| 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: 195 |
| ; Schema: 0 |
| OpCapability Shader |
| %71 = 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 |
| %26 = OpConstantNull %bool |
| %_ptr_Private_bool = OpTypePointer Private %bool |
| %tint_discard = OpVariable %_ptr_Private_bool Private %26 |
| %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 |
| %true = OpConstantTrue %bool |
| %uint = OpTypeInt 32 0 |
| %uint_0 = OpConstant %uint 0 |
| %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float |
| %float_1 = OpConstant %float 1 |
| %78 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 |
| %uint_3 = OpConstant %uint 3 |
| %_ptr_Uniform_float = OpTypePointer Uniform %float |
| %110 = OpConstantComposite %v3float %float_1 %float_1 %float_1 |
| %float_0 = OpConstant %float 0 |
| %112 = 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 |
| %175 = OpTypeFunction %main_out %float %float |
| %186 = 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 |
| %57 = OpFOrdGreaterThan %bool %56 %11 |
| OpSelectionMerge %58 None |
| OpBranchConditional %57 %59 %58 |
| %59 = OpLabel |
| OpStore %tint_discard %true |
| OpReturn |
| %58 = OpLabel |
| %61 = OpLoad %float %fClipDistance4 |
| %62 = OpFOrdGreaterThan %bool %61 %11 |
| OpSelectionMerge %63 None |
| OpBranchConditional %62 %64 %63 |
| %64 = OpLabel |
| OpStore %tint_discard %true |
| OpReturn |
| %63 = OpLabel |
| %68 = OpAccessChain %_ptr_Uniform_v4float %x_29 %uint_0 |
| %69 = OpLoad %v4float %68 |
| %72 = OpCompositeExtract %float %69 0 |
| %73 = OpCompositeExtract %float %69 1 |
| %74 = OpCompositeExtract %float %69 2 |
| %75 = OpCompositeConstruct %v3float %72 %73 %74 |
| %76 = OpFSub %v3float %75 %35 |
| %70 = OpExtInst %v3float %71 Normalize %76 |
| OpStore %viewDirectionW %70 |
| OpStore %baseColor %78 |
| %79 = OpAccessChain %_ptr_Uniform_v4float %x_49 %uint_0 |
| %80 = OpLoad %v4float %79 |
| %81 = OpCompositeExtract %float %80 0 |
| %82 = OpCompositeExtract %float %80 1 |
| %83 = OpCompositeExtract %float %80 2 |
| %84 = OpCompositeConstruct %v3float %81 %82 %83 |
| OpStore %diffuseColor %84 |
| %87 = OpAccessChain %_ptr_Uniform_float %x_49 %uint_0 %uint_3 |
| %88 = OpLoad %float %87 |
| OpStore %alpha %88 |
| %92 = OpDPdx %v3float %35 |
| %93 = OpDPdy %v3float %35 |
| %91 = OpExtInst %v3float %71 Cross %92 %93 |
| %90 = OpFNegate %v3float %91 |
| %89 = OpExtInst %v3float %71 Normalize %90 |
| OpStore %normalW %89 |
| OpStore %uvOffset %45 |
| %94 = OpLoad %v4float %baseColor |
| %95 = OpCompositeExtract %float %94 0 |
| %96 = OpCompositeExtract %float %94 1 |
| %97 = OpCompositeExtract %float %94 2 |
| %98 = OpCompositeConstruct %v3float %95 %96 %97 |
| %99 = OpCompositeExtract %float %8 0 |
| %100 = OpCompositeExtract %float %8 1 |
| %101 = OpCompositeExtract %float %8 2 |
| %102 = OpCompositeConstruct %v3float %99 %100 %101 |
| %103 = OpFMul %v3float %98 %102 |
| %104 = OpLoad %v4float %baseColor |
| %105 = OpCompositeExtract %float %103 0 |
| %106 = OpCompositeExtract %float %103 1 |
| %107 = OpCompositeExtract %float %103 2 |
| %108 = OpCompositeExtract %float %104 3 |
| %109 = OpCompositeConstruct %v4float %105 %106 %107 %108 |
| OpStore %baseColor %109 |
| OpStore %baseAmbientColor %110 |
| OpStore %glossiness %11 |
| OpStore %diffuseBase %35 |
| OpStore %shadow %float_1 |
| OpStore %refractionColor %112 |
| OpStore %reflectionColor %112 |
| %114 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_3 |
| %115 = OpLoad %v3float %114 |
| OpStore %emissiveColor %115 |
| %116 = OpLoad %v3float %diffuseBase |
| %117 = OpLoad %v3float %diffuseColor |
| %118 = OpLoad %v3float %emissiveColor |
| %120 = OpAccessChain %_ptr_Uniform_v3float %x_49 %uint_1 |
| %121 = OpLoad %v3float %120 |
| %122 = OpLoad %v4float %baseColor |
| %124 = OpFMul %v3float %116 %117 |
| %125 = OpFAdd %v3float %124 %118 |
| %126 = OpFAdd %v3float %125 %121 |
| %123 = OpExtInst %v3float %71 NClamp %126 %35 %110 |
| %127 = OpCompositeExtract %float %122 0 |
| %128 = OpCompositeExtract %float %122 1 |
| %129 = OpCompositeExtract %float %122 2 |
| %130 = OpCompositeConstruct %v3float %127 %128 %129 |
| %131 = OpFMul %v3float %123 %130 |
| OpStore %finalDiffuse %131 |
| OpStore %finalSpecular %35 |
| %132 = OpLoad %v3float %finalDiffuse |
| %133 = OpLoad %v3float %baseAmbientColor |
| %134 = OpLoad %v3float %finalSpecular |
| %135 = OpLoad %v4float %reflectionColor |
| %136 = OpLoad %v4float %refractionColor |
| %137 = OpFMul %v3float %132 %133 |
| %138 = OpFAdd %v3float %137 %134 |
| %139 = OpCompositeExtract %float %135 0 |
| %140 = OpCompositeExtract %float %135 1 |
| %141 = OpCompositeExtract %float %135 2 |
| %142 = OpCompositeConstruct %v3float %139 %140 %141 |
| %143 = OpFAdd %v3float %138 %142 |
| %144 = OpCompositeExtract %float %136 0 |
| %145 = OpCompositeExtract %float %136 1 |
| %146 = OpCompositeExtract %float %136 2 |
| %147 = OpCompositeConstruct %v3float %144 %145 %146 |
| %148 = OpFAdd %v3float %143 %147 |
| %149 = OpLoad %float %alpha |
| %150 = OpCompositeExtract %float %148 0 |
| %151 = OpCompositeExtract %float %148 1 |
| %152 = OpCompositeExtract %float %148 2 |
| %153 = OpCompositeConstruct %v4float %150 %151 %152 %149 |
| OpStore %color %153 |
| %154 = OpLoad %v4float %color |
| %156 = OpCompositeExtract %float %154 0 |
| %157 = OpCompositeExtract %float %154 1 |
| %158 = OpCompositeExtract %float %154 2 |
| %159 = OpCompositeConstruct %v3float %156 %157 %158 |
| %155 = OpExtInst %v3float %71 NMax %159 %35 |
| %160 = OpLoad %v4float %color |
| %161 = OpCompositeExtract %float %155 0 |
| %162 = OpCompositeExtract %float %155 1 |
| %163 = OpCompositeExtract %float %155 2 |
| %164 = OpCompositeExtract %float %160 3 |
| %165 = OpCompositeConstruct %v4float %161 %162 %163 %164 |
| OpStore %color %165 |
| %166 = OpAccessChain %_ptr_Uniform_float %x_137 %uint_0 |
| %167 = OpLoad %float %166 |
| %168 = OpAccessChain %_ptr_Function_float %color %uint_3 |
| %169 = OpLoad %float %168 |
| %170 = OpAccessChain %_ptr_Function_float %color %uint_3 |
| %171 = OpFMul %float %169 %167 |
| OpStore %170 %171 |
| %172 = OpLoad %v4float %color |
| OpStore %glFragColor %172 |
| OpReturn |
| OpFunctionEnd |
| %tint_discard_func = OpFunction %void None %29 |
| %174 = OpLabel |
| OpKill |
| OpFunctionEnd |
| %main_inner = OpFunction %main_out None %175 |
| %fClipDistance3_param = OpFunctionParameter %float |
| %fClipDistance4_param = OpFunctionParameter %float |
| %180 = OpLabel |
| OpStore %fClipDistance3 %fClipDistance3_param |
| OpStore %fClipDistance4 %fClipDistance4_param |
| %181 = OpFunctionCall %void %main_1 |
| %182 = OpLoad %bool %tint_discard |
| OpSelectionMerge %183 None |
| OpBranchConditional %182 %184 %183 |
| %184 = OpLabel |
| %185 = OpFunctionCall %void %tint_discard_func |
| OpReturnValue %186 |
| %183 = OpLabel |
| %187 = OpLoad %v4float %glFragColor |
| %188 = OpCompositeConstruct %main_out %187 |
| OpReturnValue %188 |
| OpFunctionEnd |
| %main = OpFunction %void None %29 |
| %190 = OpLabel |
| %192 = OpLoad %float %fClipDistance3_param_1 |
| %193 = OpLoad %float %fClipDistance4_param_1 |
| %191 = OpFunctionCall %main_out %main_inner %192 %193 |
| %194 = OpCompositeExtract %v4float %191 0 |
| OpStore %glFragColor_1_1 %194 |
| OpReturn |
| OpFunctionEnd |