1// Copyright (C) 2008-2012 NVIDIA Corporation.
2// Copyright (C) 2020 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
4
5#ifndef QSSGRHIQUADRENDERER_P_H
6#define QSSGRHIQUADRENDERER_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQuick3DRuntimeRender/private/qtquick3druntimerenderglobal_p.h>
20#include <QtQuick3DRuntimeRender/private/qssgrhicontext_p.h>
21
22QT_BEGIN_NAMESPACE
23
24class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRhiQuadRenderer
25{
26public:
27 // The expected usage is one of the following:
28 // prepareQuad() + recordRenderQuadPass() right after each other (to record a full standalone renderpass, in the prepare phase)
29 // prepareQuad() in prepare phase, then recordRenderQuad() in render phase (to draw a quad within the main renderpass)
30
31 enum Flag {
32 UvCoords = 0x01,
33 DepthTest = 0x02,
34 DepthWrite = 0x04,
35 PremulBlend = 0x08,
36 RenderBehind = 0x10
37 };
38 Q_DECLARE_FLAGS(Flags, Flag)
39
40 void prepareQuad(QSSGRhiContext *rhiCtx, QRhiResourceUpdateBatch *maybeRub);
41
42 void recordRenderQuad(QSSGRhiContext *rhiCtx,
43 QSSGRhiGraphicsPipelineState *ps, QRhiShaderResourceBindings *srb,
44 QRhiRenderPassDescriptor *rpDesc, Flags flags);
45
46 void recordRenderQuadPass(QSSGRhiContext *rhiCtx,
47 QSSGRhiGraphicsPipelineState *ps, QRhiShaderResourceBindings *srb,
48 QRhiTextureRenderTarget *rt, Flags flags);
49
50private:
51 void ensureBuffers(QSSGRhiContext *rhiCtx, QRhiResourceUpdateBatch *rub);
52
53 QSSGRhiBufferPtr m_vbuf;
54 QSSGRhiBufferPtr m_ibuf;
55};
56
57Q_DECLARE_OPERATORS_FOR_FLAGS(QSSGRhiQuadRenderer::Flags)
58
59
60class Q_QUICK3DRUNTIMERENDER_EXPORT QSSGRhiCubeRenderer
61{
62public:
63 void prepareCube(QSSGRhiContext *rhiCtx, QRhiResourceUpdateBatch *maybeRub);
64
65 void recordRenderCube(QSSGRhiContext *rhiCtx,
66 QSSGRhiGraphicsPipelineState *ps, QRhiShaderResourceBindings *srb,
67 QRhiRenderPassDescriptor *rpDesc, QSSGRhiQuadRenderer::Flags flags);
68private:
69 void ensureBuffers(QSSGRhiContext *rhiCtx, QRhiResourceUpdateBatch *rub);
70
71 QSSGRhiBufferPtr m_vbuf;
72 QSSGRhiBufferPtr m_ibuf;
73};
74
75
76QT_END_NAMESPACE
77
78#endif
79

source code of qtquick3d/src/runtimerender/qssgrhiquadrenderer_p.h