From 661d6198bbb9857d3fdc6df477e0742ed0b0765c Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 14 Aug 2023 16:23:19 -0700 Subject: Support per field matrix layout (#3101) * Support per field matrix layout * Fix warnings. * Fix. * Fix tests. * Fix spiv gen. * Fix. * More test fixes. * Fix. * Run only GPU tests on self-hosted servers. * Remove -use-glsl-matrix-layout-modifier. * Fix. --------- Co-authored-by: Yong He --- tests/cross-compile/array-of-buffers.slang.glsl | 7 +++---- tests/cross-compile/array-of-buffers.slang.hlsl | 8 ++++---- tests/cross-compile/func-resource-param-array.slang.glsl | 13 +++++-------- 3 files changed, 12 insertions(+), 16 deletions(-) (limited to 'tests/cross-compile') diff --git a/tests/cross-compile/array-of-buffers.slang.glsl b/tests/cross-compile/array-of-buffers.slang.glsl index 62990033e..a198a5277 100644 --- a/tests/cross-compile/array-of-buffers.slang.glsl +++ b/tests/cross-compile/array-of-buffers.slang.glsl @@ -11,6 +11,7 @@ layout(std140) uniform _S1 { uint index_0; } C_0; + struct S_0 { vec4 f_0; @@ -36,9 +37,7 @@ out vec4 _S6; void main() { - S_0 _S7 = ((sb1_0[C_0.index_0])._data[(C_0.index_0)]); - vec4 _S8 = cb_0[C_0.index_0].f_0 + _S7.f_0; - uint _S9 = ((bb_0[C_0.index_0])._data[(int(C_0.index_0 * 4U))/4]); - _S6 = _S8 + ((sb2_0[C_0.index_0])._data[(C_0.index_0)]) + vec4(float(_S9)); + uint _S7 = ((bb_0[C_0.index_0])._data[(int(C_0.index_0 * 4U))/4]); + _S6 = cb_0[C_0.index_0].f_0 + sb1_0[C_0.index_0]._data[C_0.index_0].f_0 + sb2_0[C_0.index_0]._data[C_0.index_0] + vec4(float(_S7)); return; } diff --git a/tests/cross-compile/array-of-buffers.slang.hlsl b/tests/cross-compile/array-of-buffers.slang.hlsl index e709d323a..ca4b76bbe 100644 --- a/tests/cross-compile/array-of-buffers.slang.hlsl +++ b/tests/cross-compile/array-of-buffers.slang.hlsl @@ -13,6 +13,7 @@ cbuffer C_0 : register(b0) { SLANG_ParameterGroup_C_0 C_0; } + struct S_0 { float4 f_0; @@ -25,10 +26,9 @@ StructuredBuffer sb1_0[int(4)] : register(t0); RWStructuredBuffer sb2_0[int(5)] : register(u0); ByteAddressBuffer bb_0[int(6)] : register(t4); + float4 main() : SV_TARGET { - S_0 _S1 = sb1_0[C_0.index_0][C_0.index_0]; - float4 _S2 = cb_0[C_0.index_0].f_0 + _S1.f_0; - uint _S3 = bb_0[C_0.index_0].Load(int(C_0.index_0 * 4U)); - return _S2 + sb2_0[C_0.index_0][C_0.index_0] + (float4)float(_S3); + uint _S1 = bb_0[C_0.index_0].Load(int(C_0.index_0 * 4U)); + return cb_0[C_0.index_0].f_0 + sb1_0[C_0.index_0].Load(C_0.index_0).f_0 + sb2_0[C_0.index_0][C_0.index_0] + (float4)float(_S1); } diff --git a/tests/cross-compile/func-resource-param-array.slang.glsl b/tests/cross-compile/func-resource-param-array.slang.glsl index d5d1bd08c..9e396e55f 100644 --- a/tests/cross-compile/func-resource-param-array.slang.glsl +++ b/tests/cross-compile/func-resource-param-array.slang.glsl @@ -16,22 +16,22 @@ layout(std430, binding = 2) buffer _S3 { int f_0(uint _S4) { - return ((a_0)._data[(_S4)]); + return a_0._data[_S4]; } int f_1(uint _S5, uint _S6) { - return ((b_0[_S5])._data[(_S6)]); + return b_0[_S5]._data[_S6]; } int g_0(uint _S7, uint _S8) { - return ((b_0[_S7])._data[(_S8)]); + return b_0[_S7]._data[_S8]; } int g_1(uint _S9, uint _S10, uint _S11) { - return ((c_0[_S9][_S10])._data[(_S11)]); + return c_0[_S9][_S10]._data[_S11]; } layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; @@ -39,10 +39,7 @@ void main() { uint ii_0 = gl_GlobalInvocationID.x; uint jj_0 = gl_GlobalInvocationID.y; - - 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; + a_0._data[ii_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); return; } -- cgit v1.2.3