diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/cross-compile/unknown-image-format.slang | 56 | ||||
| -rw-r--r-- | tests/cross-compile/unknown-image-format.slang.glsl | 65 |
2 files changed, 121 insertions, 0 deletions
diff --git a/tests/cross-compile/unknown-image-format.slang b/tests/cross-compile/unknown-image-format.slang new file mode 100644 index 000000000..bf937c5fa --- /dev/null +++ b/tests/cross-compile/unknown-image-format.slang @@ -0,0 +1,56 @@ +// unknown-image-format.slang + +//TEST:CROSS_COMPILE:-target spirv-assembly -entry main -stage fragment -default-image-format-unknown + +// Ensure that we can emit R/W images with an unknown format, when required. + +// Global Scope: + +RWTexture2D<float> gNoFormat; + +[format("r32f")] +RWTexture2D<float> gExplicitFormat; + +// Nested in a Parameter Block + +struct PB +{ + RWTexture2D<float4> noFormat; + + [format("rgba8")] + RWTexture2D<float4> explicitFormat; +} +ParameterBlock<PB> gBlock; + +cbuffer C +{ + uint2 index; +} + +float4 main( + + // In entry-point parameter list + + uniform RWTexture2D<float4> noFormat, + + [format("rgba16f")] + uniform RWTexture2D<float4> explicitFormat + ) : SV_Target +{ + float4 result = 0; + +#define USE(NAME) result += NAME[index] + + USE(gNoFormat); + USE(gExplicitFormat); + + USE(gBlock.noFormat); + USE(gBlock.explicitFormat); + + USE(noFormat); + USE(explicitFormat); + +#undef USE + + return result; +} diff --git a/tests/cross-compile/unknown-image-format.slang.glsl b/tests/cross-compile/unknown-image-format.slang.glsl new file mode 100644 index 000000000..9995bba72 --- /dev/null +++ b/tests/cross-compile/unknown-image-format.slang.glsl @@ -0,0 +1,65 @@ +// unknown-image-format.slang.glsl +//TEST_IGNORE_FILE: + +#version 450 +#extension GL_EXT_shader_image_load_formatted : require + +struct SLANG_ParameterGroup_C_0 +{ + uvec2 index_0; +}; + +layout(binding = 2) +layout(std140) uniform _S1 +{ + SLANG_ParameterGroup_C_0 _data; +} C_0; + +layout(binding = 0) +uniform image2D gNoFormat_0; + +layout(r32f) +layout(binding = 1) +uniform image2D gExplicitFormat_0; + +layout(binding = 0, set = 1) +uniform image2D gBlock_noFormat_0; + +layout(rgba8) +layout(binding = 1, set = 1) +uniform image2D gBlock_explicitFormat_0; + +layout(binding = 3) +uniform image2D _S2; + +layout(rgba16f) +layout(binding = 4) +uniform image2D _S3; + +layout(location = 0) +out vec4 _S4; + +void main() +{ + const vec4 result_0 = vec4(0); + + float _S5 = (imageLoad((gNoFormat_0), ivec2((C_0._data.index_0))).x); + vec4 result_1 = result_0 + _S5; + + float _S6 = (imageLoad((gExplicitFormat_0), ivec2((C_0._data.index_0))).x); + vec4 result_2 = result_1 + _S6; + + vec4 _S7 = (imageLoad((gBlock_noFormat_0), ivec2((C_0._data.index_0)))); + vec4 result_3 = result_2 + _S7; + + vec4 _S8 = (imageLoad((gBlock_explicitFormat_0), ivec2((C_0._data.index_0)))); + vec4 result_4 = result_3 + _S8; + + vec4 _S9 = (imageLoad((_S2), ivec2((C_0._data.index_0)))); + vec4 result_5 = result_4 + _S9; + + vec4 _S10 = (imageLoad((_S3), ivec2((C_0._data.index_0)))); + _S4 = result_5 + _S10; + + return; +} |
