From 45e22bbf1037e7547bb2dbd40cac01a466381584 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Tue, 10 Nov 2026 05:47:17 -0800 Subject: [PATCH] Fixture rgbx_sample_half: a compute kernel's half sample through the runtime sampler at slot 0 Owned MSL; its AIR companions follow from scripts/regen-air-fixtures. (cherry picked from commit a0fa64448df5d4180010d65ad3542eb36a652682) --- .../fixtures/public/engine/rgbx_sample_half.metal | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 crates/metal2vulkan-validation/fixtures/public/engine/rgbx_sample_half.metal diff --git a/crates/metal2vulkan-validation/fixtures/public/engine/rgbx_sample_half.metal b/crates/metal2vulkan-validation/fixtures/public/engine/rgbx_sample_half.metal new file mode 100644 index 000000000..76c4c0479 --- /dev/null +++ b/crates/metal2vulkan-validation/fixtures/public/engine/rgbx_sample_half.metal @@ -0,0 +1,13 @@ +// Owned fixture (written for this repository): a `half` sample through the runtime sampler at +// slot 0, as a compute kernel of a 16 by 16 grid: lane `(x, y)` samples texture 0 at the +// coordinate `where[16 y + x]` and writes the `half4` it answers to `out[16 y + x]`. The runtime +// lane binds a 32-bit float texture and samplers of each filter. Loop-free. +#include +using namespace metal; + +kernel void rgbx_sample_half(texture2d t [[texture(0)]], sampler s [[sampler(0)]], + device half4 *out [[buffer(0)]], device const float2 *where [[buffer(1)]], + uint2 g [[thread_position_in_grid]]) +{ + out[g.y * 16 + g.x] = half4(t.sample(s, where[g.y * 16 + g.x])); +}