6#include <private/qqmlglobal_p.h> 
    7#include <private/qsgmaterialshader_p.h> 
    8#include <private/qsgrenderer_p.h> 
    9#include <private/qquickitem_p.h>  
   10#include <private/qquickwindow_p.h> 
   11#include <QtCore/private/qnativeinterface_p.h> 
   14#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) && defined(__GLIBC__) 
   15#define CAN_BACKTRACE_EXECINFO 
   19#define CAN_BACKTRACE_EXECINFO 
   22#if defined(QT_NO_DEBUG) 
   23#undef CAN_BACKTRACE_EXECINFO 
   26#if defined(CAN_BACKTRACE_EXECINFO) 
   40    return a.filtering == 
b.filtering
 
   41            && 
a.mipmapFiltering == 
b.mipmapFiltering
 
   42            && 
a.horizontalWrap == 
b.horizontalWrap
 
   43            && 
a.verticalWrap == 
b.verticalWrap
 
   44            && 
a.anisotropylevel == 
b.anisotropylevel;
 
   54    const int f = 
s.filtering;
 
   55    const int m = 
s.mipmapFiltering;
 
   56    const int w = 
s.horizontalWrap;
 
   57    const int a = 
s.anisotropylevel;
 
   58    return (((
f & 7) << 24) | ((
m & 7) << 16) | ((
w & 7) << 8) | (
a & 7)) ^ 
seed;
 
   64    s.filtering = 
t->filtering();
 
   65    s.mipmapFiltering = 
t->mipmapFiltering();
 
   66    s.horizontalWrap = 
t->horizontalWrapMode();
 
   67    s.verticalWrap = 
t->verticalWrapMode();
 
   68    s.anisotropylevel = 
t->anisotropyLevel();
 
   74    , filteringChanged(
false)
 
   75    , anisotropyChanged(
false)
 
   82    , m_openglTextureAccessor(
t)
 
   85    , m_d3d11TextureAccessor(
t)
 
   86    , m_d3d12TextureAccessor(
t)
 
   89    , m_metalTextureAccessor(
t)
 
   92    , m_vulkanTextureAccessor(
t)
 
  104#if (defined(Q_OS_LINUX) || defined (Q_OS_MAC)) && !defined(Q_OS_ANDROID) 
  107#define BACKTRACE_SIZE 20 
  108class SGTextureTraceItem
 
  111    void *backTrace[BACKTRACE_SIZE];
 
  112    size_t backTraceSize;
 
  123#if defined(CAN_BACKTRACE_EXECINFO) 
  124    if (qmlDebugLeakBacktrace()) {
 
  125        while (!qt_debug_allocated_textures.
isEmpty()) {
 
  128            SGTextureTraceItem* 
item = 
it.value();
 
  130            qt_debug_allocated_textures.
erase(
it);
 
  135            char** symbols = backtrace_symbols(
item->backTrace, 
item->backTraceSize);
 
  138                for (
int i=0; 
i<(int) 
item->backTraceSize; 
i++)
 
  139                    qDebug(
"Backtrace <%02d>: %s", 
i, symbols[
i]);
 
  153#if defined(CAN_BACKTRACE_EXECINFO) 
  154    if (qmlDebugLeakBacktrace()) {
 
  155        SGTextureTraceItem* 
item = 
new SGTextureTraceItem;
 
  156        item->backTraceSize = backtrace(
item->backTrace, BACKTRACE_SIZE);
 
  165    static bool atexit_registered = 
false;
 
  166    if (!atexit_registered) {
 
  168        atexit_registered = 
true;
 
  174#if defined(CAN_BACKTRACE_EXECINFO) 
  175    if (qmlDebugLeakBacktrace()) {
 
  189        qDebug(
"Texture destroyed after qt_debug_print_texture_count() was called.");
 
  310    qsg_valid_texture_set()->insert(
this);
 
  325    qsg_valid_texture_set()->insert(
this);
 
  339    qsg_valid_texture_set()->remove(
this);
 
  434    return QRectF(0, 0, 1, 1);
 
  462        d->filteringChanged = 
true;
 
  483        d->filteringChanged = 
true;
 
  509        d->anisotropyLevel = 
level;
 
  510        d->anisotropyChanged = 
true;
 
  533    if ((
uint) hwrap != 
d->horizontalWrap) {
 
  534        d->horizontalWrap = hwrap;
 
  535        d->wrapChanged = 
true;
 
  555    if ((
uint) vwrap != 
d->verticalWrap) {
 
  556        d->verticalWrap = vwrap;
 
  557        d->wrapChanged = 
true;
 
  677#if QT_CONFIG(opengl) || defined(Q_QDOC) 
  725                                         QQuickWindow::CreateTextureOptions options)
 
  760                                                    QQuickWindow::CreateTextureOptions options)
 
  770GLuint QSGTexturePlatformOpenGL::nativeTexture()
 const 
  772    if (
auto *tex = m_texture->rhiTexture())
 
  773        return GLuint(tex->nativeTexture().object);
 
  778#if defined(Q_OS_WIN) || defined(Q_QDOC) 
  825                                        QQuickWindow::CreateTextureOptions options)
 
  831void *QSGTexturePlatformD3D11::nativeTexture()
 const 
  833    if (
auto *tex = m_texture->rhiTexture())
 
  834        return reinterpret_cast<void *
>(
quintptr(tex->nativeTexture().object));
 
  889                                        QQuickWindow::CreateTextureOptions options)
 
  895int QSGTexturePlatformD3D12::nativeResourceState()
 const 
  897    if (
auto *tex = m_texture->rhiTexture())
 
  898        return tex->nativeTexture().layout;
 
  902void *QSGTexturePlatformD3D12::nativeTexture()
 const 
  904    if (
auto *tex = m_texture->rhiTexture())
 
  905        return reinterpret_cast<void *
>(
quintptr(tex->nativeTexture().object));
 
  911#if defined(__OBJC__) || defined(Q_QDOC) 
  959#if QT_CONFIG(vulkan) || defined(Q_QDOC) 
 1014                                         QQuickWindow::CreateTextureOptions options)
 
 1020VkImage QSGTexturePlatformVulkan::nativeImage()
 const 
 1022    if (
auto *tex = m_texture->rhiTexture())
 
 1023        return VkImage(tex->nativeTexture().object);
 
 1024    return VK_NULL_HANDLE;
 
 1027VkImageLayout QSGTexturePlatformVulkan::nativeImageLayout()
 const 
 1029    if (
auto *tex = m_texture->rhiTexture())
 
 1030        return VkImageLayout(tex->nativeTexture().layout);
 
 1031    return VK_IMAGE_LAYOUT_UNDEFINED;
 
 1035void *QSGTexture::resolveInterface(
const char *
name, 
int revision)
 const 
 1045#if QT_CONFIG(vulkan) 
 1048#if defined(__OBJC__) 
 1051#if defined(Q_OS_WIN) 
 1055#if QT_CONFIG(opengl) 
 1064#include "moc_qsgtexture.cpp" 
bool remove(const Key &key)
Removes the item that has the key from the hash.
 
iterator begin()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
 
iterator erase(const_iterator it)
 
T value(const Key &key) const noexcept
 
bool isEmpty() const noexcept
Returns true if the hash contains no items; otherwise returns false.
 
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
 
static QQuickWindowPrivate * get(QQuickWindow *c)
 
QSGTexture * createTextureFromNativeTexture(quint64 nativeObjectHandle, int nativeLayoutOrState, uint nativeFormat, const QSize &size, QQuickWindow::CreateTextureOptions options, TextureFromNativeTextureFlags flags={}) const
 
@ NativeTextureIsExternalOES
 
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
 
\inmodule QtCore\reentrant
 
~QSGDynamicTexture() override
 
QSGDynamicTexture()=default
 
void resetDirtySamplerOptions()
 
bool hasDirtySamplerOptions() const
 
QSGTexturePrivate(QSGTexture *t)
 
virtual void commitTextureOperations(QRhi *rhi, QRhiResourceUpdateBatch *resourceUpdates)
Call this function to enqueue image upload operations to resourceUpdates, in case there are any pendi...
 
void setAnisotropyLevel(AnisotropyLevel level)
Sets the level of anisotropic filtering to level.
 
QSGTexture::Filtering mipmapFiltering() const
Returns whether mipmapping should be used when sampling from this texture.
 
virtual QRectF normalizedTextureSubRect() const
Returns the rectangle inside textureSize() that this texture represents in normalized coordinates.
 
void setHorizontalWrapMode(WrapMode hwrap)
Sets the horizontal wrap mode to hwrap.
 
virtual QSGTexture * removedFromAtlas(QRhiResourceUpdateBatch *resourceUpdates=nullptr) const
This function returns a copy of the current texture which is removed from its atlas.
 
void setFiltering(Filtering filter)
Sets the sampling mode to filter.
 
QSGTexture::WrapMode verticalWrapMode() const
Returns the vertical wrap mode to be used for this texture.
 
QSGTexture::Filtering filtering() const
Returns the sampling mode to be used for this texture.
 
QSGTexture::AnisotropyLevel anisotropyLevel() const
Returns the anisotropy level in use for filtering this texture.
 
void setMipmapFiltering(Filtering filter)
Sets the mipmap sampling mode to filter.
 
Filtering
Specifies how sampling of texels should filter when texture coordinates are not pixel aligned.
 
WrapMode
Specifies how the sampler should treat texture coordinates.
 
~QSGTexture() override
Destroys the QSGTexture.
 
QSGTexture()
Constructs the QSGTexture base class.
 
virtual bool isAtlasTexture() const
Returns whether this texture is part of an atlas or not.
 
AnisotropyLevel
Specifies the anisotropic filtering level to be used when the texture is not screen aligned.
 
QSGTexture::WrapMode horizontalWrapMode() const
Returns the horizontal wrap mode to be used for this texture.
 
virtual QRhiTexture * rhiTexture() const
 
void setVerticalWrapMode(WrapMode vwrap)
Sets the vertical wrap mode to vwrap.
 
QSet< QString >::iterator it
 
Combined button and popup list for selecting options.
 
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
 
#define QT_NATIVE_INTERFACE_RETURN_IF(NativeInterface, baseType)
 
#define QT_DEFINE_NATIVE_INTERFACE(...)
 
GLboolean GLboolean GLboolean b
 
GLenum GLuint GLint level
 
GLfloat GLfloat GLfloat w
[0]
 
GLboolean GLboolean GLboolean GLboolean a
[7]
 
GLenum GLuint GLintptr GLsizeiptr size
[1]
 
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
 
#define DEFINE_BOOL_CONFIG_OPTION(name, var)
 
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
 
#define Q_ASSERT_X(cond, x, msg)
 
QT_BEGIN_NAMESPACE bool operator==(const QSGSamplerDescription &a, const QSGSamplerDescription &b) noexcept
 
size_t qHash(const QSGSamplerDescription &s, size_t seed) noexcept
 
static void qt_debug_print_texture_count()
 
static void qt_debug_remove_texture(QSGTexture *texture)
 
static int qt_debug_texture_count
 
bool operator!=(const QSGSamplerDescription &a, const QSGSamplerDescription &b) noexcept
 
static void qt_debug_add_texture(QSGTexture *texture)
 
#define QT_CONFIG(feature)
 
unsigned long long quint64
 
if(qFloatDistance(a, b)<(1<< 7))
[0]
 
static QSGSamplerDescription fromTexture(QSGTexture *t)