From bf752edaa4d8ff88d5ba1ec3c0b6ad76be618961 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Fri, 19 May 2023 11:29:45 +0200 Subject: [PATCH] Update test output for preserve structured. --- ...tured-buffers.structured.fxconly.asm.frag} | 4 +-- .../structured-buffer.structured.asm.frag} | 4 +-- ...ctured-buffers.structured.fxconly.asm.frag | 26 +++++++++++++++++++ .../structured-buffer.structured.asm.frag | 26 +++++++++++++++++++ ...tured-buffers.structured.fxconly.asm.frag} | 0 ... => structured-buffer.structured.asm.frag} | 0 test_shaders.py | 2 ++ 7 files changed, 58 insertions(+), 4 deletions(-) rename reference/{shaders-hlsl/asm/frag/array-of-structured-buffers.asm.frag => opt/shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag} (76%) rename reference/{shaders-hlsl/asm/frag/structured-buffer.asm.frag => opt/shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag} (75%) create mode 100644 reference/shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag create mode 100644 reference/shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag rename shaders-hlsl/asm/frag/{array-of-structured-buffers.frag => array-of-structured-buffers.structured.fxconly.asm.frag} (100%) rename shaders-hlsl/asm/frag/{structured-buffer.frag => structured-buffer.structured.asm.frag} (100%) diff --git a/reference/shaders-hlsl/asm/frag/array-of-structured-buffers.asm.frag b/reference/opt/shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag similarity index 76% rename from reference/shaders-hlsl/asm/frag/array-of-structured-buffers.asm.frag rename to reference/opt/shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag index 18e76722..77bd3a67 100644 --- a/reference/shaders-hlsl/asm/frag/array-of-structured-buffers.asm.frag +++ b/reference/opt/shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag @@ -9,7 +9,7 @@ static float4 out_var_SV_Target; struct SPIRV_Cross_Output { - float4 out_var_SV_Target : COLOR0; + float4 out_var_SV_Target : SV_Target0; }; void frag_main() @@ -21,6 +21,6 @@ SPIRV_Cross_Output main() { frag_main(); SPIRV_Cross_Output stage_output; - stage_output.out_var_SV_Target = float4(out_var_SV_Target); + stage_output.out_var_SV_Target = out_var_SV_Target; return stage_output; } diff --git a/reference/shaders-hlsl/asm/frag/structured-buffer.asm.frag b/reference/opt/shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag similarity index 75% rename from reference/shaders-hlsl/asm/frag/structured-buffer.asm.frag rename to reference/opt/shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag index cebe9ca7..d374bb9f 100644 --- a/reference/shaders-hlsl/asm/frag/structured-buffer.asm.frag +++ b/reference/opt/shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag @@ -9,7 +9,7 @@ static float4 out_var_SV_Target; struct SPIRV_Cross_Output { - float4 out_var_SV_Target : COLOR0; + float4 out_var_SV_Target : SV_Target0; }; void frag_main() @@ -21,6 +21,6 @@ SPIRV_Cross_Output main() { frag_main(); SPIRV_Cross_Output stage_output; - stage_output.out_var_SV_Target = float4(out_var_SV_Target); + stage_output.out_var_SV_Target = out_var_SV_Target; return stage_output; } diff --git a/reference/shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag b/reference/shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag new file mode 100644 index 00000000..77bd3a67 --- /dev/null +++ b/reference/shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag @@ -0,0 +1,26 @@ +struct Data +{ + float4 Color; +}; + +StructuredBuffer Colors[2] : register(t0); + +static float4 out_var_SV_Target; + +struct SPIRV_Cross_Output +{ + float4 out_var_SV_Target : SV_Target0; +}; + +void frag_main() +{ + out_var_SV_Target = Colors[1][3u].Color; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.out_var_SV_Target = out_var_SV_Target; + return stage_output; +} diff --git a/reference/shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag b/reference/shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag new file mode 100644 index 00000000..d374bb9f --- /dev/null +++ b/reference/shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag @@ -0,0 +1,26 @@ +struct Data +{ + float4 Color; +}; + +StructuredBuffer Colors : register(t0); + +static float4 out_var_SV_Target; + +struct SPIRV_Cross_Output +{ + float4 out_var_SV_Target : SV_Target0; +}; + +void frag_main() +{ + out_var_SV_Target = Colors[3u].Color; +} + +SPIRV_Cross_Output main() +{ + frag_main(); + SPIRV_Cross_Output stage_output; + stage_output.out_var_SV_Target = out_var_SV_Target; + return stage_output; +} diff --git a/shaders-hlsl/asm/frag/array-of-structured-buffers.frag b/shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag similarity index 100% rename from shaders-hlsl/asm/frag/array-of-structured-buffers.frag rename to shaders-hlsl/asm/frag/array-of-structured-buffers.structured.fxconly.asm.frag diff --git a/shaders-hlsl/asm/frag/structured-buffer.frag b/shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag similarity index 100% rename from shaders-hlsl/asm/frag/structured-buffer.frag rename to shaders-hlsl/asm/frag/structured-buffer.structured.asm.frag diff --git a/test_shaders.py b/test_shaders.py index 1e8af62a..6ae9c94a 100755 --- a/test_shaders.py +++ b/test_shaders.py @@ -515,6 +515,8 @@ def cross_compile_hlsl(shader, spirv, opt, force_no_external_validation, iterati hlsl_args.append('--hlsl-flatten-matrix-vertex-input-semantics') if '.relax-nan.' in shader: hlsl_args.append('--relax-nan-checks') + if '.structured.' in shader: + hlsl_args.append('--hlsl-preserve-structured-buffers') subprocess.check_call(hlsl_args)