mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-01 07:24:12 +01:00
[dxbc] implemented retc instructions (#140)
This commit is contained in:
parent
28880d0fa8
commit
3dad074fc4
@ -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) {
|
void DxbcCompiler::emitControlFlowDiscard(const DxbcShaderInstruction& ins) {
|
||||||
// Discard actually has an operand that determines
|
// Discard actually has an operand that determines
|
||||||
// whether or not the fragment should be discarded
|
// whether or not the fragment should be discarded
|
||||||
@ -3488,6 +3515,9 @@ namespace dxvk {
|
|||||||
case DxbcOpcode::Ret:
|
case DxbcOpcode::Ret:
|
||||||
return this->emitControlFlowRet(ins);
|
return this->emitControlFlowRet(ins);
|
||||||
|
|
||||||
|
case DxbcOpcode::Retc:
|
||||||
|
return this->emitControlFlowRetc(ins);
|
||||||
|
|
||||||
case DxbcOpcode::Discard:
|
case DxbcOpcode::Discard:
|
||||||
return this->emitControlFlowDiscard(ins);
|
return this->emitControlFlowDiscard(ins);
|
||||||
|
|
||||||
|
@ -642,6 +642,9 @@ namespace dxvk {
|
|||||||
void emitControlFlowRet(
|
void emitControlFlowRet(
|
||||||
const DxbcShaderInstruction& ins);
|
const DxbcShaderInstruction& ins);
|
||||||
|
|
||||||
|
void emitControlFlowRetc(
|
||||||
|
const DxbcShaderInstruction& ins);
|
||||||
|
|
||||||
void emitControlFlowDiscard(
|
void emitControlFlowDiscard(
|
||||||
const DxbcShaderInstruction& ins);
|
const DxbcShaderInstruction& ins);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user