Qt
6.x
The Qt SDK
Loading...
Searching...
No Matches
qssgrhieffectsystem_p.h
Go to the documentation of this file.
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 QSSGRHIEFFECTSYSTEM_P_H
6
#define QSSGRHIEFFECTSYSTEM_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/qssgrendereffect_p.h>
20
#include <QtQuick3DRuntimeRender/private/qssgrhicontext_p.h>
21
#include <QtQuick3DRuntimeRender/private/qssgrendercommands_p.h>
22
23
QT_BEGIN_NAMESPACE
24
25
struct
QSSGRhiEffectTexture
;
26
class
QSSGRenderer
;
27
28
class
QSSGProgramGenerator
;
29
class
QSSGShaderLibraryManager
;
30
class
QSSGShaderCache
;
31
32
struct
QSSGEffectSceneCacheKey
33
{
34
QByteArray
m_shaderPathKey
;
35
quintptr
m_cmd
;
36
int
m_ubufIndex
;
37
38
size_t
m_hashCode
= 0;
39
40
static
size_t
generateHashCode
(
const
QByteArray
&shaderPathKey,
quintptr
cmd,
int
ubufIndex)
41
{
42
return
qHash
(shaderPathKey) ^
qHash
(cmd) ^
qHash
(ubufIndex);
43
}
44
45
void
updateHashCode
()
46
{
47
m_hashCode
=
generateHashCode
(
m_shaderPathKey
,
m_cmd
,
m_ubufIndex
);
48
}
49
50
bool
operator==
(
const
QSSGEffectSceneCacheKey
&
other
)
const
51
{
52
return
m_shaderPathKey
==
other
.m_shaderPathKey
53
&&
m_cmd
==
other
.m_cmd
54
&&
m_ubufIndex
==
other
.m_ubufIndex;
55
}
56
};
57
58
inline
size_t
qHash
(
const
QSSGEffectSceneCacheKey
&
key
)
59
{
60
return
key
.m_hashCode;
61
}
62
63
class
Q_QUICK3DRUNTIMERENDER_EXPORT
QSSGRhiEffectSystem
64
{
65
public
:
66
explicit
QSSGRhiEffectSystem
(
const
std::shared_ptr<QSSGRenderContextInterface> &sgContext);
67
~QSSGRhiEffectSystem
();
68
69
void
setup(
QSize
outputSize);
70
QRhiTexture
*process(
const
QSSGRenderEffect
&firstEffect,
71
QRhiTexture
*inTexture,
72
QRhiTexture
*inDepthTexture,
73
QVector2D
cameraClipRange);
74
75
static
QSSGRenderTextureFormat::Format
overriddenOutputFormat(
const
QSSGRenderEffect
*inEffect);
76
77
static
QSSGRhiShaderPipelinePtr
buildShaderForEffect(
const
QSSGBindShader
&inCmd,
78
QSSGProgramGenerator
&
generator
,
79
QSSGShaderLibraryManager
&shaderLib,
80
QSSGShaderCache
&shaderCache,
81
bool
isYUpInFramebuffer);
82
83
private
:
84
void
releaseResources();
85
QSSGRhiEffectTexture
*doRenderEffect(
const
QSSGRenderEffect
*inEffect,
86
QSSGRhiEffectTexture
*inTexture);
87
88
void
allocateBufferCmd(
const
QSSGAllocateBuffer
*inCmd,
QSSGRhiEffectTexture
*inTexture,
const
QSSGRenderEffect
*inEffect);
89
void
applyInstanceValueCmd(
const
QSSGApplyInstanceValue
*inCmd,
const
QSSGRenderEffect
*inEffect);
90
void
applyValueCmd(
const
QSSGApplyValue
*inCmd,
const
QSSGRenderEffect
*inEffect);
91
void
bindShaderCmd(
const
QSSGBindShader
*inCmd,
const
QSSGRenderEffect
*inEffect);
92
void
renderCmd(
QSSGRhiEffectTexture
*inTexture,
QSSGRhiEffectTexture
*
target
);
93
94
void
addCommonEffectUniforms(
const
QSize
&inputSize,
const
QSize
&outputSize);
95
void
addTextureToShaderPipeline(
const
QByteArray
&
name
,
QRhiTexture
*
texture
,
const
QSSGRhiSamplerDescription
&samplerDesc);
96
97
QSSGRhiEffectTexture
*findTexture(
const
QByteArray
&bufferName);
98
QSSGRhiEffectTexture
*getTexture(
const
QByteArray
&bufferName,
const
QSize
&
size
,
99
QRhiTexture::Format
format
,
bool
isFinalOutput,
100
const
QSSGRenderEffect
*inEffect);
101
void
releaseTexture(
QSSGRhiEffectTexture
*
texture
);
102
void
releaseTextures();
103
104
QSize
m_outSize;
105
std::shared_ptr<QSSGRenderContextInterface> m_sgContext;
106
QVector<QSSGRhiEffectTexture *>
m_textures;
107
QRhiTexture
*m_depthTexture =
nullptr
;
108
QVector2D
m_cameraClipRange;
109
int
m_currentUbufIndex = 0;
110
QHash<QSSGEffectSceneCacheKey, QSSGRhiShaderPipelinePtr>
m_shaderPipelines;
111
QSSGRhiShaderPipeline
*m_currentShaderPipeline =
nullptr
;
112
char
*m_currentUBufData =
nullptr
;
113
QHash<QByteArray, QSSGRhiTexture>
m_currentTextures;
114
QSet<QRhiTextureRenderTarget *>
m_pendingClears;
115
};
116
117
QT_END_NAMESPACE
118
119
#endif
QByteArray
\inmodule QtCore
Definition
qbytearray.h:57
QHash
\inmodule QtCore
Definition
qhash.h:818
QList
Definition
qlist.h:74
QRhiTexture
\inmodule QtGui
Definition
qrhi.h:883
QRhiTexture::Format
Format
Specifies the texture format.
Definition
qrhi.h:902
QSSGProgramGenerator
Definition
qssgrendershadercodegenerator_p.h:142
QSSGRenderer
Definition
qssgrenderer_p.h:47
QSSGRhiEffectSystem
Definition
qssgrhieffectsystem_p.h:64
QSSGRhiShaderPipeline
Definition
qssgrhicontext_p.h:202
QSSGShaderCache
Definition
qssgrendershadercache_p.h:161
QSSGShaderLibraryManager
Definition
qssgrendershaderlibrarymanager_p.h:62
QSet
Definition
qset.h:18
QSize
\inmodule QtCore
Definition
qsize.h:25
QVector2D
The QVector2D class represents a vector or vertex in 2D space.
Definition
qvectornd.h:31
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qstandardpaths_haiku.cpp:21
QT_END_NAMESPACE
Definition
qsharedpointer.cpp:1545
key
GLuint64 key
Definition
qopengles2ext.h:2268
size
GLenum GLuint GLintptr GLsizeiptr size
[1]
Definition
qopengles2ext.h:660
target
GLenum target
Definition
qopengles2ext.h:751
texture
GLenum GLuint texture
Definition
qopengles2ext.h:416
name
GLuint name
Definition
qopengles2ext.h:156
format
GLint GLsizei GLsizei GLenum format
Definition
qopengles2ext.h:206
QSSGRhiShaderPipelinePtr
std::shared_ptr< QSSGRhiShaderPipeline > QSSGRhiShaderPipelinePtr
Definition
qssgrhicontext_p.h:396
qHash
size_t qHash(const QSSGEffectSceneCacheKey &key)
Definition
qssgrhieffectsystem_p.h:58
quintptr
size_t quintptr
Definition
qtypes.h:72
generator
QRandomGenerator generator(sseq)
other
QSharedPointer< T > other(t)
[5]
QSSGAllocateBuffer
Definition
qssgrendercommands_p.h:68
QSSGApplyInstanceValue
Definition
qssgrendercommands_p.h:140
QSSGApplyValue
Definition
qssgrendercommands_p.h:162
QSSGBindShader
Definition
qssgrendercommands_p.h:122
QSSGEffectSceneCacheKey
Definition
qssgrhieffectsystem_p.h:33
QSSGEffectSceneCacheKey::m_hashCode
size_t m_hashCode
Definition
qssgrhieffectsystem_p.h:38
QSSGEffectSceneCacheKey::updateHashCode
void updateHashCode()
Definition
qssgrhieffectsystem_p.h:45
QSSGEffectSceneCacheKey::operator==
bool operator==(const QSSGEffectSceneCacheKey &other) const
Definition
qssgrhieffectsystem_p.h:50
QSSGEffectSceneCacheKey::m_cmd
quintptr m_cmd
Definition
qssgrhieffectsystem_p.h:35
QSSGEffectSceneCacheKey::m_shaderPathKey
QByteArray m_shaderPathKey
Definition
qssgrhieffectsystem_p.h:34
QSSGEffectSceneCacheKey::m_ubufIndex
int m_ubufIndex
Definition
qssgrhieffectsystem_p.h:36
QSSGEffectSceneCacheKey::generateHashCode
static size_t generateHashCode(const QByteArray &shaderPathKey, quintptr cmd, int ubufIndex)
Definition
qssgrhieffectsystem_p.h:40
QSSGRenderEffect
Definition
qssgrendereffect_p.h:33
QSSGRenderTextureFormat::Format
Format
Definition
qssgrenderbasetypes_p.h:71
QSSGRhiEffectTexture
Definition
qssgrhieffectsystem.cpp:21
QSSGRhiSamplerDescription
Definition
qssgrhicontext_p.h:126
qtquick3d
src
runtimerender
qssgrhieffectsystem_p.h
Generated by
1.9.7