共用方式為


Effect.CompileEffectFromFile Method (Stream, Int32, CompilerMacro , CompilerIncludeHandler, CompilerOptions, TargetPlatform)

Note

This method is available only when developing for Windows.

Compiles an effect from a stream containing the effect source code, specifying the number of bytes in the stream.

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

Syntax

public static CompiledEffect CompileEffectFromFile (
         Stream effectFileStream,
         int numberBytes,
         CompilerMacro[] preprocessorDefines,
         CompilerIncludeHandler includeHandler,
         CompilerOptions options,
         TargetPlatform platform
)

Parameters

  • effectFileStream
    File stream containing the effect source code.
  • numberBytes
    The number of bytes in effectFileStream.
  • 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.
  • platform
    The target platform for the compilation.

Return Value

The compiled effect.

Exceptions

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

See Also

Reference

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

Platforms

Windows XP SP2, Windows Vista