idk
This commit is contained in:
Vendored
+1
-1
@@ -27,7 +27,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Editor (Linux)",
|
"name": "Editor (Linux)",
|
||||||
"type": "cppdbg",
|
"type": "lldb",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "${workspaceRoot}/build/Editor",
|
"program": "${workspaceRoot}/build/Editor",
|
||||||
"args": [],
|
"args": [],
|
||||||
|
|||||||
@@ -31,17 +31,17 @@ void reinitialize(uint3 dispatchThreadID : SV_DispatchThreadID)
|
|||||||
float dx = 1.0f;
|
float dx = 1.0f;
|
||||||
|
|
||||||
// Current value and original sign
|
// 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);
|
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
|
// Forward and backward differences
|
||||||
float dxp = phi[x + 1, y, z] - p;
|
float dxp = phi0[x + 1, y, z] - p;
|
||||||
float dxm = p - phi[x - 1, y, z];
|
float dxm = p - phi0[x - 1, y, z];
|
||||||
float dyp = phi[x, y + 1, z] - p;
|
float dyp = phi0[x, y + 1, z] - p;
|
||||||
float dym = p - phi[x, y - 1, z];
|
float dym = p - phi0[x, y - 1, z];
|
||||||
float dzp = phi[x, y, z + 1] - p;
|
float dzp = phi0[x, y, z + 1] - p;
|
||||||
float dzm = p - phi[x, y, z - 1];
|
float dzm = p - phi0[x, y, z - 1];
|
||||||
|
|
||||||
// Godunov upwind scheme
|
// Godunov upwind scheme
|
||||||
float gradPhi;
|
float gradPhi;
|
||||||
|
|||||||
@@ -350,6 +350,11 @@ void SimulationComputePass::render() {
|
|||||||
Gfx::PShaderBuffer pressureNext = data.velocityZBuffer;
|
Gfx::PShaderBuffer pressureNext = data.velocityZBuffer;
|
||||||
divergencePass(divergence, pressureCurrent, data.velocityX0Buffer, data.velocityY0Buffer, data.velocityZ0Buffer, data.gridSize);
|
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) {
|
for (int iteration = 0; iteration < pressureSolveIterations; ++iteration) {
|
||||||
linearSolvePass(pressureNext, pressureCurrent, divergence, 1, 6, data.gridSize);
|
linearSolvePass(pressureNext, pressureCurrent, divergence, 1, 6, data.gridSize);
|
||||||
|
|
||||||
@@ -388,6 +393,9 @@ void SimulationComputePass::render() {
|
|||||||
Gfx::PShaderBuffer advectedPressureCurrent = data.velocityYNextBuffer;
|
Gfx::PShaderBuffer advectedPressureCurrent = data.velocityYNextBuffer;
|
||||||
Gfx::PShaderBuffer advectedPressureNext = data.velocityZNextBuffer;
|
Gfx::PShaderBuffer advectedPressureNext = data.velocityZNextBuffer;
|
||||||
divergencePass(advectedDivergence, advectedPressureCurrent, data.velocityXBuffer, data.velocityYBuffer, data.velocityZBuffer, data.gridSize);
|
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) {
|
for (int iteration = 0; iteration < pressureSolveIterations; ++iteration) {
|
||||||
linearSolvePass(advectedPressureNext, advectedPressureCurrent, advectedDivergence, 1, 6, data.gridSize);
|
linearSolvePass(advectedPressureNext, advectedPressureCurrent, advectedDivergence, 1, 6, data.gridSize);
|
||||||
setBoundsPass(advectedPressureNext, 0, data.gridSize);
|
setBoundsPass(advectedPressureNext, 0, data.gridSize);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
"vulkan",
|
||||||
{
|
{
|
||||||
"name": "vulkan-memory-allocator"
|
"name": "vulkan-memory-allocator"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user