Then chaining still kinda broken

This commit is contained in:
Dynamitos
2021-12-22 14:32:40 +01:00
parent 8ccaa26223
commit 79ced0a30f
14 changed files with 131 additions and 53 deletions
@@ -63,6 +63,7 @@ Job BasePassMeshProcessor::processMeshBatch(
collection->fragmentShader,
false);
}
std::unique_lock lock(commandLock);
renderCommands.add(renderCommand);
co_return;
}
@@ -160,6 +161,7 @@ MainJob BasePass::render()
co_await Job::all(jobs);
graphics->executeCommands(processor->getRenderCommands());
graphics->endRenderPass();
co_return;
}
MainJob BasePass::endFrame()
@@ -27,6 +27,7 @@ Job DepthPrepassMeshProcessor::processMeshBatch(
Array<Gfx::PDescriptorSet> descriptorSets,
int32 /*staticMeshId*/)
{
std::cout << "Depth job started" << std::endl;
PMaterialAsset material = batch.material;
//const Gfx::MaterialShadingModel shadingModel = material->getShadingModel();
@@ -60,7 +61,9 @@ Job DepthPrepassMeshProcessor::processMeshBatch(
collection->fragmentShader,
true);
}
std::unique_lock lock(commandLock);
renderCommands.add(renderCommand);
std::cout << "Finished depth job" << std::endl;
co_return;
}
@@ -127,8 +130,10 @@ MainJob DepthPrepass::render()
jobs.add(processor->processMeshBatch(meshBatch, renderPass, depthPrepassLayout, primitiveLayout, descriptorSets));
}
co_await Job::all(jobs);
std::cout << "Finished waiting depth jobs " << std::endl;
graphics->executeCommands(processor->getRenderCommands());
graphics->endRenderPass();
co_return;
}
MainJob DepthPrepass::endFrame()
@@ -20,9 +20,7 @@ public:
int32 staticMeshId = -1) override;
private:
//Array<Gfx::PDescriptorSet> cachedPrimitiveSets;
Gfx::PViewport target;
//uint32 cachedPrimitiveIndex;
};
DEFINE_REF(DepthPrepassMeshProcessor)
DECLARE_REF(CameraActor)
@@ -38,6 +38,7 @@ protected:
Gfx::PGeometryShader geometryShader,
Gfx::PFragmentShader fragmentShader,
bool positionOnly);
std::mutex commandLock;
Array<Gfx::PRenderCommand> renderCommands;
};
} // namespace Seele
@@ -233,7 +233,7 @@ PSubAllocation Allocator::allocate(const VkMemoryRequirements2 &memRequirements2
PAllocation newAllocation = new Allocation(graphics, this, requirements.size, memoryTypeIndex, properties, dedicatedInfo);
heaps[heapIndex].allocations.add(newAllocation);
return newAllocation->getSuballocation(requirements.size, requirements.alignment);
}
}
}
for (auto alloc : heaps[heapIndex].allocations)
{
@@ -74,6 +74,7 @@ void CmdBuffer::beginRenderPass(PRenderPass newRenderPass, PFramebuffer newFrame
beginInfo.framebuffer = framebuffer->getHandle();
vkCmdBeginRenderPass(handle, &beginInfo, renderPass->getSubpassContents());
state = State::RenderPassActive;
std::cout << "Beginning renderPass" << std::endl;
}
void CmdBuffer::endRenderPass()
@@ -81,6 +82,7 @@ void CmdBuffer::endRenderPass()
std::unique_lock lock(handleLock);
vkCmdEndRenderPass(handle);
state = State::InsideBegin;
std::cout << "Ending renderPass" << std::endl;
}
void CmdBuffer::executeCommands(const Array<Gfx::PRenderCommand>& commands)
@@ -88,7 +90,6 @@ void CmdBuffer::executeCommands(const Array<Gfx::PRenderCommand>& commands)
assert(state == State::RenderPassActive);
if(commands.size() == 0)
{
std::cout << "No commands!" << std::endl;
return;
}
std::unique_lock lock(handleLock);