From c8e30ef39eebd22124d95a458645025ec3769772 Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Mon, 1 Jun 2015 12:35:54 -0700 Subject: [PATCH] On to a full rendered pipeline --- libraries/gpu/src/gpu/Context.cpp | 5 ++++- libraries/gpu/src/gpu/Context.h | 2 ++ libraries/gpu/src/gpu/GLBackend.h | 12 ++++++------ libraries/render-utils/src/RenderDeferredTask.cpp | 4 ++++ 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/libraries/gpu/src/gpu/Context.cpp b/libraries/gpu/src/gpu/Context.cpp index c888003b29..9cc6bb3cd7 100644 --- a/libraries/gpu/src/gpu/Context.cpp +++ b/libraries/gpu/src/gpu/Context.cpp @@ -34,5 +34,8 @@ bool Context::makeProgram(Shader& shader, const Shader::BindingSet& bindings) { void Context::render(Batch& batch) { _backend->render(batch); - // GLBackend::renderBatch(batch, true); } + +void Context::syncCache() { + _backend->syncCache(); +} \ No newline at end of file diff --git a/libraries/gpu/src/gpu/Context.h b/libraries/gpu/src/gpu/Context.h index 97ecf6b846..99021d2731 100644 --- a/libraries/gpu/src/gpu/Context.h +++ b/libraries/gpu/src/gpu/Context.h @@ -33,6 +33,7 @@ public: virtual~ Backend() {}; virtual void render(Batch& batch) = 0; + virtual void syncCache() = 0; class TransformObject { public: @@ -115,6 +116,7 @@ public: void render(Batch& batch); + void syncCache(); protected: Context(const Context& context); diff --git a/libraries/gpu/src/gpu/GLBackend.h b/libraries/gpu/src/gpu/GLBackend.h index da0fe77b24..d1ba7714e9 100644 --- a/libraries/gpu/src/gpu/GLBackend.h +++ b/libraries/gpu/src/gpu/GLBackend.h @@ -30,6 +30,12 @@ public: virtual void render(Batch& batch); + // This call synchronize the Full Backend cache with the current GLState + // THis is only intended to be used when mixing raw gl calls with the gpu api usage in order to sync + // the gpu::Backend state with the true gl state which has probably been messed up by these ugly naked gl calls + // Let's try to avoid to do that as much as possible! + virtual void syncCache(); + // Render Batch create a local Context and execute the batch with it // WARNING: // if syncCache is true, then the gpu::GLBackend will synchornize @@ -195,12 +201,6 @@ public: void do_setStateColorWriteMask(uint32 mask); - // This call synchronize the Full Backend cache with the current GLState - // THis is only intended to be used when mixing raw gl calls with the gpu api usage in order to sync - // the gpu::Backend state with the true gl state which has probably been messed up by these ugly naked gl calls - // Let's try to avoid to do that as much as possible! - void syncCache(); - protected: // Draw Stage diff --git a/libraries/render-utils/src/RenderDeferredTask.cpp b/libraries/render-utils/src/RenderDeferredTask.cpp index 8ab5faace1..821a93f567 100755 --- a/libraries/render-utils/src/RenderDeferredTask.cpp +++ b/libraries/render-utils/src/RenderDeferredTask.cpp @@ -10,6 +10,8 @@ // #include "RenderDeferredTask.h" +#include "gpu/Context.h" + using namespace render; RenderDeferredTask::RenderDeferredTask() : Task() { @@ -34,6 +36,8 @@ void RenderDeferredTask::run(const SceneContextPointer& sceneContext, const Rend return; } + renderContext->args->_context->syncCache(); + for (auto job : _jobs) { job.run(sceneContext, renderContext); }