PreprocessVariant
Preprocesses a shader variant for this shader pass and returns the preprocessed code.
Read time 4 minutesLast updated 6 days ago
Definition
- Type: Method
- Namespace: UnityEditor
- Assembly: UnityEditor.CoreModule
PreprocessVariant(ShaderType, string[], ShaderCompilerPlatform, BuildTarget, bool)
Preprocesses a shader variant for this shader pass and returns the preprocessed code.
public ShaderData.PreprocessedVariant PreprocessVariant(ShaderType shaderType, string[] keywords, ShaderCompilerPlatform shaderCompilerPlatform, BuildTarget buildTarget, bool stripLineDirectives)
Parameters
The shader type within this pass to preprocess. (e.g. Vertex, Fragment, etc.) Some platforms (OpenGLCore, GLES3x, Switch and Vulkan) include all stages within the Vertex shader type.
The keywords to use during the preprocessing.
The shader compiler platform to preprocess for.
The build target to preprocess for.
Whether to skip line number directives in the preprocessed output. When enabled, Unity produces more human-readable preprocessed source code and skips the line directives when the file name doesn't change. Otherwise, this method produces the exact preprocessed source that Unity passes to the compiler.
Returns
Type | Description |
|---|---|
| PreprocessedVariant | The preprocessed variant result. 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 preprocessed code. |
PreprocessVariant(ShaderType, string[], ShaderCompilerPlatform, BuildTarget, GraphicsTier, bool)
Preprocesses a shader variant for this shader pass and returns the preprocessed code.
public ShaderData.PreprocessedVariant PreprocessVariant(ShaderType shaderType, string[] keywords, ShaderCompilerPlatform shaderCompilerPlatform, BuildTarget buildTarget, GraphicsTier tier, bool stripLineDirectives)
Parameters
The shader type within this pass to preprocess. (e.g. Vertex, Fragment, etc.) Some platforms (OpenGLCore, GLES3x, Switch and Vulkan) include all stages within the Vertex shader type.
The keywords to use during the preprocessing.
The shader compiler platform to preprocess for.
The build target to preprocess for.
An optional graphics tier.
Whether to skip line number directives in the preprocessed output. When enabled, Unity produces more human-readable preprocessed source code and skips the line directives when the file name doesn't change. Otherwise, this method produces the exact preprocessed source that Unity passes to the compiler.
Returns
Type | Description |
|---|---|
| PreprocessedVariant | The preprocessed variant result. 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 preprocessed code. |
PreprocessVariant(ShaderType, string[], ShaderCompilerPlatform, BuildTarget, BuiltinShaderDefine[], bool)
Preprocesses a shader variant for this shader pass and returns the preprocessed code.
public ShaderData.PreprocessedVariant PreprocessVariant(ShaderType shaderType, string[] keywords, ShaderCompilerPlatform shaderCompilerPlatform, BuildTarget buildTarget, BuiltinShaderDefine[] platformKeywords, bool stripLineDirectives)
Parameters
The shader type within this pass to preprocess. (e.g. Vertex, Fragment, etc.) Some platforms (OpenGLCore, GLES3x, Switch and Vulkan) include all stages within the Vertex shader type.
The keywords to use during the preprocessing.
The shader compiler platform to preprocess for.
The build target to preprocess for.
An optional set of platform keywords. If you do not provide any, Unity uses the default keywords for the given platform, target, and tier.
Whether to skip line number directives in the preprocessed output. When enabled, Unity produces more human-readable preprocessed source code and skips the line directives when the file name doesn't change. Otherwise, this method produces the exact preprocessed source that Unity passes to the compiler.
Returns
Type | Description |
|---|---|
| PreprocessedVariant | The preprocessed variant result. 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 preprocessed code. |
PreprocessVariant(ShaderType, string[], ShaderCompilerPlatform, BuildTarget, BuiltinShaderDefine[], GraphicsTier, bool)
Preprocesses a shader variant for this shader pass and returns the preprocessed code.
public ShaderData.PreprocessedVariant PreprocessVariant(ShaderType shaderType, string[] keywords, ShaderCompilerPlatform shaderCompilerPlatform, BuildTarget buildTarget, BuiltinShaderDefine[] platformKeywords, GraphicsTier tier, bool stripLineDirectives)
Parameters
The shader type within this pass to preprocess. (e.g. Vertex, Fragment, etc.) Some platforms (OpenGLCore, GLES3x, Switch and Vulkan) include all stages within the Vertex shader type.
The keywords to use during the preprocessing.
The shader compiler platform to preprocess for.
The build target to preprocess for.
An optional set of platform keywords. If you do not provide any, Unity uses the default keywords for the given platform, target, and tier.
An optional graphics tier.
Whether to skip line number directives in the preprocessed output. When enabled, Unity produces more human-readable preprocessed source code and skips the line directives when the file name doesn't change. Otherwise, this method produces the exact preprocessed source that Unity passes to the compiler.
Returns
Type | Description |
|---|---|
| PreprocessedVariant | The preprocessed variant result. 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 preprocessed code. |