Fix thread_index_in_simdgroup outside of compute

This commit is contained in:
Isaac Marovitz 2024-06-22 13:15:23 +01:00
commit 15e4d4e891
No known key found for this signature in database
GPG key ID: 97250B2B09A132E1

View file

@ -80,6 +80,14 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
context.AppendLine("FragmentOut out;"); context.AppendLine("FragmentOut out;");
break; break;
} }
// TODO: Only add if necessary
if (stage != ShaderStage.Compute)
{
// MSL does not give us access to [[thread_index_in_simdgroup]]
// outside compute. But we may still need to provide this value in frag/vert.
context.AppendLine("uint thread_index_in_simdgroup = simd_prefix_exclusive_sum(1);");
}
} }
foreach (AstOperand decl in function.Locals) foreach (AstOperand decl in function.Locals)