diff options
| author | Yong He <yonghe@outlook.com> | 2024-01-24 15:36:49 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-24 15:36:49 -0800 |
| commit | e7b6de334f320429462a0257e2191ccf3cbc9a0d (patch) | |
| tree | 7e2f6802a2f6fa5217903948efbd994b51e103b7 /tests/cross-compile | |
| parent | dd57306d951dbcaf6471659fcd1d2c37738f36d0 (diff) | |
[SPIRV] Support `globallycoherent` and `[vk::index()]`. (#3488)
* [SPIRV] Support `globallycoherent` modifier.
* Fix.
* Disable executable cooperative vector tests.
* Update expected failure.
* [SPIRV] Emit varying output index decoration.
* Add test.
* Update tests.
* Fix test.
* Emit `SpvExecutionModeEarlyFragmentTests`.
* Lower `StructuredBuffer<bool>`.
* Support globallycoherent on ByteAddressBuffer.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/cross-compile')
19 files changed, 65 insertions, 54 deletions
diff --git a/tests/cross-compile/array-of-buffers.slang.glsl b/tests/cross-compile/array-of-buffers.slang.glsl index 53a826a91..0b0af50bf 100644 --- a/tests/cross-compile/array-of-buffers.slang.glsl +++ b/tests/cross-compile/array-of-buffers.slang.glsl @@ -30,10 +30,10 @@ layout(std430, binding = 4) readonly buffer StructuredBuffer_uint_t_0 { uint _data[]; } bb_0[6]; layout(location = 0) -out vec4 _S3; +out vec4 main_0; void main() { - _S3 = 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(bb_0[C_0.index_0]._data[int(C_0.index_0 * 4U) / 4])); + main_0 = 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(bb_0[C_0.index_0]._data[int(C_0.index_0 * 4U) / 4])); return; } diff --git a/tests/cross-compile/barycentrics-nv.slang.glsl b/tests/cross-compile/barycentrics-nv.slang.glsl index ca37a14e8..583310125 100644 --- a/tests/cross-compile/barycentrics-nv.slang.glsl +++ b/tests/cross-compile/barycentrics-nv.slang.glsl @@ -3,10 +3,10 @@ #extension GL_NV_fragment_shader_barycentric : enable layout(location = 0) -out vec4 _S1; +out vec4 main_0; void main() { - _S1 = vec4(gl_BaryCoordNV, float(0)); + main_0 = vec4(gl_BaryCoordNV, float(0)); return; } diff --git a/tests/cross-compile/barycentrics.slang.glsl b/tests/cross-compile/barycentrics.slang.glsl index 963316b53..ede585db0 100644 --- a/tests/cross-compile/barycentrics.slang.glsl +++ b/tests/cross-compile/barycentrics.slang.glsl @@ -3,10 +3,10 @@ #extension GL_EXT_fragment_shader_barycentric : enable layout(location = 0) -out vec4 _S1; +out vec4 main_0; void main() { - _S1 = vec4(gl_BaryCoordEXT, float(0)); + main_0 = vec4(gl_BaryCoordEXT, float(0)); return; } diff --git a/tests/cross-compile/dual-source-blending.slang.glsl b/tests/cross-compile/dual-source-blending.slang.glsl index aa550b451..0cdd0fef6 100644 --- a/tests/cross-compile/dual-source-blending.slang.glsl +++ b/tests/cross-compile/dual-source-blending.slang.glsl @@ -5,13 +5,13 @@ layout(row_major) uniform; layout(row_major) buffer; layout(location = 0) -out vec4 _S1; +out vec4 main_a_0; layout(location = 0, index = 1) -out vec4 _S2; +out vec4 main_b_0; layout(location = 0) -in vec4 _S3; +in vec4 v_0; struct FragmentOutput_0 { @@ -21,17 +21,17 @@ struct FragmentOutput_0 void main() { - const vec4 _S4 = vec4(0.0, 0.0, 0.0, 0.0); + const vec4 _S1 = vec4(0.0, 0.0, 0.0, 0.0); FragmentOutput_0 f_0; - f_0.a_0 = _S4; + f_0.a_0 = _S1; - f_0.b_0 = _S4; - f_0.a_0 = _S3; - f_0.b_0 = _S3; - FragmentOutput_0 _S5 = f_0; - _S1 = f_0.a_0; - _S2 = _S5.b_0; + f_0.b_0 = _S1; + f_0.a_0 = v_0; + f_0.b_0 = v_0; + FragmentOutput_0 _S2 = f_0; + main_a_0 = f_0.a_0; + main_b_0 = _S2.b_0; return; } diff --git a/tests/cross-compile/early-depth-stencil.hlsl.glsl b/tests/cross-compile/early-depth-stencil.hlsl.glsl index 73e258a82..4a723215c 100644 --- a/tests/cross-compile/early-depth-stencil.hlsl.glsl +++ b/tests/cross-compile/early-depth-stencil.hlsl.glsl @@ -5,12 +5,12 @@ layout(row_major) buffer; #line 5 0 layout(location = 0) -out vec4 _S1; +out vec4 main_0; #line 5 layout(early_fragment_tests) in; void main() { - _S1 = vec4(float(1), float(0), float(0), float(1)); + main_0 = vec4(float(1), float(0), float(0), float(1)); return; } diff --git a/tests/cross-compile/geometry-shader.slang b/tests/cross-compile/geometry-shader.slang index 8666b739a..98e5fe661 100644 --- a/tests/cross-compile/geometry-shader.slang +++ b/tests/cross-compile/geometry-shader.slang @@ -1,6 +1,7 @@ // geometry-shader.slang -//TEST:CROSS_COMPILE: -profile sm_5_0 -stage geometry -entry main -target spirv-assembly +//TEST:SIMPLE(filecheck=CHECK): -profile sm_5_0 -stage geometry -entry main -target glsl +//TEST:SIMPLE(filecheck=SPIRV): -profile sm_5_0 -stage geometry -entry main -target spirv struct CoarseVertex { @@ -16,6 +17,11 @@ struct RasterVertex uint id : SV_RenderTargetArrayIndex; } +// SPIRV: OpEntryPoint +// CHECK: void main() +// CHECK: gl_Layer = +// CHECK: EmitVertex(); + [maxvertexcount(3)] void main( triangle CoarseVertex coarseVertices[3], diff --git a/tests/cross-compile/geometry-shader.slang.glsl b/tests/cross-compile/geometry-shader.slang.glsl index da7ae19cd..9f36b880d 100644 --- a/tests/cross-compile/geometry-shader.slang.glsl +++ b/tests/cross-compile/geometry-shader.slang.glsl @@ -5,11 +5,11 @@ #define RasterVertex RasterVertex_0 #define CoarseVertex CoarseVertex_0 -#define input_position _S1 -#define input_color _S2 -#define input_id _S3 -#define output_position _S4 -#define output_color _S5 +#define input_position coarseVertices_position_0 +#define input_color coarseVertices_color_0 +#define input_id coarseVertices_id_0 +#define output_position outputStream_position_0 +#define output_color outputStream_color_0 layout(row_major) uniform; layout(row_major) buffer; diff --git a/tests/cross-compile/glsl-empty-struct-param-field.slang.glsl b/tests/cross-compile/glsl-empty-struct-param-field.slang.glsl index acf0a6fe9..bff888233 100644 --- a/tests/cross-compile/glsl-empty-struct-param-field.slang.glsl +++ b/tests/cross-compile/glsl-empty-struct-param-field.slang.glsl @@ -14,10 +14,10 @@ layout(std140) uniform _S1 vec4 param_0; } pblock_0; layout(location = 0) -out vec4 _S2; +out vec4 main_0; void main() { - _S2 = pblock_0.param_0; + main_0 = pblock_0.param_0; return; }
\ No newline at end of file diff --git a/tests/cross-compile/glsl-generic-in.slang b/tests/cross-compile/glsl-generic-in.slang index 90fe387ba..a43f33c21 100644 --- a/tests/cross-compile/glsl-generic-in.slang +++ b/tests/cross-compile/glsl-generic-in.slang @@ -1,4 +1,7 @@ -//TEST:CROSS_COMPILE:-target spirv-assembly -entry main -profile vs_5_0 +//TEST:SIMPLE(filecheck=CHECK): -target spirv-assembly -entry main -profile vs_5_0 +// CHECK: vIn_field_v0_0 = OpVariable %_ptr_Input_v4float Input +// CHECK: %vIn_field_v1_0 = OpVariable %_ptr_Input_v2float Input +// CHECK: %vIn_p0_0 = OpVariable %_ptr_Input_v3float Input interface IField { float get(); @@ -30,4 +33,4 @@ VOut main(GIn<F, E> vIn) VOut vout; vout.projPos = float4(vIn.p0, vIn.field.get() + vIn.e.get()); return vout; -}
\ No newline at end of file +} diff --git a/tests/cross-compile/glsl-generic-in.slang.glsl b/tests/cross-compile/glsl-generic-in.slang.glsl index 4bf0598d0..0aefb27f2 100644 --- a/tests/cross-compile/glsl-generic-in.slang.glsl +++ b/tests/cross-compile/glsl-generic-in.slang.glsl @@ -18,10 +18,10 @@ float E_get_0() } layout(location = 0) -in vec3 _S1; +in vec3 vIn_p0_0; layout(location = 1) -in vec4 _S2; +in vec4 vIn_field_v0_0; layout(location = 2) in vec2 _S3; @@ -32,9 +32,9 @@ struct VOut_0 }; void main() { - F_0 _S4 = { _S2, _S3 }; + F_0 _S4 = { vIn_field_v0_0, _S3 }; VOut_0 vout_0; - vout_0.projPos_0 = vec4(_S1, F_get_0(_S4) + E_get_0()); + vout_0.projPos_0 = vec4(vIn_p0_0, F_get_0(_S4) + E_get_0()); gl_Position = vout_0.projPos_0; return; } diff --git a/tests/cross-compile/glsl-samplecmplevelzero.slang b/tests/cross-compile/glsl-samplecmplevelzero.slang index cd2ee54bd..556addf80 100644 --- a/tests/cross-compile/glsl-samplecmplevelzero.slang +++ b/tests/cross-compile/glsl-samplecmplevelzero.slang @@ -1,7 +1,7 @@ //TEST:CROSS_COMPILE(filecheck=CHECK): -profile ps_5_0 -entry main -target glsl -// CHECK: float _S3 = (textureLod(sampler2DShadow(shadowMap_0,sampler_0), (_S2), 0)); -// CHECK: float _S4 = (textureLodOffset(sampler2DShadow(shadowMap_0,sampler_0), (_S2), 0, (ivec2(1, 1)))); +// CHECK: float {{.*}} = (textureLod(sampler2DShadow(shadowMap_0,sampler_0), ({{.*}}), 0)); +// CHECK: float {{.*}} = (textureLodOffset(sampler2DShadow(shadowMap_0,sampler_0), ({{.*}}), 0, (ivec2(1, 1)))); Texture2D shadowMap; SamplerComparisonState sampler; diff --git a/tests/cross-compile/half-conversion.slang.glsl b/tests/cross-compile/half-conversion.slang.glsl index b062f67b4..b9772c32e 100644 --- a/tests/cross-compile/half-conversion.slang.glsl +++ b/tests/cross-compile/half-conversion.slang.glsl @@ -31,10 +31,10 @@ vec4 f16tof32_0(uvec4 value_0) } layout(location = 0) -out vec4 _S2; +out vec4 main_0; void main() { - _S2 = f16tof32_0(C_0.u_0); + main_0 = f16tof32_0(C_0.u_0); return; } diff --git a/tests/cross-compile/non-uniform-indexing.slang.glsl b/tests/cross-compile/non-uniform-indexing.slang.glsl index 07e8f9e38..35b5fab95 100644 --- a/tests/cross-compile/non-uniform-indexing.slang.glsl +++ b/tests/cross-compile/non-uniform-indexing.slang.glsl @@ -9,14 +9,14 @@ layout(binding = 1) uniform sampler s_0; layout(location = 0) -out vec4 _S1; +out vec4 main_0; layout(location = 0) -in vec3 _S2; +in vec3 uv_0; void main() { - _S1 = (texture(sampler2D(t_0[nonuniformEXT(int(_S2.z))],s_0), (_S2.xy))); + main_0 = (texture(sampler2D(t_0[nonuniformEXT(int(uv_0.z))],s_0), (uv_0.xy))); return; } diff --git a/tests/cross-compile/precise-keyword.slang b/tests/cross-compile/precise-keyword.slang index 5ebfd35ad..9be605e0c 100644 --- a/tests/cross-compile/precise-keyword.slang +++ b/tests/cross-compile/precise-keyword.slang @@ -1,11 +1,13 @@ // precise-keyword.slang -//TEST:CROSS_COMPILE:-target spirv-assembly -entry main -stage fragment +//TEST:SIMPLE(filecheck=SPIRV): -target spirv-assembly -entry main -stage fragment //TEST:CROSS_COMPILE:-target dxbc-assembly -entry main -stage fragment //TEST:CROSS_COMPILE:-target dxil-assembly -entry main -stage fragment -profile sm_6_0 // Test handling of the `precise` keyword +// SPIRV: OpEntryPoint + float4 main(float2 v : V) : SV_Target { precise float z; diff --git a/tests/cross-compile/sign.slang.glsl b/tests/cross-compile/sign.slang.glsl index 44c015967..ec0bfe377 100644 --- a/tests/cross-compile/sign.slang.glsl +++ b/tests/cross-compile/sign.slang.glsl @@ -3,10 +3,10 @@ layout(row_major) uniform; layout(row_major) buffer; layout(location = 0) -out vec4 _S1; +out vec4 main_0; void main() { - _S1 = vec4((ivec4(sign((vec4(1.5, 1.0, -1.5, -1.0)))))); + main_0 = vec4((ivec4(sign((vec4(1.5, 1.0, -1.5, -1.0)))))); return; } diff --git a/tests/cross-compile/sv-coverage.slang.glsl b/tests/cross-compile/sv-coverage.slang.glsl index 2a8ff0734..a5e0dea47 100644 --- a/tests/cross-compile/sv-coverage.slang.glsl +++ b/tests/cross-compile/sv-coverage.slang.glsl @@ -2,15 +2,15 @@ #version 450 layout(location = 0) -out vec4 _S1; +out vec4 main_0; layout(location = 0) -in vec4 _S2; +in vec4 color_0; void main() { - uint _S3 = uint(gl_SampleMaskIn[0]) ^ uint(1); - _S1 = _S2; - gl_SampleMask[0] = int(_S3); + uint _S1 = uint(gl_SampleMaskIn[0]) ^ uint(1); + main_0 = color_0; + gl_SampleMask[0] = int(_S1); return; } diff --git a/tests/cross-compile/unknown-image-format.slang.glsl b/tests/cross-compile/unknown-image-format.slang.glsl index e541a8b17..a39cf3693 100644 --- a/tests/cross-compile/unknown-image-format.slang.glsl +++ b/tests/cross-compile/unknown-image-format.slang.glsl @@ -39,7 +39,7 @@ layout(binding = 4) uniform image2D entryPointParams_explicitFormat_0; layout(location = 0) -out vec4 _S2; +out vec4 main_0; void main() { @@ -60,7 +60,7 @@ void main() vec4 result_3 = result_2 + _S8; vec4 _S9 = (imageLoad((entryPointParams_explicitFormat_0), ivec2((C_0.index_0)))); - _S2 = result_3 + _S9; + main_0 = result_3 + _S9; return; } diff --git a/tests/cross-compile/vector-comparison.slang.glsl b/tests/cross-compile/vector-comparison.slang.glsl index f7c28203e..f3f103678 100644 --- a/tests/cross-compile/vector-comparison.slang.glsl +++ b/tests/cross-compile/vector-comparison.slang.glsl @@ -14,13 +14,13 @@ layout(std140) uniform _S1 vec4 b_0; } params_0; layout(location = 0) -out vec4 _S2; +out vec4 main_0; void main() { const vec4 _S3 = vec4(2.0); const vec4 _S4 = vec4(3.0); - _S2 = mix(_S4, _S3, (equal(params_0.a_0,params_0.b_0))) + mix(_S4, _S3, (lessThan(params_0.a_0,params_0.b_0))) + mix(_S4, _S3, (greaterThan(params_0.a_0,params_0.b_0))) + mix(_S4, _S3, (lessThanEqual(params_0.a_0,params_0.b_0))) + mix(_S4, _S3, (greaterThanEqual(params_0.a_0,params_0.b_0))) + mix(_S4, _S3, (notEqual(params_0.a_0,params_0.b_0))); + main_0 = mix(_S4, _S3, (equal(params_0.a_0,params_0.b_0))) + mix(_S4, _S3, (lessThan(params_0.a_0,params_0.b_0))) + mix(_S4, _S3, (greaterThan(params_0.a_0,params_0.b_0))) + mix(_S4, _S3, (lessThanEqual(params_0.a_0,params_0.b_0))) + mix(_S4, _S3, (greaterThanEqual(params_0.a_0,params_0.b_0))) + mix(_S4, _S3, (notEqual(params_0.a_0,params_0.b_0))); return; } diff --git a/tests/cross-compile/vk-push-constant-set.slang.glsl b/tests/cross-compile/vk-push-constant-set.slang.glsl index 7a2ce4db0..dde1c9413 100644 --- a/tests/cross-compile/vk-push-constant-set.slang.glsl +++ b/tests/cross-compile/vk-push-constant-set.slang.glsl @@ -19,10 +19,10 @@ layout(std140) uniform _S2 } y_0; layout(location = 0) -out vec4 _S3; +out vec4 main_0; void main() { - _S3 = x_0.v_0 + y_0.v_0; + main_0 = x_0.v_0 + y_0.v_0; return; } |
