mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 14:31:24 +12:00
rsx: Fix rare crash in vertex program decompiler
- This whole decompiler mess needs a rewrite
This commit is contained in:
parent
cfc124fabf
commit
01fe39fbb9
1 changed files with 6 additions and 5 deletions
|
@ -362,14 +362,13 @@ std::string VertexProgramDecompiler::NotZeroPositive(const std::string& code)
|
||||||
std::string VertexProgramDecompiler::BuildCode()
|
std::string VertexProgramDecompiler::BuildCode()
|
||||||
{
|
{
|
||||||
std::string main_body;
|
std::string main_body;
|
||||||
for (uint i = 0, lvl = 1; i < m_instr_count; i++)
|
for (int i = 0, lvl = 1; i < static_cast<int>(m_instr_count); i++)
|
||||||
{
|
{
|
||||||
lvl -= m_instructions[i].close_scopes;
|
lvl = std::max<int>(lvl - m_instructions[i].close_scopes, 0);
|
||||||
if (lvl < 1) lvl = 1;
|
|
||||||
for (int j = 0; j < m_instructions[i].put_close_scopes; ++j)
|
for (int j = 0; j < m_instructions[i].put_close_scopes; ++j)
|
||||||
{
|
{
|
||||||
--lvl;
|
if (lvl > 1) --lvl;
|
||||||
if (lvl < 1) lvl = 1;
|
|
||||||
main_body.append(lvl, '\t') += "}\n";
|
main_body.append(lvl, '\t') += "}\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,6 +379,8 @@ std::string VertexProgramDecompiler::BuildCode()
|
||||||
lvl++;
|
lvl++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ensure(lvl >= 0); // Underflow of indent level will cause crashes!!
|
||||||
|
|
||||||
for (const auto& instruction_body : m_instructions[i].body)
|
for (const auto& instruction_body : m_instructions[i].body)
|
||||||
{
|
{
|
||||||
main_body.append(lvl, '\t') += instruction_body + "\n";
|
main_body.append(lvl, '\t') += instruction_body + "\n";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue