@@ -23,50 +23,52 @@ describe('jump flood example', () => {
2323
2424 @group(1) @binding(0) var writeView_3: texture_storage_2d_array<rgba16float, write>;
2525
26- var<private> seed_6: vec2f ;
26+ @group(0) @binding(1) var<uniform> timeUniform_4: f32 ;
2727
28- fn seed2_5(value: vec2f) {
29- seed_6 = value;
28+ var<private> seed_7: vec2f;
29+
30+ fn seed2_6(value: vec2f) {
31+ seed_7 = value;
3032 }
3133
32- fn randSeed2_4 (seed: vec2f) {
33- seed2_5 (seed);
34+ fn randSeed2_5 (seed: vec2f) {
35+ seed2_6 (seed);
3436 }
3537
36- fn item_8 () -> f32 {
37- let a = dot(seed_6 , vec2f(23.140779495239258, 232.6168975830078));
38- let b = dot(seed_6 , vec2f(54.47856521606445, 345.8415222167969));
39- seed_6 .x = fract((cos(a) * 136.8168f));
40- seed_6 .y = fract((cos(b) * 534.7645f));
41- return seed_6 .y;
38+ fn item_9 () -> f32 {
39+ let a = dot(seed_7 , vec2f(23.140779495239258, 232.6168975830078));
40+ let b = dot(seed_7 , vec2f(54.47856521606445, 345.8415222167969));
41+ seed_7 .x = fract((cos(a) * 136.8168f));
42+ seed_7 .y = fract((cos(b) * 534.7645f));
43+ return seed_7 .y;
4244 }
4345
44- fn randFloat01_7 () -> f32 {
45- return item_8 ();
46+ fn randFloat01_8 () -> f32 {
47+ return item_9 ();
4648 }
4749
48- @group(0) @binding(1 ) var<uniform> seedThresholdUniform_9 : f32;
50+ @group(0) @binding(2 ) var<uniform> seedThresholdUniform_10 : f32;
4951
50- const palette_10 : array<vec3f, 4> = array<vec3f, 4>(vec3f(0.9215686321258545, 0.8117647171020508, 1), vec3f(0.7176470756530762, 0.545098066329956, 0.9803921580314636), vec3f(0.545098066329956, 0.3607843220233917, 0.9647058844566345), vec3f(0.4274509847164154, 0.2666666805744171, 0.9490196108818054));
52+ const palette_11 : array<vec3f, 4> = array<vec3f, 4>(vec3f(0.9215686321258545, 0.8117647171020508, 1), vec3f(0.7176470756530762, 0.545098066329956, 0.9803921580314636), vec3f(0.545098066329956, 0.3607843220233917, 0.9647058844566345), vec3f(0.4274509847164154, 0.2666666805744171, 0.9490196108818054));
5153
5254 fn wrappedCallback_2(x: u32, y: u32, _arg_2: u32) {
5355 var size = textureDimensions(writeView_3);
54- randSeed2_4(( vec2f(f32(x), f32(y)) / vec2f(size)));
55- let randomVal = randFloat01_7 ();
56- let isSeed = (randomVal >= seedThresholdUniform_9 );
57- let paletteColor = palette_10 [u32(floor((randFloat01_7 () * 4f)))];
58- var variation = (vec3f((randFloat01_7 () - 0.5f), (randFloat01_7 () - 0.5f), (randFloat01_7 () - 0.5f)) * 0.15);
56+ randSeed2_5((( vec2f(f32(x), f32(y)) / vec2f(size)) + timeUniform_4 ));
57+ let randomVal = randFloat01_8 ();
58+ let isSeed = (randomVal >= seedThresholdUniform_10 );
59+ let paletteColor = palette_11 [u32(floor((randFloat01_8 () * 4f)))];
60+ var variation = (vec3f((randFloat01_8 () - 0.5f), (randFloat01_8 () - 0.5f), (randFloat01_8 () - 0.5f)) * 0.15);
5961 var color = select(vec4f(), vec4f(saturate((paletteColor + variation)), 1f), isSeed);
6062 var coord = select(vec2f(-1), (vec2f(f32(x), f32(y)) / vec2f(size)), isSeed);
6163 textureStore(writeView_3, vec2i(i32(x), i32(y)), 0, color);
6264 textureStore(writeView_3, vec2i(i32(x), i32(y)), 1, vec4f(coord, 0f, 0f));
6365 }
6466
65- struct mainCompute_Input_11 {
67+ struct mainCompute_Input_12 {
6668 @builtin(global_invocation_id) id: vec3u,
6769 }
6870
69- @compute @workgroup_size(16, 16, 1) fn mainCompute_0(in: mainCompute_Input_11 ) {
71+ @compute @workgroup_size(16, 16, 1) fn mainCompute_0(in: mainCompute_Input_12 ) {
7072 if (any(in.id >= sizeUniform_1)) {
7173 return;
7274 }
@@ -89,16 +91,16 @@ describe('jump flood example', () => {
8991 return fullScreenTriangle_Output_2(vec4f(pos[in.vertexIndex], 0, 1), uv[in.vertexIndex]);
9092 }
9193
92- @group(1 ) @binding(0) var floodTexture_4: texture_2d<f32>;
94+ @group(0 ) @binding(0) var floodTexture_4: texture_2d<f32>;
9395
94- @group(0) @binding(0 ) var filteringSampler_5 : sampler;
96+ @group(0) @binding(1 ) var sampler_5 : sampler;
9597
96- struct sampleFrag_Input_6 {
98+ struct voronoiFrag_Input_6 {
9799 @location(0) uv: vec2f,
98100 }
99101
100- @fragment fn sampleFrag_3 (_arg_0: sampleFrag_Input_6 ) -> @location(0) vec4f {
101- return textureSample(floodTexture_4, filteringSampler_5 , _arg_0.uv);
102+ @fragment fn voronoiFrag_3 (_arg_0: voronoiFrag_Input_6 ) -> @location(0) vec4f {
103+ return textureSample(floodTexture_4, sampler_5 , _arg_0.uv);
102104 }
103105
104106 @group(0) @binding(0) var<uniform> sizeUniform_1: vec3u;
0 commit comments