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
QRhiShadingRateMap Class Reference

\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h More...

#include <qrhi.h>

+ Inheritance diagram for QRhiShadingRateMap:
+ Collaboration diagram for QRhiShadingRateMap:

Classes

struct  NativeShadingRateMap
 \inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h More...
 

Public Member Functions

QRhiResource::Type resourceType () const override
 
virtual bool createFrom (NativeShadingRateMap src)
 Sets up the shading rate map to use a native 3D API shading rate object src.
 
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.
 
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
 
QRhirhi () const
 

Protected Member Functions

 QRhiShadingRateMap (QRhiImplementation *rhi)
 \variable QRhiShadingRateMap::NativeShadingRateMap::object
 
- Protected Member Functions inherited from QRhiResource
 QRhiResource (QRhiImplementation *rhi)
 

Additional Inherited Members

- Public Types inherited from QRhiResource
enum  Type {
  Buffer , Texture , Sampler , RenderBuffer ,
  RenderPassDescriptor , SwapChainRenderTarget , TextureRenderTarget , ShaderResourceBindings ,
  GraphicsPipeline , SwapChain , ComputePipeline , CommandBuffer ,
  ShadingRateMap
}
 Specifies type of the resource. More...
 
- Protected Attributes inherited from QRhiResource
QRhiImplementationm_rhi = nullptr
 
quint64 m_id
 
QByteArray m_objectName
 

Detailed Description

\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h

Since
6.9

An object that wraps a texture or another kind of native 3D API object.

Note
This is a RHI API with limited compatibility guarantees, see \l QRhi for details.

For an introduction to Variable Rate Shading (VRS), see \l{https://learn.microsoft.com/en-us/windows/win32/direct3d12/vrs}. Qt supports a subset of the VRS features offered by Direct 3D 12 and Vulkan. In addition, Metal's somewhat different mechanism is supported by making it possible to set up a QRhiShadingRateMap with an existing MTLRasterizationRateMap object.

Definition at line 1152 of file qrhi.h.

Constructor & Destructor Documentation

◆ QRhiShadingRateMap()

QRhiShadingRateMap::QRhiShadingRateMap ( QRhiImplementation * rhi)
protected

\variable QRhiShadingRateMap::NativeShadingRateMap::object

64-bit integer containing the native object handle.

Used with QRhiShadingRateMap::createFrom(). For example, with Metal, object is expected to be an id<MTLRasterizationRateMap>.

Definition at line 4998 of file qrhi.cpp.

Member Function Documentation

◆ createFrom() [1/2]

bool QRhiShadingRateMap::createFrom ( NativeShadingRateMap src)
virtual

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::VariableShadingRateMapWithTexture 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>. Note that Qt does not perform anything else apart from passing the MTLRasterizationRateMap on to the MTLRenderPassDescriptor. If any special scaling is required, it is up to the application (or the XR compositor) to perform that.

Reimplemented in QMetalShadingRateMap.

Definition at line 5028 of file qrhi.cpp.

◆ createFrom() [2/2]

bool QRhiShadingRateMap::createFrom ( QRhiTexture * src)
virtual

Sets up the shading rate map to use the texture src as the image containing the per-tile shading rates.

Returns
true when successful, false when not supported.

The QRhiShadingRateMap does not take ownership of src.

Note
This is functional only when the QRhi::VariableRateShadingMapWithTexture feature is reported as supported. In practice may be supported on Vulkan and Direct 3D 12 when using modern graphics cards. It will never be supported on OpenGL or Metal, for example.
src must have a format of QRhiTexture::R8UI.
src must have a width of {ceil(render_target_pixel_width / (float)tile_width)} and a height of {ceil(render_target_pixel_height / (float)tile_height)}. It is up to the application to ensure the size of the texture is as expected, using the above formula, at all times. The tile size can be queried via \l QRhi::resourceLimit() and QRhi::ShadingRateImageTileSize.

Each byte (texel) in the texture corresponds to the shading rate value for one tile. 0 indicates 1x1, while a value of 10 indicates 4x4. See \l{https://learn.microsoft.com/en-us/windows/win32/api/d3d12/ne-d3d12-d3d12_shading_rate}{D3D12_SHADING_RATE} for other possible values.

Reimplemented in QVkShadingRateMap.

Definition at line 5061 of file qrhi.cpp.

◆ resourceType()

QRhiResource::Type QRhiShadingRateMap::resourceType ( ) const
overridevirtual
Returns
the resource type.

Implements QRhiResource.

Definition at line 5006 of file qrhi.cpp.


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