mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-09 15:45:40 +12:00
Shader decompiler: Add support for compilation errors
This commit is contained in:
parent
37a43e245f
commit
ca2d7e40ea
2 changed files with 14 additions and 1 deletions
|
@ -99,6 +99,7 @@ namespace PICA::ShaderGen {
|
|||
|
||||
API api;
|
||||
Language language;
|
||||
bool compilationError = false;
|
||||
|
||||
void compileInstruction(u32& pc, bool& finished);
|
||||
// Compile range "range" and returns the end PC or if we're "finished" with the program (called an END instruction)
|
||||
|
|
|
@ -247,6 +247,7 @@ std::string ShaderDecompiler::decompile() {
|
|||
return "";
|
||||
}
|
||||
|
||||
compilationError = false;
|
||||
decompiledShader = "";
|
||||
|
||||
switch (api) {
|
||||
|
@ -324,6 +325,13 @@ std::string ShaderDecompiler::decompile() {
|
|||
}
|
||||
}
|
||||
|
||||
// We allow some leeway for "compilation errors" in addition to control flow errors, in cases where eg an unimplemented instruction
|
||||
// or an instruction that we can't emulate in GLSL is found in the instruction stream. Just like control flow errors, these return an empty string
|
||||
// and the renderer core will decide to use CPU shaders instead
|
||||
if (compilationError) [[unlikely]] {
|
||||
return "";
|
||||
}
|
||||
|
||||
return decompiledShader;
|
||||
}
|
||||
|
||||
|
@ -707,7 +715,11 @@ void ShaderDecompiler::compileInstruction(u32& pc, bool& finished) {
|
|||
return;
|
||||
|
||||
case ShaderOpcodes::NOP: break;
|
||||
default: Helpers::panic("GLSL recompiler: Unknown opcode: %X", opcode); break;
|
||||
|
||||
default:
|
||||
Helpers::warn("GLSL recompiler: Unknown opcode: %X. Falling back to CPU shaders", opcode);
|
||||
compilationError = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue