-
Notifications
You must be signed in to change notification settings - Fork 1
hello example shows pink screen on macOS #48
Copy link
Copy link
Open
Labels
priority: criticalRelease blocker, security, data lossRelease blocker, security, data lossstatus: confirmedVerified, ready for workVerified, ready for worktype: bugSomething isn't workingSomething isn't working
Description
hello example shows pink screen on macOS
Platform: macOS
Build command: CGO_ENABLED=0 go build .
Steps to reproduce
- Clone the repo
cd examples/helloCGO_ENABLED=0 go build . && ./hello
Result
Pink screen. See attached screenshot.
Console output
2026/03/13 19:17:21 render: ensure pipelines: SDF pipeline: compile sdf_render shader: metal: failed to compile MSL: program_source:87:26: error: cannot reserve 'buffer' resource location at index 0
constant ClipParams& clip [[buffer(0)]]) {
^
program_source:129:26: error: cannot reserve 'buffer' resource location at index 0
constant ClipParams& clip [[buffer(0)]]) {
^
| Error Domain=MTLLibraryErrorDomain Code=3 "program_source:87:26: error: cannot reserve 'buffer' resource location at index 0
constant ClipParams& clip [[buffer(0)]]) {
^
program_source:129:26: error: cannot reserve 'buffer' resource location at index 0
constant ClipParams& clip [[buffer(0)]]) {
^
" UserInfo={NSLocalizedDescription=program_source:87:26: error: cannot reserve 'buffer' resource location at index 0
constant ClipParams& clip [[buffer(0)]]) {
^
program_source:129:26: error: cannot reserve 'buffer' resource location at index 0
constant ClipParams& clip [[buffer(0)]]) {
^
} | {
NSLocalizedDescription = "program_source:87:26: error: cannot reserve 'buffer' resource location at index 0\n constant ClipParams& clip [[buffer(0)]]) {\n ^\nprogram_source:129:26: error: cannot reserve 'buffer' resource location at index 0\n constant ClipParams& clip [[buffer(0)]]) {\n ^\n";
}
MSL:
#include <metal_stdlib>
#include <simd/simd.h>
using metal::uint;
struct Uniforms {
metal::float2 viewport;
metal::float2 _pad;
};
struct VertexInput {
metal::float2 position_;
metal::float2 local;
float shape_kind;
float param1;
float param2;
float param3;
float half_stroke;
float is_stroked;
metal::float4 color_;
};
struct VertexOutput {
metal::float4 clip_position;
metal::float2 local;
float shape_kind;
float param1;
float param2;
float param3;
float half_stroke;
float is_stroked;
metal::float4 color_;
};
struct ClipParams {
metal::float4 clip_rect;
float clip_radius;
float clip_enabled;
metal::float2 _pad;
};
// Safe division helper (handles zero divisor)
template <typename T, typename D>
T _naga_div(T lhs, D rhs) {
D nz = D(rhs != D(0));
return lhs / (nz * rhs + D(!nz));
}
// Safe modulo helper (handles zero divisor)
template <typename T, typename D>
T _naga_mod(T lhs, D rhs) {
D nz = D(rhs != D(0));
return lhs % (nz * rhs + D(!nz));
}
float rrect_clip_coverage(metal::float2 frag_pos,
constant ClipParams& clip) {
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
priority: criticalRelease blocker, security, data lossRelease blocker, security, data lossstatus: confirmedVerified, ready for workVerified, ready for worktype: bugSomething isn't workingSomething isn't working