blob: 4a66e5285cd3c48588dbeadea005112ca1366e1f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#pragma once
#include "dxvk_hash.h"
#include "dxvk_include.h"
namespace dxvk {
/**
* \brief Shader key
*
* Provides a unique key that can be used
* to look up a specific shader within a
* structure. This consists of the shader
* stage and the source hash, which should
* be generated from the original code.
*/
class DxvkShaderKey {
public:
/**
* \brief Creates default shader key
*/
DxvkShaderKey();
/**
* \brief Creates shader key
*
* \param [in] stage Shader stage
* \param [in] hash Shader hash
*/
DxvkShaderKey(
VkShaderStageFlagBits stage,
Sha1Hash hash)
: m_type(stage), m_sha1(hash) { }
/**
* \brief Generates string from shader key
* \returns String representation of the key
*/
std::string toString() const;
/**
* \brief Computes lookup hash
* \returns Lookup hash
*/
size_t hash() const;
/**
* \brief Shader type
* \returns Shader type
*/
VkShaderStageFlags type() const { return m_type; }
/**
* \brief Shader SHA1
* \returns Shader SHA1
*/
const Sha1Hash& sha1() const { return m_sha1; }
/**
* \brief Checks whether two keys are equal
*
* \param [in] key The shader key to compare to
* \returns \c true if the two keys are equal
*/
bool eq(const DxvkShaderKey& key) const;
private:
VkShaderStageFlags m_type;
Sha1Hash m_sha1;
};
}
|