From 6c858dab2ca3054af44ef3d3dfd14c6a74e8a483 Mon Sep 17 00:00:00 2001 From: boykopovar Date: Wed, 7 Oct 2026 18:48:28 +0300 Subject: [PATCH] fix(shader): validate unsupported sRGB sampling and SINT d16 writes at materialization --- .../recompiler/Optimization/src/ResourceMaterializer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp b/core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp index 34df285c3..9c2f03cf9 100644 --- a/core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp +++ b/core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp @@ -170,6 +170,9 @@ DecodedImage decodeImageDescriptor(const DescriptorValue& descriptor, const Imag } decoded.conversionFormat = RemapTextureFormat(format) != format ? format : IrBufferFormat::Invalid; decoded.srgbDecode = !storage && (srgbDecodeFormats & SrgbDecodeBit(format)) != 0u; + if (decoded.srgbDecode && !base.srgbDecodeCompatible) { + throw std::runtime_error("samples or gathers an sRGB image the device cannot sample, which is not implemented"); + } if (storage || decoded.conversionFormat != IrBufferFormat::Invalid) { decoded.shaderSwizzle = descriptorImageSwizzle(descriptor); } @@ -192,6 +195,7 @@ DecodedImage decodeImageDescriptor(const DescriptorValue& descriptor, const Imag decoded.numericClass = IrTextureNumericClass::Uint; } if ((rawSintStorage || (base.atomic && format == IrBufferFormat::Format32SInt)) && !base.packed) { + if (!base.depthBitsCompatible) throw std::runtime_error("stores 16-bit data to an image of a SINT format"); decoded.conversionFormat = format; } } else if (decoded.numericClass == IrTextureNumericClass::Unsupported || (base.depthCompare && decoded.numericClass != IrTextureNumericClass::Float)) {