Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qssgrendershadowmap_p.h
Go to the documentation of this file.
1
// Copyright (C) 2008-2012 NVIDIA Corporation.
2
// Copyright (C) 2019 The Qt Company Ltd.
3
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
4
// Qt-Security score:significant reason:default
5
6
7
#
ifndef
QSSG_RENDER_SHADOW_MAP_H
8
#
define
QSSG_RENDER_SHADOW_MAP_H
9
10
//
11
// W A R N I N G
12
// -------------
13
//
14
// This file is not part of the Qt API. It exists purely as an
15
// implementation detail. This header file may change from version to
16
// version without notice, or even be removed.
17
//
18
// We mean it.
19
//
20
21
#
include
<
QtQuick3DRuntimeRender
/
private
/
qtquick3druntimerenderglobal_p
.
h
>
22
#
include
<
QtGui
/
QMatrix4x4
>
23
#
include
<
QtGui
/
QVector3D
>
24
#
include
<
QtQuick3DUtils
/
private
/
qssgrenderbasetypes_p
.
h
>
25
#
include
<
QtQuick3DRuntimeRender
/
private
/
qssgrenderableobjects_p
.
h
>
26
27
QT_BEGIN_NAMESPACE
28
29
class
QSSGRhiContext;
30
class
QSSGRenderContextInterface
;
31
32
class
QRhiRenderBuffer;
33
class
QRhiTextureRenderTarget;
34
class
QRhiRenderPassDescriptor;
35
class
QRhiTexture;
36
37
struct
QSSGShadowMapEntry
38
{
39
QSSGShadowMapEntry
();
40
41
static
QSSGShadowMapEntry
withAtlas
(quint32 lightIdx);
42
43
void
destroyRhiResources
();
44
45
quint32
m_lightIndex
;
///< the light index it belongs to
46
quint32
m_depthArrayIndex
= 0;
///< shadow map texture array index
47
48
// Owned RHI Resoruces (just for point lights)
49
QRhiTexture *
m_rhiDepthCube
=
nullptr
;
// shadow cube map
50
QRhiRenderBuffer *
m_rhiDepthStencilCube
=
nullptr
;
51
QRhiRenderPassDescriptor *
m_rhiRenderPassDescCube
=
nullptr
;
52
std
::
array
<
QRhiTextureRenderTarget
*, 6>
m_rhiRenderTargetCube
= {};
53
QRhiShaderResourceBindings
*
m_cubeToAtlasFrontSrb
=
nullptr
;
54
QRhiShaderResourceBindings
*
m_cubeToAtlasBackSrb
=
nullptr
;
55
56
// Shared RHI Resources
57
std
::
array
<
QRhiTextureRenderTarget
*, 4>
m_rhiRenderTargets
= {};
58
std
::
array
<
QRhiRenderPassDescriptor
*, 4>
m_rhiRenderPassDesc
= {};
59
60
QMatrix4x4
m_lightViewProjection
[4];
///< light view projection matrix
61
QMatrix4x4
m_lightCubeView
[6];
///< light cubemap view matrices
62
QMatrix4x4
m_lightView
;
///< light view transform
63
quint32
m_csmNumSplits
= 0;
64
float
m_csmSplits
[4] = {};
65
float
m_csmActive
[4] = {};
66
float
m_shadowMapFar
= 0.f;
67
QMatrix4x4
m_fixedScaleBiasMatrix
[4];
68
QVector4D
m_dimensionsInverted
[4];
///< (x, y, z, 0) 4 vec4
69
70
struct
AtlasEntry
{
71
int
layerIndex
= 0;
72
float
uOffset
= 0.0f;
73
float
vOffset
= 0.0f;
74
float
uvScale
= 1.0f;
75
} m_atlasInfo[4];
76
};
77
78
class
Q_QUICK3DRUNTIMERENDER_EXPORT
QSSGRenderShadowMap
79
{
80
Q_DISABLE_COPY(QSSGRenderShadowMap)
81
82
public
:
83
const
QSSGRenderContextInterface &m_context;
84
85
explicit
QSSGRenderShadowMap
(
const
QSSGRenderContextInterface
&inContext);
86
~QSSGRenderShadowMap();
87
void
releaseCachedResources();
88
void
addShadowMaps
(
const
QSSGShaderLightList &renderableLights);
89
90
QSSGShadowMapEntry
*
shadowMapEntry
(
int
lightIdx);
91
QRhiTextureRenderTarget *
layerRenderTarget
(
int
layerIndex);
92
QRhiRenderPassDescriptor *
layerRenderPassDescriptor
(
int
layerIndex);
93
QRhiTexture *
shadowMapAtlasTexture
()
const
;
94
QRhiTexture *
shadowMapBlueNoiseTexture
()
const
;
95
96
qsizetype
shadowMapEntryCount
() {
return
m_shadowMapList.size(); }
97
98
QRhiShaderResourceBindings
*
shadowClearSrb
()
const
{
return
m_shadowClearSrb.get(); }
99
100
private
:
101
QSSGShadowMapEntry *addShadowMap(quint32 lightIdx,
102
QSize size,
103
QVector<QSSGShadowMapEntry::AtlasEntry> atlasEntries,
104
quint32 csmNumSplits,
105
QRhiTexture::Format format,
106
bool
isPointLight,
107
const
QString &renderNodeObjName);
108
109
QVector<QSSGShadowMapEntry> m_shadowMapList;
110
std::unique_ptr<QRhiTexture> m_shadowMapAtlasTexture;
111
std::unique_ptr<QRhiTexture> m_shadowMapBlueNoiseTexture;
112
std::unique_ptr<QRhiSampler> m_sharedCubeToAtlasSampler;
113
std::unique_ptr<QRhiBuffer> m_sharedFrontCubeToAtlasUniformBuffer;
114
std::unique_ptr<QRhiBuffer> m_sharedBackCubeToAtlasUniformBuffer;
115
std::unique_ptr<QRhiShaderResourceBindings> m_shadowClearSrb;
116
QVector<QRhiRenderBuffer *> m_layerDepthStencilBuffers;
117
QVector<QRhiTextureRenderTarget *> m_layerRenderTargets;
118
QVector<QRhiRenderPassDescriptor *> m_layerRenderPassDescriptors;
119
};
120
121
using
QSSGRenderShadowMapPtr = std::shared_ptr<QSSGRenderShadowMap>;
122
123
QT_END_NAMESPACE
124
125
#
endif
QSSGRenderShadowMap
Definition
qssgrendershadowmap_p.h:79
QSSGRenderShadowMap::QSSGRenderShadowMap
QSSGRenderShadowMap(const QSSGRenderContextInterface &inContext)
Definition
qssgrendershadowmap.cpp:185
QSSGRenderShadowMap::shadowClearSrb
QRhiShaderResourceBindings * shadowClearSrb() const
Definition
qssgrendershadowmap_p.h:98
QSSGRenderShadowMap::layerRenderPassDescriptor
QRhiRenderPassDescriptor * layerRenderPassDescriptor(int layerIndex)
Definition
qssgrendershadowmap.cpp:530
QSSGRenderShadowMap::layerRenderTarget
QRhiTextureRenderTarget * layerRenderTarget(int layerIndex)
Definition
qssgrendershadowmap.cpp:523
QSSGRenderShadowMap::shadowMapEntry
QSSGShadowMapEntry * shadowMapEntry(int lightIdx)
Definition
qssgrendershadowmap.cpp:510
QSSGRenderShadowMap::shadowMapEntryCount
qsizetype shadowMapEntryCount()
Definition
qssgrendershadowmap_p.h:96
QSSGRenderShadowMap::addShadowMaps
void addShadowMaps(const QSSGShaderLightList &renderableLights)
Definition
qssgrendershadowmap.cpp:216
QSSGRenderer::QSSGRenderContextInterface
friend class QSSGRenderContextInterface
Definition
qssgrenderer_p.h:105
QSSGRhiShaderPipeline::shadowMapAtlasTexture
QRhiTexture * shadowMapAtlasTexture() const
Definition
qssgrhicontext_p.h:551
QSSGRhiShaderPipeline::shadowMapBlueNoiseTexture
QRhiTexture * shadowMapBlueNoiseTexture() const
Definition
qssgrhicontext_p.h:554
QSSGShadowMapEntry::AtlasEntry
Definition
qssgrendershadowmap_p.h:70
QSSGShadowMapEntry::AtlasEntry::uOffset
float uOffset
Definition
qssgrendershadowmap_p.h:72
QSSGShadowMapEntry::AtlasEntry::layerIndex
int layerIndex
Definition
qssgrendershadowmap_p.h:71
QSSGShadowMapEntry::AtlasEntry::vOffset
float vOffset
Definition
qssgrendershadowmap_p.h:73
QSSGShadowMapEntry::AtlasEntry::uvScale
float uvScale
Definition
qssgrendershadowmap_p.h:74
QSSGShadowMapEntry
Definition
qssgrendershadowmap_p.h:38
QSSGShadowMapEntry::m_rhiRenderPassDesc
std::array< QRhiRenderPassDescriptor *, 4 > m_rhiRenderPassDesc
Definition
qssgrendershadowmap_p.h:58
QSSGShadowMapEntry::m_rhiRenderTargetCube
std::array< QRhiTextureRenderTarget *, 6 > m_rhiRenderTargetCube
Definition
qssgrendershadowmap_p.h:52
QSSGShadowMapEntry::m_depthArrayIndex
quint32 m_depthArrayIndex
shadow map texture array index
Definition
qssgrendershadowmap_p.h:46
QSSGShadowMapEntry::m_csmSplits
float m_csmSplits[4]
Definition
qssgrendershadowmap_p.h:64
QSSGShadowMapEntry::m_rhiDepthStencilCube
QRhiRenderBuffer * m_rhiDepthStencilCube
Definition
qssgrendershadowmap_p.h:50
QSSGShadowMapEntry::m_fixedScaleBiasMatrix
QMatrix4x4 m_fixedScaleBiasMatrix[4]
Definition
qssgrendershadowmap_p.h:67
QSSGShadowMapEntry::m_lightViewProjection
QMatrix4x4 m_lightViewProjection[4]
light view projection matrix
Definition
qssgrendershadowmap_p.h:60
QSSGShadowMapEntry::m_cubeToAtlasFrontSrb
QRhiShaderResourceBindings * m_cubeToAtlasFrontSrb
Definition
qssgrendershadowmap_p.h:53
QSSGShadowMapEntry::m_csmActive
float m_csmActive[4]
Definition
qssgrendershadowmap_p.h:65
QSSGShadowMapEntry::QSSGShadowMapEntry
QSSGShadowMapEntry()
Definition
qssgrendershadowmap.cpp:547
QSSGShadowMapEntry::destroyRhiResources
void destroyRhiResources()
Definition
qssgrendershadowmap.cpp:559
QSSGShadowMapEntry::m_rhiRenderTargets
std::array< QRhiTextureRenderTarget *, 4 > m_rhiRenderTargets
Definition
qssgrendershadowmap_p.h:57
QSSGShadowMapEntry::m_cubeToAtlasBackSrb
QRhiShaderResourceBindings * m_cubeToAtlasBackSrb
Definition
qssgrendershadowmap_p.h:54
QSSGShadowMapEntry::m_csmNumSplits
quint32 m_csmNumSplits
Definition
qssgrendershadowmap_p.h:63
QSSGShadowMapEntry::m_lightCubeView
QMatrix4x4 m_lightCubeView[6]
light cubemap view matrices
Definition
qssgrendershadowmap_p.h:61
QSSGShadowMapEntry::withAtlas
static QSSGShadowMapEntry withAtlas(quint32 lightIdx)
Definition
qssgrendershadowmap.cpp:552
QSSGShadowMapEntry::m_rhiRenderPassDescCube
QRhiRenderPassDescriptor * m_rhiRenderPassDescCube
Definition
qssgrendershadowmap_p.h:51
QSSGShadowMapEntry::m_rhiDepthCube
QRhiTexture * m_rhiDepthCube
Definition
qssgrendershadowmap_p.h:49
QSSGShadowMapEntry::m_dimensionsInverted
QVector4D m_dimensionsInverted[4]
(x, y, z, 0) 4 vec4
Definition
qssgrendershadowmap_p.h:68
QSSGShadowMapEntry::m_shadowMapFar
float m_shadowMapFar
Definition
qssgrendershadowmap_p.h:66
QSSGShadowMapEntry::m_lightIndex
quint32 m_lightIndex
the light index it belongs to
Definition
qssgrendershadowmap_p.h:45
QSSGShadowMapEntry::m_lightView
QMatrix4x4 m_lightView
light view transform
Definition
qssgrendershadowmap_p.h:62
qtquick3d
src
runtimerender
qssgrendershadowmap_p.h
Generated on
for Qt by
1.18.0