From 50e7d9797d9bf4b98a056d5df128c24dde6e78bd Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 23 Mar 2023 16:59:02 -0700 Subject: Fix optimization pass not converging. (#2725) * Fix optimization pass not converging. * Fix. * Fix tests. --------- Co-authored-by: Yong He --- tests/vkray/callable-caller.slang.glsl | 7 +++---- tests/vkray/raygen.slang.glsl | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) (limited to 'tests/vkray') diff --git a/tests/vkray/callable-caller.slang.glsl b/tests/vkray/callable-caller.slang.glsl index 11049074f..885c78dfa 100644 --- a/tests/vkray/callable-caller.slang.glsl +++ b/tests/vkray/callable-caller.slang.glsl @@ -41,10 +41,9 @@ void main() uvec3 _S2 = ((gl_LaunchIDNV)); vec2 _S3 = vec2(_S2.xy); uvec3 _S4 = ((gl_LaunchSizeNV)); - vec2 _S5 = _S3 / vec2(_S4.xy); - payload_1.uv_0 = _S5; + payload_1.uv_0 = _S3 / vec2(_S4.xy); CallShader_0(C_0._data.shaderIndex_0, payload_1); - uvec3 _S6 = ((gl_LaunchIDNV)); - imageStore((gImage_0), ivec2((_S6.xy)), payload_1.albedo_0); + uvec3 _S5 = ((gl_LaunchIDNV)); + imageStore((gImage_0), ivec2((_S5.xy)), payload_1.albedo_0); return; } diff --git a/tests/vkray/raygen.slang.glsl b/tests/vkray/raygen.slang.glsl index f86f67e82..5c609f795 100644 --- a/tests/vkray/raygen.slang.glsl +++ b/tests/vkray/raygen.slang.glsl @@ -92,17 +92,17 @@ void main() uvec3 _S6 = ((gl_LaunchIDEXT)); float _S7 = float(_S6.y) + 0.5; uvec3 _S8 = ((gl_LaunchSizeEXT)); - float _S9 = _S7 / float(_S8.y); - vec2 inUV_0 = vec2(_S5, _S9); - vec4 _S10 = (texture(sampler2D(samplerPosition_0,sampler_0), (inUV_0))); - vec3 P_0 = _S10.xyz; - vec4 _S11 = (texture(sampler2D(samplerNormal_0,sampler_0), (inUV_0))); - vec3 N_0 = _S11.xyz * 2.0 - 1.0; + + vec2 inUV_0 = vec2(_S5, _S7 / float(_S8.y)); + vec4 _S9 = (texture(sampler2D(samplerPosition_0,sampler_0), (inUV_0))); + vec3 P_0 = _S9.xyz; + vec4 _S10 = (texture(sampler2D(samplerNormal_0,sampler_0), (inUV_0))); + vec3 N_0 = _S10.xyz * 2.0 - 1.0; vec3 lightDelta_0 = ubo_0._data.light_0.position_0.xyz - P_0; float lightDist_0 = length(lightDelta_0); vec3 L_0 = normalize(lightDelta_0); - float _S12 = 1.0 / (lightDist_0 * lightDist_0); + float _S11 = 1.0 / (lightDist_0 * lightDist_0); RayDesc_0 ray_0; ray_0.Origin_0 = P_0; ray_0.TMin_0 = 0.00000099999999747524; @@ -119,14 +119,14 @@ void main() } else { - atten_0 = _S12; + atten_0 = _S11; } vec3 color_2 = ubo_0._data.light_0.color_1.xyz * saturate_0(dot(N_0, L_0)) * atten_0; ReflectionRay_0 reflectionRay_0; TraceRay_1(as_0, 1U, 255U, 0U, 0U, 2U, ray_0, reflectionRay_0); vec3 color_3 = color_2 + reflectionRay_0.color_0; - uvec3 _S13 = ((gl_LaunchIDEXT)); - imageStore((outputImage_0), ivec2((uvec2(ivec2(_S13.xy)))), vec4(color_3, 1.0)); + uvec3 _S12 = ((gl_LaunchIDEXT)); + imageStore((outputImage_0), ivec2((uvec2(ivec2(_S12.xy)))), vec4(color_3, 1.0)); return; } -- cgit v1.2.3