mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[dxbc] Implemented Rsq instruction
This commit is contained in:
parent
4a3b04f605
commit
9acc9bf3e0
@ -62,6 +62,9 @@ namespace dxvk {
|
||||
case DxbcOpcode::Dp4:
|
||||
return this->opDpx(ins, 4);
|
||||
|
||||
case DxbcOpcode::Rsq:
|
||||
return this->opRsq(ins);
|
||||
|
||||
case DxbcOpcode::Ret:
|
||||
return this->opRet(ins);
|
||||
|
||||
@ -262,6 +265,17 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void DxbcCompiler::opRsq(const DxbcInstruction& ins) {
|
||||
auto dstOp = ins.operand(0);
|
||||
auto srcOp = ins.operand(dstOp.length());
|
||||
DxbcComponentMask mask = this->getDstOperandMask(dstOp);
|
||||
|
||||
DxbcValue src = this->loadOperand(srcOp, mask, DxbcScalarType::Float32);
|
||||
DxbcValue val = m_gen->opRsqrt(src);
|
||||
val = this->applyResultModifiers(val, ins.token().control());
|
||||
this->storeOperand(dstOp, val, mask);
|
||||
}
|
||||
|
||||
void DxbcCompiler::opMov(const DxbcInstruction& ins) {
|
||||
auto dstOp = ins.operand(0);
|
||||
auto srcOp = ins.operand(dstOp.length());
|
||||
|
@ -57,6 +57,9 @@ namespace dxvk {
|
||||
const DxbcInstruction& ins,
|
||||
uint32_t n);
|
||||
|
||||
void opRsq(
|
||||
const DxbcInstruction& ins);
|
||||
|
||||
void opMov(
|
||||
const DxbcInstruction& ins);
|
||||
|
||||
|
@ -354,6 +354,16 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
DxbcValue DxbcCodeGen::opRsqrt(const DxbcValue& src) {
|
||||
DxbcValue result;
|
||||
result.type = src.type;
|
||||
result.valueId = m_module.opInverseSqrt(
|
||||
this->defValueType(result.type),
|
||||
src.valueId);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
DxbcValue DxbcCodeGen::opNeg(const DxbcValue& src) {
|
||||
DxbcValue result;
|
||||
result.type = src.type;
|
||||
|
@ -118,6 +118,9 @@ namespace dxvk {
|
||||
const DxbcValue& a,
|
||||
const DxbcValue& b);
|
||||
|
||||
DxbcValue opRsqrt(
|
||||
const DxbcValue& src);
|
||||
|
||||
DxbcValue opNeg(
|
||||
const DxbcValue& src);
|
||||
|
||||
|
@ -786,6 +786,21 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
uint32_t SpirvModule::opInverseSqrt(
|
||||
uint32_t resultType,
|
||||
uint32_t x) {
|
||||
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::GLSLstd450InverseSqrt);
|
||||
m_code.putWord(x);
|
||||
return resultId;
|
||||
}
|
||||
|
||||
|
||||
uint32_t SpirvModule::opFunctionCall(
|
||||
uint32_t resultType,
|
||||
uint32_t functionId,
|
||||
|
@ -281,6 +281,10 @@ namespace dxvk {
|
||||
uint32_t vector1,
|
||||
uint32_t vector2);
|
||||
|
||||
uint32_t opInverseSqrt(
|
||||
uint32_t resultType,
|
||||
uint32_t x);
|
||||
|
||||
uint32_t opFunctionCall(
|
||||
uint32_t resultType,
|
||||
uint32_t functionId,
|
||||
|
Loading…
x
Reference in New Issue
Block a user