; SPIR-V ; Version: 1.1 ; Generator: rspirv ; Bound: 641 OpCapability Shader OpExtension "SPV_KHR_storage_buffer_storage_class" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint GLCompute %344 "gen_terrain_compute" %341 OpEntryPoint Vertex %414 "gen_terrain_vertex" %405 %408 %410 %412 OpEntryPoint Fragment %464 "gen_terrain_fragment" %454 %456 %459 %462 %463 OpEntryPoint Vertex %555 "vs_main" %546 %549 %551 %552 %554 OpEntryPoint Fragment %581 "fs_main" %574 %576 %578 %580 OpExecutionMode %344 LocalSize 64 1 1 OpExecutionMode %464 OriginUpperLeft OpExecutionMode %581 OriginUpperLeft %3 = OpString "debug-symbol-terrain.wgsl" OpSource Unknown 0 %3 "// Taken from https://github.com/sotrh/learn-wgpu/blob/11820796f5e1dbce42fb1119f04ddeb4b167d2a0/code/intermediate/tutorial13-terrain/src/terrain.wgsl // ============================ // Terrain Generation // ============================ // https://gist.github.com/munrocket/236ed5ba7e409b8bdf1ff6eca5dcdc39 // MIT License. © Ian McEwan, Stefan Gustavson, Munrocket // - Less condensed glsl implementation with comments can be found at https://weber.itn.liu.se/~stegu/jgt2012/article.pdf fn permute3(x: vec3) -> vec3 { return (((x * 34.) + 1.) * x) % vec3(289.); } fn snoise2(v: vec2) -> f32 { let C = vec4(0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439); var i: vec2 = floor(v + dot(v, C.yy)); let x0 = v - i + dot(i, C.xx); // I flipped the condition here from > to < as it fixed some artifacting I was observing var i1: vec2 = select(vec2(1., 0.), vec2(0., 1.), (x0.x < x0.y)); var x12: vec4 = x0.xyxy + C.xxzz - vec4(i1, 0., 0.); i = i % vec2(289.); let p = permute3(permute3(i.y + vec3(0., i1.y, 1.)) + i.x + vec3(0., i1.x, 1.)); var m: vec3 = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), vec3(0.)); m = m * m; m = m * m; let x = 2. * fract(p * C.www) - 1.; let h = abs(x) - 0.5; let ox = floor(x + 0.5); let a0 = x - ox; m = m * (1.79284291400159 - 0.85373472095314 * (a0 * a0 + h * h)); let g = vec3(a0.x * x0.x + h.x * x0.y, a0.yz * x12.xz + h.yz * x12.yw); return 130. * dot(m, g); } fn fbm(p: vec2) -> f32 { let NUM_OCTAVES: u32 = 5u; var x = p * 0.01; var v = 0.0; var a = 0.5; let shift = vec2(100.0); let cs = vec2(cos(0.5), sin(0.5)); let rot = mat2x2(cs.x, cs.y, -cs.y, cs.x); for (var i = 0u; i < NUM_OCTAVES; i = i + 1u) { v = v + a * snoise2(x); x = rot * x * 2.0 + shift; a = a * 0.5; } return v; } struct ChunkData { chunk_size: vec2, chunk_corner: vec2, min_max_height: vec2, } struct Vertex { @location(0) position: vec3, @location(1) normal: vec3, } struct VertexBuffer { data: array, // stride: 32 } struct IndexBuffer { data: array, } @group(0) @binding(0) var chunk_data: ChunkData; @group(0) @binding(1) var vertices: VertexBuffer; @group(0) @binding(2) var indices: IndexBuffer; fn terrain_point(p: vec2, min_max_height: vec2) -> vec3 { return vec3( p.x, mix(min_max_height.x, min_max_height.y, fbm(p)), p.y, ); } fn terrain_vertex(p: vec2, min_max_height: vec2) -> Vertex { let v = terrain_point(p, min_max_height); let tpx = terrain_point(p + vec2(0.1, 0.0), min_max_height) - v; let tpz = terrain_point(p + vec2(0.0, 0.1), min_max_height) - v; let tnx = terrain_point(p + vec2(-0.1, 0.0), min_max_height) - v; let tnz = terrain_point(p + vec2(0.0, -0.1), min_max_height) - v; let pn = normalize(cross(tpz, tpx)); let nn = normalize(cross(tnz, tnx)); let n = (pn + nn) * 0.5; return Vertex(v, n); } fn index_to_p(vert_index: u32, chunk_size: vec2, chunk_corner: vec2) -> vec2 { return vec2( f32(vert_index) % f32(chunk_size.x + 1u), f32(vert_index / (chunk_size.x + 1u)), ) + vec2(chunk_corner); } @compute @workgroup_size(64) fn gen_terrain_compute( @builtin(global_invocation_id) gid: vec3 ) { // Create vert_component let vert_index = gid.x; let p = index_to_p(vert_index, chunk_data.chunk_size, chunk_data.chunk_corner); vertices.data[vert_index] = terrain_vertex(p, chunk_data.min_max_height); // Create indices let start_index = gid.x * 6u; // using TriangleList if (start_index >= (chunk_data.chunk_size.x * chunk_data.chunk_size.y * 6u)) { return; } let v00 = vert_index + gid.x / chunk_data.chunk_size.x; let v10 = v00 + 1u; let v01 = v00 + chunk_data.chunk_size.x + 1u; let v11 = v01 + 1u; indices.data[start_index] = v00; indices.data[start_index + 1u] = v01; indices.data[start_index + 2u] = v11; indices.data[start_index + 3u] = v00; indices.data[start_index + 4u] = v11; indices.data[start_index + 5u] = v10; } // ============================ // Terrain Gen (Fragment Shader) // ============================ struct GenData { chunk_size: vec2, chunk_corner: vec2, min_max_height: vec2, texture_size: u32, start_index: u32, } @group(0) @binding(0) var gen_data: GenData; struct GenVertexOutput { @location(0) index: u32, @builtin(position) position: vec4, @location(1) uv: vec2, }; @vertex fn gen_terrain_vertex(@builtin(vertex_index) vindex: u32) -> GenVertexOutput { let u = f32(((vindex + 2u) / 3u) % 2u); let v = f32(((vindex + 1u) / 3u) % 2u); let uv = vec2(u, v); let position = vec4(-1.0 + uv * 2.0, 0.0, 1.0); // TODO: maybe replace this with u32(dot(uv, vec2(f32(gen_data.texture_dim.x)))) let index = u32(uv.x * f32(gen_data.texture_size) + uv.y * f32(gen_data.texture_size)) + gen_data.start_index; return GenVertexOutput(index, position, uv); } struct GenFragmentOutput { @location(0) vert_component: u32, @location(1) index: u32, } @fragment fn gen_terrain_fragment(in: GenVertexOutput) -> GenFragmentOutput { let i = u32(in.uv.x * f32(gen_data.texture_size) + in.uv.y * f32(gen_data.texture_size * gen_data.texture_size)) + gen_data.start_index; let vert_index = u32(floor(f32(i) / 6.)); let comp_index = i % 6u; let p = index_to_p(vert_index, gen_data.chunk_size, gen_data.chunk_corner); let v = terrain_vertex(p, gen_data.min_max_height); var vert_component: f32 = 0.; switch comp_index { case 0u: { vert_component = v.position.x; } case 1u: { vert_component = v.position.y; } case 2u: { vert_component = v.position.z; } case 3u: { vert_component = v.normal.x; } case 4u: { vert_component = v.normal.y; } case 5u: { vert_component = v.normal.z; } default: {} } let v00 = vert_index + vert_index / gen_data.chunk_size.x; let v10 = v00 + 1u; let v01 = v00 + gen_data.chunk_size.x + 1u; let v11 = v01 + 1u; var index = 0u; switch comp_index { case 0u, 3u: { index = v00; } case 2u, 4u: { index = v11; } case 1u: { index = v01; } case 5u: { index = v10; } default: {} } index = in.index; // index = gen_data.start_index; // indices.data[start_index] = v00; // indices.data[start_index + 1u] = v01; // indices.data[start_index + 2u] = v11; // indices.data[start_index + 3u] = v00; // indices.data[start_index + 4u] = v11; // indices.data[start_index + 5u] = v10; let ivert_component = bitcast(vert_component); return GenFragmentOutput(ivert_component, index); } // ============================ // Terrain Rendering // ============================ struct Camera { view_pos: vec4, view_proj: mat4x4, } @group(0) @binding(0) var camera: Camera; struct Light { position: vec3, color: vec3, } @group(1) @binding(0) var light: Light; struct VertexOutput { @builtin(position) clip_position: vec4, @location(0) normal: vec3, @location(1) world_pos: vec3, } @vertex fn vs_main( vertex: Vertex, ) -> VertexOutput { let clip_position = camera.view_proj * vec4(vertex.position, 1.); let normal = vertex.normal; return VertexOutput(clip_position, normal, vertex.position); } @group(2) @binding(0) var t_diffuse: texture_2d; @group(2) @binding(1) var s_diffuse: sampler; @group(2) @binding(2) var t_normal: texture_2d; @group(2) @binding(3) var s_normal: sampler; fn color23(p: vec2) -> vec3 { return vec3( snoise2(p) * 0.5 + 0.5, snoise2(p + vec2(23., 32.)) * 0.5 + 0.5, snoise2(p + vec2(-43., 3.)) * 0.5 + 0.5, ); } @fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { var color = smoothstep(vec3(0.0), vec3(0.1), fract(in.world_pos)); color = mix(vec3(0.5, 0.1, 0.7), vec3(0.2, 0.2, 0.2), vec3(color.x * color.y * color.z)); let ambient_strength = 0.1; let ambient_color = light.color * ambient_strength; let light_dir = normalize(light.position - in.world_pos); let view_dir = normalize(camera.view_pos.xyz - in.world_pos); let half_dir = normalize(view_dir + light_dir); let diffuse_strength = max(dot(in.normal, light_dir), 0.0); let diffuse_color = diffuse_strength * light.color; let specular_strength = pow(max(dot(in.normal, half_dir), 0.0), 32.0); let specular_color = specular_strength * light.color; let result = (ambient_color + diffuse_color + specular_color) * color; return vec4(result, 1.0); }" OpMemberName %13 0 "chunk_size" OpMemberName %13 1 "chunk_corner" OpMemberName %13 2 "min_max_height" OpName %13 "ChunkData" OpMemberName %14 0 "position" OpMemberName %14 1 "normal" OpName %14 "Vertex" OpMemberName %16 0 "data" OpName %16 "VertexBuffer" OpMemberName %18 0 "data" OpName %18 "IndexBuffer" OpMemberName %20 0 "chunk_size" OpMemberName %20 1 "chunk_corner" OpMemberName %20 2 "min_max_height" OpMemberName %20 3 "texture_size" OpMemberName %20 4 "start_index" OpName %20 "GenData" OpMemberName %21 0 "index" OpMemberName %21 1 "position" OpMemberName %21 2 "uv" OpName %21 "GenVertexOutput" OpMemberName %22 0 "vert_component" OpMemberName %22 1 "index" OpName %22 "GenFragmentOutput" OpMemberName %24 0 "view_pos" OpMemberName %24 1 "view_proj" OpName %24 "Camera" OpMemberName %25 0 "position" OpMemberName %25 1 "color" OpName %25 "Light" OpMemberName %26 0 "clip_position" OpMemberName %26 1 "normal" OpMemberName %26 2 "world_pos" OpName %26 "VertexOutput" OpName %29 "chunk_data" OpName %32 "vertices" OpName %34 "indices" OpName %36 "gen_data" OpName %39 "camera" OpName %42 "light" OpName %45 "t_diffuse" OpName %47 "s_diffuse" OpName %49 "t_normal" OpName %50 "s_normal" OpName %52 "x" OpName %53 "permute3" OpName %65 "i" OpName %68 "i1" OpName %69 "x12" OpName %72 "m" OpName %76 "v" OpName %77 "snoise2" OpName %204 "x" OpName %205 "v" OpName %208 "a" OpName %209 "i" OpName %213 "p" OpName %214 "fbm" OpName %254 "p" OpName %255 "min_max_height" OpName %256 "terrain_point" OpName %267 "p" OpName %268 "min_max_height" OpName %269 "terrain_vertex" OpName %299 "vert_index" OpName %300 "chunk_size" OpName %301 "chunk_corner" OpName %302 "index_to_p" OpName %318 "p" OpName %319 "color23" OpName %341 "gid" OpName %344 "gen_terrain_compute" OpName %405 "vindex" OpName %408 "index" OpName %410 "position" OpName %412 "uv" OpName %414 "gen_terrain_vertex" OpName %450 "vert_component" OpName %451 "index" OpName %454 "index" OpName %456 "position" OpName %459 "uv" OpName %462 "vert_component" OpName %463 "index" OpName %464 "gen_terrain_fragment" OpName %546 "position" OpName %549 "normal" OpName %551 "clip_position" OpName %552 "normal" OpName %554 "world_pos" OpName %555 "vs_main" OpName %571 "color" OpName %574 "clip_position" OpName %576 "normal" OpName %578 "world_pos" OpName %581 "fs_main" OpMemberDecorate %13 0 Offset 0 OpMemberDecorate %13 1 Offset 8 OpMemberDecorate %13 2 Offset 16 OpMemberDecorate %14 0 Offset 0 OpMemberDecorate %14 1 Offset 16 OpDecorate %15 ArrayStride 32 OpMemberDecorate %16 0 Offset 0 OpDecorate %16 Block OpDecorate %17 ArrayStride 4 OpMemberDecorate %18 0 Offset 0 OpDecorate %18 Block OpMemberDecorate %20 0 Offset 0 OpMemberDecorate %20 1 Offset 8 OpMemberDecorate %20 2 Offset 16 OpMemberDecorate %20 3 Offset 24 OpMemberDecorate %20 4 Offset 28 OpMemberDecorate %21 0 Offset 0 OpMemberDecorate %21 1 Offset 16 OpMemberDecorate %21 2 Offset 32 OpMemberDecorate %22 0 Offset 0 OpMemberDecorate %22 1 Offset 4 OpMemberDecorate %24 0 Offset 0 OpMemberDecorate %24 1 Offset 16 OpMemberDecorate %24 1 ColMajor OpMemberDecorate %24 1 MatrixStride 16 OpMemberDecorate %25 0 Offset 0 OpMemberDecorate %25 1 Offset 16 OpMemberDecorate %26 0 Offset 0 OpMemberDecorate %26 1 Offset 16 OpMemberDecorate %26 2 Offset 32 OpDecorate %29 DescriptorSet 0 OpDecorate %29 Binding 0 OpDecorate %30 Block OpMemberDecorate %30 0 Offset 0 OpDecorate %32 DescriptorSet 0 OpDecorate %32 Binding 1 OpDecorate %34 DescriptorSet 0 OpDecorate %34 Binding 2 OpDecorate %36 DescriptorSet 0 OpDecorate %36 Binding 0 OpDecorate %37 Block OpMemberDecorate %37 0 Offset 0 OpDecorate %39 DescriptorSet 0 OpDecorate %39 Binding 0 OpDecorate %40 Block OpMemberDecorate %40 0 Offset 0 OpDecorate %42 DescriptorSet 1 OpDecorate %42 Binding 0 OpDecorate %43 Block OpMemberDecorate %43 0 Offset 0 OpDecorate %45 DescriptorSet 2 OpDecorate %45 Binding 0 OpDecorate %47 DescriptorSet 2 OpDecorate %47 Binding 1 OpDecorate %49 DescriptorSet 2 OpDecorate %49 Binding 2 OpDecorate %50 DescriptorSet 2 OpDecorate %50 Binding 3 OpDecorate %341 BuiltIn GlobalInvocationId OpDecorate %405 BuiltIn VertexIndex OpDecorate %408 Location 0 OpDecorate %408 Flat OpDecorate %410 BuiltIn Position OpDecorate %412 Location 1 OpDecorate %454 Location 0 OpDecorate %454 Flat OpDecorate %456 BuiltIn FragCoord OpDecorate %459 Location 1 OpDecorate %462 Location 0 OpDecorate %463 Location 1 OpDecorate %546 Location 0 OpDecorate %549 Location 1 OpDecorate %551 BuiltIn Position OpDecorate %552 Location 0 OpDecorate %554 Location 1 OpDecorate %574 BuiltIn FragCoord OpDecorate %576 Location 0 OpDecorate %578 Location 1 OpDecorate %580 Location 0 %2 = OpTypeVoid %5 = OpTypeFloat 32 %4 = OpTypeVector %5 3 %6 = OpTypeVector %5 2 %7 = OpTypeVector %5 4 %8 = OpTypeInt 32 0 %9 = OpTypeMatrix %6 2 %10 = OpTypeVector %8 2 %12 = OpTypeInt 32 1 %11 = OpTypeVector %12 2 %13 = OpTypeStruct %10 %11 %6 %14 = OpTypeStruct %4 %4 %15 = OpTypeRuntimeArray %14 %16 = OpTypeStruct %15 %17 = OpTypeRuntimeArray %8 %18 = OpTypeStruct %17 %19 = OpTypeVector %8 3 %20 = OpTypeStruct %10 %11 %6 %8 %8 %21 = OpTypeStruct %8 %7 %6 %22 = OpTypeStruct %8 %8 %23 = OpTypeMatrix %7 4 %24 = OpTypeStruct %7 %23 %25 = OpTypeStruct %4 %4 %26 = OpTypeStruct %7 %4 %4 %27 = OpTypeImage %5 2D 0 0 0 1 Unknown %28 = OpTypeSampler %30 = OpTypeStruct %13 %31 = OpTypePointer Uniform %30 %29 = OpVariable %31 Uniform %33 = OpTypePointer StorageBuffer %16 %32 = OpVariable %33 StorageBuffer %35 = OpTypePointer StorageBuffer %18 %34 = OpVariable %35 StorageBuffer %37 = OpTypeStruct %20 %38 = OpTypePointer Uniform %37 %36 = OpVariable %38 Uniform %40 = OpTypeStruct %24 %41 = OpTypePointer Uniform %40 %39 = OpVariable %41 Uniform %43 = OpTypeStruct %25 %44 = OpTypePointer Uniform %43 %42 = OpVariable %44 Uniform %46 = OpTypePointer UniformConstant %27 %45 = OpVariable %46 UniformConstant %48 = OpTypePointer UniformConstant %28 %47 = OpVariable %48 UniformConstant %49 = OpVariable %46 UniformConstant %50 = OpVariable %48 UniformConstant %54 = OpTypeFunction %4 %4 %55 = OpConstant %5 34.0 %56 = OpConstant %5 1.0 %57 = OpConstant %5 289.0 %66 = OpTypePointer Function %6 %67 = OpConstantNull %6 %70 = OpTypePointer Function %7 %71 = OpConstantNull %7 %73 = OpTypePointer Function %4 %74 = OpConstantNull %4 %78 = OpTypeFunction %5 %6 %79 = OpConstant %5 0.21132487 %80 = OpConstant %5 0.36602542 %81 = OpConstant %5 -0.57735026 %82 = OpConstant %5 0.024390243 %83 = OpConstant %5 0.0 %84 = OpConstant %5 0.5 %85 = OpConstant %5 2.0 %86 = OpConstant %5 1.7928429 %87 = OpConstant %5 0.85373473 %88 = OpConstant %5 130.0 %107 = OpTypeBool %110 = OpTypeVector %107 2 %121 = OpTypePointer Function %5 %122 = OpConstant %8 1 %131 = OpConstant %8 0 %206 = OpTypePointer Function %5 %207 = OpConstantNull %5 %210 = OpTypePointer Function %8 %211 = OpConstantNull %8 %215 = OpConstant %8 5 %216 = OpConstant %5 0.01 %217 = OpConstant %5 100.0 %257 = OpTypeFunction %4 %6 %6 %270 = OpTypeFunction %14 %6 %6 %271 = OpConstant %5 0.1 %272 = OpConstant %5 -0.1 %303 = OpTypeFunction %6 %8 %10 %11 %320 = OpTypeFunction %4 %6 %321 = OpConstant %5 23.0 %322 = OpConstant %5 32.0 %323 = OpConstant %5 -43.0 %324 = OpConstant %5 3.0 %342 = OpTypePointer Input %19 %341 = OpVariable %342 Input %345 = OpTypeFunction %2 %346 = OpTypePointer Uniform %13 %348 = OpConstant %8 6 %349 = OpConstant %8 2 %350 = OpConstant %8 3 %351 = OpConstant %8 4 %354 = OpTypePointer Uniform %10 %357 = OpTypePointer Uniform %11 %361 = OpTypePointer StorageBuffer %15 %362 = OpTypePointer StorageBuffer %14 %363 = OpTypePointer Uniform %6 %370 = OpTypePointer Uniform %8 %391 = OpTypePointer StorageBuffer %17 %392 = OpTypePointer StorageBuffer %8 %406 = OpTypePointer Input %8 %405 = OpVariable %406 Input %409 = OpTypePointer Output %8 %408 = OpVariable %409 Output %411 = OpTypePointer Output %7 %410 = OpVariable %411 Output %413 = OpTypePointer Output %6 %412 = OpVariable %413 Output %415 = OpTypePointer Uniform %20 %417 = OpConstant %5 -1.0 %432 = OpTypePointer Uniform %8 %454 = OpVariable %406 Input %457 = OpTypePointer Input %7 %456 = OpVariable %457 Input %460 = OpTypePointer Input %6 %459 = OpVariable %460 Input %462 = OpVariable %409 Output %463 = OpVariable %409 Output %466 = OpConstant %5 6.0 %547 = OpTypePointer Input %4 %546 = OpVariable %547 Input %549 = OpVariable %547 Input %551 = OpVariable %411 Output %553 = OpTypePointer Output %4 %552 = OpVariable %553 Output %554 = OpVariable %553 Output %556 = OpTypePointer Uniform %24 %559 = OpTypePointer Uniform %23 %574 = OpVariable %457 Input %576 = OpVariable %547 Input %578 = OpVariable %547 Input %580 = OpVariable %411 Output %583 = OpTypePointer Uniform %25 %585 = OpConstant %5 0.7 %586 = OpConstant %5 0.2 %605 = OpTypePointer Uniform %4 %614 = OpTypePointer Uniform %7 %53 = OpFunction %4 None %54 %52 = OpFunctionParameter %4 %51 = OpLabel OpBranch %58 %58 = OpLabel OpLine %3 10 52 %59 = OpVectorTimesScalar %4 %52 %55 OpLine %3 10 50 %60 = OpCompositeConstruct %4 %56 %56 %56 %61 = OpFAdd %4 %59 %60 %62 = OpFMul %4 %61 %52 OpLine %3 10 49 %63 = OpCompositeConstruct %4 %57 %57 %57 %64 = OpFRem %4 %62 %63 OpReturnValue %64 OpFunctionEnd %77 = OpFunction %5 None %78 %76 = OpFunctionParameter %6 %75 = OpLabel %68 = OpVariable %66 Function %67 %72 = OpVariable %73 Function %74 %65 = OpVariable %66 Function %67 %69 = OpVariable %70 Function %71 OpBranch %89 %89 = OpLabel OpLine %3 13 13 %90 = OpCompositeConstruct %7 %79 %80 %81 %82 OpLine %3 14 24 %91 = OpCompositeConstruct %6 %80 %80 %92 = OpDot %5 %76 %91 %93 = OpCompositeConstruct %6 %92 %92 %94 = OpFAdd %6 %76 %93 %95 = OpExtInst %6 %1 Floor %94 OpLine %3 14 5 OpStore %65 %95 OpLine %3 15 14 %96 = OpLoad %6 %65 %97 = OpFSub %6 %76 %96 %98 = OpLoad %6 %65 %99 = OpCompositeConstruct %6 %79 %79 %100 = OpDot %5 %98 %99 %101 = OpCompositeConstruct %6 %100 %100 %102 = OpFAdd %6 %97 %101 OpLine %3 17 32 %103 = OpCompositeConstruct %6 %56 %83 OpLine %3 17 25 %104 = OpCompositeConstruct %6 %83 %56 %105 = OpCompositeExtract %5 %102 0 %106 = OpCompositeExtract %5 %102 1 %108 = OpFOrdLessThan %107 %105 %106 %111 = OpCompositeConstruct %110 %108 %108 %109 = OpSelect %6 %111 %104 %103 OpLine %3 17 5 OpStore %68 %109 OpLine %3 18 26 %112 = OpVectorShuffle %7 %102 %102 0 1 0 1 %113 = OpCompositeConstruct %7 %79 %79 %81 %81 %114 = OpFAdd %7 %112 %113 %115 = OpLoad %6 %68 OpLine %3 18 26 %116 = OpCompositeConstruct %7 %115 %83 %83 %117 = OpFSub %7 %114 %116 OpLine %3 18 5 OpStore %69 %117 OpLine %3 1 1 %118 = OpLoad %6 %65 OpLine %3 19 9 %119 = OpCompositeConstruct %6 %57 %57 %120 = OpFRem %6 %118 %119 OpLine %3 19 5 OpStore %65 %120 OpLine %3 20 31 %123 = OpAccessChain %121 %65 %122 %124 = OpLoad %5 %123 OpLine %3 20 51 %125 = OpAccessChain %121 %68 %122 %126 = OpLoad %5 %125 OpLine %3 20 31 %127 = OpCompositeConstruct %4 %83 %126 %56 %128 = OpCompositeConstruct %4 %124 %124 %124 %129 = OpFAdd %4 %128 %127 OpLine %3 20 22 %130 = OpFunctionCall %4 %53 %129 OpLine %3 20 22 %132 = OpAccessChain %121 %65 %131 %133 = OpLoad %5 %132 %134 = OpCompositeConstruct %4 %133 %133 %133 %135 = OpFAdd %4 %130 %134 OpLine %3 20 84 %136 = OpAccessChain %121 %68 %131 %137 = OpLoad %5 %136 OpLine %3 20 22 %138 = OpCompositeConstruct %4 %83 %137 %56 %139 = OpFAdd %4 %135 %138 OpLine %3 20 13 %140 = OpFunctionCall %4 %53 %139 OpLine %3 21 28 %141 = OpDot %5 %102 %102 %142 = OpLoad %7 %69 %143 = OpVectorShuffle %6 %142 %142 0 1 %144 = OpLoad %7 %69 %145 = OpVectorShuffle %6 %144 %144 0 1 %146 = OpDot %5 %143 %145 %147 = OpLoad %7 %69 %148 = OpVectorShuffle %6 %147 %147 2 3 %149 = OpLoad %7 %69 %150 = OpVectorShuffle %6 %149 %149 2 3 %151 = OpDot %5 %148 %150 %152 = OpCompositeConstruct %4 %141 %146 %151 %153 = OpCompositeConstruct %4 %84 %84 %84 %154 = OpFSub %4 %153 %152 OpLine %3 21 24 %155 = OpCompositeConstruct %4 %83 %83 %83 %156 = OpExtInst %4 %1 FMax %154 %155 OpLine %3 21 5 OpStore %72 %156 OpLine %3 22 9 %157 = OpLoad %4 %72 %158 = OpLoad %4 %72 %159 = OpFMul %4 %157 %158 OpLine %3 22 5 OpStore %72 %159 OpLine %3 23 9 %160 = OpLoad %4 %72 %161 = OpLoad %4 %72 %162 = OpFMul %4 %160 %161 OpLine %3 23 5 OpStore %72 %162 OpLine %3 24 13 %163 = OpCompositeConstruct %4 %82 %82 %82 %164 = OpFMul %4 %140 %163 %165 = OpExtInst %4 %1 Fract %164 %166 = OpVectorTimesScalar %4 %165 %85 OpLine %3 24 13 %167 = OpCompositeConstruct %4 %56 %56 %56 %168 = OpFSub %4 %166 %167 OpLine %3 25 13 %169 = OpExtInst %4 %1 FAbs %168 OpLine %3 25 13 %170 = OpCompositeConstruct %4 %84 %84 %84 %171 = OpFSub %4 %169 %170 OpLine %3 26 14 %172 = OpCompositeConstruct %4 %84 %84 %84 %173 = OpFAdd %4 %168 %172 %174 = OpExtInst %4 %1 Floor %173 OpLine %3 27 14 %175 = OpFSub %4 %168 %174 OpLine %3 1 1 %176 = OpLoad %4 %72 OpLine %3 28 9 %177 = OpFMul %4 %175 %175 %178 = OpFMul %4 %171 %171 %179 = OpFAdd %4 %177 %178 %180 = OpVectorTimesScalar %4 %179 %87 %181 = OpCompositeConstruct %4 %86 %86 %86 %182 = OpFSub %4 %181 %180 %183 = OpFMul %4 %176 %182 OpLine %3 28 5 OpStore %72 %183 OpLine %3 29 13 %184 = OpCompositeExtract %5 %175 0 %185 = OpCompositeExtract %5 %102 0 %186 = OpFMul %5 %184 %185 %187 = OpCompositeExtract %5 %171 0 %188 = OpCompositeExtract %5 %102 1 %189 = OpFMul %5 %187 %188 %190 = OpFAdd %5 %186 %189 %191 = OpVectorShuffle %6 %175 %175 1 2 %192 = OpLoad %7 %69 %193 = OpVectorShuffle %6 %192 %192 0 2 %194 = OpFMul %6 %191 %193 %195 = OpVectorShuffle %6 %171 %171 1 2 %196 = OpLoad %7 %69 %197 = OpVectorShuffle %6 %196 %196 1 3 %198 = OpFMul %6 %195 %197 %199 = OpFAdd %6 %194 %198 %200 = OpCompositeConstruct %4 %190 %199 OpLine %3 30 12 %201 = OpLoad %4 %72 %202 = OpDot %5 %201 %200 %203 = OpFMul %5 %88 %202 OpReturnValue %203 OpFunctionEnd %214 = OpFunction %5 None %78 %213 = OpFunctionParameter %6 %212 = OpLabel %205 = OpVariable %206 Function %207 %209 = OpVariable %210 Function %211 %204 = OpVariable %66 Function %67 %208 = OpVariable %206 Function %207 OpBranch %218 %218 = OpLabel OpLine %3 36 13 %219 = OpVectorTimesScalar %6 %213 %216 OpLine %3 36 5 OpStore %204 %219 OpLine %3 37 5 OpStore %205 %83 OpLine %3 38 5 OpStore %208 %84 OpLine %3 39 17 %220 = OpCompositeConstruct %6 %217 %217 OpLine %3 40 24 %221 = OpExtInst %5 %1 Cos %84 OpLine %3 40 14 %222 = OpExtInst %5 %1 Sin %84 %223 = OpCompositeConstruct %6 %221 %222 OpLine %3 41 15 %224 = OpFNegate %5 %222 %225 = OpCompositeConstruct %6 %221 %222 %226 = OpCompositeConstruct %6 %224 %221 %227 = OpCompositeConstruct %9 %225 %226 OpLine %3 43 10 OpStore %209 %131 OpBranch %228 %228 = OpLabel OpLine %3 43 5 OpLoopMerge %229 %231 None OpBranch %230 %230 = OpLabel OpLine %3 43 22 %232 = OpLoad %8 %209 %233 = OpULessThan %107 %232 %215 OpLine %3 43 21 OpSelectionMerge %234 None OpBranchConditional %233 %234 %235 %235 = OpLabel OpBranch %229 %234 = OpLabel OpBranch %236 %236 = OpLabel OpLine %3 1 1 %238 = OpLoad %5 %205 %239 = OpLoad %5 %208 %240 = OpLoad %6 %204 OpLine %3 44 21 %241 = OpFunctionCall %5 %77 %240 OpLine %3 44 13 %242 = OpFMul %5 %239 %241 %243 = OpFAdd %5 %238 %242 OpLine %3 44 9 OpStore %205 %243 OpLine %3 45 13 %244 = OpLoad %6 %204 %245 = OpMatrixTimesVector %6 %227 %244 OpLine %3 45 13 %246 = OpVectorTimesScalar %6 %245 %85 %247 = OpFAdd %6 %246 %220 OpLine %3 45 9 OpStore %204 %247 OpLine %3 1 1 %248 = OpLoad %5 %208 OpLine %3 46 13 %249 = OpFMul %5 %248 %84 OpLine %3 46 9 OpStore %208 %249 OpBranch %237 %237 = OpLabel OpBranch %231 %231 = OpLabel OpLine %3 1 1 %250 = OpLoad %8 %209 OpLine %3 43 43 %251 = OpIAdd %8 %250 %122 OpLine %3 43 39 OpStore %209 %251 OpBranch %228 %229 = OpLabel OpLine %3 1 1 %252 = OpLoad %5 %205 OpReturnValue %252 OpFunctionEnd %256 = OpFunction %4 None %257 %254 = OpFunctionParameter %6 %255 = OpFunctionParameter %6 %253 = OpLabel OpBranch %258 %258 = OpLabel OpLine %3 77 9 %259 = OpCompositeExtract %5 %254 0 %260 = OpCompositeExtract %5 %255 0 %261 = OpCompositeExtract %5 %255 1 OpLine %3 78 49 %262 = OpFunctionCall %5 %214 %254 OpLine %3 76 12 %263 = OpExtInst %5 %1 FMix %260 %261 %262 %264 = OpCompositeExtract %5 %254 1 %265 = OpCompositeConstruct %4 %259 %263 %264 OpReturnValue %265 OpFunctionEnd %269 = OpFunction %14 None %270 %267 = OpFunctionParameter %6 %268 = OpFunctionParameter %6 %266 = OpLabel OpBranch %273 %273 = OpLabel OpLine %3 84 13 %274 = OpFunctionCall %4 %256 %267 %268 OpLine %3 86 29 %275 = OpCompositeConstruct %6 %271 %83 %276 = OpFAdd %6 %267 %275 OpLine %3 86 15 %277 = OpFunctionCall %4 %256 %276 %268 OpLine %3 86 15 %278 = OpFSub %4 %277 %274 OpLine %3 87 29 %279 = OpCompositeConstruct %6 %83 %271 %280 = OpFAdd %6 %267 %279 OpLine %3 87 15 %281 = OpFunctionCall %4 %256 %280 %268 OpLine %3 87 15 %282 = OpFSub %4 %281 %274 OpLine %3 88 29 %283 = OpCompositeConstruct %6 %272 %83 %284 = OpFAdd %6 %267 %283 OpLine %3 88 15 %285 = OpFunctionCall %4 %256 %284 %268 OpLine %3 88 15 %286 = OpFSub %4 %285 %274 OpLine %3 89 29 %287 = OpCompositeConstruct %6 %83 %272 %288 = OpFAdd %6 %267 %287 OpLine %3 89 15 %289 = OpFunctionCall %4 %256 %288 %268 OpLine %3 89 15 %290 = OpFSub %4 %289 %274 OpLine %3 91 14 %291 = OpExtInst %4 %1 Cross %282 %278 %292 = OpExtInst %4 %1 Normalize %291 OpLine %3 92 14 %293 = OpExtInst %4 %1 Cross %290 %286 %294 = OpExtInst %4 %1 Normalize %293 OpLine %3 94 14 %295 = OpFAdd %4 %292 %294 OpLine %3 94 13 %296 = OpVectorTimesScalar %4 %295 %84 OpLine %3 96 12 %297 = OpCompositeConstruct %14 %274 %296 OpReturnValue %297 OpFunctionEnd %302 = OpFunction %6 None %303 %299 = OpFunctionParameter %8 %300 = OpFunctionParameter %10 %301 = OpFunctionParameter %11 %298 = OpLabel OpBranch %304 %304 = OpLabel OpLine %3 101 9 %305 = OpConvertUToF %5 %299 %306 = OpCompositeExtract %8 %300 0 OpLine %3 101 9 %307 = OpIAdd %8 %306 %122 %308 = OpConvertUToF %5 %307 %309 = OpFRem %5 %305 %308 %310 = OpCompositeExtract %8 %300 0 OpLine %3 100 12 %311 = OpIAdd %8 %310 %122 %312 = OpUDiv %8 %299 %311 %313 = OpConvertUToF %5 %312 %314 = OpCompositeConstruct %6 %309 %313 %315 = OpConvertSToF %6 %301 %316 = OpFAdd %6 %314 %315 OpReturnValue %316 OpFunctionEnd %319 = OpFunction %4 None %320 %318 = OpFunctionParameter %6 %317 = OpLabel OpBranch %325 %325 = OpLabel OpLine %3 270 9 %326 = OpFunctionCall %5 %77 %318 OpLine %3 270 9 %327 = OpFMul %5 %326 %84 OpLine %3 270 9 %328 = OpFAdd %5 %327 %84 OpLine %3 271 17 %329 = OpCompositeConstruct %6 %321 %322 %330 = OpFAdd %6 %318 %329 OpLine %3 271 9 %331 = OpFunctionCall %5 %77 %330 OpLine %3 271 9 %332 = OpFMul %5 %331 %84 OpLine %3 271 9 %333 = OpFAdd %5 %332 %84 OpLine %3 272 17 %334 = OpCompositeConstruct %6 %323 %324 %335 = OpFAdd %6 %318 %334 OpLine %3 272 9 %336 = OpFunctionCall %5 %77 %335 OpLine %3 272 9 %337 = OpFMul %5 %336 %84 OpLine %3 269 12 %338 = OpFAdd %5 %337 %84 %339 = OpCompositeConstruct %4 %328 %333 %338 OpReturnValue %339 OpFunctionEnd %344 = OpFunction %2 None %345 %340 = OpLabel %343 = OpLoad %19 %341 %347 = OpAccessChain %346 %29 %131 OpBranch %352 %352 = OpLabel OpLine %3 111 22 %353 = OpCompositeExtract %8 %343 0 OpLine %3 113 36 %355 = OpAccessChain %354 %347 %131 %356 = OpLoad %10 %355 OpLine %3 113 59 %358 = OpAccessChain %357 %347 %122 %359 = OpLoad %11 %358 OpLine %3 113 13 %360 = OpFunctionCall %6 %302 %353 %356 %359 OpLine %3 115 5 OpLine %3 115 51 %364 = OpAccessChain %363 %347 %349 %365 = OpLoad %6 %364 OpLine %3 115 33 %366 = OpFunctionCall %14 %269 %360 %365 OpLine %3 115 5 %367 = OpAccessChain %362 %32 %131 %353 OpStore %367 %366 OpLine %3 118 23 %368 = OpCompositeExtract %8 %343 0 OpLine %3 118 23 %369 = OpIMul %8 %368 %348 OpLine %3 120 25 %371 = OpAccessChain %370 %347 %131 %131 %372 = OpLoad %8 %371 OpLine %3 120 25 %373 = OpAccessChain %370 %347 %131 %122 %374 = OpLoad %8 %373 %375 = OpIMul %8 %372 %374 OpLine %3 120 9 %376 = OpIMul %8 %375 %348 %377 = OpUGreaterThanEqual %107 %369 %376 OpLine %3 120 5 OpSelectionMerge %378 None OpBranchConditional %377 %379 %378 %379 = OpLabel OpReturn %378 = OpLabel OpLine %3 122 28 %380 = OpCompositeExtract %8 %343 0 OpLine %3 122 15 %381 = OpAccessChain %370 %347 %131 %131 %382 = OpLoad %8 %381 %383 = OpUDiv %8 %380 %382 %384 = OpIAdd %8 %353 %383 OpLine %3 123 15 %385 = OpIAdd %8 %384 %122 OpLine %3 124 15 %386 = OpAccessChain %370 %347 %131 %131 %387 = OpLoad %8 %386 %388 = OpIAdd %8 %384 %387 OpLine %3 124 15 %389 = OpIAdd %8 %388 %122 OpLine %3 125 15 %390 = OpIAdd %8 %389 %122 OpLine %3 127 5 OpLine %3 127 5 %393 = OpAccessChain %392 %34 %131 %369 OpStore %393 %384 OpLine %3 128 5 OpLine %3 128 5 %394 = OpIAdd %8 %369 %122 OpLine %3 128 5 %395 = OpAccessChain %392 %34 %131 %394 OpStore %395 %389 OpLine %3 129 5 OpLine %3 129 5 %396 = OpIAdd %8 %369 %349 OpLine %3 129 5 %397 = OpAccessChain %392 %34 %131 %396 OpStore %397 %390 OpLine %3 130 5 OpLine %3 130 5 %398 = OpIAdd %8 %369 %350 OpLine %3 130 5 %399 = OpAccessChain %392 %34 %131 %398 OpStore %399 %384 OpLine %3 131 5 OpLine %3 131 5 %400 = OpIAdd %8 %369 %351 OpLine %3 131 5 %401 = OpAccessChain %392 %34 %131 %400 OpStore %401 %390 OpLine %3 132 5 OpLine %3 132 5 %402 = OpIAdd %8 %369 %215 OpLine %3 132 5 %403 = OpAccessChain %392 %34 %131 %402 OpStore %403 %385 OpReturn OpFunctionEnd %414 = OpFunction %2 None %345 %404 = OpLabel %407 = OpLoad %8 %405 %416 = OpAccessChain %415 %36 %131 OpBranch %418 %418 = OpLabel OpLine %3 161 19 %419 = OpIAdd %8 %407 %349 OpLine %3 161 18 %420 = OpUDiv %8 %419 %350 OpLine %3 161 13 %421 = OpUMod %8 %420 %349 %422 = OpConvertUToF %5 %421 OpLine %3 162 19 %423 = OpIAdd %8 %407 %122 OpLine %3 162 18 %424 = OpUDiv %8 %423 %350 OpLine %3 162 13 %425 = OpUMod %8 %424 %349 %426 = OpConvertUToF %5 %425 OpLine %3 163 14 %427 = OpCompositeConstruct %6 %422 %426 OpLine %3 165 30 %428 = OpVectorTimesScalar %6 %427 %85 %429 = OpCompositeConstruct %6 %417 %417 %430 = OpFAdd %6 %429 %428 OpLine %3 165 20 %431 = OpCompositeConstruct %7 %430 %83 %56 OpLine %3 168 21 %433 = OpAccessChain %432 %416 %350 %434 = OpLoad %8 %433 %435 = OpConvertUToF %5 %434 %436 = OpFMul %5 %422 %435 OpLine %3 168 17 %437 = OpAccessChain %432 %416 %350 %438 = OpLoad %8 %437 %439 = OpConvertUToF %5 %438 %440 = OpFMul %5 %426 %439 %441 = OpFAdd %5 %436 %440 %442 = OpConvertFToU %8 %441 OpLine %3 168 17 %443 = OpAccessChain %432 %416 %351 %444 = OpLoad %8 %443 %445 = OpIAdd %8 %442 %444 OpLine %3 170 12 %446 = OpCompositeConstruct %21 %445 %431 %427 %447 = OpCompositeExtract %8 %446 0 OpStore %408 %447 %448 = OpCompositeExtract %7 %446 1 OpStore %410 %448 %449 = OpCompositeExtract %6 %446 2 OpStore %412 %449 OpReturn OpFunctionEnd %464 = OpFunction %2 None %345 %452 = OpLabel %450 = OpVariable %206 Function %207 %451 = OpVariable %210 Function %211 %455 = OpLoad %8 %454 %458 = OpLoad %7 %456 %461 = OpLoad %6 %459 %453 = OpCompositeConstruct %21 %455 %458 %461 %465 = OpAccessChain %415 %36 %131 OpBranch %467 %467 = OpLabel OpLine %3 181 17 %468 = OpCompositeExtract %6 %453 2 %469 = OpCompositeExtract %5 %468 0 OpLine %3 181 17 %470 = OpAccessChain %432 %465 %350 %471 = OpLoad %8 %470 %472 = OpConvertUToF %5 %471 %473 = OpFMul %5 %469 %472 %474 = OpCompositeExtract %6 %453 2 %475 = OpCompositeExtract %5 %474 1 OpLine %3 181 70 %476 = OpAccessChain %432 %465 %350 %477 = OpLoad %8 %476 OpLine %3 181 13 %478 = OpAccessChain %432 %465 %350 %479 = OpLoad %8 %478 %480 = OpIMul %8 %477 %479 %481 = OpConvertUToF %5 %480 %482 = OpFMul %5 %475 %481 %483 = OpFAdd %5 %473 %482 %484 = OpConvertFToU %8 %483 OpLine %3 181 13 %485 = OpAccessChain %432 %465 %351 %486 = OpLoad %8 %485 %487 = OpIAdd %8 %484 %486 OpLine %3 182 32 %488 = OpConvertUToF %5 %487 OpLine %3 182 22 %489 = OpFDiv %5 %488 %466 %490 = OpExtInst %5 %1 Floor %489 %491 = OpConvertFToU %8 %490 OpLine %3 183 22 %492 = OpUMod %8 %487 %348 OpLine %3 185 36 %493 = OpAccessChain %354 %465 %131 %494 = OpLoad %10 %493 OpLine %3 185 57 %495 = OpAccessChain %357 %465 %122 %496 = OpLoad %11 %495 OpLine %3 185 13 %497 = OpFunctionCall %6 %302 %491 %494 %496 OpLine %3 186 31 %498 = OpAccessChain %363 %465 %349 %499 = OpLoad %6 %498 OpLine %3 186 13 %500 = OpFunctionCall %14 %269 %497 %499 OpLine %3 188 5 OpStore %450 %83 OpLine %3 190 5 OpSelectionMerge %501 None OpSwitch %492 %508 0 %502 1 %503 2 %504 3 %505 4 %506 5 %507 %502 = OpLabel OpLine %3 191 37 %509 = OpCompositeExtract %4 %500 0 %510 = OpCompositeExtract %5 %509 0 OpLine %3 191 20 OpStore %450 %510 OpBranch %501 %503 = OpLabel OpLine %3 192 37 %511 = OpCompositeExtract %4 %500 0 %512 = OpCompositeExtract %5 %511 1 OpLine %3 192 20 OpStore %450 %512 OpBranch %501 %504 = OpLabel OpLine %3 193 37 %513 = OpCompositeExtract %4 %500 0 %514 = OpCompositeExtract %5 %513 2 OpLine %3 193 20 OpStore %450 %514 OpBranch %501 %505 = OpLabel OpLine %3 194 37 %515 = OpCompositeExtract %4 %500 1 %516 = OpCompositeExtract %5 %515 0 OpLine %3 194 20 OpStore %450 %516 OpBranch %501 %506 = OpLabel OpLine %3 195 37 %517 = OpCompositeExtract %4 %500 1 %518 = OpCompositeExtract %5 %517 1 OpLine %3 195 20 OpStore %450 %518 OpBranch %501 %507 = OpLabel OpLine %3 196 37 %519 = OpCompositeExtract %4 %500 1 %520 = OpCompositeExtract %5 %519 2 OpLine %3 196 20 OpStore %450 %520 OpBranch %501 %508 = OpLabel OpBranch %501 %501 = OpLabel OpLine %3 200 15 %521 = OpAccessChain %370 %465 %131 %131 %522 = OpLoad %8 %521 %523 = OpUDiv %8 %491 %522 %524 = OpIAdd %8 %491 %523 OpLine %3 201 15 %525 = OpIAdd %8 %524 %122 OpLine %3 202 15 %526 = OpAccessChain %370 %465 %131 %131 %527 = OpLoad %8 %526 %528 = OpIAdd %8 %524 %527 OpLine %3 202 15 %529 = OpIAdd %8 %528 %122 OpLine %3 203 15 %530 = OpIAdd %8 %529 %122 OpLine %3 205 5 OpStore %451 %131 OpLine %3 206 5 OpSelectionMerge %531 None OpSwitch %492 %536 0 %532 3 %532 2 %533 4 %533 1 %534 5 %535 %532 = OpLabel OpLine %3 207 24 OpStore %451 %524 OpBranch %531 %533 = OpLabel OpLine %3 208 24 OpStore %451 %530 OpBranch %531 %534 = OpLabel OpLine %3 209 20 OpStore %451 %529 OpBranch %531 %535 = OpLabel OpLine %3 210 20 OpStore %451 %525 OpBranch %531 %536 = OpLabel OpBranch %531 %531 = OpLabel OpLine %3 213 13 %537 = OpCompositeExtract %8 %453 0 OpLine %3 213 5 OpStore %451 %537 OpLine %3 222 27 %538 = OpLoad %5 %450 %539 = OpBitcast %8 %538 OpLine %3 223 12 %540 = OpLoad %8 %451 %541 = OpCompositeConstruct %22 %539 %540 %542 = OpCompositeExtract %8 %541 0 OpStore %462 %542 %543 = OpCompositeExtract %8 %541 1 OpStore %463 %543 OpReturn OpFunctionEnd %555 = OpFunction %2 None %345 %544 = OpLabel %548 = OpLoad %4 %546 %550 = OpLoad %4 %549 %545 = OpCompositeConstruct %14 %548 %550 %557 = OpAccessChain %556 %39 %131 OpBranch %558 %558 = OpLabel OpLine %3 254 25 %560 = OpAccessChain %559 %557 %122 %561 = OpLoad %23 %560 %562 = OpCompositeExtract %4 %545 0 OpLine %3 254 25 %563 = OpCompositeConstruct %7 %562 %56 %564 = OpMatrixTimesVector %7 %561 %563 OpLine %3 255 18 %565 = OpCompositeExtract %4 %545 1 OpLine %3 256 12 %566 = OpCompositeExtract %4 %545 0 %567 = OpCompositeConstruct %26 %564 %565 %566 %568 = OpCompositeExtract %7 %567 0 OpStore %551 %568 %569 = OpCompositeExtract %4 %567 1 OpStore %552 %569 %570 = OpCompositeExtract %4 %567 2 OpStore %554 %570 OpReturn OpFunctionEnd %581 = OpFunction %2 None %345 %572 = OpLabel %571 = OpVariable %73 Function %74 %575 = OpLoad %7 %574 %577 = OpLoad %4 %576 %579 = OpLoad %4 %578 %573 = OpCompositeConstruct %26 %575 %577 %579 %582 = OpAccessChain %556 %39 %131 %584 = OpAccessChain %583 %42 %131 OpBranch %587 %587 = OpLabel OpLine %3 278 28 %588 = OpCompositeConstruct %4 %83 %83 %83 OpLine %3 278 17 %589 = OpCompositeConstruct %4 %271 %271 %271 %590 = OpCompositeExtract %4 %573 2 %591 = OpExtInst %4 %1 Fract %590 %592 = OpExtInst %4 %1 SmoothStep %588 %589 %591 OpLine %3 278 5 OpStore %571 %592 OpLine %3 279 17 %593 = OpCompositeConstruct %4 %84 %271 %585 OpLine %3 279 13 %594 = OpCompositeConstruct %4 %586 %586 %586 %595 = OpAccessChain %121 %571 %131 %596 = OpLoad %5 %595 %597 = OpAccessChain %121 %571 %122 %598 = OpLoad %5 %597 %599 = OpFMul %5 %596 %598 %600 = OpAccessChain %121 %571 %349 %601 = OpLoad %5 %600 %602 = OpFMul %5 %599 %601 %603 = OpCompositeConstruct %4 %602 %602 %602 %604 = OpExtInst %4 %1 FMix %593 %594 %603 OpLine %3 279 5 OpStore %571 %604 OpLine %3 282 25 %606 = OpAccessChain %605 %584 %122 %607 = OpLoad %4 %606 %608 = OpVectorTimesScalar %4 %607 %271 OpLine %3 284 21 %609 = OpAccessChain %605 %584 %131 %610 = OpLoad %4 %609 %611 = OpCompositeExtract %4 %573 2 %612 = OpFSub %4 %610 %611 %613 = OpExtInst %4 %1 Normalize %612 OpLine %3 285 20 %615 = OpAccessChain %614 %582 %131 %616 = OpLoad %7 %615 %617 = OpVectorShuffle %4 %616 %616 0 1 2 %618 = OpCompositeExtract %4 %573 2 %619 = OpFSub %4 %617 %618 %620 = OpExtInst %4 %1 Normalize %619 OpLine %3 286 20 %621 = OpFAdd %4 %620 %613 %622 = OpExtInst %4 %1 Normalize %621 OpLine %3 288 32 %623 = OpCompositeExtract %4 %573 1 %624 = OpDot %5 %623 %613 OpLine %3 288 28 %625 = OpExtInst %5 %1 FMax %624 %83 OpLine %3 289 25 %626 = OpAccessChain %605 %584 %122 %627 = OpLoad %4 %626 %628 = OpVectorTimesScalar %4 %627 %625 OpLine %3 291 37 %629 = OpCompositeExtract %4 %573 1 %630 = OpDot %5 %629 %622 OpLine %3 291 33 %631 = OpExtInst %5 %1 FMax %630 %83 OpLine %3 291 29 %632 = OpExtInst %5 %1 Pow %631 %322 OpLine %3 292 26 %633 = OpAccessChain %605 %584 %122 %634 = OpLoad %4 %633 %635 = OpVectorTimesScalar %4 %634 %632 OpLine %3 294 18 %636 = OpFAdd %4 %608 %628 %637 = OpFAdd %4 %636 %635 %638 = OpLoad %4 %571 %639 = OpFMul %4 %637 %638 OpLine %3 296 12 %640 = OpCompositeConstruct %7 %639 %56 OpStore %580 %640 OpReturn OpFunctionEnd