From 4ddcef96ae282f8fe39f6eb0c055acb9fe410ccf Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Wed, 27 Nov 2024 20:08:35 -0800 Subject: [PATCH] Update naga and use built-in ray flags --- Cargo.toml | 4 +++- blade-render/code/fill-gbuf.wgsl | 3 --- blade-render/code/ray-trace.wgsl | 3 --- examples/ray-query/shader.wgsl | 4 ++-- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fc45ec47..061ebe6c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,9 @@ glam = { version = "0.28", features = ["mint"] } gltf = { version = "1.1", default-features = false } log = "0.4" mint = "0.5" -naga = { version = "23.0", features = ["wgsl-in"] } +naga = { git = "https://github.com/gfx-rs/wgpu", rev = "1a643291c2e8854ba7e4f5445a4388202731bfa1", features = [ + "wgsl-in", +] } profiling = "1" slab = "0.4" strum = { version = "0.25", features = ["derive"] } diff --git a/blade-render/code/fill-gbuf.wgsl b/blade-render/code/fill-gbuf.wgsl index 180cd628..e574bc4e 100644 --- a/blade-render/code/fill-gbuf.wgsl +++ b/blade-render/code/fill-gbuf.wgsl @@ -4,9 +4,6 @@ #include "debug-param.inc.wgsl" #include "gbuf.inc.wgsl" -//TODO: use proper WGSL -const RAY_FLAG_CULL_NO_OPAQUE: u32 = 0x80u; - // Has to match the host! struct Vertex { pos: vec3, diff --git a/blade-render/code/ray-trace.wgsl b/blade-render/code/ray-trace.wgsl index df4c3351..94e3e21a 100644 --- a/blade-render/code/ray-trace.wgsl +++ b/blade-render/code/ray-trace.wgsl @@ -7,9 +7,6 @@ #include "surface.inc.wgsl" #include "gbuf.inc.wgsl" -//TODO: use proper WGSL -const RAY_FLAG_CULL_NO_OPAQUE: u32 = 0x80u; - const PI: f32 = 3.1415926; const MAX_RESERVOIRS: u32 = 4u; // See "DECOUPLING SHADING AND REUSE" in diff --git a/examples/ray-query/shader.wgsl b/examples/ray-query/shader.wgsl index e17e3c16..8387ab08 100644 --- a/examples/ray-query/shader.wgsl +++ b/examples/ray-query/shader.wgsl @@ -69,7 +69,7 @@ fn main(@builtin(global_invocation_id) global_id: vec3) { var ray_pos = qrot(rotator, parameters.cam_position); var ray_dir = qrot(rotator, world_dir); loop { - rayQueryInitialize(&rq, acc_struct, RayDesc(0u, 0xFFu, 0.1, parameters.depth, ray_pos, ray_dir)); + rayQueryInitialize(&rq, acc_struct, RayDesc(RAY_FLAG_NONE, 0xFFu, 0.1, parameters.depth, ray_pos, ray_dir)); rayQueryProceed(&rq); let intersection = rayQueryGetCommittedIntersection(&rq); if (intersection.kind == RAY_QUERY_INTERSECTION_NONE) { @@ -85,7 +85,7 @@ fn main(@builtin(global_invocation_id) global_id: vec3) { break; } } - + let color = get_miss_color(ray_dir); textureStore(output, global_id.xy, color); }