Skip to content

Commit 722309f

Browse files
committed
[Toolkit.Graphics] Add new TextureCompilerTask, currently a passthrough. Refactor internals of content serialization to check for a version number. Add IContentResolver.Exists() method.
1 parent c7cfe37 commit 722309f

37 files changed

+2666
-2455
lines changed

Samples/Toolkit/Common/SpriteBatchAndFont/SpriteBatchAndFontGame.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public SpriteBatchAndFontGame()
6868
protected override void LoadContent()
6969
{
7070
// Loads the balls texture (32 textures (32x32) stored vertically => 32 x 1024 ).
71-
ballsTexture = Content.Load<Texture2D>("balls.dds");
71+
ballsTexture = Content.Load<Texture2D>("balls");
7272

7373
// SpriteFont supports the following font file format:
7474
// - DirectX Toolkit MakeSpriteFont or SharpDX Toolkit tkfont

Samples/Toolkit/Desktop/ModelRendering/ModelRendering.Desktop.csproj

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@
5858
<ToolkitModel Include="..\..\Common\ModelRendering\Content\duck.dae">
5959
<Link>Content\duck.dae</Link>
6060
</ToolkitModel>
61-
<Content Include="..\..\Common\ModelRendering\Content\duckCM.dds">
61+
<ToolkitTexture Include="..\..\Common\ModelRendering\Content\duckCM.dds">
6262
<Link>Content\duckCM.dds</Link>
63-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
64-
</Content>
63+
</ToolkitTexture>
6564
</ItemGroup>
6665
<ItemGroup>
6766
<ToolkitModel Include="..\..\Common\ModelRendering\Content\Car.x">
@@ -87,22 +86,18 @@
8786
<ToolkitModel Include="..\..\Common\ModelRendering\Content\dude.fbx">
8887
<Link>Content\dude.fbx</Link>
8988
</ToolkitModel>
90-
<Content Include="..\..\Common\ModelRendering\Content\head.dds">
89+
<ToolkitTexture Include="..\..\Common\ModelRendering\Content\head.dds">
9190
<Link>Content\head.dds</Link>
92-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
93-
</Content>
94-
<Content Include="..\..\Common\ModelRendering\Content\jacket.dds">
91+
</ToolkitTexture>
92+
<ToolkitTexture Include="..\..\Common\ModelRendering\Content\jacket.dds">
9593
<Link>Content\jacket.dds</Link>
96-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
97-
</Content>
98-
<Content Include="..\..\Common\ModelRendering\Content\pants.dds">
94+
</ToolkitTexture>
95+
<ToolkitTexture Include="..\..\Common\ModelRendering\Content\pants.dds">
9996
<Link>Content\pants.dds</Link>
100-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
101-
</Content>
102-
<Content Include="..\..\Common\ModelRendering\Content\upBodyC.dds">
97+
</ToolkitTexture>
98+
<ToolkitTexture Include="..\..\Common\ModelRendering\Content\upBodyC.dds">
10399
<Link>Content\upBodyC.dds</Link>
104-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
105-
</Content>
100+
</ToolkitTexture>
106101
</ItemGroup>
107102
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
108103
<Import Project="..\..\..\..\SharpDX.targets" />

Samples/Toolkit/Desktop/SpriteBatchAndFont/SpriteBatchAndFont.Desktop.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,9 @@
5454
<ToolkitFont Include="..\..\Common\SpriteBatchAndFont\Content\Arial16.xml">
5555
<Link>Content\Arial16.xml</Link>
5656
</ToolkitFont>
57-
<Content Include="..\..\Common\SpriteBatchAndFont\Content\balls.dds">
57+
<ToolkitTexture Include="..\..\Common\SpriteBatchAndFont\Content\balls.dds">
5858
<Link>Content\balls.dds</Link>
59-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
60-
</Content>
59+
</ToolkitTexture>
6160
</ItemGroup>
6261
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
6362
<Import Project="..\..\..\..\SharpDX.targets" />

Samples/Toolkit/WP8/ModelRendering.DrawingSurface/ModelRendering.WP8.DrawingSurface.csproj

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,9 @@
124124
<ToolkitModel Include="..\..\Common\ModelRendering\Content\duck.dae">
125125
<Link>Content\duck.dae</Link>
126126
</ToolkitModel>
127-
<Content Include="..\..\Common\ModelRendering\Content\duckCM.dds">
127+
<ToolkitTexture Include="..\..\Common\ModelRendering\Content\duckCM.dds">
128128
<Link>Content\duckCM.dds</Link>
129-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
130-
</Content>
129+
</ToolkitTexture>
131130
<ToolkitModel Include="..\..\Common\ModelRendering\Content\Happy.x">
132131
<Link>Content\Happy.x</Link>
133132
</ToolkitModel>
@@ -146,22 +145,18 @@
146145
<ToolkitModel Include="..\..\Common\ModelRendering\Content\dude.fbx">
147146
<Link>Content\dude.fbx</Link>
148147
</ToolkitModel>
149-
<Content Include="..\..\Common\ModelRendering\Content\head.dds">
148+
<ToolkitTexture Include="..\..\Common\ModelRendering\Content\head.dds">
150149
<Link>Content\head.dds</Link>
151-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
152-
</Content>
153-
<Content Include="..\..\Common\ModelRendering\Content\jacket.dds">
150+
</ToolkitTexture>
151+
<ToolkitTexture Include="..\..\Common\ModelRendering\Content\jacket.dds">
154152
<Link>Content\jacket.dds</Link>
155-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
156-
</Content>
157-
<Content Include="..\..\Common\ModelRendering\Content\pants.dds">
153+
</ToolkitTexture>
154+
<ToolkitTexture Include="..\..\Common\ModelRendering\Content\pants.dds">
158155
<Link>Content\pants.dds</Link>
159-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
160-
</Content>
161-
<Content Include="..\..\Common\ModelRendering\Content\upBodyC.dds">
156+
</ToolkitTexture>
157+
<ToolkitTexture Include="..\..\Common\ModelRendering\Content\upBodyC.dds">
162158
<Link>Content\upBodyC.dds</Link>
163-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
164-
</Content>
159+
</ToolkitTexture>
165160
<None Include="Properties\AppManifest.xml" />
166161
<None Include="Properties\WMAppManifest.xml">
167162
<SubType>Designer</SubType>

Samples/Toolkit/WP8/SpriteBatchAndFont/SpriteBatchAndFont.WP8.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,9 @@
121121
<ToolkitFont Include="..\..\Common\SpriteBatchAndFont\Content\Arial16.xml">
122122
<Link>Content\Arial16.xml</Link>
123123
</ToolkitFont>
124-
<Content Include="..\..\Common\SpriteBatchAndFont\Content\balls.dds">
124+
<ToolkitTexture Include="..\..\Common\SpriteBatchAndFont\Content\balls.dds">
125125
<Link>Content\balls.dds</Link>
126-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
127-
</Content>
126+
</ToolkitTexture>
128127
<None Include="Properties\AppManifest.xml" />
129128
<None Include="Properties\WMAppManifest.xml">
130129
<SubType>Designer</SubType>

Samples/Toolkit/WinRT/ModelRendering/ModelRendering.WinRT.csproj

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,31 +53,27 @@
5353
<ToolkitModel Include="..\..\Common\ModelRendering\Content\duck.dae">
5454
<Link>Content\duck.dae</Link>
5555
</ToolkitModel>
56-
<Content Include="..\..\Common\ModelRendering\Content\duckCM.dds">
56+
<ToolkitTexture Include="..\..\Common\ModelRendering\Content\duckCM.dds">
5757
<Link>Content\duckCM.dds</Link>
58-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
59-
</Content>
58+
</ToolkitTexture>
6059
<ToolkitModel Include="..\..\Common\ModelRendering\Content\dude.fbx">
6160
<Link>Content\dude.fbx</Link>
6261
</ToolkitModel>
6362
<ToolkitModel Include="..\..\Common\ModelRendering\Content\Happy.x">
6463
<Link>Content\Happy.x</Link>
6564
</ToolkitModel>
66-
<Content Include="..\..\Common\ModelRendering\Content\head.dds">
65+
<ToolkitTexture Include="..\..\Common\ModelRendering\Content\head.dds">
6766
<Link>Content\head.dds</Link>
68-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
69-
</Content>
70-
<Content Include="..\..\Common\ModelRendering\Content\jacket.dds">
67+
</ToolkitTexture>
68+
<ToolkitTexture Include="..\..\Common\ModelRendering\Content\jacket.dds">
7169
<Link>Content\jacket.dds</Link>
72-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
73-
</Content>
70+
</ToolkitTexture>
7471
<ToolkitModel Include="..\..\Common\ModelRendering\Content\Knot.x">
7572
<Link>Content\Knot.x</Link>
7673
</ToolkitModel>
77-
<Content Include="..\..\Common\ModelRendering\Content\pants.dds">
74+
<ToolkitTexture Include="..\..\Common\ModelRendering\Content\pants.dds">
7875
<Link>Content\pants.dds</Link>
79-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
80-
</Content>
76+
</ToolkitTexture>
8177
<ToolkitModel Include="..\..\Common\ModelRendering\Content\Skull.x">
8278
<Link>Content\Skull.x</Link>
8379
</ToolkitModel>
@@ -87,10 +83,9 @@
8783
<ToolkitModel Include="..\..\Common\ModelRendering\Content\Teapot.x">
8884
<Link>Content\Teapot.x</Link>
8985
</ToolkitModel>
90-
<Content Include="..\..\Common\ModelRendering\Content\upBodyC.dds">
86+
<ToolkitTexture Include="..\..\Common\ModelRendering\Content\upBodyC.dds">
9187
<Link>Content\upBodyC.dds</Link>
92-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
93-
</Content>
88+
</ToolkitTexture>
9489
<None Include="ModelRendering_TemporaryKey.pfx" />
9590
</ItemGroup>
9691
<ItemGroup>

Samples/Toolkit/WinRT/SpriteBatchAndFont/SpriteBatchAndFont.WinRT.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,9 @@
5151
<ToolkitFont Include="..\..\Common\SpriteBatchAndFont\Content\Arial16.xml">
5252
<Link>Content\Arial16.xml</Link>
5353
</ToolkitFont>
54-
<Content Include="..\..\Common\SpriteBatchAndFont\Content\balls.dds">
54+
<ToolkitTexture Include="..\..\Common\SpriteBatchAndFont\Content\balls.dds">
5555
<Link>Content\balls.dds</Link>
56-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
57-
</Content>
56+
</ToolkitTexture>
5857
<None Include="SpriteBatchAndFont.WinRT_TemporaryKey.pfx" />
5958
</ItemGroup>
6059
<ItemGroup>

Samples/Toolkit/WinRT/SpriteBatchAndFont/SpriteBatchAndFont.WinRTXaml.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,9 @@
5555
<ToolkitFont Include="..\..\Common\SpriteBatchAndFont\Content\Arial16.xml">
5656
<Link>Content\Arial16.xml</Link>
5757
</ToolkitFont>
58-
<Content Include="..\..\Common\SpriteBatchAndFont\Content\balls.dds">
58+
<ToolkitTexture Include="..\..\Common\SpriteBatchAndFont\Content\balls.dds">
5959
<Link>Content\balls.dds</Link>
60-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
61-
</Content>
60+
</ToolkitTexture>
6261
<None Include="SpriteBatchAndFont.WinRTXaml_TemporaryKey.pfx" />
6362
</ItemGroup>
6463
<ItemGroup>

SharpDX.targets

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ It compiles all files of type ToolkitFxc/ToolkitFont
3333
<AvailableItemName Include="ToolkitFxc"></AvailableItemName>
3434
<AvailableItemName Include="ToolkitFont"></AvailableItemName>
3535
<AvailableItemName Include="ToolkitModel"></AvailableItemName>
36+
<!-- Currently, toolkit texture is mostly a passthrough and copies the texture to the output directory -->
37+
<!--But a future version may provide compression/rescale on the fly, so we need to introduce it now -->
38+
<!--in order to keep project compatible-->
39+
<AvailableItemName Include="ToolkitTexture"></AvailableItemName>
3640
</ItemGroup>
3741

3842
<!-- Global property most of them are overridable in the project including this project file -->
@@ -148,6 +152,7 @@ It compiles all files of type ToolkitFxc/ToolkitFont
148152
<UsingTask TaskName="SharpDX.Toolkit.FontCompilerTask" AssemblyFile="$(SharpDXSdkToolsDir)\SharpDX.Toolkit.CompilerTask.dll"/>
149153
<UsingTask TaskName="SharpDX.Toolkit.CompilerDependencyTask" AssemblyFile="$(SharpDXSdkToolsDir)\SharpDX.Toolkit.CompilerTask.dll"/>
150154
<UsingTask TaskName="SharpDX.Toolkit.ModelCompilerTask" AssemblyFile="$(SharpDXSdkToolsDir)\SharpDX.Toolkit.CompilerTask.dll"/>
155+
<UsingTask TaskName="SharpDX.Toolkit.TextureCompilerTask" AssemblyFile="$(SharpDXSdkToolsDir)\SharpDX.Toolkit.CompilerTask.dll"/>
151156

152157
<!-- Plugs all compilers in BuildDependsOn -->
153158
<PropertyGroup>
@@ -185,7 +190,7 @@ It compiles all files of type ToolkitFxc/ToolkitFont
185190
ProjectDirectory="$(ProjectDir)"
186191
IntermediateDirectory="$(IntermediateOutputPath)"
187192
Debug="$(ToolkitFxcDebugOption)"
188-
Files="@(ToolkitFxc);@(ToolkitFont);@(ToolkitModel)"
193+
Files="@(ToolkitFxc);@(ToolkitFont);@(ToolkitModel);@(ToolkitTexture)"
189194
RootNamespace="$(RootNamespace)"
190195
>
191196
<Output TaskParameter="ContentFiles" ItemName="TkContent"/>
@@ -196,7 +201,7 @@ It compiles all files of type ToolkitFxc/ToolkitFont
196201
<!--List Of fxo compiled file-->
197202
<Content Include="@(TkContent)" KeepMetadata="Link;CopyToOutputDirectory"/>
198203

199-
<!--List of cs compiled file-->
204+
<!--List of cs compiled file-->
200205
<Compile Include="@(TkCompile)"/>
201206
</ItemGroup>
202207
</Target>
@@ -235,5 +240,15 @@ It compiles all files of type ToolkitFxc/ToolkitFont
235240
>
236241
</ModelCompilerTask>
237242

243+
<!--TODO Merge both task into a single one?-->
244+
<TextureCompilerTask
245+
ProjectDirectory="$(ProjectDir)"
246+
IntermediateDirectory="$(IntermediateOutputPath)"
247+
DynamicCompiling="$(ToolkitFxcDynamicCompilingOption)"
248+
Debug="$(ToolkitFxcDebugOption)"
249+
Files="@(ToolkitTexture)"
250+
RootNamespace="$(RootNamespace)"
251+
>
252+
</TextureCompilerTask>
238253
</Target>
239254
</Project>

Source/SharpDX.WP8/SharpDXWP8.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ IntPtr32 Interop::GetFileInformationByHandleEx() { return (IntPtr32)::GetFileInf
2222
IntPtr32 Interop::FormatMessageW() { return (IntPtr32)::FormatMessageW;}
2323
IntPtr32 Interop::CloseHandle() { return (IntPtr32)::CloseHandle;}
2424
IntPtr32 Interop::SetEndOfFile() { return (IntPtr32)::SetEndOfFile;}
25+
IntPtr32 Interop::GetFileAttributesExW() { return (IntPtr32)::GetFileAttributesExW;}
2526

2627
// D3D11
2728
IntPtr32 Interop::D3D11CreateDevice() { return (IntPtr32)::D3D11CreateDevice;}

Source/SharpDX.WP8/SharpDXWP8.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ namespace SharpDX
2525
static IntPtr32 FormatMessageW();
2626
static IntPtr32 CloseHandle();
2727
static IntPtr32 SetEndOfFile();
28+
static IntPtr32 GetFileAttributesExW();
2829
// D3D11
2930
static IntPtr32 D3D11CreateDevice();
3031
// DXGI

0 commit comments

Comments
 (0)