![]() |
Qt 6.x
The Qt SDK
|
#include <qrhigles2_p.h>
Classes | |
struct | UsageState |
Public Member Functions | |
QGles2Texture (QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth, int arraySize, int sampleCount, Flags flags) | |
~QGles2Texture () | |
void | destroy () override |
Releases (or requests deferred releasing of) the underlying native graphics resources. | |
bool | create () override |
Creates the corresponding native graphics resources. | |
bool | createFrom (NativeTexture src) override |
Similar to create(), except that no new native textures are created. | |
NativeTexture | nativeTexture () override |
bool | prepareCreate (QSize *adjustedSize=nullptr) |
![]() | |
QRhiResource::Type | resourceType () const override |
Format | format () const |
void | setFormat (Format fmt) |
Sets the requested texture format to fmt. | |
QSize | pixelSize () const |
void | setPixelSize (const QSize &sz) |
Sets the texture size, specified in pixels, to sz. | |
int | depth () const |
void | setDepth (int depth) |
Sets the depth for a 3D texture. | |
int | arraySize () const |
void | setArraySize (int arraySize) |
Sets the texture arraySize. | |
int | arrayRangeStart () const |
int | arrayRangeLength () const |
void | setArrayRange (int startIndex, int count) |
Normally all array layers are exposed and it is up to the shader to select the layer via the third coordinate passed to the {texture()} GLSL function when sampling the sampler2DArray . | |
Flags | flags () const |
void | setFlags (Flags f) |
Sets the texture flags to f. | |
int | sampleCount () const |
void | setSampleCount (int s) |
Sets the sample count to s. | |
virtual bool | create ()=0 |
Creates the corresponding native graphics resources. | |
virtual NativeTexture | nativeTexture () |
virtual bool | createFrom (NativeTexture src) |
Similar to create(), except that no new native textures are created. | |
virtual void | setNativeLayout (int layout) |
With some graphics APIs, such as Vulkan, integrating custom rendering code that uses the graphics API directly needs special care when it comes to image layouts. | |
![]() | |
virtual | ~QRhiResource () |
Destructor. | |
virtual Type | resourceType () const =0 |
virtual void | destroy ()=0 |
Releases (or requests deferred releasing of) the underlying native graphics resources. | |
void | deleteLater () |
When called without a frame being recorded, this function is equivalent to deleting the object. | |
QByteArray | name () const |
void | setName (const QByteArray &name) |
Sets a name for the object. | |
quint64 | globalResourceId () const |
QRhi * | rhi () const |
Public Attributes | |
GLuint | texture = 0 |
bool | owns = true |
GLenum | target |
GLenum | glintformat |
GLenum | glsizedintformat |
GLenum | glformat |
GLenum | gltype |
QGles2SamplerData | samplerState |
bool | specified = false |
bool | zeroInitialized = false |
int | mipLevelCount = 0 |
UsageState | usageState |
uint | generation = 0 |
Friends | |
class | QRhiGles2 |
Additional Inherited Members | |
![]() | |
QRhiTexture (QRhiImplementation *rhi, Format format_, const QSize &pixelSize_, int depth_, int arraySize_, int sampleCount_, Flags flags_) | |
\variable QRhiTexture::NativeTexture::object | |
![]() | |
QRhiResource (QRhiImplementation *rhi) | |
![]() | |
Format | m_format |
QSize | m_pixelSize |
int | m_depth |
int | m_arraySize |
int | m_sampleCount |
Flags | m_flags |
int | m_arrayRangeStart = -1 |
int | m_arrayRangeLength = -1 |
![]() | |
QRhiImplementation * | m_rhi = nullptr |
quint64 | m_id |
QByteArray | m_objectName |
Definition at line 106 of file qrhigles2_p.h.
Enumerator | |
---|---|
AccessNone | |
AccessSample | |
AccessFramebuffer | |
AccessStorageRead | |
AccessStorageWrite | |
AccessStorageReadWrite | |
AccessUpdate | |
AccessRead |
Definition at line 130 of file qrhigles2_p.h.
QGles2Texture::QGles2Texture | ( | QRhiImplementation * | rhi, |
Format | format, | ||
const QSize & | pixelSize, | ||
int | depth, | ||
int | arraySize, | ||
int | sampleCount, | ||
Flags | flags | ||
) |
Definition at line 5230 of file qrhigles2.cpp.
QGles2Texture::~QGles2Texture | ( | ) |
Definition at line 5236 of file qrhigles2.cpp.
References destroy().
|
overridevirtual |
Creates the corresponding native graphics resources.
If there are already resources present due to an earlier create() with no corresponding destroy(), then destroy() is called implicitly first.
true
when successful, false
when a graphics operation failed. Regardless of the return value, calling destroy() is always safe. Implements QRhiTexture.
Definition at line 5361 of file qrhigles2.cpp.
References QRhiTexture::CubeMap, generation, GL_TEXTURE_CUBE_MAP_POSITIVE_X, GLenum(), glformat, GLint(), glintformat, glsizedintformat, gltype, QSize::height(), QRhiTexture::m_arraySize, QRhiTexture::m_depth, QRhiTexture::m_flags, QRhiTexture::m_format, mipLevelCount, QRhiTexture::MipMapped, QRhiTexture::OneDimensional, owns, prepareCreate(), qMax(), QRHI_RES_RHI, specified, target, QRhiTexture::TextureArray, QRhiTexture::ThreeDimensional, QRhiTexture::UsedWithLoadStore, and QSize::width().
|
overridevirtual |
Similar to create(), except that no new native textures are created.
Instead, the native texture resources specified by src is used.
This allows importing an existing native texture object (which must belong to the same device or sharing context, depending on the graphics API) from an external graphics engine.
The opposite of this operation, exposing a QRhiTexture-created native texture object to a foreign engine, is possible via nativeTexture().
Reimplemented from QRhiTexture.
Definition at line 5444 of file qrhigles2.cpp.
References generation, owns, prepareCreate(), QRHI_RES_RHI, specified, and zeroInitialized.
|
overridevirtual |
Releases (or requests deferred releasing of) the underlying native graphics resources.
Safe to call multiple times, subsequent invocations will be a no-op then.
Once destroy() is called, the QRhiResource instance can be reused, by calling create()
again. That will then result in creating new native graphics resources underneath.
The QRhiResource destructor also performs the same task, so calling this function is not necessary before deleting a QRhiResource.
Implements QRhiResource.
Definition at line 5241 of file qrhigles2.cpp.
References e, owns, QRHI_RES_RHI, specified, texture, QRhiGles2::DeferredReleaseEntry::Texture, and zeroInitialized.
Referenced by ~QGles2Texture(), and prepareCreate().
|
overridevirtual |
Reimplemented from QRhiTexture.
Definition at line 5465 of file qrhigles2.cpp.
References texture.
Definition at line 5263 of file qrhigles2.cpp.
References QGles2Texture::UsageState::access, AccessNone, QRhiTexture::CubeMap, destroy(), QRhiTexture::ExternalOES, GL_RGBA, GL_TEXTURE_1D, GL_TEXTURE_1D_ARRAY, GL_TEXTURE_2D_ARRAY, GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_2D_MULTISAMPLE_ARRAY, GL_TEXTURE_3D, GL_TEXTURE_CUBE_MAP, GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_RECTANGLE, GL_UNSIGNED_BYTE, glformat, glintformat, glsizedintformat, gltype, QSize::isEmpty(), QRhiTexture::m_arraySize, QRhiTexture::m_depth, QRhiTexture::m_flags, QRhiTexture::m_format, QRhiTexture::m_pixelSize, QRhiTexture::m_sampleCount, mipLevelCount, QRhiTexture::MipMapped, QRhiTexture::OneDimensional, qMax(), QRHI_RES_RHI, qWarning, samplerState, QRhiTexture::TextureArray, QRhiTexture::TextureRectangleGL, QRhiTexture::ThreeDimensional, toGlCompressedTextureFormat(), toGlTextureFormat(), usageState, QRhiTexture::UsedWithLoadStore, and QSize::width().
Referenced by create(), and createFrom().
|
friend |
Definition at line 146 of file qrhigles2_p.h.
uint QGles2Texture::generation = 0 |
Definition at line 145 of file qrhigles2_p.h.
Referenced by create(), and createFrom().
GLenum QGles2Texture::glformat |
Definition at line 123 of file qrhigles2_p.h.
Referenced by create(), QRhiGles2::enqueueSubresUpload(), and prepareCreate().
GLenum QGles2Texture::glintformat |
Definition at line 121 of file qrhigles2_p.h.
Referenced by create(), QRhiGles2::enqueueSubresUpload(), and prepareCreate().
GLenum QGles2Texture::glsizedintformat |
Definition at line 122 of file qrhigles2_p.h.
Referenced by QRhiGles2::bindShaderResources(), create(), and prepareCreate().
GLenum QGles2Texture::gltype |
Definition at line 124 of file qrhigles2_p.h.
Referenced by create(), QRhiGles2::enqueueSubresUpload(), and prepareCreate().
int QGles2Texture::mipLevelCount = 0 |
Definition at line 128 of file qrhigles2_p.h.
Referenced by create(), and prepareCreate().
bool QGles2Texture::owns = true |
Definition at line 119 of file qrhigles2_p.h.
Referenced by create(), createFrom(), and destroy().
QGles2SamplerData QGles2Texture::samplerState |
Definition at line 125 of file qrhigles2_p.h.
Referenced by QRhiGles2::bindCombinedSampler(), and prepareCreate().
bool QGles2Texture::specified = false |
Definition at line 126 of file qrhigles2_p.h.
Referenced by create(), QGles2TextureRenderTarget::create(), createFrom(), destroy(), QRhiGles2::enqueueResourceUpdates(), and QRhiGles2::enqueueSubresUpload().
GLenum QGles2Texture::target |
Definition at line 120 of file qrhigles2_p.h.
Referenced by QRhiGles2::bindCombinedSampler(), create(), QGles2TextureRenderTarget::create(), QRhiGles2::endPass(), QRhiGles2::enqueueResourceUpdates(), and QRhiGles2::enqueueSubresUpload().
GLuint QGles2Texture::texture = 0 |
Definition at line 118 of file qrhigles2_p.h.
Referenced by QRhiGles2::bindCombinedSampler(), QRhiGles2::bindShaderResources(), QGles2TextureRenderTarget::create(), destroy(), QRhiGles2::endPass(), QRhiGles2::enqueueResourceUpdates(), QRhiGles2::enqueueSubresUpload(), and nativeTexture().
UsageState QGles2Texture::usageState |
Definition at line 143 of file qrhigles2_p.h.
Referenced by prepareCreate(), QRhiGles2::trackedImageBarrier(), and QRhiGles2::trackedRegisterTexture().
bool QGles2Texture::zeroInitialized = false |
Definition at line 127 of file qrhigles2_p.h.
Referenced by createFrom(), destroy(), and QRhiGles2::enqueueSubresUpload().