Finished water for real this time
This commit is contained in:
@@ -26,7 +26,7 @@ void Seele::addDebugVertex(DebugVertex vert) { gDebugVertices.add(vert); }
|
||||
void Seele::addDebugVertices(Array<DebugVertex> verts) { gDebugVertices.addAll(verts); }
|
||||
|
||||
BasePass::BasePass(Gfx::PGraphics graphics, PScene scene) : RenderPass(graphics, scene) {
|
||||
//waterRenderer = new WaterRenderer(graphics, scene, viewParamsLayout);
|
||||
waterRenderer = new WaterRenderer(graphics, scene, viewParamsLayout);
|
||||
basePassLayout = graphics->createPipelineLayout("BasePassLayout");
|
||||
|
||||
basePassLayout->addDescriptorLayout(viewParamsLayout);
|
||||
@@ -472,7 +472,7 @@ void BasePass::createRenderPass() {
|
||||
oLightGrid = resources->requestTexture("LIGHTCULLING_OLIGHTGRID");
|
||||
tLightGrid = resources->requestTexture("LIGHTCULLING_TLIGHTGRID");
|
||||
|
||||
//waterRenderer->setViewport(viewport, renderPass);
|
||||
waterRenderer->setViewport(viewport, renderPass);
|
||||
|
||||
// Debug rendering
|
||||
{
|
||||
|
||||
@@ -358,6 +358,8 @@ void WaterRenderer::beginFrame() {
|
||||
.height = tile.height,
|
||||
});
|
||||
});
|
||||
if (payloads.size() == 0)
|
||||
return;
|
||||
waterTiles = graphics->createShaderBuffer(ShaderBufferCreateInfo{
|
||||
.sourceData =
|
||||
{
|
||||
@@ -435,7 +437,6 @@ void WaterRenderer::beginFrame() {
|
||||
|
||||
boyancyData->changeLayout(Gfx::SE_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, Gfx::SE_ACCESS_SHADER_WRITE_BIT,
|
||||
Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT, Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_SHADER_STAGE_MESH_BIT_EXT);
|
||||
|
||||
updateMaterialDescriptor();
|
||||
}
|
||||
|
||||
@@ -463,6 +464,7 @@ void WaterRenderer::setViewport(Gfx::PViewport _viewport, Gfx::PRenderPass rende
|
||||
},
|
||||
.rasterizationState =
|
||||
{
|
||||
//.polygonMode = Gfx::SE_POLYGON_MODE_LINE,
|
||||
.cullMode = Gfx::SE_CULL_MODE_BACK_BIT,
|
||||
},
|
||||
.colorBlend =
|
||||
|
||||
@@ -54,11 +54,25 @@ void ThreadPool::runAsync(std::function<void()> func) {
|
||||
queueCV.notify_one();
|
||||
}
|
||||
|
||||
void ThreadPool::waitIdle() {
|
||||
std::unique_lock l(queueLock);
|
||||
while (numWaiting < workers.size())
|
||||
{
|
||||
idleCV.wait(l);
|
||||
}
|
||||
}
|
||||
|
||||
void ThreadPool::work() {
|
||||
while (running) {
|
||||
std::unique_lock l(queueLock);
|
||||
while (queue.empty()) {
|
||||
numWaiting++;
|
||||
if (numWaiting == workers.size())
|
||||
{
|
||||
idleCV.notify_all();
|
||||
}
|
||||
queueCV.wait(l);
|
||||
numWaiting--;
|
||||
if (!running) {
|
||||
return;
|
||||
}
|
||||
@@ -72,7 +86,7 @@ void ThreadPool::work() {
|
||||
std::unique_lock t(taskLock);
|
||||
entry.task->numRemaining--;
|
||||
if (entry.task->numRemaining == 0) {
|
||||
completedCV.notify_one();
|
||||
completedCV.notify_all();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ class ThreadPool {
|
||||
~ThreadPool();
|
||||
void runAndWait(List<std::function<void()>> functions);
|
||||
void runAsync(std::function<void()> func);
|
||||
void waitIdle();
|
||||
private:
|
||||
struct TaskGroup {
|
||||
uint64 numRemaining = 0;
|
||||
@@ -22,6 +23,8 @@ class ThreadPool {
|
||||
|
||||
std::mutex queueLock;
|
||||
std::condition_variable queueCV;
|
||||
std::atomic_uint32_t numWaiting = 0;
|
||||
std::condition_variable idleCV;
|
||||
List<QueueEntry> queue;
|
||||
|
||||
void work();
|
||||
|
||||
Reference in New Issue
Block a user