Working on adding rendering from the workload

This commit is contained in:
samcake 2018-02-16 17:21:07 -08:00
parent 6d347cf44f
commit 9441bb477d
4 changed files with 82 additions and 4 deletions

View file

@ -2209,7 +2209,8 @@ Application::~Application() {
// shutdown render engine
_main3DScene = nullptr;
_renderEngine = nullptr;
_infinityEngine = nullptr;
_gameWorkload.shutdown();
DependencyManager::destroy<Preferences>();
@ -2332,6 +2333,8 @@ void Application::initializeGL() {
DependencyManager::get<GeometryCache>()->initializeShapePipelines();
});
_gameWorkload.startup();
_offscreenContext = new OffscreenGLCanvas();
_offscreenContext->setObjectName("MainThreadContext");
_offscreenContext->create(_glWidget->qglContext());
@ -4099,7 +4102,7 @@ void Application::idle() {
}
{
_infinityEngine->run();
_gameWorkload._engine->run();
}
{
PerformanceTimer perfTimer("update");

View file

@ -69,7 +69,8 @@
#include "ui/OverlayConductor.h"
#include "ui/overlays/Overlays.h"
#include "UndoStackScriptingInterface.h"
#include "workload/Engine.h"
#include "workload/GameWorkload.h"
#include <procedural/ProceduralSkybox.h>
#include <graphics/Skybox.h>
@ -616,7 +617,8 @@ private:
render::ScenePointer _main3DScene{ new render::Scene(glm::vec3(-0.5f * (float)TREE_SCALE), (float)TREE_SCALE) };
render::EnginePointer _renderEngine{ new render::Engine() };
gpu::ContextPointer _gpuContext; // initialized during window creation
workload::EnginePointer _infinityEngine{ new workload::Engine() };
GameWorkload _gameWorkload;
mutable QMutex _renderArgsMutex{ QMutex::Recursive };
struct AppRenderArgs {

View file

@ -0,0 +1,32 @@
//
// GameWorkload.cpp
//
// Created by Sam Gateau on 2/16/2018.
// Copyright 2018 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "GameWorkload.h"
GameWorkload::GameWorkload() {
}
GameWorkload::~GameWorkload() {
shutdown();
}
void GameWorkload::startup() {
_engine.reset(new workload::Engine());
_engine.addJob<GameSpaceToRender>();
}
void GameWorkload::shutdown() {
_engine.reset();
}
void GameSpaceToRender::run(const workload::WorkloadContextPointer& renderContext, Outputs& outputs) {
}

View file

@ -0,0 +1,41 @@
//
// GameWorkload.h
//
// Created by Sam Gateau on 2/16/2018.
// Copyright 2018 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_GameWorkload_h
#define hifi_GameWorkload_h
#include "workload/Space.h"
#include "workload/Engine.h"
#include "render/Scene.h"
class GameSpaceToRender {
public:
using Outputs = render::Transaction;
using JobModel = workload::Job::ModelO<GameSpaceToRender, Outputs>;
GameSpaceToRender() {}
void run(const workload::WorkloadContextPointer& renderContext, Outputs& outputs);
protected:
};
class GameWorkload {
public:
GameWorkload();
~GameWorkload();
void startup();
void shutdown();
workload::EnginePointer _engine{};
};
#endif