Version: 2022.3
LanguageEnglish
  • C#

ShaderData.Pass.CompileVariant

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public ShaderData.VariantCompileInfo CompileVariant(Rendering.ShaderType shaderType, string[] keywords, Rendering.ShaderCompilerPlatform shaderCompilerPlatform, BuildTarget buildTarget);

Declaration

public ShaderData.VariantCompileInfo CompileVariant(Rendering.ShaderType shaderType, string[] keywords, Rendering.ShaderCompilerPlatform shaderCompilerPlatform, BuildTarget buildTarget, bool forExternalTool);

Declaration

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

Declaration

public ShaderData.VariantCompileInfo CompileVariant(Rendering.ShaderType shaderType, string[] keywords, Rendering.ShaderCompilerPlatform shaderCompilerPlatform, BuildTarget buildTarget, Rendering.GraphicsTier tier, bool forExternalTool);

Declaration

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

Declaration

public ShaderData.VariantCompileInfo CompileVariant(Rendering.ShaderType shaderType, string[] keywords, Rendering.ShaderCompilerPlatform shaderCompilerPlatform, BuildTarget buildTarget, BuiltinShaderDefine[] platformKeywords, bool forExternalTool);

Declaration

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

Declaration

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

Parameters

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.
forExternalTool Indicates whether to prepare the bytecode for Unity or to use with external tools.
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.

Returns

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.

Description

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

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