mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-16 11:33:43 +00:00
This uses FXC compilation failure mitigation for _any_ vector index assignment that has a non-constant index. FXC can still fall over if the loop calls a function that performs the dynamic index. Use some vector swizzle logic to avoid branches in the helper. Fixed: tint:980 Change-Id: I2a759d88a7d884bc61b4631cf57feb4acc8178de Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57882 Auto-Submit: Ben Clayton <bclayton@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com>
14 lines
520 B
WebGPU Shading Language
14 lines
520 B
WebGPU Shading Language
// Fails with "D3D compile failed with value cannot be NaN, isnan() may not be necessary. /Gis may force isnan() to be performed"
|
|
fn Bad(index: u32, rd: vec3<f32>) -> vec3<f32> {
|
|
var normal: vec3<f32> = vec3<f32>(0.0);
|
|
normal[index] = -sign(rd[index]);
|
|
return normalize(normal);
|
|
}
|
|
|
|
[[block]] struct S { v : vec3<f32>; i : u32; };
|
|
[[binding(0), group(0)]] var<storage, read_write> io : S;
|
|
[[stage(compute), workgroup_size(1)]]
|
|
fn main([[builtin(local_invocation_index)]] idx : u32) {
|
|
io.v = Bad(io.i, io.v);
|
|
}
|