diff options
| author | Yong He <yonghe@outlook.com> | 2023-05-09 09:44:33 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-09 09:44:33 -0700 |
| commit | 38ed03a7203baacf36fca62539ac74fd45ed42d2 (patch) | |
| tree | 9648daee25c0a2aaac2fa8cd7d91908fd2aeef2f /tests/cross-compile | |
| parent | 89a1234964a1927c4936a2758f72b7d6c9d0bc73 (diff) | |
Fix function side-effectness prop logic. (#2875)
Diffstat (limited to 'tests/cross-compile')
| -rw-r--r-- | tests/cross-compile/func-resource-param-array.slang | 3 | ||||
| -rw-r--r-- | tests/cross-compile/func-resource-param-array.slang.glsl | 87 | ||||
| -rw-r--r-- | tests/cross-compile/vk-texture-indexing.slang.glsl | 18 |
3 files changed, 33 insertions, 75 deletions
diff --git a/tests/cross-compile/func-resource-param-array.slang b/tests/cross-compile/func-resource-param-array.slang index 7062169dc..d7b7fca99 100644 --- a/tests/cross-compile/func-resource-param-array.slang +++ b/tests/cross-compile/func-resource-param-array.slang @@ -32,7 +32,6 @@ void main(uint3 tid : SV_DispatchThreadID) { uint ii = tid.x; uint jj = tid.y; - uint kk = tid.z; // Can we specialize `f`? // @@ -56,7 +55,7 @@ void main(uint3 tid : SV_DispatchThreadID) // What if the function takes an array, and we pass // in an element of an array-of-arrays? // - tmp += g(c[ii], jj, kk); + tmp += g(c[ii], jj, tid.z); a[ii] = tmp; } diff --git a/tests/cross-compile/func-resource-param-array.slang.glsl b/tests/cross-compile/func-resource-param-array.slang.glsl index e9d1b5a97..d5d1bd08c 100644 --- a/tests/cross-compile/func-resource-param-array.slang.glsl +++ b/tests/cross-compile/func-resource-param-array.slang.glsl @@ -1,93 +1,48 @@ -// func-resource-param-array.slang.glsl #version 450 +layout(row_major) uniform; +layout(row_major) buffer; -#define a a_0 -#define b b_0 -#define c c_0 -#define ii ii_0 -#define jj jj_0 -#define kk kk_0 - -#define f_a f_0 -#define f_b f_1 -#define g_b g_0 -#define g_c g_1 - -#define a_block _S1 -#define b_block _S2 -#define c_block _S3 - -#define f_a_i _S4 -#define f_b_t _S5 -#define f_b_i _S6 -#define g_b_i _S7 -#define g_b_j _S8 -#define g_c_t _S9 -#define g_c_i _S10 -#define g_c_j _S11 - -#define tmp_f_a_ii _S12 -#define tmp_f_a_jj _S13 - -#define tmp_f_b _S14 -#define tmp_g_b _S15 -#define tmp_g_c _S16 - -layout(std430, binding = 0) buffer a_block { +layout(std430, binding = 0) buffer _S1 { int _data[]; -} a; +} a_0; -layout(std430, binding = 1) buffer b_block { +layout(std430, binding = 1) buffer _S2 { int _data[]; -} b[3]; +} b_0[3]; -layout(std430, binding = 2) buffer c_block { +layout(std430, binding = 2) buffer _S3 { int _data[]; -} c[4][3]; +} c_0[4][3]; -int f_a(uint f_a_i) +int f_0(uint _S4) { - return a._data[f_a_i]; + return ((a_0)._data[(_S4)]); } -int f_b(uint f_b_t, uint f_b_i) +int f_1(uint _S5, uint _S6) { - return b[f_b_t]._data[f_b_i]; + return ((b_0[_S5])._data[(_S6)]); } -int g_b(uint g_b_i, uint g_b_j) +int g_0(uint _S7, uint _S8) { - return b[g_b_i]._data[g_b_j]; + return ((b_0[_S7])._data[(_S8)]); } -int g_c(uint g_c_t, uint g_c_i, uint g_c_j) +int g_1(uint _S9, uint _S10, uint _S11) { - return c[g_c_t][g_c_i]._data[g_c_j]; + return ((c_0[_S9][_S10])._data[(_S11)]); } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; - void main() { - uint ii = gl_GlobalInvocationID.x; - uint jj = gl_GlobalInvocationID.y; - uint kk = gl_GlobalInvocationID.z; + uint ii_0 = gl_GlobalInvocationID.x; + uint jj_0 = gl_GlobalInvocationID.y; - int tmp_f_a_ii = f_a(ii); - - int tmp_f_a_jj = f_a(jj); - int tmp_0 = tmp_f_a_ii + tmp_f_a_jj; - - int tmp_f_b = f_b(ii, jj); - int tmp_1 = tmp_0 + tmp_f_b; - - int tmp_g_b = g_b(ii, jj); - int tmp_2 = tmp_1 + tmp_g_b; - - int tmp_g_c = g_c(ii, jj, kk); - int tmp_3 = tmp_2 + tmp_g_c; - - a._data[ii] = tmp_3; + int tmp_0 = f_0(ii_0) + f_0(jj_0) + f_1(ii_0, jj_0) + g_0(ii_0, jj_0) + g_1(ii_0, jj_0, gl_GlobalInvocationID.z); + ((a_0)._data[(ii_0)]) = tmp_0; return; } + diff --git a/tests/cross-compile/vk-texture-indexing.slang.glsl b/tests/cross-compile/vk-texture-indexing.slang.glsl index 069e6efc3..73513c623 100644 --- a/tests/cross-compile/vk-texture-indexing.slang.glsl +++ b/tests/cross-compile/vk-texture-indexing.slang.glsl @@ -1,16 +1,16 @@ #version 450 -#extension GL_EXT_nonuniform_qualifier : require #extension GL_EXT_samplerless_texture_functions : require +#extension GL_EXT_nonuniform_qualifier : require +layout(row_major) uniform; +layout(row_major) buffer; layout(binding = 0) uniform texture2D gParams_textures_0[10]; + float fetchData_0(uvec2 coords_0, uint index_0) { - float _S1 = texelFetch( - gParams_textures_0[nonuniformEXT(index_0)], - ivec2(coords_0), - 0).x; + float _S1 = (texelFetch((gParams_textures_0[nonuniformEXT(index_0)]), ivec2((coords_0)), 0).x); return _S1; } @@ -18,12 +18,16 @@ float fetchData_0(uvec2 coords_0, uint index_0) layout(location = 0) out vec4 _S2; + flat layout(location = 0) in uvec3 _S3; + void main() { - float v_0 = fetchData_0(_S3.xy, _S3.z); - _S2 = vec4(v_0); + + _S2 = vec4(fetchData_0(_S3.xy, _S3.z)); + return; } + |
