Version: 2023.2
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.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961