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.