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/9ed19e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureLoad/9ed19e.wgsl.expected.spvasm
index 1732f24..e090e01 100644
--- a/test/tint/builtins/gen/literal/textureLoad/9ed19e.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureLoad/9ed19e.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 39
+; Bound: 46
; 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_9ed19e "textureLoad_9ed19e"
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,43 +41,51 @@
%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 %float
+%_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
- %22 = OpConstantComposite %v2uint %uint_1 %uint_1
+ %25 = OpConstantComposite %v2uint %uint_1 %uint_1
%_ptr_Function_float = OpTypePointer Function %float
- %25 = OpTypeFunction %v4float
+ %uint_0 = OpConstant %uint 0
+%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
+ %32 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
-%textureLoad_9ed19e = OpFunction %void None %12
- %15 = OpLabel
+%textureLoad_9ed19e = OpFunction %void None %15
+ %18 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8
- %18 = OpLoad %11 %arg_0
- %17 = OpImageFetch %v4float %18 %22 Lod %uint_1
- %16 = OpCompositeExtract %float %17 0
- OpStore %res %16
+ %21 = OpLoad %11 %arg_0
+ %20 = OpImageFetch %v4float %21 %25 Lod %uint_1
+ %19 = OpCompositeExtract %float %20 0
+ OpStore %res %19
+ %30 = OpAccessChain %_ptr_StorageBuffer_float %prevent_dce %uint_0
+ %31 = OpLoad %float %res
+ OpStore %30 %31
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %25
- %27 = OpLabel
- %28 = OpFunctionCall %void %textureLoad_9ed19e
+%vertex_main_inner = OpFunction %v4float None %32
+ %34 = OpLabel
+ %35 = OpFunctionCall %void %textureLoad_9ed19e
OpReturnValue %5
OpFunctionEnd
-%vertex_main = OpFunction %void None %12
- %30 = OpLabel
- %31 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %31
+%vertex_main = OpFunction %void None %15
+ %37 = OpLabel
+ %38 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %38
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %12
- %34 = OpLabel
- %35 = OpFunctionCall %void %textureLoad_9ed19e
+%fragment_main = OpFunction %void None %15
+ %41 = OpLabel
+ %42 = OpFunctionCall %void %textureLoad_9ed19e
OpReturn
OpFunctionEnd
-%compute_main = OpFunction %void None %12
- %37 = OpLabel
- %38 = OpFunctionCall %void %textureLoad_9ed19e
+%compute_main = OpFunction %void None %15
+ %44 = OpLabel
+ %45 = OpFunctionCall %void %textureLoad_9ed19e
OpReturn
OpFunctionEnd