iPhone 6
Estimated original GLSL:
#version 450
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
layout(push_constant, binding = 1, std430) uniform Params
{
ivec4 section;
ivec2 target;
uint flags;
uint pad;
float glow_strength;
float glow_bloom;
float glow_hdr_threshold;
float glow_hdr_scale;
float glow_exposure;
float glow_white;
float glow_luminance_cap;
float glow_auto_exposure_grey;
float camera_z_far;
float camera_z_near;
uint pad2[2];
} params;
layout(set = 0, binding = 0) uniform samplerCube source_color;
layout(set = 3, binding = 0, rgba32f) uniform restrict writeonly image2D dest_buffer;
void main()
{
ivec2 pos = ivec2(gl_GlobalInvocationID.xy);
if (any(greaterThanEqual(pos, params.section.zw)))
{
return;
}
vec2 uv = vec2(pos) / vec2(params.section.zw);
uv.y = 1.0 - uv.y;
float phi = (uv.x * 2.0) * 3.1415927410125732421875;
float theta = uv.y * 3.1415927410125732421875;
vec3 normal;
normal.x = (sin(phi) * sin(theta)) * (-1.0);
normal.y = cos(theta);
normal.z = (cos(phi) * sin(theta)) * (-1.0);
vec4 color = textureLod(source_color, normal, params.camera_z_far);
imageStore(dest_buffer, pos + params.target, color);
}
End GLSL
[mvk-info] Converting SPIR-V:
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 8
; Bound: 120
; Schema: 0
OpCapability Shader
OpCapability SampledCubeArray
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %4 "main" %13
OpExecutionMode %4 LocalSize 8 8 1
OpSource GLSL 450
OpName %4 "main"
OpName %9 "pos"
OpName %13 "gl_GlobalInvocationID"
OpName %23 "Params"
OpMemberName %23 0 "section"
OpMemberName %23 1 "target"
OpMemberName %23 2 "flags"
OpMemberName %23 3 "pad"
OpMemberName %23 4 "glow_strength"
OpMemberName %23 5 "glow_bloom"
OpMemberName %23 6 "glow_hdr_threshold"
OpMemberName %23 7 "glow_hdr_scale"
OpMemberName %23 8 "glow_exposure"
OpMemberName %23 9 "glow_white"
OpMemberName %23 10 "glow_luminance_cap"
OpMemberName %23 11 "glow_auto_exposure_grey"
OpMemberName %23 12 "camera_z_far"
OpMemberName %23 13 "camera_z_near"
OpMemberName %23 14 "pad2"
OpName %25 "params"
OpName %40 "uv"
OpName %55 "phi"
OpName %63 "theta"
OpName %69 "normal"
OpName %90 "color"
OpName %94 "source_color"
OpName %109 "dest_buffer"
OpDecorate %13 BuiltIn GlobalInvocationId
OpDecorate %22 ArrayStride 4
OpMemberDecorate %23 0 Offset 0
OpMemberDecorate %23 1 Offset 16
OpMemberDecorate %23 2 Offset 24
OpMemberDecorate %23 3 Offset 28
OpMemberDecorate %23 4 Offset 32
OpMemberDecorate %23 5 Offset 36
OpMemberDecorate %23 6 Offset 40
OpMemberDecorate %23 7 Offset 44
OpMemberDecorate %23 8 Offset 48
OpMemberDecorate %23 9 Offset 52
OpMemberDecorate %23 10 Offset 56
OpMemberDecorate %23 11 Offset 60
OpMemberDecorate %23 12 Offset 64
OpMemberDecorate %23 13 Offset 68
OpMemberDecorate %23 14 Offset 72
OpDecorate %23 Block
OpDecorate %25 Binding 1
OpDecorate %94 DescriptorSet 0
OpDecorate %94 Binding 0
OpDecorate %109 DescriptorSet 3
OpDecorate %109 Binding 0
OpDecorate %109 Restrict
OpDecorate %109 NonReadable
OpDecorate %119 BuiltIn WorkgroupSize
%2 = OpTypeVoid
%3 = OpTypeFunction %2
%6 = OpTypeInt 32 1
%7 = OpTypeVector %6 2
%8 = OpTypePointer Function %7
%10 = OpTypeInt 32 0
%11 = OpTypeVector %10 3
%12 = OpTypePointer Input %11
%13 = OpVariable %12 Input
%14 = OpTypeVector %10 2
%19 = OpTypeVector %6 4
%20 = OpTypeFloat 32
%21 = OpConstant %10 2
%22 = OpTypeArray %10 %21
%23 = OpTypeStruct %19 %7 %10 %10 %20 %20 %20 %20 %20 %20 %20 %20 %20 %20 %22
%24 = OpTypePointer PushConstant %23
%25 = OpVariable %24 PushConstant
%26 = OpConstant %6 0
%27 = OpTypePointer PushConstant %19
%31 = OpTypeBool
%32 = OpTypeVector %31 2
%38 = OpTypeVector %20 2
%39 = OpTypePointer Function %38
%48 = OpConstant %20 1
%49 = OpConstant %10 1
%50 = OpTypePointer Function %20
%56 = OpConstant %10 0
%59 = OpConstant %20 2
%61 = OpConstant %20 3.14159274
%67 = OpTypeVector %20 3
%68 = OpTypePointer Function %67
%75 = OpConstant %20 -1
%88 = OpTypeVector %20 4
%89 = OpTypePointer Function %88
%91 = OpTypeImage %20 Cube 0 1 0 1 Unknown
%92 = OpTypeSampledImage %91
%93 = OpTypePointer UniformConstant %92
%94 = OpVariable %93 UniformConstant
%97 = OpConstant %6 12
%98 = OpTypePointer PushConstant %20
%105 = OpConstant %20 0
%107 = OpTypeImage %20 2D 0 0 0 2 Rgba32f
%108 = OpTypePointer UniformConstant %107
%109 = OpVariable %108 UniformConstant
%112 = OpConstant %6 1
%113 = OpTypePointer PushConstant %7
%118 = OpConstant %10 8
%119 = OpConstantComposite %11 %118 %118 %49
%4 = OpFunction %2 None %3
%5 = OpLabel
%9 = OpVariable %8 Function
%40 = OpVariable %39 Function
%55 = OpVariable %50 Function
%63 = OpVariable %50 Function
%69 = OpVariable %68 Function
%90 = OpVariable %89 Function
%15 = OpLoad %11 %13
%16 = OpVectorShuffle %14 %15 %15 0 1
%17 = OpBitcast %7 %16
OpStore %9 %17
%18 = OpLoad %7 %9
%28 = OpAccessChain %27 %25 %26
%29 = OpLoad %19 %28
%30 = OpVectorShuffle %7 %29 %29 2 3
%33 = OpSGreaterThanEqual %32 %18 %30
%34 = OpAny %31 %33
OpSelectionMerge %36 None
OpBranchConditional %34 %35 %36
%35 = OpLabel
OpReturn
%36 = OpLabel
%41 = OpLoad %7 %9
%42 = OpConvertSToF %38 %41
%43 = OpAccessChain %27 %25 %26
%44 = OpLoad %19 %43
%45 = OpVectorShuffle %7 %44 %44 2 3
%46 = OpConvertSToF %38 %45
%47 = OpFDiv %38 %42 %46
OpStore %40 %47
%51 = OpAccessChain %50 %40 %49
%52 = OpLoad %20 %51
%53 = OpFSub %20 %48 %52
%54 = OpAccessChain %50 %40 %49
OpStore %54 %53
%57 = OpAccessChain %50 %40 %56
%58 = OpLoad %20 %57
%60 = OpFMul %20 %58 %59
%62 = OpFMul %20 %60 %61
OpStore %55 %62
%64 = OpAccessChain %50 %40 %49
%65 = OpLoad %20 %64
%66 = OpFMul %20 %65 %61
OpStore %63 %66
%70 = OpLoad %20 %55
%71 = OpExtInst %20 %1 Sin %70
%72 = OpLoad %20 %63
%73 = OpExtInst %20 %1 Sin %72
%74 = OpFMul %20 %71 %73
%76 = OpFMul %20 %74 %75
%77 = OpAccessChain %50 %69 %56
OpStore %77 %76
%78 = OpLoad %20 %63
%79 = OpExtInst %20 %1 Cos %78
%80 = OpAccessChain %50 %69 %49
OpStore %80 %79
%81 = OpLoad %20 %55
%82 = OpExtInst %20 %1 Cos %81
%83 = OpLoad %20 %63
%84 = OpExtInst %20 %1 Sin %83
%85 = OpFMul %20 %82 %84
%86 = OpFMul %20 %85 %75
%87 = OpAccessChain %50 %69 %21
OpStore %87 %86
%95 = OpLoad %92 %94
%96 = OpLoad %67 %69
%99 = OpAccessChain %98 %25 %97
%100 = OpLoad %20 %99
%101 = OpCompositeExtract %20 %96 0
%102 = OpCompositeExtract %20 %96 1
%103 = OpCompositeExtract %20 %96 2
%104 = OpCompositeConstruct %88 %101 %102 %103 %100
%106 = OpImageSampleExplicitLod %88 %95 %104 Lod %105
OpStore %90 %106
%110 = OpLoad %107 %109
%111 = OpLoad %7 %9
%114 = OpAccessChain %113 %25 %112
%115 = OpLoad %7 %114
%116 = OpIAdd %7 %111 %115
%117 = OpLoad %88 %90
OpImageWrite %110 %116 %117
OpReturn
OpFunctionEnd
End SPIR-V
Converted MSL:
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Params
{
int4 section;
int2 target;
uint flags;
uint pad;
float glow_strength;
float glow_bloom;
float glow_hdr_threshold;
float glow_hdr_scale;
float glow_exposure;
float glow_white;
float glow_luminance_cap;
float glow_auto_exposure_grey;
float camera_z_far;
float camera_z_near;
uint pad2[2];
};
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(8u, 8u, 1u);
kernel void main0(constant Params& params [[buffer(1)]], texturecube_array<float> source_color [[texture(0)]], texture2d<float, access::write> dest_buffer [[texture(1)]], sampler source_colorSmplr [[sampler(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
{
int2 pos = int2(gl_GlobalInvocationID.xy);
if (any(pos >= params.section.zw))
{
return;
}
float2 uv = float2(pos) / float2(params.section.zw);
uv.y = 1.0 - uv.y;
float phi = (uv.x * 2.0) * 3.1415927410125732421875;
float theta = uv.y * 3.1415927410125732421875;
float3 normal;
normal.x = (sin(phi) * sin(theta)) * (-1.0);
normal.y = cos(theta);
normal.z = (cos(phi) * sin(theta)) * (-1.0);
float4 _104 = float4(normal, params.camera_z_far);
float4 color = source_color.sample(source_colorSmplr, _104.xyz, uint(round(_104.w)), level(0.0));
dest_buffer.write(color, uint2((pos + params.target)));
}
End MSL
Estimated original GLSL:
#version 450
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
layout(push_constant, binding = 1, std430) uniform Params
{
ivec4 section;
ivec2 target;
uint flags;
uint pad;
float glow_strength;
float glow_bloom;
float glow_hdr_threshold;
float glow_hdr_scale;
float glow_exposure;
float glow_white;
float glow_luminance_cap;
float glow_auto_exposure_grey;
float camera_z_far;
float camera_z_near;
uint pad2[2];
} params;
layout(set = 0, binding = 0) uniform samplerCubeArray source_color;
layout(set = 3, binding = 0, rgba32f) uniform restrict writeonly image2D dest_buffer;
void main()
{
ivec2 pos = ivec2(gl_GlobalInvocationID.xy);
if (any(greaterThanEqual(pos, params.section.zw)))
{
return;
}
vec2 uv = vec2(pos) / vec2(params.section.zw);
uv.y = 1.0 - uv.y;
float phi = (uv.x * 2.0) * 3.1415927410125732421875;
float theta = uv.y * 3.1415927410125732421875;
vec3 normal;
normal.x = (sin(phi) * sin(theta)) * (-1.0);
normal.y = cos(theta);
normal.z = (cos(phi) * sin(theta)) * (-1.0);
vec4 color = textureLod(source_color, vec4(normal, params.camera_z_far), 0.0);
imageStore(dest_buffer, pos + params.target, color);
}
End GLSL
iPad
Estimated original GLSL:
#version 450
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
struct CascadeData
{
vec3 offset;
float to_cell;
ivec3 probe_world_offset;
uint pad;
};
layout(set = 0, binding = 7, std140) uniform Cascades
{
CascadeData data[8];
} cascades;
layout(push_constant, binding = 0, std430) uniform Params
{
vec3 grid_size;
uint max_cascades;
uint probe_axis_size;
uint cascade;
uint history_index;
uint history_size;
uint ray_count;
float ray_bias;
ivec2 image_size;
ivec3 world_offset;
uint sky_mode;
ivec3 scroll;
float sky_energy;
vec3 sky_color;
float y_mult;
} params;
layout(set = 0, binding = 11, rgba16i) uniform restrict readonly iimage2DArray lightprobe_history_scroll_texture;
layout(set = 0, binding = 9, rgba16i) uniform restrict writeonly iimage2DArray lightprobe_history_texture;
layout(set = 0, binding = 12, rgba32i) uniform restrict readonly iimage2D lightprobe_average_scroll_texture;
layout(set = 0, binding = 10, rgba32i) uniform restrict writeonly iimage2D lightprobe_average_texture;
layout(set = 0, binding = 1) uniform texture3D sdf_cascades[8];
layout(set = 0, binding = 2) uniform texture3D light_cascades[8];
layout(set = 0, binding = 3) uniform texture3D aniso0_cascades[8];
layout(set = 0, binding = 4) uniform texture3D aniso1_cascades[8];
layout(set = 0, binding = 6) uniform sampler linear_sampler;
layout(set = 0, binding = 8, r32ui) uniform restrict readonly writeonly uimage2DArray lightprobe_texture_data;
layout(set = 0, binding = 13, rgba32i) uniform restrict readonly writeonly iimage2D lightprobe_average_parent_texture;
layout(set = 1, binding = 0) uniform textureCube sky_irradiance;
layout(set = 1, binding = 1) uniform sampler linear_sampler_mipmaps;
void main()
{
ivec2 pos = ivec2(gl_GlobalInvocationID.xy);
if (any(greaterThanEqual(pos, params.image_size)))
{
return;
}
for (uint j = 0u; j < params.history_size; j++)
{
for (int i = 0; i < 16; i++)
{
ivec3 spos = ivec3(pos.x, (pos.y * 16) + i, int(j));
ivec4 value = imageLoad(lightprobe_history_scroll_texture, spos);
imageStore(lightprobe_history_texture, spos, value);
}
}
for (int i_1 = 0; i_1 < 16; i_1++)
{
ivec2 spos_1 = ivec2(pos.x, (pos.y * 16) + i_1);
ivec4 average = imageLoad(lightprobe_average_scroll_texture, spos_1);
imageStore(lightprobe_average_texture, spos_1, average);
}
}
End GLSL
[mvk-info] Converting SPIR-V:
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 8
; Bound: 2129
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %4 "main" %1899
OpExecutionMode %4 LocalSize 8 8 1
OpSource GLSL 450
OpName %4 "main"
OpName %11 "octahedron_wrap(vf2;"
OpName %10 "v"
OpName %17 "octahedron_encode(vf3;"
OpName %16 "n"
OpName %24 "blend_color(vf4;vf4;"
OpName %22 "src"
OpName %23 "dst"
OpName %31 "reconstruct_position(vi2;"
OpName %30 "screen_pos"
OpName %45 "sdfgi_probe_process(u1;vf3;vf3;vf3;vf3;f1;vf3;vf3;"
OpName %37 "cascade"
OpName %38 "cascade_pos"
OpName %39 "cam_pos"
OpName %40 "cam_normal"
OpName %41 "cam_specular_normal"
OpName %42 "roughness"
OpName %43 "diffuse_light"
OpName %44 "specular_light"
OpName %54 "sdfgi_process(vf3;vf3;vf3;f1;vf4;vf4;"
OpName %48 "vertex"
OpName %49 "normal"
OpName %50 "reflection"
OpName %51 "roughness"
OpName %52 "ambient_light"
OpName %53 "reflection_light"
OpName %66 "voxel_cone_trace(t31;vf3;vf3;vf3;f1;f1;f1;"
OpName %59 "probe"
OpName %60 "cell_size"
OpName %61 "pos"
OpName %62 "direction"
OpName %63 "tan_half_angle"
OpName %64 "max_distance"
OpName %65 "p_bias"
OpName %75 "voxel_cone_trace_45_degrees(t31;vf3;vf3;vf3;f1;f1;"
OpName %69 "probe"
OpName %70 "cell_size"
OpName %71 "pos"
OpName %72 "direction"
OpName %73 "max_distance"
OpName %74 "p_bias"
OpName %89 "gi_probe_compute(u1;vf3;vf3;vf3;mf33;f1;vf4;vf4;f1;"
OpName %80 "index"
OpName %81 "position"
OpName %82 "normal"
OpName %83 "ref_vec"
OpName %84 "normal_xform"
OpName %85 "roughness"
OpName %86 "out_spec"
OpName %87 "out_diff"
OpName %88 "out_blend"
OpName %93 "fetch_normal_and_roughness(vi2;"
OpName %92 "pos"
OpName %95 "signVal"
OpName %145 "param"
OpName %164 "sa"
OpName %169 "res"
OpName %209 "pos"
OpName %212 "depth_buffer"
OpName %216 "linear_sampler"
OpName %233 "Params"
OpMemberName %233 0 "screen_size"
OpMemberName %233 1 "z_near"
OpMemberName %233 2 "z_far"
OpMemberName %233 3 "proj_info"
OpMemberName %233 4 "max_giprobes"
OpMemberName %233 5 "high_quality_vct"
OpMemberName %233 6 "use_sdfgi"
OpMemberName %233 7 "orthogonal"
OpMemberName %233 8 "ao_color"
OpMemberName %233 9 "pad"
OpMemberName %233 10 "cam_rotation"
OpName %235 "params"
OpName %327 "ProbeCascadeData"
OpMemberName %327 0 "position"
OpMemberName %327 1 "to_probe"
OpMemberName %327 2 "probe_world_offset"
OpMemberName %327 3 "to_cell"
OpName %330 "SDFGI"
OpMemberName %330 0 "grid_size"
OpMemberName %330 1 "max_cascades"
OpMemberName %330 2 "use_occlusion"
OpMemberName %330 3 "probe_axis_size"
OpMemberName %330 4 "probe_to_uvw"
OpMemberName %330 5 "normal_bias"
OpMemberName %330 6 "lightprobe_tex_pixel_size"
OpMemberName %330 7 "energy"
OpMemberName %330 8 "lightprobe_uv_offset"
OpMemberName %330 9 "y_mult"
OpMemberName %330 10 "occlusion_clamp"
OpMemberName %330 11 "pad3"
OpMemberName %330 12 "occlusion_renormalize"
OpMemberName %330 13 "pad4"
OpMemberName %330 14 "cascade_probe_size"
OpMemberName %330 15 "pad5"
OpMemberName %330 16 "cascades"
OpName %332 "sdfgi"
OpName %340 "base_pos"
OpName %344 "probe_base_pos"
OpName %347 "diffuse_accum"
OpName %349 "tex_pos"
OpName %377 "diffuse_posf"
OpName %380 "param"
OpName %394 "specular_posf"
OpName %397 "param"
OpName %408 "specular_accum"
OpName %409 "light_accum"
OpName %410 "weight_accum"
OpName %411 "j"
OpName %419 "offset"
OpName %427 "probe_posi"
OpName %432 "probe_pos"
OpName %435 "probe_to_pos"
OpName %439 "probe_dir"
OpName %443 "trilinear"
OpName %448 "weight"
OpName %469 "occ_indexv"
OpName %482 "occ_mask"
OpName %495 "occ_pos"
OpName %530 "occlusion"
OpName %531 "occlusion_texture"
OpName %545 "pos_uvw"
OpName %569 "diffuse"
OpName %572 "lightprobe_texture"
OpName %590 "specular"
OpName %591 "pos_uvw"
OpName %705 "cam_pos"
OpName %707 "cam_normal"
OpName %709 "light_accum"
OpName %710 "weight_accum"
OpName %711 "light_blend_accum"
OpName %712 "weight_blend_accum"
OpName %713 "blend"
OpName %714 "cascade"
OpName %716 "i"
OpName %726 "cascade_pos"
OpName %762 "diffuse"
OpName %763 "specular"
OpName %764 "param"
OpName %766 "param"
OpName %768 "param"
OpName %770 "param"
OpName %772 "param"
OpName %774 "param"
OpName %776 "param"
OpName %777 "param"
OpName %781 "blend_from"
OpName %789 "blend_to"
OpName %792 "inner_pos"
OpName %798 "len"
OpName %819 "blend"
OpName %856 "diffuse2"
OpName %857 "specular2"
OpName %858 "param"
OpName %859 "param"
OpName %861 "param"
OpName %863 "param"
OpName %865 "param"
OpName %867 "param"
OpName %869 "param"
OpName %870 "param"
OpName %891 "pos_to_uvw"
OpName %896 "light_accum"
OpName %897 "blend_size"
OpName %907 "base_distance"
OpName %910 "i"
OpName %922 "radius_sizes"
OpName %955 "max_distance"
OpName %961 "ray_pos"
OpName %963 "ray_dir"
OpName %965 "prev_radius"
OpName %977 "base_blend"
OpName %987 "bias"
OpName %992 "abs_ray_dir"
OpName %1020 "softness"
OpName %1037 "i"
OpName %1064 "pos"
OpName %1077 "distance"
OpName %1080 "sdf_cascades"
OpName %1092 "hit_light"
OpName %1098 "light_cascades"
OpName %1153 "distance2"
OpName %1165 "hit_light2"
OpName %1200 "prev_radius"
OpName %1212 "blend"
OpName %1256 "light"
OpName %1265 "alpha"
OpName %1269 "b"
OpName %1273 "sa"
OpName %1319 "dist"
OpName %1321 "color"
OpName %1337 "diameter"
OpName %1343 "uvw_pos"
OpName %1351 "half_diameter"
OpName %1372 "scolor"
OpName %1374 "linear_sampler_with_mipmaps"
OpName %1381 "a"
OpName %1396 "dist"
OpName %1398 "color"
OpName %1399 "radius"
OpName %1402 "lod_level"
OpName %1420 "uvw_pos"
OpName %1446 "scolor"
OpName %1455 "a"
OpName %1474 "GIProbeData"
OpMemberName %1474 0 "xform"
OpMemberName %1474 1 "bounds"
OpMemberName %1474 2 "dynamic_range"
OpMemberName %1474 3 "bias"
OpMemberName %1474 4 "normal_bias"
OpMemberName %1474 5 "blend_ambient"
OpMemberName %1474 6 "texture_slot"
OpMemberName %1474 7 "anisotropy_strength"
OpMemberName %1474 8 "ambient_occlusion"
OpMemberName %1474 9 "ambient_occlusion_size"
OpMemberName %1474 10 "pad2"
OpName %1476 "GIProbes"
OpMemberName %1476 0 "data"
OpName %1478 "gi_probes"
OpName %1534 "dir_xform"
OpName %1547 "blendv"
OpName %1557 "blend"
OpName %1568 "max_distance"
OpName %1573 "cell_size"
OpName %1579 "light"
OpName %1588 "cone_dirs"
OpName %1605 "cone_weights"
OpName %1609 "cone_angle_tan"
OpName %1611 "i"
OpName %1619 "dir"
OpName %1629 "gi_probe_textures"
OpName %1633 "param"
OpName %1635 "param"
OpName %1637 "param"
OpName %1639 "param"
OpName %1641 "param"
OpName %1643 "param"
OpName %1656 "cone_dirs"
OpName %1666 "cone_weights"
OpName %1668 "i"
OpName %1677 "dir"
OpName %1690 "param"
OpName %1692 "param"
OpName %1694 "param"
OpName %1696 "param"
OpName %1698 "param"
OpName %1714 "size"
OpName %1721 "blend"
OpName %1723 "taps"
OpName %1725 "ao"
OpName %1726 "i"
OpName %1735 "ofs"
OpName %1765 "ofs"
OpName %1830 "irr_light"
OpName %1840 "param"
OpName %1842 "param"
OpName %1844 "param"
OpName %1846 "param"
OpName %1847 "param"
OpName %1849 "param"
OpName %1877 "normal_roughness"
OpName %1878 "normal_roughness_buffer"
OpName %1896 "pos"
OpName %1899 "gl_GlobalInvocationID"
OpName %1913 "vertex"
OpName %1914 "param"
OpName %1921 "normal_roughness"
OpName %1922 "param"
OpName %1925 "normal"
OpName %1928 "ambient_light"
OpName %1929 "reflection_light"
OpName %1933 "roughness"
OpName %1960 "reflection"
OpName %1971 "param"
OpName %1973 "param"
OpName %1975 "param"
OpName %1977 "param"
OpName %1979 "param"
OpName %1980 "param"
OpName %1990 "giprobe_tex"
OpName %1993 "giprobe_buffer"
OpName %2006 "v0"
OpName %2015 "tangent"
OpName %2020 "bitangent"
OpName %2025 "normal_mat"
OpName %2042 "amb_accum"
OpName %2043 "spec_accum"
OpName %2044 "blend_accum"
OpName %2045 "i"
OpName %2062 "param"
OpName %2064 "param"
OpName %2066 "param"
OpName %2068 "param"
OpName %2070 "param"
OpName %2072 "param"
OpName %2074 "param"
OpName %2076 "param"
OpName %2078 "param"
OpName %2103 "param"
OpName %2105 "param"
OpName %2108 "param"
OpName %2110 "param"
OpName %2118 "ambient_buffer"
OpName %2122 "reflection_buffer"
OpName %2127 "aniso0_cascades"
OpName %2128 "aniso1_cascades"
OpDecorate %212 DescriptorSet 0
OpDecorate %212 Binding 12
OpDecorate %216 DescriptorSet 0
OpDecorate %216 Binding 6
OpMemberDecorate %233 0 Offset 0
OpMemberDecorate %233 1 Offset 8
OpMemberDecorate %233 2 Offset 12
OpMemberDecorate %233 3 Offset 16
OpMemberDecorate %233 4 Offset 32
OpMemberDecorate %233 5 Offset 36
OpMemberDecorate %233 6 Offset 40
OpMemberDecorate %233 7 Offset 44
OpMemberDecorate %233 8 Offset 48
OpMemberDecorate %233 9 Offset 60
OpMemberDecorate %233 10 ColMajor
OpMemberDecorate %233 10 Offset 64
OpMemberDecorate %233 10 MatrixStride 16
OpDecorate %233 Block
OpDecorate %235 Binding 0
OpMemberDecorate %327 0 Offset 0
OpMemberDecorate %327 1 Offset 12
OpMemberDecorate %327 2 Offset 16
OpMemberDecorate %327 3 Offset 28
OpDecorate %329 ArrayStride 32
OpMemberDecorate %330 0 Offset 0
OpMemberDecorate %330 1 Offset 12
OpMemberDecorate %330 2 Offset 16
OpMemberDecorate %330 3 Offset 20
OpMemberDecorate %330 4 Offset 24
OpMemberDecorate %330 5 Offset 28
OpMemberDecorate %330 6 Offset 32
OpMemberDecorate %330 7 Offset 44
OpMemberDecorate %330 8 Offset 48
OpMemberDecorate %330 9 Offset 60
OpMemberDecorate %330 10 Offset 64
OpMemberDecorate %330 11 Offset 76
OpMemberDecorate %330 12 Offset 80
OpMemberDecorate %330 13 Offset 92
OpMemberDecorate %330 14 Offset 96
OpMemberDecorate %330 15 Offset 108
OpMemberDecorate %330 16 Offset 112
OpDecorate %330 Block
OpDecorate %332 DescriptorSet 0
OpDecorate %332 Binding 15
OpDecorate %531 DescriptorSet 0
OpDecorate %531 Binding 5
OpDecorate %572 DescriptorSet 0
OpDecorate %572 Binding 11
OpDecorate %1080 DescriptorSet 0
OpDecorate %1080 Binding 1
OpDecorate %1098 DescriptorSet 0
OpDecorate %1098 Binding 2
OpDecorate %1374 DescriptorSet 0
OpDecorate %1374 Binding 7
OpMemberDecorate %1474 0 ColMajor
OpMemberDecorate %1474 0 Offset 0
OpMemberDecorate %1474 0 MatrixStride 16
OpMemberDecorate %1474 1 Offset 64
OpMemberDecorate %1474 2 Offset 76
OpMemberDecorate %1474 3 Offset 80
OpMemberDecorate %1474 4 Offset 84
OpMemberDecorate %1474 5 Offset 88
OpMemberDecorate %1474 6 Offset 92
OpMemberDecorate %1474 7 Offset 96
OpMemberDecorate %1474 8 Offset 100
OpMemberDecorate %1474 9 Offset 104
OpMemberDecorate %1474 10 Offset 108
OpDecorate %1475 ArrayStride 112
OpMemberDecorate %1476 0 Offset 0
OpDecorate %1476 Block
OpDecorate %1478 DescriptorSet 0
OpDecorate %1478 Binding 16
OpDecorate %1629 DescriptorSet 0
OpDecorate %1629 Binding 17
OpDecorate %1878 DescriptorSet 0
OpDecorate %1878 Binding 13
OpDecorate %1899 BuiltIn GlobalInvocationId
OpDecorate %1993 DescriptorSet 0
OpDecorate %1993 Binding 14
OpDecorate %2118 DescriptorSet 0
OpDecorate %2118 Binding 9
OpDecorate %2118 Restrict
OpDecorate %2118 NonReadable
OpDecorate %2122 DescriptorSet 0
OpDecorate %2122 Binding 10
OpDecorate %2122 Restrict
OpDecorate %2122 NonReadable
OpDecorate %2126 BuiltIn WorkgroupSize
OpDecorate %2127 DescriptorSet 0
OpDecorate %2127 Binding 3
OpDecorate %2128 DescriptorSet 0
OpDecorate %2128 Binding 4
%2 = OpTypeVoid
%3 = OpTypeFunction %2
%6 = OpTypeFloat 32
%7 = OpTypeVector %6 2
%8 = OpTypePointer Function %7
%9 = OpTypeFunction %7 %8
%13 = OpTypeVector %6 3
%14 = OpTypePointer Function %13
%15 = OpTypeFunction %7 %14
%19 = OpTypeVector %6 4
%20 = OpTypePointer Function %19
%21 = OpTypeFunction %19 %20 %20
%26 = OpTypeInt 32 1
%27 = OpTypeVector %26 2
%28 = OpTypePointer Function %27
%29 = OpTypeFunction %13 %28
%33 = OpTypeInt 32 0
%34 = OpTypePointer Function %33
%35 = OpTypePointer Function %6
%36 = OpTypeFunction %2 %34 %14 %14 %14 %14 %35 %14 %14
%47 = OpTypeFunction %2 %14 %14 %14 %35 %20 %20
%56 = OpTypeImage %6 3D 0 0 0 1 Unknown
%57 = OpTypePointer UniformConstant %56
%58 = OpTypeFunction %19 %57 %14 %14 %14 %35 %35 %35
%68 = OpTypeFunction %19 %57 %14 %14 %14 %35 %35
%77 = OpTypeMatrix %13 3
%78 = OpTypePointer Function %77
%79 = OpTypeFunction %2 %34 %14 %14 %14 %78 %35 %20 %20 %35
%91 = OpTypeFunction %19 %28
%96 = OpConstant %33 0
%99 = OpConstant %6 0
%100 = OpTypeBool
%102 = OpConstant %6 1
%103 = OpConstant %6 -1
%106 = OpConstant %33 1
%128 = OpConstant %33 2
%154 = OpConstant %6 0.5
%165 = OpConstant %33 3
%183 = OpConstantComposite %13 %99 %99 %99
%210 = OpTypeImage %6 2D 0 0 0 1 Unknown
%211 = OpTypePointer UniformConstant %210
%212 = OpVariable %211 UniformConstant
%214 = OpTypeSampler
%215 = OpTypePointer UniformConstant %214
%216 = OpVariable %215 UniformConstant
%218 = OpTypeSampledImage %210
%221 = OpConstant %26 0
%228 = OpConstant %6 2
%232 = OpTypeMatrix %19 3
%233 = OpTypeStruct %27 %6 %6 %19 %33 %33 %33 %33 %13 %33 %232
%234 = OpTypePointer PushConstant %233
%235 = OpVariable %234 PushConstant
%236 = OpConstant %26 7
%237 = OpTypePointer PushConstant %33
%245 = OpConstant %26 2
%246 = OpTypePointer PushConstant %6
%249 = OpConstant %26 1
%297 = OpConstant %26 3
%298 = OpTypePointer PushConstant %19
%326 = OpTypeVector %26 3
%327 = OpTypeStruct %13 %6 %326 %6
%328 = OpConstant %33 8
%329 = OpTypeArray %327 %328
%330 = OpTypeStruct %13 %33 %33 %26 %6 %6 %13 %6 %13 %6 %13 %33 %13 %33 %13 %33 %329
%331 = OpTypePointer Uniform %330
%332 = OpVariable %331 Uniform
%333 = OpConstant %26 5
%334 = OpTypePointer Uniform %6
%343 = OpTypePointer Function %326
%348 = OpConstantComposite %19 %99 %99 %99 %99
%357 = OpTypePointer Function %26
%360 = OpTypePointer Uniform %26
%370 = OpConstant %26 8
%373 = OpConstantComposite %27 %249 %249
%383 = OpConstant %6 6
%389 = OpConstant %26 6
%390 = OpTypePointer Uniform %13
%423 = OpConstantComposite %326 %221 %249 %245
%425 = OpConstantComposite %326 %249 %249 %249
%444 = OpConstantComposite %13 %102 %102 %102
%457 = OpConstant %6 0.00499999989
%463 = OpTypePointer Uniform %33
%470 = OpConstant %26 16
%472 = OpTypePointer Uniform %326
%479 = OpConstant %26 4
%480 = OpConstantComposite %326 %249 %245 %479
%483 = OpConstantComposite %19 %102 %102 %102 %102
%489 = OpTypeVector %26 4
%491 = OpConstantComposite %489 %221 %249 %245 %297
%492 = OpTypeVector %100 4
%498 = OpConstant %26 10
%525 = OpConstant %26 12
%531 = OpVariable %57 UniformConstant
%534 = OpTypeSampledImage %56
%541 = OpConstant %6 0.00999999978
%570 = OpTypeImage %6 2D 0 1 0 1 Unknown
%571 = OpTypePointer UniformConstant %570
%572 = OpVariable %571 UniformConstant
%575 = OpTypeSampledImage %570
%616 = OpConstant %6 0.99000001
%632 = OpConstant %6 0.200000003
%645 = OpConstant %6 1.25
%682 = OpConstant %26 9
%715 = OpConstant %33 4294967295
%737 = OpTypeVector %100 3
%744 = OpConstant %26 14
%761 = OpConstantComposite %19 %99 %99 %99 %102
%787 = OpConstant %6 2.5
%906 = OpConstant %33 65535
%920 = OpTypeArray %6 %328
%921 = OpTypePointer Function %920
%990 = OpConstant %6 1.10000002
%1008 = OpConstant %6 1.39999998
%1022 = OpConstant %6 5
%1025 = OpConstant %6 4
%1078 = OpTypeArray %56 %328
%1079 = OpTypePointer UniformConstant %1078
%1080 = OpVariable %1079 UniformConstant
%1089 = OpConstant %6 255
%1098 = OpVariable %1079 UniformConstant
%1261 = OpConstant %6 9.99999975e-06
%1334 = OpConstant %6 0.949999988
%1374 = OpVariable %215 UniformConstant
%1473 = OpTypeMatrix %19 4
%1474 = OpTypeStruct %1473 %13 %6 %6 %6 %33 %33 %6 %6 %6 %33
%1475 = OpTypeArray %1474 %328
%1476 = OpTypeStruct %1475
%1477 = OpTypePointer Uniform %1476
%1478 = OpVariable %1477 Uniform
%1480 = OpTypePointer Uniform %1473
%1528 = OpTypeVector %100 2
%1585 = OpConstant %33 6
%1586 = OpTypeArray %13 %1585
%1587 = OpTypePointer Function %1586
%1589 = OpConstantComposite %13 %99 %99 %102
%1590 = OpConstant %6 0.866024971
%1591 = OpConstantComposite %13 %1590 %99 %154
%1592 = OpConstant %6 0.267616987
%1593 = OpConstant %6 0.823638976
%1594 = OpConstantComposite %13 %1592 %1593 %154
%1595 = OpConstant %6 -0.700628996
%1596 = OpConstant %6 0.509037018
%1597 = OpConstantComposite %13 %1595 %1596 %154
%1598 = OpConstant %6 -0.509037018
%1599 = OpConstantComposite %13 %1595 %1598 %154
%1600 = OpConstant %6 -0.823638976
%1601 = OpConstantComposite %13 %1592 %1600 %154
%1602 = OpConstantComposite %1586 %1589 %1591 %1594 %1597 %1599 %1601
%1603 = OpTypeArray %6 %1585
%1604 = OpTypePointer Function %1603
%1606 = OpConstant %6 0.25
%1607 = OpConstant %6 0.150000006
%1608 = OpConstantComposite %1603 %1606 %1607 %1607 %1607 %1607 %1607
%1610 = OpConstant %6 0.577000022
%1629 = OpVariable %1079 UniformConstant
%1653 = OpConstant %33 4
%1654 = OpTypeArray %13 %1653
%1655 = OpTypePointer Function %1654
%1657 = OpConstant %6 0.707107008
%1658 = OpConstantComposite %13 %1657 %99 %1657
%1659 = OpConstantComposite %13 %99 %1657 %1657
%1660 = OpConstant %6 -0.707107008
%1661 = OpConstantComposite %13 %1660 %99 %1657
%1662 = OpConstantComposite %13 %99 %1660 %1657
%1663 = OpConstantComposite %1654 %1658 %1659 %1661 %1662
%1664 = OpTypeArray %6 %1653
%1665 = OpTypePointer Function %1664
%1667 = OpConstantComposite %1664 %1606 %1606 %1606 %1606
%1710 = OpConstant %6 0.00100000005
%1718 = OpConstant %6 7
%1795 = OpTypePointer PushConstant %13
%1834 = OpConstant %6 3.14159203
%1878 = OpVariable %211 UniformConstant
%1897 = OpTypeVector %33 3
%1898 = OpTypePointer Input %1897
%1899 = OpVariable %1898 Input
%1900 = OpTypeVector %33 2
%1905 = OpTypePointer PushConstant %27
%1930 = OpConstantTrue %100
%1936 = OpTypePointer PushConstant %232
%1989 = OpTypePointer Function %1900
%1991 = OpTypeImage %33 2D 0 0 0 1 Unknown
%1992 = OpTypePointer UniformConstant %1991
%1993 = OpVariable %1992 UniformConstant
%1996 = OpTypeSampledImage %1991
%2000 = OpTypeVector %33 4
%2010 = OpConstant %6 0.999000013
%2012 = OpConstantComposite %13 %99 %102 %99
%2116 = OpTypeImage %6 2D 0 0 0 2 Rgba16f
%2117 = OpTypePointer UniformConstant %2116
%2118 = OpVariable %2117 UniformConstant
%2122 = OpVariable %2117 UniformConstant
%2126 = OpConstantComposite %1897 %328 %328 %106
%2127 = OpVariable %1079 UniformConstant
%2128 = OpVariable %1079 UniformConstant
%4 = OpFunction %2 None %3
%5 = OpLabel
%1896 = OpVariable %28 Function
%1913 = OpVariable %14 Function
%1914 = OpVariable %28 Function
%1921 = OpVariable %20 Function
%1922 = OpVariable %28 Function
%1925 = OpVariable %14 Function
%1928 = OpVariable %20 Function
%1929 = OpVariable %20 Function
%1933 = OpVariable %35 Function
%1960 = OpVariable %14 Function
%1971 = OpVariable %14 Function
%1973 = OpVariable %14 Function
%1975 = OpVariable %14 Function
%1977 = OpVariable %35 Function
%1979 = OpVariable %20 Function
%1980 = OpVariable %20 Function
%1990 = OpVariable %1989 Function
%2006 = OpVariable %14 Function
%2015 = OpVariable %14 Function
%2020 = OpVariable %14 Function
%2025 = OpVariable %78 Function
%2042 = OpVariable %20 Function
%2043 = OpVariable %20 Function
%2044 = OpVariable %35 Function
%2045 = OpVariable %34 Function
%2062 = OpVariable %34 Function
%2064 = OpVariable %14 Function
%2066 = OpVariable %14 Function
%2068 = OpVariable %14 Function
%2070 = OpVariable %78 Function
%2072 = OpVariable %35 Function
%2074 = OpVariable %20 Function
%2076 = OpVariable %20 Function
%2078 = OpVariable %35 Function
%2103 = OpVariable %20 Function
%2105 = OpVariable %20 Function
%2108 = OpVariable %20 Function
%2110 = OpVariable %20 Function
%1901 = OpLoad %1897 %1899
%1902 = OpVectorShuffle %1900 %1901 %1901 0 1
%1903 = OpBitcast %27 %1902
OpStore %1896 %1903
%1904 = OpLoad %27 %1896
%1906 = OpAccessChain %1905 %235 %221
%1907 = OpLoad %27 %1906
%1908 = OpSGreaterThanEqual %1528 %1904 %1907
%1909 = OpAny %100 %1908
OpSelectionMerge %1911 None
OpBranchConditional %1909 %1910 %1911
%1910 = OpLabel
OpReturn
%1911 = OpLabel
%1915 = OpLoad %27 %1896
OpStore %1914 %1915
%1916 = OpFunctionCall %13 %31 %1914
OpStore %1913 %1916
%1917 = OpAccessChain %35 %1913 %106
%1918 = OpLoad %6 %1917
%1919 = OpFNegate %6 %1918
%1920 = OpAccessChain %35 %1913 %106
OpStore %1920 %1919
%1923 = OpLoad %27 %1896
OpStore %1922 %1923
%1924 = OpFunctionCall %19 %93 %1922
OpStore %1921 %1924
%1926 = OpLoad %19 %1921
%1927 = OpVectorShuffle %13 %1926 %1926 0 1 2
OpStore %1925 %1927
OpStore %1928 %348
OpStore %1929 %348
OpSelectionMerge %1932 None
OpBranchConditional %1930 %1931 %1932
%1931 = OpLabel
%1934 = OpAccessChain %35 %1921 %165
%1935 = OpLoad %6 %1934
OpStore %1933 %1935
%1937 = OpAccessChain %1936 %235 %498
%1938 = OpLoad %232 %1937
%1939 = OpCompositeExtract %19 %1938 0
%1940 = OpVectorShuffle %13 %1939 %1939 0 1 2
%1941 = OpCompositeExtract %19 %1938 1
%1942 = OpVectorShuffle %13 %1941 %1941 0 1 2
%1943 = OpCompositeExtract %19 %1938 2
%1944 = OpVectorShuffle %13 %1943 %1943 0 1 2
%1945 = OpCompositeConstruct %77 %1940 %1942 %1944
%1946 = OpLoad %13 %1913
%1947 = OpMatrixTimesVector %13 %1945 %1946
OpStore %1913 %1947
%1948 = OpAccessChain %1936 %235 %498
%1949 = OpLoad %232 %1948
%1950 = OpCompositeExtract %19 %1949 0
%1951 = OpVectorShuffle %13 %1950 %1950 0 1 2
%1952 = OpCompositeExtract %19 %1949 1
%1953 = OpVectorShuffle %13 %1952 %1952 0 1 2
%1954 = OpCompositeExtract %19 %1949 2
%1955 = OpVectorShuffle %13 %1954 %1954 0 1 2
%1956 = OpCompositeConstruct %77 %1951 %1953 %1955
%1957 = OpLoad %13 %1925
%1958 = OpMatrixTimesVector %13 %1956 %1957
%1959 = OpExtInst %13 %1 Normalize %1958
OpStore %1925 %1959
%1961 = OpLoad %13 %1913
%1962 = OpExtInst %13 %1 Normalize %1961
%1963 = OpLoad %13 %1925
%1964 = OpExtInst %13 %1 Reflect %1962 %1963
%1965 = OpExtInst %13 %1 Normalize %1964
OpStore %1960 %1965
%1966 = OpAccessChain %237 %235 %389
%1967 = OpLoad %33 %1966
%1968 = OpINotEqual %100 %1967 %96
OpSelectionMerge %1970 None
OpBranchConditional %1968 %1969 %1970
%1969 = OpLabel
%1972 = OpLoad %13 %1913
OpStore %1971 %1972
%1974 = OpLoad %13 %1925
OpStore %1973 %1974
%1976 = OpLoad %13 %1960
OpStore %1975 %1976
%1978 = OpLoad %6 %1933
OpStore %1977 %1978
%1981 = OpFunctionCall %2 %54 %1971 %1973 %1975 %1977 %1979 %1980
%1982 = OpLoad %19 %1979
OpStore %1928 %1982
%1983 = OpLoad %19 %1980
OpStore %1929 %1983
OpBranch %1970
%1970 = OpLabel
%1984 = OpAccessChain %237 %235 %479
%1985 = OpLoad %33 %1984
%1986 = OpUGreaterThan %100 %1985 %96
OpSelectionMerge %1988 None
OpBranchConditional %1986 %1987 %1988
%1987 = OpLabel
%1994 = OpLoad %1991 %1993
%1995 = OpLoad %214 %216
%1997 = OpSampledImage %1996 %1994 %1995
%1998 = OpLoad %27 %1896
%1999 = OpImage %1991 %1997
%2001 = OpImageFetch %2000 %1999 %1998 Lod %221
%2002 = OpVectorShuffle %1900 %2001 %2001 0 1
OpStore %1990 %2002
%2003 = OpLoad %6 %1933
%2004 = OpLoad %6 %1933
%2005 = OpFMul %6 %2004 %2003
OpStore %1933 %2005
%2007 = OpAccessChain %35 %1925 %128
%2008 = OpLoad %6 %2007
%2009 = OpExtInst %6 %1 FAbs %2008
%2011 = OpFOrdLessThan %100 %2009 %2010
%2013 = OpCompositeConstruct %737 %2011 %2011 %2011
%2014 = OpSelect %13 %2013 %1589 %2012
OpStore %2006 %2014
%2016 = OpLoad %13 %2006
%2017 = OpLoad %13 %1925
%2018 = OpExtInst %13 %1 Cross %2016 %2017
%2019 = OpExtInst %13 %1 Normalize %2018
OpStore %2015 %2019
%2021 = OpLoad %13 %2015
%2022 = OpLoad %13 %1925
%2023 = OpExtInst %13 %1 Cross %2021 %2022
%2024 = OpExtInst %13 %1 Normalize %2023
OpStore %2020 %2024
%2026 = OpLoad %13 %2015
%2027 = OpLoad %13 %2020
%2028 = OpLoad %13 %1925
%2029 = OpCompositeExtract %6 %2026 0
%2030 = OpCompositeExtract %6 %2026 1
%2031 = OpCompositeExtract %6 %2026 2
%2032 = OpCompositeExtract %6 %2027 0
%2033 = OpCompositeExtract %6 %2027 1
%2034 = OpCompositeExtract %6 %2027 2
%2035 = OpCompositeExtract %6 %2028 0
%2036 = OpCompositeExtract %6 %2028 1
%2037 = OpCompositeExtract %6 %2028 2
%2038 = OpCompositeConstruct %13 %2029 %2030 %2031
%2039 = OpCompositeConstruct %13 %2032 %2033 %2034
%2040 = OpCompositeConstruct %13 %2035 %2036 %2037
%2041 = OpCompositeConstruct %77 %2038 %2039 %2040
OpStore %2025 %2041
OpStore %2042 %348
OpStore %2043 %348
OpStore %2044 %99
OpStore %2045 %96
OpBranch %2046
%2046 = OpLabel
OpLoopMerge %2048 %2049 None
OpBranch %2050
%2050 = OpLabel
%2051 = OpLoad %33 %2045
%2052 = OpAccessChain %237 %235 %479
%2053 = OpLoad %33 %2052
%2054 = OpULessThan %100 %2051 %2053
OpBranchConditional %2054 %2047 %2048
%2047 = OpLabel
%2055 = OpLoad %33 %2045
%2056 = OpCompositeConstruct %1900 %2055 %2055
%2057 = OpLoad %1900 %1990
%2058 = OpIEqual %1528 %2056 %2057
%2059 = OpAny %100 %2058
OpSelectionMerge %2061 None
OpBranchConditional %2059 %2060 %2061
%2060 = OpLabel
%2063 = OpLoad %33 %2045
OpStore %2062 %2063
%2065 = OpLoad %13 %1913
OpStore %2064 %2065
%2067 = OpLoad %13 %1925
OpStore %2066 %2067
%2069 = OpLoad %13 %1960
OpStore %2068 %2069
%2071 = OpLoad %77 %2025
OpStore %2070 %2071
%2073 = OpLoad %6 %1933
OpStore %2072 %2073
%2075 = OpLoad %19 %2043
OpStore %2074 %2075
%2077 = OpLoad %19 %2042
OpStore %2076 %2077
%2079 = OpLoad %6 %2044
OpStore %2078 %2079
%2080 = OpFunctionCall %2 %89 %2062 %2064 %2066 %2068 %2070 %2072 %2074 %2076 %2078
%2081 = OpLoad %19 %2074
OpStore %2043 %2081
%2082 = OpLoad %19 %2076
OpStore %2042 %2082
%2083 = OpLoad %6 %2078
OpStore %2044 %2083
OpBranch %2061
%2061 = OpLabel
OpBranch %2049
%2049 = OpLabel
%2084 = OpLoad %33 %2045
%2085 = OpIAdd %33 %2084 %249
OpStore %2045 %2085
OpBranch %2046
%2048 = OpLabel
%2086 = OpLoad %6 %2044
%2087 = OpFOrdGreaterThan %100 %2086 %99
OpSelectionMerge %2089 None
OpBranchConditional %2087 %2088 %2089
%2088 = OpLabel
%2090 = OpLoad %6 %2044
%2091 = OpLoad %19 %2042
%2092 = OpCompositeConstruct %19 %2090 %2090 %2090 %2090
%2093 = OpFDiv %19 %2091 %2092
OpStore %2042 %2093
%2094 = OpLoad %6 %2044
%2095 = OpLoad %19 %2043
%2096 = OpCompositeConstruct %19 %2094 %2094 %2094 %2094
%2097 = OpFDiv %19 %2095 %2096
OpStore %2043 %2097
OpBranch %2089
%2089 = OpLabel
%2098 = OpAccessChain %237 %235 %389
%2099 = OpLoad %33 %2098
%2100 = OpINotEqual %100 %2099 %96
OpSelectionMerge %2102 None
OpBranchConditional %2100 %2101 %2113
%2101 = OpLabel
%2104 = OpLoad %19 %2043
OpStore %2103 %2104
%2106 = OpLoad %19 %1929
OpStore %2105 %2106
%2107 = OpFunctionCall %19 %24 %2103 %2105
OpStore %1929 %2107
%2109 = OpLoad %19 %2042
OpStore %2108 %2109
%2111 = OpLoad %19 %1928
OpStore %2110 %2111
%2112 = OpFunctionCall %19 %24 %2108 %2110
OpStore %1928 %2112
OpBranch %2102
%2113 = OpLabel
%2114 = OpLoad %19 %2043
OpStore %1929 %2114
%2115 = OpLoad %19 %2042
OpStore %1928 %2115
OpBranch %2102
%2102 = OpLabel
OpBranch %1988
%1988 = OpLabel
OpBranch %1932
%1932 = OpLabel
%2119 = OpLoad %2116 %2118
%2120 = OpLoad %27 %1896
%2121 = OpLoad %19 %1928
OpImageWrite %2119 %2120 %2121
%2123 = OpLoad %2116 %2122
%2124 = OpLoad %27 %1896
%2125 = OpLoad %19 %1929
OpImageWrite %2123 %2124 %2125
OpReturn
OpFunctionEnd
%11 = OpFunction %7 None %9
%10 = OpFunctionParameter %8
%12 = OpLabel
%95 = OpVariable %8 Function
%97 = OpAccessChain %35 %10 %96
%98 = OpLoad %6 %97
%101 = OpFOrdGreaterThanEqual %100 %98 %99
%104 = OpSelect %6 %101 %102 %103
%105 = OpAccessChain %35 %95 %96
OpStore %105 %104
%107 = OpAccessChain %35 %10 %106
%108 = OpLoad %6 %107
%109 = OpFOrdGreaterThanEqual %100 %108 %99
%110 = OpSelect %6 %109 %102 %103
%111 = OpAccessChain %35 %95 %106
OpStore %111 %110
%112 = OpLoad %7 %10
%113 = OpVectorShuffle %7 %112 %112 1 0
%114 = OpExtInst %7 %1 FAbs %113
%115 = OpCompositeConstruct %7 %102 %102
%116 = OpFSub %7 %115 %114
%117 = OpLoad %7 %95
%118 = OpFMul %7 %116 %117
OpReturnValue %118
OpFunctionEnd
%17 = OpFunction %7 None %15
%16 = OpFunctionParameter %14
%18 = OpLabel
%139 = OpVariable %8 Function
%145 = OpVariable %8 Function
%121 = OpAccessChain %35 %16 %96
%122 = OpLoad %6 %121
%123 = OpExtInst %6 %1 FAbs %122
%124 = OpAccessChain %35 %16 %106
%125 = OpLoad %6 %124
%126 = OpExtInst %6 %1 FAbs %125
%127 = OpFAdd %6 %123 %126
%129 = OpAccessChain %35 %16 %128
%130 = OpLoad %6 %129
%131 = OpExtInst %6 %1 FAbs %130
%132 = OpFAdd %6 %127 %131
%133 = OpLoad %13 %16
%134 = OpCompositeConstruct %13 %132 %132 %132
%135 = OpFDiv %13 %133 %134
OpStore %16 %135
%136 = OpAccessChain %35 %16 %128
%137 = OpLoad %6 %136
%138 = OpFOrdGreaterThanEqual %100 %137 %99
OpSelectionMerge %141 None
OpBranchConditional %138 %140 %144
%140 = OpLabel
%142 = OpLoad %13 %16
%143 = OpVectorShuffle %7 %142 %142 0 1
OpStore %139 %143
OpBranch %141
%144 = OpLabel
%146 = OpLoad %13 %16
%147 = OpVectorShuffle %7 %146 %146 0 1
OpStore %145 %147
%148 = OpFunctionCall %7 %11 %145
OpStore %139 %148
OpBranch %141
%141 = OpLabel
%149 = OpLoad %7 %139
%150 = OpLoad %13 %16
%151 = OpVectorShuffle %13 %150 %149 3 4 2
OpStore %16 %151
%152 = OpLoad %13 %16
%153 = OpVectorShuffle %7 %152 %152 0 1
%155 = OpVectorTimesScalar %7 %153 %154
%156 = OpCompositeConstruct %7 %154 %154
%157 = OpFAdd %7 %155 %156
%158 = OpLoad %13 %16
%159 = OpVectorShuffle %13 %158 %157 3 4 2
OpStore %16 %159
%160 = OpLoad %13 %16
%161 = OpVectorShuffle %7 %160 %160 0 1
OpReturnValue %161
OpFunctionEnd
%24 = OpFunction %19 None %21
%22 = OpFunctionParameter %20
%23 = OpFunctionParameter %20
%25 = OpLabel
%164 = OpVariable %35 Function
%169 = OpVariable %20 Function
%166 = OpAccessChain %35 %22 %165
%167 = OpLoad %6 %166
%168 = OpFSub %6 %102 %167
OpStore %164 %168
%170 = OpAccessChain %35 %23 %165
%171 = OpLoad %6 %170
%172 = OpLoad %6 %164
%173 = OpFMul %6 %171 %172
%174 = OpAccessChain %35 %22 %165
%175 = OpLoad %6 %174
%176 = OpFAdd %6 %173 %175
%177 = OpAccessChain %35 %169 %165
OpStore %177 %176
%178 = OpAccessChain %35 %169 %165
%179 = OpLoad %6 %178
%180 = OpFOrdEqual %100 %179 %99
OpSelectionMerge %182 None
OpBranchConditional %180 %181 %186
%181 = OpLabel
%184 = OpLoad %19 %169
%185 = OpVectorShuffle %19 %184 %183 4 5 6 3
OpStore %169 %185
OpBranch %182
%186 = OpLabel
%187 = OpLoad %19 %23
%188 = OpVectorShuffle %13 %187 %187 0 1 2
%189 = OpAccessChain %35 %23 %165
%190 = OpLoad %6 %189
%191 = OpVectorTimesScalar %13 %188 %190
%192 = OpLoad %6 %164
%193 = OpVectorTimesScalar %13 %191 %192
%194 = OpLoad %19 %22
%195 = OpVectorShuffle %13 %194 %194 0 1 2
%196 = OpAccessChain %35 %22 %165
%197 = OpLoad %6 %196
%198 = OpVectorTimesScalar %13 %195 %197
%199 = OpFAdd %13 %193 %198
%200 = OpAccessChain %35 %169 %165
%201 = OpLoad %6 %200
%202 = OpCompositeConstruct %13 %201 %201 %201
%203 = OpFDiv %13 %199 %202
%204 = OpLoad %19 %169
%205 = OpVectorShuffle %19 %204 %203 4 5 6 3
OpStore %169 %205
OpBranch %182
%182 = OpLabel
%206 = OpLoad %19 %169
OpReturnValue %206
OpFunctionEnd
%31 = OpFunction %13 None %29
%30 = OpFunctionParameter %28
%32 = OpLabel
%209 = OpVariable %14 Function
%213 = OpLoad %210 %212
%217 = OpLoad %214 %216
%219 = OpSampledImage %218 %213 %217
%220 = OpLoad %27 %30
%222 = OpImage %210 %219
%223 = OpImageFetch %19 %222 %220 Lod %221
%224 = OpCompositeExtract %6 %223 0
%225 = OpAccessChain %35 %209 %128
OpStore %225 %224
%226 = OpAccessChain %35 %209 %128
%227 = OpLoad %6 %226
%229 = OpFMul %6 %227 %228
%230 = OpFSub %6 %229 %102
%231 = OpAccessChain %35 %209 %128
OpStore %231 %230
%238 = OpAccessChain %237 %235 %236
%239 = OpLoad %33 %238
%240 = OpINotEqual %100 %239 %96
OpSelectionMerge %242 None
OpBranchConditional %240 %241 %268
%241 = OpLabel
%243 = OpAccessChain %35 %209 %128
%244 = OpLoad %6 %243
%247 = OpAccessChain %246 %235 %245
%248 = OpLoad %6 %247
%250 = OpAccessChain %246 %235 %249
%251 = OpLoad %6 %250
%252 = OpFAdd %6 %248 %251
%253 = OpAccessChain %246 %235 %245
%254 = OpLoad %6 %253
%255 = OpAccessChain %246 %235 %249
%256 = OpLoad %6 %255
%257 = OpFSub %6 %254 %256
%258 = OpFDiv %6 %252 %257
%259 = OpFAdd %6 %244 %258
%260 = OpAccessChain %246 %235 %245
%261 = OpLoad %6 %260
%262 = OpAccessChain %246 %235 %249
%263 = OpLoad %6 %262
%264 = OpFSub %6 %261 %263
%265 = OpFMul %6 %259 %264
%266 = OpFDiv %6 %265 %228
%267 = OpAccessChain %35 %209 %128
OpStore %267 %266
OpBranch %242
%268 = OpLabel
%269 = OpAccessChain %246 %235 %249
%270 = OpLoad %6 %269
%271 = OpFMul %6 %228 %270
%272 = OpAccessChain %246 %235 %245
%273 = OpLoad %6 %272
%274 = OpFMul %6 %271 %273
%275 = OpAccessChain %246 %235 %245
%276 = OpLoad %6 %275
%277 = OpAccessChain %246 %235 %249
%278 = OpLoad %6 %277
%279 = OpFAdd %6 %276 %278
%280 = OpAccessChain %35 %209 %128
%281 = OpLoad %6 %280
%282 = OpAccessChain %246 %235 %245
%283 = OpLoad %6 %282
%284 = OpAccessChain %246 %235 %249
%285 = OpLoad %6 %284
%286 = OpFSub %6 %283 %285
%287 = OpFMul %6 %281 %286
%288 = OpFSub %6 %279 %287
%289 = OpFDiv %6 %274 %288
%290 = OpAccessChain %35 %209 %128
OpStore %290 %289
OpBranch %242
%242 = OpLabel
%291 = OpAccessChain %35 %209 %128
%292 = OpLoad %6 %291
%293 = OpFNegate %6 %292
%294 = OpAccessChain %35 %209 %128
OpStore %294 %293
%295 = OpLoad %27 %30
%296 = OpConvertSToF %7 %295
%299 = OpAccessChain %298 %235 %297
%300 = OpLoad %19 %299
%301 = OpVectorShuffle %7 %300 %300 0 1
%302 = OpFMul %7 %296 %301
%303 = OpAccessChain %298 %235 %297
%304 = OpLoad %19 %303
%305 = OpVectorShuffle %7 %304 %304 2 3
%306 = OpFAdd %7 %302 %305
%307 = OpLoad %13 %209
%308 = OpVectorShuffle %13 %307 %306 3 4 2
OpStore %209 %308
%309 = OpAccessChain %237 %235 %236
%310 = OpLoad %33 %309
%311 = OpINotEqual %100 %310 %96
%312 = OpLogicalNot %100 %311
OpSelectionMerge %314 None
OpBranchConditional %312 %313 %314
%313 = OpLabel
%315 = OpAccessChain %35 %209 %128
%316 = OpLoad %6 %315
%317 = OpLoad %13 %209
%318 = OpVectorShuffle %7 %317 %317 0 1
%319 = OpVectorTimesScalar %7 %318 %316
%320 = OpLoad %13 %209
%321 = OpVectorShuffle %13 %320 %319 3 4 2
OpStore %209 %321
OpBranch %314
%314 = OpLabel
%322 = OpLoad %13 %209
OpReturnValue %322
OpFunctionEnd
%45 = OpFunction %2 None %36
%37 = OpFunctionParameter %34
%38 = OpFunctionParameter %14
%39 = OpFunctionParameter %14
%40 = OpFunctionParameter %14
%41 = OpFunctionParameter %14
%42 = OpFunctionParameter %35
%43 = OpFunctionParameter %14
%44 = OpFunctionParameter %14
%46 = OpLabel
%340 = OpVariable %14 Function
%344 = OpVariable %343 Function
%347 = OpVariable %20 Function
%349 = OpVariable %343 Function
%377 = OpVariable %14 Function
%380 = OpVariable %14 Function
%394 = OpVariable %14 Function
%397 = OpVariable %14 Function
%408 = OpVariable %14 Function
%409 = OpVariable %20 Function
%410 = OpVariable %35 Function
%411 = OpVariable %34 Function
%419 = OpVariable %343 Function
%427 = OpVariable %343 Function
%432 = OpVariable %14 Function
%435 = OpVariable %14 Function
%439 = OpVariable %14 Function
%443 = OpVariable %14 Function
%448 = OpVariable %35 Function
%469 = OpVariable %343 Function
%482 = OpVariable %20 Function
%495 = OpVariable %14 Function
%530 = OpVariable %35 Function
%545 = OpVariable %14 Function
%569 = OpVariable %14 Function
%590 = OpVariable %14 Function
%591 = OpVariable %14 Function
%325 = OpLoad %13 %40
%335 = OpAccessChain %334 %332 %333
%336 = OpLoad %6 %335
%337 = OpVectorTimesScalar %13 %325 %336
%338 = OpLoad %13 %38
%339 = OpFAdd %13 %338 %337
OpStore %38 %339
%341 = OpLoad %13 %38
%342 = OpExtInst %13 %1 Floor %341
OpStore %340 %342
%345 = OpLoad %13 %340
%346 = OpConvertFToS %326 %345
OpStore %344 %346
OpStore %347 %348
%350 = OpLoad %326 %344
%351 = OpVectorShuffle %27 %350 %350 0 1
%352 = OpLoad %33 %37
%353 = OpBitcast %26 %352
%354 = OpCompositeExtract %26 %351 0
%355 = OpCompositeExtract %26 %351 1
%356 = OpCompositeConstruct %326 %354 %355 %353
OpStore %349 %356
%358 = OpAccessChain %357 %344 %128
%359 = OpLoad %26 %358
%361 = OpAccessChain %360 %332 %297
%362 = OpLoad %26 %361
%363 = OpIMul %26 %359 %362
%364 = OpAccessChain %357 %349 %96
%365 = OpLoad %26 %364
%366 = OpIAdd %26 %365 %363
%367 = OpAccessChain %357 %349 %96
OpStore %367 %366
%368 = OpLoad %326 %349
%369 = OpVectorShuffle %27 %368 %368 0 1
%371 = OpCompositeConstruct %27 %370 %370
%372 = OpIMul %27 %369 %371
%374 = OpIAdd %27 %372 %373
%375 = OpLoad %326 %349
%376 = OpVectorShuffle %326 %375 %374 3 4 2
OpStore %349 %376
%378 = OpLoad %326 %349
%379 = OpConvertSToF %13 %378
%381 = OpLoad %13 %40
OpStore %380 %381
%382 = OpFunctionCall %7 %17 %380
%384 = OpVectorTimesScalar %7 %382 %383
%385 = OpCompositeExtract %6 %384 0
%386 = OpCompositeExtract %6 %384 1
%387 = OpCompositeConstruct %13 %385 %386 %99
%388 = OpFAdd %13 %379 %387
%391 = OpAccessChain %390 %332 %389
%392 = OpLoad %13 %391
%393 = OpFMul %13 %388 %392
OpStore %377 %393
%395 = OpLoad %326 %349
%396 = OpConvertSToF %13 %395
%398 = OpLoad %13 %41
OpStore %397 %398
%399 = OpFunctionCall %7 %17 %397
%400 = OpVectorTimesScalar %7 %399 %383
%401 = OpCompositeExtract %6 %400 0
%402 = OpCompositeExtract %6 %400 1
%403 = OpCompositeConstruct %13 %401 %402 %99
%404 = OpFAdd %13 %396 %403
%405 = OpAccessChain %390 %332 %389
%406 = OpLoad %13 %405
%407 = OpFMul %13 %404 %406
OpStore %394 %407
OpStore %408 %183
OpStore %409 %348
OpStore %410 %99
OpStore %411 %96
OpBranch %412
%412 = OpLabel
OpLoopMerge %414 %415 None
OpBranch %416
%416 = OpLabel
%417 = OpLoad %33 %411
%418 = OpULessThan %100 %417 %328
OpBranchConditional %418 %413 %414
%413 = OpLabel
%420 = OpLoad %33 %411
%421 = OpBitcast %26 %420
%422 = OpCompositeConstruct %326 %421 %421 %421
%424 = OpShiftRightArithmetic %326 %422 %423
%426 = OpBitwiseAnd %326 %424 %425
OpStore %419 %426
%428 = OpLoad %326 %344
OpStore %427 %428
%429 = OpLoad %326 %419
%430 = OpLoad %326 %427
%431 = OpIAdd %326 %430 %429
OpStore %427 %431
%433 = OpLoad %326 %427
%434 = OpConvertSToF %13 %433
OpStore %432 %434
%436 = OpLoad %13 %38
%437 = OpLoad %13 %432
%438 = OpFSub %13 %436 %437
OpStore %435 %438
%440 = OpLoad %13 %435
%441 = OpFNegate %13 %440
%442 = OpExtInst %13 %1 Normalize %441
OpStore %439 %442
%445 = OpLoad %13 %435
%446 = OpExtInst %13 %1 FAbs %445
%447 = OpFSub %13 %444 %446
OpStore %443 %447
%449 = OpAccessChain %35 %443 %96
%450 = OpLoad %6 %449
%451 = OpAccessChain %35 %443 %106
%452 = OpLoad %6 %451
%453 = OpFMul %6 %450 %452
%454 = OpAccessChain %35 %443 %128
%455 = OpLoad %6 %454
%456 = OpFMul %6 %453 %455
%458 = OpLoad %13 %40
%459 = OpLoad %13 %439
%460 = OpDot %6 %458 %459
%461 = OpExtInst %6 %1 FMax %457 %460
%462 = OpFMul %6 %456 %461
OpStore %448 %462
%464 = OpAccessChain %463 %332 %245
%465 = OpLoad %33 %464
%466 = OpINotEqual %100 %465 %96
OpSelectionMerge %468 None
OpBranchConditional %466 %467 %468
%467 = OpLabel
%471 = OpLoad %33 %37
%473 = OpAccessChain %472 %332 %470 %471 %245
%474 = OpLoad %326 %473
%475 = OpLoad %326 %427
%476 = OpIAdd %326 %474 %475
%477 = OpBitwiseAnd %326 %476 %425
%478 = OpExtInst %326 %1 SAbs %477
%481 = OpIMul %326 %478 %480
OpStore %469 %481
%484 = OpAccessChain %357 %469 %96
%485 = OpLoad %26 %484
%486 = OpAccessChain %357 %469 %106
%487 = OpLoad %26 %486
%488 = OpBitwiseOr %26 %485 %487
%490 = OpCompositeConstruct %489 %488 %488 %488 %488
%493 = OpIEqual %492 %490 %491
%494 = OpSelect %19 %493 %483 %348
OpStore %482 %494
%496 = OpLoad %13 %38
%497 = OpLoad %13 %432
%499 = OpAccessChain %390 %332 %498
%500 = OpLoad %13 %499
%501 = OpFSub %13 %497 %500
%502 = OpLoad %13 %432
%503 = OpAccessChain %390 %332 %498
%504 = OpLoad %13 %503
%505 = OpFAdd %13 %502 %504
%506 = OpExtInst %13 %1 FClamp %496 %501 %505
%507 = OpAccessChain %334 %332 %479
%508 = OpLoad %6 %507
%509 = OpVectorTimesScalar %13 %506 %508
OpStore %495 %509
%510 = OpLoad %33 %37
%511 = OpConvertUToF %6 %510
%512 = OpAccessChain %35 %495 %128
%513 = OpLoad %6 %512
%514 = OpFAdd %6 %513 %511
%515 = OpAccessChain %35 %495 %128
OpStore %515 %514
%516 = OpAccessChain %357 %469 %128
%517 = OpLoad %26 %516
%518 = OpINotEqual %100 %517 %221
OpSelectionMerge %520 None
OpBranchConditional %518 %519 %520
%519 = OpLabel
%521 = OpAccessChain %35 %495 %96
%522 = OpLoad %6 %521
%523 = OpFAdd %6 %522 %102
%524 = OpAccessChain %35 %495 %96
OpStore %524 %523
OpBranch %520
%520 = OpLabel
%526 = OpAccessChain %390 %332 %525
%527 = OpLoad %13 %526
%528 = OpLoad %13 %495
%529 = OpFMul %13 %528 %527
OpStore %495 %529
%532 = OpLoad %56 %531
%533 = OpLoad %214 %216
%535 = OpSampledImage %534 %532 %533
%536 = OpLoad %13 %495
%537 = OpImageSampleExplicitLod %19 %535 %536 Lod %99
%538 = OpLoad %19 %482
%539 = OpDot %6 %537 %538
OpStore %530 %539
%540 = OpLoad %6 %530
%542 = OpExtInst %6 %1 FMax %540 %541
%543 = OpLoad %6 %448
%544 = OpFMul %6 %543 %542
OpStore %448 %544
OpBranch %468
%468 = OpLabel
%546 = OpLoad %13 %377
OpStore %545 %546
%547 = OpLoad %326 %419
%548 = OpVectorShuffle %27 %547 %547 0 1
%549 = OpConvertSToF %7 %548
%550 = OpAccessChain %390 %332 %370
%551 = OpLoad %13 %550
%552 = OpVectorShuffle %7 %551 %551 0 1
%553 = OpFMul %7 %549 %552
%554 = OpLoad %13 %545
%555 = OpVectorShuffle %7 %554 %554 0 1
%556 = OpFAdd %7 %555 %553
%557 = OpLoad %13 %545
%558 = OpVectorShuffle %13 %557 %556 3 4 2
OpStore %545 %558
%559 = OpAccessChain %357 %419 %128
%560 = OpLoad %26 %559
%561 = OpConvertSToF %6 %560
%562 = OpAccessChain %334 %332 %370 %128
%563 = OpLoad %6 %562
%564 = OpFMul %6 %561 %563
%565 = OpAccessChain %35 %545 %96
%566 = OpLoad %6 %565
%567 = OpFAdd %6 %566 %564
%568 = OpAccessChain %35 %545 %96
OpStore %568 %567
%573 = OpLoad %570 %572
%574 = OpLoad %214 %216
%576 = OpSampledImage %575 %573 %574
%577 = OpLoad %13 %545
%578 = OpImageSampleExplicitLod %19 %576 %577 Lod %99
%579 = OpVectorShuffle %13 %578 %578 0 1 2
OpStore %569 %579
%580 = OpLoad %13 %569
%581 = OpLoad %6 %448
%582 = OpVectorTimesScalar %13 %580 %581
%583 = OpLoad %6 %448
%584 = OpCompositeExtract %6 %582 0
%585 = OpCompositeExtract %6 %582 1
%586 = OpCompositeExtract %6 %582 2
%587 = OpCompositeConstruct %19 %584 %585 %586 %583
%588 = OpLoad %19 %347
%589 = OpFAdd %19 %588 %587
OpStore %347 %589
OpStore %590 %183
%592 = OpLoad %13 %394
OpStore %591 %592
%593 = OpLoad %326 %419
%594 = OpVectorShuffle %27 %593 %593 0 1
%595 = OpConvertSToF %7 %594
%596 = OpAccessChain %390 %332 %370
%597 = OpLoad %13 %596
%598 = OpVectorShuffle %7 %597 %597 0 1
%599 = OpFMul %7 %595 %598
%600 = OpLoad %13 %591
%601 = OpVectorShuffle %7 %600 %600 0 1
%602 = OpFAdd %7 %601 %599
%603 = OpLoad %13 %591
%604 = OpVectorShuffle %13 %603 %602 3 4 2
OpStore %591 %604
%605 = OpAccessChain %357 %419 %128
%606 = OpLoad %26 %605
%607 = OpConvertSToF %6 %606
%608 = OpAccessChain %334 %332 %370 %128
%609 = OpLoad %6 %608
%610 = OpFMul %6 %607 %609
%611 = OpAccessChain %35 %591 %96
%612 = OpLoad %6 %611
%613 = OpFAdd %6 %612 %610
%614 = OpAccessChain %35 %591 %96
OpStore %614 %613
%615 = OpLoad %6 %42
%617 = OpFOrdLessThan %100 %615 %616
OpSelectionMerge %619 None
OpBranchConditional %617 %618 %619
%618 = OpLabel
%620 = OpLoad %570 %572
%621 = OpLoad %214 %216
%622 = OpSampledImage %575 %620 %621
%623 = OpLoad %13 %591
%624 = OpAccessChain %463 %332 %249
%625 = OpLoad %33 %624
%626 = OpConvertUToF %6 %625
%627 = OpCompositeConstruct %13 %99 %99 %626
%628 = OpFAdd %13 %623 %627
%629 = OpImageSampleExplicitLod %19 %622 %628 Lod %99
%630 = OpVectorShuffle %13 %629 %629 0 1 2
OpStore %590 %630
OpBranch %619
%619 = OpLabel
%631 = OpLoad %6 %42
%633 = OpFOrdGreaterThan %100 %631 %632
OpSelectionMerge %635 None
OpBranchConditional %633 %634 %635
%634 = OpLabel
%636 = OpLoad %13 %590
%637 = OpLoad %570 %572
%638 = OpLoad %214 %216
%639 = OpSampledImage %575 %637 %638
%640 = OpLoad %13 %591
%641 = OpImageSampleExplicitLod %19 %639 %640 Lod %99
%642 = OpVectorShuffle %13 %641 %641 0 1 2
%643 = OpLoad %6 %42
%644 = OpFSub %6 %643 %632
%646 = OpFMul %6 %644 %645
%647 = OpCompositeConstruct %13 %646 %646 %646
%648 = OpExtInst %13 %1 FMix %636 %642 %647
OpStore %590 %648
OpBranch %635
%635 = OpLabel
%649 = OpLoad %13 %590
%650 = OpLoad %6 %448
%651 = OpVectorTimesScalar %13 %649 %650
%652 = OpLoad %13 %408
%653 = OpFAdd %13 %652 %651
OpStore %408 %653
OpBranch %415
%415 = OpLabel
%654 = OpLoad %33 %411
%655 = OpIAdd %33 %654 %249
OpStore %411 %655
OpBranch %412
%414 = OpLabel
%656 = OpAccessChain %35 %347 %165
%657 = OpLoad %6 %656
%658 = OpFOrdGreaterThan %100 %657 %99
OpSelectionMerge %660 None
OpBranchConditional %658 %659 %660
%659 = OpLabel
%661 = OpAccessChain %35 %347 %165
%662 = OpLoad %6 %661
%663 = OpLoad %19 %347
%664 = OpVectorShuffle %13 %663 %663 0 1 2
%665 = OpCompositeConstruct %13 %662 %662 %662
%666 = OpFDiv %13 %664 %665
%667 = OpLoad %19 %347
%668 = OpVectorShuffle %19 %667 %666 4 5 6 3
OpStore %347 %668
OpBranch %660
%660 = OpLabel
%669 = OpLoad %19 %347
%670 = OpVectorShuffle %13 %669 %669 0 1 2
OpStore %43 %670
%671 = OpAccessChain %35 %347 %165
%672 = OpLoad %6 %671
%673 = OpFOrdGreaterThan %100 %672 %99
OpSelectionMerge %675 None
OpBranchConditional %673 %674 %675
%674 = OpLabel
%676 = OpAccessChain %35 %347 %165
%677 = OpLoad %6 %676
%678 = OpLoad %13 %408
%679 = OpCompositeConstruct %13 %677 %677 %677
%680 = OpFDiv %13 %678 %679
OpStore %408 %680
OpBranch %675
%675 = OpLabel
%681 = OpLoad %13 %408
OpStore %44 %681
OpReturn
OpFunctionEnd
%54 = OpFunction %2 None %47
%48 = OpFunctionParameter %14
%49 = OpFunctionParameter %14
%50 = OpFunctionParameter %14
%51 = OpFunctionParameter %35
%52 = OpFunctionParameter %20
%53 = OpFunctionParameter %20
%55 = OpLabel
%705 = OpVariable %14 Function
%707 = OpVariable %14 Function
%709 = OpVariable %20 Function
%710 = OpVariable %35 Function
%711 = OpVariable %20 Function
%712 = OpVariable %35 Function
%713 = OpVariable %35 Function
%714 = OpVariable %34 Function
%716 = OpVariable %34 Function
%726 = OpVariable %14 Function
%762 = OpVariable %14 Function
%763 = OpVariable %14 Function
%764 = OpVariable %34 Function
%766 = OpVariable %14 Function
%768 = OpVariable %14 Function
%770 = OpVariable %14 Function
%772 = OpVariable %14 Function
%774 = OpVariable %35 Function
%776 = OpVariable %14 Function
%777 = OpVariable %14 Function
%781 = OpVariable %35 Function
%789 = OpVariable %35 Function
%792 = OpVariable %14 Function
%798 = OpVariable %35 Function
%819 = OpVariable %35 Function
%856 = OpVariable %14 Function
%857 = OpVariable %14 Function
%858 = OpVariable %34 Function
%859 = OpVariable %14 Function
%861 = OpVariable %14 Function
%863 = OpVariable %14 Function
%865 = OpVariable %14 Function
%867 = OpVariable %35 Function
%869 = OpVariable %14 Function
%870 = OpVariable %14 Function
%891 = OpVariable %14 Function
%896 = OpVariable %20 Function
%897 = OpVariable %35 Function
%907 = OpVariable %35 Function
%910 = OpVariable %34 Function
%922 = OpVariable %921 Function
%955 = OpVariable %35 Function
%961 = OpVariable %14 Function
%963 = OpVariable %14 Function
%965 = OpVariable %35 Function
%968 = OpVariable %35 Function
%977 = OpVariable %35 Function
%987 = OpVariable %35 Function
%992 = OpVariable %14 Function
%1020 = OpVariable %35 Function
%1037 = OpVariable %34 Function
%1064 = OpVariable %14 Function
%1077 = OpVariable %35 Function
%1092 = OpVariable %20 Function
%1153 = OpVariable %35 Function
%1165 = OpVariable %20 Function
%1200 = OpVariable %35 Function
%1203 = OpVariable %35 Function
%1212 = OpVariable %35 Function
%1256 = OpVariable %14 Function
%1265 = OpVariable %35 Function
%1269 = OpVariable %35 Function
%1273 = OpVariable %35 Function
%683 = OpAccessChain %334 %332 %682
%684 = OpLoad %6 %683
%685 = OpAccessChain %35 %48 %106
%686 = OpLoad %6 %685
%687 = OpFMul %6 %686 %684
%688 = OpAccessChain %35 %48 %106
OpStore %688 %687
%689 = OpAccessChain %334 %332 %682
%690 = OpLoad %6 %689
%691 = OpAccessChain %35 %49 %106
%692 = OpLoad %6 %691
%693 = OpFMul %6 %692 %690
%694 = OpAccessChain %35 %49 %106
OpStore %694 %693
%695 = OpAccessChain %334 %332 %682
%696 = OpLoad %6 %695
%697 = OpAccessChain %35 %50 %106
%698 = OpLoad %6 %697
%699 = OpFMul %6 %698 %696
%700 = OpAccessChain %35 %50 %106
OpStore %700 %699
%701 = OpLoad %13 %49
%702 = OpExtInst %13 %1 Normalize %701
OpStore %49 %702
%703 = OpLoad %13 %50
%704 = OpExtInst %13 %1 Normalize %703
OpStore %50 %704
%706 = OpLoad %13 %48
OpStore %705 %706
%708 = OpLoad %13 %49
OpStore %707 %708
OpStore %709 %348
OpStore %710 %99
OpStore %711 %348
OpStore %712 %99
OpStore %713 %103
OpStore %714 %715
OpStore %716 %96
OpBranch %717
%717 = OpLabel
OpLoopMerge %719 %720 None
OpBranch %721
%721 = OpLabel
%722 = OpLoad %33 %716
%723 = OpAccessChain %463 %332 %249
%724 = OpLoad %33 %723
%725 = OpULessThan %100 %722 %724
OpBranchConditional %725 %718 %719
%718 = OpLabel
%727 = OpLoad %13 %705
%728 = OpLoad %33 %716
%729 = OpAccessChain %390 %332 %470 %728 %221
%730 = OpLoad %13 %729
%731 = OpFSub %13 %727 %730
%732 = OpLoad %33 %716
%733 = OpAccessChain %334 %332 %470 %732 %249
%734 = OpLoad %6 %733
%735 = OpVectorTimesScalar %13 %731 %734
OpStore %726 %735
%736 = OpLoad %13 %726
%738 = OpFOrdLessThan %737 %736 %183
%739 = OpAny %100 %738
%740 = OpLogicalNot %100 %739
OpSelectionMerge %742 None
OpBranchConditional %740 %741 %742
%741 = OpLabel
%743 = OpLoad %13 %726
%745 = OpAccessChain %390 %332 %744
%746 = OpLoad %13 %745
%747 = OpFOrdGreaterThanEqual %737 %743 %746
%748 = OpAny %100 %747
OpBranch %742
%742 = OpLabel
%749 = OpPhi %100 %739 %718 %748 %741
OpSelectionMerge %751 None
OpBranchConditional %749 %750 %751
%750 = OpLabel
OpBranch %720
%751 = OpLabel
%753 = OpLoad %33 %716
OpStore %714 %753
OpBranch %719
%720 = OpLabel
%755 = OpLoad %33 %716
%756 = OpIAdd %33 %755 %249
OpStore %716 %756
OpBranch %717
%719 = OpLabel
%757 = OpLoad %33 %714
%758 = OpULessThan %100 %757 %328
OpSelectionMerge %760 None
OpBranchConditional %758 %759 %1318
%759 = OpLabel
OpStore %52 %761
OpStore %53 %761
%765 = OpLoad %33 %714
OpStore %764 %765
%767 = OpLoad %13 %726
OpStore %766 %767
%769 = OpLoad %13 %705
OpStore %768 %769
%771 = OpLoad %13 %707
OpStore %770 %771
%773 = OpLoad %13 %50
OpStore %772 %773
%775 = OpLoad %6 %51
OpStore %774 %775
%778 = OpFunctionCall %2 %45 %764 %766 %768 %770 %772 %774 %776 %777
%779 = OpLoad %13 %776
OpStore %762 %779
%780 = OpLoad %13 %777
OpStore %763 %780
%782 = OpAccessChain %360 %332 %297
%783 = OpLoad %26 %782
%784 = OpISub %26 %783 %249
%785 = OpConvertSToF %6 %784
%786 = OpFDiv %6 %785 %228
%788 = OpFSub %6 %786 %787
OpStore %781 %788
%790 = OpLoad %6 %781
%791 = OpFAdd %6 %790 %228
OpStore %789 %791
%793 = OpLoad %13 %705
%794 = OpLoad %33 %714
%795 = OpAccessChain %334 %332 %470 %794 %249
%796 = OpLoad %6 %795
%797 = OpVectorTimesScalar %13 %793 %796
OpStore %792 %797
%799 = OpLoad %13 %792
%800 = OpExtInst %6 %1 Length %799
OpStore %798 %800
%801 = OpLoad %13 %792
%802 = OpExtInst %13 %1 Normalize %801
%803 = OpExtInst %13 %1 FAbs %802
OpStore %792 %803
%804 = OpAccessChain %35 %792 %96
%805 = OpLoad %6 %804
%806 = OpAccessChain %35 %792 %106
%807 = OpLoad %6 %806
%808 = OpAccessChain %35 %792 %128
%809 = OpLoad %6 %808
%810 = OpExtInst %6 %1 FMax %807 %809
%811 = OpExtInst %6 %1 FMax %805 %810
%812 = OpLoad %6 %798
%813 = OpFMul %6 %812 %811
OpStore %798 %813
%814 = OpLoad %6 %798
%815 = OpLoad %6 %781
%816 = OpFOrdGreaterThanEqual %100 %814 %815
OpSelectionMerge %818 None
OpBranchConditional %816 %817 %824
%817 = OpLabel
%820 = OpLoad %6 %781
%821 = OpLoad %6 %789
%822 = OpLoad %6 %798
%823 = OpExtInst %6 %1 SmoothStep %820 %821 %822
OpStore %819 %823
OpBranch %818
%824 = OpLabel
OpStore %819 %99
OpBranch %818
%818 = OpLabel
%825 = OpLoad %6 %819
%826 = OpFOrdGreaterThan %100 %825 %99
OpSelectionMerge %828 None
OpBranchConditional %826 %827 %828
%827 = OpLabel
%829 = OpLoad %33 %714
%830 = OpAccessChain %463 %332 %249
%831 = OpLoad %33 %830
%832 = OpISub %33 %831 %106
%833 = OpIEqual %100 %829 %832
OpSelectionMerge %835 None
OpBranchConditional %833 %834 %842
%834 = OpLabel
%836 = OpLoad %6 %819
%837 = OpFSub %6 %102 %836
%838 = OpAccessChain %35 %52 %165
OpStore %838 %837
%839 = OpLoad %6 %819
%840 = OpFSub %6 %102 %839
%841 = OpAccessChain %35 %53 %165
OpStore %841 %840
OpBranch %835
%842 = OpLabel
%843 = OpLoad %13 %705
%844 = OpLoad %33 %714
%845 = OpIAdd %33 %844 %106
%846 = OpAccessChain %390 %332 %470 %845 %221
%847 = OpLoad %13 %846
%848 = OpFSub %13 %843 %847
%849 = OpLoad %33 %714
%850 = OpIAdd %33 %849 %106
%851 = OpAccessChain %334 %332 %470 %850 %249
%852 = OpLoad %6 %851
%853 = OpVectorTimesScalar %13 %848 %852
OpStore %726 %853
%854 = OpLoad %33 %714
%855 = OpIAdd %33 %854 %106
OpStore %858 %855
%860 = OpLoad %13 %726
OpStore %859 %860
%862 = OpLoad %13 %705
OpStore %861 %862
%864 = OpLoad %13 %707
OpStore %863 %864
%866 = OpLoad %13 %50
OpStore %865 %866
%868 = OpLoad %6 %51
OpStore %867 %868
%871 = OpFunctionCall %2 %45 %858 %859 %861 %863 %865 %867 %869 %870
%872 = OpLoad %13 %869
OpStore %856 %872
%873 = OpLoad %13 %870
OpStore %857 %873
%874 = OpLoad %13 %762
%875 = OpLoad %13 %856
%876 = OpLoad %6 %819
%877 = OpCompositeConstruct %13 %876 %876 %876
%878 = OpExtInst %13 %1 FMix %874 %875 %877
OpStore %762 %878
%879 = OpLoad %13 %763
%880 = OpLoad %13 %857
%881 = OpLoad %6 %819
%882 = OpCompositeConstruct %13 %881 %881 %881
%883 = OpExtInst %13 %1 FMix %879 %880 %882
OpStore %763 %883
OpBranch %835
%835 = OpLabel
OpBranch %828
%828 = OpLabel
%884 = OpLoad %13 %762
%885 = OpLoad %19 %52
%886 = OpVectorShuffle %19 %885 %884 4 5 6 3
OpStore %52 %886
%887 = OpLoad %6 %51
%888 = OpFOrdLessThan %100 %887 %632
OpSelectionMerge %890 None
OpBranchConditional %888 %889 %890
%889 = OpLabel
%892 = OpAccessChain %390 %332 %221
%893 = OpLoad %13 %892
%894 = OpCompositeConstruct %13 %102 %102 %102
%895 = OpFDiv %13 %894 %893
OpStore %891 %895
OpStore %896 %348
%898 = OpAccessChain %334 %332 %221 %96
%899 = OpLoad %6 %898
%900 = OpAccessChain %360 %332 %297
%901 = OpLoad %26 %900
%902 = OpISub %26 %901 %249
%903 = OpConvertSToF %6 %902
%904 = OpFDiv %6 %899 %903
%905 = OpFMul %6 %904 %154
OpStore %897 %905
OpStore %714 %906
%908 = OpLoad %13 %705
%909 = OpExtInst %6 %1 Length %908
OpStore %907 %909
OpStore %910 %96
OpBranch %911
%911 = OpLabel
OpLoopMerge %913 %914 None
OpBranch %915
%915 = OpLabel
%916 = OpLoad %33 %910
%917 = OpAccessChain %463 %332 %249
%918 = OpLoad %33 %917
%919 = OpULessThan %100 %916 %918
OpBranchConditional %919 %912 %913
%912 = OpLabel
%923 = OpLoad %33 %910
%924 = OpLoad %33 %910
%925 = OpAccessChain %334 %332 %470 %924 %297
%926 = OpLoad %6 %925
%927 = OpFDiv %6 %102 %926
%928 = OpAccessChain %334 %332 %221 %96
%929 = OpLoad %6 %928
%930 = OpFMul %6 %929 %154
%931 = OpLoad %6 %897
%932 = OpFSub %6 %930 %931
%933 = OpFMul %6 %927 %932
%934 = OpAccessChain %35 %922 %923
OpStore %934 %933
%935 = OpLoad %33 %714
%936 = OpIEqual %100 %935 %906
OpSelectionMerge %938 None
OpBranchConditional %936 %937 %938
%937 = OpLabel
%939 = OpLoad %6 %907
%940 = OpLoad %33 %910
%941 = OpAccessChain %35 %922 %940
%942 = OpLoad %6 %941
%943 = OpFOrdLessThan %100 %939 %942
OpBranch %938
%938 = OpLabel
%944 = OpPhi %100 %936 %912 %943 %937
OpSelectionMerge %946 None
OpBranchConditional %944 %945 %946
%945 = OpLabel
%947 = OpLoad %33 %910
OpStore %714 %947
OpBranch %946
%946 = OpLabel
OpBranch %914
%914 = OpLabel
%948 = OpLoad %33 %910
%949 = OpIAdd %33 %948 %249
OpStore %910 %949
OpBranch %911
%913 = OpLabel
%950 = OpLoad %33 %714
%951 = OpAccessChain %463 %332 %249
%952 = OpLoad %33 %951
%953 = OpISub %33 %952 %106
%954 = OpExtInst %33 %1 UMin %950 %953
OpStore %714 %954
%956 = OpAccessChain %463 %332 %249
%957 = OpLoad %33 %956
%958 = OpISub %33 %957 %106
%959 = OpAccessChain %35 %922 %958
%960 = OpLoad %6 %959
OpStore %955 %960
%962 = OpLoad %13 %705
OpStore %961 %962
%964 = OpLoad %13 %50
OpStore %963 %964
%966 = OpLoad %33 %714
%967 = OpUGreaterThan %100 %966 %96
OpSelectionMerge %970 None
OpBranchConditional %967 %969 %975
%969 = OpLabel
%971 = OpLoad %33 %714
%972 = OpISub %33 %971 %106
%973 = OpAccessChain %35 %922 %972
%974 = OpLoad %6 %973
OpStore %968 %974
OpBranch %970
%975 = OpLabel
OpStore %968 %99
OpBranch %970
%970 = OpLabel
%976 = OpLoad %6 %968
OpStore %965 %976
%978 = OpLoad %6 %907
%979 = OpLoad %6 %965
%980 = OpFSub %6 %978 %979
%981 = OpLoad %33 %714
%982 = OpAccessChain %35 %922 %981
%983 = OpLoad %6 %982
%984 = OpLoad %6 %965
%985 = OpFSub %6 %983 %984
%986 = OpFDiv %6 %980 %985
OpStore %977 %986
%988 = OpLoad %6 %977
%989 = OpFAdd %6 %102 %988
%991 = OpFMul %6 %989 %990
OpStore %987 %991
%993 = OpLoad %13 %963
%994 = OpExtInst %13 %1 FAbs %993
OpStore %992 %994
%995 = OpLoad %13 %963
%996 = OpVectorTimesScalar %13 %995 %102
%997 = OpAccessChain %35 %992 %96
%998 = OpLoad %6 %997
%999 = OpAccessChain %35 %992 %106
%1000 = OpLoad %6 %999
%1001 = OpAccessChain %35 %992 %128
%1002 = OpLoad %6 %1001
%1003 = OpExtInst %6 %1 FMax %1000 %1002
%1004 = OpExtInst %6 %1 FMax %998 %1003
%1005 = OpCompositeConstruct %13 %1004 %1004 %1004
%1006 = OpFDiv %13 %996 %1005
%1007 = OpLoad %13 %707
%1009 = OpVectorTimesScalar %13 %1007 %1008
%1010 = OpFAdd %13 %1006 %1009
%1011 = OpLoad %6 %987
%1012 = OpVectorTimesScalar %13 %1010 %1011
%1013 = OpLoad %33 %714
%1014 = OpAccessChain %334 %332 %470 %1013 %297
%1015 = OpLoad %6 %1014
%1016 = OpCompositeConstruct %13 %1015 %1015 %1015
%1017 = OpFDiv %13 %1012 %1016
%1018 = OpLoad %13 %961
%1019 = OpFAdd %13 %1018 %1017
OpStore %961 %1019
%1021 = OpLoad %6 %51
%1023 = OpFMul %6 %1021 %1022
%1024 = OpExtInst %6 %1 FMin %102 %1023
%1026 = OpFMul %6 %1024 %1025
%1027 = OpFAdd %6 %632 %1026
OpStore %1020 %1027
OpBranch %1028
%1028 = OpLabel
OpLoopMerge %1030 %1031 None
OpBranch %1032
%1032 = OpLabel
%1033 = OpLoad %13 %961
%1034 = OpExtInst %6 %1 Length %1033
%1035 = OpLoad %6 %955
%1036 = OpFOrdLessThan %100 %1034 %1035
OpBranchConditional %1036 %1029 %1030
%1029 = OpLabel
OpStore %1037 %96
OpBranch %1038
%1038 = OpLabel
OpLoopMerge %1040 %1041 None
OpBranch %1042
%1042 = OpLabel
%1043 = OpLoad %33 %1037
%1044 = OpAccessChain %463 %332 %249
%1045 = OpLoad %33 %1044
%1046 = OpULessThan %100 %1043 %1045
OpBranchConditional %1046 %1039 %1040
%1039 = OpLabel
%1047 = OpLoad %33 %1037
%1048 = OpLoad %33 %714
%1049 = OpUGreaterThanEqual %100 %1047 %1048
OpSelectionMerge %1051 None
OpBranchConditional %1049 %1050 %1051
%1050 = OpLabel
%1052 = OpLoad %13 %961
%1053 = OpExtInst %6 %1 Length %1052
%1054 = OpLoad %33 %1037
%1055 = OpAccessChain %35 %922 %1054
%1056 = OpLoad %6 %1055
%1057 = OpFOrdLessThan %100 %1053 %1056
OpBranch %1051
%1051 = OpLabel
%1058 = OpPhi %100 %1049 %1039 %1057 %1050
OpSelectionMerge %1060 None
OpBranchConditional %1058 %1059 %1060
%1059 = OpLabel
%1061 = OpLoad %33 %1037
%1062 = OpLoad %33 %714
%1063 = OpExtInst %33 %1 UMax %1061 %1062
OpStore %714 %1063
%1065 = OpLoad %13 %961
%1066 = OpLoad %33 %1037
%1067 = OpAccessChain %390 %332 %470 %1066 %221
%1068 = OpLoad %13 %1067
%1069 = OpFSub %13 %1065 %1068
OpStore %1064 %1069
%1070 = OpLoad %33 %1037
%1071 = OpAccessChain %334 %332 %470 %1070 %297
%1072 = OpLoad %6 %1071
%1073 = OpLoad %13 %891
%1074 = OpVectorTimesScalar %13 %1073 %1072
%1075 = OpLoad %13 %1064
%1076 = OpFMul %13 %1075 %1074
OpStore %1064 %1076
%1081 = OpLoad %33 %1037
%1082 = OpAccessChain %57 %1080 %1081
%1083 = OpLoad %56 %1082
%1084 = OpLoad %214 %216
%1085 = OpSampledImage %534 %1083 %1084
%1086 = OpLoad %13 %1064
%1087 = OpImageSampleExplicitLod %19 %1085 %1086 Lod %99
%1088 = OpCompositeExtract %6 %1087 0
%1090 = OpFMul %6 %1088 %1089
%1091 = OpFSub %6 %1090 %990
OpStore %1077 %1091
OpStore %1092 %348
%1093 = OpLoad %6 %1077
%1094 = OpLoad %6 %1020
%1095 = OpFOrdLessThan %100 %1093 %1094
OpSelectionMerge %1097 None
OpBranchConditional %1095 %1096 %1097
%1096 = OpLabel
%1099 = OpLoad %33 %1037
%1100 = OpAccessChain %57 %1098 %1099
%1101 = OpLoad %56 %1100
%1102 = OpLoad %214 %216
%1103 = OpSampledImage %534 %1101 %1102
%1104 = OpLoad %13 %1064
%1105 = OpImageSampleExplicitLod %19 %1103 %1104 Lod %99
%1106 = OpVectorShuffle %13 %1105 %1105 0 1 2
%1107 = OpLoad %19 %1092
%1108 = OpVectorShuffle %19 %1107 %1106 4 5 6 3
OpStore %1092 %1108
%1109 = OpLoad %19 %1092
%1110 = OpVectorShuffle %13 %1109 %1109 0 1 2
%1111 = OpVectorTimesScalar %13 %1110 %154
%1112 = OpLoad %19 %1092
%1113 = OpVectorShuffle %19 %1112 %1111 4 5 6 3
OpStore %1092 %1113
%1114 = OpLoad %6 %1077
%1115 = OpLoad %6 %1020
%1116 = OpFDiv %6 %1114 %1115
%1117 = OpFSub %6 %102 %1116
%1118 = OpExtInst %6 %1 FClamp %1117 %99 %102
%1119 = OpAccessChain %35 %1092 %165
OpStore %1119 %1118
%1120 = OpAccessChain %35 %1092 %165
%1121 = OpLoad %6 %1120
%1122 = OpLoad %19 %1092
%1123 = OpVectorShuffle %13 %1122 %1122 0 1 2
%1124 = OpVectorTimesScalar %13 %1123 %1121
%1125 = OpLoad %19 %1092
%1126 = OpVectorShuffle %19 %1125 %1124 4 5 6 3
OpStore %1092 %1126
OpBranch %1097
%1097 = OpLabel
%1127 = OpLoad %33 %1037
%1128 = OpAccessChain %334 %332 %470 %1127 %297
%1129 = OpLoad %6 %1128
%1130 = OpLoad %6 %1077
%1131 = OpFDiv %6 %1130 %1129
OpStore %1077 %1131
%1132 = OpLoad %33 %1037
%1133 = OpAccessChain %463 %332 %249
%1134 = OpLoad %33 %1133
%1135 = OpISub %33 %1134 %106
%1136 = OpULessThan %100 %1132 %1135
OpSelectionMerge %1138 None
OpBranchConditional %1136 %1137 %1138
%1137 = OpLabel
%1139 = OpLoad %13 %961
%1140 = OpLoad %33 %1037
%1141 = OpIAdd %33 %1140 %106
%1142 = OpAccessChain %390 %332 %470 %1141 %221
%1143 = OpLoad %13 %1142
%1144 = OpFSub %13 %1139 %1143
OpStore %1064 %1144
%1145 = OpLoad %33 %1037
%1146 = OpIAdd %33 %1145 %106
%1147 = OpAccessChain %334 %332 %470 %1146 %297
%1148 = OpLoad %6 %1147
%1149 = OpLoad %13 %891
%1150 = OpVectorTimesScalar %13 %1149 %1148
%1151 = OpLoad %13 %1064
%1152 = OpFMul %13 %1151 %1150
OpStore %1064 %1152
%1154 = OpLoad %33 %1037
%1155 = OpIAdd %33 %1154 %106
%1156 = OpAccessChain %57 %1080 %1155
%1157 = OpLoad %56 %1156
%1158 = OpLoad %214 %216
%1159 = OpSampledImage %534 %1157 %1158
%1160 = OpLoad %13 %1064
%1161 = OpImageSampleExplicitLod %19 %1159 %1160 Lod %99
%1162 = OpCompositeExtract %6 %1161 0
%1163 = OpFMul %6 %1162 %1089
%1164 = OpFSub %6 %1163 %990
OpStore %1153 %1164
OpStore %1165 %348
%1166 = OpLoad %6 %1153
%1167 = OpLoad %6 %1020
%1168 = OpFOrdLessThan %100 %1166 %1167
OpSelectionMerge %1170 None
OpBranchConditional %1168 %1169 %1170
%1169 = OpLabel
%1171 = OpLoad %33 %1037
%1172 = OpIAdd %33 %1171 %106
%1173 = OpAccessChain %57 %1098 %1172
%1174 = OpLoad %56 %1173
%1175 = OpLoad %214 %216
%1176 = OpSampledImage %534 %1174 %1175
%1177 = OpLoad %13 %1064
%1178 = OpImageSampleExplicitLod %19 %1176 %1177 Lod %99
%1179 = OpVectorShuffle %13 %1178 %1178 0 1 2
%1180 = OpLoad %19 %1165
%1181 = OpVectorShuffle %19 %1180 %1179 4 5 6 3
OpStore %1165 %1181
%1182 = OpLoad %19 %1165
%1183 = OpVectorShuffle %13 %1182 %1182 0 1 2
%1184 = OpVectorTimesScalar %13 %1183 %154
%1185 = OpLoad %19 %1165
%1186 = OpVectorShuffle %19 %1185 %1184 4 5 6 3
OpStore %1165 %1186
%1187 = OpLoad %6 %1153
%1188 = OpLoad %6 %1020
%1189 = OpFDiv %6 %1187 %1188
%1190 = OpFSub %6 %102 %1189
%1191 = OpExtInst %6 %1 FClamp %1190 %99 %102
%1192 = OpAccessChain %35 %1165 %165
OpStore %1192 %1191
%1193 = OpAccessChain %35 %1165 %165
%1194 = OpLoad %6 %1193
%1195 = OpLoad %19 %1165
%1196 = OpVectorShuffle %13 %1195 %1195 0 1 2
%1197 = OpVectorTimesScalar %13 %1196 %1194
%1198 = OpLoad %19 %1165
%1199 = OpVectorShuffle %19 %1198 %1197 4 5 6 3
OpStore %1165 %1199
OpBranch %1170
%1170 = OpLabel
%1201 = OpLoad %33 %1037
%1202 = OpIEqual %100 %1201 %96
OpSelectionMerge %1205 None
OpBranchConditional %1202 %1204 %1206
%1204 = OpLabel
OpStore %1203 %99
OpBranch %1205
%1206 = OpLabel
%1207 = OpLoad %33 %1037
%1208 = OpISub %33 %1207 %106
%1209 = OpAccessChain %35 %922 %1208
%1210 = OpLoad %6 %1209
OpStore %1203 %1210
OpBranch %1205
%1205 = OpLabel
%1211 = OpLoad %6 %1203
OpStore %1200 %1211
%1213 = OpLoad %13 %961
%1214 = OpExtInst %6 %1 Length %1213
%1215 = OpLoad %6 %1200
%1216 = OpFSub %6 %1214 %1215
%1217 = OpLoad %33 %1037
%1218 = OpAccessChain %35 %922 %1217
%1219 = OpLoad %6 %1218
%1220 = OpLoad %6 %1200
%1221 = OpFSub %6 %1219 %1220
%1222 = OpFDiv %6 %1216 %1221
%1223 = OpExtInst %6 %1 FClamp %1222 %99 %102
OpStore %1212 %1223
%1224 = OpLoad %33 %1037
%1225 = OpIAdd %33 %1224 %106
%1226 = OpAccessChain %334 %332 %470 %1225 %297
%1227 = OpLoad %6 %1226
%1228 = OpLoad %6 %1153
%1229 = OpFDiv %6 %1228 %1227
OpStore %1153 %1229
%1230 = OpLoad %19 %1092
%1231 = OpLoad %19 %1165
%1232 = OpLoad %6 %1212
%1233 = OpCompositeConstruct %19 %1232 %1232 %1232 %1232
%1234 = OpExtInst %19 %1 FMix %1230 %1231 %1233
OpStore %1092 %1234
%1235 = OpLoad %6 %1077
%1236 = OpLoad %6 %1153
%1237 = OpLoad %6 %1212
%1238 = OpExtInst %6 %1 FMix %1235 %1236 %1237
OpStore %1077 %1238
OpBranch %1138
%1138 = OpLabel
%1239 = OpLoad %19 %1092
%1240 = OpLoad %19 %896
%1241 = OpFAdd %19 %1240 %1239
OpStore %896 %1241
%1242 = OpLoad %13 %963
%1243 = OpLoad %6 %1077
%1244 = OpVectorTimesScalar %13 %1242 %1243
%1245 = OpLoad %13 %961
%1246 = OpFAdd %13 %1245 %1244
OpStore %961 %1246
OpBranch %1040
%1060 = OpLabel
OpBranch %1041
%1041 = OpLabel
%1248 = OpLoad %33 %1037
%1249 = OpIAdd %33 %1248 %249
OpStore %1037 %1249
OpBranch %1038
%1040 = OpLabel
%1250 = OpAccessChain %35 %896 %165
%1251 = OpLoad %6 %1250
%1252 = OpFOrdGreaterThan %100 %1251 %616
OpSelectionMerge %1254 None
OpBranchConditional %1252 %1253 %1254
%1253 = OpLabel
OpBranch %1030
%1254 = OpLabel
OpBranch %1031
%1031 = OpLabel
OpBranch %1028
%1030 = OpLabel
%1257 = OpLoad %19 %896
%1258 = OpVectorShuffle %13 %1257 %1257 0 1 2
%1259 = OpAccessChain %35 %896 %165
%1260 = OpLoad %6 %1259
%1262 = OpExtInst %6 %1 FMax %1260 %1261
%1263 = OpCompositeConstruct %13 %1262 %1262 %1262
%1264 = OpFDiv %13 %1258 %1263
OpStore %1256 %1264
%1266 = OpAccessChain %35 %896 %165
%1267 = OpLoad %6 %1266
%1268 = OpExtInst %6 %1 FMin %102 %1267
OpStore %1265 %1268
%1270 = OpLoad %6 %51
%1271 = OpFMul %6 %1270 %1022
%1272 = OpExtInst %6 %1 FMin %102 %1271
OpStore %1269 %1272
%1274 = OpLoad %6 %1269
%1275 = OpFSub %6 %102 %1274
OpStore %1273 %1275
%1276 = OpLoad %6 %1265
%1277 = OpLoad %6 %1273
%1278 = OpFMul %6 %1276 %1277
%1279 = OpLoad %6 %1269
%1280 = OpFAdd %6 %1278 %1279
%1281 = OpAccessChain %35 %53 %165
OpStore %1281 %1280
%1282 = OpAccessChain %35 %53 %165
%1283 = OpLoad %6 %1282
%1284 = OpFOrdEqual %100 %1283 %99
OpSelectionMerge %1286 None
OpBranchConditional %1284 %1285 %1287
%1285 = OpLabel
OpStore %763 %183
OpBranch %1286
%1287 = OpLabel
%1288 = OpLoad %13 %1256
%1289 = OpLoad %6 %1265
%1290 = OpVectorTimesScalar %13 %1288 %1289
%1291 = OpLoad %6 %1273
%1292 = OpVectorTimesScalar %13 %1290 %1291
%1293 = OpLoad %13 %763
%1294 = OpLoad %6 %1269
%1295 = OpVectorTimesScalar %13 %1293 %1294
%1296 = OpFAdd %13 %1292 %1295
%1297 = OpAccessChain %35 %53 %165
%1298 = OpLoad %6 %1297
%1299 = OpCompositeConstruct %13 %1298 %1298 %1298
%1300 = OpFDiv %13 %1296 %1299
OpStore %763 %1300
OpBranch %1286
%1286 = OpLabel
OpBranch %890
%890 = OpLabel
%1301 = OpLoad %13 %763
%1302 = OpLoad %19 %53
%1303 = OpVectorShuffle %19 %1302 %1301 4 5 6 3
OpStore %53 %1303
%1304 = OpAccessChain %334 %332 %236
%1305 = OpLoad %6 %1304
%1306 = OpLoad %19 %52
%1307 = OpVectorShuffle %13 %1306 %1306 0 1 2
%1308 = OpVectorTimesScalar %13 %1307 %1305
%1309 = OpLoad %19 %52
%1310 = OpVectorShuffle %19 %1309 %1308 4 5 6 3
OpStore %52 %1310
%1311 = OpAccessChain %334 %332 %236
%1312 = OpLoad %6 %1311
%1313 = OpLoad %19 %53
%1314 = OpVectorShuffle %13 %1313 %1313 0 1 2
%1315 = OpVectorTimesScalar %13 %1314 %1312
%1316 = OpLoad %19 %53
%1317 = OpVectorShuffle %19 %1316 %1315 4 5 6 3
OpStore %53 %1317
OpBranch %760
%1318 = OpLabel
OpStore %52 %348
OpStore %53 %348
OpBranch %760
%760 = OpLabel
OpReturn
OpFunctionEnd
%66 = OpFunction %19 None %58
%59 = OpFunctionParameter %57
%60 = OpFunctionParameter %14
%61 = OpFunctionParameter %14
%62 = OpFunctionParameter %14
%63 = OpFunctionParameter %35
%64 = OpFunctionParameter %35
%65 = OpFunctionParameter %35
%67 = OpLabel
%1319 = OpVariable %35 Function
%1321 = OpVariable %20 Function
%1337 = OpVariable %35 Function
%1343 = OpVariable %14 Function
%1351 = OpVariable %35 Function
%1372 = OpVariable %20 Function
%1381 = OpVariable %35 Function
%1320 = OpLoad %6 %65
OpStore %1319 %1320
OpStore %1321 %348
OpBranch %1322
%1322 = OpLabel
OpLoopMerge %1324 %1325 None
OpBranch %1326
%1326 = OpLabel
%1327 = OpLoad %6 %1319
%1328 = OpLoad %6 %64
%1329 = OpFOrdLessThan %100 %1327 %1328
OpSelectionMerge %1331 None
OpBranchConditional %1329 %1330 %1331
%1330 = OpLabel
%1332 = OpAccessChain %35 %1321 %165
%1333 = OpLoad %6 %1332
%1335 = OpFOrdLessThan %100 %1333 %1334
OpBranch %1331
%1331 = OpLabel
%1336 = OpPhi %100 %1329 %1326 %1335 %1330
OpBranchConditional %1336 %1323 %1324
%1323 = OpLabel
%1338 = OpLoad %6 %63
%1339 = OpFMul %6 %228 %1338
%1340 = OpLoad %6 %1319
%1341 = OpFMul %6 %1339 %1340
%1342 = OpExtInst %6 %1 FMax %102 %1341
OpStore %1337 %1342
%1344 = OpLoad %13 %61
%1345 = OpLoad %6 %1319
%1346 = OpLoad %13 %62
%1347 = OpVectorTimesScalar %13 %1346 %1345
%1348 = OpFAdd %13 %1344 %1347
%1349 = OpLoad %13 %60
%1350 = OpFMul %13 %1348 %1349
OpStore %1343 %1350
%1352 = OpLoad %6 %1337
%1353 = OpFMul %6 %1352 %154
OpStore %1351 %1353
%1354 = OpLoad %13 %1343
%1355 = OpCompositeConstruct %13 %154 %154 %154
%1356 = OpFSub %13 %1354 %1355
%1357 = OpExtInst %13 %1 FAbs %1356
%1358 = OpLoad %6 %1351
%1359 = OpLoad %13 %60
%1360 = OpVectorTimesScalar %13 %1359 %1358
%1361 = OpCompositeConstruct %13 %154 %154 %154
%1362 = OpFAdd %13 %1361 %1360
%1363 = OpCompositeExtract %6 %1362 0
%1364 = OpCompositeExtract %6 %1362 1
%1365 = OpCompositeExtract %6 %1362 2
%1366 = OpCompositeConstruct %13 %1363 %1364 %1365
%1367 = OpFOrdGreaterThan %737 %1357 %1366
%1368 = OpAny %100 %1367
OpSelectionMerge %1370 None
OpBranchConditional %1368 %1369 %1370
%1369 = OpLabel
OpBranch %1324
%1370 = OpLabel
%1373 = OpLoad %56 %59
%1375 = OpLoad %214 %1374
%1376 = OpSampledImage %534 %1373 %1375
%1377 = OpLoad %13 %1343
%1378 = OpLoad %6 %1337
%1379 = OpExtInst %6 %1 Log2 %1378
%1380 = OpImageSampleExplicitLod %19 %1376 %1377 Lod %1379
OpStore %1372 %1380
%1382 = OpAccessChain %35 %1321 %165
%1383 = OpLoad %6 %1382
%1384 = OpFSub %6 %102 %1383
OpStore %1381 %1384
%1385 = OpLoad %6 %1381
%1386 = OpLoad %19 %1372
%1387 = OpVectorTimesScalar %19 %1386 %1385
%1388 = OpLoad %19 %1321
%1389 = OpFAdd %19 %1388 %1387
OpStore %1321 %1389
%1390 = OpLoad %6 %1351
%1391 = OpLoad %6 %1319
%1392 = OpFAdd %6 %1391 %1390
OpStore %1319 %1392
OpBranch %1325
%1325 = OpLabel
OpBranch %1322
%1324 = OpLabel
%1393 = OpLoad %19 %1321
OpReturnValue %1393
OpFunctionEnd
%75 = OpFunction %19 None %68
%69 = OpFunctionParameter %57
%70 = OpFunctionParameter %14
%71 = OpFunctionParameter %14
%72 = OpFunctionParameter %14
%73 = OpFunctionParameter %35
%74 = OpFunctionParameter %35
%76 = OpLabel
%1396 = OpVariable %35 Function
%1398 = OpVariable %20 Function
%1399 = OpVariable %35 Function
%1402 = OpVariable %35 Function
%1420 = OpVariable %14 Function
%1446 = OpVariable %20 Function
%1455 = OpVariable %35 Function
%1397 = OpLoad %6 %74
OpStore %1396 %1397
OpStore %1398 %348
%1400 = OpLoad %6 %1396
%1401 = OpExtInst %6 %1 FMax %154 %1400
OpStore %1399 %1401
%1403 = OpLoad %6 %1399
%1404 = OpFMul %6 %1403 %228
%1405 = OpExtInst %6 %1 Log2 %1404
OpStore %1402 %1405
OpBranch %1406
%1406 = OpLabel
OpLoopMerge %1408 %1409 None
OpBranch %1410
%1410 = OpLabel
%1411 = OpLoad %6 %1396
%1412 = OpLoad %6 %73
%1413 = OpFOrdLessThan %100 %1411 %1412
OpSelectionMerge %1415 None
OpBranchConditional %1413 %1414 %1415
%1414 = OpLabel
%1416 = OpAccessChain %35 %1398 %165
%1417 = OpLoad %6 %1416
%1418 = OpFOrdLessThan %100 %1417 %1334
OpBranch %1415
%1415 = OpLabel
%1419 = OpPhi %100 %1413 %1410 %1418 %1414
OpBranchConditional %1419 %1407 %1408
%1407 = OpLabel
%1421 = OpLoad %13 %71
%1422 = OpLoad %6 %1396
%1423 = OpLoad %13 %72
%1424 = OpVectorTimesScalar %13 %1423 %1422
%1425 = OpFAdd %13 %1421 %1424
%1426 = OpLoad %13 %70
%1427 = OpFMul %13 %1425 %1426
OpStore %1420 %1427
%1428 = OpLoad %13 %1420
%1429 = OpCompositeConstruct %13 %154 %154 %154
%1430 = OpFSub %13 %1428 %1429
%1431 = OpExtInst %13 %1 FAbs %1430
%1432 = OpLoad %6 %1399
%1433 = OpLoad %13 %70
%1434 = OpVectorTimesScalar %13 %1433 %1432
%1435 = OpCompositeConstruct %13 %154 %154 %154
%1436 = OpFAdd %13 %1435 %1434
%1437 = OpCompositeExtract %6 %1436 0
%1438 = OpCompositeExtract %6 %1436 1
%1439 = OpCompositeExtract %6 %1436 2
%1440 = OpCompositeConstruct %13 %1437 %1438 %1439
%1441 = OpFOrdGreaterThan %737 %1431 %1440
%1442 = OpAny %100 %1441
OpSelectionMerge %1444 None
OpBranchConditional %1442 %1443 %1444
%1443 = OpLabel
OpBranch %1408
%1444 = OpLabel
%1447 = OpLoad %56 %69
%1448 = OpLoad %214 %1374
%1449 = OpSampledImage %534 %1447 %1448
%1450 = OpLoad %13 %1420
%1451 = OpLoad %6 %1402
%1452 = OpImageSampleExplicitLod %19 %1449 %1450 Lod %1451
OpStore %1446 %1452
%1453 = OpLoad %6 %1402
%1454 = OpFAdd %6 %1453 %102
OpStore %1402 %1454
%1456 = OpAccessChain %35 %1398 %165
%1457 = OpLoad %6 %1456
%1458 = OpFSub %6 %102 %1457
OpStore %1455 %1458
%1459 = OpLoad %6 %1455
%1460 = OpLoad %19 %1446
%1461 = OpVectorTimesScalar %19 %1460 %1459
OpStore %1446 %1461
%1462 = OpLoad %19 %1446
%1463 = OpLoad %19 %1398
%1464 = OpFAdd %19 %1463 %1462
OpStore %1398 %1464
%1465 = OpLoad %6 %1399
%1466 = OpLoad %6 %1396
%1467 = OpFAdd %6 %1466 %1465
OpStore %1396 %1467
%1468 = OpLoad %6 %1396
%1469 = OpExtInst %6 %1 FMax %154 %1468
OpStore %1399 %1469
OpBranch %1409
%1409 = OpLabel
OpBranch %1406
%1408 = OpLabel
%1470 = OpLoad %19 %1398
OpReturnValue %1470
OpFunctionEnd
%89 = OpFunction %2 None %79
%80 = OpFunctionParameter %34
%81 = OpFunctionParameter %14
%82 = OpFunctionParameter %14
%83 = OpFunctionParameter %14
%84 = OpFunctionParameter %78
%85 = OpFunctionParameter %35
%86 = OpFunctionParameter %20
%87 = OpFunctionParameter %20
%88 = OpFunctionParameter %35
%90 = OpLabel
%1534 = OpVariable %78 Function
%1547 = OpVariable %14 Function
%1557 = OpVariable %35 Function
%1568 = OpVariable %35 Function
%1573 = OpVariable %14 Function
%1579 = OpVariable %20 Function
%1588 = OpVariable %1587 Function
%1605 = OpVariable %1604 Function
%1609 = OpVariable %35 Function
%1611 = OpVariable %34 Function
%1619 = OpVariable %14 Function
%1633 = OpVariable %14 Function
%1635 = OpVariable %14 Function
%1637 = OpVariable %14 Function
%1639 = OpVariable %35 Function
%1641 = OpVariable %35 Function
%1643 = OpVariable %35 Function
%1656 = OpVariable %1655 Function
%1666 = OpVariable %1665 Function
%1668 = OpVariable %357 Function
%1677 = OpVariable %14 Function
%1690 = OpVariable %14 Function
%1692 = OpVariable %14 Function
%1694 = OpVariable %14 Function
%1696 = OpVariable %35 Function
%1698 = OpVariable %35 Function
%1714 = OpVariable %35 Function
%1721 = OpVariable %35 Function
%1723 = OpVariable %35 Function
%1725 = OpVariable %35 Function
%1726 = OpVariable %35 Function
%1735 = OpVariable %14 Function
%1765 = OpVariable %14 Function
%1830 = OpVariable %20 Function
%1840 = OpVariable %14 Function
%1842 = OpVariable %14 Function
%1844 = OpVariable %14 Function
%1846 = OpVariable %35 Function
%1847 = OpVariable %35 Function
%1849 = OpVariable %35 Function
%1479 = OpLoad %33 %80
%1481 = OpAccessChain %1480 %1478 %221 %1479 %221
%1482 = OpLoad %1473 %1481
%1483 = OpLoad %13 %81
%1484 = OpCompositeExtract %6 %1483 0
%1485 = OpCompositeExtract %6 %1483 1
%1486 = OpCompositeExtract %6 %1483 2
%1487 = OpCompositeConstruct %19 %1484 %1485 %1486 %102
%1488 = OpMatrixTimesVector %19 %1482 %1487
%1489 = OpVectorShuffle %13 %1488 %1488 0 1 2
OpStore %81 %1489
%1490 = OpLoad %33 %80
%1491 = OpAccessChain %1480 %1478 %221 %1490 %221
%1492 = OpLoad %1473 %1491
%1493 = OpLoad %13 %83
%1494 = OpCompositeExtract %6 %1493 0
%1495 = OpCompositeExtract %6 %1493 1
%1496 = OpCompositeExtract %6 %1493 2
%1497 = OpCompositeConstruct %19 %1494 %1495 %1496 %99
%1498 = OpMatrixTimesVector %19 %1492 %1497
%1499 = OpVectorShuffle %13 %1498 %1498 0 1 2
%1500 = OpExtInst %13 %1 Normalize %1499
OpStore %83 %1500
%1501 = OpLoad %33 %80
%1502 = OpAccessChain %1480 %1478 %221 %1501 %221
%1503 = OpLoad %1473 %1502
%1504 = OpLoad %13 %82
%1505 = OpCompositeExtract %6 %1504 0
%1506 = OpCompositeExtract %6 %1504 1
%1507 = OpCompositeExtract %6 %1504 2
%1508 = OpCompositeConstruct %19 %1505 %1506 %1507 %99
%1509 = OpMatrixTimesVector %19 %1503 %1508
%1510 = OpVectorShuffle %13 %1509 %1509 0 1 2
%1511 = OpExtInst %13 %1 Normalize %1510
OpStore %82 %1511
%1512 = OpLoad %13 %82
%1513 = OpLoad %33 %80
%1514 = OpAccessChain %334 %1478 %221 %1513 %479
%1515 = OpLoad %6 %1514
%1516 = OpVectorTimesScalar %13 %1512 %1515
%1517 = OpLoad %13 %81
%1518 = OpFAdd %13 %1517 %1516
OpStore %81 %1518
%1519 = OpLoad %13 %81
%1520 = OpFOrdLessThan %737 %1519 %183
%1521 = OpAny %100 %1520
%1522 = OpLoad %13 %81
%1523 = OpLoad %33 %80
%1524 = OpAccessChain %390 %1478 %221 %1523 %249
%1525 = OpLoad %13 %1524
%1526 = OpFOrdGreaterThan %737 %1522 %1525
%1527 = OpAny %100 %1526
%1529 = OpCompositeConstruct %1528 %1521 %1527
%1530 = OpAny %100 %1529
OpSelectionMerge %1532 None
OpBranchConditional %1530 %1531 %1532
%1531 = OpLabel
OpReturn
%1532 = OpLabel
%1535 = OpLoad %33 %80
%1536 = OpAccessChain %1480 %1478 %221 %1535 %221
%1537 = OpLoad %1473 %1536
%1538 = OpCompositeExtract %19 %1537 0
%1539 = OpVectorShuffle %13 %1538 %1538 0 1 2
%1540 = OpCompositeExtract %19 %1537 1
%1541 = OpVectorShuffle %13 %1540 %1540 0 1 2
%1542 = OpCompositeExtract %19 %1537 2
%1543 = OpVectorShuffle %13 %1542 %1542 0 1 2
%1544 = OpCompositeConstruct %77 %1539 %1541 %1543
%1545 = OpLoad %77 %84
%1546 = OpMatrixTimesMatrix %77 %1544 %1545
OpStore %1534 %1546
%1548 = OpLoad %13 %81
%1549 = OpLoad %33 %80
%1550 = OpAccessChain %390 %1478 %221 %1549 %249
%1551 = OpLoad %13 %1550
%1552 = OpFDiv %13 %1548 %1551
%1553 = OpVectorTimesScalar %13 %1552 %228
%1554 = OpCompositeConstruct %13 %102 %102 %102
%1555 = OpFSub %13 %1553 %1554
%1556 = OpExtInst %13 %1 FAbs %1555
OpStore %1547 %1556
%1558 = OpAccessChain %35 %1547 %96
%1559 = OpLoad %6 %1558
%1560 = OpAccessChain %35 %1547 %106
%1561 = OpLoad %6 %1560
%1562 = OpAccessChain %35 %1547 %128
%1563 = OpLoad %6 %1562
%1564 = OpExtInst %6 %1 FMax %1561 %1563
%1565 = OpExtInst %6 %1 FMax %1559 %1564
%1566 = OpFSub %6 %102 %1565
%1567 = OpExtInst %6 %1 FClamp %1566 %99 %102
OpStore %1557 %1567
%1569 = OpLoad %33 %80
%1570 = OpAccessChain %390 %1478 %221 %1569 %249
%1571 = OpLoad %13 %1570
%1572 = OpExtInst %6 %1 Length %1571
OpStore %1568 %1572
%1574 = OpLoad %33 %80
%1575 = OpAccessChain %390 %1478 %221 %1574 %249
%1576 = OpLoad %13 %1575
%1577 = OpCompositeConstruct %13 %102 %102 %102
%1578 = OpFDiv %13 %1577 %1576
OpStore %1573 %1578
OpStore %1579 %348
%1580 = OpAccessChain %237 %235 %333
%1581 = OpLoad %33 %1580
%1582 = OpINotEqual %100 %1581 %96
OpSelectionMerge %1584 None
OpBranchConditional %1582 %1583 %1652
%1583 = OpLabel
OpStore %1588 %1602
OpStore %1605 %1608
OpStore %1609 %1610
OpStore %1611 %96
OpBranch %1612
%1612 = OpLabel
OpLoopMerge %1614 %1615 None
OpBranch %1616
%1616 = OpLabel
%1617 = OpLoad %33 %1611
%1618 = OpULessThan %100 %1617 %1585
OpBranchConditional %1618 %1613 %1614
%1613 = OpLabel
%1620 = OpLoad %77 %1534
%1621 = OpLoad %33 %1611
%1622 = OpAccessChain %14 %1588 %1621
%1623 = OpLoad %13 %1622
%1624 = OpMatrixTimesVector %13 %1620 %1623
%1625 = OpExtInst %13 %1 Normalize %1624
OpStore %1619 %1625
%1626 = OpLoad %33 %1611
%1627 = OpAccessChain %35 %1605 %1626
%1628 = OpLoad %6 %1627
%1630 = OpLoad %33 %80
%1631 = OpLoad %33 %80
%1632 = OpAccessChain %57 %1629 %1630
%1634 = OpLoad %13 %1573
OpStore %1633 %1634
%1636 = OpLoad %13 %81
OpStore %1635 %1636
%1638 = OpLoad %13 %1619
OpStore %1637 %1638
%1640 = OpLoad %6 %1609
OpStore %1639 %1640
%1642 = OpLoad %6 %1568
OpStore %1641 %1642
%1644 = OpAccessChain %334 %1478 %221 %1631 %297
%1645 = OpLoad %6 %1644
OpStore %1643 %1645
%1646 = OpFunctionCall %19 %66 %1632 %1633 %1635 %1637 %1639 %1641 %1643
%1647 = OpVectorTimesScalar %19 %1646 %1628
%1648 = OpLoad %19 %1579
%1649 = OpFAdd %19 %1648 %1647
OpStore %1579 %1649
OpBranch %1615
%1615 = OpLabel
%1650 = OpLoad %33 %1611
%1651 = OpIAdd %33 %1650 %249
OpStore %1611 %1651
OpBranch %1612
%1614 = OpLabel
OpBranch %1584
%1652 = OpLabel
OpStore %1656 %1663
OpStore %1666 %1667
OpStore %1668 %221
OpBranch %1669
%1669 = OpLabel
OpLoopMerge %1671 %1672 None
OpBranch %1673
%1673 = OpLabel
%1674 = OpLoad %26 %1668
%1675 = OpBitcast %33 %1674
%1676 = OpULessThan %100 %1675 %1653
OpBranchConditional %1676 %1670 %1671
%1670 = OpLabel
%1678 = OpLoad %77 %1534
%1679 = OpLoad %26 %1668
%1680 = OpAccessChain %14 %1656 %1679
%1681 = OpLoad %13 %1680
%1682 = OpMatrixTimesVector %13 %1678 %1681
%1683 = OpExtInst %13 %1 Normalize %1682
OpStore %1677 %1683
%1684 = OpLoad %26 %1668
%1685 = OpAccessChain %35 %1666 %1684
%1686 = OpLoad %6 %1685
%1687 = OpLoad %33 %80
%1688 = OpLoad %33 %80
%1689 = OpAccessChain %57 %1629 %1687
%1691 = OpLoad %13 %1573
OpStore %1690 %1691
%1693 = OpLoad %13 %81
OpStore %1692 %1693
%1695 = OpLoad %13 %1677
OpStore %1694 %1695
%1697 = OpLoad %6 %1568
OpStore %1696 %1697
%1699 = OpAccessChain %334 %1478 %221 %1688 %297
%1700 = OpLoad %6 %1699
OpStore %1698 %1700
%1701 = OpFunctionCall %19 %75 %1689 %1690 %1692 %1694 %1696 %1698
%1702 = OpVectorTimesScalar %19 %1701 %1686
%1703 = OpLoad %19 %1579
%1704 = OpFAdd %19 %1703 %1702
OpStore %1579 %1704
OpBranch %1672
%1672 = OpLabel
%1705 = OpLoad %26 %1668
%1706 = OpIAdd %26 %1705 %249
OpStore %1668 %1706
OpBranch %1669
%1671 = OpLabel
OpBranch %1584
%1584 = OpLabel
%1707 = OpLoad %33 %80
%1708 = OpAccessChain %334 %1478 %221 %1707 %370
%1709 = OpLoad %6 %1708
%1711 = OpFOrdGreaterThan %100 %1709 %1710
OpSelectionMerge %1713 None
OpBranchConditional %1711 %1712 %1713
%1712 = OpLabel
%1715 = OpLoad %33 %80
%1716 = OpAccessChain %334 %1478 %221 %1715 %682
%1717 = OpLoad %6 %1716
%1719 = OpFMul %6 %1717 %1718
%1720 = OpFAdd %6 %102 %1719
OpStore %1714 %1720
%1722 = OpLoad %6 %1714
%1724 = OpExtInst %6 %1 Modf %1722 %1723
OpStore %1721 %1724
OpStore %1725 %99
OpStore %1726 %102
OpBranch %1727
%1727 = OpLabel
OpLoopMerge %1729 %1730 None
OpBranch %1731
%1731 = OpLabel
%1732 = OpLoad %6 %1726
%1733 = OpLoad %6 %1723
%1734 = OpFOrdLessThanEqual %100 %1732 %1733
OpBranchConditional %1734 %1728 %1729
%1728 = OpLabel
%1736 = OpLoad %13 %81
%1737 = OpLoad %13 %82
%1738 = OpLoad %6 %1726
%1739 = OpFMul %6 %1738 %154
%1740 = OpFAdd %6 %1739 %102
%1741 = OpVectorTimesScalar %13 %1737 %1740
%1742 = OpFAdd %13 %1736 %1741
%1743 = OpLoad %13 %1573
%1744 = OpFMul %13 %1742 %1743
OpStore %1735 %1744
%1745 = OpLoad %33 %80
%1746 = OpAccessChain %57 %1629 %1745
%1747 = OpLoad %56 %1746
%1748 = OpLoad %214 %1374
%1749 = OpSampledImage %534 %1747 %1748
%1750 = OpLoad %13 %1735
%1751 = OpLoad %6 %1726
%1752 = OpFSub %6 %1751 %102
%1753 = OpImageSampleExplicitLod %19 %1749 %1750 Lod %1752
%1754 = OpCompositeExtract %6 %1753 3
%1755 = OpLoad %6 %1726
%1756 = OpFMul %6 %1754 %1755
%1757 = OpLoad %6 %1725
%1758 = OpFAdd %6 %1757 %1756
OpStore %1725 %1758
OpBranch %1730
%1730 = OpLabel
%1759 = OpLoad %6 %1726
%1760 = OpFAdd %6 %1759 %102
OpStore %1726 %1760
OpBranch %1727
%1729 = OpLabel
%1761 = OpLoad %6 %1721
%1762 = OpFOrdGreaterThan %100 %1761 %1710
OpSelectionMerge %1764 None
OpBranchConditional %1762 %1763 %1764
%1763 = OpLabel
%1766 = OpLoad %13 %81
%1767 = OpLoad %13 %82
%1768 = OpLoad %6 %1723
%1769 = OpFAdd %6 %1768 %102
%1770 = OpFMul %6 %1769 %154
%1771 = OpFAdd %6 %1770 %102
%1772 = OpVectorTimesScalar %13 %1767 %1771
%1773 = OpFAdd %13 %1766 %1772
%1774 = OpLoad %13 %1573
%1775 = OpFMul %13 %1773 %1774
OpStore %1765 %1775
%1776 = OpLoad %33 %80
%1777 = OpAccessChain %57 %1629 %1776
%1778 = OpLoad %56 %1777
%1779 = OpLoad %214 %1374
%1780 = OpSampledImage %534 %1778 %1779
%1781 = OpLoad %13 %1765
%1782 = OpLoad %6 %1723
%1783 = OpImageSampleExplicitLod %19 %1780 %1781 Lod %1782
%1784 = OpCompositeExtract %6 %1783 3
%1785 = OpLoad %6 %1723
%1786 = OpFAdd %6 %1785 %102
%1787 = OpFMul %6 %1784 %1786
%1788 = OpLoad %6 %1721
%1789 = OpFMul %6 %1787 %1788
%1790 = OpLoad %6 %1725
%1791 = OpFAdd %6 %1790 %1789
OpStore %1725 %1791
OpBranch %1764
%1764 = OpLabel
%1792 = OpLoad %6 %1725
%1793 = OpExtInst %6 %1 FMin %102 %1792
%1794 = OpFSub %6 %102 %1793
OpStore %1725 %1794
%1796 = OpAccessChain %1795 %235 %370
%1797 = OpLoad %13 %1796
%1798 = OpLoad %19 %1579
%1799 = OpVectorShuffle %13 %1798 %1798 0 1 2
%1800 = OpLoad %6 %1725
%1801 = OpLoad %33 %80
%1802 = OpAccessChain %334 %1478 %221 %1801 %370
%1803 = OpLoad %6 %1802
%1804 = OpExtInst %6 %1 FMix %102 %1800 %1803
%1805 = OpCompositeConstruct %13 %1804 %1804 %1804
%1806 = OpExtInst %13 %1 FMix %1797 %1799 %1805
%1807 = OpLoad %19 %1579
%1808 = OpVectorShuffle %19 %1807 %1806 4 5 6 3
OpStore %1579 %1808
OpBranch %1713
%1713 = OpLabel
%1809 = OpLoad %33 %80
%1810 = OpAccessChain %334 %1478 %221 %1809 %245
%1811 = OpLoad %6 %1810
%1812 = OpLoad %19 %1579
%1813 = OpVectorShuffle %13 %1812 %1812 0 1 2
%1814 = OpVectorTimesScalar %13 %1813 %1811
%1815 = OpLoad %19 %1579
%1816 = OpVectorShuffle %19 %1815 %1814 4 5 6 3
OpStore %1579 %1816
%1817 = OpLoad %33 %80
%1818 = OpAccessChain %463 %1478 %221 %1817 %333
%1819 = OpLoad %33 %1818
%1820 = OpINotEqual %100 %1819 %96
%1821 = OpLogicalNot %100 %1820
OpSelectionMerge %1823 None
OpBranchConditional %1821 %1822 %1823
%1822 = OpLabel
%1824 = OpAccessChain %35 %1579 %165
OpStore %1824 %102
OpBranch %1823
%1823 = OpLabel
%1825 = OpLoad %19 %1579
%1826 = OpLoad %6 %1557
%1827 = OpVectorTimesScalar %19 %1825 %1826
%1828 = OpLoad %19 %87
%1829 = OpFAdd %19 %1828 %1827
OpStore %87 %1829
%1831 = OpLoad %33 %80
%1832 = OpLoad %6 %85
%1833 = OpFMul %6 %1832 %154
%1835 = OpFMul %6 %1833 %1834
%1836 = OpFMul %6 %1835 %616
%1837 = OpExtInst %6 %1 Tan %1836
%1838 = OpLoad %33 %80
%1839 = OpAccessChain %57 %1629 %1831
%1841 = OpLoad %13 %1573
OpStore %1840 %1841
%1843 = OpLoad %13 %81
OpStore %1842 %1843
%1845 = OpLoad %13 %83
OpStore %1844 %1845
OpStore %1846 %1837
%1848 = OpLoad %6 %1568
OpStore %1847 %1848
%1850 = OpAccessChain %334 %1478 %221 %1838 %297
%1851 = OpLoad %6 %1850
OpStore %1849 %1851
%1852 = OpFunctionCall %19 %66 %1839 %1840 %1842 %1844 %1846 %1847 %1849
OpStore %1830 %1852
%1853 = OpLoad %33 %80
%1854 = OpAccessChain %334 %1478 %221 %1853 %245
%1855 = OpLoad %6 %1854
%1856 = OpLoad %19 %1830
%1857 = OpVectorShuffle %13 %1856 %1856 0 1 2
%1858 = OpVectorTimesScalar %13 %1857 %1855
%1859 = OpLoad %19 %1830
%1860 = OpVectorShuffle %19 %1859 %1858 4 5 6 3
OpStore %1830 %1860
%1861 = OpLoad %33 %80
%1862 = OpAccessChain %463 %1478 %221 %1861 %333
%1863 = OpLoad %33 %1862
%1864 = OpINotEqual %100 %1863 %96
%1865 = OpLogicalNot %100 %1864
OpSelectionMerge %1867 None
OpBranchConditional %1865 %1866 %1867
%1866 = OpLabel
%1868 = OpAccessChain %35 %1830 %165
OpStore %1868 %102
OpBranch %1867
%1867 = OpLabel
%1869 = OpLoad %19 %1830
%1870 = OpLoad %6 %1557
%1871 = OpVectorTimesScalar %19 %1869 %1870
%1872 = OpLoad %19 %86
%1873 = OpFAdd %19 %1872 %1871
OpStore %86 %1873
%1874 = OpLoad %6 %1557
%1875 = OpLoad %6 %88
%1876 = OpFAdd %6 %1875 %1874
OpStore %88 %1876
OpReturn
OpFunctionEnd
%93 = OpFunction %19 None %91
%92 = OpFunctionParameter %28
%94 = OpLabel
%1877 = OpVariable %20 Function
%1879 = OpLoad %210 %1878
%1880 = OpLoad %214 %216
%1881 = OpSampledImage %218 %1879 %1880
%1882 = OpLoad %27 %92
%1883 = OpImage %210 %1881
%1884 = OpImageFetch %19 %1883 %1882 Lod %221
OpStore %1877 %1884
%1885 = OpLoad %19 %1877
%1886 = OpVectorShuffle %13 %1885 %1885 0 1 2
%1887 = OpVectorTimesScalar %13 %1886 %228
%1888 = OpCompositeConstruct %13 %102 %102 %102
%1889 = OpFSub %13 %1887 %1888
%1890 = OpExtInst %13 %1 Normalize %1889
%1891 = OpLoad %19 %1877
%1892 = OpVectorShuffle %19 %1891 %1890 4 5 6 3
OpStore %1877 %1892
%1893 = OpLoad %19 %1877
OpReturnValue %1893
OpFunctionEnd
End SPIR-V
Converted MSL:
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#pragma clang diagnostic ignored "-Wmissing-braces"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
template<typename T, size_t Num>
struct spvUnsafeArray
{
T elements[Num ? Num : 1];
thread T& operator [] (size_t pos) thread
{
return elements[pos];
}
constexpr const thread T& operator [] (size_t pos) const thread
{
return elements[pos];
}
device T& operator [] (size_t pos) device
{
return elements[pos];
}
constexpr const device T& operator [] (size_t pos) const device
{
return elements[pos];
}
constexpr const constant T& operator [] (size_t pos) const constant
{
return elements[pos];
}
threadgroup T& operator [] (size_t pos) threadgroup
{
return elements[pos];
}
constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
{
return elements[pos];
}
};
struct Params
{
int2 screen_size;
float z_near;
float z_far;
float4 proj_info;
uint max_giprobes;
uint high_quality_vct;
uint use_sdfgi;
uint orthogonal;
packed_float3 ao_color;
uint pad;
float3x4 cam_rotation;
};
struct ProbeCascadeData
{
packed_float3 position;
float to_probe;
packed_int3 probe_world_offset;
float to_cell;
};
struct SDFGI
{
packed_float3 grid_size;
uint max_cascades;
uint use_occlusion;
int probe_axis_size;
float probe_to_uvw;
float normal_bias;
packed_float3 lightprobe_tex_pixel_size;
float energy;
packed_float3 lightprobe_uv_offset;
float y_mult;
packed_float3 occlusion_clamp;
uint pad3;
packed_float3 occlusion_renormalize;
uint pad4;
packed_float3 cascade_probe_size;
uint pad5;
ProbeCascadeData cascades[8];
};
struct GIProbeData
{
float4x4 xform;
packed_float3 bounds;
float dynamic_range;
float bias0;
float normal_bias;
uint blend_ambient;
uint texture_slot;
float anisotropy_strength;
float ambient_occlusion;
float ambient_occlusion_size;
uint pad2;
};
struct GIProbes
{
GIProbeData data[8];
};
constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(8u, 8u, 1u);
constant spvUnsafeArray<float3, 6> _1602 = spvUnsafeArray<float3, 6>({ float3(0.0, 0.0, 1.0), float3(0.86602497100830078125, 0.0, 0.5), float3(0.2676169872283935546875, 0.823638975620269775390625, 0.5), float3(-0.7006289958953857421875, 0.509037017822265625, 0.5), float3(-0.7006289958953857421875, -0.509037017822265625, 0.5), float3(0.2676169872283935546875, -0.823638975620269775390625, 0.5) });
constant spvUnsafeArray<float, 6> _1608 = spvUnsafeArray<float, 6>({ 0.25, 0.1500000059604644775390625, 0.1500000059604644775390625, 0.1500000059604644775390625, 0.1500000059604644775390625, 0.1500000059604644775390625 });
constant spvUnsafeArray<float3, 4> _1663 = spvUnsafeArray<float3, 4>({ float3(0.707107007503509521484375, 0.0, 0.707107007503509521484375), float3(0.0, 0.707107007503509521484375, 0.707107007503509521484375), float3(-0.707107007503509521484375, 0.0, 0.707107007503509521484375), float3(0.0, -0.707107007503509521484375, 0.707107007503509521484375) });
constant spvUnsafeArray<float, 4> _1667 = spvUnsafeArray<float, 4>({ 0.25, 0.25, 0.25, 0.25 });
static inline __attribute__((always_inline))
float3 reconstruct_position(thread const int2& screen_pos, thread texture2d<float> depth_buffer, thread sampler linear_sampler, constant Params& params)
{
float3 pos;
pos.z = depth_buffer.read(uint2(screen_pos), 0).x;
pos.z = (pos.z * 2.0) - 1.0;
if (params.orthogonal != 0u)
{
pos.z = ((pos.z + ((params.z_far + params.z_near) / (params.z_far - params.z_near))) * (params.z_far - params.z_near)) / 2.0;
}
else
{
pos.z = ((2.0 * params.z_near) * params.z_far) / ((params.z_far + params.z_near) - (pos.z * (params.z_far - params.z_near)));
}
pos.z = -pos.z;
float2 _306 = (float2(screen_pos) * params.proj_info.xy) + params.proj_info.zw;
pos = float3(_306.x, _306.y, pos.z);
if (!(params.orthogonal != 0u))
{
float2 _319 = pos.xy * pos.z;
pos = float3(_319.x, _319.y, pos.z);
}
return pos;
}
static inline __attribute__((always_inline))
float4 fetch_normal_and_roughness(thread const int2& pos, thread sampler linear_sampler, thread texture2d<float> normal_roughness_buffer)
{
float4 normal_roughness = normal_roughness_buffer.read(uint2(pos), 0);
float3 _1890 = normalize((normal_roughness.xyz * 2.0) - float3(1.0));
normal_roughness = float4(_1890.x, _1890.y, _1890.z, normal_roughness.w);
return normal_roughness;
}
static inline __attribute__((always_inline))
float2 octahedron_wrap(thread const float2& v)
{
float2 signVal;
signVal.x = (v.x >= 0.0) ? 1.0 : (-1.0);
signVal.y = (v.y >= 0.0) ? 1.0 : (-1.0);
return (float2(1.0) - abs(v.yx)) * signVal;
}
static inline __attribute__((always_inline))
float2 octahedron_encode(thread float3& n)
{
n /= float3((abs(n.x) + abs(n.y)) + abs(n.z));
float2 _139;
if (n.z >= 0.0)
{
_139 = n.xy;
}
else
{
float2 param = n.xy;
_139 = octahedron_wrap(param);
}
n = float3(_139.x, _139.y, n.z);
float2 _157 = (n.xy * 0.5) + float2(0.5);
n = float3(_157.x, _157.y, n.z);
return n.xy;
}
static inline __attribute__((always_inline))
void sdfgi_probe_process(thread const uint& cascade, thread float3& cascade_pos, thread const float3& cam_pos, thread const float3& cam_normal, thread const float3& cam_specular_normal, thread const float& roughness, thread float3& diffuse_light, thread float3& specular_light, thread sampler linear_sampler, constant SDFGI& sdfgi, thread texture3d<float> occlusion_texture, thread texture2d_array<float> lightprobe_texture)
{
cascade_pos += (cam_normal * sdfgi.normal_bias);
float3 base_pos = floor(cascade_pos);
int3 probe_base_pos = int3(base_pos);
float4 diffuse_accum = float4(0.0);
int3 tex_pos = int3(probe_base_pos.xy, int(cascade));
tex_pos.x += (probe_base_pos.z * sdfgi.probe_axis_size);
int2 _374 = (tex_pos.xy * int2(8)) + int2(1);
tex_pos = int3(_374.x, _374.y, tex_pos.z);
float3 param = cam_normal;
float2 _382 = octahedron_encode(param);
float3 diffuse_posf = (float3(tex_pos) + float3(_382 * 6.0, 0.0)) * float3(sdfgi.lightprobe_tex_pixel_size);
float3 param_1 = cam_specular_normal;
float2 _399 = octahedron_encode(param_1);
float3 specular_posf = (float3(tex_pos) + float3(_399 * 6.0, 0.0)) * float3(sdfgi.lightprobe_tex_pixel_size);
float3 specular_accum = float3(0.0);
float4 light_accum = float4(0.0);
float weight_accum = 0.0;
for (uint j = 0u; j < 8u; j++)
{
int3 offset = (int3(int(j)) >> int3(0, 1, 2)) & int3(1);
int3 probe_posi = probe_base_pos;
probe_posi += offset;
float3 probe_pos = float3(probe_posi);
float3 probe_to_pos = cascade_pos - probe_pos;
float3 probe_dir = normalize(-probe_to_pos);
float3 trilinear = float3(1.0) - abs(probe_to_pos);
float weight = ((trilinear.x * trilinear.y) * trilinear.z) * fast::max(0.004999999888241291046142578125, dot(cam_normal, probe_dir));
if (sdfgi.use_occlusion != 0u)
{
int3 occ_indexv = abs((int3(sdfgi.cascades[cascade].probe_world_offset) + probe_posi) & int3(1)) * int3(1, 2, 4);
float4 occ_mask = select(float4(0.0), float4(1.0), int4(occ_indexv.x | occ_indexv.y) == int4(0, 1, 2, 3));
float3 occ_pos = fast::clamp(cascade_pos, probe_pos - float3(sdfgi.occlusion_clamp), probe_pos + float3(sdfgi.occlusion_clamp)) * sdfgi.probe_to_uvw;
occ_pos.z += float(cascade);
if (occ_indexv.z != 0)
{
occ_pos.x += 1.0;
}
occ_pos *= float3(sdfgi.occlusion_renormalize);
float occlusion = dot(occlusion_texture.sample(linear_sampler, occ_pos, level(0.0)), occ_mask);
weight *= fast::max(occlusion, 0.00999999977648258209228515625);
}
float3 pos_uvw = diffuse_posf;
float2 _556 = pos_uvw.xy + (float2(offset.xy) * float2(sdfgi.lightprobe_uv_offset[0], sdfgi.lightprobe_uv_offset[1]));
pos_uvw = float3(_556.x, _556.y, pos_uvw.z);
pos_uvw.x += (float(offset.z) * sdfgi.lightprobe_uv_offset[2u]);
float3 diffuse = lightprobe_texture.sample(linear_sampler, pos_uvw.xy, uint(round(pos_uvw.z)), level(0.0)).xyz;
diffuse_accum += float4(diffuse * weight, weight);
float3 specular = float3(0.0);
float3 pos_uvw_1 = specular_posf;
float2 _602 = pos_uvw_1.xy + (float2(offset.xy) * float2(sdfgi.lightprobe_uv_offset[0], sdfgi.lightprobe_uv_offset[1]));
pos_uvw_1 = float3(_602.x, _602.y, pos_uvw_1.z);
pos_uvw_1.x += (float(offset.z) * sdfgi.lightprobe_uv_offset[2u]);
if (roughness < 0.9900000095367431640625)
{
float3 _628 = pos_uvw_1 + float3(0.0, 0.0, float(sdfgi.max_cascades));
specular = lightprobe_texture.sample(linear_sampler, _628.xy, uint(round(_628.z)), level(0.0)).xyz;
}
if (roughness > 0.20000000298023223876953125)
{
specular = mix(specular, lightprobe_texture.sample(linear_sampler, pos_uvw_1.xy, uint(round(pos_uvw_1.z)), level(0.0)).xyz, float3((roughness - 0.20000000298023223876953125) * 1.25));
}
specular_accum += (specular * weight);
}
if (diffuse_accum.w > 0.0)
{
float3 _666 = diffuse_accum.xyz / float3(diffuse_accum.w);
diffuse_accum = float4(_666.x, _666.y, _666.z, diffuse_accum.w);
}
diffuse_light = diffuse_accum.xyz;
if (diffuse_accum.w > 0.0)
{
specular_accum /= float3(diffuse_accum.w);
}
specular_light = specular_accum;
}
static inline __attribute__((always_inline))
void sdfgi_process(thread float3& vertex0, thread float3& normal, thread float3& reflection, thread const float& roughness, thread float4& ambient_light, thread float4& reflection_light, thread sampler linear_sampler, constant SDFGI& sdfgi, thread texture3d<float> occlusion_texture, thread texture2d_array<float> lightprobe_texture, thread const array<texture3d<float>, 8> sdf_cascades, thread const array<texture3d<float>, 8> light_cascades)
{
vertex0.y *= sdfgi.y_mult;
normal.y *= sdfgi.y_mult;
reflection.y *= sdfgi.y_mult;
normal = normalize(normal);
reflection = normalize(reflection);
float3 cam_pos = vertex0;
float3 cam_normal = normal;
float4 light_accum = float4(0.0);
float weight_accum = 0.0;
float4 light_blend_accum = float4(0.0);
float weight_blend_accum = 0.0;
float blend = -1.0;
uint cascade = 4294967295u;
float3 cascade_pos;
for (uint i = 0u; i < sdfgi.max_cascades; i++)
{
cascade_pos = (cam_pos - float3(sdfgi.cascades[i].position)) * sdfgi.cascades[i].to_probe;
bool _739 = any(cascade_pos < float3(0.0));
bool _749;
if (!_739)
{
_749 = any(cascade_pos >= float3(sdfgi.cascade_probe_size));
}
else
{
_749 = _739;
}
if (_749)
{
}
cascade = i;
break;
}
if (cascade < 8u)
{
ambient_light = float4(0.0, 0.0, 0.0, 1.0);
reflection_light = float4(0.0, 0.0, 0.0, 1.0);
uint param = cascade;
float3 param_1 = cascade_pos;
float3 param_2 = cam_pos;
float3 param_3 = cam_normal;
float3 param_4 = reflection;
float param_5 = roughness;
float3 param_6;
float3 param_7;
sdfgi_probe_process(param, param_1, param_2, param_3, param_4, param_5, param_6, param_7, linear_sampler, sdfgi, occlusion_texture, lightprobe_texture);
float3 diffuse = param_6;
float3 specular = param_7;
float blend_from = (float(sdfgi.probe_axis_size - 1) / 2.0) - 2.5;
float blend_to = blend_from + 2.0;
float3 inner_pos = cam_pos * sdfgi.cascades[cascade].to_probe;
float len = length(inner_pos);
inner_pos = abs(normalize(inner_pos));
len *= fast::max(inner_pos.x, fast::max(inner_pos.y, inner_pos.z));
float blend_1;
if (len >= blend_from)
{
blend_1 = smoothstep(blend_from, blend_to, len);
}
else
{
blend_1 = 0.0;
}
if (blend_1 > 0.0)
{
if (cascade == (sdfgi.max_cascades - 1u))
{
ambient_light.w = 1.0 - blend_1;
reflection_light.w = 1.0 - blend_1;
}
else
{
cascade_pos = (cam_pos - float3(sdfgi.cascades[cascade + 1u].position)) * sdfgi.cascades[cascade + 1u].to_probe;
uint param_8 = cascade + 1u;
float3 param_9 = cascade_pos;
float3 param_10 = cam_pos;
float3 param_11 = cam_normal;
float3 param_12 = reflection;
float param_13 = roughness;
float3 param_14;
float3 param_15;
sdfgi_probe_process(param_8, param_9, param_10, param_11, param_12, param_13, param_14, param_15, linear_sampler, sdfgi, occlusion_texture, lightprobe_texture);
float3 diffuse2 = param_14;
float3 specular2 = param_15;
diffuse = mix(diffuse, diffuse2, float3(blend_1));
specular = mix(specular, specular2, float3(blend_1));
}
}
ambient_light = float4(diffuse.x, diffuse.y, diffuse.z, ambient_light.w);
if (roughness < 0.20000000298023223876953125)
{
float3 pos_to_uvw = float3(1.0) / float3(sdfgi.grid_size);
float4 light_accum_1 = float4(0.0);
float blend_size = (sdfgi.grid_size[0u] / float(sdfgi.probe_axis_size - 1)) * 0.5;
cascade = 65535u;
float base_distance = length(cam_pos);
spvUnsafeArray<float, 8> radius_sizes;
for (uint i_1 = 0u; i_1 < sdfgi.max_cascades; i_1++)
{
radius_sizes[i_1] = (1.0 / sdfgi.cascades[i_1].to_cell) * ((sdfgi.grid_size[0u] * 0.5) - blend_size);
bool _936 = cascade == 65535u;
bool _944;
if (_936)
{
_944 = base_distance < radius_sizes[i_1];
}
else
{
_944 = _936;
}
if (_944)
{
cascade = i_1;
}
}
cascade = min(cascade, (sdfgi.max_cascades - 1u));
float max_distance = radius_sizes[sdfgi.max_cascades - 1u];
float3 ray_pos = cam_pos;
float3 ray_dir = reflection;
float _968;
if (cascade > 0u)
{
_968 = radius_sizes[cascade - 1u];
}
else
{
_968 = 0.0;
}
float prev_radius = _968;
float base_blend = (base_distance - prev_radius) / (radius_sizes[cascade] - prev_radius);
float bias0 = (1.0 + base_blend) * 1.10000002384185791015625;
float3 abs_ray_dir = abs(ray_dir);
ray_pos += (((((ray_dir * 1.0) / float3(fast::max(abs_ray_dir.x, fast::max(abs_ray_dir.y, abs_ray_dir.z)))) + (cam_normal * 1.39999997615814208984375)) * bias0) / float3(sdfgi.cascades[cascade].to_cell));
float softness = 0.20000000298023223876953125 + (fast::min(1.0, roughness * 5.0) * 4.0);
float _1203;
while (length(ray_pos) < max_distance)
{
for (uint i_2 = 0u; i_2 < sdfgi.max_cascades; i_2++)
{
bool _1049 = i_2 >= cascade;
bool _1058;
if (_1049)
{
_1058 = length(ray_pos) < radius_sizes[i_2];
}
else
{
_1058 = _1049;
}
if (_1058)
{
cascade = max(i_2, cascade);
float3 pos = ray_pos - float3(sdfgi.cascades[i_2].position);
pos *= (pos_to_uvw * sdfgi.cascades[i_2].to_cell);
float _distance = (sdf_cascades[i_2].sample(linear_sampler, pos, level(0.0)).x * 255.0) - 1.10000002384185791015625;
float4 hit_light = float4(0.0);
if (_distance < softness)
{
float3 _1106 = light_cascades[i_2].sample(linear_sampler, pos, level(0.0)).xyz;
hit_light = float4(_1106.x, _1106.y, _1106.z, hit_light.w);
float3 _1111 = hit_light.xyz * 0.5;
hit_light = float4(_1111.x, _1111.y, _1111.z, hit_light.w);
hit_light.w = fast::clamp(1.0 - (_distance / softness), 0.0, 1.0);
float3 _1124 = hit_light.xyz * hit_light.w;
hit_light = float4(_1124.x, _1124.y, _1124.z, hit_light.w);
}
_distance /= sdfgi.cascades[i_2].to_cell;
if (i_2 < (sdfgi.max_cascades - 1u))
{
pos = ray_pos - float3(sdfgi.cascades[i_2 + 1u].position);
pos *= (pos_to_uvw * sdfgi.cascades[i_2 + 1u].to_cell);
uint _1155 = i_2 + 1u;
float distance2 = (sdf_cascades[_1155].sample(linear_sampler, pos, level(0.0)).x * 255.0) - 1.10000002384185791015625;
float4 hit_light2 = float4(0.0);
if (distance2 < softness)
{
uint _1172 = i_2 + 1u;
float3 _1179 = light_cascades[_1172].sample(linear_sampler, pos, level(0.0)).xyz;
hit_light2 = float4(_1179.x, _1179.y, _1179.z, hit_light2.w);
float3 _1184 = hit_light2.xyz * 0.5;
hit_light2 = float4(_1184.x, _1184.y, _1184.z, hit_light2.w);
hit_light2.w = fast::clamp(1.0 - (distance2 / softness), 0.0, 1.0);
float3 _1197 = hit_light2.xyz * hit_light2.w;
hit_light2 = float4(_1197.x, _1197.y, _1197.z, hit_light2.w);
}
if (i_2 == 0u)
{
_1203 = 0.0;
}
else
{
_1203 = radius_sizes[i_2 - 1u];
}
float prev_radius_1 = _1203;
float blend_2 = fast::clamp((length(ray_pos) - prev_radius_1) / (radius_sizes[i_2] - prev_radius_1), 0.0, 1.0);
distance2 /= sdfgi.cascades[i_2 + 1u].to_cell;
hit_light = mix(hit_light, hit_light2, float4(blend_2));
_distance = mix(_distance, distance2, blend_2);
}
light_accum_1 += hit_light;
ray_pos += (ray_dir * _distance);
break;
}
}
if (light_accum_1.w > 0.9900000095367431640625)
{
break;
}
}
float3 light = light_accum_1.xyz / float3(fast::max(light_accum_1.w, 9.9999997473787516355514526367188e-06));
float alpha = fast::min(1.0, light_accum_1.w);
float b = fast::min(1.0, roughness * 5.0);
float sa = 1.0 - b;
reflection_light.w = (alpha * sa) + b;
if (reflection_light.w == 0.0)
{
specular = float3(0.0);
}
else
{
specular = (((light * alpha) * sa) + (specular * b)) / float3(reflection_light.w);
}
}
reflection_light = float4(specular.x, specular.y, specular.z, reflection_light.w);
float3 _1308 = ambient_light.xyz * sdfgi.energy;
ambient_light = float4(_1308.x, _1308.y, _1308.z, ambient_light.w);
float3 _1315 = reflection_light.xyz * sdfgi.energy;
reflection_light = float4(_1315.x, _1315.y, _1315.z, reflection_light.w);
}
else
{
ambient_light = float4(0.0);
reflection_light = float4(0.0);
}
}
static inline __attribute__((always_inline))
float4 voxel_cone_trace(thread const texture3d<float> probe, thread const float3& cell_size, thread const float3& pos, thread const float3& direction, thread const float& tan_half_angle, thread const float& max_distance, thread const float& p_bias, thread sampler linear_sampler_with_mipmaps)
{
float dist = p_bias;
float4 color = float4(0.0);
for (;;)
{
bool _1329 = dist < max_distance;
bool _1336;
if (_1329)
{
_1336 = color.w < 0.949999988079071044921875;
}
else
{
_1336 = _1329;
}
if (_1336)
{
float diameter = fast::max(1.0, (2.0 * tan_half_angle) * dist);
float3 uvw_pos = (pos + (direction * dist)) * cell_size;
float half_diameter = diameter * 0.5;
if (any(abs(uvw_pos - float3(0.5)) > float3(float3(0.5) + (cell_size * half_diameter))))
{
break;
}
float4 scolor = probe.sample(linear_sampler_with_mipmaps, uvw_pos, level(log2(diameter)));
float a = 1.0 - color.w;
color += (scolor * a);
dist += half_diameter;
continue;
}
else
{
break;
}
}
return color;
}
static inline __attribute__((always_inline))
float4 voxel_cone_trace_45_degrees(thread const texture3d<float> probe, thread const float3& cell_size, thread const float3& pos, thread const float3& direction, thread const float& max_distance, thread const float& p_bias, thread sampler linear_sampler_with_mipmaps)
{
float dist = p_bias;
float4 color = float4(0.0);
float radius = fast::max(0.5, dist);
float lod_level = log2(radius * 2.0);
for (;;)
{
bool _1413 = dist < max_distance;
bool _1419;
if (_1413)
{
_1419 = color.w < 0.949999988079071044921875;
}
else
{
_1419 = _1413;
}
if (_1419)
{
float3 uvw_pos = (pos + (direction * dist)) * cell_size;
if (any(abs(uvw_pos - float3(0.5)) > float3(float3(0.5) + (cell_size * radius))))
{
break;
}
float4 scolor = probe.sample(linear_sampler_with_mipmaps, uvw_pos, level(lod_level));
lod_level += 1.0;
float a = 1.0 - color.w;
scolor *= a;
color += scolor;
dist += radius;
radius = fast::max(0.5, dist);
continue;
}
else
{
break;
}
}
return color;
}
static inline __attribute__((always_inline))
void gi_probe_compute(thread const uint& index, thread float3& position, thread float3& normal, thread float3& ref_vec, thread const float3x3& normal_xform, thread const float& roughness, thread float4& out_spec, thread float4& out_diff, thread float& out_blend, constant Params& params, thread sampler linear_sampler_with_mipmaps, constant GIProbes& gi_probes, thread const array<texture3d<float>, 8> gi_probe_textures)
{
position = (gi_probes.data[index].xform * float4(position, 1.0)).xyz;
ref_vec = normalize((gi_probes.data[index].xform * float4(ref_vec, 0.0)).xyz);
normal = normalize((gi_probes.data[index].xform * float4(normal, 0.0)).xyz);
position += (normal * gi_probes.data[index].normal_bias);
if (any(bool2(any(position < float3(0.0)), any(position > float3(gi_probes.data[index].bounds)))))
{
return;
}
float3x3 dir_xform = float3x3(gi_probes.data[index].xform[0].xyz, gi_probes.data[index].xform[1].xyz, gi_probes.data[index].xform[2].xyz) * normal_xform;
float3 blendv = abs(((position / float3(gi_probes.data[index].bounds)) * 2.0) - float3(1.0));
float blend = fast::clamp(1.0 - fast::max(blendv.x, fast::max(blendv.y, blendv.z)), 0.0, 1.0);
float max_distance = length(float3(gi_probes.data[index].bounds));
float3 cell_size = float3(1.0) / float3(gi_probes.data[index].bounds);
float4 light = float4(0.0);
if (params.high_quality_vct != 0u)
{
float cone_angle_tan = 0.57700002193450927734375;
for (uint i = 0u; i < 6u; i++)
{
float3 dir = normalize(dir_xform * _1602[i]);
float3 param = cell_size;
float3 param_1 = position;
float3 param_2 = dir;
float param_3 = cone_angle_tan;
float param_4 = max_distance;
float param_5 = gi_probes.data[index].bias0;
light += (voxel_cone_trace(gi_probe_textures[index], param, param_1, param_2, param_3, param_4, param_5, linear_sampler_with_mipmaps) * _1608[i]);
}
}
else
{
for (int i_1 = 0; uint(i_1) < 4u; i_1++)
{
float3 dir_1 = normalize(dir_xform * _1663[i_1]);
float3 param_6 = cell_size;
float3 param_7 = position;
float3 param_8 = dir_1;
float param_9 = max_distance;
float param_10 = gi_probes.data[index].bias0;
light += (voxel_cone_trace_45_degrees(gi_probe_textures[index], param_6, param_7, param_8, param_9, param_10, linear_sampler_with_mipmaps) * _1667[i_1]);
}
}
if (gi_probes.data[index].ambient_occlusion > 0.001000000047497451305389404296875)
{
float size = 1.0 + (gi_probes.data[index].ambient_occlusion_size * 7.0);
float taps;
float _1724 = modf(size, taps);
float blend_1 = _1724;
float ao = 0.0;
for (float i_2 = 1.0; i_2 <= taps; i_2 += 1.0)
{
float3 ofs = (position + (normal * ((i_2 * 0.5) + 1.0))) * cell_size;
ao += (gi_probe_textures[index].sample(linear_sampler_with_mipmaps, ofs, level(i_2 - 1.0)).w * i_2);
}
if (blend_1 > 0.001000000047497451305389404296875)
{
float3 ofs_1 = (position + (normal * (((taps + 1.0) * 0.5) + 1.0))) * cell_size;
ao += ((gi_probe_textures[index].sample(linear_sampler_with_mipmaps, ofs_1, level(taps)).w * (taps + 1.0)) * blend_1);
}
ao = 1.0 - fast::min(1.0, ao);
float3 _1806 = mix(float3(params.ao_color), light.xyz, float3(mix(1.0, ao, gi_probes.data[index].ambient_occlusion)));
light = float4(_1806.x, _1806.y, _1806.z, light.w);
}
float3 _1814 = light.xyz * gi_probes.data[index].dynamic_range;
light = float4(_1814.x, _1814.y, _1814.z, light.w);
if (!(gi_probes.data[index].blend_ambient != 0u))
{
light.w = 1.0;
}
out_diff += (light * blend);
float3 param_11 = cell_size;
float3 param_12 = position;
float3 param_13 = ref_vec;
float param_14 = tan(((roughness * 0.5) * 3.1415920257568359375) * 0.9900000095367431640625);
float param_15 = max_distance;
float param_16 = gi_probes.data[index].bias0;
float4 irr_light = voxel_cone_trace(gi_probe_textures[index], param_11, param_12, param_13, param_14, param_15, param_16, linear_sampler_with_mipmaps);
float3 _1858 = irr_light.xyz * gi_probes.data[index].dynamic_range;
irr_light = float4(_1858.x, _1858.y, _1858.z, irr_light.w);
if (!(gi_probes.data[index].blend_ambient != 0u))
{
irr_light.w = 1.0;
}
out_spec += (irr_light * blend);
out_blend += blend;
}
static inline __attribute__((always_inline))
float4 blend_color(thread const float4& src, thread const float4& dst)
{
float sa = 1.0 - src.w;
float4 res;
res.w = (dst.w * sa) + src.w;
if (res.w == 0.0)
{
res = float4(float3(0.0).x, float3(0.0).y, float3(0.0).z, res.w);
}
else
{
float3 _203 = (((dst.xyz * dst.w) * sa) + (src.xyz * src.w)) / float3(res.w);
res = float4(_203.x, _203.y, _203.z, res.w);
}
return res;
}
kernel void main0(constant SDFGI& sdfgi [[buffer(2)]], constant GIProbes& gi_probes [[buffer(3)]], constant Params& params [[buffer(4)]], array<texture3d<float>, 8> sdf_cascades [[texture(0)]], array<texture3d<float>, 8> light_cascades [[texture(8)]], texture3d<float> occlusion_texture [[texture(32)]], texture2d<float, access::write> ambient_buffer [[texture(33)]], texture2d<float, access::write> reflection_buffer [[texture(34)]], texture2d_array<float> lightprobe_texture [[texture(35)]], texture2d<float> depth_buffer [[texture(36)]], texture2d<float> normal_roughness_buffer [[texture(37)]], texture2d<uint> giprobe_buffer [[texture(38)]], array<texture3d<float>, 8> gi_probe_textures [[texture(39)]], sampler linear_sampler [[sampler(0)]], sampler linear_sampler_with_mipmaps [[sampler(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
{
int2 pos = int2(gl_GlobalInvocationID.xy);
if (any(pos >= params.screen_size))
{
return;
}
int2 param = pos;
float3 vertex0 = reconstruct_position(param, depth_buffer, linear_sampler, params);
vertex0.y = -vertex0.y;
int2 param_1 = pos;
float4 normal_roughness = fetch_normal_and_roughness(param_1, linear_sampler, normal_roughness_buffer);
float3 normal = normal_roughness.xyz;
float4 ambient_light = float4(0.0);
float4 reflection_light = float4(0.0);
if (true)
{
float roughness = normal_roughness.w;
vertex0 = float3x3(params.cam_rotation[0].xyz, params.cam_rotation[1].xyz, params.cam_rotation[2].xyz) * vertex0;
normal = normalize(float3x3(params.cam_rotation[0].xyz, params.cam_rotation[1].xyz, params.cam_rotation[2].xyz) * normal);
float3 reflection = normalize(reflect(normalize(vertex0), normal));
if (params.use_sdfgi != 0u)
{
float3 param_2 = vertex0;
float3 param_3 = normal;
float3 param_4 = reflection;
float param_5 = roughness;
float4 param_6;
float4 param_7;
sdfgi_process(param_2, param_3, param_4, param_5, param_6, param_7, linear_sampler, sdfgi, occlusion_texture, lightprobe_texture, sdf_cascades, light_cascades);
ambient_light = param_6;
reflection_light = param_7;
}
if (params.max_giprobes > 0u)
{
uint2 giprobe_tex = giprobe_buffer.read(uint2(pos), 0).xy;
roughness *= roughness;
float3 v0 = select(float3(0.0, 1.0, 0.0), float3(0.0, 0.0, 1.0), bool3(abs(normal.z) < 0.999000012874603271484375));
float3 tangent = normalize(cross(v0, normal));
float3 bitangent = normalize(cross(tangent, normal));
float3x3 normal_mat = float3x3(float3(tangent), float3(bitangent), float3(normal));
float4 amb_accum = float4(0.0);
float4 spec_accum = float4(0.0);
float blend_accum = 0.0;
for (uint i = 0u; i < params.max_giprobes; i++)
{
if (any(uint2(i) == giprobe_tex))
{
uint param_8 = i;
float3 param_9 = vertex0;
float3 param_10 = normal;
float3 param_11 = reflection;
float3x3 param_12 = normal_mat;
float param_13 = roughness;
float4 param_14 = spec_accum;
float4 param_15 = amb_accum;
float param_16 = blend_accum;
gi_probe_compute(param_8, param_9, param_10, param_11, param_12, param_13, param_14, param_15, param_16, params, linear_sampler_with_mipmaps, gi_probes, gi_probe_textures);
spec_accum = param_14;
amb_accum = param_15;
blend_accum = param_16;
}
}
if (blend_accum > 0.0)
{
amb_accum /= float4(blend_accum);
spec_accum /= float4(blend_accum);
}
if (params.use_sdfgi != 0u)
{
float4 param_17 = spec_accum;
float4 param_18 = reflection_light;
reflection_light = blend_color(param_17, param_18);
float4 param_19 = amb_accum;
float4 param_20 = ambient_light;
ambient_light = blend_color(param_19, param_20);
}
else
{
reflection_light = spec_accum;
ambient_light = amb_accum;
}
}
}
ambient_buffer.write(ambient_light, uint2(pos));
reflection_buffer.write(reflection_light, uint2(pos));
}
End MSL
Estimated original GLSL:
#version 450
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
struct ProbeCascadeData
{
vec3 position;
float to_probe;
ivec3 probe_world_offset;
float to_cell;
};
struct GIProbeData
{
mat4 xform;
vec3 bounds;
float dynamic_range;
float bias;
float normal_bias;
uint blend_ambient;
uint texture_slot;
float anisotropy_strength;
float ambient_occlusion;
float ambient_occlusion_size;
uint pad2;
};
const vec3 _1602[6] = vec3[](vec3(0.0, 0.0, 1.0), vec3(0.86602497100830078125, 0.0, 0.5), vec3(0.2676169872283935546875, 0.823638975620269775390625, 0.5), vec3(-0.7006289958953857421875, 0.509037017822265625, 0.5), vec3(-0.7006289958953857421875, -0.509037017822265625, 0.5), vec3(0.2676169872283935546875, -0.823638975620269775390625, 0.5));
const float _1608[6] = float[](0.25, 0.1500000059604644775390625, 0.1500000059604644775390625, 0.1500000059604644775390625, 0.1500000059604644775390625, 0.1500000059604644775390625);
const vec3 _1663[4] = vec3[](vec3(0.707107007503509521484375, 0.0, 0.707107007503509521484375), vec3(0.0, 0.707107007503509521484375, 0.707107007503509521484375), vec3(-0.707107007503509521484375, 0.0, 0.707107007503509521484375), vec3(0.0, -0.707107007503509521484375, 0.707107007503509521484375));
const float _1667[4] = float[](0.25, 0.25, 0.25, 0.25);
layout(set = 0, binding = 15, std140) uniform SDFGI
{
vec3 grid_size;
uint max_cascades;
uint use_occlusion;
int probe_axis_size;
float probe_to_uvw;
float normal_bias;
vec3 lightprobe_tex_pixel_size;
float energy;
vec3 lightprobe_uv_offset;
float y_mult;
vec3 occlusion_clamp;
uint pad3;
vec3 occlusion_renormalize;
uint pad4;
vec3 cascade_probe_size;
uint pad5;
ProbeCascadeData cascades[8];
} sdfgi;
layout(set = 0, binding = 16, std140) uniform GIProbes
{
GIProbeData data[8];
} gi_probes;
layout(push_constant, binding = 0, std430) uniform Params
{
ivec2 screen_size;
float z_near;
float z_far;
vec4 proj_info;
uint max_giprobes;
uint high_quality_vct;
uint use_sdfgi;
uint orthogonal;
vec3 ao_color;
uint pad;
mat3x4 cam_rotation;
} params;
layout(set = 0, binding = 12) uniform texture2D depth_buffer;
layout(set = 0, binding = 6) uniform sampler linear_sampler;
layout(set = 0, binding = 5) uniform texture3D occlusion_texture;
layout(set = 0, binding = 11) uniform texture2DArray lightprobe_texture;
layout(set = 0, binding = 1) uniform texture3D sdf_cascades[8];
layout(set = 0, binding = 2) uniform texture3D light_cascades[8];
layout(set = 0, binding = 7) uniform sampler linear_sampler_with_mipmaps;
layout(set = 0, binding = 17) uniform texture3D gi_probe_textures[8];
layout(set = 0, binding = 13) uniform texture2D normal_roughness_buffer;
layout(set = 0, binding = 14) uniform utexture2D giprobe_buffer;
layout(set = 0, binding = 9, rgba16f) uniform restrict writeonly image2D ambient_buffer;
layout(set = 0, binding = 10, rgba16f) uniform restrict writeonly image2D reflection_buffer;
layout(set = 0, binding = 3) uniform texture3D aniso0_cascades[8];
layout(set = 0, binding = 4) uniform texture3D aniso1_cascades[8];
vec3 reconstruct_position(ivec2 screen_pos)
{
vec3 pos;
pos.z = texelFetch(sampler2D(depth_buffer, linear_sampler), screen_pos, 0).x;
pos.z = (pos.z * 2.0) - 1.0;
if (params.orthogonal != 0u)
{
pos.z = ((pos.z + ((params.z_far + params.z_near) / (params.z_far - params.z_near))) * (params.z_far - params.z_near)) / 2.0;
}
else
{
pos.z = ((2.0 * params.z_near) * params.z_far) / ((params.z_far + params.z_near) - (pos.z * (params.z_far - params.z_near)));
}
pos.z = -pos.z;
vec2 _306 = (vec2(screen_pos) * params.proj_info.xy) + params.proj_info.zw;
pos = vec3(_306.x, _306.y, pos.z);
if (!(params.orthogonal != 0u))
{
vec2 _319 = pos.xy * pos.z;
pos = vec3(_319.x, _319.y, pos.z);
}
return pos;
}
vec4 fetch_normal_and_roughness(ivec2 pos)
{
vec4 normal_roughness = texelFetch(sampler2D(normal_roughness_buffer, linear_sampler), pos, 0);
vec3 _1890 = normalize((normal_roughness.xyz * 2.0) - vec3(1.0));
normal_roughness = vec4(_1890.x, _1890.y, _1890.z, normal_roughness.w);
return normal_roughness;
}
vec2 octahedron_wrap(vec2 v)
{
vec2 signVal;
signVal.x = (v.x >= 0.0) ? 1.0 : (-1.0);
signVal.y = (v.y >= 0.0) ? 1.0 : (-1.0);
return (vec2(1.0) - abs(v.yx)) * signVal;
}
vec2 octahedron_encode(inout vec3 n)
{
n /= vec3((abs(n.x) + abs(n.y)) + abs(n.z));
vec2 _139;
if (n.z >= 0.0)
{
_139 = n.xy;
}
else
{
vec2 param = n.xy;
_139 = octahedron_wrap(param);
}
n = vec3(_139.x, _139.y, n.z);
vec2 _157 = (n.xy * 0.5) + vec2(0.5);
n = vec3(_157.x, _157.y, n.z);
return n.xy;
}
void sdfgi_probe_process(uint cascade, inout vec3 cascade_pos, vec3 cam_pos, vec3 cam_normal, vec3 cam_specular_normal, float roughness, inout vec3 diffuse_light, inout vec3 specular_light)
{
cascade_pos += (cam_normal * sdfgi.normal_bias);
vec3 base_pos = floor(cascade_pos);
ivec3 probe_base_pos = ivec3(base_pos);
vec4 diffuse_accum = vec4(0.0);
ivec3 tex_pos = ivec3(probe_base_pos.xy, int(cascade));
tex_pos.x += (probe_base_pos.z * sdfgi.probe_axis_size);
ivec2 _374 = (tex_pos.xy * ivec2(8)) + ivec2(1);
tex_pos = ivec3(_374.x, _374.y, tex_pos.z);
vec3 param = cam_normal;
vec2 _382 = octahedron_encode(param);
vec3 diffuse_posf = (vec3(tex_pos) + vec3(_382 * 6.0, 0.0)) * sdfgi.lightprobe_tex_pixel_size;
vec3 param_1 = cam_specular_normal;
vec2 _399 = octahedron_encode(param_1);
vec3 specular_posf = (vec3(tex_pos) + vec3(_399 * 6.0, 0.0)) * sdfgi.lightprobe_tex_pixel_size;
vec3 specular_accum = vec3(0.0);
vec4 light_accum = vec4(0.0);
float weight_accum = 0.0;
for (uint j = 0u; j < 8u; j++)
{
ivec3 offset = (ivec3(int(j)) >> ivec3(0, 1, 2)) & ivec3(1);
ivec3 probe_posi = probe_base_pos;
probe_posi += offset;
vec3 probe_pos = vec3(probe_posi);
vec3 probe_to_pos = cascade_pos - probe_pos;
vec3 probe_dir = normalize(-probe_to_pos);
vec3 trilinear = vec3(1.0) - abs(probe_to_pos);
float weight = ((trilinear.x * trilinear.y) * trilinear.z) * max(0.004999999888241291046142578125, dot(cam_normal, probe_dir));
if (sdfgi.use_occlusion != 0u)
{
ivec3 occ_indexv = abs((sdfgi.cascades[cascade].probe_world_offset + probe_posi) & ivec3(1)) * ivec3(1, 2, 4);
vec4 occ_mask = mix(vec4(0.0), vec4(1.0), equal(ivec4(occ_indexv.x | occ_indexv.y), ivec4(0, 1, 2, 3)));
vec3 occ_pos = clamp(cascade_pos, probe_pos - sdfgi.occlusion_clamp, probe_pos + sdfgi.occlusion_clamp) * sdfgi.probe_to_uvw;
occ_pos.z += float(cascade);
if (occ_indexv.z != 0)
{
occ_pos.x += 1.0;
}
occ_pos *= sdfgi.occlusion_renormalize;
float occlusion = dot(textureLod(sampler3D(occlusion_texture, linear_sampler), occ_pos, 0.0), occ_mask);
weight *= max(occlusion, 0.00999999977648258209228515625);
}
vec3 pos_uvw = diffuse_posf;
vec2 _556 = pos_uvw.xy + (vec2(offset.xy) * sdfgi.lightprobe_uv_offset.xy);
pos_uvw = vec3(_556.x, _556.y, pos_uvw.z);
pos_uvw.x += (float(offset.z) * sdfgi.lightprobe_uv_offset.z);
vec3 diffuse = textureLod(sampler2DArray(lightprobe_texture, linear_sampler), pos_uvw, 0.0).xyz;
diffuse_accum += vec4(diffuse * weight, weight);
vec3 specular = vec3(0.0);
vec3 pos_uvw_1 = specular_posf;
vec2 _602 = pos_uvw_1.xy + (vec2(offset.xy) * sdfgi.lightprobe_uv_offset.xy);
pos_uvw_1 = vec3(_602.x, _602.y, pos_uvw_1.z);
pos_uvw_1.x += (float(offset.z) * sdfgi.lightprobe_uv_offset.z);
if (roughness < 0.9900000095367431640625)
{
specular = textureLod(sampler2DArray(lightprobe_texture, linear_sampler), pos_uvw_1 + vec3(0.0, 0.0, float(sdfgi.max_cascades)), 0.0).xyz;
}
if (roughness > 0.20000000298023223876953125)
{
specular = mix(specular, textureLod(sampler2DArray(lightprobe_texture, linear_sampler), pos_uvw_1, 0.0).xyz, vec3((roughness - 0.20000000298023223876953125) * 1.25));
}
specular_accum += (specular * weight);
}
if (diffuse_accum.w > 0.0)
{
vec3 _666 = diffuse_accum.xyz / vec3(diffuse_accum.w);
diffuse_accum = vec4(_666.x, _666.y, _666.z, diffuse_accum.w);
}
diffuse_light = diffuse_accum.xyz;
if (diffuse_accum.w > 0.0)
{
specular_accum /= vec3(diffuse_accum.w);
}
specular_light = specular_accum;
}
void sdfgi_process(inout vec3 vertex, inout vec3 normal, inout vec3 reflection, float roughness, inout vec4 ambient_light, inout vec4 reflection_light)
{
vertex.y *= sdfgi.y_mult;
normal.y *= sdfgi.y_mult;
reflection.y *= sdfgi.y_mult;
normal = normalize(normal);
reflection = normalize(reflection);
vec3 cam_pos = vertex;
vec3 cam_normal = normal;
vec4 light_accum = vec4(0.0);
float weight_accum = 0.0;
vec4 light_blend_accum = vec4(0.0);
float weight_blend_accum = 0.0;
float blend = -1.0;
uint cascade = 4294967295u;
vec3 cascade_pos;
for (uint i = 0u; i < sdfgi.max_cascades; i++)
{
cascade_pos = (cam_pos - sdfgi.cascades[i].position) * sdfgi.cascades[i].to_probe;
bool _739 = any(lessThan(cascade_pos, vec3(0.0)));
bool _749;
if (!_739)
{
_749 = any(greaterThanEqual(cascade_pos, sdfgi.cascade_probe_size));
}
else
{
_749 = _739;
}
if (_749)
{
}
cascade = i;
break;
}
if (cascade < 8u)
{
ambient_light = vec4(0.0, 0.0, 0.0, 1.0);
reflection_light = vec4(0.0, 0.0, 0.0, 1.0);
uint param = cascade;
vec3 param_1 = cascade_pos;
vec3 param_2 = cam_pos;
vec3 param_3 = cam_normal;
vec3 param_4 = reflection;
float param_5 = roughness;
vec3 param_6;
vec3 param_7;
sdfgi_probe_process(param, param_1, param_2, param_3, param_4, param_5, param_6, param_7);
vec3 diffuse = param_6;
vec3 specular = param_7;
float blend_from = (float(sdfgi.probe_axis_size - 1) / 2.0) - 2.5;
float blend_to = blend_from + 2.0;
vec3 inner_pos = cam_pos * sdfgi.cascades[cascade].to_probe;
float len = length(inner_pos);
inner_pos = abs(normalize(inner_pos));
len *= max(inner_pos.x, max(inner_pos.y, inner_pos.z));
float blend_1;
if (len >= blend_from)
{
blend_1 = smoothstep(blend_from, blend_to, len);
}
else
{
blend_1 = 0.0;
}
if (blend_1 > 0.0)
{
if (cascade == (sdfgi.max_cascades - 1u))
{
ambient_light.w = 1.0 - blend_1;
reflection_light.w = 1.0 - blend_1;
}
else
{
cascade_pos = (cam_pos - sdfgi.cascades[cascade + 1u].position) * sdfgi.cascades[cascade + 1u].to_probe;
uint param_8 = cascade + 1u;
vec3 param_9 = cascade_pos;
vec3 param_10 = cam_pos;
vec3 param_11 = cam_normal;
vec3 param_12 = reflection;
float param_13 = roughness;
vec3 param_14;
vec3 param_15;
sdfgi_probe_process(param_8, param_9, param_10, param_11, param_12, param_13, param_14, param_15);
vec3 diffuse2 = param_14;
vec3 specular2 = param_15;
diffuse = mix(diffuse, diffuse2, vec3(blend_1));
specular = mix(specular, specular2, vec3(blend_1));
}
}
ambient_light = vec4(diffuse.x, diffuse.y, diffuse.z, ambient_light.w);
if (roughness < 0.20000000298023223876953125)
{
vec3 pos_to_uvw = vec3(1.0) / sdfgi.grid_size;
vec4 light_accum_1 = vec4(0.0);
float blend_size = (sdfgi.grid_size.x / float(sdfgi.probe_axis_size - 1)) * 0.5;
cascade = 65535u;
float base_distance = length(cam_pos);
float radius_sizes[8];
for (uint i_1 = 0u; i_1 < sdfgi.max_cascades; i_1++)
{
radius_sizes[i_1] = (1.0 / sdfgi.cascades[i_1].to_cell) * ((sdfgi.grid_size.x * 0.5) - blend_size);
bool _936 = cascade == 65535u;
bool _944;
if (_936)
{
_944 = base_distance < radius_sizes[i_1];
}
else
{
_944 = _936;
}
if (_944)
{
cascade = i_1;
}
}
cascade = min(cascade, (sdfgi.max_cascades - 1u));
float max_distance = radius_sizes[sdfgi.max_cascades - 1u];
vec3 ray_pos = cam_pos;
vec3 ray_dir = reflection;
float _968;
if (cascade > 0u)
{
_968 = radius_sizes[cascade - 1u];
}
else
{
_968 = 0.0;
}
float prev_radius = _968;
float base_blend = (base_distance - prev_radius) / (radius_sizes[cascade] - prev_radius);
float bias = (1.0 + base_blend) * 1.10000002384185791015625;
vec3 abs_ray_dir = abs(ray_dir);
ray_pos += (((((ray_dir * 1.0) / vec3(max(abs_ray_dir.x, max(abs_ray_dir.y, abs_ray_dir.z)))) + (cam_normal * 1.39999997615814208984375)) * bias) / vec3(sdfgi.cascades[cascade].to_cell));
float softness = 0.20000000298023223876953125 + (min(1.0, roughness * 5.0) * 4.0);
float _1203;
while (length(ray_pos) < max_distance)
{
for (uint i_2 = 0u; i_2 < sdfgi.max_cascades; i_2++)
{
bool _1049 = i_2 >= cascade;
bool _1058;
if (_1049)
{
_1058 = length(ray_pos) < radius_sizes[i_2];
}
else
{
_1058 = _1049;
}
if (_1058)
{
cascade = max(i_2, cascade);
vec3 pos = ray_pos - sdfgi.cascades[i_2].position;
pos *= (pos_to_uvw * sdfgi.cascades[i_2].to_cell);
float _distance = (textureLod(sampler3D(sdf_cascades[i_2], linear_sampler), pos, 0.0).x * 255.0) - 1.10000002384185791015625;
vec4 hit_light = vec4(0.0);
if (_distance < softness)
{
vec3 _1106 = textureLod(sampler3D(light_cascades[i_2], linear_sampler), pos, 0.0).xyz;
hit_light = vec4(_1106.x, _1106.y, _1106.z, hit_light.w);
vec3 _1111 = hit_light.xyz * 0.5;
hit_light = vec4(_1111.x, _1111.y, _1111.z, hit_light.w);
hit_light.w = clamp(1.0 - (_distance / softness), 0.0, 1.0);
vec3 _1124 = hit_light.xyz * hit_light.w;
hit_light = vec4(_1124.x, _1124.y, _1124.z, hit_light.w);
}
_distance /= sdfgi.cascades[i_2].to_cell;
if (i_2 < (sdfgi.max_cascades - 1u))
{
pos = ray_pos - sdfgi.cascades[i_2 + 1u].position;
pos *= (pos_to_uvw * sdfgi.cascades[i_2 + 1u].to_cell);
float distance2 = (textureLod(sampler3D(sdf_cascades[i_2 + 1u], linear_sampler), pos, 0.0).x * 255.0) - 1.10000002384185791015625;
vec4 hit_light2 = vec4(0.0);
if (distance2 < softness)
{
vec3 _1179 = textureLod(sampler3D(light_cascades[i_2 + 1u], linear_sampler), pos, 0.0).xyz;
hit_light2 = vec4(_1179.x, _1179.y, _1179.z, hit_light2.w);
vec3 _1184 = hit_light2.xyz * 0.5;
hit_light2 = vec4(_1184.x, _1184.y, _1184.z, hit_light2.w);
hit_light2.w = clamp(1.0 - (distance2 / softness), 0.0, 1.0);
vec3 _1197 = hit_light2.xyz * hit_light2.w;
hit_light2 = vec4(_1197.x, _1197.y, _1197.z, hit_light2.w);
}
if (i_2 == 0u)
{
_1203 = 0.0;
}
else
{
_1203 = radius_sizes[i_2 - 1u];
}
float prev_radius_1 = _1203;
float blend_2 = clamp((length(ray_pos) - prev_radius_1) / (radius_sizes[i_2] - prev_radius_1), 0.0, 1.0);
distance2 /= sdfgi.cascades[i_2 + 1u].to_cell;
hit_light = mix(hit_light, hit_light2, vec4(blend_2));
_distance = mix(_distance, distance2, blend_2);
}
light_accum_1 += hit_light;
ray_pos += (ray_dir * _distance);
break;
}
}
if (light_accum_1.w > 0.9900000095367431640625)
{
break;
}
}
vec3 light = light_accum_1.xyz / vec3(max(light_accum_1.w, 9.9999997473787516355514526367188e-06));
float alpha = min(1.0, light_accum_1.w);
float b = min(1.0, roughness * 5.0);
float sa = 1.0 - b;
reflection_light.w = (alpha * sa) + b;
if (reflection_light.w == 0.0)
{
specular = vec3(0.0);
}
else
{
specular = (((light * alpha) * sa) + (specular * b)) / vec3(reflection_light.w);
}
}
reflection_light = vec4(specular.x, specular.y, specular.z, reflection_light.w);
vec3 _1308 = ambient_light.xyz * sdfgi.energy;
ambient_light = vec4(_1308.x, _1308.y, _1308.z, ambient_light.w);
vec3 _1315 = reflection_light.xyz * sdfgi.energy;
reflection_light = vec4(_1315.x, _1315.y, _1315.z, reflection_light.w);
}
else
{
ambient_light = vec4(0.0);
reflection_light = vec4(0.0);
}
}
vec4 voxel_cone_trace(texture3D probe, vec3 cell_size, vec3 pos, vec3 direction, float tan_half_angle, float max_distance, float p_bias)
{
float dist = p_bias;
vec4 color = vec4(0.0);
for (;;)
{
bool _1329 = dist < max_distance;
bool _1336;
if (_1329)
{
_1336 = color.w < 0.949999988079071044921875;
}
else
{
_1336 = _1329;
}
if (_1336)
{
float diameter = max(1.0, (2.0 * tan_half_angle) * dist);
vec3 uvw_pos = (pos + (direction * dist)) * cell_size;
float half_diameter = diameter * 0.5;
if (any(greaterThan(abs(uvw_pos - vec3(0.5)), vec3(vec3(0.5) + (cell_size * half_diameter)))))
{
break;
}
vec4 scolor = textureLod(sampler3D(probe, linear_sampler_with_mipmaps), uvw_pos, log2(diameter));
float a = 1.0 - color.w;
color += (scolor * a);
dist += half_diameter;
continue;
}
else
{
break;
}
}
return color;
}
vec4 voxel_cone_trace_45_degrees(texture3D probe, vec3 cell_size, vec3 pos, vec3 direction, float max_distance, float p_bias)
{
float dist = p_bias;
vec4 color = vec4(0.0);
float radius = max(0.5, dist);
float lod_level = log2(radius * 2.0);
for (;;)
{
bool _1413 = dist < max_distance;
bool _1419;
if (_1413)
{
_1419 = color.w < 0.949999988079071044921875;
}
else
{
_1419 = _1413;
}
if (_1419)
{
vec3 uvw_pos = (pos + (direction * dist)) * cell_size;
if (any(greaterThan(abs(uvw_pos - vec3(0.5)), vec3(vec3(0.5) + (cell_size * radius)))))
{
break;
}
vec4 scolor = textureLod(sampler3D(probe, linear_sampler_with_mipmaps), uvw_pos, lod_level);
lod_level += 1.0;
float a = 1.0 - color.w;
scolor *= a;
color += scolor;
dist += radius;
radius = max(0.5, dist);
continue;
}
else
{
break;
}
}
return color;
}
void gi_probe_compute(uint index, inout vec3 position, inout vec3 normal, inout vec3 ref_vec, mat3 normal_xform, float roughness, inout vec4 out_spec, inout vec4 out_diff, inout float out_blend)
{
position = (gi_probes.data[index].xform * vec4(position, 1.0)).xyz;
ref_vec = normalize((gi_probes.data[index].xform * vec4(ref_vec, 0.0)).xyz);
normal = normalize((gi_probes.data[index].xform * vec4(normal, 0.0)).xyz);
position += (normal * gi_probes.data[index].normal_bias);
if (any(bvec2(any(lessThan(position, vec3(0.0))), any(greaterThan(position, gi_probes.data[index].bounds)))))
{
return;
}
mat3 dir_xform = mat3(gi_probes.data[index].xform[0].xyz, gi_probes.data[index].xform[1].xyz, gi_probes.data[index].xform[2].xyz) * normal_xform;
vec3 blendv = abs(((position / gi_probes.data[index].bounds) * 2.0) - vec3(1.0));
float blend = clamp(1.0 - max(blendv.x, max(blendv.y, blendv.z)), 0.0, 1.0);
float max_distance = length(gi_probes.data[index].bounds);
vec3 cell_size = vec3(1.0) / gi_probes.data[index].bounds;
vec4 light = vec4(0.0);
if (params.high_quality_vct != 0u)
{
float cone_angle_tan = 0.57700002193450927734375;
for (uint i = 0u; i < 6u; i++)
{
vec3 dir = normalize(dir_xform * _1602[i]);
vec3 param = cell_size;
vec3 param_1 = position;
vec3 param_2 = dir;
float param_3 = cone_angle_tan;
float param_4 = max_distance;
float param_5 = gi_probes.data[index].bias;
light += (voxel_cone_trace(gi_probe_textures[index], param, param_1, param_2, param_3, param_4, param_5) * _1608[i]);
}
}
else
{
for (int i_1 = 0; uint(i_1) < 4u; i_1++)
{
vec3 dir_1 = normalize(dir_xform * _1663[i_1]);
vec3 param_6 = cell_size;
vec3 param_7 = position;
vec3 param_8 = dir_1;
float param_9 = max_distance;
float param_10 = gi_probes.data[index].bias;
light += (voxel_cone_trace_45_degrees(gi_probe_textures[index], param_6, param_7, param_8, param_9, param_10) * _1667[i_1]);
}
}
if (gi_probes.data[index].ambient_occlusion > 0.001000000047497451305389404296875)
{
float size = 1.0 + (gi_probes.data[index].ambient_occlusion_size * 7.0);
float taps;
float _1724 = modf(size, taps);
float blend_1 = _1724;
float ao = 0.0;
for (float i_2 = 1.0; i_2 <= taps; i_2 += 1.0)
{
vec3 ofs = (position + (normal * ((i_2 * 0.5) + 1.0))) * cell_size;
ao += (textureLod(sampler3D(gi_probe_textures[index], linear_sampler_with_mipmaps), ofs, i_2 - 1.0).w * i_2);
}
if (blend_1 > 0.001000000047497451305389404296875)
{
vec3 ofs_1 = (position + (normal * (((taps + 1.0) * 0.5) + 1.0))) * cell_size;
ao += ((textureLod(sampler3D(gi_probe_textures[index], linear_sampler_with_mipmaps), ofs_1, taps).w * (taps + 1.0)) * blend_1);
}
ao = 1.0 - min(1.0, ao);
vec3 _1806 = mix(params.ao_color, light.xyz, vec3(mix(1.0, ao, gi_probes.data[index].ambient_occlusion)));
light = vec4(_1806.x, _1806.y, _1806.z, light.w);
}
vec3 _1814 = light.xyz * gi_probes.data[index].dynamic_range;
light = vec4(_1814.x, _1814.y, _1814.z, light.w);
if (!(gi_probes.data[index].blend_ambient != 0u))
{
light.w = 1.0;
}
out_diff += (light * blend);
vec3 param_11 = cell_size;
vec3 param_12 = position;
vec3 param_13 = ref_vec;
float param_14 = tan(((roughness * 0.5) * 3.1415920257568359375) * 0.9900000095367431640625);
float param_15 = max_distance;
float param_16 = gi_probes.data[index].bias;
vec4 irr_light = voxel_cone_trace(gi_probe_textures[index], param_11, param_12, param_13, param_14, param_15, param_16);
vec3 _1858 = irr_light.xyz * gi_probes.data[index].dynamic_range;
irr_light = vec4(_1858.x, _1858.y, _1858.z, irr_light.w);
if (!(gi_probes.data[index].blend_ambient != 0u))
{
irr_light.w = 1.0;
}
out_spec += (irr_light * blend);
out_blend += blend;
}
vec4 blend_color(vec4 src, vec4 dst)
{
float sa = 1.0 - src.w;
vec4 res;
res.w = (dst.w * sa) + src.w;
if (res.w == 0.0)
{
res = vec4(vec3(0.0).x, vec3(0.0).y, vec3(0.0).z, res.w);
}
else
{
vec3 _203 = (((dst.xyz * dst.w) * sa) + (src.xyz * src.w)) / vec3(res.w);
res = vec4(_203.x, _203.y, _203.z, res.w);
}
return res;
}
void main()
{
ivec2 pos = ivec2(gl_GlobalInvocationID.xy);
if (any(greaterThanEqual(pos, params.screen_size)))
{
return;
}
ivec2 param = pos;
vec3 vertex = reconstruct_position(param);
vertex.y = -vertex.y;
ivec2 param_1 = pos;
vec4 normal_roughness = fetch_normal_and_roughness(param_1);
vec3 normal = normal_roughness.xyz;
vec4 ambient_light = vec4(0.0);
vec4 reflection_light = vec4(0.0);
if (true)
{
float roughness = normal_roughness.w;
vertex = mat3(params.cam_rotation[0].xyz, params.cam_rotation[1].xyz, params.cam_rotation[2].xyz) * vertex;
normal = normalize(mat3(params.cam_rotation[0].xyz, params.cam_rotation[1].xyz, params.cam_rotation[2].xyz) * normal);
vec3 reflection = normalize(reflect(normalize(vertex), normal));
if (params.use_sdfgi != 0u)
{
vec3 param_2 = vertex;
vec3 param_3 = normal;
vec3 param_4 = reflection;
float param_5 = roughness;
vec4 param_6;
vec4 param_7;
sdfgi_process(param_2, param_3, param_4, param_5, param_6, param_7);
ambient_light = param_6;
reflection_light = param_7;
}
if (params.max_giprobes > 0u)
{
uvec2 giprobe_tex = texelFetch(usampler2D(giprobe_buffer, linear_sampler), pos, 0).xy;
roughness *= roughness;
vec3 v0 = mix(vec3(0.0, 1.0, 0.0), vec3(0.0, 0.0, 1.0), bvec3(abs(normal.z) < 0.999000012874603271484375));
vec3 tangent = normalize(cross(v0, normal));
vec3 bitangent = normalize(cross(tangent, normal));
mat3 normal_mat = mat3(vec3(tangent), vec3(bitangent), vec3(normal));
vec4 amb_accum = vec4(0.0);
vec4 spec_accum = vec4(0.0);
float blend_accum = 0.0;
for (uint i = 0u; i < params.max_giprobes; i++)
{
if (any(equal(uvec2(i), giprobe_tex)))
{
uint param_8 = i;
vec3 param_9 = vertex;
vec3 param_10 = normal;
vec3 param_11 = reflection;
mat3 param_12 = normal_mat;
float param_13 = roughness;
vec4 param_14 = spec_accum;
vec4 param_15 = amb_accum;
float param_16 = blend_accum;
gi_probe_compute(param_8, param_9, param_10, param_11, param_12, param_13, param_14, param_15, param_16);
spec_accum = param_14;
amb_accum = param_15;
blend_accum = param_16;
}
}
if (blend_accum > 0.0)
{
amb_accum /= vec4(blend_accum);
spec_accum /= vec4(blend_accum);
}
if (params.use_sdfgi != 0u)
{
vec4 param_17 = spec_accum;
vec4 param_18 = reflection_light;
reflection_light = blend_color(param_17, param_18);
vec4 param_19 = amb_accum;
vec4 param_20 = ambient_light;
ambient_light = blend_color(param_19, param_20);
}
else
{
reflection_light = spec_accum;
ambient_light = amb_accum;
}
}
}
imageStore(ambient_buffer, pos, ambient_light);
imageStore(reflection_buffer, pos, reflection_light);
}
End GLSL
[mvk-info] Shader library compilation succeeded with warnings (Error code 4):
Compilation succeeded with:
program_source:200:11: warning: unused variable 'weight_accum'
float weight_accum = 0.0;
^
program_source:199:12: warning: unused variable 'light_accum'
float4 light_accum = float4(0.0);
^
program_source:270:12: warning: unused variable 'light_accum'
float4 light_accum = float4(0.0);
^
program_source:272:12: warning: unused variable 'light_blend_accum'
float4 light_blend_accum = float4(0.0);
^
program_source:274:11: warning: unused variable 'blend'
float blend = -1.0;
^
program_source:273:11: warning: unused variable 'weight_blend_accum'
float weight_blend_accum = 0.0;
^
program_source:271:11: warning: unused variable 'weight_accum'
float weight_accum = 0.0;
^
2020-07-22 17:24:04.327444+0300 godot_app[352:15455] Compiler failed with XPC_ERROR_CONNECTION_INTERRUPTED
2020-07-22 17:24:04.399405+0300 godot_app[352:15455] Compiler failed with XPC_ERROR_CONNECTION_INTERRUPTED
2020-07-22 17:24:04.470131+0300 godot_app[352:15455] Compiler failed with XPC_ERROR_CONNECTION_INTERRUPTED
2020-07-22 17:24:04.470267+0300 godot_app[352:15455] MTLCompiler: Compilation failed with XPC_ERROR_CONNECTION_INTERRUPTED on 3 try
2020-07-22 17:24:04.470809+0300 godot_app[352:15453] Compiler failed with XPC_ERROR_CONNECTION_INTERRUPTED
2020-07-22 17:24:14.593353+0300 godot_app[352:15453] Compiler failed with XPC_ERROR_CONNECTION_INTERRUPTED
2020-07-22 17:24:24.681765+0300 godot_app[352:15592] Compiler failed with XPC_ERROR_CONNECTION_INTERRUPTED
2020-07-22 17:24:24.681878+0300 godot_app[352:15592] MTLCompiler: Compilation failed with XPC_ERROR_CONNECTION_INTERRUPTED on 3 try
[mvk-error] VK_ERROR_INITIALIZATION_FAILED: Compute pipeline compile failed (Error code 3):
Compiler encountered an internal error.
2020-07-22 17:24:24.682262+0300 godot_app[352:15310] ERROR: - Message Id Number: 0 | Message Id Name:
VK_ERROR_INITIALIZATION_FAILED: Compute pipeline compile failed (Error code 3):
Compiler encountered an internal error.
Objects - 1
Object[0] - VK_OBJECT_TYPE_PIPELINE, Handle 10785457664
2020-07-22 17:24:24.682304+0300 godot_app[352:15310] at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:136) - - Message Id Number: 0 | Message Id Name:
VK_ERROR_INITIALIZATION_FAILED: Compute pipeline compile failed (Error code 3):
Compiler encountered an internal error.
Objects - 1
Object[0] - VK_OBJECT_TYPE_PIPELINE, Handle 10785457664
ERROR: - Message Id Number: 0 | Message Id Name:
VK_ERROR_INITIALIZATION_FAILED: Compute pipeline compile failed (Error code 3):
Compiler encountered an internal error.
Objects - 1
Object[0] - VK_OBJECT_TYPE_PIPELINE, Handle 10785457664
at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:136) - - Message Id Number: 0 | Message Id Name:
VK_ERROR_INITIALIZATION_FAILED: Compute pipeline compile failed (Error code 3):
Compiler encountered an internal error.
Objects - 1
Object[0] - VK_OBJECT_TYPE_PIPELINE, Handle 10785457664
2020-07-22 17:24:24.682474+0300 godot_app[352:15310] ERROR: vkCreateComputePipelines failed with error -3.
2020-07-22 17:24:24.682504+0300 godot_app[352:15310] at: compute_pipeline_create (drivers/vulkan/rendering_device_vulkan.cpp:5378) - Condition "err" is true. Returning: RID()
ERROR: vkCreateComputePipelines failed with error -3.
at: compute_pipeline_create (drivers/vulkan/rendering_device_vulkan.cpp:5378) - Condition "err" is true. Returning: RID()