From f70702beb7a63618a515a33a825db2bcec32f5e0 Mon Sep 17 00:00:00 2001 From: samcake Date: Fri, 2 Jun 2017 17:54:41 -0700 Subject: [PATCH] Introducing debug flags --- .../render-utils/src/StencilMaskPass.cpp | 11 ++++++--- libraries/render-utils/src/StencilMaskPass.h | 24 +++++++++++++++---- .../render-utils/src/ToneMappingEffect.cpp | 1 - 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/libraries/render-utils/src/StencilMaskPass.cpp b/libraries/render-utils/src/StencilMaskPass.cpp index dcd994763f..2374f24211 100644 --- a/libraries/render-utils/src/StencilMaskPass.cpp +++ b/libraries/render-utils/src/StencilMaskPass.cpp @@ -22,6 +22,11 @@ using namespace render; +void PrepareStencil::configure(const Config& config) { + _maskMode = config.maskMode; + _forceDraw = config.forceDraw; +} + model::MeshPointer PrepareStencil::getMesh() { if (!_mesh) { @@ -72,8 +77,8 @@ gpu::PipelinePointer PrepareStencil::getPaintStencilPipeline() { void PrepareStencil::run(const RenderContextPointer& renderContext, const gpu::FramebufferPointer& srcFramebuffer) { RenderArgs* args = renderContext->args; - // Only draw the stencil mask if in HMD mode. - if (args->_displayMode != RenderArgs::STEREO_HMD) { + // Only draw the stencil mask if in HMD mode or not forced. + if (!_forceDraw && (args->_displayMode != RenderArgs::STEREO_HMD)) { return; } @@ -82,7 +87,7 @@ void PrepareStencil::run(const RenderContextPointer& renderContext, const gpu::F batch.setViewportTransform(args->_viewport); - if (false) { + if (_maskMode < 0) { batch.setPipeline(getMeshStencilPipeline()); auto mesh = getMesh(); diff --git a/libraries/render-utils/src/StencilMaskPass.h b/libraries/render-utils/src/StencilMaskPass.h index d7d6ee448b..01601d1ae6 100644 --- a/libraries/render-utils/src/StencilMaskPass.h +++ b/libraries/render-utils/src/StencilMaskPass.h @@ -16,16 +16,28 @@ #include #include +class PrepareStencilConfig : public render::Job::Config { + Q_OBJECT + Q_PROPERTY(int maskMode MEMBER maskMode NOTIFY dirty) + Q_PROPERTY(bool forceDraw MEMBER forceDraw NOTIFY dirty) + +public: + PrepareStencilConfig(bool enabled = true) : JobConfig(enabled) {} + + int maskMode { 0 }; + bool forceDraw { false }; + +signals: + void dirty(); +}; + class PrepareStencil { public: - class Config : public render::JobConfig { - public: - Config(bool enabled = true) : JobConfig(enabled) {} - }; + using Config = PrepareStencilConfig; using JobModel = render::Job::ModelI; - void configure(const Config& config) {} + void configure(const Config& config); void run(const render::RenderContextPointer& renderContext, const gpu::FramebufferPointer& dstFramebuffer); @@ -51,6 +63,8 @@ private: model::MeshPointer _mesh; model::MeshPointer getMesh(); + int _maskMode { 0 }; + bool _forceDraw { false }; }; diff --git a/libraries/render-utils/src/ToneMappingEffect.cpp b/libraries/render-utils/src/ToneMappingEffect.cpp index 7a3d868236..ce41cf16fa 100644 --- a/libraries/render-utils/src/ToneMappingEffect.cpp +++ b/libraries/render-utils/src/ToneMappingEffect.cpp @@ -39,7 +39,6 @@ void ToneMappingEffect::init() { slotBindings.insert(gpu::Shader::Binding(std::string("colorMap"), ToneMappingEffect_LightingMapSlot)); gpu::Shader::makeProgram(*blitProgram, slotBindings); auto blitState = std::make_shared(); - PrepareStencil::testMask(*blitState); blitState->setColorWriteMask(true, true, true, true); _blitLightBuffer = gpu::PipelinePointer(gpu::Pipeline::create(blitProgram, blitState)); }