次の方法で共有


ShaderCompiler.CompileFromFile Method (Stream, Int32, 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, 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 CompiledShader CompileFromFile (
         Stream shaderSourceCode,
         int numberBytes,
         CompilerMacro[] preprocessorDefines,
         CompilerIncludeHandler includeHandler,
         CompilerOptions options,
         string functionName,
         ShaderProfile profile,
         TargetPlatform platform
)

Parameters

  • shaderSourceCode
    Stream that contains the shader source code.
  • numberBytes
    The number of bytes in shaderSourceCode.
  • 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