Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SupportsTypedUAVShaderLoadStoreOnGraphicsFormat(GraphicsFormat, bool)

Tests if a GraphicsFormat can be used for typed UAV shader load/store on current hardware.
Read time 1 minuteLast updated 12 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule
public static bool SupportsTypedUAVShaderLoadStoreOnGraphicsFormat(GraphicsFormat graphicsFormat, bool isLoad)

Parameters

graphicsFormat

The format to look up.

isLoad

True for "load" operation check, false for "store" operation check. Some formats on some hardware can support one but not another.

Returns

Type

Description

boolTrue if the hardware supports the format for typed UAV load/store.

Remarks

D3D11/D3D12 are more restrictive (https://learn.microsoft.com/en-us/windows/win32/direct3d12/typed-unordered-access-view-loads#supported-formats-and-api-calls) than other APIs for typed UAV load/store operations. When a user wants to read/write to a RWTexture of a specific format, such as GraphicsFormat.R32G32_SFloat, in a shader, D3D can silently produce incorrect results on some hardware (i.e., integrated Intel GPUs). This function can be used to prevent such behavior on D3D. Other APIs are either less restrictive or do not have typed shader syntax for RW textures; this function just returns
true
on those APIs if the format supports GraphicsFormatUsage.LoadStore.