blob: 8e5c56c412773600fa0f0d1cb4a72933221fd6f9 [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: 139
; Schema: 0
OpCapability Shader
%118 = 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
%float_0 = OpConstant %float 0
%37 = OpConstantComposite %v2float %float_n0_5 %float_0
%float_1_5 = OpConstant %float 1.5
%39 = OpConstantComposite %v2float %float_1_5 %float_0
%float_0_5 = OpConstant %float 0.5
%float_2 = OpConstant %float 2
%42 = OpConstantComposite %v2float %float_0_5 %float_2
%43 = OpConstantComposite %_arr_v2float_uint_3 %37 %39 %42
%_ptr_Function__arr_v2float_uint_3 = OpTypePointer Function %_arr_v2float_uint_3
%46 = OpConstantNull %_arr_v2float_uint_3
%_ptr_Function_VertexOutputs = OpTypePointer Function %VertexOutputs
%49 = OpConstantNull %VertexOutputs
%uint_1 = OpConstant %uint 1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%_ptr_Function_v2float = OpTypePointer Function %v2float
%float_1 = OpConstant %float 1
%58 = 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
%71 = OpConstantNull %bool
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%float_n1 = OpConstant %float -1
%87 = OpConstantComposite %v2float %float_1 %float_n1
%89 = OpConstantComposite %v2float %float_0 %float_1
%void = OpTypeVoid
%103 = OpTypeFunction %void
%113 = OpTypeFunction %v4float %v2float
%v2bool = OpTypeVector %bool 2
%131 = OpTypeSampledImage %27
%vs_main_inner = OpFunction %VertexOutputs None %28
%VertexIndex = OpFunctionParameter %uint
%32 = OpLabel
%texcoord = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %46
%output = OpVariable %_ptr_Function_VertexOutputs Function %49
%flipY = OpVariable %_ptr_Function_bool Function %71
OpStore %texcoord %43
%52 = OpAccessChain %_ptr_Function_v4float %output %uint_1
%54 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex
%55 = OpLoad %v2float %54
%56 = OpVectorTimesScalar %v2float %55 %float_2
%59 = OpFSub %v2float %56 %58
%60 = OpCompositeExtract %float %59 0
%61 = OpCompositeExtract %float %59 1
%62 = OpCompositeConstruct %v4float %60 %61 %15 %float_1
OpStore %52 %62
%65 = OpAccessChain %_ptr_Uniform_float %uniforms %uint_0 %uint_1
%66 = OpLoad %float %65
%67 = OpFOrdLessThan %bool %66 %15
OpStore %flipY %67
%72 = OpLoad %bool %flipY
OpSelectionMerge %73 None
OpBranchConditional %72 %74 %75
%74 = OpLabel
%76 = OpAccessChain %_ptr_Function_v2float %output %uint_0
%77 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex
%78 = OpLoad %v2float %77
%80 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0
%81 = OpLoad %v2float %80
%82 = OpFMul %v2float %78 %81
%83 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_1
%84 = OpLoad %v2float %83
%85 = OpFAdd %v2float %82 %84
%88 = OpFMul %v2float %85 %87
%90 = OpFAdd %v2float %88 %89
OpStore %76 %90
OpBranch %73
%75 = OpLabel
%91 = OpAccessChain %_ptr_Function_v2float %output %uint_0
%92 = OpAccessChain %_ptr_Function_v2float %texcoord %VertexIndex
%93 = OpLoad %v2float %92
%94 = OpFMul %v2float %93 %87
%95 = OpFAdd %v2float %94 %89
%96 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_0
%97 = OpLoad %v2float %96
%98 = OpFMul %v2float %95 %97
%99 = OpAccessChain %_ptr_Uniform_v2float %uniforms %uint_1
%100 = OpLoad %v2float %99
%101 = OpFAdd %v2float %98 %100
OpStore %91 %101
OpBranch %73
%73 = OpLabel
%102 = OpLoad %VertexOutputs %output
OpReturnValue %102
OpFunctionEnd
%vs_main = OpFunction %void None %103
%106 = OpLabel
%108 = OpLoad %uint %VertexIndex_1
%107 = OpFunctionCall %VertexOutputs %vs_main_inner %108
%109 = OpCompositeExtract %v2float %107 0
OpStore %texcoords_1 %109
%110 = OpCompositeExtract %v4float %107 1
OpStore %position_1 %110
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%tint_discard_func = OpFunction %void None %103
%112 = OpLabel
OpKill
OpFunctionEnd
%fs_main_inner = OpFunction %v4float None %113
%texcoord_0 = OpFunctionParameter %v2float
%116 = OpLabel
%clampedTexcoord = OpVariable %_ptr_Function_v2float Function %8
%srcColor = OpVariable %_ptr_Function_v4float Function %12
%117 = OpExtInst %v2float %118 NClamp %texcoord_0 %8 %58
OpStore %clampedTexcoord %117
%122 = OpLoad %v2float %clampedTexcoord
%123 = OpFOrdEqual %v2bool %122 %texcoord_0
%121 = OpAll %bool %123
%120 = OpLogicalNot %bool %121
OpSelectionMerge %125 None
OpBranchConditional %120 %126 %125
%126 = OpLabel
%127 = OpFunctionCall %void %tint_discard_func
OpReturnValue %12
%125 = OpLabel
%129 = OpLoad %24 %mySampler
%130 = OpLoad %27 %myTexture
%132 = OpSampledImage %131 %130 %129
%128 = OpImageSampleImplicitLod %v4float %132 %texcoord_0
OpStore %srcColor %128
%134 = OpLoad %v4float %srcColor
OpReturnValue %134
OpFunctionEnd
%fs_main = OpFunction %void None %103
%136 = OpLabel
%138 = OpLoad %v2float %texcoord_1
%137 = OpFunctionCall %v4float %fs_main_inner %138
OpStore %value %137
OpReturn
OpFunctionEnd