Version: 2021.3
public bool IsSupported (int kernelIndex);

参数

kernelIndex Which kernel to query.

返回

bool True if the specified compute kernel is able to run on the current end user device, false otherwise.

描述

Allows you to check whether the current end user device supports the features required to run the specified compute shader kernel.

The result of this call depends on which hardware requirements the compute shader in question is expected to rely on (as defined by the `#pragma require <requirement_a> <requirement_b> <requirement_c> ...` shader syntax). This method implicitly refers to the compute shader variant defined by the set of currently enabled shader keywords (the variant that would be run if ComputeShader.Dispatch were called instead). This means that when the source code of the shader in question contains per-keyword requirements defined using the '#pragma require KEYWORD_A KEYWORD_B ... : <requirement_a> <requirement_b> <requirement_c>...' syntax the result of IsSupported might depend on which shader keywords are enabled.

See Also: Shader variants and keywords, Declaring and using shader keywords in HLSL, Targeting shader models and GPU features in HLSL.