Parameter | Description |
---|---|
shader | The shader the pass belongs to. |
passIdentifier | The identifier of the pass in the shader. |
graphicsAPI | The graphics API to check against. |
bool If the graphics API is supported, returns true. Otherwise, returns false.
Checks whether the given shader pass supports the provided graphics API.
Use this method to check if the shader pass has a #pragma exclude_renderers
or #pragma only_renderers
that excludes the graphicsAPI
.
ComputeShader FindComputeShader() { return (ComputeShader)AssetDatabase.LoadAssetAtPath("Assets/Shaders/ShaderName.compute", typeof(ComputeShader)); }
public void CheckComputeShaderSupportsD3D11() { // Get a compute shader object to check var shader = FindComputeShader(); // Check whether it supports D3D11 bool supports = ShaderUtil.IsGraphicsAPISupported(shader, GraphicsDeviceType.Direct3D11); // Log the result Debug.Log("Compute shader supports D3D11: " + supports); }
Parameter | Description |
---|---|
shader | The shader to check. |
graphicsAPI | The graphics API to check against. |
bool If the graphics API is supported, returns true. Otherwise, returns false.
Checks whether the given compute shader supports the provided graphics API.
Use this method to check if the compute shader has a #pragma exclude_renderers
or #pragma only_renderers
that excludes the graphicsAPI
.
public void CheckShaderPassSupportsD3D11() { // Get a shader object to check var shader = Shader.Find("Custom/ShaderName"); // Check whether the first pass of the first subshader supports D3D11 bool supports = ShaderUtil.IsGraphicsAPISupported(shader, new PassIdentifier(0, 0), GraphicsDeviceType.Direct3D11); // Log the result Debug.Log("Shader pass supports D3D11: " + supports); }