diff --git a/InputSystems/ANX.InputDevices.Windows.XInput/ANX.InputDevices.Windows.XInput_WindowsMetro.csproj b/InputSystems/ANX.InputDevices.Windows.XInput/ANX.InputDevices.Windows.XInput_WindowsMetro.csproj index bcba5192..c50cb571 100644 --- a/InputSystems/ANX.InputDevices.Windows.XInput/ANX.InputDevices.Windows.XInput_WindowsMetro.csproj +++ b/InputSystems/ANX.InputDevices.Windows.XInput/ANX.InputDevices.Windows.XInput_WindowsMetro.csproj @@ -34,13 +34,13 @@ - ..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.dll + ..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.dll - ..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.DirectInput.dll + ..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.DirectInput.dll - ..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.XInput.dll + ..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.XInput.dll diff --git a/PlatformSystems/ANX.PlatformSystem.Metro/ANX.PlatformSystem.Metro_WindowsMetro.csproj b/PlatformSystems/ANX.PlatformSystem.Metro/ANX.PlatformSystem.Metro_WindowsMetro.csproj index 7e679dcc..9add825f 100644 --- a/PlatformSystems/ANX.PlatformSystem.Metro/ANX.PlatformSystem.Metro_WindowsMetro.csproj +++ b/PlatformSystems/ANX.PlatformSystem.Metro/ANX.PlatformSystem.Metro_WindowsMetro.csproj @@ -32,6 +32,9 @@ prompt 4 + + + diff --git a/PlatformSystems/ANX.PlatformSystem.Windows/ANX.PlatformSystem.Windows_WindowsMetro.csproj b/PlatformSystems/ANX.PlatformSystem.Windows/ANX.PlatformSystem.Windows_WindowsMetro.csproj index 7588799d..dd6e58b8 100644 --- a/PlatformSystems/ANX.PlatformSystem.Windows/ANX.PlatformSystem.Windows_WindowsMetro.csproj +++ b/PlatformSystems/ANX.PlatformSystem.Windows/ANX.PlatformSystem.Windows_WindowsMetro.csproj @@ -19,7 +19,7 @@ true full false - ..\..\bin\Debug\ + bin\Debug\ TRACE;DEBUG;WINDOWSMETRO; prompt 4 @@ -27,7 +27,7 @@ pdbonly true - ..\..\bin\Release\ + bin\Release\ TRACE;WINDOWSMETRO; prompt 4 diff --git a/RenderSystems/ANX.Framework.GL3/ANX.RenderSystem.GL3_WindowsMetro.csproj b/RenderSystems/ANX.Framework.GL3/ANX.RenderSystem.GL3_WindowsMetro.csproj index bdaac18e..bc326b1d 100644 --- a/RenderSystems/ANX.Framework.GL3/ANX.RenderSystem.GL3_WindowsMetro.csproj +++ b/RenderSystems/ANX.Framework.GL3/ANX.RenderSystem.GL3_WindowsMetro.csproj @@ -71,6 +71,12 @@ + + + {6899f0c9-70b9-4eb0-9dd3-e598d4be3e35} + ANX.Framework + + diff --git a/RenderSystems/ANX.RenderSystem.DX.SharedSources/SharedVertexBuffer.cs b/RenderSystems/ANX.RenderSystem.DX.SharedSources/SharedVertexBuffer.cs index 01c198e3..74a732ee 100644 --- a/RenderSystems/ANX.RenderSystem.DX.SharedSources/SharedVertexBuffer.cs +++ b/RenderSystems/ANX.RenderSystem.DX.SharedSources/SharedVertexBuffer.cs @@ -11,15 +11,21 @@ using SharpDX; // For details see: http://anxframework.codeplex.com/license #if DX10 +using Dx = SharpDX.Direct3D10; +using DxDevice = SharpDX.Direct3D10.Device; + namespace ANX.RenderSystem.Windows.DX10 #endif #if DX11 +using Dx = SharpDX.Direct3D11; +using DxDevice = SharpDX.Direct3D11.Device; + namespace ANX.RenderSystem.Windows.DX11 #endif { public partial class DxVertexBuffer : IDisposable { - protected int vertexStride; + private int vertexStride; #region SetData public void SetData(GraphicsDevice graphicsDevice, S[] data) where S : struct @@ -74,13 +80,16 @@ namespace ANX.RenderSystem.Windows.DX11 public void GetData(int offsetInBytes, S[] data, int startIndex, int elementCount, int vertexStride) where S : struct { - using (var stream = MapBufferRead()) + Dx.Buffer stagingBuffer = CreateStagingBuffer(elementCount * vertexStride); + CopySubresource(NativeBuffer, stagingBuffer); + + using (var stream = MapBufferRead(stagingBuffer)) { if (offsetInBytes > 0) stream.Seek(offsetInBytes, SeekOrigin.Current); stream.ReadRange(data, startIndex, elementCount); - UnmapBuffer(); + UnmapBuffer(stagingBuffer); } } #endregion diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX10/ANX.RenderSystem.Windows.DX10_WindowsMetro.csproj b/RenderSystems/ANX.RenderSystem.Windows.DX10/ANX.RenderSystem.Windows.DX10_WindowsMetro.csproj index 3e9d3aa2..8e40b2e5 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX10/ANX.RenderSystem.Windows.DX10_WindowsMetro.csproj +++ b/RenderSystems/ANX.RenderSystem.Windows.DX10/ANX.RenderSystem.Windows.DX10_WindowsMetro.csproj @@ -37,21 +37,17 @@ true - - False - ..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.dll + + ..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.dll - - False - ..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.D3DCompiler.dll + + ..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.D3DCompiler.dll - - False - ..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.Direct3D10.dll + + ..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.Direct3D10.dll - - False - ..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.DXGI.dll + + ..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.DXGI.dll diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX10/DxVertexBuffer.cs b/RenderSystems/ANX.RenderSystem.Windows.DX10/DxVertexBuffer.cs index f5131710..aa5b1c38 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX10/DxVertexBuffer.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX10/DxVertexBuffer.cs @@ -10,31 +10,41 @@ using SharpDX; // "ANX.Framework developer group" and released under the Ms-PL license. // For details see: http://anxframework.codeplex.com/license -using Dx10 = SharpDX.Direct3D10; +#if DX10 +using Dx = SharpDX.Direct3D10; +using DxDevice = SharpDX.Direct3D10.Device; namespace ANX.RenderSystem.Windows.DX10 +#endif +#if DX11 +using Dx = SharpDX.Direct3D11; +using DxDevice = SharpDX.Direct3D11.Device; + +namespace ANX.RenderSystem.Windows.DX11 +#endif { public partial class DxVertexBuffer : INativeVertexBuffer, IDisposable { - public Dx10.Buffer NativeBuffer { get; protected set; } + public Dx.Buffer NativeBuffer { get; protected set; } + private Dx.Device device; #region Constructor public DxVertexBuffer(GraphicsDevice graphics, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage) { GraphicsDeviceDX gd10 = graphics.NativeDevice as GraphicsDeviceDX; - Dx10.Device device = gd10 != null ? gd10.NativeDevice as Dx10.Device : null; + this.device = gd10 != null ? gd10.NativeDevice as Dx.Device : null; InitializeBuffer(device, vertexDeclaration, vertexCount, usage); } - internal DxVertexBuffer(Dx10.Device device, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage) + internal DxVertexBuffer(Dx.Device device, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage) { InitializeBuffer(device, vertexDeclaration, vertexCount, usage); } #endregion #region InitializeBuffer - private void InitializeBuffer(Dx10.Device device, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage) + private void InitializeBuffer(Dx.Device device, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage) { this.vertexStride = vertexDeclaration.VertexStride; @@ -42,34 +52,62 @@ namespace ANX.RenderSystem.Windows.DX10 if (device != null) { - var description = new Dx10.BufferDescription() + var description = new Dx.BufferDescription() { - Usage = Dx10.ResourceUsage.Dynamic, + Usage = Dx.ResourceUsage.Dynamic, SizeInBytes = vertexDeclaration.VertexStride * vertexCount, - BindFlags = Dx10.BindFlags.VertexBuffer, - CpuAccessFlags = Dx10.CpuAccessFlags.Write, - OptionFlags = Dx10.ResourceOptionFlags.None + BindFlags = Dx.BindFlags.VertexBuffer, + CpuAccessFlags = Dx.CpuAccessFlags.Write, + OptionFlags = Dx.ResourceOptionFlags.None }; - NativeBuffer = new Dx10.Buffer(device, description); + NativeBuffer = new Dx.Buffer(device, description); NativeBuffer.Unmap(); - } + } } #endregion - protected DataStream MapBufferWrite() + private DataStream MapBufferWrite() { - return NativeBuffer.Map(Dx10.MapMode.WriteDiscard); + return NativeBuffer.Map(Dx.MapMode.WriteDiscard); } - protected DataStream MapBufferRead() + private DataStream MapBufferRead() { - return NativeBuffer.Map(Dx10.MapMode.Read); + return NativeBuffer.Map(Dx.MapMode.Read); } - protected void UnmapBuffer() + private SharpDX.DataStream MapBufferRead(Dx.Buffer buffer) + { + return buffer.Map(Dx.MapMode.ReadWrite); + } + + private void UnmapBuffer() { NativeBuffer.Unmap(); } + + private void UnmapBuffer(Dx.Buffer buffer) + { + buffer.Unmap(); + } + + private void CopySubresource(Dx.Buffer source, Dx.Buffer destination) + { + this.device.CopyResource(source, destination); + } + + private Dx.Buffer CreateStagingBuffer(int sizeInBytes) + { + var description = new Dx.BufferDescription() + { + Usage = Dx.ResourceUsage.Staging, + SizeInBytes = sizeInBytes, + CpuAccessFlags = Dx.CpuAccessFlags.Read | Dx.CpuAccessFlags.Write, + OptionFlags = Dx.ResourceOptionFlags.None + }; + + return new Dx.Buffer(device, description); + } } } diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX10/Properties/AssemblyInfo.cs b/RenderSystems/ANX.RenderSystem.Windows.DX10/Properties/AssemblyInfo.cs index 65f6040b..d000211f 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX10/Properties/AssemblyInfo.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX10/Properties/AssemblyInfo.cs @@ -32,7 +32,7 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.7.20.*")] -[assembly: AssemblyFileVersion("0.7.20.0")] +[assembly: AssemblyVersion("0.7.21.*")] +[assembly: AssemblyFileVersion("0.7.21.0")] [assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")] diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX11/ANX.RenderSystem.Windows.DX11_WindowsMetro.csproj b/RenderSystems/ANX.RenderSystem.Windows.DX11/ANX.RenderSystem.Windows.DX11_WindowsMetro.csproj index 1934d4c0..144af835 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX11/ANX.RenderSystem.Windows.DX11_WindowsMetro.csproj +++ b/RenderSystems/ANX.RenderSystem.Windows.DX11/ANX.RenderSystem.Windows.DX11_WindowsMetro.csproj @@ -50,21 +50,17 @@ - - False - ..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.dll + + ..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.dll - - False - ..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.D3DCompiler.dll + + ..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.D3DCompiler.dll - - False - ..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.Direct3D11.dll + + ..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.Direct3D11.dll - - False - ..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.DXGI.dll + + ..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.DXGI.dll diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX11/DxVertexBuffer.cs b/RenderSystems/ANX.RenderSystem.Windows.DX11/DxVertexBuffer.cs index fe89b17d..95b52604 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX11/DxVertexBuffer.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX11/DxVertexBuffer.cs @@ -10,31 +10,41 @@ using SharpDX; // "ANX.Framework developer group" and released under the Ms-PL license. // For details see: http://anxframework.codeplex.com/license -using Dx11 = SharpDX.Direct3D11; +#if DX10 +using Dx = SharpDX.Direct3D10; +using DxDevice = SharpDX.Direct3D10.Device; + +namespace ANX.RenderSystem.Windows.DX10 +#endif +#if DX11 +using Dx = SharpDX.Direct3D11; +using DxDevice = SharpDX.Direct3D11.Device; namespace ANX.RenderSystem.Windows.DX11 +#endif { public partial class DxVertexBuffer : INativeVertexBuffer, IDisposable { - public Dx11.Buffer NativeBuffer { get; protected set; } + public Dx.Buffer NativeBuffer { get; protected set; } + private Dx.DeviceContext context; #region Constructor public DxVertexBuffer(GraphicsDevice graphics, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage) { var gd11 = graphics.NativeDevice as GraphicsDeviceDX; - Dx11.DeviceContext context = gd11 != null ? gd11.NativeDevice as Dx11.DeviceContext : null; + this.context = gd11 != null ? gd11.NativeDevice as Dx.DeviceContext : null; InitializeBuffer(context.Device, vertexDeclaration, vertexCount, usage); } - internal DxVertexBuffer(Dx11.Device device, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage) + internal DxVertexBuffer(Dx.Device device, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage) { InitializeBuffer(device, vertexDeclaration, vertexCount, usage); } #endregion #region InitializeBuffer (TODO) - private void InitializeBuffer(Dx11.Device device, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage) + private void InitializeBuffer(Dx.Device device, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage) { vertexStride = vertexDeclaration.VertexStride; @@ -42,40 +52,71 @@ namespace ANX.RenderSystem.Windows.DX11 if (device != null) { - var description = new Dx11.BufferDescription() + var description = new Dx.BufferDescription() { - Usage = Dx11.ResourceUsage.Dynamic, + Usage = Dx.ResourceUsage.Dynamic, SizeInBytes = vertexDeclaration.VertexStride * vertexCount, - BindFlags = Dx11.BindFlags.VertexBuffer, - CpuAccessFlags = Dx11.CpuAccessFlags.Write, - OptionFlags = Dx11.ResourceOptionFlags.None + BindFlags = Dx.BindFlags.VertexBuffer, + CpuAccessFlags = Dx.CpuAccessFlags.Write, + OptionFlags = Dx.ResourceOptionFlags.None }; - NativeBuffer = new Dx11.Buffer(device, description); + NativeBuffer = new Dx.Buffer(device, description); } } #endregion - protected SharpDX.DataStream MapBufferWrite() + private SharpDX.DataStream MapBufferWrite() { - Dx11.DeviceContext context = NativeBuffer.Device.ImmediateContext; + Dx.DeviceContext context = NativeBuffer.Device.ImmediateContext; DataStream stream; - context.MapSubresource(NativeBuffer, Dx11.MapMode.WriteDiscard, Dx11.MapFlags.None, out stream); + context.MapSubresource(NativeBuffer, Dx.MapMode.WriteDiscard, Dx.MapFlags.None, out stream); return stream; } - protected SharpDX.DataStream MapBufferRead() + private SharpDX.DataStream MapBufferRead() { - Dx11.DeviceContext context = NativeBuffer.Device.ImmediateContext; + Dx.DeviceContext context = NativeBuffer.Device.ImmediateContext; DataStream stream; - context.MapSubresource(NativeBuffer, Dx11.MapMode.Read, Dx11.MapFlags.None, out stream); + context.MapSubresource(NativeBuffer, Dx.MapMode.Read, Dx.MapFlags.None, out stream); return stream; } - protected void UnmapBuffer() + private SharpDX.DataStream MapBufferRead(Dx.Resource buffer) + { + DataStream stream; + buffer.Device.ImmediateContext.MapSubresource(buffer, 0, Dx.MapMode.Read, Dx.MapFlags.None, out stream); + return stream; + } + + private void UnmapBuffer() { - Dx11.DeviceContext context = NativeBuffer.Device.ImmediateContext; + Dx.DeviceContext context = NativeBuffer.Device.ImmediateContext; context.UnmapSubresource(NativeBuffer, 0); } + + private void CopySubresource(Dx.Buffer source, Dx.Buffer destination) + { + this.context.CopyResource(source, destination); + } + + private void UnmapBuffer(Dx.Resource buffer) + { + buffer.Device.ImmediateContext.UnmapSubresource(buffer, 0); + } + + private Dx.Buffer CreateStagingBuffer(int sizeInBytes) + { + var description = new Dx.BufferDescription() + { + Usage = Dx.ResourceUsage.Staging, + SizeInBytes = sizeInBytes, + BindFlags = Dx.BindFlags.VertexBuffer, + CpuAccessFlags = Dx.CpuAccessFlags.Write | Dx.CpuAccessFlags.Read, + OptionFlags = Dx.ResourceOptionFlags.None + }; + + return new Dx.Buffer(context.Device, description); + } } } diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX11/Properties/AssemblyInfo.cs b/RenderSystems/ANX.RenderSystem.Windows.DX11/Properties/AssemblyInfo.cs index 583e8405..13165561 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX11/Properties/AssemblyInfo.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX11/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Buildnummer // Revision // -[assembly: AssemblyVersion("0.7.12.*")] -[assembly: AssemblyFileVersion("0.7.12.0")] +[assembly: AssemblyVersion("0.7.13.*")] +[assembly: AssemblyFileVersion("0.7.13.0")] diff --git a/Samples/VertexIndexBuffer/Game1.cs b/Samples/VertexIndexBuffer/Game1.cs index 6a0358b1..fd6ce6b6 100644 --- a/Samples/VertexIndexBuffer/Game1.cs +++ b/Samples/VertexIndexBuffer/Game1.cs @@ -70,6 +70,9 @@ namespace VertexIndexBuffer graphics.PreferredBackBufferHeight = 486; graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8; graphics.ApplyChanges(); + + VertexPositionColor[] vertices23 = new VertexPositionColor[vb.VertexCount]; + vb.GetData(vertices23); } protected override void Update(GameTime gameTime) diff --git a/SoundSystems/ANX.SoundSystem.Windows.XAudio/ANX.SoundSystem.Windows.XAudio_WindowsMetro.csproj b/SoundSystems/ANX.SoundSystem.Windows.XAudio/ANX.SoundSystem.Windows.XAudio_WindowsMetro.csproj index 03847804..aa5c6f2d 100644 --- a/SoundSystems/ANX.SoundSystem.Windows.XAudio/ANX.SoundSystem.Windows.XAudio_WindowsMetro.csproj +++ b/SoundSystems/ANX.SoundSystem.Windows.XAudio/ANX.SoundSystem.Windows.XAudio_WindowsMetro.csproj @@ -33,12 +33,11 @@ 4 - - False - ..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.dll + + ..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.dll - ..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.XAudio2.dll + ..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.XAudio2.dll diff --git a/Tools/ContentBuilder/ContentBuilder.csproj b/Tools/ContentBuilder/ContentBuilder.csproj index b800fc64..23b0b438 100644 --- a/Tools/ContentBuilder/ContentBuilder.csproj +++ b/Tools/ContentBuilder/ContentBuilder.csproj @@ -1,4 +1,4 @@ - + Debug @@ -67,6 +67,16 @@ + + + {2DAFDFC1-223B-4741-87BB-BE3D0A7617DB} + ANX.Framework.Content.Pipeline + + + {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35} + ANX.Framework + +