| bug/tint/1118.wgsl:64:31 warning: 'dpdx' must only be called from uniform control flow |
| normalW = normalize(-(cross(dpdx(x_62), dpdy(x_64)))); |
| ^^^^ |
| |
| bug/tint/1118.wgsl:47:3 note: control flow depends on non-uniform value |
| if ((x_9 > 0.0)) { |
| ^^ |
| |
| bug/tint/1118.wgsl:46:19 note: reading from module-scope private variable 'fClipDistance3' may result in a non-uniform value |
| let x_9 : f32 = fClipDistance3; |
| ^^^^^^^^^^^^^^ |
| |
| ; SPIR-V |
| ; Version: 1.3 |
| ; Generator: Google Tint Compiler; 0 |
| ; Bound: 198 |
| ; Schema: 0 |
| OpCapability Shader |
| %73 = OpExtInstImport "GLSL.std.450" |
| OpMemoryModel Logical GLSL450 |
| OpEntryPoint Fragment %main "main" %fClipDistance3_param_1 %fClipDistance4_param_1 %glFragColor_1_1 |
| OpExecutionMode %main OriginUpperLeft |
| OpName %fClipDistance3_param_1 "fClipDistance3_param_1" |
| OpName %fClipDistance4_param_1 "fClipDistance4_param_1" |
| OpName %glFragColor_1_1 "glFragColor_1_1" |
| OpName %fClipDistance3 "fClipDistance3" |
| OpName %fClipDistance4 "fClipDistance4" |
| OpName %Scene "Scene" |
| OpMemberName %Scene 0 "vEyePosition" |
| OpName %x_29 "x_29" |
| OpName %Material "Material" |
| OpMemberName %Material 0 "vDiffuseColor" |
| OpMemberName %Material 1 "vAmbientColor" |
| OpMemberName %Material 2 "placeholder" |
| OpMemberName %Material 3 "vEmissiveColor" |
| OpMemberName %Material 4 "placeholder2" |
| OpName %x_49 "x_49" |
| OpName %Mesh "Mesh" |
| OpMemberName %Mesh 0 "visibility" |
| OpName %x_137 "x_137" |
| OpName %glFragColor "glFragColor" |
| OpName %tint_discard "tint_discard" |
| OpName %main_1 "main_1" |
| OpName %viewDirectionW "viewDirectionW" |
| OpName %baseColor "baseColor" |
| OpName %diffuseColor "diffuseColor" |
| OpName %alpha "alpha" |
| OpName %normalW "normalW" |
| OpName %uvOffset "uvOffset" |
| OpName %baseAmbientColor "baseAmbientColor" |
| OpName %glossiness "glossiness" |
| OpName %diffuseBase "diffuseBase" |
| OpName %shadow "shadow" |
| OpName %refractionColor "refractionColor" |
| OpName %reflectionColor "reflectionColor" |
| OpName %emissiveColor "emissiveColor" |
| OpName %finalDiffuse "finalDiffuse" |
| OpName %finalSpecular "finalSpecular" |
| OpName %color "color" |
| OpName %tint_discard_func "tint_discard_func" |
| OpName %main_out "main_out" |
| OpMemberName %main_out 0 "glFragColor_1" |
| OpName %main_inner "main_inner" |
| OpName %fClipDistance3_param "fClipDistance3_param" |
| OpName %fClipDistance4_param "fClipDistance4_param" |
| OpName %main "main" |
| OpDecorate %fClipDistance3_param_1 Location 2 |
| OpDecorate %fClipDistance4_param_1 Location 3 |
| OpDecorate %glFragColor_1_1 Location 0 |
| OpDecorate %Scene Block |
| OpMemberDecorate %Scene 0 Offset 0 |
| OpDecorate %x_29 NonWritable |
| OpDecorate %x_29 DescriptorSet 0 |
| OpDecorate %x_29 Binding 0 |
| OpDecorate %Material Block |
| OpMemberDecorate %Material 0 Offset 0 |
| OpMemberDecorate %Material 1 Offset 16 |
| OpMemberDecorate %Material 2 Offset 28 |
| OpMemberDecorate %Material 3 Offset 32 |
| OpMemberDecorate %Material 4 Offset 44 |
| OpDecorate %x_49 NonWritable |
| OpDecorate %x_49 DescriptorSet 0 |
| OpDecorate %x_49 Binding 1 |
| OpDecorate %Mesh Block |
| OpMemberDecorate %Mesh 0 Offset 0 |
| OpDecorate %x_137 NonWritable |
| OpDecorate %x_137 DescriptorSet 0 |
| OpDecorate %x_137 Binding 2 |
| OpMemberDecorate %main_out 0 Offset 0 |
| %float = OpTypeFloat 32 |
| %_ptr_Input_float = OpTypePointer Input %float |
| %fClipDistance3_param_1 = OpVariable %_ptr_Input_float Input |
| %fClipDistance4_param_1 = OpVariable %_ptr_Input_float Input |
| %v4float = OpTypeVector %float 4 |
| %_ptr_Output_v4float = OpTypePointer Output %v4float |
| %8 = OpConstantNull %v4float |
| %glFragColor_1_1 = OpVariable %_ptr_Output_v4float Output %8 |
| %_ptr_Private_float = OpTypePointer Private %float |
| %11 = OpConstantNull %float |
| %fClipDistance3 = OpVariable %_ptr_Private_float Private %11 |
| %fClipDistance4 = OpVariable %_ptr_Private_float Private %11 |
| %Scene = OpTypeStruct %v4float |
| %_ptr_Uniform_Scene = OpTypePointer Uniform %Scene |
| %x_29 = OpVariable %_ptr_Uniform_Scene Uniform |
| %v3float = OpTypeVector %float 3 |
| %Material = OpTypeStruct %v4float %v3float %float %v3float %float |
| %_ptr_Uniform_Material = OpTypePointer Uniform %Material |
| %x_49 = OpVariable %_ptr_Uniform_Material Uniform |
| %Mesh = OpTypeStruct %float |
| %_ptr_Uniform_Mesh = OpTypePointer Uniform %Mesh |
| %x_137 = OpVariable %_ptr_Uniform_Mesh Uniform |
| %_ptr_Private_v4float = OpTypePointer Private %v4float |
| %glFragColor = OpVariable %_ptr_Private_v4float Private %8 |
| %bool = OpTypeBool |
| %false = OpConstantFalse %bool |
| %_ptr_Private_bool = OpTypePointer Private %bool |
| %tint_discard = OpVariable %_ptr_Private_bool Private %false |
| %void = OpTypeVoid |
| %29 = OpTypeFunction %void |
| %_ptr_Function_v3float = OpTypePointer Function %v3float |
| %35 = OpConstantNull %v3float |
| %_ptr_Function_v4float = OpTypePointer Function %v4float |
| %_ptr_Function_float = OpTypePointer Function %float |
| %v2float = OpTypeVector %float 2 |
| %_ptr_Function_v2float = OpTypePointer Function %v2float |
| %45 = OpConstantNull %v2float |
| %float_0 = OpConstant %float 0 |
| %true = OpConstantTrue %bool |
| %uint = OpTypeInt 32 0 |
| %uint_0 = OpConstant %uint 0 |
| %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float |
| %71 = OpConstantComposite %v3float %float_0 %float_0 %float_0 |
| %float_1 = OpConstant %float 1 |
| %80 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 |
| %uint_3 = OpConstant %uint 3 |
| %_ptr_Uniform_float = OpTypePointer Uniform %float |
| %96 = OpConstantComposite %v2float %float_0 %float_0 |
| %97 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 |
| %114 = OpConstantComposite %v3float %float_1 %float_1 %float_1 |
| %115 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_1 |
| %_ptr_Uniform_v3float = OpTypePointer Uniform %v3float |
| %uint_1 = OpConstant %uint 1 |
| %main_out = OpTypeStruct %v4float |
| %178 = OpTypeFunction %main_out %float %float |
| %189 = OpConstantNull %main_out |
| %main_1 = OpFunction %void None %29 |
| %32 = OpLabel |
| %viewDirectionW = OpVariable %_ptr_Function_v3float Function %35 |
| %baseColor = OpVariable %_ptr_Function_v4float Function %8 |
| %diffuseColor = OpVariable %_ptr_Function_v3float Function %35 |
| %alpha = OpVariable %_ptr_Function_float Function %11 |
| %normalW = OpVariable %_ptr_Function_v3float Function %35 |
| %uvOffset = OpVariable %_ptr_Function_v2float Function %45 |
| %baseAmbientColor = OpVariable %_ptr_Function_v3float Function %35 |
| %glossiness = OpVariable %_ptr_Function_float Function %11 |
| %diffuseBase = OpVariable %_ptr_Function_v3float Function %35 |
| %shadow = OpVariable %_ptr_Function_float Function %11 |
| %refractionColor = OpVariable %_ptr_Function_v4float Function %8 |
| %reflectionColor = OpVariable %_ptr_Function_v4float Function %8 |
| %emissiveColor = OpVariable %_ptr_Function_v3float Function %35 |
| %finalDiffuse = OpVariable %_ptr_Function_v3float Function %35 |
| %finalSpecular = OpVariable %_ptr_Function_v3float Function %35 |
| %color = OpVariable %_ptr_Function_v4float Function %8 |
| %56 = OpLoad %float %fClipDistance3 |
| %58 = OpFOrdGreaterThan %bool %56 %float_0 |
| OpSelectionMerge %59 None |
| OpBranchConditional %58 %60 %59 |
| %60 = OpLabel |
| OpStore %tint_discard %true |
| OpReturn |
| %59 = OpLabel |
| %62 = OpLoad %float %fClipDistance4 |
| %63 = OpFOrdGreaterThan %bool %62 %float_0 |
| OpSelectionMerge %64 None |
| OpBranchConditional %63 %65 %64 |
| %65 = OpLabel |
| OpStore %tint_discard %true |
| OpReturn |
| %64 = OpLabel |
| %69 = OpAccessChain %_ptr_Uniform_v4float %x_29 %uint_0 |
| %70 = OpLoad %v4float %69 |
| %74 = OpCompositeExtract %float %70 0 |
| %75 = OpCompositeExtract %float %70 1 |
| %76 = OpCompositeExtract %float %70 2 |
| %77 = OpCompositeConstruct %v3float %74 %75 %76 |
| %78 = OpFSub %v3float %77 %71 |
| %72 = OpExtInst %v3float %73 Normalize %78 |
| OpStore %viewDirectionW %72 |
| OpStore %baseColor %80 |
| %81 = OpAccessChain %_ptr_Uniform_v4float %x_49 %uint_0 |
| %82 = OpLoad %v4float %81 |
| %83 = OpCompositeExtract %float %82 0 |
| %84 = OpCompositeExtract %float %82 1 |
| %85 = OpCompositeExtract %float %82 2 |
| %86 = OpCompositeConstruct %v3float %83 %84 %85 |
| OpStore %diffuseColor %86 |
| %89 = OpAccessChain %_ptr_Uniform_float %x_49 %uint_0 %uint_3 |
| %90 = OpLoad %float %89 |
| OpStore %alpha %90 |
| %94 = OpDPdx %v3float %71 |
| %95 = OpDPdy %v3float %71 |
| %93 = OpExtInst %v3float %73 Cross %94 %95 |
| %92 = OpFNegate %v3float %93 |
| %91 = OpExtInst %v3float %73 Normalize %92 |
| OpStore %normalW %91 |
| OpStore %uvOffset %96 |
| %98 = OpLoad %v4float %baseColor |
| %99 = OpCompositeExtract %float %98 0 |
| %100 = OpCompositeExtract %float %98 1 |
| %101 = OpCompositeExtract %float %98 2 |
| %102 = OpCompositeConstruct %v3float %99 %100 %101 |
| %103 = OpCompositeExtract %float %97 0 |
| %104 = OpCompositeExtract %float %97 1 |
| %105 = OpCompositeExtract %float %97 2 |
| %106 = OpCompositeConstruct %v3float %103 %104 %105 |
| %107 = OpFMul %v3float %102 %106 |
| %108 = OpLoad %v4float %baseColor |
| %109 = OpCompositeExtract %float %107 0 |
| %110 = OpCompositeExtract %float %107 1 |
| %111 = OpCompositeExtract %float %107 2 |
| %112 = OpCompositeExtract %float %108 3 |
| %113 = OpCompositeConstruct %v4float %109 %110 %111 %112 |
| OpStore %baseColor %113 |
| OpStore %baseAmbientColor %114 |
| OpStore %glossiness %float_0 |
| OpStore %diffuseBase %71 |
| OpStore %shadow %float_1 |
| OpStore %refractionColor %115 |
| OpStore %reflectionColor %115 |
| %117 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_3 |
| %118 = OpLoad %v3float %117 |
| OpStore %emissiveColor %118 |
| %119 = OpLoad %v3float %diffuseBase |
| %120 = OpLoad %v3float %diffuseColor |
| %121 = OpLoad %v3float %emissiveColor |
| %123 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_1 |
| %124 = OpLoad %v3float %123 |
| %125 = OpLoad %v4float %baseColor |
| %127 = OpFMul %v3float %119 %120 |
| %128 = OpFAdd %v3float %127 %121 |
| %129 = OpFAdd %v3float %128 %124 |
| %126 = OpExtInst %v3float %73 NClamp %129 %71 %114 |
| %130 = OpCompositeExtract %float %125 0 |
| %131 = OpCompositeExtract %float %125 1 |
| %132 = OpCompositeExtract %float %125 2 |
| %133 = OpCompositeConstruct %v3float %130 %131 %132 |
| %134 = OpFMul %v3float %126 %133 |
| OpStore %finalDiffuse %134 |
| OpStore %finalSpecular %71 |
| %135 = OpLoad %v3float %finalDiffuse |
| %136 = OpLoad %v3float %baseAmbientColor |
| %137 = OpLoad %v3float %finalSpecular |
| %138 = OpLoad %v4float %reflectionColor |
| %139 = OpLoad %v4float %refractionColor |
| %140 = OpFMul %v3float %135 %136 |
| %141 = OpFAdd %v3float %140 %137 |
| %142 = OpCompositeExtract %float %138 0 |
| %143 = OpCompositeExtract %float %138 1 |
| %144 = OpCompositeExtract %float %138 2 |
| %145 = OpCompositeConstruct %v3float %142 %143 %144 |
| %146 = OpFAdd %v3float %141 %145 |
| %147 = OpCompositeExtract %float %139 0 |
| %148 = OpCompositeExtract %float %139 1 |
| %149 = OpCompositeExtract %float %139 2 |
| %150 = OpCompositeConstruct %v3float %147 %148 %149 |
| %151 = OpFAdd %v3float %146 %150 |
| %152 = OpLoad %float %alpha |
| %153 = OpCompositeExtract %float %151 0 |
| %154 = OpCompositeExtract %float %151 1 |
| %155 = OpCompositeExtract %float %151 2 |
| %156 = OpCompositeConstruct %v4float %153 %154 %155 %152 |
| OpStore %color %156 |
| %157 = OpLoad %v4float %color |
| %159 = OpCompositeExtract %float %157 0 |
| %160 = OpCompositeExtract %float %157 1 |
| %161 = OpCompositeExtract %float %157 2 |
| %162 = OpCompositeConstruct %v3float %159 %160 %161 |
| %158 = OpExtInst %v3float %73 NMax %162 %71 |
| %163 = OpLoad %v4float %color |
| %164 = OpCompositeExtract %float %158 0 |
| %165 = OpCompositeExtract %float %158 1 |
| %166 = OpCompositeExtract %float %158 2 |
| %167 = OpCompositeExtract %float %163 3 |
| %168 = OpCompositeConstruct %v4float %164 %165 %166 %167 |
| OpStore %color %168 |
| %169 = OpAccessChain %_ptr_Uniform_float %x_137 %uint_0 |
| %170 = OpLoad %float %169 |
| %171 = OpAccessChain %_ptr_Function_float %color %uint_3 |
| %172 = OpLoad %float %171 |
| %173 = OpAccessChain %_ptr_Function_float %color %uint_3 |
| %174 = OpFMul %float %172 %170 |
| OpStore %173 %174 |
| %175 = OpLoad %v4float %color |
| OpStore %glFragColor %175 |
| OpReturn |
| OpFunctionEnd |
| %tint_discard_func = OpFunction %void None %29 |
| %177 = OpLabel |
| OpKill |
| OpFunctionEnd |
| %main_inner = OpFunction %main_out None %178 |
| %fClipDistance3_param = OpFunctionParameter %float |
| %fClipDistance4_param = OpFunctionParameter %float |
| %183 = OpLabel |
| OpStore %fClipDistance3 %fClipDistance3_param |
| OpStore %fClipDistance4 %fClipDistance4_param |
| %184 = OpFunctionCall %void %main_1 |
| %185 = OpLoad %bool %tint_discard |
| OpSelectionMerge %186 None |
| OpBranchConditional %185 %187 %186 |
| %187 = OpLabel |
| %188 = OpFunctionCall %void %tint_discard_func |
| OpReturnValue %189 |
| %186 = OpLabel |
| %190 = OpLoad %v4float %glFragColor |
| %191 = OpCompositeConstruct %main_out %190 |
| OpReturnValue %191 |
| OpFunctionEnd |
| %main = OpFunction %void None %29 |
| %193 = OpLabel |
| %195 = OpLoad %float %fClipDistance3_param_1 |
| %196 = OpLoad %float %fClipDistance4_param_1 |
| %194 = OpFunctionCall %main_out %main_inner %195 %196 |
| %197 = OpCompositeExtract %v4float %194 0 |
| OpStore %glFragColor_1_1 %197 |
| OpReturn |
| OpFunctionEnd |