ShaderLoader.FromFile(String,Macro[],Include,ShaderFlags,String) Method (Microsoft.DirectX.Direct3D)

Assembles a shader from a file.

Definition

Visual Basic Public Shared Function FromFile( _
    ByVal sourceFile As String, _
    ByVal preprocessorDefines() As Macro, _
    ByVal includeFile As Include, _
    ByVal flags As ShaderFlags, _
    ByRef compilationErrors As String _
) As GraphicsStream
C# public static GraphicsStream FromFile(
    string sourceFile,
    Macro[] preprocessorDefines,
    Include includeFile,
    ShaderFlags flags,
    out string compilationErrors
);
C++ public:
static GraphicsStreamFromFile(
    StringLeave SitesourceFile,
    array<Macro>^ preprocessorDefines,
    IncludeincludeFile,
    ShaderFlags flags,
    [Out] StringLeave Site^% compilationErrors
);
JScript public static function FromFile(
    sourceFile : String,
    preprocessorDefines : Macro[],
    includeFile : Include,
    flags : ShaderFlags,
    compilationErrors : String
) : GraphicsStream;

Parameters

sourceFile System.String
String that specifies the file name containing the shader code to assemble.
preprocessorDefines Microsoft.DirectX.Direct3D.Macro[]
Reference to a Macro object that describes the preprocessor definitions to use.
includeFile Microsoft.DirectX.Direct3D.Include
Reference to an Include object that provides access to include-file directives.
flags Microsoft.DirectX.Direct3D.ShaderFlags
Value of the ShaderFlags enumeration that represents the shader compiler options to use.
compilationErrors System.String
String containing a listing of errors and warnings that were encountered during compilation. These are the same messages the debugger displays in debug mode.

Return Value

Microsoft.DirectX.GraphicsStream
A GraphicsStream object that contains the assembled shader code, as well as any embedded debug and symbol table information.

Remarks

Exceptions

InvalidCallException

The method call is invalid. For example, a method's parameter might contain an invalid value.

InvalidDataException

The data is invalid.

OutOfMemoryExceptionLeave Site

Microsoft Direct3D could not allocate sufficient memory to complete the call.