From ded4cb18578bddc28e3ece820a5efdc83624bdf7 Mon Sep 17 00:00:00 2001 From: Glatzemann Date: Thu, 3 Nov 2011 12:37:07 +0000 Subject: [PATCH] RenderSystem DX10: moved all type translations to a static class extended the IRenderSystemCreator interface to obtain available GraphicsAdapters of a render system enumeration of GraphicsAdapters implemented for DirectX 10 RenderSystem enumeration of DisplayModes implemented for DirectX 10 RenderSystem improved GraphicsDeviceManager --- .../ANX.Framework.Windows.DX10.csproj | 1 + ANX.Framework.Windows.DX10/BlendState_DX10.cs | 93 +---- ANX.Framework.Windows.DX10/Creator.cs | 70 +++- .../DepthStencilState_DX10.cs | 71 +--- ANX.Framework.Windows.DX10/FormatConverter.cs | 328 ++++++++++++++++++ .../GraphicsDeviceWindowsDX10.cs | 93 +---- .../RasterizerState_DX10.cs | 32 +- .../SamplerState_DX10.cs | 51 +-- ANX.Framework.Windows.GL3/Creator.cs | 8 +- ANX.Framework/Graphics/DisplayMode.cs | 30 +- .../Graphics/DisplayModeCollection.cs | 16 +- ANX.Framework/Graphics/GraphicsAdapter.cs | 58 ++-- ANX.Framework/Graphics/GraphicsDevice.cs | 22 +- ANX.Framework/GraphicsDeviceManager.cs | 87 ++++- .../RenderSystem/IRenderSystemCreator.cs | 3 + ANX.RenderSystem.Windows.DX11.1/Creator.cs | 6 + 16 files changed, 583 insertions(+), 386 deletions(-) create mode 100644 ANX.Framework.Windows.DX10/FormatConverter.cs diff --git a/ANX.Framework.Windows.DX10/ANX.Framework.Windows.DX10.csproj b/ANX.Framework.Windows.DX10/ANX.Framework.Windows.DX10.csproj index 3e4d59bf..8df5dec8 100644 --- a/ANX.Framework.Windows.DX10/ANX.Framework.Windows.DX10.csproj +++ b/ANX.Framework.Windows.DX10/ANX.Framework.Windows.DX10.csproj @@ -68,6 +68,7 @@ + diff --git a/ANX.Framework.Windows.DX10/BlendState_DX10.cs b/ANX.Framework.Windows.DX10/BlendState_DX10.cs index 235e0965..b36dcbc5 100644 --- a/ANX.Framework.Windows.DX10/BlendState_DX10.cs +++ b/ANX.Framework.Windows.DX10/BlendState_DX10.cs @@ -140,7 +140,7 @@ namespace ANX.Framework.Windows.DX10 { set { - BlendOperation alphaBlendOperation = Translate(value); + BlendOperation alphaBlendOperation = FormatConverter.Translate(value); if (description.AlphaBlendOperation != alphaBlendOperation) { @@ -154,7 +154,7 @@ namespace ANX.Framework.Windows.DX10 { set { - BlendOperation blendOperation = Translate(value); + BlendOperation blendOperation = FormatConverter.Translate(value); if (description.BlendOperation != blendOperation) { @@ -168,7 +168,7 @@ namespace ANX.Framework.Windows.DX10 { set { - BlendOption destinationAlphaBlend = Translate(value); + BlendOption destinationAlphaBlend = FormatConverter.Translate(value); if (description.DestinationAlphaBlend != destinationAlphaBlend) { @@ -182,7 +182,7 @@ namespace ANX.Framework.Windows.DX10 { set { - BlendOption destinationBlend = Translate(value); + BlendOption destinationBlend = FormatConverter.Translate(value); if (description.DestinationBlend != destinationBlend) { @@ -196,7 +196,7 @@ namespace ANX.Framework.Windows.DX10 { set { - ColorWriteMaskFlags renderTargetWriteMask = Translate(value); + ColorWriteMaskFlags renderTargetWriteMask = FormatConverter.Translate(value); if (description.RenderTargetWriteMask[0] != renderTargetWriteMask) { @@ -210,7 +210,7 @@ namespace ANX.Framework.Windows.DX10 { set { - ColorWriteMaskFlags renderTargetWriteMask = Translate(value); + ColorWriteMaskFlags renderTargetWriteMask = FormatConverter.Translate(value); if (description.RenderTargetWriteMask[1] != renderTargetWriteMask) { @@ -224,7 +224,7 @@ namespace ANX.Framework.Windows.DX10 { set { - ColorWriteMaskFlags renderTargetWriteMask = Translate(value); + ColorWriteMaskFlags renderTargetWriteMask = FormatConverter.Translate(value); if (description.RenderTargetWriteMask[2] != renderTargetWriteMask) { @@ -238,7 +238,7 @@ namespace ANX.Framework.Windows.DX10 { set { - ColorWriteMaskFlags renderTargetWriteMask = Translate(value); + ColorWriteMaskFlags renderTargetWriteMask = FormatConverter.Translate(value); if (description.RenderTargetWriteMask[3] != renderTargetWriteMask) { @@ -252,7 +252,7 @@ namespace ANX.Framework.Windows.DX10 { set { - BlendOption sourceAlphaBlend = Translate(value); + BlendOption sourceAlphaBlend = FormatConverter.Translate(value); if (description.SourceAlphaBlend != sourceAlphaBlend) { @@ -266,7 +266,7 @@ namespace ANX.Framework.Windows.DX10 { set { - BlendOption sourceBlend = Translate(value); + BlendOption sourceBlend = FormatConverter.Translate(value); if (description.SourceBlend != sourceBlend) { @@ -291,78 +291,5 @@ namespace ANX.Framework.Windows.DX10 this.nativeBlendStateDirty = false; } } - - private BlendOperation Translate(BlendFunction blendFunction) - { - switch (blendFunction) - { - case BlendFunction.Add: - return BlendOperation.Add; - case BlendFunction.Max: - return BlendOperation.Maximum; - case BlendFunction.Min: - return BlendOperation.Minimum; - case BlendFunction.ReverseSubtract: - return BlendOperation.ReverseSubtract; - case BlendFunction.Subtract: - return BlendOperation.Subtract; - } - - throw new NotImplementedException(); - } - - private BlendOption Translate(Blend blend) - { - switch (blend) - { - case Blend.BlendFactor: - return BlendOption.BlendFactor; - case Blend.DestinationAlpha: - return BlendOption.DestinationAlpha; - case Blend.DestinationColor: - return BlendOption.DestinationColor; - case Blend.InverseBlendFactor: - return BlendOption.InverseBlendFactor; - case Blend.InverseDestinationAlpha: - return BlendOption.InverseDestinationAlpha; - case Blend.InverseDestinationColor: - return BlendOption.InverseDestinationColor; - case Blend.InverseSourceAlpha: - return BlendOption.InverseSourceAlpha; - case Blend.InverseSourceColor: - return BlendOption.InverseSourceColor; - case Blend.One: - return BlendOption.One; - case Blend.SourceAlpha: - return BlendOption.SourceAlpha; - case Blend.SourceAlphaSaturation: - return BlendOption.SourceAlphaSaturate; - case Blend.SourceColor: - return BlendOption.SourceColor; - case Blend.Zero: - return BlendOption.Zero; - } - - throw new NotImplementedException(); - } - - private ColorWriteMaskFlags Translate(ColorWriteChannels colorWriteChannels) - { - switch (colorWriteChannels) - { - case ColorWriteChannels.All: - return ColorWriteMaskFlags.All; - case ColorWriteChannels.Alpha: - return ColorWriteMaskFlags.Alpha; - case ColorWriteChannels.Blue: - return ColorWriteMaskFlags.Blue; - case ColorWriteChannels.Green: - return ColorWriteMaskFlags.Green; - case ColorWriteChannels.Red: - return ColorWriteMaskFlags.Red; - } - - throw new NotImplementedException(); - } } } diff --git a/ANX.Framework.Windows.DX10/Creator.cs b/ANX.Framework.Windows.DX10/Creator.cs index 335b7de9..25641968 100644 --- a/ANX.Framework.Windows.DX10/Creator.cs +++ b/ANX.Framework.Windows.DX10/Creator.cs @@ -128,7 +128,7 @@ namespace ANX.Framework.Windows.DX10 Height = height, MipLevels = mipCount, ArraySize = mipCount, - Format = Translate(surfaceFormat), + Format = FormatConverter.Translate(surfaceFormat), SampleDescription = new SharpDX.DXGI.SampleDescription(1, 0), Usage = SharpDX.Direct3D10.ResourceUsage.Dynamic, BindFlags = SharpDX.Direct3D10.BindFlags.ShaderResource, @@ -231,21 +231,6 @@ namespace ANX.Framework.Windows.DX10 return new SamplerState_DX10(); } - private SharpDX.DXGI.Format Translate(SurfaceFormat surfaceFormat) - { - switch (surfaceFormat) - { - case SurfaceFormat.Color: - return SharpDX.DXGI.Format.R8G8B8A8_UNorm; - case SurfaceFormat.Dxt3: - return SharpDX.DXGI.Format.BC2_UNorm; - case SurfaceFormat.Dxt5: - return SharpDX.DXGI.Format.BC3_UNorm; - } - - throw new Exception("can't translate SurfaceFormat: " + surfaceFormat.ToString()); - } - private static int FormatSize(SurfaceFormat format) { switch (format) @@ -288,5 +273,58 @@ namespace ANX.Framework.Windows.DX10 { factory.AddCreator(this); } + + + public System.Collections.ObjectModel.ReadOnlyCollection GetAdapterList() + { + SharpDX.DXGI.Factory factory = new Factory(); + + List adapterList = new List(); + DisplayModeCollection displayModeCollection = new DisplayModeCollection(); + + for (int i = 0; i < factory.GetAdapterCount(); i++) + { + using (Adapter adapter = factory.GetAdapter(i)) + { + GraphicsAdapter ga = new GraphicsAdapter(); + //ga.CurrentDisplayMode = ; + //ga.Description = ; + ga.DeviceId = adapter.Description.DeviceId; + ga.DeviceName = adapter.Description.Description; + ga.IsDefaultAdapter = i == 0; //TODO: how to set default adapter? + //ga.IsWideScreen = ; + //ga.MonitorHandle = ; + ga.Revision = adapter.Description.Revision; + ga.SubSystemId = adapter.Description.SubsystemId; + //ga.SupportedDisplayModes = ; + ga.VendorId = adapter.Description.VendorId; + + using (Output adapterOutput = adapter.GetOutput(0)) + { + foreach (ModeDescription modeDescription in adapterOutput.GetDisplayModeList(Format.R8G8B8A8_UNorm, DisplayModeEnumerationFlags.Interlaced)) + { + DisplayMode displayMode = new DisplayMode() + { + Format = FormatConverter.Translate(modeDescription.Format), + Width = modeDescription.Width, + Height = modeDescription.Height, + AspectRatio = (float)modeDescription.Width / (float)modeDescription.Height, + TitleSafeArea = new Rectangle(0, 0, modeDescription.Width, modeDescription.Height), //TODO: calculate this for real + }; + + displayModeCollection[displayMode.Format] = new DisplayMode[] { displayMode }; + } + } + + ga.SupportedDisplayModes = displayModeCollection; + + adapterList.Add(ga); + } + } + + factory.Dispose(); + + return new System.Collections.ObjectModel.ReadOnlyCollection(adapterList); + } } } diff --git a/ANX.Framework.Windows.DX10/DepthStencilState_DX10.cs b/ANX.Framework.Windows.DX10/DepthStencilState_DX10.cs index d82c28e9..376d4e9c 100644 --- a/ANX.Framework.Windows.DX10/DepthStencilState_DX10.cs +++ b/ANX.Framework.Windows.DX10/DepthStencilState_DX10.cs @@ -63,7 +63,7 @@ namespace ANX.Framework.Windows.DX10 { set { - SharpDX.Direct3D10.StencilOperation operation = Translate(value); + SharpDX.Direct3D10.StencilOperation operation = FormatConverter.Translate(value); if (description.BackFace.DepthFailOperation != operation) { @@ -77,7 +77,7 @@ namespace ANX.Framework.Windows.DX10 { set { - SharpDX.Direct3D10.StencilOperation operation = Translate(value); + SharpDX.Direct3D10.StencilOperation operation = FormatConverter.Translate(value); if (description.BackFace.FailOperation != operation) { @@ -91,7 +91,7 @@ namespace ANX.Framework.Windows.DX10 { set { - SharpDX.Direct3D10.Comparison comparison = Translate(value); + SharpDX.Direct3D10.Comparison comparison = FormatConverter.Translate(value); if (description.BackFace.Comparison != comparison) { @@ -105,7 +105,7 @@ namespace ANX.Framework.Windows.DX10 { set { - SharpDX.Direct3D10.StencilOperation operation = Translate(value); + SharpDX.Direct3D10.StencilOperation operation = FormatConverter.Translate(value); if (description.BackFace.PassOperation != operation) { @@ -131,7 +131,7 @@ namespace ANX.Framework.Windows.DX10 { set { - SharpDX.Direct3D10.Comparison comparison = Translate(value); + SharpDX.Direct3D10.Comparison comparison = FormatConverter.Translate(value); if (description.DepthComparison != comparison) { @@ -171,7 +171,7 @@ namespace ANX.Framework.Windows.DX10 { set { - SharpDX.Direct3D10.StencilOperation operation = Translate(value); + SharpDX.Direct3D10.StencilOperation operation = FormatConverter.Translate(value); if (description.FrontFace.DepthFailOperation != operation) { @@ -197,7 +197,7 @@ namespace ANX.Framework.Windows.DX10 { set { - SharpDX.Direct3D10.StencilOperation operation = Translate(value); + SharpDX.Direct3D10.StencilOperation operation = FormatConverter.Translate(value); if (description.FrontFace.FailOperation != operation) { @@ -211,7 +211,7 @@ namespace ANX.Framework.Windows.DX10 { set { - SharpDX.Direct3D10.Comparison comparison = Translate(value); + SharpDX.Direct3D10.Comparison comparison = FormatConverter.Translate(value); if (description.FrontFace.Comparison != comparison) { @@ -238,8 +238,8 @@ namespace ANX.Framework.Windows.DX10 public Graphics.StencilOperation StencilPass { set - { - SharpDX.Direct3D10.StencilOperation operation = Translate(value); + { + SharpDX.Direct3D10.StencilOperation operation = FormatConverter.Translate(value); if (description.FrontFace.PassOperation != operation) { @@ -286,56 +286,5 @@ namespace ANX.Framework.Windows.DX10 this.nativeDepthStencilStateDirty = false; } } - - private SharpDX.Direct3D10.StencilOperation Translate(ANX.Framework.Graphics.StencilOperation stencilOperation) - { - switch (stencilOperation) - { - case Graphics.StencilOperation.Decrement: - return StencilOperation.Decrement; - case Graphics.StencilOperation.DecrementSaturation: - return StencilOperation.DecrementAndClamp; - case Graphics.StencilOperation.Increment: - return StencilOperation.Increment; - case Graphics.StencilOperation.IncrementSaturation: - return StencilOperation.IncrementAndClamp; - case Graphics.StencilOperation.Invert: - return StencilOperation.Invert; - case Graphics.StencilOperation.Keep: - return StencilOperation.Keep; - case Graphics.StencilOperation.Replace: - return StencilOperation.Replace; - case Graphics.StencilOperation.Zero: - return StencilOperation.Zero; - } - - throw new NotImplementedException("unknown StencilOperation"); - } - - private Comparison Translate(ANX.Framework.Graphics.CompareFunction compareFunction) - { - switch (compareFunction) - { - case ANX.Framework.Graphics.CompareFunction.Always: - return Comparison.Always; - case ANX.Framework.Graphics.CompareFunction.Equal: - return Comparison.Equal; - case ANX.Framework.Graphics.CompareFunction.Greater: - return Comparison.Greater; - case ANX.Framework.Graphics.CompareFunction.GreaterEqual: - return Comparison.GreaterEqual; - case ANX.Framework.Graphics.CompareFunction.Less: - return Comparison.Less; - case ANX.Framework.Graphics.CompareFunction.LessEqual: - return Comparison.LessEqual; - case ANX.Framework.Graphics.CompareFunction.Never: - return Comparison.Never; - case ANX.Framework.Graphics.CompareFunction.NotEqual: - return Comparison.NotEqual; - } - - throw new NotImplementedException("unknown CompareFunction"); - } - } } diff --git a/ANX.Framework.Windows.DX10/FormatConverter.cs b/ANX.Framework.Windows.DX10/FormatConverter.cs new file mode 100644 index 00000000..84b936d8 --- /dev/null +++ b/ANX.Framework.Windows.DX10/FormatConverter.cs @@ -0,0 +1,328 @@ +#region Using Statements +using System; +using ANX.Framework.Graphics; +using SharpDX.Direct3D10; +using SharpDX.Direct3D; +using SharpDX.DXGI; + +#endregion // Using Statements + +#region License + +// +// This file is part of the ANX.Framework created by the "ANX.Framework developer group". +// +// This file is released under the Ms-PL license. +// +// +// +// Microsoft Public License (Ms-PL) +// +// This license governs use of the accompanying software. If you use the software, you accept this license. +// If you do not accept the license, do not use the software. +// +// 1.Definitions +// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning +// here as under U.S. copyright law. +// A "contribution" is the original software, or any additions or changes to the software. +// A "contributor" is any person that distributes its contribution under this license. +// "Licensed patents" are a contributor's patent claims that read directly on its contribution. +// +// 2.Grant of Rights +// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations +// in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to +// reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution +// or any derivative works that you create. +// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in +// section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed +// patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution +// in the software or derivative works of the contribution in the software. +// +// 3.Conditions and Limitations +// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. +// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your +// patent license from such contributor to the software ends automatically. +// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution +// notices that are present in the software. +// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including +// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or +// object code form, you may only do so under a license that complies with this license. +// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees, +// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the +// extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a +// particular purpose and non-infringement. + +#endregion // License + +namespace ANX.Framework.Windows.DX10 +{ + internal class FormatConverter + { + public static SharpDX.DXGI.Format Translate(SurfaceFormat surfaceFormat) + { + switch (surfaceFormat) + { + case SurfaceFormat.Color: + return SharpDX.DXGI.Format.R8G8B8A8_UNorm; + case SurfaceFormat.Dxt3: + return SharpDX.DXGI.Format.BC2_UNorm; + case SurfaceFormat.Dxt5: + return SharpDX.DXGI.Format.BC3_UNorm; + } + + throw new Exception("can't translate SurfaceFormat: " + surfaceFormat.ToString()); + } + + public static SurfaceFormat Translate(SharpDX.DXGI.Format format) + { + switch (format) + { + case SharpDX.DXGI.Format.R8G8B8A8_UNorm: + return SurfaceFormat.Color; + case SharpDX.DXGI.Format.BC2_UNorm: + return SurfaceFormat.Dxt3; + case SharpDX.DXGI.Format.BC3_UNorm: + return SurfaceFormat.Dxt5; + } + + throw new Exception("can't translate Format: " + format.ToString()); + } + + public static Filter Translate(TextureFilter filter) + { + switch (filter) + { + case TextureFilter.Anisotropic: + return Filter.Anisotropic; + case TextureFilter.Linear: + return Filter.MinMagMipLinear; + case TextureFilter.LinearMipPoint: + return Filter.MinMagMipPoint; + case TextureFilter.MinLinearMagPointMipLinear: + return Filter.MinLinearMagPointMipLinear; + case TextureFilter.MinLinearMagPointMipPoint: + return Filter.MinLinearMagMipPoint; + case TextureFilter.MinPointMagLinearMipLinear: + return Filter.MinPointMagMipLinear; + case TextureFilter.MinPointMagLinearMipPoint: + return Filter.MinPointMagLinearMipPoint; + case TextureFilter.Point: + return Filter.MinMagMipPoint; + case TextureFilter.PointMipLinear: + return Filter.MinMagPointMipLinear; + } + + throw new NotImplementedException(); + } + + public static SharpDX.Direct3D10.TextureAddressMode Translate(ANX.Framework.Graphics.TextureAddressMode addressMode) + { + switch (addressMode) + { + case Graphics.TextureAddressMode.Clamp: + return SharpDX.Direct3D10.TextureAddressMode.Clamp; + case Graphics.TextureAddressMode.Mirror: + return SharpDX.Direct3D10.TextureAddressMode.Mirror; + case Graphics.TextureAddressMode.Wrap: + return SharpDX.Direct3D10.TextureAddressMode.Wrap; + } + + return SharpDX.Direct3D10.TextureAddressMode.Clamp; + } + + public static PrimitiveTopology Translate(PrimitiveType primitiveType) + { + switch (primitiveType) + { + case PrimitiveType.LineList: + return PrimitiveTopology.LineList; + case PrimitiveType.LineStrip: + return PrimitiveTopology.LineStrip; + case PrimitiveType.TriangleList: + return PrimitiveTopology.TriangleList; + case PrimitiveType.TriangleStrip: + return PrimitiveTopology.TriangleStrip; + default: + throw new InvalidOperationException("unknown PrimitiveType: " + primitiveType.ToString()); + } + } + + public static SharpDX.DXGI.Format Translate(IndexElementSize indexElementSize) + { + switch (indexElementSize) + { + case IndexElementSize.SixteenBits: + return Format.R16_UInt; + case IndexElementSize.ThirtyTwoBits: + return Format.R32_UInt; + default: + throw new InvalidOperationException("unknown IndexElementSize: " + indexElementSize.ToString()); + } + } + + public static string Translate(VertexElementUsage usage) + { + //TODO: map the other Usages + if (usage == VertexElementUsage.TextureCoordinate) + { + return "TEXCOORD"; + } + else + { + return usage.ToString().ToUpperInvariant(); + } + } + + public static BlendOperation Translate(BlendFunction blendFunction) + { + switch (blendFunction) + { + case BlendFunction.Add: + return BlendOperation.Add; + case BlendFunction.Max: + return BlendOperation.Maximum; + case BlendFunction.Min: + return BlendOperation.Minimum; + case BlendFunction.ReverseSubtract: + return BlendOperation.ReverseSubtract; + case BlendFunction.Subtract: + return BlendOperation.Subtract; + } + + throw new NotImplementedException(); + } + + public static BlendOption Translate(Blend blend) + { + switch (blend) + { + case Blend.BlendFactor: + return BlendOption.BlendFactor; + case Blend.DestinationAlpha: + return BlendOption.DestinationAlpha; + case Blend.DestinationColor: + return BlendOption.DestinationColor; + case Blend.InverseBlendFactor: + return BlendOption.InverseBlendFactor; + case Blend.InverseDestinationAlpha: + return BlendOption.InverseDestinationAlpha; + case Blend.InverseDestinationColor: + return BlendOption.InverseDestinationColor; + case Blend.InverseSourceAlpha: + return BlendOption.InverseSourceAlpha; + case Blend.InverseSourceColor: + return BlendOption.InverseSourceColor; + case Blend.One: + return BlendOption.One; + case Blend.SourceAlpha: + return BlendOption.SourceAlpha; + case Blend.SourceAlphaSaturation: + return BlendOption.SourceAlphaSaturate; + case Blend.SourceColor: + return BlendOption.SourceColor; + case Blend.Zero: + return BlendOption.Zero; + } + + throw new NotImplementedException(); + } + + public static ColorWriteMaskFlags Translate(ColorWriteChannels colorWriteChannels) + { + switch (colorWriteChannels) + { + case ColorWriteChannels.All: + return ColorWriteMaskFlags.All; + case ColorWriteChannels.Alpha: + return ColorWriteMaskFlags.Alpha; + case ColorWriteChannels.Blue: + return ColorWriteMaskFlags.Blue; + case ColorWriteChannels.Green: + return ColorWriteMaskFlags.Green; + case ColorWriteChannels.Red: + return ColorWriteMaskFlags.Red; + } + + throw new NotImplementedException(); + } + + public static SharpDX.Direct3D10.StencilOperation Translate(ANX.Framework.Graphics.StencilOperation stencilOperation) + { + switch (stencilOperation) + { + case Graphics.StencilOperation.Decrement: + return SharpDX.Direct3D10.StencilOperation.Decrement; + case Graphics.StencilOperation.DecrementSaturation: + return SharpDX.Direct3D10.StencilOperation.DecrementAndClamp; + case Graphics.StencilOperation.Increment: + return SharpDX.Direct3D10.StencilOperation.Increment; + case Graphics.StencilOperation.IncrementSaturation: + return SharpDX.Direct3D10.StencilOperation.IncrementAndClamp; + case Graphics.StencilOperation.Invert: + return SharpDX.Direct3D10.StencilOperation.Invert; + case Graphics.StencilOperation.Keep: + return SharpDX.Direct3D10.StencilOperation.Keep; + case Graphics.StencilOperation.Replace: + return SharpDX.Direct3D10.StencilOperation.Replace; + case Graphics.StencilOperation.Zero: + return SharpDX.Direct3D10.StencilOperation.Zero; + } + + throw new NotImplementedException("unknown StencilOperation"); + } + + public static Comparison Translate(ANX.Framework.Graphics.CompareFunction compareFunction) + { + switch (compareFunction) + { + case ANX.Framework.Graphics.CompareFunction.Always: + return Comparison.Always; + case ANX.Framework.Graphics.CompareFunction.Equal: + return Comparison.Equal; + case ANX.Framework.Graphics.CompareFunction.Greater: + return Comparison.Greater; + case ANX.Framework.Graphics.CompareFunction.GreaterEqual: + return Comparison.GreaterEqual; + case ANX.Framework.Graphics.CompareFunction.Less: + return Comparison.Less; + case ANX.Framework.Graphics.CompareFunction.LessEqual: + return Comparison.LessEqual; + case ANX.Framework.Graphics.CompareFunction.Never: + return Comparison.Never; + case ANX.Framework.Graphics.CompareFunction.NotEqual: + return Comparison.NotEqual; + } + + throw new NotImplementedException("unknown CompareFunction"); + } + + public static SharpDX.Direct3D10.CullMode Translate(ANX.Framework.Graphics.CullMode cullMode) + { + if (cullMode == Graphics.CullMode.CullClockwiseFace) + { + return SharpDX.Direct3D10.CullMode.Front; + } + else if (cullMode == Graphics.CullMode.CullCounterClockwiseFace) + { + return SharpDX.Direct3D10.CullMode.Back; + } + else + { + return SharpDX.Direct3D10.CullMode.None; + } + } + + public static SharpDX.Direct3D10.FillMode Translate(ANX.Framework.Graphics.FillMode fillMode) + { + if (fillMode == Graphics.FillMode.WireFrame) + { + return SharpDX.Direct3D10.FillMode.Wireframe; + } + else + { + return SharpDX.Direct3D10.FillMode.Solid; + } + } + + } +} diff --git a/ANX.Framework.Windows.DX10/GraphicsDeviceWindowsDX10.cs b/ANX.Framework.Windows.DX10/GraphicsDeviceWindowsDX10.cs index 53b2bf8b..ed1046b4 100644 --- a/ANX.Framework.Windows.DX10/GraphicsDeviceWindowsDX10.cs +++ b/ANX.Framework.Windows.DX10/GraphicsDeviceWindowsDX10.cs @@ -199,7 +199,7 @@ namespace ANX.Framework.Windows.DX10 SetupInputLayout(passSignature); // Prepare All the stages - device.InputAssembler.PrimitiveTopology = Translate(primitiveType); + device.InputAssembler.PrimitiveTopology = FormatConverter.Translate(primitiveType); device.Rasterizer.SetViewports(currentViewport); device.OutputMerger.SetTargets(this.renderView); @@ -219,7 +219,7 @@ namespace ANX.Framework.Windows.DX10 SetupInputLayout(passSignature); // Prepare All the stages - device.InputAssembler.PrimitiveTopology = Translate(primitiveType); + device.InputAssembler.PrimitiveTopology = FormatConverter.Translate(primitiveType); device.Rasterizer.SetViewports(currentViewport); device.OutputMerger.SetTargets(this.renderView); @@ -243,7 +243,7 @@ namespace ANX.Framework.Windows.DX10 if (nativeIndexBuffer != null) { - device.InputAssembler.SetIndexBuffer(nativeIndexBuffer.NativeBuffer, Translate(indexBuffer.IndexElementSize), 0); + device.InputAssembler.SetIndexBuffer(nativeIndexBuffer.NativeBuffer, FormatConverter.Translate(indexBuffer.IndexElementSize), 0); } else { @@ -287,48 +287,6 @@ namespace ANX.Framework.Windows.DX10 this.currentViewport = new SharpDX.Direct3D10.Viewport(viewport.X, viewport.Y, viewport.Width, viewport.Height, viewport.MinDepth, viewport.MaxDepth); } - private Filter Translate(TextureFilter filter) - { - switch (filter) - { - case TextureFilter.Anisotropic: - return Filter.Anisotropic; - case TextureFilter.Linear: - return Filter.MinMagMipLinear; - case TextureFilter.LinearMipPoint: - return Filter.MinMagMipPoint; - case TextureFilter.MinLinearMagPointMipLinear: - return Filter.MinLinearMagPointMipLinear; - case TextureFilter.MinLinearMagPointMipPoint: - return Filter.MinLinearMagMipPoint; - case TextureFilter.MinPointMagLinearMipLinear: - return Filter.MinPointMagMipLinear; - case TextureFilter.MinPointMagLinearMipPoint: - return Filter.MinPointMagLinearMipPoint; - case TextureFilter.Point: - return Filter.MinMagMipPoint; - case TextureFilter.PointMipLinear: - return Filter.MinMagPointMipLinear; - } - - throw new NotImplementedException(); - } - - private SharpDX.Direct3D10.TextureAddressMode Translate(ANX.Framework.Graphics.TextureAddressMode addressMode) - { - switch (addressMode) - { - case Graphics.TextureAddressMode.Clamp: - return SharpDX.Direct3D10.TextureAddressMode.Clamp; - case Graphics.TextureAddressMode.Mirror: - return SharpDX.Direct3D10.TextureAddressMode.Mirror; - case Graphics.TextureAddressMode.Wrap: - return SharpDX.Direct3D10.TextureAddressMode.Wrap; - } - - return SharpDX.Direct3D10.TextureAddressMode.Clamp; - } - /// /// This method creates a InputLayout which is needed by DirectX 10 for rendering primitives. The VertexDeclaration of ANX/XNA needs to be mapped /// to the DirectX 10 types. This is what this method is for. @@ -350,7 +308,7 @@ namespace ANX.Framework.Windows.DX10 private InputElement CreateInputElementFromVertexElement(VertexElement vertexElement) { - string elementName = Translate(vertexElement.VertexElementUsage); + string elementName = FormatConverter.Translate(vertexElement.VertexElementUsage); Format elementFormat; switch (vertexElement.VertexElementFormat) @@ -373,48 +331,5 @@ namespace ANX.Framework.Windows.DX10 return new InputElement(elementName, vertexElement.UsageIndex, elementFormat, vertexElement.Offset, 0); } - - private PrimitiveTopology Translate(PrimitiveType primitiveType) - { - switch (primitiveType) - { - case PrimitiveType.LineList: - return PrimitiveTopology.LineList; - case PrimitiveType.LineStrip: - return PrimitiveTopology.LineStrip; - case PrimitiveType.TriangleList: - return PrimitiveTopology.TriangleList; - case PrimitiveType.TriangleStrip: - return PrimitiveTopology.TriangleStrip; - default: - throw new InvalidOperationException("unknown PrimitiveType: " + primitiveType.ToString()); - } - } - - private SharpDX.DXGI.Format Translate(IndexElementSize indexElementSize) - { - switch (indexElementSize) - { - case IndexElementSize.SixteenBits: - return Format.R16_UInt; - case IndexElementSize.ThirtyTwoBits: - return Format.R32_UInt; - default: - throw new InvalidOperationException("unknown IndexElementSize: " + indexElementSize.ToString()); - } - } - - private string Translate(VertexElementUsage usage) - { - //TODO: map the other Usages - if (usage == VertexElementUsage.TextureCoordinate) - { - return "TEXCOORD"; - } - else - { - return usage.ToString().ToUpperInvariant(); - } - } } } diff --git a/ANX.Framework.Windows.DX10/RasterizerState_DX10.cs b/ANX.Framework.Windows.DX10/RasterizerState_DX10.cs index 536f53ab..9fc88785 100644 --- a/ANX.Framework.Windows.DX10/RasterizerState_DX10.cs +++ b/ANX.Framework.Windows.DX10/RasterizerState_DX10.cs @@ -116,7 +116,7 @@ namespace ANX.Framework.Windows.DX10 { set { - SharpDX.Direct3D10.CullMode cullMode = Translate(value); + SharpDX.Direct3D10.CullMode cullMode = FormatConverter.Translate(value); if (description.CullMode != cullMode) { @@ -147,7 +147,7 @@ namespace ANX.Framework.Windows.DX10 { set { - SharpDX.Direct3D10.FillMode fillMode = Translate(value); + SharpDX.Direct3D10.FillMode fillMode = FormatConverter.Translate(value); if (description.FillMode != fillMode) { @@ -208,33 +208,5 @@ namespace ANX.Framework.Windows.DX10 this.nativeRasterizerStateDirty = false; } } - - private SharpDX.Direct3D10.CullMode Translate(ANX.Framework.Graphics.CullMode cullMode) - { - if (cullMode == Graphics.CullMode.CullClockwiseFace) - { - return SharpDX.Direct3D10.CullMode.Front; - } - else if (cullMode == Graphics.CullMode.CullCounterClockwiseFace) - { - return SharpDX.Direct3D10.CullMode.Back; - } - else - { - return SharpDX.Direct3D10.CullMode.None; - } - } - - private SharpDX.Direct3D10.FillMode Translate(ANX.Framework.Graphics.FillMode fillMode) - { - if (fillMode == Graphics.FillMode.WireFrame) - { - return SharpDX.Direct3D10.FillMode.Wireframe; - } - else - { - return SharpDX.Direct3D10.FillMode.Solid; - } - } } } diff --git a/ANX.Framework.Windows.DX10/SamplerState_DX10.cs b/ANX.Framework.Windows.DX10/SamplerState_DX10.cs index 8442f1a6..eefd5fa0 100644 --- a/ANX.Framework.Windows.DX10/SamplerState_DX10.cs +++ b/ANX.Framework.Windows.DX10/SamplerState_DX10.cs @@ -100,7 +100,7 @@ namespace ANX.Framework.Windows.DX10 { set { - SharpDX.Direct3D10.TextureAddressMode mode = Translate(value); + SharpDX.Direct3D10.TextureAddressMode mode = FormatConverter.Translate(value); if (description.AddressU != mode) { @@ -114,7 +114,7 @@ namespace ANX.Framework.Windows.DX10 { set { - SharpDX.Direct3D10.TextureAddressMode mode = Translate(value); + SharpDX.Direct3D10.TextureAddressMode mode = FormatConverter.Translate(value); if (description.AddressV != mode) { @@ -128,7 +128,7 @@ namespace ANX.Framework.Windows.DX10 { set { - SharpDX.Direct3D10.TextureAddressMode mode = Translate(value); + SharpDX.Direct3D10.TextureAddressMode mode = FormatConverter.Translate(value); if (description.AddressW != mode) { @@ -142,7 +142,7 @@ namespace ANX.Framework.Windows.DX10 { set { - SharpDX.Direct3D10.Filter filter = Translate(value); + SharpDX.Direct3D10.Filter filter = FormatConverter.Translate(value); if (description.Filter != filter) { @@ -212,48 +212,5 @@ namespace ANX.Framework.Windows.DX10 this.nativeSamplerStateDirty = false; } } - - private SharpDX.Direct3D10.TextureAddressMode Translate(ANX.Framework.Graphics.TextureAddressMode addressMode) - { - switch (addressMode) - { - case Graphics.TextureAddressMode.Clamp: - return SharpDX.Direct3D10.TextureAddressMode.Clamp; - case Graphics.TextureAddressMode.Mirror: - return SharpDX.Direct3D10.TextureAddressMode.Mirror; - case Graphics.TextureAddressMode.Wrap: - return SharpDX.Direct3D10.TextureAddressMode.Wrap; - } - - return SharpDX.Direct3D10.TextureAddressMode.Clamp; - } - - private Filter Translate(TextureFilter filter) - { - switch (filter) - { - case TextureFilter.Anisotropic: - return SharpDX.Direct3D10.Filter.Anisotropic; - case TextureFilter.Linear: - return SharpDX.Direct3D10.Filter.MinMagMipLinear; - case TextureFilter.LinearMipPoint: - return SharpDX.Direct3D10.Filter.MinMagMipPoint; - case TextureFilter.MinLinearMagPointMipLinear: - return SharpDX.Direct3D10.Filter.MinLinearMagPointMipLinear; - case TextureFilter.MinLinearMagPointMipPoint: - return SharpDX.Direct3D10.Filter.MinLinearMagMipPoint; - case TextureFilter.MinPointMagLinearMipLinear: - return SharpDX.Direct3D10.Filter.MinPointMagMipLinear; - case TextureFilter.MinPointMagLinearMipPoint: - return SharpDX.Direct3D10.Filter.MinPointMagLinearMipPoint; - case TextureFilter.Point: - return SharpDX.Direct3D10.Filter.MinMagMipPoint; - case TextureFilter.PointMipLinear: - return SharpDX.Direct3D10.Filter.MinMagPointMipLinear; - } - - throw new NotImplementedException(); - } - } } diff --git a/ANX.Framework.Windows.GL3/Creator.cs b/ANX.Framework.Windows.GL3/Creator.cs index cd60d7c9..4ceb053c 100644 --- a/ANX.Framework.Windows.GL3/Creator.cs +++ b/ANX.Framework.Windows.GL3/Creator.cs @@ -223,5 +223,11 @@ namespace ANX.Framework.Windows.GL3 } } #endregion - } + + + public System.Collections.ObjectModel.ReadOnlyCollection GetAdapterList() + { + throw new NotImplementedException(); + } + } } diff --git a/ANX.Framework/Graphics/DisplayMode.cs b/ANX.Framework/Graphics/DisplayMode.cs index d43757c1..5b9da618 100644 --- a/ANX.Framework/Graphics/DisplayMode.cs +++ b/ANX.Framework/Graphics/DisplayMode.cs @@ -56,42 +56,32 @@ namespace ANX.Framework.Graphics { public float AspectRatio { - get - { - throw new NotImplementedException(); - } + get; + set; } public SurfaceFormat Format { - get - { - throw new NotImplementedException(); - } + get; + set; } public int Height { - get - { - throw new NotImplementedException(); - } + get; + set; } public Rectangle TitleSafeArea { - get - { - throw new NotImplementedException(); - } + get; + set; } public int Width { - get - { - throw new NotImplementedException(); - } + get; + set; } public override string ToString() diff --git a/ANX.Framework/Graphics/DisplayModeCollection.cs b/ANX.Framework/Graphics/DisplayModeCollection.cs index f0e8323d..673993d6 100644 --- a/ANX.Framework/Graphics/DisplayModeCollection.cs +++ b/ANX.Framework/Graphics/DisplayModeCollection.cs @@ -56,6 +56,7 @@ namespace ANX.Framework.Graphics { public class DisplayModeCollection : IEnumerable, IEnumerable { + private List displayModes = new List(); public IEnumerator GetEnumerator() { @@ -71,7 +72,20 @@ namespace ANX.Framework.Graphics { get { - throw new NotImplementedException(); + foreach (DisplayMode mode in displayModes) + { + if (mode.Format == format) + { + yield return mode; + } + } + } + set + { + foreach (DisplayMode mode in value) + { + displayModes.Add(mode); + } } } diff --git a/ANX.Framework/Graphics/GraphicsAdapter.cs b/ANX.Framework/Graphics/GraphicsAdapter.cs index 113b85bf..66c6823d 100644 --- a/ANX.Framework/Graphics/GraphicsAdapter.cs +++ b/ANX.Framework/Graphics/GraphicsAdapter.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections.ObjectModel; +using ANX.Framework.NonXNA; #endregion // Using Statements @@ -58,12 +59,22 @@ namespace ANX.Framework.Graphics { public sealed class GraphicsAdapter { + private static List adapters; + private DisplayModeCollection supportedDisplayModes; + + static GraphicsAdapter() + { + adapters = new List(); + + IRenderSystemCreator renderSystemCreator = AddInSystemFactory.Instance.GetCurrentCreator(); + adapters.AddRange(renderSystemCreator.GetAdapterList()); + } public static ReadOnlyCollection Adapters { get { - throw new NotImplementedException(); + return new ReadOnlyCollection(adapters); } } @@ -71,7 +82,8 @@ namespace ANX.Framework.Graphics { get { - throw new NotImplementedException(); + GraphicsAdapter defaultAdapter = adapters.Where(a => a.IsDefaultAdapter).First(); + return defaultAdapter; } } @@ -105,26 +117,20 @@ namespace ANX.Framework.Graphics public int DeviceId { - get - { - throw new NotImplementedException(); - } + get; + set; } public string DeviceName { - get - { - throw new NotImplementedException(); - } + get; + set; } public bool IsDefaultAdapter { - get - { - throw new NotImplementedException(); - } + get; + set; } public bool IsWideScreen @@ -145,34 +151,32 @@ namespace ANX.Framework.Graphics public int Revision { - get - { - throw new NotImplementedException(); - } + get; + set; } public int SubSystemId { - get - { - throw new NotImplementedException(); - } + get; + set; } public DisplayModeCollection SupportedDisplayModes { get { - throw new NotImplementedException(); + return this.supportedDisplayModes; + } + set + { + this.supportedDisplayModes = value; } } public int VendorId { - get - { - throw new NotImplementedException(); - } + get; + set; } public bool IsProfileSupported(GraphicsProfile graphicsProfile) diff --git a/ANX.Framework/Graphics/GraphicsDevice.cs b/ANX.Framework/Graphics/GraphicsDevice.cs index 522f05d9..fee4636c 100644 --- a/ANX.Framework/Graphics/GraphicsDevice.cs +++ b/ANX.Framework/Graphics/GraphicsDevice.cs @@ -66,9 +66,14 @@ namespace ANX.Framework.Graphics private BlendState blendState; private RasterizerState rasterizerState; private DepthStencilState depthStencilState; + private GraphicsAdapter currentAdapter; + private PresentationParameters currentPresentationParameters; - public GraphicsDevice(PresentationParameters presentationParameters) + public GraphicsDevice(GraphicsAdapter adapter, GraphicsProfile graphicsProfile, PresentationParameters presentationParameters) { + this.currentAdapter = adapter; + this.currentPresentationParameters = presentationParameters; + this.viewport = new Viewport(0, 0, presentationParameters.BackBufferWidth, presentationParameters.BackBufferHeight); nativeDevice = AddInSystemFactory.Instance.GetCurrentCreator().CreateGraphicsDevice(presentationParameters); @@ -148,6 +153,21 @@ namespace ANX.Framework.Graphics nativeDevice.SetVertexBuffers(vertexBuffers); } + public void Reset() + { + this.Reset(this.currentPresentationParameters, this.currentAdapter); + } + + public void Reset(PresentationParameters presentationParameters) + { + this.Reset(presentationParameters, this.currentAdapter); + } + + public void Reset(PresentationParameters presentationParameters, GraphicsAdapter adapter) + { + throw new NotImplementedException(); + } + public void Dispose() { throw new NotImplementedException(); diff --git a/ANX.Framework/GraphicsDeviceManager.cs b/ANX.Framework/GraphicsDeviceManager.cs index 1abb5c69..0c36ea96 100644 --- a/ANX.Framework/GraphicsDeviceManager.cs +++ b/ANX.Framework/GraphicsDeviceManager.cs @@ -61,6 +61,7 @@ namespace ANX.Framework #region Private Members private Game game; private GraphicsDevice graphicsDevice; + private DepthFormat depthStencilFormat = DepthFormat.Depth24; public static readonly int DefaultBackBufferWidth = 800; public static readonly int DefaultBackBufferHeight = 600; //TODO: this is 480 in the original XNA @@ -76,14 +77,45 @@ namespace ANX.Framework public GraphicsDeviceManager(Game game) { - //TODO: check arguments for null + if (game == null) + { + throw new ArgumentNullException("game"); + } this.game = game; - //TODO: check for duplicates + if (game.Services.GetService(typeof(IGraphicsDeviceManager)) != null) + { + throw new ArgumentException("The GraphicsDeviceManager was already registered to the game class"); + } game.Services.AddService(typeof(IGraphicsDeviceManager), this); + + if (game.Services.GetService(typeof(IGraphicsDeviceService)) != null) + { + throw new ArgumentException("The GraphicsDeviceService was already registered to the game class"); + } game.Services.AddService(typeof(IGraphicsDeviceService), this); + game.Window.ClientSizeChanged += new EventHandler(Window_ClientSizeChanged); + game.Window.ScreenDeviceNameChanged += new EventHandler(Window_ScreenDeviceNameChanged); + game.Window.OrientationChanged += new EventHandler(Window_OrientationChanged); + + //TODO: read graphics profile type from manifest resource stream + } + + void Window_OrientationChanged(object sender, EventArgs e) + { + throw new NotImplementedException(); + } + + void Window_ScreenDeviceNameChanged(object sender, EventArgs e) + { + throw new NotImplementedException(); + } + + void Window_ClientSizeChanged(object sender, EventArgs e) + { + throw new NotImplementedException(); } public bool BeginDraw() @@ -92,6 +124,11 @@ namespace ANX.Framework } public void CreateDevice() + { + ApplyChanges(); + } + + private void CreateDevice(GraphicsDeviceInformation deviceInformation) { if (this.graphicsDevice != null) { @@ -101,11 +138,13 @@ namespace ANX.Framework //TODO: validate graphics device - PresentationParameters presentationParameters = new PresentationParameters(); - presentationParameters.DeviceWindowHandle = game.Window.Handle; - presentationParameters.BackBufferWidth = DefaultBackBufferWidth; //TODO: set real default sizes - presentationParameters.BackBufferHeight = DefaultBackBufferHeight; - this.graphicsDevice = new GraphicsDevice(presentationParameters); + //TODO: this should be set somewhere else + deviceInformation.PresentationParameters.DeviceWindowHandle = game.Window.Handle; + deviceInformation.PresentationParameters.BackBufferWidth = DefaultBackBufferWidth; //TODO: set real default sizes + deviceInformation.PresentationParameters.BackBufferHeight = DefaultBackBufferHeight; + this.graphicsDevice = new GraphicsDevice(deviceInformation.Adapter, deviceInformation.GraphicsProfile, deviceInformation.PresentationParameters); + + OnDeviceCreated(this, EventArgs.Empty); //TODO: hookup events } @@ -117,7 +156,31 @@ namespace ANX.Framework public void ApplyChanges() { - throw new NotImplementedException(); + GraphicsDeviceInformation graphicsDeviceInformation = FindBestDevice(true); + OnPreparingDeviceSettings(this, new PreparingDeviceSettingsEventArgs(graphicsDeviceInformation)); + + if (graphicsDevice != null) + { + if (this.CanResetDevice(graphicsDeviceInformation)) + { + OnDeviceResetting(this, EventArgs.Empty); + + this.graphicsDevice.Reset(graphicsDeviceInformation.PresentationParameters, graphicsDeviceInformation.Adapter); + + OnDeviceReset(this, EventArgs.Empty); + } + else + { + graphicsDevice.Dispose(); + graphicsDevice = null; + } + } + + if (graphicsDevice == null) + { + CreateDevice(graphicsDeviceInformation); + } + } public void ToggleFullScreen() @@ -132,7 +195,8 @@ namespace ANX.Framework protected GraphicsDeviceInformation FindBestDevice(bool anySuitableDevice) { - throw new NotImplementedException(); + //TODO: implement + return new GraphicsDeviceInformation(); } protected virtual bool CanResetDevice(GraphicsDeviceInformation newDeviceInfo) @@ -204,7 +268,10 @@ namespace ANX.Framework public DepthFormat PreferredDepthStencilFormat { - get { throw new NotImplementedException(); } + get + { + return this.depthStencilFormat; + } set { throw new NotImplementedException(); } } diff --git a/ANX.Framework/NonXNA/RenderSystem/IRenderSystemCreator.cs b/ANX.Framework/NonXNA/RenderSystem/IRenderSystemCreator.cs index c61380a9..b964a352 100644 --- a/ANX.Framework/NonXNA/RenderSystem/IRenderSystemCreator.cs +++ b/ANX.Framework/NonXNA/RenderSystem/IRenderSystemCreator.cs @@ -3,6 +3,7 @@ using System; using ANX.Framework.Graphics; using System.IO; using ANX.Framework.NonXNA; +using System.Collections.ObjectModel; #endregion // Using Statements @@ -76,5 +77,7 @@ namespace ANX.Framework INativeSamplerState CreateSamplerState(); byte[] GetShaderByteCode(PreDefinedShader type); + + ReadOnlyCollection GetAdapterList(); } } diff --git a/ANX.RenderSystem.Windows.DX11.1/Creator.cs b/ANX.RenderSystem.Windows.DX11.1/Creator.cs index eba1c34d..2fb47b3e 100644 --- a/ANX.RenderSystem.Windows.DX11.1/Creator.cs +++ b/ANX.RenderSystem.Windows.DX11.1/Creator.cs @@ -217,5 +217,11 @@ namespace ANX.RenderSystem.Windows.DX11_1 { throw new NotImplementedException(); } + + + public System.Collections.ObjectModel.ReadOnlyCollection GetAdapterList() + { + throw new NotImplementedException(); + } } }