somewhat fixed threadpool
This commit is contained in:
@@ -66,6 +66,7 @@ else()
|
||||
${ASSIMP_ROOT}/code
|
||||
DOC "Assimp library file")
|
||||
|
||||
|
||||
endif()
|
||||
|
||||
# Handle REQUIRD argument, define *_FOUND variable
|
||||
|
||||
@@ -7,9 +7,6 @@ list(APPEND DEPENDENCIES assimp)
|
||||
set(ASSIMP_BUILD_TESTS OFF CACHE INTERNAL "")
|
||||
set(ASSIMP_BUILD_SAMPLES OFF CACHE INTERNAL "")
|
||||
set(ASSIMP_BUILD_OVERALLS OFF CACHE INTERNAL "")
|
||||
set(ASSIMP_BUILD_ASSIMP_TOOLS OFF CACHE INTERNAL "")
|
||||
set(ASSIMP_INSTALL OFF CACHE INTERNAL "")
|
||||
set(ASSIMP_BUILD_ZLIB OFF CACHE INTERNAL "")
|
||||
set(BUILD_SHARED_LIBS ON CACHE INTERNAL "")
|
||||
|
||||
add_subdirectory(${ASSIMP_ROOT} ${ASSIMP_ROOT})
|
||||
@@ -18,6 +15,7 @@ if(WIN32)
|
||||
target_compile_options(assimp PRIVATE /WX-)
|
||||
else()
|
||||
target_compile_options(assimp PRIVATE -Wno-error -fPIC)
|
||||
target_compile_options(IrrXML PRIVATE -fPIC)
|
||||
endif()
|
||||
#-------------BOOST----------------
|
||||
list(APPEND DEPENDENCIES boost)
|
||||
|
||||
@@ -72,6 +72,6 @@ float4 fragmentMain(
|
||||
PointLight pointLight = pointLights[lightIndex];
|
||||
result += pointLight.illuminate(materialParams, brdf, viewDir);
|
||||
}
|
||||
return float4(result, 1);
|
||||
return float4(result, 0.1f);
|
||||
}
|
||||
|
||||
|
||||
@@ -165,6 +165,7 @@ public:
|
||||
{
|
||||
add(it);
|
||||
}
|
||||
markIteratorDirty();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -182,6 +183,7 @@ public:
|
||||
endIt = other.endIt;
|
||||
_size = other._size;
|
||||
other._size = 0;
|
||||
markIteratorDirty();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -206,6 +208,7 @@ public:
|
||||
deallocateNode(tmp->prev);
|
||||
}
|
||||
deallocateNode(tail);
|
||||
markIteratorDirty();
|
||||
tail = nullptr;
|
||||
root = nullptr;
|
||||
}
|
||||
@@ -347,6 +350,7 @@ public:
|
||||
newNode->prev = tmp;
|
||||
newNode->next = pos.node;
|
||||
pos.node->prev = newNode;
|
||||
markIteratorDirty();
|
||||
return Iterator(newNode);
|
||||
}
|
||||
iterator find(const T &value)
|
||||
@@ -360,11 +364,11 @@ public:
|
||||
}
|
||||
return endIt;
|
||||
}
|
||||
bool empty()
|
||||
bool empty() const
|
||||
{
|
||||
return _size == 0;
|
||||
}
|
||||
size_type size()
|
||||
size_type size() const
|
||||
{
|
||||
return _size;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ BasePassMeshProcessor::BasePassMeshProcessor(Gfx::PViewport viewport, Gfx::PGrap
|
||||
: MeshProcessor(graphics)
|
||||
, target(viewport)
|
||||
, translucentBasePass(translucentBasePass)
|
||||
, cachedPrimitiveIndex(0)
|
||||
//, cachedPrimitiveIndex(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -29,28 +29,26 @@ void BasePassMeshProcessor::addMeshBatch(
|
||||
Array<Gfx::PDescriptorSet>& descriptorSets,
|
||||
int32 /*staticMeshId*/)
|
||||
{
|
||||
const PMaterialAsset material = batch.material;
|
||||
PMaterialAsset material = batch.material;
|
||||
//const Gfx::MaterialShadingModel shadingModel = material->getShadingModel();
|
||||
|
||||
const PVertexShaderInput vertexInput = batch.vertexInput;
|
||||
|
||||
const Gfx::ShaderCollection* collection = material->getShaders(Gfx::RenderPassType::BasePass, vertexInput->getType());
|
||||
assert(collection != nullptr);
|
||||
|
||||
Gfx::PRenderCommand renderCommand = graphics->createRenderCommand();
|
||||
renderCommand->setViewport(target);
|
||||
pipelineLayout->addDescriptorLayout(BasePass::INDEX_MATERIAL, material->getDescriptorLayout());
|
||||
pipelineLayout->create();
|
||||
Gfx::PDescriptorSet materialSet = material->createDescriptorSet();
|
||||
descriptorSets[BasePass::INDEX_MATERIAL] = materialSet;
|
||||
for(uint32 i = 0; i < batch.elements.size(); ++i)
|
||||
{
|
||||
Gfx::PDescriptorSet descriptorSet = primitiveLayout->allocateDescriptorSet();
|
||||
descriptorSet->updateBuffer(0, batch.elements[i].uniformBuffer);
|
||||
descriptorSet->writeChanges();
|
||||
cachedPrimitiveSets.add(descriptorSet);
|
||||
}
|
||||
Gfx::PRenderCommand renderCommand = graphics->createRenderCommand();
|
||||
renderCommand->setViewport(target);
|
||||
for(uint32 i = 0; i < batch.elements.size(); ++i)
|
||||
{
|
||||
pipelineLayout->addDescriptorLayout(BasePass::INDEX_MATERIAL, material->getDescriptorLayout());
|
||||
pipelineLayout->create();
|
||||
descriptorSets[BasePass::INDEX_MATERIAL] = material->getDescriptor();
|
||||
descriptorSets[BasePass::INDEX_SCENE_DATA] = cachedPrimitiveSets[cachedPrimitiveIndex++];
|
||||
descriptorSets[BasePass::INDEX_SCENE_DATA] = descriptorSet;
|
||||
buildMeshDrawCommand(batch,
|
||||
// primitiveComponent,
|
||||
renderPass,
|
||||
@@ -75,8 +73,6 @@ Array<Gfx::PRenderCommand> BasePassMeshProcessor::getRenderCommands()
|
||||
void BasePassMeshProcessor::clearCommands()
|
||||
{
|
||||
renderCommands.clear();
|
||||
cachedPrimitiveSets.clear();
|
||||
cachedPrimitiveIndex = 0;
|
||||
}
|
||||
|
||||
BasePass::BasePass(Gfx::PGraphics graphics, Gfx::PViewport viewport, PCameraActor source)
|
||||
@@ -148,8 +144,7 @@ void BasePass::beginFrame()
|
||||
|
||||
void BasePass::render()
|
||||
{
|
||||
|
||||
oLightIndexList->pipelineBarrier(
|
||||
oLightIndexList->pipelineBarrier(
|
||||
Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_FRAGMENT_SHADER_BIT);
|
||||
oLightGrid->pipelineBarrier(
|
||||
|
||||
@@ -23,10 +23,10 @@ public:
|
||||
void clearCommands();
|
||||
private:
|
||||
Array<Gfx::PRenderCommand> renderCommands;
|
||||
Array<Gfx::PDescriptorSet> cachedPrimitiveSets;
|
||||
//Array<Gfx::PDescriptorSet> cachedPrimitiveSets;
|
||||
Gfx::PViewport target;
|
||||
uint8 translucentBasePass;
|
||||
uint32 cachedPrimitiveIndex;
|
||||
//uint32 cachedPrimitiveIndex;
|
||||
};
|
||||
DEFINE_REF(BasePassMeshProcessor)
|
||||
DECLARE_REF(CameraActor)
|
||||
|
||||
@@ -11,7 +11,6 @@ using namespace Seele;
|
||||
DepthPrepassMeshProcessor::DepthPrepassMeshProcessor(Gfx::PViewport viewport, Gfx::PGraphics graphics)
|
||||
: MeshProcessor(graphics)
|
||||
, target(viewport)
|
||||
, cachedPrimitiveIndex(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -28,28 +27,26 @@ void DepthPrepassMeshProcessor::addMeshBatch(
|
||||
Array<Gfx::PDescriptorSet>& descriptorSets,
|
||||
int32 /*staticMeshId*/)
|
||||
{
|
||||
const PMaterialAsset material = batch.material;
|
||||
PMaterialAsset material = batch.material;
|
||||
//const Gfx::MaterialShadingModel shadingModel = material->getShadingModel();
|
||||
|
||||
const PVertexShaderInput vertexInput = batch.vertexInput;
|
||||
|
||||
const Gfx::ShaderCollection* collection = material->getShaders(Gfx::RenderPassType::DepthPrepass, vertexInput->getType());
|
||||
assert(collection != nullptr);
|
||||
|
||||
Gfx::PRenderCommand renderCommand = graphics->createRenderCommand();
|
||||
renderCommand->setViewport(target);
|
||||
pipelineLayout->addDescriptorLayout(DepthPrepass::INDEX_MATERIAL, material->getDescriptorLayout());
|
||||
pipelineLayout->create();
|
||||
Gfx::PDescriptorSet materialSet = material->createDescriptorSet();
|
||||
descriptorSets[DepthPrepass::INDEX_MATERIAL] = materialSet;
|
||||
for(uint32 i = 0; i < batch.elements.size(); ++i)
|
||||
{
|
||||
{
|
||||
Gfx::PDescriptorSet descriptorSet = primitiveLayout->allocateDescriptorSet();
|
||||
descriptorSet->updateBuffer(0, batch.elements[i].uniformBuffer);
|
||||
descriptorSet->writeChanges();
|
||||
cachedPrimitiveSets.add(descriptorSet);
|
||||
}
|
||||
Gfx::PRenderCommand renderCommand = graphics->createRenderCommand();
|
||||
renderCommand->setViewport(target);
|
||||
for(uint32 i = 0; i < batch.elements.size(); ++i)
|
||||
{
|
||||
pipelineLayout->addDescriptorLayout(DepthPrepass::INDEX_MATERIAL, material->getDescriptorLayout());
|
||||
pipelineLayout->create();
|
||||
descriptorSets[DepthPrepass::INDEX_MATERIAL] = material->getDescriptor();
|
||||
descriptorSets[DepthPrepass::INDEX_SCENE_DATA] = cachedPrimitiveSets[cachedPrimitiveIndex++];
|
||||
descriptorSets[DepthPrepass::INDEX_SCENE_DATA] = descriptorSet;
|
||||
buildMeshDrawCommand(batch,
|
||||
// primitiveComponent,
|
||||
renderPass,
|
||||
@@ -74,8 +71,8 @@ Array<Gfx::PRenderCommand> DepthPrepassMeshProcessor::getRenderCommands()
|
||||
void DepthPrepassMeshProcessor::clearCommands()
|
||||
{
|
||||
renderCommands.clear();
|
||||
cachedPrimitiveSets.clear();
|
||||
cachedPrimitiveIndex = 0;
|
||||
//cachedPrimitiveSets.clear();
|
||||
//cachedPrimitiveIndex = 0;
|
||||
}
|
||||
|
||||
DepthPrepass::DepthPrepass(Gfx::PGraphics graphics, Gfx::PViewport viewport, PCameraActor source)
|
||||
@@ -129,6 +126,7 @@ void DepthPrepass::beginFrame()
|
||||
|
||||
void DepthPrepass::render()
|
||||
{
|
||||
|
||||
depthAttachment->getTexture()->pipelineBarrier(
|
||||
Gfx::SE_ACCESS_SHADER_READ_BIT, Gfx::SE_PIPELINE_STAGE_COMPUTE_SHADER_BIT,
|
||||
Gfx::SE_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT);
|
||||
|
||||
@@ -23,9 +23,9 @@ public:
|
||||
void clearCommands();
|
||||
private:
|
||||
Array<Gfx::PRenderCommand> renderCommands;
|
||||
Array<Gfx::PDescriptorSet> cachedPrimitiveSets;
|
||||
//Array<Gfx::PDescriptorSet> cachedPrimitiveSets;
|
||||
Gfx::PViewport target;
|
||||
uint32 cachedPrimitiveIndex;
|
||||
//uint32 cachedPrimitiveIndex;
|
||||
};
|
||||
DEFINE_REF(DepthPrepassMeshProcessor)
|
||||
DECLARE_REF(CameraActor)
|
||||
|
||||
@@ -87,6 +87,7 @@ void CmdBuffer::executeCommands(const Array<Gfx::PRenderCommand>& commands)
|
||||
executingRenders.add(command);
|
||||
for(auto descriptor : command->boundDescriptors)
|
||||
{
|
||||
descriptor->free();
|
||||
boundDescriptors.add(descriptor);
|
||||
}
|
||||
cmdBuffers[i] = command->getHandle();
|
||||
@@ -104,6 +105,7 @@ void CmdBuffer::executeCommands(const Array<Gfx::PComputeCommand>& commands)
|
||||
executingComputes.add(command);
|
||||
for(auto descriptor : command->boundDescriptors)
|
||||
{
|
||||
descriptor->free();
|
||||
boundDescriptors.add(descriptor);
|
||||
}
|
||||
cmdBuffers[i] = command->getHandle();
|
||||
|
||||
@@ -117,12 +117,12 @@ DescriptorSet::~DescriptorSet()
|
||||
void DescriptorSet::updateBuffer(uint32_t binding, Gfx::PUniformBuffer uniformBuffer)
|
||||
{
|
||||
PUniformBuffer vulkanBuffer = uniformBuffer.cast<UniformBuffer>();
|
||||
//UniformBuffer* cachedBuffer = reinterpret_cast<UniformBuffer*>(cachedData[binding]);
|
||||
/*if(vulkanBuffer->isDataEquals(cachedBuffer))
|
||||
UniformBuffer* cachedBuffer = reinterpret_cast<UniformBuffer*>(cachedData[binding]);
|
||||
if(vulkanBuffer->isDataEquals(cachedBuffer))
|
||||
{
|
||||
std::cout << "uniform data equal, skip" << std::endl;
|
||||
return;
|
||||
}*/
|
||||
}
|
||||
bufferInfos.add(init::DescriptorBufferInfo(vulkanBuffer->getHandle(), 0, vulkanBuffer->getSize()));
|
||||
|
||||
VkWriteDescriptorSet writeDescriptor = init::WriteDescriptorSet(setHandle, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, binding, &bufferInfos.back());
|
||||
|
||||
@@ -152,10 +152,9 @@ void MaterialAsset::endFrame()
|
||||
{
|
||||
}
|
||||
|
||||
void MaterialAsset::updateDescriptorData()
|
||||
Gfx::PDescriptorSet MaterialAsset::createDescriptorSet()
|
||||
{
|
||||
layout->reset();
|
||||
descriptorSet = layout->allocateDescriptorSet();
|
||||
Gfx::PDescriptorSet descriptorSet = layout->allocateDescriptorSet();
|
||||
BulkResourceData uniformUpdate;
|
||||
uniformUpdate.size = uniformDataSize;
|
||||
uniformUpdate.data = uniformData;
|
||||
@@ -169,8 +168,10 @@ void MaterialAsset::updateDescriptorData()
|
||||
descriptorSet->updateBuffer(uniformBinding, uniformBuffer);
|
||||
}
|
||||
descriptorSet->writeChanges();
|
||||
return descriptorSet;
|
||||
}
|
||||
|
||||
|
||||
const Gfx::ShaderCollection* MaterialAsset::getShaders(Gfx::RenderPassType renderPass, VertexInputType* vertexInput) const
|
||||
{
|
||||
Gfx::ShaderPermutation permutation;
|
||||
|
||||
@@ -20,10 +20,7 @@ public:
|
||||
Gfx::SeBlendOp getBlendMode() const {return Gfx::SE_BLEND_OP_END_RANGE;}
|
||||
Gfx::MaterialShadingModel getShadingModel() const {return Gfx::MaterialShadingModel::DefaultLit;}
|
||||
|
||||
// This needs to be called while the descriptorset is unused
|
||||
void updateDescriptorData();
|
||||
void resetDescriptorSet();
|
||||
const Gfx::PDescriptorSet getDescriptor() const { return descriptorSet; };
|
||||
Gfx::PDescriptorSet createDescriptorSet();
|
||||
|
||||
Gfx::PDescriptorLayout getDescriptorLayout() const { return layout; }
|
||||
// The name of the generated material shader, opposed to the name of the .asset file
|
||||
@@ -37,7 +34,6 @@ private:
|
||||
|
||||
//For now its simply the collection of parameters, since there is no point for expressions
|
||||
Array<PShaderParameter> parameters;
|
||||
Gfx::PDescriptorSet descriptorSet;
|
||||
Gfx::PDescriptorLayout layout;
|
||||
Gfx::PUniformBuffer uniformBuffer;
|
||||
uint32 uniformDataSize;
|
||||
|
||||
@@ -35,10 +35,6 @@ Scene::~Scene()
|
||||
|
||||
void Scene::tick(double deltaTime)
|
||||
{
|
||||
for(auto &&meshBatch : staticMeshes)
|
||||
{
|
||||
meshBatch.material->updateDescriptorData();
|
||||
}
|
||||
}
|
||||
|
||||
void Scene::addActor(PActor actor)
|
||||
|
||||
@@ -53,7 +53,7 @@ void ThreadPool::addJob(Job&& job)
|
||||
void ThreadPool::addJob(MainJob&& job)
|
||||
{
|
||||
std::unique_lock lock(mainJobLock);
|
||||
//std::cout << "Adding main job " << job << std::endl;
|
||||
//std::cout << "Adding main job " << std::addressof(job.handle) << std::endl;
|
||||
mainJobs.add(std::move(job));
|
||||
mainJobCV.notify_one();
|
||||
}
|
||||
@@ -65,7 +65,7 @@ void ThreadPool::enqueueWaiting(Event* event, Job&& job)
|
||||
}
|
||||
void ThreadPool::enqueueWaiting(Event* event, MainJob&& job)
|
||||
{
|
||||
//std::cout << job << " main waiting for event " << event->name << std::endl;
|
||||
//std::cout << std::addressof(job.handle) << " main waiting for event " << event->name << std::endl;
|
||||
std::unique_lock lock(waitingMainLock);
|
||||
waitingMainJobs[*event].add(std::move(job));
|
||||
}
|
||||
@@ -74,23 +74,19 @@ void ThreadPool::notify(Event* event)
|
||||
{
|
||||
std::unique_lock lock(jobQueueLock);
|
||||
std::unique_lock lock2(waitingLock);
|
||||
for(Job& job : waitingJobs[*event])
|
||||
while(!waitingJobs.empty())
|
||||
{
|
||||
//std::cout << "Waking up job " << job << std::endl;
|
||||
jobQueue.add(std::move(job));
|
||||
jobQueue.add(std::move(waitingJobs[*event].retrieve()));
|
||||
jobQueueCV.notify_one();
|
||||
}
|
||||
waitingJobs[*event].clear();
|
||||
}
|
||||
{
|
||||
std::unique_lock lock(mainJobLock);
|
||||
std::unique_lock lock2(waitingMainLock);
|
||||
auto&& jobsToQueue = std::move(waitingMainJobs[*event]);
|
||||
waitingMainJobs.erase(*event);
|
||||
for(MainJob& job : jobsToQueue)
|
||||
while(!waitingMainJobs[*event].empty())
|
||||
{
|
||||
//std::cout << "Waking up main job " << job << std::endl;
|
||||
mainJobs.add(std::move(job));
|
||||
mainJobs.add(std::move(waitingMainJobs[*event].retrieve()));
|
||||
mainJobCV.notify_one();
|
||||
}
|
||||
}
|
||||
|
||||
+10
-16
@@ -35,7 +35,14 @@ public:
|
||||
explicit JobBase(std::coroutine_handle<promise_type> handle)
|
||||
: handle(handle)
|
||||
{
|
||||
std::cout << "Creating job " << handle.address() << std::endl;
|
||||
/*if constexpr(MainJob)
|
||||
{
|
||||
std::cout << "Creating mainjob " << handle.address() << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Creating job " << handle.address() << std::endl;
|
||||
}*/
|
||||
}
|
||||
JobBase(const JobBase & rhs) = delete;
|
||||
JobBase(JobBase&& rhs)
|
||||
@@ -47,7 +54,6 @@ public:
|
||||
{
|
||||
if(handle)
|
||||
{
|
||||
std::cout << "Destroying job " << handle.address() << std::endl;
|
||||
handle.destroy();
|
||||
}
|
||||
}
|
||||
@@ -61,24 +67,12 @@ public:
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
friend std::basic_ostream<char>& operator<<(std::basic_ostream<char>& stream, const JobBase& obj)
|
||||
{
|
||||
if (obj.handle == nullptr)
|
||||
{
|
||||
stream << nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
stream << obj.handle.address();
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
void resume()
|
||||
{
|
||||
handle.resume();
|
||||
}
|
||||
private:
|
||||
std::coroutine_handle<promise_type> handle;
|
||||
private:
|
||||
};
|
||||
|
||||
using MainJob = JobBase<true>;
|
||||
@@ -91,7 +85,7 @@ public:
|
||||
Event(const std::string& name);
|
||||
auto operator<=>(const Event& other) const
|
||||
{
|
||||
return name <=> other.name;
|
||||
return flag <=> other.flag;
|
||||
}
|
||||
Event operator co_await()
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
using namespace Seele;
|
||||
|
||||
InspectorView::InspectorView(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo &createInfo)
|
||||
: View(graphics, window, createInfo)
|
||||
: View(graphics, window, createInfo, "InspectorView")
|
||||
, uiPass(UIPass(graphics, viewport, new Gfx::SwapchainAttachment(window->getGfxHandle())))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
using namespace Seele;
|
||||
|
||||
Seele::SceneView::SceneView(Gfx::PGraphics graphics, PWindow owner, const ViewportCreateInfo &createInfo)
|
||||
: View(graphics, owner, createInfo)
|
||||
: View(graphics, owner, createInfo, "SceneView")
|
||||
, activeCamera(new CameraActor())
|
||||
, depthPrepass(DepthPrepass(graphics, viewport, activeCamera))
|
||||
, lightCullingPass(LightCullingPass(graphics, viewport, activeCamera))
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
using namespace Seele;
|
||||
|
||||
View::View(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo &viewportInfo)
|
||||
: graphics(graphics), owner(window)
|
||||
View::View(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo &viewportInfo, std::string name)
|
||||
: graphics(graphics), owner(window), name(name)
|
||||
{
|
||||
viewport = graphics->createViewport(owner->getGfxHandle(), viewportInfo);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ DECLARE_REF(Window)
|
||||
class View
|
||||
{
|
||||
public:
|
||||
View(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo &createInfo);
|
||||
View(Gfx::PGraphics graphics, PWindow window, const ViewportCreateInfo &createInfo, std::string name);
|
||||
virtual ~View();
|
||||
|
||||
// These are called from the view thread, and handle updating game data
|
||||
@@ -28,6 +28,7 @@ protected:
|
||||
Gfx::PGraphics graphics;
|
||||
Gfx::PViewport viewport;
|
||||
PWindow owner;
|
||||
std::string name;
|
||||
|
||||
virtual void keyCallback(KeyCode code, InputAction action, KeyModifier modifier) = 0;
|
||||
virtual void mouseMoveCallback(double xPos, double yPos) = 0;
|
||||
|
||||
@@ -18,7 +18,7 @@ void Window::addView(PView view)
|
||||
{
|
||||
WindowView* windowView = new WindowView();
|
||||
windowView->view = view;
|
||||
windowView->updateFinished = Event("test");
|
||||
windowView->updateFinished = Event(view->name);
|
||||
//windowView->worker = std::thread(&Window::viewWorker, this, windowView);
|
||||
views.add(windowView);
|
||||
viewWorker(views.size() - 1);
|
||||
@@ -30,7 +30,6 @@ MainJob Window::render()
|
||||
for(auto& windowView : views)
|
||||
{
|
||||
co_await windowView->updateFinished;
|
||||
std::cout << "view update finished" << std::endl;
|
||||
{
|
||||
std::unique_lock lock(windowView->workerMutex);
|
||||
windowView->view->prepareRender();
|
||||
@@ -73,7 +72,7 @@ Job Window::viewWorker(size_t viewIndex)
|
||||
std::unique_lock lock(windowView->workerMutex);
|
||||
windowView->view->commitUpdate();
|
||||
}
|
||||
std::cout << "Update completed" << std::endl;
|
||||
//std::cout << "Update completed" << std::endl;
|
||||
windowView->updateFinished.raise();
|
||||
// enqueue next frame update
|
||||
viewWorker(viewIndex);
|
||||
|
||||
Reference in New Issue
Block a user