diff options
author | Wieland Hagen <wieland.hagen@kdab.com> | 2016-04-14 21:08:25 +0200 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2016-05-03 17:25:11 +0000 |
commit | 545cd3d3a5d0032c044f807429ace1cade462ceb (patch) | |
tree | 458d4d993714f92341ef77f5e58ac62f2a875d83 /src/render/backend/renderview_p.h | |
parent | 44ca2d31d278b4b744abfee818a92370daf7c343 (diff) |
QClearBuffers: clear specific QRenderTargetOutputs
If QClearBuffers::colorBuffer is set to a non-NULL value, only
this color buffer will be affected by the Clear operation.
Right now, only clamped color values are supported by the frontend.
OpenGL also supports non-clamped float and integer values, depending
on the type of the target buffer.
Task-number: QTBUG-50116
Change-Id: I2786c0603b24b4af0d24751151d64be7504b3e92
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/backend/renderview_p.h')
-rw-r--r-- | src/render/backend/renderview_p.h | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/src/render/backend/renderview_p.h b/src/render/backend/renderview_p.h index b5169a712..bc634a65d 100644 --- a/src/render/backend/renderview_p.h +++ b/src/render/backend/renderview_p.h @@ -55,6 +55,7 @@ #include <Qt3DRender/qparameter.h> #include <Qt3DRender/qclearbuffers.h> #include <Qt3DRender/private/renderer_p.h> +#include <Qt3DRender/private/clearbuffers_p.h> #include <Qt3DRender/private/cameralens_p.h> #include <Qt3DRender/private/attachmentpack_p.h> #include <Qt3DRender/private/handle_types_p.h> @@ -201,33 +202,15 @@ public: return *m_viewport; } - inline void setClearColor(const QColor &c) - { - if (!m_clearColor) { - Q_ASSERT(m_allocator); - m_clearColor = m_allocator->allocate<QColor>(); - *m_clearColor = QColor(QColor::Invalid); - } - *m_clearColor = c; - } - inline QColor clearColor() const - { - if (!m_clearColor) { - Q_ASSERT(m_allocator); - m_clearColor = m_allocator->allocate<QColor>(); - *m_clearColor = QColor(QColor::Invalid); - } - return *m_clearColor; - } - - inline void setClearBuffer(QClearBuffers::BufferTypeFlags clearBuffer) Q_DECL_NOEXCEPT { m_clearBuffer = clearBuffer; } - inline QClearBuffers::BufferTypeFlags clearBuffer() const Q_DECL_NOEXCEPT { return m_clearBuffer; } - - inline void setClearDepthValue(float clearDepthValue) Q_DECL_NOEXCEPT { m_clearDepthValue = clearDepthValue; } - inline float clearDepthValue() const Q_DECL_NOEXCEPT { return m_clearDepthValue; } - - inline void setClearStencilValue(int clearStencilValue) Q_DECL_NOEXCEPT { m_clearStencilValue = clearStencilValue; } - inline int clearStencilValue() const Q_DECL_NOEXCEPT { return m_clearStencilValue; } + // depth and stencil ClearBuffers are cached locally + // color ClearBuffers are collected, as there may be multiple + // color buffers to be cleared. we need to apply all these at rendering + void addClearBuffers(const ClearBuffers *cb); + inline QVector<const ClearBuffers*> specificClearColorBuffers() const { return m_specificClearColorBuffers; } + inline const ClearBuffers* globalClearColorBuffers() const { return m_globalClearColorBuffer; } + inline QClearBuffers::BufferTypeFlags clearTypes() const { return m_clearBuffer; } + inline float clearDepthValue() const { return m_clearDepthValue; } + inline int clearStencilValue() const { return m_clearStencilValue; } RenderRenderPassList passesAndParameters(ParameterInfoList *parameter, Entity *node, bool useDefaultMaterials = true); @@ -291,7 +274,6 @@ private: InnerData *m_data; - mutable QColor *m_clearColor; mutable QRectF *m_viewport; HTarget m_renderTarget; QSurface *m_surface; @@ -299,6 +281,8 @@ private: QClearBuffers::BufferTypeFlags m_clearBuffer; float m_clearDepthValue; int m_clearStencilValue; + const ClearBuffers* m_globalClearColorBuffer; // global ClearColor + QVector<const ClearBuffers*> m_specificClearColorBuffers; // different draw buffers with distinct colors RenderStateSet *m_stateSet; bool m_noDraw:1; bool m_compute:1; |