1 Star 0 Fork 2

dannyjones/SharpBgfx

forked from ktxiaok/SharpBgfx 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
SharpBgfx.targets 4.90 KB
一键复制 编辑 原始数据 按行查看 历史
Zachary Snow 提交于 2017-11-05 17:16 . Compiling Shaders via MSBuild (#17)
<Project>
<PropertyGroup>
<!-- Instucts Visual Studio to always start MSBuild when building. -->
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
<ShaderCPath Condition=" $(ShaderCPath) == '' ">$(MSBuildThisFileDirectory)tools\shaderc.exe</ShaderCPath>
<ShaderIncludeDir Condition=" $(ShaderIncludeDir) == '' ">$(MSBuildThisFileDirectory)include</ShaderIncludeDir>
<VertexShaderIncludePattern Condition=" $(VertexShaderIncludePattern) == '' ">vs_*.sc</VertexShaderIncludePattern>
<FragmentShaderIncludePattern Condition=" $(FragmentShaderIncludePattern) == '' ">fs_*.sc</FragmentShaderIncludePattern>
<ComputeShaderIncludePattern Condition=" $(ComputeShaderIncludePattern) == '' ">cs_*.sc</ComputeShaderIncludePattern>
<ShaderOutputDir Condition=" $(ShaderOutputDir) == '' ">bin\</ShaderOutputDir>
</PropertyGroup>
<ItemGroup>
<VertexShaders Include="$(VertexShaderIncludePattern)" />
<FragmentShaders Include="$(FragmentShaderIncludePattern)" />
<ComputeShaders Include="$(ComputeShaderIncludePattern)" />
</ItemGroup>
<!-- Build process hooks. -->
<PropertyGroup>
<CleanDependsOn>CleanShaders;$(CoreCompileDependsOn)</CleanDependsOn>
<CoreCompileDependsOn>$(CoreCompileDependsOn);CompileShaders</CoreCompileDependsOn>
</PropertyGroup>
<Target Name="CleanShaders" BeforeTargets="CoreClean">
<RemoveDir Condition=" Exists('$(IntermediateOutputPath)$(ShaderOutputDir)') "
Directories="$(IntermediateOutputPath)$(ShaderOutputDir)" />
<RemoveDir Condition=" Exists('$(TargetDir)$(ShaderOutputDir)') "
Directories="$(TargetDir)$(ShaderOutputDir)" />
</Target>
<Target Name="CompileShaders"
BeforeTargets="AfterBuild"
AfterTargets="CopyFilesToOutputDirectory"
DependsOnTargets="EnsureShaderIntermediateOutputDirectory;CompileVertexShaders;CompileFragmentShaders;CompileComputeShaders;CopyShaderBinariesToOutputDirectory" />
<Target Name="EnsureShaderIntermediateOutputDirectory">
<MakeDir Directories="$(IntermediateOutputPath)$(ShaderOutputDir)dx11\" />
<MakeDir Directories="$(IntermediateOutputPath)$(ShaderOutputDir)glsl\" />
</Target>
<Target Name="CompileVertexShaders" Inputs="@(VertexShaders)" Outputs="$(IntermediateOutputPath)$(ShaderOutputDir)dx11\%(VertexShaders.Filename).bin;$(IntermediateOutputPath)$(ShaderOutputDir)glsl\%(VertexShaders.Filename).bin">
<Exec Command="$(ShaderCPath) --platform windows --type vertex -p vs_4_0 -O 3 -f &quot;@(VertexShaders)&quot; -o &quot;$(IntermediateOutputPath)$(ShaderOutputDir)dx11\%(VertexShaders.Filename).bin&quot; -i &quot;$(ShaderIncludeDir)&quot;" />
<Exec Command="$(ShaderCPath) --platform linux --type vertex -p 120 -f &quot;@(VertexShaders)&quot; -o &quot;$(IntermediateOutputPath)$(ShaderOutputDir)glsl\%(VertexShaders.Filename).bin&quot; -i &quot;$(ShaderIncludeDir)&quot;" />
</Target>
<Target Name="CompileFragmentShaders" Inputs="@(FragmentShaders)" Outputs="$(IntermediateOutputPath)$(ShaderOutputDir)dx11\%(FragmentShaders.Filename).bin;$(IntermediateOutputPath)$(ShaderOutputDir)glsl\%(FragmentShaders.Filename).bin">
<Exec Command="$(ShaderCPath) --platform windows --type fragment -p ps_4_0 -O 3 -f &quot;@(FragmentShaders)&quot; -o &quot;$(IntermediateOutputPath)$(ShaderOutputDir)dx11\%(FragmentShaders.Filename).bin&quot; -i &quot;$(ShaderIncludeDir)&quot;" />
<Exec Command="$(ShaderCPath) --platform linux --type fragment -p 120 -f &quot;@(FragmentShaders)&quot; -o &quot;$(IntermediateOutputPath)$(ShaderOutputDir)glsl\%(FragmentShaders.Filename).bin&quot; -i &quot;$(ShaderIncludeDir)&quot;" />
</Target>
<Target Name="CompileComputeShaders" Inputs="@(ComputeShaders)" Outputs="$(IntermediateOutputPath)$(ShaderOutputDir)dx11\%(ComputeShaders.Filename).bin;$(IntermediateOutputPath)$(ShaderOutputDir)glsl\%(ComputeShaders.Filename).bin">
<Exec Command="$(ShaderCPath) --platform windows --type compute -p cs_5_0 -O 3 -f &quot;@(ComputeShaders)&quot; -o &quot;$(IntermediateOutputPath)$(ShaderOutputDir)dx11\%(ComputeShaders.Filename).bin&quot; -i &quot;$(ShaderIncludeDir)&quot;" />
<Exec Command="$(ShaderCPath) --platform linux --type compute -p 430 -f &quot;@(ComputeShaders)&quot; -o &quot;$(IntermediateOutputPath)$(ShaderOutputDir)glsl\%(ComputeShaders.Filename).bin&quot; -i &quot;$(ShaderIncludeDir)&quot;" />
</Target>
<Target Name="CopyShaderBinariesToOutputDirectory">
<ItemGroup>
<ShaderBinaries Include="$(IntermediateOutputPath)$(ShaderOutputDir)**\*.bin" />
</ItemGroup>
<Copy SourceFiles="@(ShaderBinaries)"
DestinationFolder="$(TargetDir)$(ShaderOutputDir)%(RecursiveDir)"
SkipUnchangedFiles="true" />
</Target>
</Project>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/DannyJones/SharpBgfx.git
git@gitee.com:DannyJones/SharpBgfx.git
DannyJones
SharpBgfx
SharpBgfx
master

搜索帮助