]> O.S.I.I.S - jp/vke.net.git/commitdiff
test appveyor config appveyor
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 21 Jan 2020 04:53:54 +0000 (05:53 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 21 Jan 2020 05:06:59 +0000 (06:06 +0100)
SpirVTasks/CompileGLSLTask.cs
SpirVTasks/README.md
SpirVTasks/SpirVTasks.targets
appveyor.yml [new file with mode: 0644]

index e6774a65df4ac64d94de71fc93badc425ea92187..5c65dd5eecbcaf2486264f13cc754b92fc02ab09 100644 (file)
@@ -144,7 +144,7 @@ namespace SpirVTasks {
 
                        string glslcExec = "glslc";
                        if (Environment.OSVersion.Platform.ToString ().StartsWith ("Win", StringComparison.Ordinal))
-                               glslcExec = glslcExec + "exe";
+                               glslcExec = glslcExec + ".exe";
 
                        glslcPath = Path.Combine (Environment.GetEnvironmentVariable ("VULKAN_SDK"), "bin");
                        glslcPath = Path.Combine (glslcPath, glslcExec);
index 7e720845d2e3a85c3b845655b6d8218319d8176d..b5e805df421d0b63a76f613d56b481cb16e26d89 100644 (file)
 </p>
 </h1>
 
-**SpirVTasks** package add **SpirV** compilation support to msbuild project. Error and warning are routed to the `IDE`.
+**SpirVTasks** package add **SpirV** compilation support to **msbuild** projects through [Shaderrc](https://github.com/google/shaderc) which is part of the [lunarg vulkan sdk](https://www.lunarg.com/vulkan-sdk/).  Errors and warnings are routed to the `IDE`.
 
 ## Usage
+
+To enable SpirV compilation, you need to add the [nuget package](https://www.nuget.org/packages/SpirVTasks) to each project and tell with the new **<GLSLShader>** item where your shader sources reside.
+
 ```xml
 <ItemGroup>
-  <PackageReference Include="SpirVTasks" Version="0.1.15-beta" />              
+  <PackageReference Include="SpirVTasks"/>             
 </ItemGroup>
 <ItemGroup>    
   <GLSLShader Include="shaders\*.frag;shaders\*.vert;shaders\*.comp;shaders\*.geom" />
 </ItemGroup> 
 ```
-Resulting `.spv` files are embedded with resource ID = `ProjectName.file.ext.spv`. You can override the default resource id by adding a custom **LogicalName**.
+Resulting `.spv` files are automatically embedded with the resource ID: `ProjectName.file.ext.spv`. You can override this default id by adding a custom **LogicalName**.
 ```xml
-<ItemGroup>    
-  <GLSLShader Include="shaders\skybox.vert">
-         <LogicalName>NewName.vert.spv</LogicalName>
+<ItemGroup>
+  <GLSLShader Include="shaders\*.vert">
+         <LogicalName>shaders.%(Filename)%(Extension).spv</LogicalName>
   </GLSLShader>
 </ItemGroup> 
 ```
 
-`VULKAN_SDK/bin` then `PATH` are searched for the `glslc` executable. You can also use the `SpirVglslcPath` property.
+`VULKAN_SDK/bin` then `PATH` are searched for the **`glslc`** executable. You can also use the `SpirVglslcPath` property.
+
 ```xml
 <PropertyGroup>
   <SpirVglslcPath>bin\glslc.exe</SpirVglslcPath>
@@ -39,6 +43,9 @@ Resulting `.spv` files are embedded with resource ID = `ProjectName.file.ext.spv
 ```
 
 ## Include in glsl
+
+SpirVTasks add the ability to use **include** statements in your shader sources. Files are combined before compilation. Includes are not referenced in the project file with `GLSLShader` elements.
+
 ```glsl
 #include <preamble.inc>
 
@@ -57,10 +64,21 @@ Included files are searched from the location of the current parsed file, then i
 </PropertyGroup>
 ```
 
+It is also valid to add additional include search paths individually for each `GLSLShader`.
+
+```xml
+<ItemGroup>
+  <GLSLShader Include="shaders\*.vert">
+         <AdditionalIncludeDirectories>../include</AdditionalIncludeDirectories>
+  </GLSLShader>
+</ItemGroup> 
+
+```
+
 ## Additional attributes
 
 **Optimisation** attribute will set compiler flag for resulting code optimizations.
-```
+```xml
 <GLSLShader Include="shaders\skybox.vert" Optimization="size"/>
 ```
 Default optimization if this attribute is not present is **PERF**, accepted values are:
@@ -68,9 +86,9 @@ Default optimization if this attribute is not present is **PERF**, accepted valu
 - PERF: spirv will be optimized for performances.
 - SIZE: resulting code size will be minimized.
 
-**DefineConstants** attribute may contains a semicolon separated list of implicit **MACRO** to define for compilation.
+**DefineConstants** attribute may contains a semicolon separated list of implicit **MACRO** to define for compilation. Note that **project constants** are automatically to the compilation unit.
 
-```
+```xml
 <GLSLShader Include="shaders\skybox.vert" DefineConstants="DEBUG;SHADOW_FACTOR=0.15"/>
 ```
 
index c1176e65a416e7ae90555734e1695e7131af9d96..491d4a9bd23d9be4ba58c8062f5f01ee814e6612 100644 (file)
@@ -7,7 +7,7 @@
     </AvailableItemName>
   </ItemGroup>
   <Target Name="CompileShaders" BeforeTargets="BeforeBuild" Condition="'@(GLSLShader)'!=''" Outputs="@(CompiledShaders)">                              
-       <CompileGLSLTask SourceFile="%(GLSLShader.Identity)"
+               <CompileGLSLTask SourceFile="%(GLSLShader.Identity)"
                                         AdditionalIncludeDirectories="%(GLSLShader.AdditionalIncludeDirectories);$(SpirVAdditionalIncludeDirectories)"
                                         DefineConstants="%(GLSLShader.DefineConstants);$(DefineConstants)"                                      
                                         TempDirectory="$(IntermediateOutputPath)"
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644 (file)
index 0000000..f2eafad
--- /dev/null
@@ -0,0 +1,18 @@
+version: 1.0.{build}
+image: Visual Studio 2019
+
+environment:
+  VULKAN_SDK: C:/VulkanSDK/1.1.130.0
+
+cache:
+  - VulkanSDK.exe
+
+install:
+  - if not exist VulkanSDK.exe curl -L --silent --show-error --output VulkanSDK.exe https://vulkan.lunarg.com/sdk/download/1.1.130.0/windows/VulkanSDK-1.1.130.0-Installer.exe?Human=true
+  - VulkanSDK.exe /S
+
+before_build:
+  - nuget restore
+
+build:
+  verbosity: minimal