diff --git a/src/dxbc/dxbc_compiler.cpp b/src/dxbc/dxbc_compiler.cpp index 927114a9e..98abfc8b6 100644 --- a/src/dxbc/dxbc_compiler.cpp +++ b/src/dxbc/dxbc_compiler.cpp @@ -130,7 +130,10 @@ namespace dxvk { case DxbcInstClass::NoOperation: return; - + + case DxbcInstClass::SparseCheckAccess: + return this->emitSparseCheckAccess(ins); + case DxbcInstClass::TextureQuery: return this->emitTextureQuery(ins); @@ -3048,6 +3051,27 @@ namespace dxvk { } + void DxbcCompiler::emitSparseCheckAccess( + const DxbcShaderInstruction& ins) { + // check_access_mapped has two operands: + // (dst0) The destination register + // (src0) The residency code + m_module.enableCapability(spv::CapabilitySparseResidency); + + DxbcRegisterValue srcValue = emitRegisterLoad(ins.src[0], ins.dst[0].mask); + + uint32_t boolId = m_module.opImageSparseTexelsResident( + m_module.defBoolType(), srcValue.id); + + DxbcRegisterValue dstValue; + dstValue.type = { DxbcScalarType::Uint32, 1 }; + dstValue.id = m_module.opSelect(getScalarTypeId(DxbcScalarType::Uint32), + boolId, m_module.constu32(~0u), m_module.constu32(0)); + + emitRegisterStore(ins.dst[0], dstValue); + } + + void DxbcCompiler::emitTextureQuery(const DxbcShaderInstruction& ins) { // resinfo has three operands: // (dst0) The destination register diff --git a/src/dxbc/dxbc_compiler.h b/src/dxbc/dxbc_compiler.h index 46afc8062..0a192e08e 100644 --- a/src/dxbc/dxbc_compiler.h +++ b/src/dxbc/dxbc_compiler.h @@ -709,6 +709,9 @@ namespace dxvk { void emitInterpolate( const DxbcShaderInstruction& ins); + void emitSparseCheckAccess( + const DxbcShaderInstruction& ins); + void emitTextureQuery( const DxbcShaderInstruction& ins);