spirv backend: do not generate a load for ignored expressions

Fixes spirv-val failing on loads of dynamic arrays.

Bug: chromium:1249602
Change-Id: Ic15af9f9ef2beb45bc732e4e45f023651544a1c7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/64400
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Antonio Maiorano
2021-09-16 13:32:57 +00:00
committed by Tint LUCI CQ
parent d1d99bc7de
commit dad26395d8
45 changed files with 177 additions and 411 deletions

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 114
; Bound: 110
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -128,7 +128,7 @@
%float_0 = OpConstant %float 0
%92 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
%void = OpTypeVoid
%103 = OpTypeFunction %void
%99 = OpTypeFunction %void
%getColor = OpFunction %v4float None %30
%fragment = OpFunctionParameter %FragmentInput
%34 = OpLabel
@@ -195,23 +195,19 @@
%output = OpVariable %_ptr_Function_FragmentOutput Function %89
%90 = OpAccessChain %_ptr_Function_v4float %output %uint_0
OpStore %90 %92
%95 = OpLoad %Uniforms %uniforms
%97 = OpLoad %26 %mySampler
%99 = OpLoad %29 %myTexture
%101 = OpLoad %PointLights %pointLights
%102 = OpLoad %FragmentOutput %output
OpReturnValue %102
%98 = OpLoad %FragmentOutput %output
OpReturnValue %98
OpFunctionEnd
%main = OpFunction %void None %103
%105 = OpLabel
%107 = OpLoad %v4float %position_1
%108 = OpLoad %v4float %view_position_1
%109 = OpLoad %v4float %normal_1
%110 = OpLoad %v2float %uv_1
%111 = OpLoad %v4float %color_1
%112 = OpCompositeConstruct %FragmentInput %107 %108 %109 %110 %111
%106 = OpFunctionCall %FragmentOutput %main_inner %112
%113 = OpCompositeExtract %v4float %106 0
OpStore %color_2 %113
%main = OpFunction %void None %99
%101 = OpLabel
%103 = OpLoad %v4float %position_1
%104 = OpLoad %v4float %view_position_1
%105 = OpLoad %v4float %normal_1
%106 = OpLoad %v2float %uv_1
%107 = OpLoad %v4float %color_1
%108 = OpCompositeConstruct %FragmentInput %103 %104 %105 %106 %107
%102 = OpFunctionCall %FragmentOutput %main_inner %108
%109 = OpCompositeExtract %v4float %102 0
OpStore %color_2 %109
OpReturn
OpFunctionEnd

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 160
; Bound: 112
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -235,53 +235,5 @@
%60 = OpTypeFunction %void
%main = OpFunction %void None %60
%63 = OpLabel
%65 = OpLoad %S %b0
%67 = OpLoad %S %b1
%69 = OpLoad %S %b2
%71 = OpLoad %S %b3
%73 = OpLoad %S %b4
%75 = OpLoad %S %b5
%77 = OpLoad %S %b6
%79 = OpLoad %S %b7
%81 = OpLoad %S %b8
%83 = OpLoad %S %b9
%85 = OpLoad %S %b10
%87 = OpLoad %S %b11
%89 = OpLoad %S %b12
%91 = OpLoad %S %b13
%93 = OpLoad %S %b14
%95 = OpLoad %S %b15
%97 = OpLoad %23 %t0
%99 = OpLoad %23 %t1
%101 = OpLoad %23 %t2
%103 = OpLoad %23 %t3
%105 = OpLoad %23 %t4
%107 = OpLoad %23 %t5
%109 = OpLoad %23 %t6
%111 = OpLoad %23 %t7
%113 = OpLoad %33 %t8
%115 = OpLoad %33 %t9
%117 = OpLoad %33 %t10
%119 = OpLoad %33 %t11
%121 = OpLoad %33 %t12
%123 = OpLoad %33 %t13
%125 = OpLoad %33 %t14
%127 = OpLoad %33 %t15
%129 = OpLoad %43 %s0
%131 = OpLoad %43 %s1
%133 = OpLoad %43 %s2
%135 = OpLoad %43 %s3
%137 = OpLoad %43 %s4
%139 = OpLoad %43 %s5
%141 = OpLoad %43 %s6
%143 = OpLoad %43 %s7
%145 = OpLoad %43 %s8
%147 = OpLoad %43 %s9
%149 = OpLoad %43 %s10
%151 = OpLoad %43 %s11
%153 = OpLoad %43 %s12
%155 = OpLoad %43 %s13
%157 = OpLoad %43 %s14
%159 = OpLoad %43 %s15
OpReturn
OpFunctionEnd