blob: 636dbca046ff16782f78fbd5a1738a95f5c6edf9 [file] [log] [blame]
bug/dawn/947.wgsl:59:20 warning: 'textureSample' must only be called from uniform control flow
var srcColor = textureSample(myTexture, mySampler, texcoord);
^^^^^^^^^^^^^
bug/dawn/947.wgsl:55:5 note: control flow depends on non-uniform value
if (!all(clampedTexcoord == texcoord)) {
^^
bug/dawn/947.wgsl:55:33 note: reading from user-defined input 'texcoord' may result in a non-uniform value
if (!all(clampedTexcoord == texcoord)) {
^^^^^^^^
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 138
; Schema: 0
OpCapability Shader
%117 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vs_main "vs_main" %VertexIndex_1 %texcoords_1 %position_1 %vertex_point_size
OpEntryPoint Fragment %fs_main "fs_main" %texcoord_1 %value
OpExecutionMode %fs_main OriginUpperLeft
OpName %VertexIndex_1 "VertexIndex_1"
OpName %texcoords_1 "texcoords_1"
OpName %position_1 "position_1"
OpName %vertex_point_size "vertex_point_size"
OpName %texcoord_1 "texcoord_1"
OpName %value "value"
OpName %Uniforms "Uniforms"
OpMemberName %Uniforms 0 "u_scale"
OpMemberName %Uniforms 1 "u_offset"
OpName %uniforms "uniforms"
OpName %mySampler "mySampler"
OpName %myTexture "myTexture"
OpName %VertexOutputs "VertexOutputs"
OpMemberName %VertexOutputs 0 "texcoords"
OpMemberName %VertexOutputs 1 "position"
OpName %vs_main_inner "vs_main_inner"
OpName %VertexIndex "VertexIndex"
OpName %texcoord "texcoord"
OpName %output "output"
OpName %flipY "flipY"
OpName %vs_main "vs_main"
OpName %tint_discard_func "tint_discard_func"
OpName %fs_main_inner "fs_main_inner"
OpName %texcoord_0 "texcoord"
OpName %clampedTexcoord "clampedTexcoord"
OpName %srcColor "srcColor"
OpName %fs_main "fs_main"
OpDecorate %VertexIndex_1 BuiltIn VertexIndex
OpDecorate %texcoords_1 Location 0
OpDecorate %position_1 BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %texcoord_1 Location 0
OpDecorate %value Location 0
OpDecorate %Uniforms Block
OpMemberDecorate %Uniforms 0 Offset 0
OpMemberDecorate %Uniforms 1 Offset 8
OpDecorate %uniforms NonWritable
OpDecorate %uniforms Binding 0
OpDecorate %uniforms DescriptorSet 0
OpDecorate %mySampler Binding 1
OpDecorate %mySampler DescriptorSet 0
OpDecorate %myTexture Binding 2
OpDecorate %myTexture DescriptorSet 0
OpMemberDecorate %VertexOutputs 0 Offset 0
OpMemberDecorate %VertexOutputs 1 Offset 16
OpDecorate %_arr_v2float_uint_3 ArrayStride 8
%uint = OpTypeInt 32 0
%_ptr_Input_uint = OpTypePointer Input %uint
%VertexIndex_1 = OpVariable %_ptr_Input_uint Input
%float = OpTypeFloat 32
%v2float = OpTypeVector %float 2
%_ptr_Output_v2float = OpTypePointer Output %v2float
%8 = OpConstantNull %v2float
%texcoords_1 = OpVariable %_ptr_Output_v2float Output %8
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%12 = OpConstantNull %v4float
%position_1 = OpVariable %_ptr_Output_v4float Output %12
%_ptr_Output_float = OpTypePointer Output %float
%15 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %15
%_ptr_Input_v2float = OpTypePointer Input %v2float
%texcoord_1 = OpVariable %_ptr_Input_v2float Input
%value = OpVariable %_ptr_Output_v4float Output %12
%Uniforms = OpTypeStruct %v2float %v2float
%_ptr_Uniform_Uniforms = OpTypePointer Uniform %Uniforms
%uniforms = OpVariable %_ptr_Uniform_Uniforms Uniform
%24 = OpTypeSampler
%_ptr_UniformConstant_24 = OpTypePointer UniformConstant %24
%mySampler = OpVariable %_ptr_UniformConstant_24 UniformConstant
%27 = OpTypeImage %float 2D 0 0 0 1 Unknown
%_ptr_UniformConstant_27 = OpTypePointer UniformConstant %27
%myTexture = OpVariable %_ptr_UniformConstant_27 UniformConstant
%VertexOutputs = OpTypeStruct %v2float %v4float
%28 = OpTypeFunction %VertexOutputs %uint
%uint_3 = OpConstant %uint 3
%_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3
%float_n0_5 = OpConstant %float -0.5
%36 = OpConstantComposite %v2float %float_n0_5 %15
%float_1_5 = OpConstant %float 1.5
%38 = OpConstantComposite %v2float %float_1_5 %15
%float_0_5 = OpConstant %float 0.5
%float_2 = OpConstant %float 2
%41 = OpConstantComposite %v2float %float_0_5 %float_2
%42 = OpConstantComposite %_arr_v2float_uint_3 %36 %38 %41
%_ptr_Function__arr_v2float_uint_3 = OpTypePointer Function %_arr_v2float_uint_3
%45 = OpConstantNull %_arr_v2float_uint_3
%_ptr_Function_VertexOutputs = OpTypePointer Function %VertexOutputs
%48 = OpConstantNull %VertexOutputs
%uint_1 = OpConstant %uint 1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%_ptr_Function_v2float = OpTypePointer Function %v2float
%float_1 = OpConstant %float 1
%57 = OpConstantComposite %v2float %float_1 %float_1
%uint_0 = OpConstant %uint 0
%_ptr_Uniform_float = OpTypePointer Uniform %float
%bool = OpTypeBool
%_ptr_Function_bool = OpTypePointer Function %bool
%70 = OpConstantNull %bool
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%float_n1 = OpConstant %float -1
%86 = OpConstantComposite %v2float %float_1 %float_n1
%88 = OpConstantComposite %v2float %15 %float_1
%void = OpTypeVoid
%102 = OpTypeFunction %void
%112 = OpTypeFunction %v4float %v2float
%v2bool = OpTypeVector %bool 2
%130 = OpTypeSampledImage %27
%vs_main_inner = OpFunction %VertexOutputs None %28
%VertexIndex = OpFunctionParameter %uint
%32 = OpLabel
%texcoord = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %45
%output = OpVariable %_ptr_Function_VertexOutputs Function %48
%flipY = OpVariable %_ptr_Function_bool Function %70
OpStore %texcoord %42
%51 = OpAccessChain %_ptr_Function_v4float %output %uint_1
%53 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex
%54 = OpLoad %v2float %53
%55 = OpVectorTimesScalar %v2float %54 %float_2
%58 = OpFSub %v2float %55 %57
%59 = OpCompositeExtract %float %58 0
%60 = OpCompositeExtract %float %58 1
%61 = OpCompositeConstruct %v4float %59 %60 %15 %float_1
OpStore %51 %61
%64 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_1
%65 = OpLoad %float %64
%66 = OpFOrdLessThan %bool %65 %15
OpStore %flipY %66
%71 = OpLoad %bool %flipY
OpSelectionMerge %72 None
OpBranchConditional %71 %73 %74
%73 = OpLabel
%75 = OpAccessChain %_ptr_Function_v2float %output %uint_0
%76 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex
%77 = OpLoad %v2float %76
%79 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0
%80 = OpLoad %v2float %79
%81 = OpFMul %v2float %77 %80
%82 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_1
%83 = OpLoad %v2float %82
%84 = OpFAdd %v2float %81 %83
%87 = OpFMul %v2float %84 %86
%89 = OpFAdd %v2float %87 %88
OpStore %75 %89
OpBranch %72
%74 = OpLabel
%90 = OpAccessChain %_ptr_Function_v2float %output %uint_0
%91 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex
%92 = OpLoad %v2float %91
%93 = OpFMul %v2float %92 %86
%94 = OpFAdd %v2float %93 %88
%95 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0
%96 = OpLoad %v2float %95
%97 = OpFMul %v2float %94 %96
%98 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_1
%99 = OpLoad %v2float %98
%100 = OpFAdd %v2float %97 %99
OpStore %90 %100
OpBranch %72
%72 = OpLabel
%101 = OpLoad %VertexOutputs %output
OpReturnValue %101
OpFunctionEnd
%vs_main = OpFunction %void None %102
%105 = OpLabel
%107 = OpLoad %uint %VertexIndex_1
%106 = OpFunctionCall %VertexOutputs %vs_main_inner %107
%108 = OpCompositeExtract %v2float %106 0
OpStore %texcoords_1 %108
%109 = OpCompositeExtract %v4float %106 1
OpStore %position_1 %109
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%tint_discard_func = OpFunction %void None %102
%111 = OpLabel
OpKill
OpFunctionEnd
%fs_main_inner = OpFunction %v4float None %112
%texcoord_0 = OpFunctionParameter %v2float
%115 = OpLabel
%clampedTexcoord = OpVariable %_ptr_Function_v2float Function %8
%srcColor = OpVariable %_ptr_Function_v4float Function %12
%116 = OpExtInst %v2float %117 NClamp %texcoord_0 %8 %57
OpStore %clampedTexcoord %116
%121 = OpLoad %v2float %clampedTexcoord
%122 = OpFOrdEqual %v2bool %121 %texcoord_0
%120 = OpAll %bool %122
%119 = OpLogicalNot %bool %120
OpSelectionMerge %124 None
OpBranchConditional %119 %125 %124
%125 = OpLabel
%126 = OpFunctionCall %void %tint_discard_func
OpReturnValue %12
%124 = OpLabel
%128 = OpLoad %24 %mySampler
%129 = OpLoad %27 %myTexture
%131 = OpSampledImage %130 %129 %128
%127 = OpImageSampleImplicitLod %v4float %131 %texcoord_0
OpStore %srcColor %127
%133 = OpLoad %v4float %srcColor
OpReturnValue %133
OpFunctionEnd
%fs_main = OpFunction %void None %102
%135 = OpLabel
%137 = OpLoad %v2float %texcoord_1
%136 = OpFunctionCall %v4float %fs_main_inner %137
OpStore %value %136
OpReturn
OpFunctionEnd