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