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

[dxbc] Fixed bug with constant vector operands

This commit is contained in:
Philip Rebohle 2017-12-18 18:02:15 +01:00
parent 6cc3ff4ad8
commit 13d4a3d87d

View File

@ -1712,19 +1712,27 @@ namespace dxvk {
result.type.ccount = 1; result.type.ccount = 1;
result.id = m_module.constu32(reg.imm.u32_1); result.id = m_module.constu32(reg.imm.u32_1);
} else if (reg.componentCount == DxbcComponentCount::Component4) { } else if (reg.componentCount == DxbcComponentCount::Component4) {
// Create a four-component u32 vector // Create a u32 vector with as many components as needed
std::array<uint32_t, 4> indices = { std::array<uint32_t, 4> indices;
m_module.constu32(reg.imm.u32_4[0]), uint32_t indexId = 0;
m_module.constu32(reg.imm.u32_4[1]),
m_module.constu32(reg.imm.u32_4[2]), for (uint32_t i = 0; i < indices.size(); i++) {
m_module.constu32(reg.imm.u32_4[3]), if (writeMask[i]) {
}; indices.at(indexId++) =
m_module.constu32(reg.imm.u32_4[i]);
}
}
result.type.ctype = DxbcScalarType::Uint32; result.type.ctype = DxbcScalarType::Uint32;
result.type.ccount = 4; result.type.ccount = writeMask.setCount();
result.id = m_module.constComposite( result.id = indices.at(0);
getVectorTypeId(result.type),
indices.size(), indices.data()); if (indexId > 1) {
result.id = m_module.constComposite(
getVectorTypeId(result.type),
result.type.ccount, indices.data());
}
} else { } else {
// Something went horribly wrong in the decoder or the shader is broken // Something went horribly wrong in the decoder or the shader is broken
throw DxvkError("DxbcCompiler: Invalid component count for immediate operand"); throw DxvkError("DxbcCompiler: Invalid component count for immediate operand");