Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qsgtexture_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QSGTEXTURE_P_H
6#define QSGTEXTURE_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 <QtQuick/private/qtquickglobal_p.h>
20#include <private/qobject_p.h>
21#include "qsgtexture.h"
22
24
35
37
38bool operator==(const QSGSamplerDescription &a, const QSGSamplerDescription &b) noexcept;
39bool operator!=(const QSGSamplerDescription &a, const QSGSamplerDescription &b) noexcept;
40size_t qHash(const QSGSamplerDescription &s, size_t seed = 0) noexcept;
41
42#if QT_CONFIG(opengl)
43class Q_QUICK_EXPORT QSGTexturePlatformOpenGL : public QNativeInterface::QSGOpenGLTexture
44{
45public:
46 QSGTexturePlatformOpenGL(QSGTexture *t) : m_texture(t) { }
47 QSGTexture *m_texture;
48
49 GLuint nativeTexture() const override;
50};
51#endif
52
53#ifdef Q_OS_WIN
54class Q_QUICK_EXPORT QSGTexturePlatformD3D11 : public QNativeInterface::QSGD3D11Texture
55{
56public:
57 QSGTexturePlatformD3D11(QSGTexture *t) : m_texture(t) { }
58 QSGTexture *m_texture;
59
60 void *nativeTexture() const override;
61};
62class Q_QUICK_EXPORT QSGTexturePlatformD3D12 : public QNativeInterface::QSGD3D12Texture
63{
64public:
65 QSGTexturePlatformD3D12(QSGTexture *t) : m_texture(t) { }
66 QSGTexture *m_texture;
67
68 int nativeResourceState() const override;
69 void *nativeTexture() const override;
70};
71#endif
72
73#if QT_CONFIG(metal)
74class Q_QUICK_EXPORT QSGTexturePlatformMetal : public QNativeInterface::QSGMetalTexture
75{
76public:
77 QSGTexturePlatformMetal(QSGTexture *t) : m_texture(t) { }
78 QSGTexture *m_texture;
79
80 QT_OBJC_PROTOCOL(MTLTexture) nativeTexture() const override;
81};
82#endif
83
84#if QT_CONFIG(vulkan)
85class Q_QUICK_EXPORT QSGTexturePlatformVulkan : public QNativeInterface::QSGVulkanTexture
86{
87public:
88 QSGTexturePlatformVulkan(QSGTexture *t) : m_texture(t) { }
89 QSGTexture *m_texture;
90
91 VkImage nativeImage() const override;
92 VkImageLayout nativeImageLayout() const override;
93};
94#endif
95
96class Q_QUICK_EXPORT QSGTexturePrivate : public QObjectPrivate
97{
98 Q_DECLARE_PUBLIC(QSGTexture)
99public:
100 QSGTexturePrivate(QSGTexture *t);
101 static QSGTexturePrivate *get(QSGTexture *t) { return t->d_func(); }
102 void resetDirtySamplerOptions();
103 bool hasDirtySamplerOptions() const;
104
105 uint wrapChanged : 1;
106 uint filteringChanged : 1;
107 uint anisotropyChanged : 1;
108
109 uint horizontalWrap : 2;
110 uint verticalWrap : 2;
111 uint mipmapMode : 2;
112 uint filterMode : 2;
113 uint anisotropyLevel: 3;
114
115 // While we could make QSGTexturePrivate implement all the interfaces, we
116 // rather choose to use separate objects to avoid clashes in the function
117 // names and signatures.
118#if QT_CONFIG(opengl)
119 QSGTexturePlatformOpenGL m_openglTextureAccessor;
120#endif
121#ifdef Q_OS_WIN
122 QSGTexturePlatformD3D11 m_d3d11TextureAccessor;
123 QSGTexturePlatformD3D12 m_d3d12TextureAccessor;
124#endif
125#if QT_CONFIG(metal)
126 QSGTexturePlatformMetal m_metalTextureAccessor;
127#endif
128#if QT_CONFIG(vulkan)
129 QSGTexturePlatformVulkan m_vulkanTextureAccessor;
130#endif
131};
132
133Q_QUICK_EXPORT bool qsg_safeguard_texture(QSGTexture *);
134
135QT_END_NAMESPACE
136
137#endif // QSGTEXTURE_P_H
Combined button and popup list for selecting options.
static void qt_debug_print_texture_count()
static void qt_debug_remove_texture(QSGTexture *texture)
static void qt_debug_add_texture(QSGTexture *texture)
size_t qHash(const QSGSamplerDescription &s, size_t seed=0) noexcept
Q_DECLARE_TYPEINFO(QSGSamplerDescription, Q_RELOCATABLE_TYPE)
bool operator!=(const QSGSamplerDescription &a, const QSGSamplerDescription &b) noexcept
Q_QUICK_EXPORT bool qsg_safeguard_texture(QSGTexture *)
bool operator==(const QSGSamplerDescription &a, const QSGSamplerDescription &b) noexcept
static QSGSamplerDescription fromTexture(QSGTexture *t)