mirror of
https://github.com/AlexMacocian/WpfExtended.git
synced 2026-07-15 14:59:30 +00:00
Shader compiler fixes
This commit is contained in:
@@ -2,16 +2,29 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ShaderDir>$(ProjectDir)</ShaderDir>
|
||||
<Fxc>$(SolutionDir)\tools\fxc.exe</Fxc>
|
||||
<!-- Use MSBuildProjectDirectory to get a more reliable path to the solution root -->
|
||||
<SolutionRootDir Condition="'$(SolutionDir)' == '' OR '$(SolutionDir)' == '*Undefined*'">$(MSBuildProjectDirectory)\..</SolutionRootDir>
|
||||
<SolutionRootDir Condition="'$(SolutionDir)' != '' AND '$(SolutionDir)' != '*Undefined*'">$(SolutionDir)</SolutionRootDir>
|
||||
<Fxc>$(SolutionRootDir)\tools\fxc.exe</Fxc>
|
||||
<FxcArgs>/O3 /T ps_3_0 /nologo /Fo</FxcArgs>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||
<Message Importance="High" Text="Compiling shader effect files..." />
|
||||
<ItemGroup>
|
||||
<!-- Check if fxc.exe exists before attempting compilation -->
|
||||
<PropertyGroup>
|
||||
<FxcExists Condition="Exists('$(Fxc)')">true</FxcExists>
|
||||
</PropertyGroup>
|
||||
|
||||
<Message Importance="High" Text="Looking for fxc.exe at: $(Fxc)" />
|
||||
<Message Condition="'$(FxcExists)' == 'true'" Importance="High" Text="Compiling shader effect files..." />
|
||||
<Message Condition="'$(FxcExists)' != 'true'" Importance="High" Text="fxc.exe not found at $(Fxc), using pre-compiled shaders..." />
|
||||
|
||||
<ItemGroup Condition="'$(FxcExists)' == 'true'">
|
||||
<_ShaderFiles Include="$(ShaderDir)**\*.fx" />
|
||||
</ItemGroup>
|
||||
<Exec Command=""$(Fxc)" $(FxcArgs) "$([System.IO.Path]::ChangeExtension('%(_ShaderFiles.Identity)', '.ps'))" "%(_ShaderFiles.Identity)"" />
|
||||
|
||||
<Exec Condition="'$(FxcExists)' == 'true'" Command=""$(Fxc)" $(FxcArgs) "$([System.IO.Path]::ChangeExtension('%(_ShaderFiles.Identity)', '.ps'))" "%(_ShaderFiles.Identity)"" />
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="$(ShaderDir)**\*.ps" />
|
||||
</ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user