![]() |
Qt 6.x
The Qt SDK
|
#include <qrhid3d11_p.h>
Public Member Functions | |
QD3D11Texture (QRhiImplementation *rhi, Format format, const QSize &pixelSize, int depth, int arraySize, int sampleCount, Flags flags) | |
~QD3D11Texture () | |
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) |
bool | finishCreate () |
ID3D11UnorderedAccessView * | unorderedAccessViewForLevel (int level) |
ID3D11Resource * | textureResource () const |
![]() | |
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 | |
ID3D11Texture2D * | tex = nullptr |
ID3D11Texture3D * | tex3D = nullptr |
ID3D11Texture1D * | tex1D = nullptr |
bool | owns = true |
ID3D11ShaderResourceView * | srv = nullptr |
DXGI_FORMAT | dxgiFormat |
uint | mipLevelCount = 0 |
DXGI_SAMPLE_DESC | sampleDesc |
ID3D11UnorderedAccessView * | perLevelViews [QRhi::MAX_MIP_LEVELS] |
uint | generation = 0 |
Friends | |
class | QRhiD3D11 |
Definition at line 69 of file qrhid3d11_p.h.
QD3D11Texture::QD3D11Texture | ( | QRhiImplementation * | rhi, |
Format | format, | ||
const QSize & | pixelSize, | ||
int | depth, | ||
int | arraySize, | ||
int | sampleCount, | ||
Flags | flags | ||
) |
Definition at line 3103 of file qrhid3d11.cpp.
References i, QRhi::MAX_MIP_LEVELS, and perLevelViews.
QD3D11Texture::~QD3D11Texture | ( | ) |
Definition at line 3111 of file qrhid3d11.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 3332 of file qrhid3d11.cpp.
References QByteArray::constData(), QRhiTexture::CubeMap, desc, dxgiFormat, finishCreate(), isDepthTextureFormat(), QByteArray::isEmpty(), QRhiTexture::m_arraySize, QRhiTexture::m_depth, QRhiTexture::m_flags, QRhiTexture::m_format, QRhiResource::m_objectName, mipLevelCount, QRhiTexture::OneDimensional, owns, prepareCreate(), qMax(), qPrintable, QRHI_RES_RHI, qWarning, QRhiTexture::RenderTarget, sampleDesc, QByteArray::size(), tex, tex1D, tex3D, QRhiTexture::TextureArray, QRhiTexture::ThreeDimensional, QRhiTexture::UsedWithGenerateMips, 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 3432 of file qrhid3d11.cpp.
References finishCreate(), QRhiTexture::m_flags, QRhiTexture::OneDimensional, owns, prepareCreate(), QRHI_RES_RHI, tex, tex1D, tex3D, and QRhiTexture::ThreeDimensional.
|
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 3116 of file qrhid3d11.cpp.
References i, QRhi::MAX_MIP_LEVELS, owns, perLevelViews, QRHI_RES_RHI, srv, tex, tex1D, and tex3D.
Referenced by ~QD3D11Texture(), and prepareCreate().
bool QD3D11Texture::finishCreate | ( | ) |
Definition at line 3257 of file qrhid3d11.cpp.
References QRhiTexture::CubeMap, dxgiFormat, generation, isDepthTextureFormat(), QRhiTexture::m_arrayRangeLength, QRhiTexture::m_arrayRangeStart, QRhiTexture::m_arraySize, QRhiTexture::m_flags, QRhiTexture::m_format, mipLevelCount, QRhiTexture::OneDimensional, qMax(), qPrintable, QRHI_RES_RHI, qWarning, sampleDesc, srv, QRhiTexture::TextureArray, textureResource(), QRhiTexture::ThreeDimensional, and toD3DDepthTextureSRVFormat().
Referenced by create(), and createFrom().
|
overridevirtual |
Reimplemented from QRhiTexture.
Definition at line 3456 of file qrhid3d11.cpp.
References textureResource().
Definition at line 3185 of file qrhid3d11.cpp.
References QRhiTexture::CubeMap, destroy(), dxgiFormat, isDepthTextureFormat(), 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, sampleDesc, tex, tex1D, tex3D, QRhiTexture::TextureArray, QRhiTexture::ThreeDimensional, toD3DTextureFormat(), and QSize::width().
Referenced by create(), and createFrom().
|
inline |
Definition at line 82 of file qrhid3d11_p.h.
References tex, tex1D, and tex3D.
Referenced by QD3D11TextureRenderTarget::create(), QRhiD3D11::endPass(), QRhiD3D11::enqueueResourceUpdates(), QRhiD3D11::enqueueSubresUpload(), finishCreate(), nativeTexture(), and unorderedAccessViewForLevel().
ID3D11UnorderedAccessView * QD3D11Texture::unorderedAccessViewForLevel | ( | int | level | ) |
Definition at line 3461 of file qrhid3d11.cpp.
References QRhiTexture::CubeMap, desc, dxgiFormat, QRhiTexture::m_arraySize, QRhiTexture::m_flags, perLevelViews, qMax(), qPrintable, QRHI_RES_RHI, qWarning, QRhiTexture::TextureArray, textureResource(), and QRhiTexture::ThreeDimensional.
Referenced by QRhiD3D11::updateShaderResourceBindings().
|
friend |
Definition at line 101 of file qrhid3d11_p.h.
DXGI_FORMAT QD3D11Texture::dxgiFormat |
Definition at line 96 of file qrhid3d11_p.h.
Referenced by create(), QRhiD3D11::endPass(), QRhiD3D11::enqueueResourceUpdates(), finishCreate(), prepareCreate(), and unorderedAccessViewForLevel().
uint QD3D11Texture::generation = 0 |
Definition at line 100 of file qrhid3d11_p.h.
Referenced by finishCreate(), QRhiD3D11::setShaderResources(), and QRhiD3D11::updateShaderResourceBindings().
uint QD3D11Texture::mipLevelCount = 0 |
Definition at line 97 of file qrhid3d11_p.h.
Referenced by create(), QRhiD3D11::endPass(), QRhiD3D11::enqueueResourceUpdates(), QRhiD3D11::enqueueSubresUpload(), finishCreate(), and prepareCreate().
bool QD3D11Texture::owns = true |
Definition at line 94 of file qrhid3d11_p.h.
Referenced by create(), createFrom(), and destroy().
ID3D11UnorderedAccessView* QD3D11Texture::perLevelViews[QRhi::MAX_MIP_LEVELS] |
Definition at line 99 of file qrhid3d11_p.h.
Referenced by QD3D11Texture(), destroy(), and unorderedAccessViewForLevel().
DXGI_SAMPLE_DESC QD3D11Texture::sampleDesc |
Definition at line 98 of file qrhid3d11_p.h.
Referenced by create(), QD3D11TextureRenderTarget::create(), QRhiD3D11::endPass(), QRhiD3D11::enqueueResourceUpdates(), finishCreate(), and prepareCreate().
ID3D11ShaderResourceView* QD3D11Texture::srv = nullptr |
Definition at line 95 of file qrhid3d11_p.h.
Referenced by destroy(), finishCreate(), and QRhiD3D11::updateShaderResourceBindings().
ID3D11Texture2D* QD3D11Texture::tex = nullptr |
Definition at line 91 of file qrhid3d11_p.h.
Referenced by create(), QD3D11TextureRenderTarget::create(), createFrom(), destroy(), prepareCreate(), QRhiD3D11::setShaderResources(), textureResource(), and QRhiD3D11::updateShaderResourceBindings().
ID3D11Texture1D* QD3D11Texture::tex1D = nullptr |
Definition at line 93 of file qrhid3d11_p.h.
Referenced by create(), createFrom(), destroy(), prepareCreate(), and textureResource().
ID3D11Texture3D* QD3D11Texture::tex3D = nullptr |
Definition at line 92 of file qrhid3d11_p.h.
Referenced by create(), createFrom(), destroy(), prepareCreate(), and textureResource().