Files
reims-vgpu/guest/bundle/tools/samplepos_probe.metal
T
Anees Iqbal 9f5f93e90b ✅ Probe sample positions against Metal's in the guest
samplepos_probe draws a triangle whose edge halves a pixel of a 4-sample
target, so the resolved pixel shows which of its samples the pass's positions
put left of the edge: four left, four right, Metal's defaults (two of four),
and the left set again with a depth attachment whose store action and options
the encoder sets. It also prints the device's default positions and sample
counts. Each value it checks is the M3 Max's on macOS 27, measured with the
same probe, so a guest run says whether the lane draws as Metal does.
2026-11-05 21:58:32 -08:00

23 lines
592 B
Metal

// samplepos_probe's shaders (samplepos_probe.m): one triangle whose right edge is the vertical
// line x = 1.5 pixels of a 4 x 4 target, so pixel column 1's coverage is the share of its samples
// left of the pixel's centre, and a flat red.
#include <metal_stdlib>
using namespace metal;
struct V {
float4 p [[position]];
};
vertex V samplepos_vertex(uint i [[vertex_id]])
{
const float2 at[3] = {float2(-3.0, 0.0), float2(-0.25, -3.0), float2(-0.25, 3.0)};
V o;
o.p = float4(at[i], 0.5, 1.0);
return o;
}
fragment float4 samplepos_fragment()
{
return float4(1.0, 0.0, 0.0, 1.0);
}