[dxbc] Correctly report a size of 0 for unbound buffers

This commit is contained in:
Philip Rebohle 2019-04-29 10:14:11 +02:00
parent ad5da34c57
commit 18cbaefdcb
1 changed files with 9 additions and 2 deletions

View File

@ -2626,7 +2626,6 @@ namespace dxvk {
// bufinfo takes two arguments
// (dst0) The destination register
// (src0) The buffer register to query
// TODO Check if resource is bound
const DxbcBufferInfo bufferInfo = getBufferInfo(ins.src[0]);
bool isSsbo = m_moduleInfo.options.useRawSsbo
@ -2649,7 +2648,7 @@ namespace dxvk {
result.id = m_module.opUDiv(typeId, result.id,
m_module.constu32(bufferInfo.stride / 4));
}
// Store the result. The scalar will be extended to a
// vector if the write mask consists of more than one
// component, which is the desired behaviour.
@ -4988,6 +4987,10 @@ namespace dxvk {
result.id = m_module.opArrayLength(
getVectorTypeId(result.type),
bufferInfo.varId, 0);
// Report a size of 0 if resource is not bound
result.id = m_module.opSelect(getVectorTypeId(result.type),
bufferInfo.specId, result.id, m_module.constu32(0));
return result;
}
@ -5007,6 +5010,10 @@ namespace dxvk {
result.type.ccount = 1;
result.id = m_module.opImageQuerySize(
getVectorTypeId(result.type), bufferId);
// Report a size of 0 if resource is not bound
result.id = m_module.opSelect(getVectorTypeId(result.type),
bufferInfo.specId, result.id, m_module.constu32(0));
return result;
}