Trying to fix fluid pass

This commit is contained in:
2026-04-12 21:39:31 +02:00
parent ac317a3829
commit 495e683522
7 changed files with 18 additions and 30 deletions
-4
View File
@@ -36,10 +36,6 @@
"name": "ASAN_OPTIONS",
"value": "detect_leaks=0",
},
{
"name": "VK_INSTANCE_LAYERS",
"value": "VK_LAYER_KHRONOS_validation",
},
{
"name": "DISABLE_VK_LAYER_VALVE_steam_overlay_1",
"value": "1",
@@ -73,22 +73,15 @@ void FluidRenderPass::render() {
void FluidRenderPass::endFrame() {}
void FluidRenderPass::publishOutputs() {
depthTexture = graphics->createTexture2D(TextureCreateInfo{
.format = Gfx::SE_FORMAT_D32_SFLOAT,
.width = viewport->getWidth(),
.height = viewport->getHeight(),
.usage = Gfx::SE_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
.name = "FluidDepth",
});
}
void FluidRenderPass::createRenderPass() {
colorAttachment = Gfx::RenderTargetAttachment(viewport, Gfx::SE_IMAGE_LAYOUT_UNDEFINED, Gfx::SE_IMAGE_LAYOUT_PRESENT_SRC_KHR,
Gfx::SE_ATTACHMENT_LOAD_OP_CLEAR, Gfx::SE_ATTACHMENT_STORE_OP_STORE);
depthAttachment = Gfx::RenderTargetAttachment(depthTexture->getDefaultView(), Gfx::SE_IMAGE_LAYOUT_UNDEFINED,
Gfx::SE_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, Gfx::SE_ATTACHMENT_LOAD_OP_CLEAR,
Gfx::SE_ATTACHMENT_STORE_OP_DONT_CARE);
depthAttachment.clear.depthStencil.depth = 0.0f;
colorAttachment = resources->requestRenderTarget("BASEPASS_COLOR");
colorAttachment.setLoadOp(Gfx::SE_ATTACHMENT_LOAD_OP_LOAD);
colorAttachment.setInitialLayout(Gfx::SE_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);
depthAttachment = resources->requestRenderTarget("BASEPASS_DEPTH");
depthAttachment.setLoadOp(Gfx::SE_ATTACHMENT_LOAD_OP_LOAD);
depthAttachment.setInitialLayout(Gfx::SE_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL);
Gfx::RenderTargetLayout layout = Gfx::RenderTargetLayout{
.colorAttachments = {colorAttachment},
.depthAttachment = depthAttachment,
@@ -22,7 +22,6 @@ class FluidRenderPass : public RenderPass {
private:
Gfx::RenderTargetAttachment colorAttachment;
Gfx::RenderTargetAttachment depthAttachment;
Gfx::OTexture2D depthTexture;
Gfx::ODescriptorSet viewParamsSet;
@@ -73,7 +73,6 @@ RayTracingPass::RayTracingPass(Gfx::PGraphics graphics, PScene scene) : RenderPa
.mainFile = "ClosestHit",
.useMaterial = true,
.rayTracing = true,
.dumpIntermediates = true,
});
skyBox = AssetRegistry::findEnvironmentMap("", "newport_loft")->getSkybox();
skyBoxSampler = graphics->createSampler({});
@@ -48,6 +48,7 @@ SurfaceExtractPass::SurfaceExtractPass(Gfx::PGraphics graphics, PScene scene) :
.modules = {"MarchingCubes"},
.entryPoints = {{"marchingCubes", "MarchingCubes"}},
.rootSignature = pipelineLayout,
.dumpIntermediate = true,
});
pipelineLayout->create();
computeShader = graphics->createComputeShader({0});
@@ -100,4 +101,4 @@ void SurfaceExtractPass::endFrame() {}
void SurfaceExtractPass::publishOutputs() {}
void SurfaceExtractPass::createRenderPass() { }
void SurfaceExtractPass::createRenderPass() {}
+2 -2
View File
@@ -268,7 +268,7 @@ void RenderCommand::bindDescriptor(Gfx::PDescriptorSet descriptor) {
}
}
if (descriptorSet->setHandle->constantsBuffer != nullptr) {
descriptorSet->setHandle->bind();
descriptorSet->setHandle->constantsBuffer->bind();
boundResources.add(PBufferAllocation(descriptorSet->setHandle->constantsBuffer));
}
@@ -299,7 +299,7 @@ void RenderCommand::bindDescriptor(const Array<Gfx::PDescriptorSet>& descriptorS
}
}
if (descriptorSet->setHandle->constantsBuffer != nullptr) {
descriptorSet->setHandle->bind();
descriptorSet->setHandle->constantsBuffer->bind();
boundResources.add(PBufferAllocation(descriptorSet->setHandle->constantsBuffer));
}
sets[layout->findParameter(descriptorSet->getName())] = descriptorSet->getHandle();
+3 -3
View File
@@ -29,9 +29,9 @@ GameView::GameView(Gfx::PGraphics graphics, PWindow window, const ViewportCreate
renderGraph.addPass(new LightCullingPass(graphics, scene));
renderGraph.addPass(new ShadowPass(graphics, scene));
renderGraph.addPass(new BasePass(graphics, scene));
// renderGraph.addPass(new SimulationComputePass(graphics, scene));
// renderGraph.addPass(new SurfaceExtractPass(graphics, scene));
// renderGraph.addPass(new FluidRenderPass(graphics, scene));
renderGraph.addPass(new SimulationComputePass(graphics, scene));
renderGraph.addPass(new SurfaceExtractPass(graphics, scene));
renderGraph.addPass(new FluidRenderPass(graphics, scene));
renderGraph.addPass(new ToneMappingPass(graphics));
renderGraph.setViewport(viewport);
renderGraph.createRenderPass();