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

[dxbc] implemented retc instructions (#140)

This commit is contained in:
Mikhail Paulyshka 2018-03-10 17:04:58 +03:00 committed by Philip Rebohle
parent 28880d0fa8
commit 3dad074fc4
2 changed files with 33 additions and 0 deletions

View File

@ -3421,6 +3421,33 @@ namespace dxvk {
}
void DxbcCompiler::emitControlFlowRetc(const DxbcShaderInstruction& ins) {
// Perform zero test on the first component of the condition
const DxbcRegisterValue condition = emitRegisterLoad(
ins.src[0], DxbcRegMask(true, false, false, false));
const DxbcRegisterValue zeroTest = emitRegisterZeroTest(
condition, ins.controls.zeroTest);
// We basically have to wrap this into an 'if' block
const uint32_t returnLabel = m_module.allocateId();
const uint32_t continueLabel = m_module.allocateId();
m_module.opSelectionMerge(continueLabel,
spv::SelectionControlMaskNone);
m_module.opBranchConditional(
zeroTest.id, returnLabel, continueLabel);
m_module.opLabel(returnLabel);
m_module.opReturn();
m_module.opLabel(continueLabel);
}
void DxbcCompiler::emitControlFlowDiscard(const DxbcShaderInstruction& ins) {
// Discard actually has an operand that determines
// whether or not the fragment should be discarded
@ -3488,6 +3515,9 @@ namespace dxvk {
case DxbcOpcode::Ret:
return this->emitControlFlowRet(ins);
case DxbcOpcode::Retc:
return this->emitControlFlowRetc(ins);
case DxbcOpcode::Discard:
return this->emitControlFlowDiscard(ins);

View File

@ -642,6 +642,9 @@ namespace dxvk {
void emitControlFlowRet(
const DxbcShaderInstruction& ins);
void emitControlFlowRetc(
const DxbcShaderInstruction& ins);
void emitControlFlowDiscard(
const DxbcShaderInstruction& ins);