QRhiShadingRateMap Class

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

頭: #include <rhi/qrhi.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS GuiPrivate)
target_link_libraries(mytarget PRIVATE Qt6::GuiPrivate)
qmake: QT += gui-private
Since: Qt 6.9
繼承: QRhiResource

公共類型

(從 6.9 起) struct NativeShadingRateMap

公共函數

virtual bool createFrom (QRhiShadingRateMap::NativeShadingRateMap src )
virtual bool createFrom (QRhiTexture * src )

重實現公共函數

virtual QRhiResource::Type resourceType () const override

詳細描述

注意: This is a RHI API with limited compatibility guarantees, see QRhi 瞭解細節。

For an introduction to Variable Rate Shading (VRS), see 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.

成員函數文檔編製

[virtual] bool QRhiShadingRateMap:: createFrom ( QRhiShadingRateMap::NativeShadingRateMap src )

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

返迴 true when successful, false when not supported.

注意: 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.

[virtual] bool QRhiShadingRateMap:: createFrom ( QRhiTexture * src )

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

返迴 true when successful, false when not supported.

The QRhiShadingRateMap 未擁有所有權對於 src .

注意: 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) 和高度 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 QRhi::resourceLimit () 和 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 D3D12_SHADING_RATE for other possible values.

[override virtual] QRhiResource::Type QRhiShadingRateMap:: resourceType () const

重實現: QRhiResource::resourceType () const.

Returns the resource type.