From 966ecb4efdc373a2db9801eb937fbf3b4d5de1e1 Mon Sep 17 00:00:00 2001 From: lujiao Date: Tue, 25 Aug 2026 17:52:59 +0800 Subject: [PATCH] Use textureLod instead of the texture texture() compiles to OpImageSampleImplicitLod, which needs screen-space derivatives of the UV if (rayQueryGetIntersectionTypeEXT(...) != ...NoneEXT) is per pixel ray query. one pixel ray query of the quad can hit while neighor misses. So the divergent branch does not match the texture, should use textureLod which does not require the screen-space derivatives of quad pixels. --- .../rayquery_morpheus.frag | 10 +++++----- .../rayquery_morpheus.frag.spv | Bin 39096 -> 39040 bytes .../rayquery_morpheus_combo.frag | 10 +++++----- .../rayquery_morpheus_combo.frag.spv | Bin 51796 -> 51740 bytes 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/shaders/mobile_nerf_rayquery/rayquery_morpheus.frag b/shaders/mobile_nerf_rayquery/rayquery_morpheus.frag index 5d9d40fecb..be175db885 100644 --- a/shaders/mobile_nerf_rayquery/rayquery_morpheus.frag +++ b/shaders/mobile_nerf_rayquery/rayquery_morpheus.frag @@ -1,4 +1,4 @@ -/* Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved. +/* Copyright (c) 2026, Qualcomm Innovation Center, Inc. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 * @@ -259,7 +259,7 @@ void main(void) // Sample feature maps and check transparency const vec2 flipped = vec2( hitpoint_uv.x, 1.0 - hitpoint_uv.y ); - vec4 test_pixel = texture(textureInput_0[nonuniformEXT(instanceID)], flipped); + vec4 test_pixel = textureLod(textureInput_0[nonuniformEXT(instanceID)], flipped, 0); if (test_pixel.r != 0.0) { rayQueryConfirmIntersectionEXT(rayQuery); @@ -272,7 +272,7 @@ void main(void) if (rayQueryGetIntersectionTypeEXT(rayQuery, true) == gl_RayQueryCommittedIntersectionTriangleEXT) { // Output feature inputs for mlp - vec4 pixel_1 = texture(textureInput_1[nonuniformEXT(commited_instanceID)], commited_flipped); + vec4 pixel_1 = textureLod(textureInput_1[nonuniformEXT(commited_instanceID)], commited_flipped, 0); pixel_0.a = pixel_0.a*2.0-1.0; pixel_1.a = pixel_1.a*2.0-1.0; @@ -327,8 +327,8 @@ void main(void) // Sample feature maps then output to second subpass vec2 flipped = vec2( hitpoint_uv.x, 1.0 - hitpoint_uv.y ); - vec4 pixel_0 = texture(textureInput_0[nonuniformEXT(instanceID)], flipped); - vec4 pixel_1 = texture(textureInput_1[nonuniformEXT(instanceID)], flipped); + vec4 pixel_0 = textureLod(textureInput_0[nonuniformEXT(instanceID)], flipped, 0); + vec4 pixel_1 = textureLod(textureInput_1[nonuniformEXT(instanceID)], flipped, 0); pixel_0.a = pixel_0.a*2.0-1.0; pixel_1.a = pixel_1.a*2.0-1.0; diff --git a/shaders/mobile_nerf_rayquery/rayquery_morpheus.frag.spv b/shaders/mobile_nerf_rayquery/rayquery_morpheus.frag.spv index 89e84aa0e0926833cfb2e9b9aa04eca62c83b2be..16076a9cee29dd66bf65900a43bd671ecba59579 100644 GIT binary patch delta 90 zcmdn7k*Q%L6E`!HGCKnUBLg=B$3|{N#?2*+B??jz4D3M2z;Kz3f#D($Ujkw#Am4&% Y@-M|Cxb$71@NFQz1DD>Mr{q-z0O?E+KmY&$ delta 146 zcmZqJ$h2c46E`!HGCKnUBLg=B??!G#Mt2qlE(Uj>cz1t)cOTdIn<;sf0RRjECT;)# diff --git a/shaders/mobile_nerf_rayquery/rayquery_morpheus_combo.frag b/shaders/mobile_nerf_rayquery/rayquery_morpheus_combo.frag index a7393ab3d0..59a26f7f54 100644 --- a/shaders/mobile_nerf_rayquery/rayquery_morpheus_combo.frag +++ b/shaders/mobile_nerf_rayquery/rayquery_morpheus_combo.frag @@ -1,4 +1,4 @@ -/* Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved. +/* Copyright (c) 2026, Qualcomm Innovation Center, Inc. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 * @@ -259,7 +259,7 @@ void main(void) // Sample feature maps and check transparency const vec2 flipped = vec2( hitpoint_uv.x, 1.0 - hitpoint_uv.y ); - vec4 test_pixel = texture(textureInput_0[nonuniformEXT(instanceID)], flipped); + vec4 test_pixel = textureLod(textureInput_0[nonuniformEXT(instanceID)], flipped, 0); if (test_pixel.r != 0.0) { rayQueryConfirmIntersectionEXT(rayQuery); @@ -272,7 +272,7 @@ void main(void) if (rayQueryGetIntersectionTypeEXT(rayQuery, true) == gl_RayQueryCommittedIntersectionTriangleEXT) { // Output feature inputs for mlp - vec4 pixel_1 = texture(textureInput_1[nonuniformEXT(commited_instanceID)], commited_flipped); + vec4 pixel_1 = textureLod(textureInput_1[nonuniformEXT(commited_instanceID)], commited_flipped, 0); pixel_0.a = pixel_0.a*2.0-1.0; pixel_1.a = pixel_1.a*2.0-1.0; @@ -327,8 +327,8 @@ void main(void) // Sample feature maps then output to second subpass const vec2 flipped = vec2( hitpoint_uv.x, 1.0 - hitpoint_uv.y ); - vec4 pixel_0 = texture(textureInput_0[nonuniformEXT(instanceID)], flipped); - vec4 pixel_1 = texture(textureInput_1[nonuniformEXT(instanceID)], flipped); + vec4 pixel_0 = textureLod(textureInput_0[nonuniformEXT(instanceID)], flipped, 0); + vec4 pixel_1 = textureLod(textureInput_1[nonuniformEXT(instanceID)], flipped, 0); pixel_0.a = pixel_0.a*2.0-1.0; pixel_1.a = pixel_1.a*2.0-1.0; diff --git a/shaders/mobile_nerf_rayquery/rayquery_morpheus_combo.frag.spv b/shaders/mobile_nerf_rayquery/rayquery_morpheus_combo.frag.spv index 6ab3ef532fd63d20a99c895d861b7f0ab49832d1..fe3e1d4781e5bfc58ef8b73d263f70179e5e97e6 100644 GIT binary patch delta 90 zcmcaIg?Y{tW^QICWp)MzMh0#Mj*Z-!jGJp1CG4dl7}$Z3f#Cs=xCg}dftU%%U(7Ul XnL`p>`V~<41rWc4OK+BPwCV%^^Xm}S delta 146 zcmbO;h55=9W^QICWp)MzMh0#M-i_RvjP5K9Tnz3$@$UZq?mn*Z$pr=R#U+(Fsqs0P zd8zR!nMJ9|C7ETZ3=Av`97yUi^OAE)Q;-yFHfEHx7Yb)!WdNGa@Bm2M1LFJalhYiM T;KHwfLN9>$CHv+_4pyB23YI4=