| ; SPIR-V |
| ; Version: 1.3 |
| ; Generator: Google Tint Compiler; 0 |
| ; Bound: 121 |
| ; Schema: 0 |
| OpCapability Shader |
| %92 = OpExtInstImport "GLSL.std.450" |
| OpMemoryModel Logical GLSL450 |
| OpEntryPoint Fragment %main "main" %shadowPos_1 %fragPos_1 %fragNorm_1 %value |
| OpExecutionMode %main OriginUpperLeft |
| OpName %shadowPos_1 "shadowPos_1" |
| OpName %fragPos_1 "fragPos_1" |
| OpName %fragNorm_1 "fragNorm_1" |
| OpName %value "value" |
| OpName %shadowDepthTextureSize "shadowDepthTextureSize" |
| OpName %Scene "Scene" |
| OpMemberName %Scene 0 "lightViewProjMatrix" |
| OpMemberName %Scene 1 "cameraViewProjMatrix" |
| OpMemberName %Scene 2 "lightPos" |
| OpName %scene "scene" |
| OpName %shadowMap "shadowMap" |
| OpName %shadowSampler "shadowSampler" |
| OpName %albedo "albedo" |
| OpName %ambientFactor "ambientFactor" |
| OpName %FragmentInput "FragmentInput" |
| OpMemberName %FragmentInput 0 "shadowPos" |
| OpMemberName %FragmentInput 1 "fragPos" |
| OpMemberName %FragmentInput 2 "fragNorm" |
| OpName %main_inner "main_inner" |
| OpName %input "input" |
| OpName %visibility "visibility" |
| OpName %y "y" |
| OpName %x "x" |
| OpName %main "main" |
| OpDecorate %shadowPos_1 Location 0 |
| OpDecorate %fragPos_1 Location 1 |
| OpDecorate %fragNorm_1 Location 2 |
| OpDecorate %value Location 0 |
| OpDecorate %Scene Block |
| OpMemberDecorate %Scene 0 Offset 0 |
| OpMemberDecorate %Scene 0 ColMajor |
| OpMemberDecorate %Scene 0 MatrixStride 16 |
| OpMemberDecorate %Scene 1 Offset 64 |
| OpMemberDecorate %Scene 1 ColMajor |
| OpMemberDecorate %Scene 1 MatrixStride 16 |
| OpMemberDecorate %Scene 2 Offset 128 |
| OpDecorate %scene NonWritable |
| OpDecorate %scene DescriptorSet 0 |
| OpDecorate %scene Binding 0 |
| OpDecorate %shadowMap DescriptorSet 0 |
| OpDecorate %shadowMap Binding 1 |
| OpDecorate %shadowSampler DescriptorSet 0 |
| OpDecorate %shadowSampler Binding 2 |
| OpMemberDecorate %FragmentInput 0 Offset 0 |
| OpMemberDecorate %FragmentInput 1 Offset 16 |
| OpMemberDecorate %FragmentInput 2 Offset 32 |
| %float = OpTypeFloat 32 |
| %v3float = OpTypeVector %float 3 |
| %_ptr_Input_v3float = OpTypePointer Input %v3float |
| %shadowPos_1 = OpVariable %_ptr_Input_v3float Input |
| %fragPos_1 = OpVariable %_ptr_Input_v3float Input |
| %fragNorm_1 = OpVariable %_ptr_Input_v3float Input |
| %v4float = OpTypeVector %float 4 |
| %_ptr_Output_v4float = OpTypePointer Output %v4float |
| %10 = OpConstantNull %v4float |
| %value = OpVariable %_ptr_Output_v4float Output %10 |
| %shadowDepthTextureSize = OpConstant %float 1024 |
| %mat4v4float = OpTypeMatrix %v4float 4 |
| %Scene = OpTypeStruct %mat4v4float %mat4v4float %v3float |
| %_ptr_Uniform_Scene = OpTypePointer Uniform %Scene |
| %scene = OpVariable %_ptr_Uniform_Scene Uniform |
| %18 = OpTypeImage %float 2D 1 0 0 1 Unknown |
| %_ptr_UniformConstant_18 = OpTypePointer UniformConstant %18 |
| %shadowMap = OpVariable %_ptr_UniformConstant_18 UniformConstant |
| %21 = OpTypeSampler |
| %_ptr_UniformConstant_21 = OpTypePointer UniformConstant %21 |
| %shadowSampler = OpVariable %_ptr_UniformConstant_21 UniformConstant |
| %float_0_899999976 = OpConstant %float 0.899999976 |
| %albedo = OpConstantComposite %v3float %float_0_899999976 %float_0_899999976 %float_0_899999976 |
| %ambientFactor = OpConstant %float 0.200000003 |
| %FragmentInput = OpTypeStruct %v3float %v3float %v3float |
| %25 = OpTypeFunction %v4float %FragmentInput |
| %float_0 = OpConstant %float 0 |
| %_ptr_Function_float = OpTypePointer Function %float |
| %33 = OpConstantNull %float |
| %float_1 = OpConstant %float 1 |
| %int = OpTypeInt 32 1 |
| %int_n1 = OpConstant %int -1 |
| %_ptr_Function_int = OpTypePointer Function %int |
| %40 = OpConstantNull %int |
| %int_1 = OpConstant %int 1 |
| %bool = OpTypeBool |
| %v2float = OpTypeVector %float 2 |
| %74 = OpTypeSampledImage %18 |
| %float_0_00700000022 = OpConstant %float 0.00700000022 |
| %float_9 = OpConstant %float 9 |
| %uint = OpTypeInt 32 0 |
| %uint_2 = OpConstant %uint 2 |
| %_ptr_Uniform_v3float = OpTypePointer Uniform %v3float |
| %void = OpTypeVoid |
| %112 = OpTypeFunction %void |
| %main_inner = OpFunction %v4float None %25 |
| %input = OpFunctionParameter %FragmentInput |
| %29 = OpLabel |
| %visibility = OpVariable %_ptr_Function_float Function %33 |
| %y = OpVariable %_ptr_Function_int Function %40 |
| %x = OpVariable %_ptr_Function_int Function %40 |
| OpStore %visibility %float_0 |
| %35 = OpFDiv %float %float_1 %shadowDepthTextureSize |
| OpStore %y %int_n1 |
| OpBranch %41 |
| %41 = OpLabel |
| OpLoopMerge %42 %43 None |
| OpBranch %44 |
| %44 = OpLabel |
| %46 = OpLoad %int %y |
| %48 = OpSLessThanEqual %bool %46 %int_1 |
| %45 = OpLogicalNot %bool %48 |
| OpSelectionMerge %50 None |
| OpBranchConditional %45 %51 %50 |
| %51 = OpLabel |
| OpBranch %42 |
| %50 = OpLabel |
| OpStore %x %int_n1 |
| OpBranch %53 |
| %53 = OpLabel |
| OpLoopMerge %54 %55 None |
| OpBranch %56 |
| %56 = OpLabel |
| %58 = OpLoad %int %x |
| %59 = OpSLessThanEqual %bool %58 %int_1 |
| %57 = OpLogicalNot %bool %59 |
| OpSelectionMerge %60 None |
| OpBranchConditional %57 %61 %60 |
| %61 = OpLabel |
| OpBranch %54 |
| %60 = OpLabel |
| %64 = OpLoad %int %x |
| %63 = OpConvertSToF %float %64 |
| %65 = OpFMul %float %63 %35 |
| %67 = OpLoad %int %y |
| %66 = OpConvertSToF %float %67 |
| %68 = OpFMul %float %66 %35 |
| %69 = OpCompositeConstruct %v2float %65 %68 |
| %70 = OpLoad %float %visibility |
| %72 = OpLoad %21 %shadowSampler |
| %73 = OpLoad %18 %shadowMap |
| %75 = OpSampledImage %74 %73 %72 |
| %76 = OpCompositeExtract %v3float %input 0 |
| %77 = OpVectorShuffle %v2float %76 %76 0 1 |
| %78 = OpFAdd %v2float %77 %69 |
| %79 = OpCompositeExtract %v3float %input 0 |
| %80 = OpCompositeExtract %float %79 2 |
| %82 = OpFSub %float %80 %float_0_00700000022 |
| %71 = OpImageSampleDrefImplicitLod %float %75 %78 %82 |
| %83 = OpFAdd %float %70 %71 |
| OpStore %visibility %83 |
| OpBranch %55 |
| %55 = OpLabel |
| %84 = OpLoad %int %x |
| %85 = OpIAdd %int %84 %int_1 |
| OpStore %x %85 |
| OpBranch %53 |
| %54 = OpLabel |
| OpBranch %43 |
| %43 = OpLabel |
| %86 = OpLoad %int %y |
| %87 = OpIAdd %int %86 %int_1 |
| OpStore %y %87 |
| OpBranch %41 |
| %42 = OpLabel |
| %88 = OpLoad %float %visibility |
| %90 = OpFDiv %float %88 %float_9 |
| OpStore %visibility %90 |
| %98 = OpAccessChain %_ptr_Uniform_v3float %scene %uint_2 |
| %99 = OpLoad %v3float %98 |
| %100 = OpCompositeExtract %v3float %input 1 |
| %101 = OpFSub %v3float %99 %100 |
| %94 = OpExtInst %v3float %92 Normalize %101 |
| %102 = OpCompositeExtract %v3float %input 2 |
| %93 = OpDot %float %94 %102 |
| %91 = OpExtInst %float %92 NMax %93 %float_0 |
| %104 = OpLoad %float %visibility |
| %105 = OpFMul %float %104 %91 |
| %106 = OpFAdd %float %ambientFactor %105 |
| %103 = OpExtInst %float %92 NMin %106 %float_1 |
| %107 = OpVectorTimesScalar %v3float %albedo %103 |
| %108 = OpCompositeExtract %float %107 0 |
| %109 = OpCompositeExtract %float %107 1 |
| %110 = OpCompositeExtract %float %107 2 |
| %111 = OpCompositeConstruct %v4float %108 %109 %110 %float_1 |
| OpReturnValue %111 |
| OpFunctionEnd |
| %main = OpFunction %void None %112 |
| %115 = OpLabel |
| %117 = OpLoad %v3float %shadowPos_1 |
| %118 = OpLoad %v3float %fragPos_1 |
| %119 = OpLoad %v3float %fragNorm_1 |
| %120 = OpCompositeConstruct %FragmentInput %117 %118 %119 |
| %116 = OpFunctionCall %v4float %main_inner %120 |
| OpStore %value %116 |
| OpReturn |
| OpFunctionEnd |