Class D3DCompile
Contains methods for compiling HLSL shaders.
Inherited Members
Namespace: JeremyAnsel.DirectX.D3DCompiler
Assembly: JeremyAnsel.DirectX.D3DCompiler.dll
Syntax
[SecurityCritical]
public static class D3DCompile
Methods
| Edit this page View SourceCompile(ReadOnlySpan<char>, string?, D3DShaderMacro[]?, string?, string?, D3DCompileOptions)
Compile HLSL code or an effect file into bytecode for a given target.
Declaration
public static D3DCompileResult Compile(ReadOnlySpan<char> sourceData, string? sourceName, D3DShaderMacro[]? defines, string? entrypoint, string? target, D3DCompileOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<char> | sourceData | Uncompiled shader data. |
| string | sourceName | You can use this parameter for strings that specify error messages. If not used, set to |
| D3DShaderMacro[] | defines | An array of macro definitions. |
| string | entrypoint | The name of the shader entry point function where shader execution begins. |
| string | target | A string that specifies the shader target or set of shader features to compile against. |
| D3DCompileOptions | options | Constants that specify how the compiler compiles the HLSL code. |
Returns
| Type | Description |
|---|---|
| D3DCompileResult |
Compile(ReadOnlySpan<char>, string?, ReadOnlySpan<D3DShaderMacro>, string?, string?, D3DCompileOptions)
Compile HLSL code or an effect file into bytecode for a given target.
Declaration
public static D3DCompileResult Compile(ReadOnlySpan<char> sourceData, string? sourceName, ReadOnlySpan<D3DShaderMacro> defines, string? entrypoint, string? target, D3DCompileOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<char> | sourceData | Uncompiled shader data. |
| string | sourceName | You can use this parameter for strings that specify error messages. If not used, set to |
| ReadOnlySpan<D3DShaderMacro> | defines | An array of macro definitions. |
| string | entrypoint | The name of the shader entry point function where shader execution begins. |
| string | target | A string that specifies the shader target or set of shader features to compile against. |
| D3DCompileOptions | options | Constants that specify how the compiler compiles the HLSL code. |
Returns
| Type | Description |
|---|---|
| D3DCompileResult |
Compile(ReadOnlySpan<char>, string?, string?, string?, D3DCompileOptions)
Compile HLSL code or an effect file into bytecode for a given target.
Declaration
public static D3DCompileResult Compile(ReadOnlySpan<char> sourceData, string? sourceName, string? entrypoint, string? target, D3DCompileOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<char> | sourceData | Uncompiled shader data. |
| string | sourceName | You can use this parameter for strings that specify error messages. If not used, set to |
| string | entrypoint | The name of the shader entry point function where shader execution begins. |
| string | target | A string that specifies the shader target or set of shader features to compile against. |
| D3DCompileOptions | options | Constants that specify how the compiler compiles the HLSL code. |
Returns
| Type | Description |
|---|---|
| D3DCompileResult |
Compile(string?, string?, D3DShaderMacro[]?, string?, string?, D3DCompileOptions)
Compile HLSL code or an effect file into bytecode for a given target.
Declaration
public static D3DCompileResult Compile(string? sourceData, string? sourceName, D3DShaderMacro[]? defines, string? entrypoint, string? target, D3DCompileOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceData | Uncompiled shader data. |
| string | sourceName | You can use this parameter for strings that specify error messages. If not used, set to |
| D3DShaderMacro[] | defines | An array of macro definitions. |
| string | entrypoint | The name of the shader entry point function where shader execution begins. |
| string | target | A string that specifies the shader target or set of shader features to compile against. |
| D3DCompileOptions | options | Constants that specify how the compiler compiles the HLSL code. |
Returns
| Type | Description |
|---|---|
| D3DCompileResult |
Compile(string?, string?, ReadOnlySpan<D3DShaderMacro>, string?, string?, D3DCompileOptions)
Compile HLSL code or an effect file into bytecode for a given target.
Declaration
public static D3DCompileResult Compile(string? sourceData, string? sourceName, ReadOnlySpan<D3DShaderMacro> defines, string? entrypoint, string? target, D3DCompileOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceData | Uncompiled shader data. |
| string | sourceName | You can use this parameter for strings that specify error messages. If not used, set to |
| ReadOnlySpan<D3DShaderMacro> | defines | An array of macro definitions. |
| string | entrypoint | The name of the shader entry point function where shader execution begins. |
| string | target | A string that specifies the shader target or set of shader features to compile against. |
| D3DCompileOptions | options | Constants that specify how the compiler compiles the HLSL code. |
Returns
| Type | Description |
|---|---|
| D3DCompileResult |
Compile(string?, string?, string?, string?, D3DCompileOptions)
Compile HLSL code or an effect file into bytecode for a given target.
Declaration
public static D3DCompileResult Compile(string? sourceData, string? sourceName, string? entrypoint, string? target, D3DCompileOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceData | Uncompiled shader data. |
| string | sourceName | You can use this parameter for strings that specify error messages. If not used, set to |
| string | entrypoint | The name of the shader entry point function where shader execution begins. |
| string | target | A string that specifies the shader target or set of shader features to compile against. |
| D3DCompileOptions | options | Constants that specify how the compiler compiles the HLSL code. |
Returns
| Type | Description |
|---|---|
| D3DCompileResult |
CompileFromFile(string?, D3DShaderMacro[]?, string?, string?, D3DCompileOptions)
Compile HLSL code or an effect file into bytecode for a given target.
Declaration
public static D3DCompileResult CompileFromFile(string? sourceFileName, D3DShaderMacro[]? defines, string? entrypoint, string? target, D3DCompileOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceFileName | The name of the file that contains the shader code. |
| D3DShaderMacro[] | defines | An array of macro definitions. |
| string | entrypoint | The name of the shader entry point function where shader execution begins. |
| string | target | A string that specifies the shader target or set of shader features to compile against. |
| D3DCompileOptions | options | Constants that specify how the compiler compiles the HLSL code. |
Returns
| Type | Description |
|---|---|
| D3DCompileResult |
CompileFromFile(string?, ReadOnlySpan<D3DShaderMacro>, string?, string?, D3DCompileOptions)
Compile HLSL code or an effect file into bytecode for a given target.
Declaration
public static D3DCompileResult CompileFromFile(string? sourceFileName, ReadOnlySpan<D3DShaderMacro> defines, string? entrypoint, string? target, D3DCompileOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceFileName | The name of the file that contains the shader code. |
| ReadOnlySpan<D3DShaderMacro> | defines | An array of macro definitions. |
| string | entrypoint | The name of the shader entry point function where shader execution begins. |
| string | target | A string that specifies the shader target or set of shader features to compile against. |
| D3DCompileOptions | options | Constants that specify how the compiler compiles the HLSL code. |
Returns
| Type | Description |
|---|---|
| D3DCompileResult |
CompileFromFile(string?, string?, string?, D3DCompileOptions)
Compile HLSL code or an effect file into bytecode for a given target.
Declaration
public static D3DCompileResult CompileFromFile(string? sourceFileName, string? entrypoint, string? target, D3DCompileOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sourceFileName | The name of the file that contains the shader code. |
| string | entrypoint | The name of the shader entry point function where shader execution begins. |
| string | target | A string that specifies the shader target or set of shader features to compile against. |
| D3DCompileOptions | options | Constants that specify how the compiler compiles the HLSL code. |
Returns
| Type | Description |
|---|---|
| D3DCompileResult |
Disassemble(byte[]?)
Disassembles compiled HLSL code.
Declaration
public static string Disassemble(byte[]? sourceData)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | sourceData | The source data as compiled HLSL code. |
Returns
| Type | Description |
|---|---|
| string | The assembly text. |
Disassemble(byte[]?, D3DDisassembleOptions)
Disassembles compiled HLSL code.
Declaration
public static string Disassemble(byte[]? sourceData, D3DDisassembleOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | sourceData | The source data as compiled HLSL code. |
| D3DDisassembleOptions | options | Flags affecting the behavior of |
Returns
| Type | Description |
|---|---|
| string | The assembly text. |
Disassemble(byte[]?, D3DDisassembleOptions, string?)
Disassembles compiled HLSL code.
Declaration
public static string Disassemble(byte[]? sourceData, D3DDisassembleOptions options, string? comments)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | sourceData | The source data as compiled HLSL code. |
| D3DDisassembleOptions | options | Flags affecting the behavior of |
| string | comments | The comment string at the top of the shader that identifies the shader constants and variables. |
Returns
| Type | Description |
|---|---|
| string | The assembly text. |
Disassemble(ReadOnlySpan<byte>)
Disassembles compiled HLSL code.
Declaration
public static string Disassemble(ReadOnlySpan<byte> sourceData)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<byte> | sourceData | The source data as compiled HLSL code. |
Returns
| Type | Description |
|---|---|
| string | The assembly text. |
Disassemble(ReadOnlySpan<byte>, D3DDisassembleOptions)
Disassembles compiled HLSL code.
Declaration
public static string Disassemble(ReadOnlySpan<byte> sourceData, D3DDisassembleOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<byte> | sourceData | The source data as compiled HLSL code. |
| D3DDisassembleOptions | options | Flags affecting the behavior of |
Returns
| Type | Description |
|---|---|
| string | The assembly text. |
Disassemble(ReadOnlySpan<byte>, D3DDisassembleOptions, string?)
Disassembles compiled HLSL code.
Declaration
public static string Disassemble(ReadOnlySpan<byte> sourceData, D3DDisassembleOptions options, string? comments)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<byte> | sourceData | The source data as compiled HLSL code. |
| D3DDisassembleOptions | options | Flags affecting the behavior of |
| string | comments | The comment string at the top of the shader that identifies the shader constants and variables. |
Returns
| Type | Description |
|---|---|
| string | The assembly text. |