mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-15 19:19:58 -04:00
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>
34 lines
1.3 KiB
Plaintext
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);
|
|
}
|