Sdílet prostřednictvím


ShaderCompiler.CompileFromFile Method (Stream, CompilerMacro , CompilerIncludeHandler, CompilerOptions, String, ShaderProfile, TargetPlatform)

Note

This method is available only when developing for Windows.

Compiles a shader from a stream containing the shader source code.

Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

Syntax

public static CompiledShader CompileFromFile (
         Stream shaderSourceCode,
         CompilerMacro[] preprocessorDefines,
         CompilerIncludeHandler includeHandler,
         CompilerOptions options,
         string functionName,
         ShaderProfile profile,
         TargetPlatform platform
)

Parameters

  • shaderSourceCode
    Stream that contains the shader source code.
  • preprocessorDefines
    Describes preprocessor definitions used by an effect object.
  • includeHandler
    User-implemented interface to provide callbacks for #include directives during shader compilation.
  • options
    Compilation optimization options.
  • functionName
    The function to be compiled.
  • profile
    A shader profile that determines the shader instruction set.
  • platform
    The target platform for compilation.

Return Value

The compiled shader.

Exceptions

Exception type Condition
ArgumentNullException shaderSourceCode is null. The stream passed into this method cannot be null.
NotSupportedException shaderSourceCode is not readable. Streams passed into this method must be readable.
EndOfStreamException shaderSourceCode does not contain enough data to support this call.

See Also

Reference

ShaderCompiler Class
ShaderCompiler Members
Microsoft.Xna.Framework.Graphics Namespace

Platforms

Windows XP SP2, Windows Vista