fix(shader): preserve comparison image flags in disk cache

This commit is contained in:
SamG-Coder 2026-10-01 20:36:28 +10:00
parent 7bcde3ba95
commit dfdbeae901
3 changed files with 6 additions and 3 deletions

View File

@ -31,7 +31,7 @@ void setEnvironment(const char* name, const std::string& value) {
}
bool sameBinding(const DescriptorBinding& left, const DescriptorBinding& right) {
return left.kind == right.kind && left.role == right.role && left.descriptorSet == right.descriptorSet && left.binding == right.binding && left.count == right.count && left.guestDescriptor == right.guestDescriptor && left.readOnly == right.readOnly && left.imageShape == right.imageShape && left.samplerDepthCompare == right.samplerDepthCompare && left.imageWritten == right.imageWritten && left.bufferAtomic == right.bufferAtomic && left.bufferWritten == right.bufferWritten;
return left.kind == right.kind && left.role == right.role && left.descriptorSet == right.descriptorSet && left.binding == right.binding && left.count == right.count && left.guestDescriptor == right.guestDescriptor && left.readOnly == right.readOnly && left.imageShape == right.imageShape && left.samplerDepthCompare == right.samplerDepthCompare && left.imageWritten == right.imageWritten && left.imageDepthCompare == right.imageDepthCompare && left.bufferAtomic == right.bufferAtomic && left.bufferWritten == right.bufferWritten;
}
bool sameBindings(const std::vector<DescriptorBinding>& left, const std::vector<DescriptorBinding>& right) {
@ -90,6 +90,7 @@ DescriptorBinding sampleBinding(std::uint32_t seed) {
binding.readOnly = seed % 2 == 0;
binding.imageShape = DescriptorImageShape::Image2DArray;
binding.samplerDepthCompare = {true, false, true};
binding.imageDepthCompare = {false, true, false};
binding.imageWritten = {false, true, true};
binding.bufferAtomic = {true};
binding.bufferWritten = {false, false, true, true, false};

View File

@ -63,7 +63,7 @@ namespace ShaderRecompiler::ShaderDiskCache {
#if defined(__linux__) && defined(__x86_64__) && defined(__GLIBCXX__)
static_assert(sizeof(RecompileResult) == 176, "RecompileResult changed: update EncodeResult and DecodeResult");
static_assert(sizeof(DescriptorBinding) == 224, "DescriptorBinding changed: update the binding encoder");
static_assert(sizeof(DescriptorBinding) == 264, "DescriptorBinding changed: update the binding encoder");
static_assert(sizeof(VertexAttribute) == 28, "VertexAttribute changed: update the attribute encoder");
static_assert(sizeof(FragmentParameter) == 12, "FragmentParameter changed: update the parameter encoder");
static_assert(sizeof(CompiledShaderInfo) == 304, "CompiledShaderInfo changed: update the info encoder");
@ -246,6 +246,7 @@ void encodeBinding(Writer& writer, const DescriptorBinding& binding) {
writer.Value(binding.imageShape.value_or(DescriptorImageShape::Image1D));
writer.Flags(binding.samplerDepthCompare);
writer.Flags(binding.imageWritten);
writer.Flags(binding.imageDepthCompare);
writer.Flags(binding.bufferAtomic);
writer.Flags(binding.bufferWritten);
}
@ -263,6 +264,7 @@ void decodeBinding(Reader& reader, DescriptorBinding& binding) {
binding.imageShape = hasShape ? std::optional(shape) : std::nullopt;
reader.Flags(binding.samplerDepthCompare);
reader.Flags(binding.imageWritten);
reader.Flags(binding.imageDepthCompare);
reader.Flags(binding.bufferAtomic);
reader.Flags(binding.bufferWritten);
}

View File

@ -12,7 +12,7 @@
namespace ShaderRecompiler::ShaderDiskCache {
inline constexpr std::uint32_t FormatVersion = 2;
inline constexpr std::uint32_t FormatVersion = 3;
enum class LoadStatus {
Loaded,