diff --git a/luisa_compute/src/rtx.rs b/luisa_compute/src/rtx.rs index 81a115f..a939495 100644 --- a/luisa_compute/src/rtx.rs +++ b/luisa_compute/src/rtx.rs @@ -570,7 +570,7 @@ impl SurfaceHitExpr { self.inst.ne(u32::MAX) } pub fn miss(&self) -> Expr { - self.prim.eq(u32::MAX) + self.inst.eq(u32::MAX) } pub fn is_curve(&self) -> Expr { self.bary.y.lt(0.0) diff --git a/luisa_compute/src/runtime.rs b/luisa_compute/src/runtime.rs index d9e475e..3df8efe 100644 --- a/luisa_compute/src/runtime.rs +++ b/luisa_compute/src/runtime.rs @@ -987,7 +987,15 @@ impl<'a> Scope<'a> { callback: F, ) { self.synchronized.set(false); - let api_commands = commands.iter().map(|c| c.inner).collect::>(); + let api_commands = commands + .iter() + .map(|c| c.inner) + .filter(|c| match c { + // filters zero-size dispatches + api::Command::ShaderDispatch(c) => c.dispatch_size.iter().all(|&s| s > 0), + _ => true, + }) + .collect::>(); let ctx = CommandCallbackCtx { commands, f: callback,