mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 19:54:19 +01:00
[dxbc] Handle dead code in shader binaries
We should not emit any code when not inside a function. Fixes #3154.
This commit is contained in:
parent
c10b53ed3e
commit
5115d80d51
@ -72,6 +72,17 @@ namespace dxvk {
|
||||
m_lastOp = m_currOp;
|
||||
m_currOp = ins.op;
|
||||
|
||||
if (!m_insideFunction
|
||||
&& ins.opClass != DxbcInstClass::CustomData
|
||||
&& ins.opClass != DxbcInstClass::Declaration
|
||||
&& ins.opClass != DxbcInstClass::HullShaderPhase
|
||||
&& ins.opClass != DxbcInstClass::NoOperation
|
||||
&& ins.op != DxbcOpcode::Label) {
|
||||
if (!std::exchange(m_hasDeadCode, true))
|
||||
Logger::warn("DxbcCompiler: Dead code detected");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (ins.opClass) {
|
||||
case DxbcInstClass::Declaration:
|
||||
return this->emitDcl(ins);
|
||||
|
@ -531,6 +531,7 @@ namespace dxvk {
|
||||
//////////////////////
|
||||
// Global state stuff
|
||||
bool m_precise = true;
|
||||
bool m_hasDeadCode = false;
|
||||
|
||||
DxbcOpcode m_lastOp = DxbcOpcode::Nop;
|
||||
DxbcOpcode m_currOp = DxbcOpcode::Nop;
|
||||
|
Loading…
x
Reference in New Issue
Block a user