Files
reims-vgpu/guest/bundle/tests/ci_kernel.metal
T
Anees Iqbal 88fbb5525e 🆕 Run Core Image's link over Metal's own libraries in the guest
Core Image takes its kernels and helpers as extern functions and links them on
the CPU in Metal's base device class, which reads Metal-internal library data
from each function (measured: macOS 27, and 26.6.1 in the guest): with our
functions it asked them for libraryData and failed. Each library now keeps the
bytes it was made from and makes, on first use, a shadow, Metal's own library
over them; it answers externFunctionNames and newExternFunctionWithName: from
the shadow, each function holding Metal's own, of functionType 4, which
functionNames leaves out as Metal's does. The device's two links hand Metal the
shadows and make the library it links ours through newLibraryWithData:, so
ciKernelMain's pipeline is made on the host like any other. The shell tests
build a Core Image kernel library from a source of our own, and ci_probe
renders through the route in a guest.
2026-11-05 21:58:32 -08:00

15 lines
424 B
Metal

// The shell tests' Core Image kernel library (Makefile: `metal -fcikernel`, `metallib -cikernel`):
// two color kernels, which Metal lists as extern functions of functionType 4, never as entry
// points.
#include <CoreImage/CoreImage.h>
extern "C" {
namespace coreimage {
float4 swap_red_blue(sample_t s) { return s.bgra; }
float4 scale_red_green(sample_t s, float k) { return float4(s.r * k, s.g * k, s.b, s.a); }
}
}