diff options
| author | Yong He <yonghe@outlook.com> | 2023-02-24 10:01:47 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-24 10:01:47 -0800 |
| commit | bd6306cdaa4a49344658bd026721b6532e103d09 (patch) | |
| tree | bb7f666d426e6cfc7777a3ccac0a1d628588eb39 /tests/vkray | |
| parent | e8c08e7ecb1124f115a1d1042277776193122b57 (diff) | |
More control flow simplifications. (#2673)
* More control flow and Phi param simplifications.
* Fix.
* Fix gcc error.
* Fix.
* More IR cleanup.
* Fix bug in phi param dce + ifelse simplify.
* Propagate and DCE side-effect-free functions.
* Enhance CFG simplifcation to remove loops with no side effects.
* Fix.
* Fixes.
* Fix tests. Add [__AlwaysFoldIntoUseSite] for rayPayloadLocation.
* More cleanup.
* Fixes.
* Fix.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/vkray')
| -rw-r--r-- | tests/vkray/anyhit.slang.glsl | 21 | ||||
| -rw-r--r-- | tests/vkray/callable-caller.slang.glsl | 23 | ||||
| -rw-r--r-- | tests/vkray/raygen.slang.glsl | 42 |
3 files changed, 36 insertions, 50 deletions
diff --git a/tests/vkray/anyhit.slang.glsl b/tests/vkray/anyhit.slang.glsl index eb39299c5..345dd6624 100644 --- a/tests/vkray/anyhit.slang.glsl +++ b/tests/vkray/anyhit.slang.glsl @@ -1,16 +1,8 @@ // anyhit.slang.glsl #version 460 - -#if USE_NV_RT -#extension GL_NV_ray_tracing : require -#define hitAttributeEXT hitAttributeNV -#define rayPayloadInEXT rayPayloadInNV -#define terminateRayEXT terminateRayNV -#define ignoreIntersectionEXT ignoreIntersectionNV -#else #extension GL_EXT_ray_tracing : require -#endif - +layout(row_major) uniform; +layout(row_major) buffer; struct Params_0 { int mode_0; @@ -47,16 +39,15 @@ void main() float val_0 = textureLod( sampler2D(gParams_alphaMap_0, gParams_sampler_0), _S2.normal_0.xy, - float(0)).x; - + (0.0)).x; - if(val_0 > float(0)) + if(val_0 > 0.0) { - terminateRayEXT; + terminateRayEXT;; } else { - ignoreIntersectionEXT; + ignoreIntersectionEXT;; } } diff --git a/tests/vkray/callable-caller.slang.glsl b/tests/vkray/callable-caller.slang.glsl index 0b7a9677b..11049074f 100644 --- a/tests/vkray/callable-caller.slang.glsl +++ b/tests/vkray/callable-caller.slang.glsl @@ -1,18 +1,7 @@ -//TEST_IGNORE_FILE: #version 460 #extension GL_NV_ray_tracing : require layout(row_major) uniform; layout(row_major) buffer; -struct SLANG_ParameterGroup_C_0 -{ - uint shaderIndex_0; -}; - -layout(binding = 0) -layout(std140) uniform _S1 -{ - SLANG_ParameterGroup_C_0 _data; -} C_0; struct MaterialPayload_0 { vec4 albedo_0; @@ -23,6 +12,16 @@ layout(location = 0) callableDataNV MaterialPayload_0 p_0; +struct SLANG_ParameterGroup_C_0 +{ + uint shaderIndex_0; +}; + +layout(binding = 0) +layout(std140) uniform _S1 +{ + SLANG_ParameterGroup_C_0 _data; +} C_0; void CallShader_0(uint shaderIndex_1, inout MaterialPayload_0 payload_0) { p_0 = payload_0; @@ -38,7 +37,7 @@ uniform image2D gImage_0; void main() { MaterialPayload_0 payload_1; - payload_1.albedo_0 = vec4(0); + payload_1.albedo_0 = vec4(0.0); uvec3 _S2 = ((gl_LaunchIDNV)); vec2 _S3 = vec2(_S2.xy); uvec3 _S4 = ((gl_LaunchSizeNV)); diff --git a/tests/vkray/raygen.slang.glsl b/tests/vkray/raygen.slang.glsl index e34f1f6e0..f86f67e82 100644 --- a/tests/vkray/raygen.slang.glsl +++ b/tests/vkray/raygen.slang.glsl @@ -76,8 +76,7 @@ uniform accelerationStructureEXT as_0; float saturate_0(float x_0) { - float _S2 = clamp(x_0, 0.0, 1.0); - return _S2; + return clamp(x_0, 0.0, 1.0); } layout(rgba32f) @@ -86,24 +85,24 @@ uniform image2D outputImage_0; void main() { - uvec3 _S3 = ((gl_LaunchIDEXT)); - float _S4 = float(_S3.x) + 0.5; - uvec3 _S5 = ((gl_LaunchSizeEXT)); - float _S6 = _S4 / float(_S5.x); - uvec3 _S7 = ((gl_LaunchIDEXT)); - float _S8 = float(_S7.y) + 0.5; - uvec3 _S9 = ((gl_LaunchSizeEXT)); - float _S10 = _S8 / float(_S9.y); - vec2 inUV_0 = vec2(_S6, _S10); - vec4 _S11 = (texture(sampler2D(samplerPosition_0,sampler_0), (inUV_0))); - vec3 P_0 = _S11.xyz; - vec4 _S12 = (texture(sampler2D(samplerNormal_0,sampler_0), (inUV_0))); - vec3 N_0 = _S12.xyz * 2.0 - 1.0; + uvec3 _S2 = ((gl_LaunchIDEXT)); + float _S3 = float(_S2.x) + 0.5; + uvec3 _S4 = ((gl_LaunchSizeEXT)); + float _S5 = _S3 / float(_S4.x); + 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; 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 _S13 = 1.0 / (lightDist_0 * lightDist_0); + float _S12 = 1.0 / (lightDist_0 * lightDist_0); RayDesc_0 ray_0; ray_0.Origin_0 = P_0; ray_0.TMin_0 = 0.00000099999999747524; @@ -120,17 +119,14 @@ void main() } else { - atten_0 = _S13; + atten_0 = _S12; } - vec3 _S14 = ubo_0._data.light_0.color_1.xyz; - float _S15 = dot(N_0, L_0); - float _S16 = saturate_0(_S15); - vec3 color_2 = _S14 * _S16 * atten_0; + 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 _S17 = ((gl_LaunchIDEXT)); - imageStore((outputImage_0), ivec2((uvec2(ivec2(_S17.xy)))), vec4(color_3, 1.0)); + uvec3 _S13 = ((gl_LaunchIDEXT)); + imageStore((outputImage_0), ivec2((uvec2(ivec2(_S13.xy)))), vec4(color_3, 1.0)); return; } |
