mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-26 09:02:44 -06:00
gl_shader_decompiler: fallback to CPU shader on GS b15 access
This commit is contained in:
parent
c8d4ca8915
commit
e56128683c
1 changed files with 6 additions and 3 deletions
|
@ -345,8 +345,11 @@ private:
|
||||||
/// Generates code representing a bool uniform
|
/// Generates code representing a bool uniform
|
||||||
std::string GetUniformBool(u32 index) const {
|
std::string GetUniformBool(u32 index) const {
|
||||||
if (is_gs && index == 15) {
|
if (is_gs && index == 15) {
|
||||||
// The uniform b15 is set to true after every geometry shader invocation.
|
// In PICA geometry shader, b15 is set to true after every geometry shader invocation.
|
||||||
return "((gl_PrimitiveIDIn == 0) || uniforms.b[15])";
|
// Accessing b15 usually indicates that the program relies on register value
|
||||||
|
// preservation across invocation (and therefore it uses b15 to determine whether to
|
||||||
|
// initialize the registers), which cannot be implemented in GL shaders.
|
||||||
|
throw DecompileFail("b15 access in geometry shader");
|
||||||
}
|
}
|
||||||
return "uniforms.b[" + std::to_string(index) + "]";
|
return "uniforms.b[" + std::to_string(index) + "]";
|
||||||
}
|
}
|
||||||
|
@ -918,7 +921,7 @@ boost::optional<std::string> DecompileProgram(const ProgramCode& program_code,
|
||||||
inputreg_getter, outputreg_getter, sanitize_mul, is_gs);
|
inputreg_getter, outputreg_getter, sanitize_mul, is_gs);
|
||||||
return generator.MoveShaderCode();
|
return generator.MoveShaderCode();
|
||||||
} catch (const DecompileFail& exception) {
|
} catch (const DecompileFail& exception) {
|
||||||
LOG_ERROR(HW_GPU, "Shader decompilation failed: %s", exception.what());
|
LOG_INFO(HW_GPU, "Shader decompilation failed: %s", exception.what());
|
||||||
return boost::none;
|
return boost::none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue