[spirv] Implement opInverse, opNormalize and opLength

This commit is contained in:
Joshua Ashton 2019-08-04 00:01:46 +01:00 committed by Philip Rebohle
parent edf0661994
commit fdbfb2c92d
2 changed files with 57 additions and 0 deletions

View File

@ -1974,6 +1974,21 @@ namespace dxvk {
}
uint32_t SpirvModule::opInverse(
uint32_t resultType,
uint32_t matrix) {
uint32_t resultId = this->allocateId();
m_code.putIns(spv::OpExtInst, 6);
m_code.putWord(resultType);
m_code.putWord(resultId);
m_code.putWord(m_instExtGlsl450);
m_code.putWord(spv::GLSLstd450MatrixInverse);
m_code.putWord(matrix);
return resultId;
}
uint32_t SpirvModule::opFFma(
uint32_t resultType,
uint32_t a,
@ -2553,6 +2568,36 @@ namespace dxvk {
m_code.putWord(operand);
return resultId;
}
uint32_t SpirvModule::opNormalize(
uint32_t resultType,
uint32_t operand) {
uint32_t resultId = this->allocateId();
m_code.putIns (spv::OpExtInst, 6);
m_code.putWord(resultType);
m_code.putWord(resultId);
m_code.putWord(m_instExtGlsl450);
m_code.putWord(spv::GLSLstd450Normalize);
m_code.putWord(operand);
return resultId;
}
uint32_t SpirvModule::opLength(
uint32_t resultType,
uint32_t operand) {
uint32_t resultId = this->allocateId();
m_code.putIns (spv::OpExtInst, 6);
m_code.putWord(resultType);
m_code.putWord(resultId);
m_code.putWord(m_instExtGlsl450);
m_code.putWord(spv::GLSLstd450Length);
m_code.putWord(operand);
return resultId;
}
uint32_t SpirvModule::opExp2(

View File

@ -711,6 +711,10 @@ namespace dxvk {
uint32_t opTranspose(
uint32_t resultType,
uint32_t matrix);
uint32_t opInverse(
uint32_t resultType,
uint32_t matrix);
uint32_t opFFma(
uint32_t resultType,
@ -894,6 +898,14 @@ namespace dxvk {
uint32_t opInverseSqrt(
uint32_t resultType,
uint32_t operand);
uint32_t opNormalize(
uint32_t resultType,
uint32_t operand);
uint32_t opLength(
uint32_t resultType,
uint32_t operand);
uint32_t opExp2(
uint32_t resultType,