mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 11:52:12 +01:00
[dxbc] Implemented continue instructions
This commit is contained in:
parent
660ac25b18
commit
b968aa0472
@ -2148,11 +2148,28 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxbcCompiler::emitControlFlowBreakc(const DxbcShaderInstruction& ins) {
|
void DxbcCompiler::emitControlFlowBreak(const DxbcShaderInstruction& ins) {
|
||||||
|
const bool isBreak = ins.op == DxbcOpcode::Break;
|
||||||
|
|
||||||
DxbcCfgBlock* loopBlock = cfgFindLoopBlock();
|
DxbcCfgBlock* loopBlock = cfgFindLoopBlock();
|
||||||
|
|
||||||
if (loopBlock == nullptr)
|
if (loopBlock == nullptr)
|
||||||
throw DxvkError("DxbcCompiler: 'Breakc' outside 'Loop' found");
|
throw DxvkError("DxbcCompiler: 'Break' or 'Continue' outside 'Loop' found");
|
||||||
|
|
||||||
|
m_module.opBranch(isBreak
|
||||||
|
? loopBlock->b_loop.labelBreak
|
||||||
|
: loopBlock->b_loop.labelContinue);
|
||||||
|
m_module.opLabel (m_module.allocateId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DxbcCompiler::emitControlFlowBreakc(const DxbcShaderInstruction& ins) {
|
||||||
|
const bool isBreak = ins.op == DxbcOpcode::Breakc;
|
||||||
|
|
||||||
|
DxbcCfgBlock* loopBlock = cfgFindLoopBlock();
|
||||||
|
|
||||||
|
if (loopBlock == nullptr)
|
||||||
|
throw DxvkError("DxbcCompiler: 'Breakc' or 'Continuec' outside 'Loop' found");
|
||||||
|
|
||||||
// Perform zero test on the first component of the condition
|
// Perform zero test on the first component of the condition
|
||||||
const DxbcRegisterValue condition = emitRegisterLoad(
|
const DxbcRegisterValue condition = emitRegisterLoad(
|
||||||
@ -2172,7 +2189,9 @@ namespace dxvk {
|
|||||||
zeroTest.id, breakBlock, mergeBlock);
|
zeroTest.id, breakBlock, mergeBlock);
|
||||||
|
|
||||||
m_module.opLabel(breakBlock);
|
m_module.opLabel(breakBlock);
|
||||||
m_module.opBranch(loopBlock->b_loop.labelBreak);
|
m_module.opBranch(isBreak
|
||||||
|
? loopBlock->b_loop.labelBreak
|
||||||
|
: loopBlock->b_loop.labelContinue);
|
||||||
|
|
||||||
m_module.opLabel(mergeBlock);
|
m_module.opLabel(mergeBlock);
|
||||||
}
|
}
|
||||||
@ -2229,7 +2248,12 @@ namespace dxvk {
|
|||||||
case DxbcOpcode::EndLoop:
|
case DxbcOpcode::EndLoop:
|
||||||
return this->emitControlFlowEndLoop(ins);
|
return this->emitControlFlowEndLoop(ins);
|
||||||
|
|
||||||
|
case DxbcOpcode::Break:
|
||||||
|
case DxbcOpcode::Continue:
|
||||||
|
return this->emitControlFlowBreak(ins);
|
||||||
|
|
||||||
case DxbcOpcode::Breakc:
|
case DxbcOpcode::Breakc:
|
||||||
|
case DxbcOpcode::Continuec:
|
||||||
return this->emitControlFlowBreakc(ins);
|
return this->emitControlFlowBreakc(ins);
|
||||||
|
|
||||||
case DxbcOpcode::Ret:
|
case DxbcOpcode::Ret:
|
||||||
|
@ -427,6 +427,9 @@ namespace dxvk {
|
|||||||
void emitControlFlowEndLoop(
|
void emitControlFlowEndLoop(
|
||||||
const DxbcShaderInstruction& ins);
|
const DxbcShaderInstruction& ins);
|
||||||
|
|
||||||
|
void emitControlFlowBreak(
|
||||||
|
const DxbcShaderInstruction& ins);
|
||||||
|
|
||||||
void emitControlFlowBreakc(
|
void emitControlFlowBreakc(
|
||||||
const DxbcShaderInstruction& ins);
|
const DxbcShaderInstruction& ins);
|
||||||
|
|
||||||
|
@ -148,6 +148,10 @@ namespace dxvk {
|
|||||||
m_instruction.sampleControls.w = aoffimmi.w;
|
m_instruction.sampleControls.w = aoffimmi.w;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
case DxbcExtOpcode::ResourceDim:
|
||||||
|
case DxbcExtOpcode::ResourceReturnType:
|
||||||
|
break; // part of resource description
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Logger::warn(str::format(
|
Logger::warn(str::format(
|
||||||
"DxbcDecodeContext: Unhandled extended opcode: ",
|
"DxbcDecodeContext: Unhandled extended opcode: ",
|
||||||
|
@ -30,7 +30,9 @@ namespace dxvk {
|
|||||||
{ DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
|
{ DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
|
||||||
} },
|
} },
|
||||||
/* Case */
|
/* Case */
|
||||||
{ },
|
{ 1, DxbcInstClass::ControlFlow, {
|
||||||
|
{ DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
|
||||||
|
} },
|
||||||
/* Continue */
|
/* Continue */
|
||||||
{ 0, DxbcInstClass::ControlFlow },
|
{ 0, DxbcInstClass::ControlFlow },
|
||||||
/* Continuec */
|
/* Continuec */
|
||||||
@ -90,7 +92,7 @@ namespace dxvk {
|
|||||||
/* EndLoop */
|
/* EndLoop */
|
||||||
{ 0, DxbcInstClass::ControlFlow },
|
{ 0, DxbcInstClass::ControlFlow },
|
||||||
/* EndSwitch */
|
/* EndSwitch */
|
||||||
{ },
|
{ 0, DxbcInstClass::ControlFlow },
|
||||||
/* Eq */
|
/* Eq */
|
||||||
{ 3, DxbcInstClass::VectorCmp, {
|
{ 3, DxbcInstClass::VectorCmp, {
|
||||||
{ DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
|
{ DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
|
||||||
@ -371,7 +373,9 @@ namespace dxvk {
|
|||||||
{ DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
|
{ DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
|
||||||
} },
|
} },
|
||||||
/* Switch */
|
/* Switch */
|
||||||
{ },
|
{ 1, DxbcInstClass::ControlFlow, {
|
||||||
|
{ DxbcOperandKind::SrcReg, DxbcScalarType::Uint32 },
|
||||||
|
} },
|
||||||
/* SinCos */
|
/* SinCos */
|
||||||
{ 3, DxbcInstClass::VectorSinCos, {
|
{ 3, DxbcInstClass::VectorSinCos, {
|
||||||
{ DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
|
{ DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user