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
QMetalShadingRateMap Struct Reference

#include <qrhimetal_p.h>

Inheritance diagram for QMetalShadingRateMap:
Collaboration diagram for QMetalShadingRateMap:

Public Member Functions

 QMetalShadingRateMap (QRhiImplementation *rhi)
 ~QMetalShadingRateMap ()
void destroy () override
 Releases (or requests deferred releasing of) the underlying native graphics resources.
bool createFrom (NativeShadingRateMap src) override
 Sets up the shading rate map to use a native 3D API shading rate object src.
QSize logicalSize () const override
Public Member Functions inherited from QRhiShadingRateMap
QRhiResource::Type resourceType () const override
virtual bool createFrom (QRhiTexture *src)
 Sets up the shading rate map to use the texture src as the image containing the per-tile shading rates.
Public Member Functions inherited from QRhiResource
virtual ~QRhiResource ()
 Destructor.
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

QMetalShadingRateMapData * d
uint generation = 0
int lastActiveFrameSlot = -1

Friends

class QRhiMetal

Additional Inherited Members

Public Types inherited from QRhiResource
enum  Type {
  Buffer , Texture , Sampler , RenderBuffer ,
  RenderPassDescriptor , SwapChainRenderTarget , TextureRenderTarget , ShaderResourceBindings ,
  GraphicsPipeline , SwapChain , ComputePipeline , CommandBuffer ,
  ShadingRateMap , IndirectCommandBuffer
}
 Specifies type of the resource. More...
Protected Member Functions inherited from QRhiShadingRateMap
 QRhiShadingRateMap (QRhiImplementation *rhi)
 \variable QRhiShadingRateMap::NativeShadingRateMap::object
Protected Member Functions inherited from QRhiResource
 QRhiResource (QRhiImplementation *rhi)
Protected Attributes inherited from QRhiResource
QRhiImplementation * m_rhi = nullptr
quint64 m_id
QByteArray m_objectName

Detailed Description

Definition at line 117 of file qrhimetal_p.h.

Constructor & Destructor Documentation

◆ QMetalShadingRateMap()

QMetalShadingRateMap::QMetalShadingRateMap ( QRhiImplementation * rhi)

Definition at line 5817 of file qrhimetal.mm.

References QMetalShadingRateMap(), and d.

Referenced by QMetalShadingRateMap().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~QMetalShadingRateMap()

QMetalShadingRateMap::~QMetalShadingRateMap ( )

Definition at line 5823 of file qrhimetal.mm.

References d, and destroy().

Here is the call graph for this function:

Member Function Documentation

◆ createFrom()

bool QMetalShadingRateMap::createFrom ( NativeShadingRateMap src)
overridevirtual

Sets up the shading rate map to use a native 3D API shading rate object src.

Returns
true when successful, false when not supported.
Note
This is functional only when the QRhi::VariableRateShadingMap feature is reported as supported, while QRhi::VariableRateShadingMapWithTexture feature is not. Currently this is true for Metal, assuming variable rate shading is supported by the GPU.
With Metal, the object field of src is expected to contain an id<MTLRasterizationRateMap>. Qt passes the MTLRasterizationRateMap on to the MTLRenderPassDescriptor, and, because Metal then interprets viewports and scissor rectangles in the map's screen space coordinate system, sizes the default scissor and converts viewports and scissors specified via QRhiCommandBuffer accordingly. The size of that coordinate system is reported by logicalSize(). Anything else, such as scaling when sampling the rendered result, is up to the application (or the XR compositor).

Reimplemented from QRhiShadingRateMap.

Definition at line 5848 of file qrhimetal.mm.

References d, destroy(), and lastActiveFrameSlot.

Here is the call graph for this function:

◆ destroy()

void QMetalShadingRateMap::destroy ( )
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.

Note
Resources referenced by commands for the current frame should not be released until the frame is submitted by QRhi::endFrame().

The QRhiResource destructor also performs the same task, so calling this function is not necessary before deleting a QRhiResource.

See also
deleteLater()

Implements QRhiResource.

Definition at line 5829 of file qrhimetal.mm.

References d, QRhiMetal::d, lastActiveFrameSlot, QRhiMetalData::DeferredReleaseEntry::lastActiveFrameSlot, QRhiMetalData::DeferredReleaseEntry::ShadingRateMap, and QRhiMetalData::DeferredReleaseEntry::type.

Referenced by ~QMetalShadingRateMap(), and createFrom().

Here is the caller graph for this function:

◆ logicalSize()

QSize QMetalShadingRateMap::logicalSize ( ) const
overridevirtual
Since
6.13
Returns
the size of the logical coordinate space the shading rate map defines, or an invalid QSize when the map does not define one.

Some implementations, Metal in particular, describe a shading rate map in terms of a logical (screen space) size that is mapped onto the physical pixels of the render target. When such a map is attached to a render target, viewports and scissor rectangles are interpreted in the logical coordinate system, and the logical size is typically larger than QRhiRenderTarget::pixelSize(). Applications that derive viewports, scissors, or projection setup from the render target size should use this size instead whenever it is valid.

For implementations where the shading rate map is a tile image covering the render target, such as Vulkan and Direct 3D 12, there is no separate logical coordinate space, and an invalid QSize is returned. The render target's pixel size applies as usual in that case.

See also
QRhiRenderTarget::pixelSize()

Reimplemented from QRhiShadingRateMap.

Definition at line 5866 of file qrhimetal.mm.

References d.

◆ QRhiMetal

friend class QRhiMetal
friend

Definition at line 128 of file qrhimetal_p.h.

Member Data Documentation

◆ d

QMetalShadingRateMapData* QMetalShadingRateMap::d

◆ generation

uint QMetalShadingRateMap::generation = 0

Definition at line 126 of file qrhimetal_p.h.

◆ lastActiveFrameSlot

int QMetalShadingRateMap::lastActiveFrameSlot = -1

Definition at line 127 of file qrhimetal_p.h.

Referenced by createFrom(), and destroy().


The documentation for this struct was generated from the following files: