From 3bbdb83cec4fba41c6ab85ce8a1a6e9242ef4be5 Mon Sep 17 00:00:00 2001 From: Jaan Soulier Date: Thu, 11 Jun 2026 18:28:10 -0400 Subject: [PATCH 1/2] fix --- CMakeLists.txt | 1 - shaders/add1.comp | 2 +- shaders/add2.comp | 22 ------ shaders/advect1.comp | 2 +- shaders/advect2.comp | 2 +- shaders/bin/add1.comp.spv | Bin 1248 -> 1248 bytes shaders/bin/add2.comp.json | 1 - shaders/bin/add2.comp.msl | 40 ---------- shaders/bin/add2.comp.spv | Bin 1652 -> 0 bytes shaders/bin/advect1.comp.msl | 30 ++++---- shaders/bin/advect1.comp.spv | Bin 17548 -> 17352 bytes shaders/bin/advect2.comp.msl | 10 +-- shaders/bin/advect2.comp.spv | Bin 6972 -> 6896 bytes shaders/bin/bnd1.comp.spv | Bin 2504 -> 2504 bytes shaders/bin/bnd2.comp.spv | Bin 2488 -> 2488 bytes shaders/bin/bnd3.comp.spv | Bin 2488 -> 2488 bytes shaders/bin/bnd4.comp.spv | Bin 5420 -> 5420 bytes shaders/bin/bnd5.comp.spv | Bin 1600 -> 1600 bytes shaders/bin/composite.comp.msl | 32 +++----- shaders/bin/composite.comp.spv | Bin 5744 -> 5536 bytes shaders/bin/diffuse.comp.json | 2 +- shaders/bin/diffuse.comp.msl | 4 +- shaders/bin/diffuse.comp.spv | Bin 3592 -> 3660 bytes shaders/bin/project1.comp.spv | Bin 2912 -> 2912 bytes shaders/bin/project2.comp.json | 2 +- shaders/bin/project2.comp.msl | 4 +- shaders/bin/project2.comp.spv | Bin 2712 -> 2780 bytes shaders/bin/project3.comp.spv | Bin 3460 -> 3460 bytes shaders/bin/single.comp.msl | 32 +++----- shaders/bin/single.comp.spv | Bin 4908 -> 4700 bytes shaders/bnd1.comp | 2 +- shaders/bnd2.comp | 2 +- shaders/bnd3.comp | 2 +- shaders/bnd4.comp | 2 +- shaders/bnd5.comp | 2 +- shaders/composite.comp | 4 +- shaders/diffuse.comp | 7 +- shaders/project1.comp | 4 +- shaders/project2.comp | 5 +- shaders/project3.comp | 6 +- shaders/shader.glsl | 22 +++--- shaders/single.comp | 4 +- src/main.cpp | 133 +++++++++++++++++++-------------- 43 files changed, 161 insertions(+), 220 deletions(-) delete mode 100644 shaders/add2.comp delete mode 100644 shaders/bin/add2.comp.json delete mode 100644 shaders/bin/add2.comp.msl delete mode 100644 shaders/bin/add2.comp.spv diff --git a/CMakeLists.txt b/CMakeLists.txt index 26a3aba..6ef8237 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/shaders/add1.comp b/shaders/add1.comp index 0bbe17f..e29ea8c 100644 --- a/shaders/add1.comp +++ b/shaders/add1.comp @@ -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; diff --git a/shaders/add2.comp b/shaders/add2.comp deleted file mode 100644 index 666b21e..0000000 --- a/shaders/add2.comp +++ /dev/null @@ -1,22 +0,0 @@ -#version 450 - -#include "config.hpp" - -layout(local_size_x = THREADS, local_size_y = THREADS, local_size_z = THREADS) in; -layout(set = 1, binding = 0, rgba32f) uniform image3D inOutImage; -layout(set = 2, binding = 0) uniform uniformValue -{ - float value; -}; - -void main() -{ - ivec3 size = imageSize(inOutImage); - ivec3 id = ivec3(gl_GlobalInvocationID); - if (any(greaterThanEqual(id, size - 1)) || any(lessThanEqual(id, ivec3(0)))) - { - return; - } - float current = imageLoad(inOutImage, id).x; - imageStore(inOutImage, id, vec4(current + value)); -} \ No newline at end of file diff --git a/shaders/advect1.comp b/shaders/advect1.comp index 051efab..e6ea88d 100644 --- a/shaders/advect1.comp +++ b/shaders/advect1.comp @@ -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; diff --git a/shaders/advect2.comp b/shaders/advect2.comp index b95de5c..ebdb66a 100644 --- a/shaders/advect2.comp +++ b/shaders/advect2.comp @@ -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; diff --git a/shaders/bin/add1.comp.spv b/shaders/bin/add1.comp.spv index 5373192ecb00e3965b9b614753d60443677fd227..c1a590ebf4565fd24e93ed6d5520c07d58364e40 100644 GIT binary patch delta 14 VcmaFB`G9jn1`{Lm=1it?CIBdK1c(3t delta 14 VcmaFB`G9jn1`{LW=1it?CIBd81cm?r diff --git a/shaders/bin/add2.comp.json b/shaders/bin/add2.comp.json deleted file mode 100644 index a611bcf..0000000 --- a/shaders/bin/add2.comp.json +++ /dev/null @@ -1 +0,0 @@ -{ "samplers": 0, "readonly_storage_textures": 0, "readonly_storage_buffers": 0, "readwrite_storage_textures": 1, "readwrite_storage_buffers": 0, "uniform_buffers": 1, "threadcount_x": 8, "threadcount_y": 8, "threadcount_z": 8 } diff --git a/shaders/bin/add2.comp.msl b/shaders/bin/add2.comp.msl deleted file mode 100644 index cc44e04..0000000 --- a/shaders/bin/add2.comp.msl +++ /dev/null @@ -1,40 +0,0 @@ -#pragma clang diagnostic ignored "-Wmissing-prototypes" - -#include -#include - -using namespace metal; - -template -void spvImageFence(ImageT img) { img.fence(); } - -struct uniformValue -{ - float value; -}; - -constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(8u); - -kernel void main0(constant uniformValue& _57 [[buffer(0)]], texture3d inOutImage [[texture(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) -{ - int3 size = int3(inOutImage.get_width(), inOutImage.get_height(), inOutImage.get_depth()); - int3 id = int3(gl_GlobalInvocationID); - bool _31 = any(id >= (size - int3(1))); - bool _40; - if (!_31) - { - _40 = any(id <= int3(0)); - } - else - { - _40 = _31; - } - if (_40) - { - return; - } - spvImageFence(inOutImage); - float current = inOutImage.read(uint3(id)).x; - inOutImage.write(float4(current + _57.value), uint3(id)); -} - diff --git a/shaders/bin/add2.comp.spv b/shaders/bin/add2.comp.spv deleted file mode 100644 index ae3447839ec89991e677e07ef0ace7162da3419c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1652 zcmZ9L+iDY06o$7snKs&kJ$bB2fdwf?=8JFUncb%@I+;{31`4BN?otRj;2@h4Pc;J;V4QGZ!|r7?ck z7)G^j^GIw~eayhMvGZ}yM}b!jdWX%R7LIzYX5{z6+Os%6WA12g4g3907%4ty9?Bnv z{+nLE`??tn<2u{~JZof0>O2}#rmDW^qx7G@BAv3N%653_?EaK5l z>fxhD4(EH?(K{#1iG?qzCnku!pqQNYqCgKz^7Sxcj+ml+<_8BBl{p#nXimi1_-G{; zK6>PzvIq3BZGG;6MSb2#5l4&qXSBn)`g5|;f+ruJdxD!+1RRUzCYO5MavOO9eiTZIV-?9pLd7efxYhwvYC;?Cw&EZymw+b|0<5z zEeq&z_F4MO^0EN`#rj3d{Zub2vRQw0R@7b+;J7Pn*Hc+GJ$|!wuE~buEx0<@WyAkg zuG3)up>FBphCnaOfLQeD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@|AN)@ z^XZrS{}7COC3n6~Tjpvk`?n05b21j+0I>UGEOYDvUx^kz5MK9d5WLQLFucxr2)y3g zL*aG5mWA6!pRvq&Ik0_a&dY<<^qaQ--97)lZWx+zugqlyxVaij?!&=#zgC3T+*g9v z+*gLz+*g6u{TczcjXq<^eO0i1C->FBYWh2KUmeYO&3z5Hxf;uUtqFEc#xlpX!0wN+ z_|^uykH+F#2kdibEWUNYKCi~|E@VBhdM&;Sc?jPkigDj7j0XE2!aDClwgzw8=+^p1 WHQZXBcO%yF{JRlr|9_etDgOtEHzckA diff --git a/shaders/bin/advect2.comp.msl b/shaders/bin/advect2.comp.msl index 26e0e11..beba004 100644 --- a/shaders/bin/advect2.comp.msl +++ b/shaders/bin/advect2.comp.msl @@ -31,9 +31,9 @@ kernel void main0(constant uniformDeltaTime& _62 [[buffer(0)]], texture3d 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; @@ -58,8 +58,8 @@ kernel void main0(constant uniformDeltaTime& _62 [[buffer(0)]], texture3d 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); } diff --git a/shaders/bin/advect2.comp.spv b/shaders/bin/advect2.comp.spv index 6dfa42bf8d747e98868c6e3b0b1f0c77388e0fa5..8ac5a1db03b2b7b877863be80f47014c31dae90e 100644 GIT binary patch literal 6896 zcmZ9Q37D2u8HPV*V;eTvR1gPHQJ@h*jWR_I8>lJ9G(%d(ab~0+hJT3phk#5`vn(^q zqD(4{inKB*%Cabn%=UfXZQu7?%j~|tIj6E3x+q2! zrio*8swBw7Gl6Q2T+u1%;>uW#h7L7J#ZW5kma1*hqr&3j) zNlZppn?j7qqLIE0@Pka$RE#S+I=eg8tm)`HySsPu=I)`|_JRKHfl9T%yRWjPzqeM| z+OKa+=BreD2ZsA{Lo<$ie)(AD7^>``cR_v4)Laym>dOA=P^GrL)EbMaYJKL%lr^s( z=%q4t+&l{m7_x&DE%r5hd&h_TC$o0nD zCjwlX{;AC9oO2o3vBlFFzlFAqu+L057fGq6;c$C{wXqjqZIo{!HWxV20!*+^~Ez-@_J+jOv6)HVa`T&Ix$H9C%SpG5eWKbh9Nb;mr*!S2T#M)&<0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c1^}&jkCa>kFm&`4fY(3Mcy2+-=VR{dlK01)!3@^|H-*v_1rr7J@mKt fe$2RkSC|j>?+SYVR^i_q=Yr=YUGLv27GeJbBCS#q diff --git a/shaders/bin/bnd1.comp.spv b/shaders/bin/bnd1.comp.spv index 9004ae9fc4bdc384ab508019983b17904b8eb524..6f8f2058eb3bfa76cccc9d489101b4ec4ef081ae 100644 GIT binary patch delta 14 WcmX>hd_s7`17=3%%@3KMvjPAu_65-Z delta 14 WcmX>hd_s7`17=3X%@3KMvjPAu>IKgL diff --git a/shaders/bin/bnd2.comp.spv b/shaders/bin/bnd2.comp.spv index 696ac28217d30a7590447ea1a22dd21759caade7..dc512a8b4a0bdddc5fd94391205037c519106a22 100644 GIT binary patch delta 14 WcmdlXyhC`y17=3%%@3KcvjPAtHU*&o delta 14 WcmdlXyhC`y17=3X%@3KcvjPAtDg~ba diff --git a/shaders/bin/bnd3.comp.spv b/shaders/bin/bnd3.comp.spv index df356a718bc2a0aeea299b358fe2ae9b57fe9393..c8bec54c7dc375c622d54a301ad37ac849e90e53 100644 GIT binary patch delta 14 WcmdlXyhC`y17=3%%@3KcvjPAtHU*&o delta 14 WcmdlXyhC`y17=3X%@3KcvjPAtDg~ba diff --git a/shaders/bin/bnd4.comp.spv b/shaders/bin/bnd4.comp.spv index e023eaf7bf28709328c337af02e1ce090abdf5e7..5ee90856af41d20313038ec54e061eb5404d3f5b 100644 GIT binary patch delta 14 VcmZ3ZwMJ`$2n!?gW>FS#K>#6P18o2R delta 14 VcmZ3ZwMJ`$2n!?QW>FS#K>#6D18V>P diff --git a/shaders/bin/bnd5.comp.spv b/shaders/bin/bnd5.comp.spv index 9e1e25ebb52a88eafcbd472e32c51911361001f5..dcd98890e8747f297ed3ead14d9be829ce0e7dea 100644 GIT binary patch delta 14 VcmX@WbAV@q1v4Y_W=m#vW&k2I1Azbl delta 14 VcmX@WbAV@q1v4Y#W=m#vW&k261AhPj diff --git a/shaders/bin/composite.comp.msl b/shaders/bin/composite.comp.msl index 1aba1ff..3cb973a 100644 --- a/shaders/bin/composite.comp.msl +++ b/shaders/bin/composite.comp.msl @@ -32,46 +32,36 @@ float3 GetRayDirection(thread const float4x4& inverseView, thread const float4x4 return fast::normalize(worldRay.xyz); } -kernel void main0(constant uniformInverseView& _120 [[buffer(0)]], constant uniformInverseProj& _123 [[buffer(1)]], constant uniformCameraPosition& _149 [[buffer(2)]], texture3d inVelocityX [[texture(0)]], texture3d inVelocityY [[texture(1)]], texture3d inVelocityZ [[texture(2)]], texture3d inDensity [[texture(3)]], texture2d outColor [[texture(4)]], sampler inVelocityXSmplr [[sampler(0)]], sampler inVelocityYSmplr [[sampler(1)]], sampler inVelocityZSmplr [[sampler(2)]], sampler inDensitySmplr [[sampler(3)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(constant uniformInverseView& _109 [[buffer(0)]], constant uniformInverseProj& _112 [[buffer(1)]], constant uniformCameraPosition& _138 [[buffer(2)]], texture3d inVelocityX [[texture(0)]], texture3d inVelocityY [[texture(1)]], texture3d inVelocityZ [[texture(2)]], texture3d inDensity [[texture(3)]], texture2d outColor [[texture(4)]], sampler inVelocityXSmplr [[sampler(0)]], sampler inVelocityYSmplr [[sampler(1)]], sampler inVelocityZSmplr [[sampler(2)]], sampler inDensitySmplr [[sampler(3)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { int3 size = int3(inVelocityX.get_width(), inVelocityX.get_height(), inVelocityX.get_depth()); int2 _imageSize = int2(outColor.get_width(), outColor.get_height()); int2 id = int2(gl_GlobalInvocationID.xy); - bool _93 = any(id >= (_imageSize - int2(1))); - bool _101; - if (!_93) - { - _101 = any(id <= int2(0)); - } - else - { - _101 = _93; - } - if (_101) + if (any(id >= _imageSize)) { return; } float2 texcoord = float2(id) / float2(_imageSize); texcoord.y = 1.0 - texcoord.y; - float4x4 param = _120.inverseView; - float4x4 param_1 = _123.inverseProj; + float4x4 param = _109.inverseView; + float4x4 param_1 = _112.inverseProj; float2 param_2 = texcoord; float3 rayDirection = GetRayDirection(param, param_1, param_2); float4 result = float4(0.0); for (int i = 0; i < 512; i++) { - int3 cell = int3(_149.cameraPosition + ((rayDirection * float(i)) * 1.0)); - bool _164 = any(cell >= size); - bool _172; - if (!_164) + int3 cell = int3(_138.cameraPosition + ((rayDirection * float(i)) * 1.0)); + bool _153 = any(cell >= size); + bool _161; + if (!_153) { - _172 = any(cell < int3(0)); + _161 = any(cell < int3(0)); } else { - _172 = _164; + _161 = _153; } - if (_172) + if (_161) { continue; } diff --git a/shaders/bin/composite.comp.spv b/shaders/bin/composite.comp.spv index 18982d540ceb88206fc414b222b3d87161251ba5..a5a1de244ef966c3ac1b039fe11da9eb3808d755 100644 GIT binary patch literal 5536 zcmZ9OiI>%78OMKcX9i>u2t)|eL8UB+jL^bS90%wQHZ-FosdXI3I~Tlk=U%$AAW8_D zK~|P+mX%qZ$~KqwqQz*TeKA|@-)KFjPM^>3zR&QRdC&RI^E}`8d7tH7es@Z9FPfKS zbFzim;_Po(do0W5!ep6p6LMkJmD}Zk-2)rPCq_4JzU)#x&(2DUd~OLoo#-84Y^2tZ z9|B9^<(7f@1(aAj7yA^6Id0@CaI9MLoFNmgOS8G)2lcPn4PCSbFJBe%Fa&_YRkwe?tftrm=#`bRB+>`&A+PkSIqwY?6$+B8w zs@fW_?x|G|=G>Aq+)%5zKj)UhO;qowG@GqaRJc;M0@)a?pm$^!pidEigt`BE?1Rl# zeN=*>&y~pW+MRUN&fSZwHTG2N%}Qc$*AdwBvlGZv+qRLhYHMVuIbL(8;Jc{Z zc}Hc|q;c+g@#u#Y<48re5S);0XJ|wuxQJ&w6#5 z^W2NR+WPuNUF*3o1n1>;DL)_IRzGu|qrq2&ebBX7EX#0&?#b3XNa@yVe zJuBJr`Y%B0Z!G7{rN6xMi;&KnZ!Owlq?~bt{;pe&be&j_?V6Q<(Hr)v+&p@9*lTh- z%g({yJ?~Do^V$~!^BR90(%8n;e@o7{&(%7wz?KXD9(4WXS5xU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GbIxj}o?>g?8w(FQjD6 zaMvPV23$+uJ*@3Ld^wQ6KiRKH+&`&fC%WT5_~Zw{PT(C-k9vmCt?!|fr;IMQ3q+n_ zboqZXcPG*{lz(S$tfK;~#k*y!>s!Mfq{AAF*$w2Jul`?lQC%+TxencW8qD$c=T$&1 z{55plL@j=bmLot3*3|8nGBAm?|?HM@|n2J#1q(QbmpKtAS;qQ^Yf z)izGQ->26Czi-|>*Y$1Q1munPZD>dQ&FBX}G5!{8dE+OM+OB0^uLI`ScQDy&+5g$- zuLtviIVORA<9wg`)DIzVP5NP^c|FfJAUy-+Kge}E@($q8e_KH_l#lgH`ev7 z;gd**H5l^=AZHEguIKq{%UjcWneVKzKJa#{d@~u&NX7* zx6xys{b(B({d@=gShDTsyP(+5_pptLe!h<`XWZ0&egLQ65&irSJ^Ilfb^Qq4x*i2_ zK0ij6kA8lFF6SCC@2BW7&wjLxi++BF{#df@=jWi<&o8iziGF^GE@#}-etrd~-x2wL zjc)#PK-B#kbor?Jx9D=tk9ogCk9pRuZCvr)_)5CE zX^C5e^nWF}C17!aztwV21;*-&@5||lM;zy#mN@V50F_zW8NgV5OMz>V5c s?9=nmt<4zg_72EJoomqLqR#Wt<%A>Z^qXWK7bMPmZtVZ)Le6{qe=@~0fdBvi diff --git a/shaders/bin/diffuse.comp.json b/shaders/bin/diffuse.comp.json index da4e0d1..645dc26 100644 --- a/shaders/bin/diffuse.comp.json +++ b/shaders/bin/diffuse.comp.json @@ -1 +1 @@ -{ "samplers": 1, "readonly_storage_textures": 0, "readonly_storage_buffers": 0, "readwrite_storage_textures": 1, "readwrite_storage_buffers": 0, "uniform_buffers": 2, "threadcount_x": 8, "threadcount_y": 8, "threadcount_z": 8 } +{ "samplers": 2, "readonly_storage_textures": 0, "readonly_storage_buffers": 0, "readwrite_storage_textures": 1, "readwrite_storage_buffers": 0, "uniform_buffers": 2, "threadcount_x": 8, "threadcount_y": 8, "threadcount_z": 8 } diff --git a/shaders/bin/diffuse.comp.msl b/shaders/bin/diffuse.comp.msl index 1f1bb9e..dcf704b 100644 --- a/shaders/bin/diffuse.comp.msl +++ b/shaders/bin/diffuse.comp.msl @@ -15,7 +15,7 @@ struct uniformDiffusion constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(8u); -kernel void main0(constant uniformDeltaTime& _55 [[buffer(0)]], constant uniformDiffusion& _61 [[buffer(1)]], texture3d inImage [[texture(0)]], texture3d outImage [[texture(1)]], sampler inImageSmplr [[sampler(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(constant uniformDeltaTime& _55 [[buffer(0)]], constant uniformDiffusion& _61 [[buffer(1)]], texture3d inSource [[texture(0)]], texture3d inImage [[texture(1)]], texture3d outImage [[texture(2)]], sampler inSourceSmplr [[sampler(0)]], sampler inImageSmplr [[sampler(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { int3 size = int3(inImage.get_width(), inImage.get_height(), inImage.get_depth()); int3 id = int3(gl_GlobalInvocationID); @@ -38,7 +38,7 @@ kernel void main0(constant uniformDeltaTime& _55 [[buffer(0)]], constant uniform float c = 1.0 + (6.0 * a); do { - outImage.write(float4((inImage.read(uint3(id), 0).x + (a * (((((inImage.read(uint3((id + int3(1, 0, 0))), 0).x + inImage.read(uint3((id + int3(-1, 0, 0))), 0).x) + inImage.read(uint3((id + int3(0, 1, 0))), 0).x) + inImage.read(uint3((id + int3(0, -1, 0))), 0).x) + inImage.read(uint3((id + int3(0, 0, 1))), 0).x) + inImage.read(uint3((id + int3(0, 0, -1))), 0).x))) / c), uint3(id)); + outImage.write(float4((inSource.read(uint3(id), 0).x + (a * (((((inImage.read(uint3((id + int3(1, 0, 0))), 0).x + inImage.read(uint3((id + int3(-1, 0, 0))), 0).x) + inImage.read(uint3((id + int3(0, 1, 0))), 0).x) + inImage.read(uint3((id + int3(0, -1, 0))), 0).x) + inImage.read(uint3((id + int3(0, 0, 1))), 0).x) + inImage.read(uint3((id + int3(0, 0, -1))), 0).x))) / c), uint3(id)); } while (false); } diff --git a/shaders/bin/diffuse.comp.spv b/shaders/bin/diffuse.comp.spv index 6d4674f3ed7cfc2d1d1c5b25eefc7fd10333a604..f9a554a2f76410daedd4ab0896c909bd2cdc4383 100644 GIT binary patch delta 1384 zcmZ9LJ8u(F5QS&`0uqdn09k=F##Mll4yB<1QGrtM#xV|$@JNV5c*7b(ha%{`;N5im5%P2Gc!Bq-remC{}?XkbG1!okquhezJ4orqiWHLcG}D) zr^cq|TFpyPJ7NXf#$E+cvJrKws!*h*tm3`Bs2{Jbf6vu&Q9k)usEr(=piELlS{35+ z>;s?x4p_->Va=pktc+ZP{bjj&omkrT0M}=eMzJ#VFsNSP+4*F-SZTaY^{HZ?3NMIk+0#$Q`&e)n<*{MN?kOjogFFjB;+| zK3qoP@E+^|LE6Y8VrlwF-N<9O8r{efxHQ#fjp$&?Yq^m&TxOIDMq-lxU&%A#w2|k; z(&m91S%9n0jl6(MQ*GABBAW7AZlnWmgGE{KD|v~KemAd((?;G9OVf|(M&82J=SJSa zrKvV+bi#*HEfHZIg8+KI*~ah~VyM5ApS<1?E0 zFC>4%UH=wA-RO79ci}xaymQXIukLw8)sNxcaJ`l{SD9s2THU^VulKY1AsetEGusX< zWO+YZUiq0f^DGOSi)OKj@>pmUjooLdZv*Qic2XIHUj~0!yHGsarsRc%qS3hpQ@5Y; zjz`hgN!8t-joQz+KcDzIv%_k(g?$ltiZ5`>|Le8TuWB%&_g$}FGo-Q z(#p}ner^9Ls9wbZj_4*MpaCY)CHp8)Pn+r(`|0S7gjU(;oQV!w^#rA8gMCr2V;=|U zgbB1Jbgif+o`cKNyY{J*@NwW%&sQ}w^>X3r4YsTZ?XsA-fL2{gx6sUsAf0&$oz9#_ z%bNl|^9o$&eCAcSyy@zu*I;tAW=O7^UI&`4noqs~Pbc3*r;~4^<>@=|$#>v7=acWk z<*7H`HjI{QI``13X?ceGaOF_VGdzH&86Kk343E+B^i6t(Cvctf3{T zGj!m}p_*st!qW^h=rqG~w7gm18D7AmS=bcR}R%YLl2&2c#Tdo zyg|#G2cF?AT<1K)JGeacrWxL&RnzheAK=QN+FblbKEm}!sOEhOaQ!)|DXYGvPv8jX r#d86!KKaMuzxNp~AMA0$FEL;zFi!$C{3hmc_Fr-TLwzyq9oqU2ZVr71 diff --git a/shaders/bin/project1.comp.spv b/shaders/bin/project1.comp.spv index 04c506e4b2f7698f0b8b090417ad7d2a772a140b..ba7a94e3b4b67f2e4e5ada4b08a234244c143e29 100644 GIT binary patch delta 14 VcmaDL_CRdI6J|!{%}<%D*#R&N1*HH0 delta 14 VcmaDL_CRdI6J|!n%}<%D*#R&B1)~4} diff --git a/shaders/bin/project2.comp.json b/shaders/bin/project2.comp.json index 73163ba..0d1932d 100644 --- a/shaders/bin/project2.comp.json +++ b/shaders/bin/project2.comp.json @@ -1 +1 @@ -{ "samplers": 1, "readonly_storage_textures": 0, "readonly_storage_buffers": 0, "readwrite_storage_textures": 1, "readwrite_storage_buffers": 0, "uniform_buffers": 0, "threadcount_x": 8, "threadcount_y": 8, "threadcount_z": 8 } +{ "samplers": 2, "readonly_storage_textures": 0, "readonly_storage_buffers": 0, "readwrite_storage_textures": 1, "readwrite_storage_buffers": 0, "uniform_buffers": 0, "threadcount_x": 8, "threadcount_y": 8, "threadcount_z": 8 } diff --git a/shaders/bin/project2.comp.msl b/shaders/bin/project2.comp.msl index cb62943..cff56b4 100644 --- a/shaders/bin/project2.comp.msl +++ b/shaders/bin/project2.comp.msl @@ -5,7 +5,7 @@ using namespace metal; constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(8u); -kernel void main0(texture3d inDivergence [[texture(0)]], texture3d outPressure [[texture(1)]], sampler inDivergenceSmplr [[sampler(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(texture3d inDivergence [[texture(0)]], texture3d inPressure [[texture(1)]], texture3d outPressure [[texture(2)]], sampler inDivergenceSmplr [[sampler(0)]], sampler inPressureSmplr [[sampler(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { int3 size = int3(inDivergence.get_width(), inDivergence.get_height(), inDivergence.get_depth()); int3 id = int3(gl_GlobalInvocationID); @@ -25,7 +25,7 @@ kernel void main0(texture3d inDivergence [[texture(0)]], texture3dQms{%mMYatwfe?Jt=GTPZr0kZPP5i%b({5mYpZGAXd$oFskb*9#e^~$#s2zZ z^yszjvO1w}1kEY6It$e6t~ERLoG+z4@(puFGu>S=)MhIBCy%iZl0%iT6=sgn1IP#sPdTLdKahiSPH4)AqA+Jmal7 zmetm`R&iL%agh86nAKpd9g+;W^SST&IF8|~Wmo2HYugK+%zd@(1IvZB{a|~^TTkEf zl-rA{N13DU<2i4gNw6{N9H*;$JA&Ce%>8-q|8IZpH#EEec9^RMeZP~#Ugwyt;hj{A z`d`Kz`o?B6@7~2Y6Thn?w9SLnAKGG1i*WxiBJT>mT;v6RE$5;}@HcWk)&##=sNtI6 zZxwjgg#Io#rJv`Haw?wdCKejE3~^wQ`-OhGJg@Ire2IC-?BRFx&dPkPXHS4V)39%H4NtFXI<`zK$<<1&f|lu-cilu+Z@q*ma@fZLplVgF4=UGwui-?}F80EOfjFF6ww6 zzo_E_e7PG~==c!qy3p|vSkBx*9UsFPcZ7}_SS`jv$4zii#|nN?M;%{o6$>2=@J%dq zG_zPr<__xk1kSi4bgY5ZVk~rg3NGqs;TLs$hA(#u3mt8+>q5tEu$;MrIy!L19id|# ztQKS6=67ZTJc}8NywAbDBV*s?c|EXv7hBHXVIM4Cv^sCj_wE}v?myuKv;PEV|1+D+ O)7VVTJNutGi~S3m6~m+e literal 2712 zcmZvd+iqJ$6o!X5328%VOHV*KI4w|Us}P_qh0-)FDQ>`!lyWL3Da zqsg>0)#{Df>T0cixzXC#XbeZUx}8Qh>vbCKY|v?qvaODJGo`$&*XnMz%L!9tl>6)N zpvN%#iq#2y(`Zg9>n&4nu-@sl3cix|$+yj!$#t)H8?|o#Mzg!p+v>NPqpaUsS&{`0@Q-Y}x$jxbVh`l;N?zl>98c!Byw>`z^&430OJ>)a zzmHS%+~znxPhWh1oN4AN=9)wJeAJvXr;6{{%V`H$xijajxg)QwZ>{pMmg6w_cQLEM zTDv3}a_0)){X0(Jt7T8_ZEM>Pt`@%94uIuC+d;6s41s`jIZNprQ@8S=QzSb zYpd> z-P(MKF4b`yQ_B=)uJzS$lG&jKb53A#Y7qa!OA*Ui zd%lP{|IV5P=BF@+@h6$hcUHge>NMt?iv64c$C>-RpT+#%5kFhRdvKMV`4-P(#vRtP{spXDe+l3Iw^`#IxP&cX7qRI1BG`4&a~UjW?s(73aK;_c z^CfV(XAQsH^JRRw6)bwb0(M>Wtb^su9q;)noN>oD#ok{7tHoI8SOu4Ltl^h+ypAvD zZ%*jA26kQOcmphF?zoOO;fy;%$6H{v7z-V5gUdSJ!7uB07hmo=7CPPoyDoIR50*1` zT*n7+#vP&KL$F$mg^mWetm7m6vW^@0a!o9Bw7{+l9c{3jx#K!IaK;^><72Q|jD?PM za9PJE_+=fR;>%@N==comy3o-D%b7c_<0hPON9gE*)ne?s;?DHJi inImage [[texture(0)]], texture2d outColor [[texture(1)]], sampler inImageSmplr [[sampler(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) +kernel void main0(constant uniformInverseView& _109 [[buffer(0)]], constant uniformInverseProj& _112 [[buffer(1)]], constant uniformCameraPosition& _138 [[buffer(2)]], texture3d inImage [[texture(0)]], texture2d outColor [[texture(1)]], sampler inImageSmplr [[sampler(0)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]]) { int3 size = int3(inImage.get_width(), inImage.get_height(), inImage.get_depth()); int2 _imageSize = int2(outColor.get_width(), outColor.get_height()); int2 id = int2(gl_GlobalInvocationID.xy); - bool _93 = any(id >= (_imageSize - int2(1))); - bool _101; - if (!_93) - { - _101 = any(id <= int2(0)); - } - else - { - _101 = _93; - } - if (_101) + if (any(id >= _imageSize)) { return; } float2 texcoord = float2(id) / float2(_imageSize); texcoord.y = 1.0 - texcoord.y; - float4x4 param = _120.inverseView; - float4x4 param_1 = _123.inverseProj; + float4x4 param = _109.inverseView; + float4x4 param_1 = _112.inverseProj; float2 param_2 = texcoord; float3 rayDirection = GetRayDirection(param, param_1, param_2); float4 result = float4(0.0); for (int i = 0; i < 512; i++) { - int3 cell = int3(_149.cameraPosition + ((rayDirection * float(i)) * 1.0)); - bool _164 = any(cell >= size); - bool _172; - if (!_164) + int3 cell = int3(_138.cameraPosition + ((rayDirection * float(i)) * 1.0)); + bool _153 = any(cell >= size); + bool _161; + if (!_153) { - _172 = any(cell < int3(0)); + _161 = any(cell < int3(0)); } else { - _172 = _164; + _161 = _153; } - if (_172) + if (_161) { continue; } diff --git a/shaders/bin/single.comp.spv b/shaders/bin/single.comp.spv index 6b851c12df89bf574d47656fb590b15cc06b93f0..460ae72b7f42a7b7ca5bfbae8143569f28513706 100644 GIT binary patch literal 4700 zcmZ9O`E!&-5Qe{GlYk(XAcCkQC|)2c;(-Xp0B+D=0(ff~*UbWpn_b)-fFedwK~xm) z6H&|izK9sh#iH(z9%6cwpIz%P-M$dXiJ5b2IR1MQ;Ivg>qHC56py@n*}CkkYjB#_HQI= zNv0(Ep8kAqZ@y=Je{tu|{-NPLl~RADTrKqvl! zwd#g-sc&m?5Awvi+man{^-N`k_i8S64PO>eX)9=Jy<&r^3hU-22 z6W6EhOV_6tgZZ#N^fj04bTPyJJb>I;s27Z>Ju<=GJ;8nmyIvX^sSN9%OZH)xfol&S zi=|2hfjv1nhzzx@Eew|Gg}&NQ*-pW?QM>bw;)F@#9%@V_dE$1WcTBJsjoZ2Oyyj!; z>)B;}we|IlIq%s`1!tsoF72^zqnkO;!r|NM=5Mrlw7jhoxwEky#vofb9iRvi2Kma=CGHI9IfMh&91kfu5Z-TlJ@ub`j+Gu=Io1ooQ;=$ z9n|huM}00@8?qgo#-6QL+i$=;{`$R<({AVQNx_!ae+p86V>xdw{pFoM8R@+FI?$#e z<%}crcin8H>%d;*Ux;{23~GeusZ{1edg*4w)xki%f&uk zk8Zv4=I=(DK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{ z|2d?#vE0`q!2HggO!hANza0Hhuo{?S4mhu$@6$Q;Q^?1Xei~_B&+`eSXQ2ECxy~TJ z3LMTqiF96REq)ij28{6rd-wdGN}S(G&szH{z*w$Tci(;wzYU%Nv2W}DPU4NP{as+~ zk?&b_^Lgf;&vQWTNn+~%JaCPCaNkS3=lD?a`#!q4oNE&6I^++4yghn4+2(cb1t1sp zi|E$_-{eckAA%Qve7uz(q07gcd>LKN_wZw+!yd`M0_5zGdgOT(-MseKJU;<)uYt(( z)5Lp55knbo@@MGgwfFiO-x^*=I;=sTp948-P&c0EuPtv)yOF;HgUPlxZvbnIZ}FSx z`iyfY7a`vQa{6_HA#f}E@%(-boOdjTk^2qk0zJTa^BU*3;1n23aes%dZxNoazP|_h z>l1fguDB=nX6#+aKLGF59P73Jn7BKUu6It(_3=*5U`K6#Lbo>WocaF@t2d}E-;S!)IKk9>yZAA$!!4Z6a0?KeGusDT%7&+iAT(H z7bMQ}k8{2dU0>%m0%O}#Yj@7t{KobJ_Zw%j301_a#8O#bk8bce;D1^qwL1B-45i0qYL> json; + state = json; } catch (const std::exception& exception) { SDL_Log("Failed to load json: %s, %s", filelist[0], exception.what()); return; } - state = json; CreateCells(); } @@ -391,7 +389,7 @@ static void UpdateSpawners(SDL_GPUCommandBuffer* commandBuffer) { for (int j = 0; j < SDL_arraysize(Spawners); j++) { - bool isSelected = spawner.Texture == j; + bool isSelected = spawner.Texture == Spawners[j]; if (ImGui::Selectable(Textures[Spawners[j]], isSelected)) { spawner.Texture = Spawners[j]; @@ -439,7 +437,7 @@ static void UpdateImGui(SDL_GPUCommandBuffer* commandBuffer) ImGui_ImplSDLGPU3_NewFrame(); ImGui::NewFrame(); ImGui::Begin("Fluid Simulation"); - const char* location = SDL_GetCurrentDirectory(); + char* location = SDL_GetCurrentDirectory(); if (ImGui::Button("Save")) { SDL_ShowSaveFileDialog(SaveCallback, nullptr, window, nullptr, 1, location); @@ -449,6 +447,7 @@ static void UpdateImGui(SDL_GPUCommandBuffer* commandBuffer) { SDL_ShowOpenFileDialog(LoadCallback, nullptr, window, nullptr, 1, location, false); } + SDL_free(location); ImGui::SameLine(); if (ImGui::Button("Reset")) { @@ -477,7 +476,7 @@ static void UpdateImGui(SDL_GPUCommandBuffer* commandBuffer) ImGui_ImplSDLGPU3_PrepareDrawData(ImGui::GetDrawData(), commandBuffer); } -static void Diffuse(SDL_GPUCommandBuffer* commandBuffer, ReadWriteTexture& texture, float diffusion) +static void Diffuse1(SDL_GPUCommandBuffer* commandBuffer, ReadWriteTexture& texture, float diffusion) { DebugGroup(commandBuffer); SDL_GPUComputePass* computePass = texture.BeginWritePass(commandBuffer); @@ -486,12 +485,14 @@ static void Diffuse(SDL_GPUCommandBuffer* commandBuffer, ReadWriteTexture& textu SDL_Log("Failed to begin compute pass: %s", SDL_GetError()); return; } - SDL_GPUTextureSamplerBinding textureBindings{}; - textureBindings.sampler = sampler; - textureBindings.texture = texture.GetReadTexture(); + SDL_GPUTextureSamplerBinding textureBindings[2]{}; + textureBindings[0].sampler = sampler; + textureBindings[0].texture = scratchTexture; + textureBindings[1].sampler = sampler; + textureBindings[1].texture = texture.GetReadTexture(); int groups = (state.Size + THREADS - 1) / THREADS; SDL_BindGPUComputePipeline(computePass, pipelines[PipelineTypeDiffuse]); - SDL_BindGPUComputeSamplers(computePass, 0, &textureBindings, 1); + SDL_BindGPUComputeSamplers(computePass, 0, textureBindings, 2); SDL_PushGPUComputeUniformData(commandBuffer, 0, &speed, sizeof(speed)); SDL_PushGPUComputeUniformData(commandBuffer, 1, &diffusion, sizeof(diffusion)); SDL_DispatchGPUCompute(computePass, groups, groups, groups); @@ -536,12 +537,14 @@ static void Project2(SDL_GPUCommandBuffer* commandBuffer) SDL_Log("Failed to begin compute pass: %s", SDL_GetError()); return; } - SDL_GPUTextureSamplerBinding textureBinding{}; - textureBinding.sampler = sampler; - textureBinding.texture = textures[TextureTypeDivergence].GetReadTexture(); + SDL_GPUTextureSamplerBinding textureBindings[2]{}; + textureBindings[0].sampler = sampler; + textureBindings[0].texture = textures[TextureTypeDivergence].GetReadTexture(); + textureBindings[1].sampler = sampler; + textureBindings[1].texture = textures[TextureTypePressure].GetReadTexture(); int groups = (state.Size + THREADS - 1) / THREADS; SDL_BindGPUComputePipeline(computePass, pipelines[PipelineTypeProject2]); - SDL_BindGPUComputeSamplers(computePass, 0, &textureBinding, 1); + SDL_BindGPUComputeSamplers(computePass, 0, textureBindings, 2); SDL_DispatchGPUCompute(computePass, groups, groups, groups); SDL_EndGPUComputePass(computePass); textures[TextureTypePressure].Swap(); @@ -739,6 +742,44 @@ static void Bnd(SDL_GPUCommandBuffer* commandBuffer, ReadWriteTexture& texture, texture.Swap(); } +static void Project(SDL_GPUCommandBuffer* commandBuffer) +{ + Project1(commandBuffer); + Bnd(commandBuffer, textures[TextureTypeDivergence], 0); + Bnd(commandBuffer, textures[TextureTypePressure], 0); + for (int i = 0; i < state.Iterations; i++) + { + Project2(commandBuffer); + Bnd(commandBuffer, textures[TextureTypePressure], 0); + } + Project3(commandBuffer); + Bnd(commandBuffer, textures[TextureTypeVelocityX], 1); + Bnd(commandBuffer, textures[TextureTypeVelocityY], 2); + Bnd(commandBuffer, textures[TextureTypeVelocityZ], 3); +} + +static void Diffuse(SDL_GPUCommandBuffer* commandBuffer, ReadWriteTexture& texture, float diffusion, int type) +{ + DebugGroup(commandBuffer); + SDL_GPUCopyPass* copyPass = SDL_BeginGPUCopyPass(commandBuffer); + if (!copyPass) + { + SDL_Log("Failed to begin copy pass: %s", SDL_GetError()); + return; + } + SDL_GPUTextureLocation source{}; + source.texture = texture.GetReadTexture(); + SDL_GPUTextureLocation destination{}; + destination.texture = scratchTexture; + SDL_CopyGPUTextureToTexture(copyPass, &source, &destination, state.Size, state.Size, state.Size, false); + SDL_EndGPUCopyPass(copyPass); + for (int i = 0; i < state.Iterations; i++) + { + Diffuse1(commandBuffer, texture, diffusion); + Bnd(commandBuffer, texture, type); + } +} + static void RenderComposite(SDL_GPUCommandBuffer* commandBuffer) { DebugGroup(commandBuffer); @@ -878,27 +919,10 @@ static void Update() UpdateViewProj(); if (cooldown <= 0) { - for (int i = 0; i < state.Iterations; i++) - { - Diffuse(commandBuffer, textures[TextureTypeVelocityX], state.Viscosity); - Diffuse(commandBuffer, textures[TextureTypeVelocityY], state.Viscosity); - Diffuse(commandBuffer, textures[TextureTypeVelocityZ], state.Viscosity); - Bnd(commandBuffer, textures[TextureTypeVelocityX], 1); - Bnd(commandBuffer, textures[TextureTypeVelocityY], 2); - Bnd(commandBuffer, textures[TextureTypeVelocityZ], 3); - } - Project1(commandBuffer); - Bnd(commandBuffer, textures[TextureTypeDivergence], 0); - Bnd(commandBuffer, textures[TextureTypePressure], 0); - for (int i = 0; i < state.Iterations; i++) - { - Project2(commandBuffer); - Bnd(commandBuffer, textures[TextureTypePressure], 0); - } - Project3(commandBuffer); - Bnd(commandBuffer, textures[TextureTypeVelocityX], 1); - Bnd(commandBuffer, textures[TextureTypeVelocityY], 2); - Bnd(commandBuffer, textures[TextureTypeVelocityZ], 3); + Diffuse(commandBuffer, textures[TextureTypeVelocityX], state.Viscosity, 1); + Diffuse(commandBuffer, textures[TextureTypeVelocityY], state.Viscosity, 2); + Diffuse(commandBuffer, textures[TextureTypeVelocityZ], state.Viscosity, 3); + Project(commandBuffer); Advect1(commandBuffer, TextureTypeVelocityX); Advect1(commandBuffer, TextureTypeVelocityY); Advect1(commandBuffer, TextureTypeVelocityZ); @@ -908,10 +932,8 @@ static void Update() Bnd(commandBuffer, textures[TextureTypeVelocityX], 1); Bnd(commandBuffer, textures[TextureTypeVelocityY], 2); Bnd(commandBuffer, textures[TextureTypeVelocityZ], 3); - Project1(commandBuffer); - Project2(commandBuffer); - Project3(commandBuffer); - Diffuse(commandBuffer, textures[TextureTypeDensity], state.Diffusion); + Project(commandBuffer); + Diffuse(commandBuffer, textures[TextureTypeDensity], state.Diffusion, 0); Advect2(commandBuffer); Bnd(commandBuffer, textures[TextureTypeDensity], 0); cooldown = kCooldown; @@ -1015,6 +1037,7 @@ int main(int argc, char** argv) { textures[i].Free(device); } + SDL_ReleaseGPUTexture(device, scratchTexture); SDL_ReleaseGPUTexture(device, colorTexture); SDL_ReleaseGPUSampler(device, sampler); for (int i = 0; i < PipelineTypeCount; i++) From df647c9b855d05d2c21d566c25e74bfaca52eb5c Mon Sep 17 00:00:00 2001 From: Jaan Soulier Date: Thu, 11 Jun 2026 18:45:40 -0400 Subject: [PATCH 2/2] v2 --- samples/1.json | 4 ++-- samples/10.json | 4 ++-- samples/11.json | 4 ++-- samples/2.json | 4 ++-- samples/3.json | 4 ++-- samples/4.json | 4 ++-- samples/5.json | 4 ++-- samples/6.json | 4 ++-- samples/7.json | 4 ++-- samples/8.json | 4 ++-- samples/9.json | 4 ++-- src/main.cpp | 9 ++++----- 12 files changed, 26 insertions(+), 27 deletions(-) diff --git a/samples/1.json b/samples/1.json index 8f5daaf..9958436 100644 --- a/samples/1.json +++ b/samples/1.json @@ -1,5 +1,5 @@ { - "Diffusion": 0.009999999776482582, + "Diffusion": 0.000004, "Iterations": 5, "Size": 128, "Spawners": [ @@ -22,5 +22,5 @@ "Value": 1.0 } ], - "Viscosity": 0.009999999776482582 + "Viscosity": 0.000004 } \ No newline at end of file diff --git a/samples/10.json b/samples/10.json index 427e372..6046720 100644 --- a/samples/10.json +++ b/samples/10.json @@ -1,5 +1,5 @@ { - "Diffusion": 0.009999999776482582, + "Diffusion": 0.000004, "Iterations": 5, "Size": 128, "Spawners": [ @@ -31,5 +31,5 @@ "Value": 8.0 } ], - "Viscosity": 0.009999999776482582 + "Viscosity": 0.000004 } \ No newline at end of file diff --git a/samples/11.json b/samples/11.json index e08b551..7306337 100644 --- a/samples/11.json +++ b/samples/11.json @@ -1,5 +1,5 @@ { - "Diffusion": 0.12800000607967377, + "Diffusion": 0.0000512, "Iterations": 5, "Size": 128, "Spawners": [ @@ -31,5 +31,5 @@ "Value": -618.0 } ], - "Viscosity": 0.009999999776482582 + "Viscosity": 0.000004 } \ No newline at end of file diff --git a/samples/2.json b/samples/2.json index 1e6023f..32223ca 100644 --- a/samples/2.json +++ b/samples/2.json @@ -1,5 +1,5 @@ { - "Diffusion": 0.12800000607967377, + "Diffusion": 0.0000512, "Iterations": 10, "Size": 128, "Spawners": [ @@ -31,5 +31,5 @@ "Value": 2.0 } ], - "Viscosity": 0.009999999776482582 + "Viscosity": 0.000004 } \ No newline at end of file diff --git a/samples/3.json b/samples/3.json index ddc89a1..34a5f7f 100644 --- a/samples/3.json +++ b/samples/3.json @@ -1,5 +1,5 @@ { - "Diffusion": 0.12800000607967377, + "Diffusion": 0.0000512, "Iterations": 10, "Size": 128, "Spawners": [ @@ -31,5 +31,5 @@ "Value": 1.0 } ], - "Viscosity": 0.009999999776482582 + "Viscosity": 0.000004 } \ No newline at end of file diff --git a/samples/4.json b/samples/4.json index 4bfa15c..a8c47d7 100644 --- a/samples/4.json +++ b/samples/4.json @@ -1,5 +1,5 @@ { - "Diffusion": 0.12800000607967377, + "Diffusion": 0.0000512, "Iterations": 7, "Size": 128, "Spawners": [ @@ -31,5 +31,5 @@ "Value": 2.0 } ], - "Viscosity": 0.009999999776482582 + "Viscosity": 0.000004 } \ No newline at end of file diff --git a/samples/5.json b/samples/5.json index d6facd4..b46f3c1 100644 --- a/samples/5.json +++ b/samples/5.json @@ -1,5 +1,5 @@ { - "Diffusion": 0.12800000607967377, + "Diffusion": 0.0000512, "Iterations": 5, "Size": 128, "Spawners": [ @@ -40,5 +40,5 @@ "Value": 65.0 } ], - "Viscosity": 0.009999999776482582 + "Viscosity": 0.000004 } \ No newline at end of file diff --git a/samples/6.json b/samples/6.json index 050be28..6dbeb53 100644 --- a/samples/6.json +++ b/samples/6.json @@ -1,5 +1,5 @@ { - "Diffusion": 0.12800000607967377, + "Diffusion": 0.0000512, "Iterations": 7, "Size": 128, "Spawners": [ @@ -40,5 +40,5 @@ "Value": 1.0 } ], - "Viscosity": 0.009999999776482582 + "Viscosity": 0.000004 } \ No newline at end of file diff --git a/samples/7.json b/samples/7.json index 8708c9f..1148294 100644 --- a/samples/7.json +++ b/samples/7.json @@ -1,5 +1,5 @@ { - "Diffusion": 0.08799999952316284, + "Diffusion": 0.0000352, "Iterations": 3, "Size": 128, "Spawners": [ @@ -40,5 +40,5 @@ "Value": 2.0 } ], - "Viscosity": 0.16500000655651093 + "Viscosity": 0.000066 } \ No newline at end of file diff --git a/samples/8.json b/samples/8.json index b3bff69..e960efc 100644 --- a/samples/8.json +++ b/samples/8.json @@ -1,5 +1,5 @@ { - "Diffusion": 0.12800000607967377, + "Diffusion": 0.0000512, "Iterations": 7, "Size": 128, "Spawners": [ @@ -40,5 +40,5 @@ "Value": -2.0 } ], - "Viscosity": 0.009999999776482582 + "Viscosity": 0.000004 } \ No newline at end of file diff --git a/samples/9.json b/samples/9.json index ad8e139..fb5261e 100644 --- a/samples/9.json +++ b/samples/9.json @@ -1,5 +1,5 @@ { - "Diffusion": 0.12800000607967377, + "Diffusion": 0.0000512, "Iterations": 5, "Size": 128, "Spawners": [ @@ -49,5 +49,5 @@ "Value": 2.0 } ], - "Viscosity": 0.009999999776482582 + "Viscosity": 0.000004 } \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 40803e3..de9af49 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -67,8 +67,8 @@ struct State { int Size = 128; int Iterations = 5; - float Diffusion = 0.01f; - float Viscosity = 0.01f; + float Diffusion = 0.000004f; + float Viscosity = 0.000004f; std::vector Spawners; NLOHMANN_DEFINE_TYPE_INTRUSIVE(State, Size, Iterations, Diffusion, Viscosity, Spawners) @@ -456,8 +456,8 @@ static void UpdateImGui(SDL_GPUCommandBuffer* commandBuffer) ImGui::SeparatorText("Settings"); ImGui::SliderFloat("Speed", &speed, 0.0f, 64.0f); ImGui::SliderInt("Iterations", &state.Iterations, 1, 50); - ImGui::SliderFloat("Diffusion", &state.Diffusion, 0.0f, 1.0f); - ImGui::SliderFloat("Viscosity", &state.Viscosity, 0.0f, 1.0f); + ImGui::SliderFloat("Diffusion", &state.Diffusion, 0.0f, 0.0001f, "%.7f", ImGuiSliderFlags_Logarithmic); + ImGui::SliderFloat("Viscosity", &state.Viscosity, 0.0f, 0.0001f, "%.7f", ImGuiSliderFlags_Logarithmic); if (ImGui::SliderInt("Size", &state.Size, 16, 256)) { CreateCells(); @@ -1043,7 +1043,6 @@ int main(int argc, char** argv) for (int i = 0; i < PipelineTypeCount; i++) { SDL_ReleaseGPUComputePipeline(device, pipelines[i]); - pipelines[i] = nullptr; } ImGui_ImplSDLGPU3_Shutdown(); ImGui_ImplSDL3_Shutdown();