Class Vrs
Encapsulates variable shading rate support (VRS) and texture conversion to shading rate image
Inherited Members
Namespace: UnityEngine .Rendering
Assembly: Unity.RenderPipelines.Core.Runtime.dll
Syntax
public static class Vrs
Methods
ColorMaskTextureToShadingRateImage(RenderGraph, RTHandle, RTHandle, bool)
Converts a color mask texture to a shading rate image.
Declaration
public static TextureHandle ColorMaskTextureToShadingRateImage(RenderGraph renderGraph, RTHandle sriRtHandle, RTHandle colorMaskRtHandle, bool yFlip)
Parameters
Type | Name | Description |
---|---|---|
Render |
renderGraph | Render graph to record conversion commands |
RTHandle | sriRtHandle | Shading rate images to convert to. |
RTHandle | colorMaskRtHandle | Texture to convert from. |
bool | yFlip | True if shading rate image should be generated flipped. |
Returns
Type | Description |
---|---|
Texture |
Shading rate image texture handle created. |
Remarks
sriRtHandle and colorMaskRtHandle are imported with renderGraph before doing the conversion.
ColorMaskTextureToShadingRateImage(RenderGraph, TextureHandle, TextureHandle, TextureDimension, bool)
Converts a color mask texture to a shading rate image.
Declaration
public static TextureHandle ColorMaskTextureToShadingRateImage(RenderGraph renderGraph, TextureHandle sriTextureHandle, TextureHandle colorMaskHandle, TextureDimension colorMaskDimension, bool yFlip)
Parameters
Type | Name | Description |
---|---|---|
Render |
renderGraph | Render graph to record conversion commands |
Texture |
sriTextureHandle | Shading rate images to convert to. |
Texture |
colorMaskHandle | Texture to convert from. |
Texture |
colorMaskDimension | Texture's dimension. |
bool | yFlip | True if shading rate image should be generated flipped. |
Returns
Type | Description |
---|---|
Texture |
Shading rate image texture handle created. |
Remarks
sriRtHandle and colorMaskHandle are expected to be imported by renderGraph prior to this call.
ColorMaskTextureToShadingRateImageDispatch(CommandBuffer, RTHandle, Texture, bool)
Converts a color mask texture to a shading rate image. Use this function to perform the conversion without the RenderGraph.
Declaration
public static void ColorMaskTextureToShadingRateImageDispatch(CommandBuffer cmd, RTHandle sriDestination, Texture colorMaskSource, bool yFlip = true)
Parameters
Type | Name | Description |
---|---|---|
Command |
cmd | CommandBuffer used for the compute dispatch. |
RTHandle | sriDestination | Shading rate images to convert to. |
Texture | colorMaskSource | Texture to convert from. |
bool | yFlip | True if shading rate image should be generated flipped. |
DisposeResources()
Cleanup resources.
Declaration
public static void DisposeResources()
InitializeResources()
Preprocess resources found in VrsRenderPipelineRuntimeResources for use at runtime.
Declaration
public static void InitializeResources()
IsColorMaskTextureConversionSupported()
Check if conversion of color texture to shading rate image is supported. Convenience to abstract all capabilities checks.
Declaration
public static bool IsColorMaskTextureConversionSupported()
Returns
Type | Description |
---|---|
bool | Returns true if conversion of color texture to shading rate image is supported, false otherwise. |
IsInitialized()
Checks if VRS resources are initialized. Initialization may fail due to platform restrictions.
Declaration
public static bool IsInitialized()
Returns
Type | Description |
---|---|
bool | Returns true if the Vrs resources are initialized. |
ShadingRateImageToColorMaskTexture(RenderGraph, in TextureHandle, in TextureHandle)
Converts a shading rate image to a color texture for visualization.
Declaration
public static void ShadingRateImageToColorMaskTexture(RenderGraph renderGraph, in TextureHandle sriTextureHandle, in TextureHandle colorMaskHandle)
Parameters
Type | Name | Description |
---|---|---|
Render |
renderGraph | Render graph to record conversion commands |
Texture |
sriTextureHandle | Texture to convert from. |
Texture |
colorMaskHandle | Output of conversion. |
ShadingRateImageToColorMaskTextureBlit(CommandBuffer, RTHandle, RTHandle)
Converts a shading rate image to a color mask texture. Use this function to perform the conversion without the RenderGraph.
Declaration
public static void ShadingRateImageToColorMaskTextureBlit(CommandBuffer cmd, RTHandle sriSource, RTHandle colorMaskDestination)
Parameters
Type | Name | Description |
---|---|---|
Command |
cmd | CommandBuffer used for the compute dispatch. |
RTHandle | sriSource | Shading rate images to convert from. |
RTHandle | colorMaskDestination | Texture to convert to. |