瀏覽代碼

Corrected ShaderCompiler documentation.
ShaderCompiler output dir is no longer mandatory, if not specified, will use input dir.

Lasse Öörni 12 年之前
父節點
當前提交
f4a3014d75
共有 2 個文件被更改,包括 12 次插入7 次删除
  1. 4 3
      Docs/Reference.dox
  2. 8 4
      Tools/ShaderCompiler/ShaderCompiler.cpp

+ 4 - 3
Docs/Reference.dox

@@ -1548,7 +1548,7 @@ The output consists of shader bytecode for each permutation, as well as informat
 Usage:
 
 \verbatim
-ShaderCompiler <definitionfile> [options]
+ShaderCompiler <definitionfile> <outputpath> [options]
 
 Options:
 -tVS|PS Compile only vertex or pixel shaders, by default compile both
@@ -1556,8 +1556,9 @@ Options:
 -dX     Add a define. Add SM3 to compile for Shader Model 3
 -dDefine Add an arbitrary define
 
-Shader binaries will be output into the same directory as the definition file.
-Specify a wildcard to compile multiple shaders from the directory.
+If output path is not specified, shader binaries will be output into the same
+directory as the definition file. Specify a wildcard to compile multiple
+shaders.
 \endverbatim
 
 The D3DX library from the DirectX runtime or SDK needs to be installed. Note that when running in Direct3D9 mode, the engine will automatically invoke ShaderCompiler if it can not find a shader in binary form. Depending on shader complexity this can take a substantial amount of time. To avoid this, execute the file CompileAllShaders.bat in the Bin directory to precompile all shader permutations. It is also highly recommended to not ship ShaderCompiler with Urho3D applications, but to instead precompile all shaders. After precompiling you can delete all .hlsl files from the CoreData directory of the shipping build.

+ 8 - 4
Tools/ShaderCompiler/ShaderCompiler.cpp

@@ -193,20 +193,24 @@ void Run(const Vector<String>& arguments)
     if (arguments.Size() < 1)
     {
         ErrorExit(
-            "Usage: ShaderCompiler <definitionfile> <outputpath> [options]\n\n"
+            "Usage: ShaderCompiler <definitionfile> [outputpath] [options]\n\n"
             "Options:\n"
             "-tVS|PS Compile only vertex or pixel shaders, by default compile both\n"
             "-vX     Compile only the shader variation X\n"
             "-dX     Add a define. Add SM3 to compile for Shader Model 3\n\n"
-            "Shader binaries will be output into the same directory as the definition file.\n"
-            "Specify a wildcard to compile multiple shaders from the directory.\n"
+            "If output path is not specified, shader binaries will be output into the same\n"
+            "directory as the definition file. Specify a wildcard to compile multiple\n"
+            "shaders."
         );
     }
     
     String path, file, extension;
     SplitPath(arguments[0], path, file, extension);
     inDir_ = AddTrailingSlash(path);
-    outDir_ = AddTrailingSlash(arguments[1]);
+    if (arguments.Size() > 1 && arguments[1][0] != '-')
+        outDir_ = AddTrailingSlash(arguments[1]);
+    else
+        outDir_ = inDir_;
     
     for (unsigned i = 1; i < arguments.Size(); ++i)
     {