Version: 2020.3
public ShaderData.VariantCompileInfo CompileVariant (Rendering.ShaderType shaderType, string[] keywords, Rendering.ShaderCompilerPlatform shaderCompilerPlatform, BuildTarget buildTarget);
public ShaderData.VariantCompileInfo CompileVariant (Rendering.ShaderType shaderType, string[] keywords, Rendering.ShaderCompilerPlatform shaderCompilerPlatform, BuildTarget buildTarget, Rendering.GraphicsTier tier);
public ShaderData.VariantCompileInfo CompileVariant (Rendering.ShaderType shaderType, string[] keywords, Rendering.ShaderCompilerPlatform shaderCompilerPlatform, BuildTarget buildTarget, BuiltinShaderDefine[] platformKeywords);
public ShaderData.VariantCompileInfo CompileVariant (Rendering.ShaderType shaderType, string[] keywords, Rendering.ShaderCompilerPlatform shaderCompilerPlatform, BuildTarget buildTarget, BuiltinShaderDefine[] platformKeywords, Rendering.GraphicsTier tier);

参数

shaderType The shader type within this pass to compile. (e.g. Vertex, Fragment, etc.) Some platforms (OpenGLCore, GLES20, GLES3x, Switch and Vulkan) include all stages within the Vertex shader type.
keywords The keywords to use during the compilation.
shaderCompilerPlatform The shader compiler platform to compile for.
buildTarget The build target to compile for.
tier An optional graphics tier.
platformKeywords An optional set of platform keywords. If you do not provide any, Unity uses the default keywords for the given platform, target, and tier.

返回

VariantCompileInfo The compiled variant result, including resource layout information and bytecode. If the pass doesn't include the requested program, or if the pass is not the correct type, this function still succeeds but returns empty bytecode.

描述

Compiles a shader variant for this shader pass and returns its bytecode and resource layout.