test/tint/builtins/gen: Use returned value
It appears that FXC and DXC do some validation post dead-code-elimination.
These tests have been updated so that the return value is assigned to a storage buffer, ensuring that all validation is performed.
Many DXC tests are affected by https://github.com/microsoft/DirectXShaderCompiler/issues/5082, which have been SKIP'ed.
Fixed: tint:1859
Change-Id: I0001a9a9821846cd0855c3d8ce2bec79ab8e64ef
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122662
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Auto-Submit: Ben Clayton <bclayton@google.com>
diff --git a/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.spvasm
index 81e00fd..66e3d53 100644
--- a/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureLoad/439e2a.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 40
+; Bound: 47
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -13,6 +13,9 @@
OpName %value "value"
OpName %vertex_point_size "vertex_point_size"
OpName %arg_0 "arg_0"
+ OpName %prevent_dce_block "prevent_dce_block"
+ OpMemberName %prevent_dce_block 0 "inner"
+ OpName %prevent_dce "prevent_dce"
OpName %textureLoad_439e2a "textureLoad_439e2a"
OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner"
@@ -23,6 +26,10 @@
OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %arg_0 DescriptorSet 1
OpDecorate %arg_0 Binding 0
+ OpDecorate %prevent_dce_block Block
+ OpMemberDecorate %prevent_dce_block 0 Offset 0
+ OpDecorate %prevent_dce DescriptorSet 2
+ OpDecorate %prevent_dce Binding 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
@@ -34,44 +41,52 @@
%11 = OpTypeImage %float 2D 0 0 0 1 Unknown
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
+%prevent_dce_block = OpTypeStruct %v4float
+%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
+%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
%void = OpTypeVoid
- %12 = OpTypeFunction %void
+ %15 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%v2uint = OpTypeVector %uint 2
%uint_1 = OpConstant %uint 1
- %21 = OpConstantComposite %v2uint %uint_1 %uint_1
+ %24 = OpConstantComposite %v2uint %uint_1 %uint_1
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%_ptr_Function_v4float = OpTypePointer Function %v4float
- %26 = OpTypeFunction %v4float
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
+ %33 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
-%textureLoad_439e2a = OpFunction %void None %12
- %15 = OpLabel
+%textureLoad_439e2a = OpFunction %void None %15
+ %18 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %5
- %17 = OpLoad %11 %arg_0
- %16 = OpImageFetch %v4float %17 %21 Lod %int_1
- OpStore %res %16
+ %20 = OpLoad %11 %arg_0
+ %19 = OpImageFetch %v4float %20 %24 Lod %int_1
+ OpStore %res %19
+ %31 = OpAccessChain %_ptr_StorageBuffer_v4float %prevent_dce %uint_0
+ %32 = OpLoad %v4float %res
+ OpStore %31 %32
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %26
- %28 = OpLabel
- %29 = OpFunctionCall %void %textureLoad_439e2a
+%vertex_main_inner = OpFunction %v4float None %33
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %textureLoad_439e2a
OpReturnValue %5
OpFunctionEnd
-%vertex_main = OpFunction %void None %12
- %31 = OpLabel
- %32 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %32
+%vertex_main = OpFunction %void None %15
+ %38 = OpLabel
+ %39 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %39
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %12
- %35 = OpLabel
- %36 = OpFunctionCall %void %textureLoad_439e2a
+%fragment_main = OpFunction %void None %15
+ %42 = OpLabel
+ %43 = OpFunctionCall %void %textureLoad_439e2a
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %12
- %38 = OpLabel
- %39 = OpFunctionCall %void %textureLoad_439e2a
+%compute_main = OpFunction %void None %15
+ %45 = OpLabel
+ %46 = OpFunctionCall %void %textureLoad_439e2a
OpReturn
OpFunctionEnd