Skip to content

Commit 6cb66f0

Browse files
committed
Verify that Viewports work correctly at a basic level
1 parent dae109f commit 6cb66f0

File tree

5 files changed

+82
-5
lines changed

5 files changed

+82
-5
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ bin
33
obj
44
*.rdc
55
*.cap
6+
.vs
67
/packages

FNATest.csproj

+26-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
<ApplicationManifest>app.manifest</ApplicationManifest>
1717
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
1818
</PropertyGroup>
19+
<PropertyGroup Condition="'$(Configuration)' == 'XNA'">
20+
<XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
21+
<XnaPlatform>Windows</XnaPlatform>
22+
<XnaProfile>HiDef</XnaProfile>
23+
<XnaOutputType>Game</XnaOutputType>
24+
<ProjectTypeGuids>{6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
25+
</PropertyGroup>
1926
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
2027
<DebugSymbols>true</DebugSymbols>
2128
<DefineConstants>DEBUG;TRACE</DefineConstants>
@@ -42,6 +49,15 @@
4249
<DebugType>pdbonly</DebugType>
4350
<PlatformTarget>x64</PlatformTarget>
4451
</PropertyGroup>
52+
<PropertyGroup Condition="'$(Configuration)' == 'XNA'">
53+
<DebugSymbols>true</DebugSymbols>
54+
<OutputPath>bin\XNA\</OutputPath>
55+
<DefineConstants>DEBUG;TRACE;XNA</DefineConstants>
56+
<DebugType>full</DebugType>
57+
<PlatformTarget>x86</PlatformTarget>
58+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
59+
<Prefer32Bit>true</Prefer32Bit>
60+
</PropertyGroup>
4561
<ItemGroup>
4662
<Reference Include="System" />
4763
<Reference Include="System.Core" />
@@ -56,11 +72,18 @@
5672
<None Include="App.config" />
5773
<None Include="app.manifest" />
5874
</ItemGroup>
59-
<ItemGroup>
75+
<ItemGroup Condition="'$(Configuration)' != 'XNA'">
6076
<ProjectReference Include="..\FNA\FNA.csproj">
6177
<Project>{35253CE1-C864-4CD3-8249-4D1319748E8F}</Project>
6278
<Name>FNA</Name>
6379
</ProjectReference>
80+
</ItemGroup>
81+
<ItemGroup Condition="'$(Configuration)' == 'XNA'">
82+
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
83+
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
84+
<Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
85+
</ItemGroup>
86+
<ItemGroup>
6487
<ProjectReference Include="..\Fracture\Squared\GameLib\Squared.Game.csproj">
6588
<Project>{36463aee-e309-43a6-bcfa-a69944390af0}</Project>
6689
<Name>Squared.Game</Name>
@@ -86,13 +109,13 @@
86109
<Name>Squared.Util</Name>
87110
</ProjectReference>
88111
</ItemGroup>
89-
<ItemGroup>
112+
<ItemGroup Condition="'$(Configuration)' != 'XNA'">
90113
<None Include="..\FNA\fnalibs\$(Platform)\*.dll">
91114
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
92115
</None>
93116
</ItemGroup>
94117
<ItemGroup>
95-
<EmbeddedResource Include="*.jpeg;*.otf">
118+
<EmbeddedResource Include="*.png;*.jpg;*.jpeg;*.otf;*.ttf">
96119
<LogicalName>%(Filename)</LogicalName>
97120
</EmbeddedResource>
98121
</ItemGroup>

FNATest.sln

+39-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 14
4-
VisualStudioVersion = 14.0.25420.1
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.28010.2019
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FNATest", "FNATest.csproj", "{947BB64F-D0DC-4DCE-BE71-FE42E10F46B6}"
77
EndProject
@@ -25,6 +25,8 @@ Global
2525
Debug|x86 = Debug|x86
2626
Release|x64 = Release|x64
2727
Release|x86 = Release|x86
28+
XNA|x64 = XNA|x64
29+
XNA|x86 = XNA|x86
2830
EndGlobalSection
2931
GlobalSection(ProjectConfigurationPlatforms) = postSolution
3032
{947BB64F-D0DC-4DCE-BE71-FE42E10F46B6}.Debug|x64.ActiveCfg = Debug|x64
@@ -35,6 +37,10 @@ Global
3537
{947BB64F-D0DC-4DCE-BE71-FE42E10F46B6}.Release|x64.Build.0 = Release|x64
3638
{947BB64F-D0DC-4DCE-BE71-FE42E10F46B6}.Release|x86.ActiveCfg = Release|x86
3739
{947BB64F-D0DC-4DCE-BE71-FE42E10F46B6}.Release|x86.Build.0 = Release|x86
40+
{947BB64F-D0DC-4DCE-BE71-FE42E10F46B6}.XNA|x64.ActiveCfg = XNA|x86
41+
{947BB64F-D0DC-4DCE-BE71-FE42E10F46B6}.XNA|x64.Build.0 = XNA|x86
42+
{947BB64F-D0DC-4DCE-BE71-FE42E10F46B6}.XNA|x86.ActiveCfg = XNA|x86
43+
{947BB64F-D0DC-4DCE-BE71-FE42E10F46B6}.XNA|x86.Build.0 = XNA|x86
3844
{35253CE1-C864-4CD3-8249-4D1319748E8F}.Debug|x64.ActiveCfg = Debug|x64
3945
{35253CE1-C864-4CD3-8249-4D1319748E8F}.Debug|x64.Build.0 = Debug|x64
4046
{35253CE1-C864-4CD3-8249-4D1319748E8F}.Debug|x86.ActiveCfg = Debug|x86
@@ -43,6 +49,10 @@ Global
4349
{35253CE1-C864-4CD3-8249-4D1319748E8F}.Release|x64.Build.0 = Release|x64
4450
{35253CE1-C864-4CD3-8249-4D1319748E8F}.Release|x86.ActiveCfg = Release|x86
4551
{35253CE1-C864-4CD3-8249-4D1319748E8F}.Release|x86.Build.0 = Release|x86
52+
{35253CE1-C864-4CD3-8249-4D1319748E8F}.XNA|x64.ActiveCfg = Release|x64
53+
{35253CE1-C864-4CD3-8249-4D1319748E8F}.XNA|x64.Build.0 = Release|x64
54+
{35253CE1-C864-4CD3-8249-4D1319748E8F}.XNA|x86.ActiveCfg = Debug|x86
55+
{35253CE1-C864-4CD3-8249-4D1319748E8F}.XNA|x86.Build.0 = Debug|x86
4656
{D7F549CF-E0A6-491C-A78C-ECAB590BB2A7}.Debug|x64.ActiveCfg = Debug|Any CPU
4757
{D7F549CF-E0A6-491C-A78C-ECAB590BB2A7}.Debug|x64.Build.0 = Debug|Any CPU
4858
{D7F549CF-E0A6-491C-A78C-ECAB590BB2A7}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -51,6 +61,10 @@ Global
5161
{D7F549CF-E0A6-491C-A78C-ECAB590BB2A7}.Release|x64.Build.0 = Release|Any CPU
5262
{D7F549CF-E0A6-491C-A78C-ECAB590BB2A7}.Release|x86.ActiveCfg = Release|x86
5363
{D7F549CF-E0A6-491C-A78C-ECAB590BB2A7}.Release|x86.Build.0 = Release|x86
64+
{D7F549CF-E0A6-491C-A78C-ECAB590BB2A7}.XNA|x64.ActiveCfg = Mono|Any CPU
65+
{D7F549CF-E0A6-491C-A78C-ECAB590BB2A7}.XNA|x64.Build.0 = Mono|Any CPU
66+
{D7F549CF-E0A6-491C-A78C-ECAB590BB2A7}.XNA|x86.ActiveCfg = Debug|x86
67+
{D7F549CF-E0A6-491C-A78C-ECAB590BB2A7}.XNA|x86.Build.0 = Debug|x86
5468
{ECCB8787-0FC6-43B2-ABD1-6CBB237916EC}.Debug|x64.ActiveCfg = Debug|Any CPU
5569
{ECCB8787-0FC6-43B2-ABD1-6CBB237916EC}.Debug|x64.Build.0 = Debug|Any CPU
5670
{ECCB8787-0FC6-43B2-ABD1-6CBB237916EC}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -59,6 +73,10 @@ Global
5973
{ECCB8787-0FC6-43B2-ABD1-6CBB237916EC}.Release|x64.Build.0 = Release|Any CPU
6074
{ECCB8787-0FC6-43B2-ABD1-6CBB237916EC}.Release|x86.ActiveCfg = Release|Any CPU
6175
{ECCB8787-0FC6-43B2-ABD1-6CBB237916EC}.Release|x86.Build.0 = Release|Any CPU
76+
{ECCB8787-0FC6-43B2-ABD1-6CBB237916EC}.XNA|x64.ActiveCfg = Release|Any CPU
77+
{ECCB8787-0FC6-43B2-ABD1-6CBB237916EC}.XNA|x64.Build.0 = Release|Any CPU
78+
{ECCB8787-0FC6-43B2-ABD1-6CBB237916EC}.XNA|x86.ActiveCfg = Debug|Any CPU
79+
{ECCB8787-0FC6-43B2-ABD1-6CBB237916EC}.XNA|x86.Build.0 = Debug|Any CPU
6280
{FE871F18-FD35-4124-AF8F-0021C9D4BA29}.Debug|x64.ActiveCfg = Debug|FNA
6381
{FE871F18-FD35-4124-AF8F-0021C9D4BA29}.Debug|x64.Build.0 = Debug|FNA
6482
{FE871F18-FD35-4124-AF8F-0021C9D4BA29}.Debug|x86.ActiveCfg = Debug|FNA
@@ -67,6 +85,10 @@ Global
6785
{FE871F18-FD35-4124-AF8F-0021C9D4BA29}.Release|x64.Build.0 = Release|FNA
6886
{FE871F18-FD35-4124-AF8F-0021C9D4BA29}.Release|x86.ActiveCfg = Release|FNA
6987
{FE871F18-FD35-4124-AF8F-0021C9D4BA29}.Release|x86.Build.0 = Release|FNA
88+
{FE871F18-FD35-4124-AF8F-0021C9D4BA29}.XNA|x64.ActiveCfg = Release|x86
89+
{FE871F18-FD35-4124-AF8F-0021C9D4BA29}.XNA|x64.Build.0 = Release|x86
90+
{FE871F18-FD35-4124-AF8F-0021C9D4BA29}.XNA|x86.ActiveCfg = Debug|x86
91+
{FE871F18-FD35-4124-AF8F-0021C9D4BA29}.XNA|x86.Build.0 = Debug|x86
7092
{36463AEE-E309-43A6-BCFA-A69944390AF0}.Debug|x64.ActiveCfg = Debug|FNA
7193
{36463AEE-E309-43A6-BCFA-A69944390AF0}.Debug|x64.Build.0 = Debug|FNA
7294
{36463AEE-E309-43A6-BCFA-A69944390AF0}.Debug|x86.ActiveCfg = Debug|FNA
@@ -75,6 +97,10 @@ Global
7597
{36463AEE-E309-43A6-BCFA-A69944390AF0}.Release|x64.Build.0 = Release|FNA
7698
{36463AEE-E309-43A6-BCFA-A69944390AF0}.Release|x86.ActiveCfg = Release|FNA
7799
{36463AEE-E309-43A6-BCFA-A69944390AF0}.Release|x86.Build.0 = Release|FNA
100+
{36463AEE-E309-43A6-BCFA-A69944390AF0}.XNA|x64.ActiveCfg = Release|x86
101+
{36463AEE-E309-43A6-BCFA-A69944390AF0}.XNA|x64.Build.0 = Release|x86
102+
{36463AEE-E309-43A6-BCFA-A69944390AF0}.XNA|x86.ActiveCfg = Debug|x86
103+
{36463AEE-E309-43A6-BCFA-A69944390AF0}.XNA|x86.Build.0 = Debug|x86
78104
{173ABDCA-7278-46FF-A300-D3BF8CCEF181}.Debug|x64.ActiveCfg = Debug|Any CPU
79105
{173ABDCA-7278-46FF-A300-D3BF8CCEF181}.Debug|x64.Build.0 = Debug|Any CPU
80106
{173ABDCA-7278-46FF-A300-D3BF8CCEF181}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -83,6 +109,10 @@ Global
83109
{173ABDCA-7278-46FF-A300-D3BF8CCEF181}.Release|x64.Build.0 = Release|Any CPU
84110
{173ABDCA-7278-46FF-A300-D3BF8CCEF181}.Release|x86.ActiveCfg = Release|x86
85111
{173ABDCA-7278-46FF-A300-D3BF8CCEF181}.Release|x86.Build.0 = Release|x86
112+
{173ABDCA-7278-46FF-A300-D3BF8CCEF181}.XNA|x64.ActiveCfg = Mono|Any CPU
113+
{173ABDCA-7278-46FF-A300-D3BF8CCEF181}.XNA|x64.Build.0 = Mono|Any CPU
114+
{173ABDCA-7278-46FF-A300-D3BF8CCEF181}.XNA|x86.ActiveCfg = Debug|x86
115+
{173ABDCA-7278-46FF-A300-D3BF8CCEF181}.XNA|x86.Build.0 = Debug|x86
86116
{CFB603C1-8371-460D-BA60-91E697EAE1B3}.Debug|x64.ActiveCfg = Debug|FNA-x64
87117
{CFB603C1-8371-460D-BA60-91E697EAE1B3}.Debug|x64.Build.0 = Debug|FNA-x64
88118
{CFB603C1-8371-460D-BA60-91E697EAE1B3}.Debug|x86.ActiveCfg = Debug|FNA
@@ -91,8 +121,15 @@ Global
91121
{CFB603C1-8371-460D-BA60-91E697EAE1B3}.Release|x64.Build.0 = Release|FNA-x64
92122
{CFB603C1-8371-460D-BA60-91E697EAE1B3}.Release|x86.ActiveCfg = Release|FNA
93123
{CFB603C1-8371-460D-BA60-91E697EAE1B3}.Release|x86.Build.0 = Release|FNA
124+
{CFB603C1-8371-460D-BA60-91E697EAE1B3}.XNA|x64.ActiveCfg = Release|x86
125+
{CFB603C1-8371-460D-BA60-91E697EAE1B3}.XNA|x64.Build.0 = Release|x86
126+
{CFB603C1-8371-460D-BA60-91E697EAE1B3}.XNA|x86.ActiveCfg = Debug|x86
127+
{CFB603C1-8371-460D-BA60-91E697EAE1B3}.XNA|x86.Build.0 = Debug|x86
94128
EndGlobalSection
95129
GlobalSection(SolutionProperties) = preSolution
96130
HideSolutionNode = FALSE
97131
EndGlobalSection
132+
GlobalSection(ExtensibilityGlobals) = postSolution
133+
SolutionGuid = {A2E56BCB-D6DC-4AEF-9F5E-94A17DD408A4}
134+
EndGlobalSection
98135
EndGlobal

Game.cs

+13
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ public class TestGame : MultithreadedGame {
2020

2121
public TestGame () {
2222
Graphics = new GraphicsDeviceManager(this);
23+
Graphics.PreparingDeviceSettings += (s, e) => {
24+
e.GraphicsDeviceInformation.GraphicsProfile = GraphicsProfile.HiDef;
25+
};
2326
Graphics.GraphicsProfile = GraphicsProfile.HiDef;
2427
Graphics.PreferredBackBufferWidth = 1920;
2528
Graphics.PreferredBackBufferHeight = 1080;
@@ -55,6 +58,16 @@ public override void Draw (GameTime gameTime, Frame frame) {
5558
blendState: BlendState.AlphaBlend,
5659
material: Materials.ScreenSpaceShadowedBitmap
5760
);
61+
62+
ir.Layer += 1;
63+
64+
var sg = ir.MakeSubgroup();
65+
sg.SetViewport(new Rectangle(64, 64, 256, 256), true);
66+
sg.Layer += 1;
67+
// Interestingly this does not produce a square
68+
sg.FillRectangle(new Rectangle(0, 0, 512, 512), Color.Black);
69+
sg.Layer += 1;
70+
sg.SetViewport(null, true);
5871
}
5972
}
6073
}

Program.cs

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
namespace FNATest {
88
class Program {
9+
#if XNA
10+
[STAThread]
11+
#endif
912
public static void Main (string[] args) {
1013
using (var g = new TestGame())
1114
g.Run();

0 commit comments

Comments
 (0)