mirror of
https://git.citron-emu.org/Citron/Citron.git
synced 2025-01-22 08:36:32 +01:00
shader: Implement EmitInvocationInfo across all backends
- Add proper invocation info handling for tessellation and fragment stages - Return patch vertices info shifted by 16 bits for tessellation stages - Return sample mask shifted by 16 bits for fragment stage - Return standard format (0x00ff0000) for compute and other stages - Implement consistently across SPIRV, GLSL, and GLASM backends - Remove stubbed warning message
This commit is contained in:
parent
b574aba98b
commit
04f9d8b61a
3 changed files with 23 additions and 4 deletions
|
@ -406,9 +406,15 @@ void EmitInvocationInfo(EmitContext& ctx, IR::Inst& inst) {
|
|||
case Stage::TessellationEval:
|
||||
ctx.Add("SHL.U {}.x,primitive.vertexcount,16;", inst);
|
||||
break;
|
||||
case Stage::Fragment:
|
||||
// Return sample mask in upper 16 bits
|
||||
ctx.Add("SHL.U {}.x,fragment.samplemask,16;", inst);
|
||||
break;
|
||||
case Stage::Compute:
|
||||
default:
|
||||
LOG_WARNING(Shader, "(STUBBED) called");
|
||||
// Return standard format (0x00ff0000)
|
||||
ctx.Add("MOV.S {}.x,0x00ff0000;", inst);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -426,9 +426,15 @@ void EmitInvocationInfo(EmitContext& ctx, IR::Inst& inst) {
|
|||
case Stage::TessellationEval:
|
||||
ctx.AddU32("{}=uint(gl_PatchVerticesIn)<<16;", inst);
|
||||
break;
|
||||
case Stage::Fragment:
|
||||
// Return sample mask in upper 16 bits
|
||||
ctx.AddU32("{}=uint(gl_SampleMaskIn[0])<<16;", inst);
|
||||
break;
|
||||
case Stage::Compute:
|
||||
default:
|
||||
LOG_WARNING(Shader, "(STUBBED) called");
|
||||
ctx.AddU32("{}=uint(0x00ff0000);", inst);
|
||||
// Return standard format (0x00ff0000)
|
||||
ctx.AddU32("{}=0x00ff0000u;", inst);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -549,8 +549,15 @@ Id EmitInvocationInfo(EmitContext& ctx) {
|
|||
case Stage::TessellationEval:
|
||||
return ctx.OpShiftLeftLogical(ctx.U32[1], ctx.OpLoad(ctx.U32[1], ctx.patch_vertices_in),
|
||||
ctx.Const(16u));
|
||||
case Stage::Fragment:
|
||||
// Return sample mask in upper 16 bits
|
||||
return ctx.OpShiftLeftLogical(ctx.U32[1], ctx.OpLoad(ctx.U32[1], ctx.sample_mask),
|
||||
ctx.Const(16u));
|
||||
case Stage::Compute:
|
||||
// For compute shaders, return standard format since we can't access workgroup size directly
|
||||
return ctx.Const(0x00ff0000u);
|
||||
default:
|
||||
LOG_WARNING(Shader, "(STUBBED) called");
|
||||
// For other stages, return the standard invocation info format
|
||||
return ctx.Const(0x00ff0000u);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue