mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-13 19:29:14 +01:00
[dxvk] Make DxvkShaderModuleCreateInfo usable with lookup tables
This commit is contained in:
parent
9cb0d6d610
commit
32c2d91961
@ -10,6 +10,37 @@
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
bool DxvkShaderModuleCreateInfo::eq(const DxvkShaderModuleCreateInfo& other) const {
|
||||
bool eq = fsDualSrcBlend == other.fsDualSrcBlend
|
||||
&& undefinedInputs == other.undefinedInputs;
|
||||
|
||||
for (uint32_t i = 0; i < rtSwizzles.size() && eq; i++) {
|
||||
eq = rtSwizzles[i].r == other.rtSwizzles[i].r
|
||||
&& rtSwizzles[i].g == other.rtSwizzles[i].g
|
||||
&& rtSwizzles[i].b == other.rtSwizzles[i].b
|
||||
&& rtSwizzles[i].a == other.rtSwizzles[i].a;
|
||||
}
|
||||
|
||||
return eq;
|
||||
}
|
||||
|
||||
|
||||
size_t DxvkShaderModuleCreateInfo::hash() const {
|
||||
DxvkHashState hash;
|
||||
hash.add(uint32_t(fsDualSrcBlend));
|
||||
hash.add(undefinedInputs);
|
||||
|
||||
for (uint32_t i = 0; i < rtSwizzles.size(); i++) {
|
||||
hash.add(rtSwizzles[i].r);
|
||||
hash.add(rtSwizzles[i].g);
|
||||
hash.add(rtSwizzles[i].b);
|
||||
hash.add(rtSwizzles[i].a);
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
DxvkShader::DxvkShader(
|
||||
const DxvkShaderCreateInfo& info,
|
||||
SpirvCodeBuffer&& spirv)
|
||||
|
@ -66,6 +66,10 @@ namespace dxvk {
|
||||
uint32_t undefinedInputs = 0;
|
||||
|
||||
std::array<VkComponentMapping, MaxNumRenderTargets> rtSwizzles = { };
|
||||
|
||||
bool eq(const DxvkShaderModuleCreateInfo& other) const;
|
||||
|
||||
size_t hash() const;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user