mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-03 04:24:11 +01:00
[dxbc] Fix invalid SPIR-V for FirstBitHi / FirstBitShi on vectors
Refs #930.
This commit is contained in:
parent
d12a8e09a8
commit
6d814b24da
@ -2607,13 +2607,19 @@ namespace dxvk {
|
||||
|
||||
// The 'Hi' variants are counted from the MSB in DXBC
|
||||
// rather than the LSB, so we have to invert the number
|
||||
if (ins.op == DxbcOpcode::FirstBitHi
|
||||
|| ins.op == DxbcOpcode::FirstBitShi) {
|
||||
if (ins.op == DxbcOpcode::FirstBitHi || ins.op == DxbcOpcode::FirstBitShi) {
|
||||
uint32_t boolTypeId = m_module.defBoolType();
|
||||
|
||||
if (dst.type.ccount > 1)
|
||||
boolTypeId = m_module.defVectorType(boolTypeId, dst.type.ccount);
|
||||
|
||||
DxbcRegisterValue const31 = emitBuildConstVecu32(31u, 31u, 31u, 31u, ins.dst[0].mask);
|
||||
DxbcRegisterValue constff = emitBuildConstVecu32(~0u, ~0u, ~0u, ~0u, ins.dst[0].mask);
|
||||
|
||||
dst.id = m_module.opSelect(typeId,
|
||||
m_module.opINotEqual(m_module.defBoolType(),
|
||||
dst.id, m_module.constu32(0xFFFFFFFF)),
|
||||
m_module.opISub(typeId, m_module.constu32(31), dst.id),
|
||||
m_module.constu32(0xFFFFFFFF));
|
||||
m_module.opINotEqual(boolTypeId, dst.id, constff.id),
|
||||
m_module.opISub(typeId, const31.id, dst.id),
|
||||
constff.id);
|
||||
}
|
||||
|
||||
// No modifiers are supported
|
||||
|
Loading…
Reference in New Issue
Block a user