Compare commits
1
Commits
424dea0012
...
bedeb8f059
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bedeb8f059 |
Vendored
+1
-1
@@ -27,7 +27,7 @@
|
||||
},
|
||||
{
|
||||
"name": "Editor (Linux)",
|
||||
"type": "cppdbg",
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/build/Editor",
|
||||
"args": [],
|
||||
|
||||
@@ -31,17 +31,17 @@ void reinitialize(uint3 dispatchThreadID : SV_DispatchThreadID)
|
||||
float dx = 1.0f;
|
||||
|
||||
// Current value and original sign
|
||||
float p = phi[x, y, z];
|
||||
float p = phi0[x, y, z];
|
||||
float s = smoothSign(phi0[x, y, z], dx);
|
||||
|
||||
// Upwind finite differences for |grad phi|
|
||||
// Upwind finite differences for |grad phi| — read from snapshot to avoid race
|
||||
// Forward and backward differences
|
||||
float dxp = phi[x + 1, y, z] - p;
|
||||
float dxm = p - phi[x - 1, y, z];
|
||||
float dyp = phi[x, y + 1, z] - p;
|
||||
float dym = p - phi[x, y - 1, z];
|
||||
float dzp = phi[x, y, z + 1] - p;
|
||||
float dzm = p - phi[x, y, z - 1];
|
||||
float dxp = phi0[x + 1, y, z] - p;
|
||||
float dxm = p - phi0[x - 1, y, z];
|
||||
float dyp = phi0[x, y + 1, z] - p;
|
||||
float dym = p - phi0[x, y - 1, z];
|
||||
float dzp = phi0[x, y, z + 1] - p;
|
||||
float dzm = p - phi0[x, y, z - 1];
|
||||
|
||||
// Godunov upwind scheme
|
||||
float gradPhi;
|
||||
|
||||
@@ -350,6 +350,11 @@ void SimulationComputePass::render() {
|
||||
Gfx::PShaderBuffer pressureNext = data.velocityZBuffer;
|
||||
divergencePass(divergence, pressureCurrent, data.velocityX0Buffer, data.velocityY0Buffer, data.velocityZ0Buffer, data.gridSize);
|
||||
|
||||
// Divergence/pressure buffers are aliased to velocity buffers whose boundary
|
||||
// cells still contain stale velocity data. Zero the boundaries before solving.
|
||||
setBoundsPass(divergence, 0, data.gridSize);
|
||||
setBoundsPass(pressureCurrent, 0, data.gridSize);
|
||||
|
||||
for (int iteration = 0; iteration < pressureSolveIterations; ++iteration) {
|
||||
linearSolvePass(pressureNext, pressureCurrent, divergence, 1, 6, data.gridSize);
|
||||
|
||||
@@ -388,6 +393,9 @@ void SimulationComputePass::render() {
|
||||
Gfx::PShaderBuffer advectedPressureCurrent = data.velocityYNextBuffer;
|
||||
Gfx::PShaderBuffer advectedPressureNext = data.velocityZNextBuffer;
|
||||
divergencePass(advectedDivergence, advectedPressureCurrent, data.velocityXBuffer, data.velocityYBuffer, data.velocityZBuffer, data.gridSize);
|
||||
setBoundsPass(advectedDivergence, 0, data.gridSize);
|
||||
setBoundsPass(advectedPressureCurrent, 0, data.gridSize);
|
||||
|
||||
for (int iteration = 0; iteration < pressureSolveIterations; ++iteration) {
|
||||
linearSolvePass(advectedPressureNext, advectedPressureCurrent, advectedDivergence, 1, 6, data.gridSize);
|
||||
setBoundsPass(advectedPressureNext, 0, data.gridSize);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"dependencies": [
|
||||
"vulkan",
|
||||
{
|
||||
"name": "vulkan-memory-allocator"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user