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
qssgrendertexturedata_p.h
Go to the documentation of this file.
1
// Copyright (C) 2020 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
6
#
ifndef
QSSGRENDERTEXTUREDATA_H
7
#
define
QSSGRENDERTEXTUREDATA_H
8
9
//
10
// W A R N I N G
11
// -------------
12
//
13
// This file is not part of the Qt API. It exists purely as an
14
// implementation detail. This header file may change from version to
15
// version without notice, or even be removed.
16
//
17
// We mean it.
18
//
19
20
#
include
<
QtQuick3DRuntimeRender
/
private
/
qssgrendergraphobject_p
.
h
>
21
#
include
<
QtQuick3DRuntimeRender
/
private
/
qssgrenderimagetexture_p
.
h
>
22
#
include
<
QtQuick3DRuntimeRender
/
private
/
qssgrenderbuffermanager_p
.
h
>
23
#
include
<
QtQuick3DUtils
/
private
/
qssgrenderbasetypes_p
.
h
>
24
#
include
<
QtCore
/
qsize
.
h
>
25
#
include
<
QtCore
/
qbytearray
.
h
>
26
27
QT_BEGIN_NAMESPACE
28
29
class
Q_QUICK3DRUNTIMERENDER_EXPORT
QSSGRenderTextureData
:
public
QSSGRenderGraphObject
30
{
31
public
:
32
explicit
QSSGRenderTextureData();
33
virtual
~QSSGRenderTextureData();
34
35
const
QByteArray &textureData()
const
;
36
void
setTextureData(
const
QByteArray &data);
37
38
QSize size()
const
{
return
m_size; }
39
void
setSize(
const
QSize &size);
40
41
int
depth()
const
{
return
m_depth; }
42
void
setDepth(
int
depth);
43
44
QSSGRenderTextureFormat format()
const
{
return
m_format; }
45
void
setFormat(QSSGRenderTextureFormat format);
46
47
bool
hasTransparency()
const
{
return
m_hasTransparency; }
48
void
setHasTransparency(
bool
hasTransparency);
49
50
// We use a version number to track changes in the texture data.
51
[[nodiscard]] quint32 version()
const
{
return
m_textureDataVersion; }
52
53
QString debugObjectName;
54
55
protected
:
56
Q_DISABLE_COPY(QSSGRenderTextureData)
57
58
// it's specially used for Type::Skin
59
explicit
QSSGRenderTextureData(QSSGRenderGraphObject::Type inType);
60
61
QByteArray m_textureData;
62
QSize m_size;
63
int
m_depth = 0;
64
quint32 m_textureDataVersion = 0;
65
QSSGRenderTextureFormat m_format = QSSGRenderTextureFormat::Unknown;
66
bool
m_hasTransparency =
false
;
67
};
68
69
// NOTE: We only hash the size, depth, format and hasTransparency here, not the actual data.
70
// This is because we want to be able to quickly check if a texture has changed, without needing
71
// to inspect the data content. If only the version changes we'll try to recycle the existing
72
// texture resource, if the size, depth, format or hasTransparency changes we'll need to create a
73
// new texture resource (See: QSSGBufferManager::loadTextureData).
74
inline
size_t
qHash
(
const
QSSGRenderTextureData &data, size_t seed)
noexcept
75
{
76
const
auto
format = data.format();
77
return
qHashMulti(seed, data.size(), data.depth(), format.format, data.hasTransparency());
78
}
79
80
QT_END_NAMESPACE
81
82
#
endif
// QSSGRENDERTEXTUREDATA_H
QSSGRenderTextureData
Definition
qssgrendertexturedata_p.h:30
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qHash
constexpr size_t qHash(const QSize &s, size_t seed=0) noexcept
Definition
qsize.h:192
qtquick3d
src
runtimerender
graphobjects
qssgrendertexturedata_p.h
Generated on
for Qt by
1.18.0