次の方法で共有


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

Note

This method is available only when developing for Windows.

Compiles a shader from file containing the shader source code.

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

Syntax

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

Parameters

  • shaderFileName
    Name of the file containing 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
ArgumentException shaderFileName is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
ArgumentNullException shaderFileName is null.
PathTooLongException The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
DirectoryNotFoundException The specified path is invalid (for example, it is on an unmapped drive).
UnauthorizedAccessException The shaderFileName parameter specifies a directory, or the caller does not have the required permission to access the file specified by filename.
FileNotFoundException The file specified in shaderFileName was not found.
NotSupportedException shaderFileName is in an invalid format.

See Also

Reference

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

Platforms

Windows XP SP2, Windows Vista