Files
NX2navi/runtime/shaders/meshfb_probe_t.task
chrg6 b1408ee371 Add --probe-meshfb, which draws mesh programs through the mesh pipeline and through the fallback and compares the pictures.
The probe's programs are written in the shape the translator gives a task or mesh program and need no game files.
With a folder of game translations it converts those instead and builds their compute pipelines.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-11 05:58:43 -05:00

34 lines
1.3 KiB
Plaintext

#version 460
#extension GL_EXT_mesh_shader : require
// build_shaders: keep functions
//
// --probe-meshfb (mesh_fb_probe.c): a task program in the shape the translator gives one (tools/xlate/MeshSpirv.cs):
// the program writes its payload into shared memory, and the entry function copies that out and starts the mesh
// workgroups the program counted into word 1. The payload is 288 bytes: the header, then the program's data from
// word 4.
//
// Task workgroup t starts 0 to 4 mesh workgroups (the uniform block shifts which tasks start how many) and tells each
// the grid cell it draws; the last payload word carries a mark the mesh program checks.
layout(local_size_x = 32) in;
layout(set = 0, binding = 1) uniform Params { uvec4 shift; } u;
shared uint mem[72];
taskPayloadSharedEXT uint payload[72];
void program() {
uint tid = gl_LocalInvocationIndex, t = gl_WorkGroupID.x;
uint count = (t * 3u + u.shift.x) % 5u;
if (tid == 0u) mem[1] = count;
if (tid < count) mem[4u + tid] = t * 4u + tid;
if (tid == 31u) mem[71] = 0x600df00du + t;
}
void main() {
uint tid = gl_LocalInvocationIndex;
if (tid < 1u) mem[1] = 0u;
barrier();
program();
barrier();
for (uint i = tid; i < 72u; i += 32u) payload[i] = mem[i];
EmitMeshTasksEXT(min(mem[1], 32u), 1u, 1u);
}