Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ function(add_shader FILE)
package(${SPV})
endfunction()
add_shader(add1.comp)
add_shader(add2.comp src/config.hpp)
add_shader(advect1.comp src/config.hpp shaders/shader.glsl)
add_shader(advect2.comp src/config.hpp shaders/shader.glsl)
add_shader(bnd1.comp src/config.hpp)
Expand Down
4 changes: 2 additions & 2 deletions samples/1.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Diffusion": 0.009999999776482582,
"Diffusion": 0.000004,
"Iterations": 5,
"Size": 128,
"Spawners": [
Expand All @@ -22,5 +22,5 @@
"Value": 1.0
}
],
"Viscosity": 0.009999999776482582
"Viscosity": 0.000004
}
4 changes: 2 additions & 2 deletions samples/10.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Diffusion": 0.009999999776482582,
"Diffusion": 0.000004,
"Iterations": 5,
"Size": 128,
"Spawners": [
Expand Down Expand Up @@ -31,5 +31,5 @@
"Value": 8.0
}
],
"Viscosity": 0.009999999776482582
"Viscosity": 0.000004
}
4 changes: 2 additions & 2 deletions samples/11.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Diffusion": 0.12800000607967377,
"Diffusion": 0.0000512,
"Iterations": 5,
"Size": 128,
"Spawners": [
Expand Down Expand Up @@ -31,5 +31,5 @@
"Value": -618.0
}
],
"Viscosity": 0.009999999776482582
"Viscosity": 0.000004
}
4 changes: 2 additions & 2 deletions samples/2.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Diffusion": 0.12800000607967377,
"Diffusion": 0.0000512,
"Iterations": 10,
"Size": 128,
"Spawners": [
Expand Down Expand Up @@ -31,5 +31,5 @@
"Value": 2.0
}
],
"Viscosity": 0.009999999776482582
"Viscosity": 0.000004
}
4 changes: 2 additions & 2 deletions samples/3.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Diffusion": 0.12800000607967377,
"Diffusion": 0.0000512,
"Iterations": 10,
"Size": 128,
"Spawners": [
Expand Down Expand Up @@ -31,5 +31,5 @@
"Value": 1.0
}
],
"Viscosity": 0.009999999776482582
"Viscosity": 0.000004
}
4 changes: 2 additions & 2 deletions samples/4.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Diffusion": 0.12800000607967377,
"Diffusion": 0.0000512,
"Iterations": 7,
"Size": 128,
"Spawners": [
Expand Down Expand Up @@ -31,5 +31,5 @@
"Value": 2.0
}
],
"Viscosity": 0.009999999776482582
"Viscosity": 0.000004
}
4 changes: 2 additions & 2 deletions samples/5.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Diffusion": 0.12800000607967377,
"Diffusion": 0.0000512,
"Iterations": 5,
"Size": 128,
"Spawners": [
Expand Down Expand Up @@ -40,5 +40,5 @@
"Value": 65.0
}
],
"Viscosity": 0.009999999776482582
"Viscosity": 0.000004
}
4 changes: 2 additions & 2 deletions samples/6.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Diffusion": 0.12800000607967377,
"Diffusion": 0.0000512,
"Iterations": 7,
"Size": 128,
"Spawners": [
Expand Down Expand Up @@ -40,5 +40,5 @@
"Value": 1.0
}
],
"Viscosity": 0.009999999776482582
"Viscosity": 0.000004
}
4 changes: 2 additions & 2 deletions samples/7.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Diffusion": 0.08799999952316284,
"Diffusion": 0.0000352,
"Iterations": 3,
"Size": 128,
"Spawners": [
Expand Down Expand Up @@ -40,5 +40,5 @@
"Value": 2.0
}
],
"Viscosity": 0.16500000655651093
"Viscosity": 0.000066
}
4 changes: 2 additions & 2 deletions samples/8.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Diffusion": 0.12800000607967377,
"Diffusion": 0.0000512,
"Iterations": 7,
"Size": 128,
"Spawners": [
Expand Down Expand Up @@ -40,5 +40,5 @@
"Value": -2.0
}
],
"Viscosity": 0.009999999776482582
"Viscosity": 0.000004
}
4 changes: 2 additions & 2 deletions samples/9.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Diffusion": 0.12800000607967377,
"Diffusion": 0.0000512,
"Iterations": 5,
"Size": 128,
"Spawners": [
Expand Down Expand Up @@ -49,5 +49,5 @@
"Value": 2.0
}
],
"Viscosity": 0.009999999776482582
"Viscosity": 0.000004
}
2 changes: 1 addition & 1 deletion shaders/add1.comp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#version 450

layout(local_size_x = 1) in;
layout(set = 1, binding = 0, rgba32f) uniform image3D inOutImage;
layout(set = 1, binding = 0, r32f) uniform image3D inOutImage;
layout(set = 2, binding = 0) uniform uniformPosition
{
ivec3 position;
Expand Down
22 changes: 0 additions & 22 deletions shaders/add2.comp

This file was deleted.

2 changes: 1 addition & 1 deletion shaders/advect1.comp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ layout(local_size_x = THREADS, local_size_y = THREADS, local_size_z = THREADS) i
layout(set = 0, binding = 0) uniform sampler3D inVelocityX;
layout(set = 0, binding = 1) uniform sampler3D inVelocityY;
layout(set = 0, binding = 2) uniform sampler3D inVelocityZ;
layout(set = 1, binding = 0, rgba32f) uniform writeonly image3D outVelocity;
layout(set = 1, binding = 0, r32f) uniform writeonly image3D outVelocity;
layout(set = 2, binding = 0) uniform uniformVelocity
{
uint velocity;
Expand Down
2 changes: 1 addition & 1 deletion shaders/advect2.comp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ layout(set = 0, binding = 0) uniform sampler3D inDensity;
layout(set = 0, binding = 1) uniform sampler3D inVelocityX;
layout(set = 0, binding = 2) uniform sampler3D inVelocityY;
layout(set = 0, binding = 3) uniform sampler3D inVelocityZ;
layout(set = 1, binding = 0, rgba32f) uniform writeonly image3D outDensity;
layout(set = 1, binding = 0, r32f) uniform writeonly image3D outDensity;
layout(set = 2, binding = 0) uniform uniformDeltaTime
{
float deltaTime;
Expand Down
Binary file modified shaders/bin/add1.comp.spv
Binary file not shown.
1 change: 0 additions & 1 deletion shaders/bin/add2.comp.json

This file was deleted.

40 changes: 0 additions & 40 deletions shaders/bin/add2.comp.msl

This file was deleted.

Binary file removed shaders/bin/add2.comp.spv
Binary file not shown.
30 changes: 15 additions & 15 deletions shaders/bin/advect1.comp.msl
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ kernel void main0(constant uniformVelocity& _48 [[buffer(0)]], constant uniformD
do
{
float N = float(size.x - 2);
float dtx = _71.deltaTime * (N - 2.0);
float dty = _71.deltaTime * (N - 2.0);
float dtz = _71.deltaTime * (N - 2.0);
float dtx = _71.deltaTime * N;
float dty = _71.deltaTime * N;
float dtz = _71.deltaTime * N;
float tmp1 = dtx * inVelocityX.read(uint3(id), 0).x;
float tmp2 = dty * inVelocityY.read(uint3(id), 0).x;
float tmp3 = dtz * inVelocityZ.read(uint3(id), 0).x;
Expand All @@ -65,8 +65,8 @@ kernel void main0(constant uniformVelocity& _48 [[buffer(0)]], constant uniformD
int j1i = int(j1);
int k0i = int(k0);
int k1i = int(k1);
float4 _310 = float4((s0 * ((t0 * ((u0 * inVelocityX.read(uint3(int3(i0i, j0i, k0i)), 0).x) + (u1 * inVelocityX.read(uint3(int3(i0i, j0i, k1i)), 0).x))) + (t1 * ((u0 * inVelocityX.read(uint3(int3(i0i, j1i, k0i)), 0).x) + (u1 * inVelocityX.read(uint3(int3(i0i, j1i, k1i)), 0).x))))) + (s1 * ((t0 * ((u0 * inVelocityX.read(uint3(int3(i1i, j0i, k0i)), 0).x) + (u1 * inVelocityX.read(uint3(int3(i1i, j0i, k1i)), 0).x))) + (t1 * ((u0 * inVelocityX.read(uint3(int3(i1i, j1i, k0i)), 0).x) + (u1 * inVelocityX.read(uint3(int3(i1i, j1i, k1i)), 0).x))))));
outVelocity.write(_310, uint3(id));
float4 _306 = float4((s0 * ((t0 * ((u0 * inVelocityX.read(uint3(int3(i0i, j0i, k0i)), 0).x) + (u1 * inVelocityX.read(uint3(int3(i0i, j0i, k1i)), 0).x))) + (t1 * ((u0 * inVelocityX.read(uint3(int3(i0i, j1i, k0i)), 0).x) + (u1 * inVelocityX.read(uint3(int3(i0i, j1i, k1i)), 0).x))))) + (s1 * ((t0 * ((u0 * inVelocityX.read(uint3(int3(i1i, j0i, k0i)), 0).x) + (u1 * inVelocityX.read(uint3(int3(i1i, j0i, k1i)), 0).x))) + (t1 * ((u0 * inVelocityX.read(uint3(int3(i1i, j1i, k0i)), 0).x) + (u1 * inVelocityX.read(uint3(int3(i1i, j1i, k1i)), 0).x))))));
outVelocity.write(_306, uint3(id));
} while (false);
}
else
Expand All @@ -76,9 +76,9 @@ kernel void main0(constant uniformVelocity& _48 [[buffer(0)]], constant uniformD
do
{
float N_1 = float(size.x - 2);
float dtx_1 = _71.deltaTime * (N_1 - 2.0);
float dty_1 = _71.deltaTime * (N_1 - 2.0);
float dtz_1 = _71.deltaTime * (N_1 - 2.0);
float dtx_1 = _71.deltaTime * N_1;
float dty_1 = _71.deltaTime * N_1;
float dtz_1 = _71.deltaTime * N_1;
float tmp1_1 = dtx_1 * inVelocityX.read(uint3(id), 0).x;
float tmp2_1 = dty_1 * inVelocityY.read(uint3(id), 0).x;
float tmp3_1 = dtz_1 * inVelocityZ.read(uint3(id), 0).x;
Expand All @@ -103,8 +103,8 @@ kernel void main0(constant uniformVelocity& _48 [[buffer(0)]], constant uniformD
int j1i_1 = int(j1_1);
int k0i_1 = int(k0_1);
int k1i_1 = int(k1_1);
float4 _554 = float4((s0_1 * ((t0_1 * ((u0_1 * inVelocityY.read(uint3(int3(i0i_1, j0i_1, k0i_1)), 0).x) + (u1_1 * inVelocityY.read(uint3(int3(i0i_1, j0i_1, k1i_1)), 0).x))) + (t1_1 * ((u0_1 * inVelocityY.read(uint3(int3(i0i_1, j1i_1, k0i_1)), 0).x) + (u1_1 * inVelocityY.read(uint3(int3(i0i_1, j1i_1, k1i_1)), 0).x))))) + (s1_1 * ((t0_1 * ((u0_1 * inVelocityY.read(uint3(int3(i1i_1, j0i_1, k0i_1)), 0).x) + (u1_1 * inVelocityY.read(uint3(int3(i1i_1, j0i_1, k1i_1)), 0).x))) + (t1_1 * ((u0_1 * inVelocityY.read(uint3(int3(i1i_1, j1i_1, k0i_1)), 0).x) + (u1_1 * inVelocityY.read(uint3(int3(i1i_1, j1i_1, k1i_1)), 0).x))))));
outVelocity.write(_554, uint3(id));
float4 _547 = float4((s0_1 * ((t0_1 * ((u0_1 * inVelocityY.read(uint3(int3(i0i_1, j0i_1, k0i_1)), 0).x) + (u1_1 * inVelocityY.read(uint3(int3(i0i_1, j0i_1, k1i_1)), 0).x))) + (t1_1 * ((u0_1 * inVelocityY.read(uint3(int3(i0i_1, j1i_1, k0i_1)), 0).x) + (u1_1 * inVelocityY.read(uint3(int3(i0i_1, j1i_1, k1i_1)), 0).x))))) + (s1_1 * ((t0_1 * ((u0_1 * inVelocityY.read(uint3(int3(i1i_1, j0i_1, k0i_1)), 0).x) + (u1_1 * inVelocityY.read(uint3(int3(i1i_1, j0i_1, k1i_1)), 0).x))) + (t1_1 * ((u0_1 * inVelocityY.read(uint3(int3(i1i_1, j1i_1, k0i_1)), 0).x) + (u1_1 * inVelocityY.read(uint3(int3(i1i_1, j1i_1, k1i_1)), 0).x))))));
outVelocity.write(_547, uint3(id));
} while (false);
}
else
Expand All @@ -114,9 +114,9 @@ kernel void main0(constant uniformVelocity& _48 [[buffer(0)]], constant uniformD
do
{
float N_2 = float(size.x - 2);
float dtx_2 = _71.deltaTime * (N_2 - 2.0);
float dty_2 = _71.deltaTime * (N_2 - 2.0);
float dtz_2 = _71.deltaTime * (N_2 - 2.0);
float dtx_2 = _71.deltaTime * N_2;
float dty_2 = _71.deltaTime * N_2;
float dtz_2 = _71.deltaTime * N_2;
float tmp1_2 = dtx_2 * inVelocityX.read(uint3(id), 0).x;
float tmp2_2 = dty_2 * inVelocityY.read(uint3(id), 0).x;
float tmp3_2 = dtz_2 * inVelocityZ.read(uint3(id), 0).x;
Expand All @@ -141,8 +141,8 @@ kernel void main0(constant uniformVelocity& _48 [[buffer(0)]], constant uniformD
int j1i_2 = int(j1_2);
int k0i_2 = int(k0_2);
int k1i_2 = int(k1_2);
float4 _797 = float4((s0_2 * ((t0_2 * ((u0_2 * inVelocityZ.read(uint3(int3(i0i_2, j0i_2, k0i_2)), 0).x) + (u1_2 * inVelocityZ.read(uint3(int3(i0i_2, j0i_2, k1i_2)), 0).x))) + (t1_2 * ((u0_2 * inVelocityZ.read(uint3(int3(i0i_2, j1i_2, k0i_2)), 0).x) + (u1_2 * inVelocityZ.read(uint3(int3(i0i_2, j1i_2, k1i_2)), 0).x))))) + (s1_2 * ((t0_2 * ((u0_2 * inVelocityZ.read(uint3(int3(i1i_2, j0i_2, k0i_2)), 0).x) + (u1_2 * inVelocityZ.read(uint3(int3(i1i_2, j0i_2, k1i_2)), 0).x))) + (t1_2 * ((u0_2 * inVelocityZ.read(uint3(int3(i1i_2, j1i_2, k0i_2)), 0).x) + (u1_2 * inVelocityZ.read(uint3(int3(i1i_2, j1i_2, k1i_2)), 0).x))))));
outVelocity.write(_797, uint3(id));
float4 _787 = float4((s0_2 * ((t0_2 * ((u0_2 * inVelocityZ.read(uint3(int3(i0i_2, j0i_2, k0i_2)), 0).x) + (u1_2 * inVelocityZ.read(uint3(int3(i0i_2, j0i_2, k1i_2)), 0).x))) + (t1_2 * ((u0_2 * inVelocityZ.read(uint3(int3(i0i_2, j1i_2, k0i_2)), 0).x) + (u1_2 * inVelocityZ.read(uint3(int3(i0i_2, j1i_2, k1i_2)), 0).x))))) + (s1_2 * ((t0_2 * ((u0_2 * inVelocityZ.read(uint3(int3(i1i_2, j0i_2, k0i_2)), 0).x) + (u1_2 * inVelocityZ.read(uint3(int3(i1i_2, j0i_2, k1i_2)), 0).x))) + (t1_2 * ((u0_2 * inVelocityZ.read(uint3(int3(i1i_2, j1i_2, k0i_2)), 0).x) + (u1_2 * inVelocityZ.read(uint3(int3(i1i_2, j1i_2, k1i_2)), 0).x))))));
outVelocity.write(_787, uint3(id));
} while (false);
}
}
Expand Down
Binary file modified shaders/bin/advect1.comp.spv
Binary file not shown.
10 changes: 5 additions & 5 deletions shaders/bin/advect2.comp.msl
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ kernel void main0(constant uniformDeltaTime& _62 [[buffer(0)]], texture3d<float>
do
{
float N = float(size.x - 2);
float dtx = _62.deltaTime * (N - 2.0);
float dty = _62.deltaTime * (N - 2.0);
float dtz = _62.deltaTime * (N - 2.0);
float dtx = _62.deltaTime * N;
float dty = _62.deltaTime * N;
float dtz = _62.deltaTime * N;
float tmp1 = dtx * inVelocityX.read(uint3(id), 0).x;
float tmp2 = dty * inVelocityY.read(uint3(id), 0).x;
float tmp3 = dtz * inVelocityZ.read(uint3(id), 0).x;
Expand All @@ -58,8 +58,8 @@ kernel void main0(constant uniformDeltaTime& _62 [[buffer(0)]], texture3d<float>
int j1i = int(j1);
int k0i = int(k0);
int k1i = int(k1);
float4 _302 = float4((s0 * ((t0 * ((u0 * inDensity.read(uint3(int3(i0i, j0i, k0i)), 0).x) + (u1 * inDensity.read(uint3(int3(i0i, j0i, k1i)), 0).x))) + (t1 * ((u0 * inDensity.read(uint3(int3(i0i, j1i, k0i)), 0).x) + (u1 * inDensity.read(uint3(int3(i0i, j1i, k1i)), 0).x))))) + (s1 * ((t0 * ((u0 * inDensity.read(uint3(int3(i1i, j0i, k0i)), 0).x) + (u1 * inDensity.read(uint3(int3(i1i, j0i, k1i)), 0).x))) + (t1 * ((u0 * inDensity.read(uint3(int3(i1i, j1i, k0i)), 0).x) + (u1 * inDensity.read(uint3(int3(i1i, j1i, k1i)), 0).x))))));
outDensity.write(_302, uint3(id));
float4 _298 = float4((s0 * ((t0 * ((u0 * inDensity.read(uint3(int3(i0i, j0i, k0i)), 0).x) + (u1 * inDensity.read(uint3(int3(i0i, j0i, k1i)), 0).x))) + (t1 * ((u0 * inDensity.read(uint3(int3(i0i, j1i, k0i)), 0).x) + (u1 * inDensity.read(uint3(int3(i0i, j1i, k1i)), 0).x))))) + (s1 * ((t0 * ((u0 * inDensity.read(uint3(int3(i1i, j0i, k0i)), 0).x) + (u1 * inDensity.read(uint3(int3(i1i, j0i, k1i)), 0).x))) + (t1 * ((u0 * inDensity.read(uint3(int3(i1i, j1i, k0i)), 0).x) + (u1 * inDensity.read(uint3(int3(i1i, j1i, k1i)), 0).x))))));
outDensity.write(_298, uint3(id));
} while (false);
}

Binary file modified shaders/bin/advect2.comp.spv
Binary file not shown.
Binary file modified shaders/bin/bnd1.comp.spv
Binary file not shown.
Binary file modified shaders/bin/bnd2.comp.spv
Binary file not shown.
Binary file modified shaders/bin/bnd3.comp.spv
Binary file not shown.
Binary file modified shaders/bin/bnd4.comp.spv
Binary file not shown.
Binary file modified shaders/bin/bnd5.comp.spv
Binary file not shown.
Loading
Loading