diff --git a/src/dxbc/dxbc_compiler.cpp b/src/dxbc/dxbc_compiler.cpp index fe203689..cfa1a835 100644 --- a/src/dxbc/dxbc_compiler.cpp +++ b/src/dxbc/dxbc_compiler.cpp @@ -1324,6 +1324,11 @@ namespace dxvk { typeId, src.at(0).id); break; + case DxbcOpcode::BfRev: + dst.id = m_module.opBitReverse( + typeId, src.at(0).id); + break; + /////////////////////////// // Conversion instructions case DxbcOpcode::ItoF: diff --git a/src/dxbc/dxbc_defs.cpp b/src/dxbc/dxbc_defs.cpp index 323f3b6a..9e9dd384 100644 --- a/src/dxbc/dxbc_defs.cpp +++ b/src/dxbc/dxbc_defs.cpp @@ -693,7 +693,10 @@ namespace dxvk { { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 }, } }, /* BfRev */ - { }, + { 2, DxbcInstClass::VectorAlu, { + { DxbcOperandKind::DstReg, DxbcScalarType::Uint32 }, + { DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 }, + } }, /* Swapc */ { 5, DxbcInstClass::VectorCmov, { { DxbcOperandKind::DstReg, DxbcScalarType::Float32 }, diff --git a/src/spirv/spirv_module.cpp b/src/spirv/spirv_module.cpp index 3de4dbac..dd436723 100644 --- a/src/spirv/spirv_module.cpp +++ b/src/spirv/spirv_module.cpp @@ -946,6 +946,19 @@ namespace dxvk { } + uint32_t SpirvModule::opBitReverse( + uint32_t resultType, + uint32_t operand) { + uint32_t resultId = this->allocateId(); + + m_code.putIns (spv::OpBitReverse, 4); + m_code.putWord(resultType); + m_code.putWord(resultId); + m_code.putWord(operand); + return resultId; + } + + uint32_t SpirvModule::opFindILsb( uint32_t resultType, uint32_t operand) { diff --git a/src/spirv/spirv_module.h b/src/spirv/spirv_module.h index c036c6ea..68bc7f58 100644 --- a/src/spirv/spirv_module.h +++ b/src/spirv/spirv_module.h @@ -381,6 +381,10 @@ namespace dxvk { uint32_t resultType, uint32_t operand); + uint32_t opBitReverse( + uint32_t resultType, + uint32_t operand); + uint32_t opFindILsb( uint32_t resultType, uint32_t operand);