Make the shader translator more error resilient

This commit is contained in:
gdk 2019-11-15 00:01:54 -03:00 committed by Thog
parent eea73bc421
commit 04102e5c9d
3 changed files with 49 additions and 19 deletions

View file

@ -105,13 +105,16 @@ namespace Ryujinx.Graphics.Shader.Translation
{
BasicBlock[] irBlocks = ControlFlowGraph.MakeCfg(ops);
Dominance.FindDominators(irBlocks[0], irBlocks.Length);
if (irBlocks.Length > 0)
{
Dominance.FindDominators(irBlocks[0], irBlocks.Length);
Dominance.FindDominanceFrontiers(irBlocks);
Dominance.FindDominanceFrontiers(irBlocks);
Ssa.Rename(irBlocks);
Ssa.Rename(irBlocks);
Optimizer.Optimize(irBlocks, config.Stage);
Optimizer.Optimize(irBlocks, config.Stage);
}
StructuredProgramInfo sInfo = StructuredProgram.MakeStructuredProgram(irBlocks, config);
@ -158,6 +161,13 @@ namespace Ryujinx.Graphics.Shader.Translation
context = new EmitterContext(header.Stage, header);
}
if (cfg == null)
{
size = 0;
return new Operation[0];
}
ulong maxEndAddress = 0;
for (int blkIndex = 0; blkIndex < cfg.Length; blkIndex++)