SPIR-V: Don't OpReturn if we already OpExit'ed

Fixes spir-v parse failure and stack smashing in RADV (obviously you still need bolist)
This commit is contained in:
riperiperi 2022-03-07 21:41:27 +00:00
parent c1517e5ee3
commit cbeb40934f

View file

@ -137,7 +137,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
Generate(context, function.MainBlock);
// Functions must always end with a return.
if (!(function.MainBlock.Last is AstOperation operation) || operation.Inst != Instruction.Return)
if (!(function.MainBlock.Last is AstOperation operation) ||
(operation.Inst != Instruction.Return && operation.Inst != Instruction.Discard))
{
context.Return();
}