WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
278946
[WGSL] Default initialization of [[position]] can lead to division by zero depending on the hardware implementation
https://bugs.webkit.org/show_bug.cgi?id=278946
Summary
[WGSL] Default initialization of [[position]] can lead to division by zero de...
Mike Wyrzykowski
Reported
2024-08-30 13:59:48 PDT
Since position performs an effective division
https://www.w3.org/TR/WGSL/#position-builtin-value
its default initializer should be 0,0,0,1 instead of 0,0,0,0. Otherwise this result is undefined, as v.position is not written to. Specifically, on Apple Silicon it renders the pixel but on AMD / Intel, the render is skipped because (x,y,z)/w = (0,0,0)/0 = inf: struct VertexOutput { @builtin(position) position : vec4f, @location(0) @interpolate(flat) something: u32, } @vertex fn v(@location(0) fromVertexBuffer: u32) -> VertexOutput { var v = VertexOutput(); v.something = fromVertexBuffer; return v; } @fragment fn f(@location(0) @interpolate(flat) something: u32) -> @location(0) u32 { return something; }
Attachments
Add attachment
proposed patch, testcase, etc.
Mike Wyrzykowski
Comment 1
2024-08-30 14:19:04 PDT
Related:
https://github.com/gpuweb/gpuweb/issues/4845
Instead of changing the initializer, we may want to insert a clamp at the end, like: position.w = select(position.w, 1., position.w == 0)
Radar WebKit Bug Importer
Comment 2
2024-08-30 14:28:05 PDT
<
rdar://problem/135039804
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug