1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-03 13:24:20 +01:00

[dxbc] Do not emit depth compare for unsupported image types

Fixes invalid SPIR-V.
This commit is contained in:
Philip Rebohle 2024-03-07 16:10:50 +01:00
parent 707ad6f328
commit 69a52b3da0

View File

@ -3881,6 +3881,7 @@ namespace dxvk {
if (imageOperands.sparse)
resultTypeId = getSparseResultTypeId(texelTypeId);
if (sampledImageId) {
switch (ins.op) {
// Simple image gather operation
case DxbcOpcode::Gather4:
@ -3909,6 +3910,10 @@ namespace dxvk {
ins.op));
return;
}
} else {
Logger::warn(str::format("DxbcCompiler: ", ins.op, ": Unsupported image type"));
resultId = m_module.constNull(resultTypeId);
}
// If necessary, deal with the sparse result
DxbcRegisterValue result;
@ -4035,6 +4040,7 @@ namespace dxvk {
if (imageOperands.sparse)
resultTypeId = getSparseResultTypeId(texelTypeId);
if (sampledImageId) {
switch (ins.op) {
// Simple image sample operation
case DxbcOpcode::Sample:
@ -4103,6 +4109,10 @@ namespace dxvk {
ins.op));
return;
}
} else {
Logger::warn(str::format("DxbcCompiler: ", ins.op, ": Unsupported image type"));
resultId = m_module.constNull(resultTypeId);
}
DxbcRegisterValue result;
result.type = texelType;
@ -5147,9 +5157,14 @@ namespace dxvk {
const DxbcShaderResource& textureResource,
const DxbcSampler& samplerResource,
bool isDepthCompare) {
const uint32_t sampledImageType = isDepthCompare
? m_module.defSampledImageType(textureResource.depthTypeId)
: m_module.defSampledImageType(textureResource.colorTypeId);
uint32_t baseId = isDepthCompare
? textureResource.depthTypeId
: textureResource.colorTypeId;
if (!baseId)
return 0;
uint32_t sampledImageType = m_module.defSampledImageType(baseId);
return m_module.opSampledImage(sampledImageType,
m_module.opLoad(textureResource.imageTypeId, textureResource.varId),