somewhat fixed threadpool
This commit is contained in:
@@ -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