![]() |
Qt 6.x
The Qt SDK
|
#include <qrhimetal_p.h>
Public Member Functions | |
QMetalTexture (QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth, int arraySize, int sampleCount, Flags flags) | |
~QMetalTexture () | |
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 | |
QMetalTextureData * | d |
int | mipLevelCount = 0 |
int | samples = 1 |
uint | generation = 0 |
int | lastActiveFrameSlot = -1 |
Friends | |
class | QRhiMetal |
struct | QMetalShaderResourceBindings |
struct | QMetalTextureData |
Definition at line 69 of file qrhimetal_p.h.
QMetalTexture::QMetalTexture | ( | QRhiImplementation * | rhi, |
Format | format, | ||
const QSize & | pixelSize, | ||
int | depth, | ||
int | arraySize, | ||
int | sampleCount, | ||
Flags | flags | ||
) |
Definition at line 3665 of file qrhimetal.mm.
References d, i, QRhi::MAX_MIP_LEVELS, QMetalTextureData::perLevelViews, QMTL_FRAMES_IN_FLIGHT, and QMetalTextureData::stagingBuf.
QMetalTexture::~QMetalTexture | ( | ) |
|
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 3779 of file qrhimetal.mm.
References QByteArray::constData(), QRhiTexture::CubeMap, d, desc, QMetalTextureData::format, generation, init(), iOS, QByteArray::isEmpty(), lastActiveFrameSlot, QRhiTexture::m_arraySize, QRhiTexture::m_depth, QRhiTexture::m_flags, QRhiResource::m_objectName, mipLevelCount, QRhiTexture::OneDimensional, QMetalTextureData::owns, prepareCreate(), qMax(), QRHI_RES_RHI, release(), QRhiTexture::RenderTarget, QMetalTextureData::tex, QRhiTexture::TextureArray, QRhiTexture::ThreeDimensional, and QRhiTexture::UsedWithLoadStore.
|
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 3842 of file qrhimetal.mm.
References d, generation, lastActiveFrameSlot, QMetalTextureData::owns, prepareCreate(), QRHI_RES_RHI, and QMetalTextureData::tex.
|
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 3683 of file qrhimetal.mm.
References d, e, i, lastActiveFrameSlot, QRhi::MAX_MIP_LEVELS, QMetalTextureData::owns, QMetalTextureData::perLevelViews, QMTL_FRAMES_IN_FLIGHT, QRHI_RES_RHI, QMetalTextureData::stagingBuf, QMetalTextureData::tex, and QRhiMetalData::DeferredReleaseEntry::Texture.
Referenced by ~QMetalTexture(), and prepareCreate().
|
overridevirtual |
Reimplemented from QRhiTexture.
Definition at line 3862 of file qrhimetal.mm.
References d, and QMetalTextureData::tex.
Definition at line 3712 of file qrhimetal.mm.
References QRhiTexture::CubeMap, d, destroy(), QMetalTextureData::format, 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, QMetalTextureData::tex, QRhiTexture::TextureArray, QRhiTexture::ThreeDimensional, toMetalTextureFormat(), and QSize::width().
Referenced by create(), and createFrom().
|
friend |
Definition at line 87 of file qrhimetal_p.h.
|
friend |
Definition at line 88 of file qrhimetal_p.h.
|
friend |
Definition at line 86 of file qrhimetal_p.h.
QMetalTextureData* QMetalTexture::d |
Definition at line 81 of file qrhimetal_p.h.
Referenced by QMetalTexture(), ~QMetalTexture(), create(), QMetalTextureRenderTarget::create(), createFrom(), destroy(), QRhiMetal::enqueueShaderResourceBindings(), QRhiMetal::enqueueSubresUpload(), nativeTexture(), QMetalTextureRenderTarget::newCompatibleRenderPassDescriptor(), and prepareCreate().
uint QMetalTexture::generation = 0 |
Definition at line 84 of file qrhimetal_p.h.
Referenced by create(), createFrom(), and QRhiMetal::setShaderResources().
int QMetalTexture::lastActiveFrameSlot = -1 |
Definition at line 85 of file qrhimetal_p.h.
Referenced by create(), createFrom(), destroy(), and QRhiMetal::setShaderResources().
int QMetalTexture::mipLevelCount = 0 |
Definition at line 82 of file qrhimetal_p.h.
Referenced by create(), and prepareCreate().
int QMetalTexture::samples = 1 |
Definition at line 83 of file qrhimetal_p.h.
Referenced by QMetalTextureRenderTarget::create().