Fixed issue #1015 (GetData method of vertex buffer). See VertexIndexBuffer sample for a proof of concept (search for GetData in Game1)
This commit is contained in:
parent
ab91d83a1b
commit
3d5b24d6f6
@ -34,13 +34,13 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="SharpDX">
|
<Reference Include="SharpDX">
|
||||||
<HintPath>..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.dll</HintPath>
|
<HintPath>..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SharpDX.DirectInput">
|
<Reference Include="SharpDX.DirectInput">
|
||||||
<HintPath>..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.DirectInput.dll</HintPath>
|
<HintPath>..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.DirectInput.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SharpDX.XInput">
|
<Reference Include="SharpDX.XInput">
|
||||||
<HintPath>..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.XInput.dll</HintPath>
|
<HintPath>..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.XInput.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
@ -32,6 +32,9 @@
|
|||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="MetroContentManager.cs" />
|
<Compile Include="MetroContentManager.cs" />
|
||||||
<Compile Include="MetroGameTimer.cs" />
|
<Compile Include="MetroGameTimer.cs" />
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>..\..\bin\Debug\</OutputPath>
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
<DefineConstants>TRACE;DEBUG;WINDOWSMETRO;</DefineConstants>
|
<DefineConstants>TRACE;DEBUG;WINDOWSMETRO;</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
@ -27,7 +27,7 @@
|
|||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>..\..\bin\Release\</OutputPath>
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
<DefineConstants>TRACE;WINDOWSMETRO;</DefineConstants>
|
<DefineConstants>TRACE;WINDOWSMETRO;</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
|
@ -71,6 +71,12 @@
|
|||||||
<Compile Include="Texture2DGL3.cs" />
|
<Compile Include="Texture2DGL3.cs" />
|
||||||
<Compile Include="VertexBufferGL3.cs" />
|
<Compile Include="VertexBufferGL3.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\ANX.Framework\ANX.Framework_WindowsMetro.csproj">
|
||||||
|
<Project>{6899f0c9-70b9-4eb0-9dd3-e598d4be3e35}</Project>
|
||||||
|
<Name>ANX.Framework</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PreBuildEvent></PreBuildEvent>
|
<PreBuildEvent></PreBuildEvent>
|
||||||
|
@ -11,15 +11,21 @@ using SharpDX;
|
|||||||
// For details see: http://anxframework.codeplex.com/license
|
// For details see: http://anxframework.codeplex.com/license
|
||||||
|
|
||||||
#if DX10
|
#if DX10
|
||||||
|
using Dx = SharpDX.Direct3D10;
|
||||||
|
using DxDevice = SharpDX.Direct3D10.Device;
|
||||||
|
|
||||||
namespace ANX.RenderSystem.Windows.DX10
|
namespace ANX.RenderSystem.Windows.DX10
|
||||||
#endif
|
#endif
|
||||||
#if DX11
|
#if DX11
|
||||||
|
using Dx = SharpDX.Direct3D11;
|
||||||
|
using DxDevice = SharpDX.Direct3D11.Device;
|
||||||
|
|
||||||
namespace ANX.RenderSystem.Windows.DX11
|
namespace ANX.RenderSystem.Windows.DX11
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
public partial class DxVertexBuffer : IDisposable
|
public partial class DxVertexBuffer : IDisposable
|
||||||
{
|
{
|
||||||
protected int vertexStride;
|
private int vertexStride;
|
||||||
|
|
||||||
#region SetData
|
#region SetData
|
||||||
public void SetData<S>(GraphicsDevice graphicsDevice, S[] data) where S : struct
|
public void SetData<S>(GraphicsDevice graphicsDevice, S[] data) where S : struct
|
||||||
@ -74,13 +80,16 @@ namespace ANX.RenderSystem.Windows.DX11
|
|||||||
public void GetData<S>(int offsetInBytes, S[] data, int startIndex, int elementCount, int vertexStride)
|
public void GetData<S>(int offsetInBytes, S[] data, int startIndex, int elementCount, int vertexStride)
|
||||||
where S : struct
|
where S : struct
|
||||||
{
|
{
|
||||||
using (var stream = MapBufferRead())
|
Dx.Buffer stagingBuffer = CreateStagingBuffer(elementCount * vertexStride);
|
||||||
|
CopySubresource(NativeBuffer, stagingBuffer);
|
||||||
|
|
||||||
|
using (var stream = MapBufferRead(stagingBuffer))
|
||||||
{
|
{
|
||||||
if (offsetInBytes > 0)
|
if (offsetInBytes > 0)
|
||||||
stream.Seek(offsetInBytes, SeekOrigin.Current);
|
stream.Seek(offsetInBytes, SeekOrigin.Current);
|
||||||
|
|
||||||
stream.ReadRange(data, startIndex, elementCount);
|
stream.ReadRange(data, startIndex, elementCount);
|
||||||
UnmapBuffer();
|
UnmapBuffer(stagingBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -37,21 +37,17 @@
|
|||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="SharpDX, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="SharpDX">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.dll</HintPath>
|
||||||
<HintPath>..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.dll</HintPath>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SharpDX.D3DCompiler, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="SharpDX.D3DCompiler">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.D3DCompiler.dll</HintPath>
|
||||||
<HintPath>..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.D3DCompiler.dll</HintPath>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SharpDX.Direct3D10, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="SharpDX.Direct3D10">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.Direct3D10.dll</HintPath>
|
||||||
<HintPath>..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.Direct3D10.dll</HintPath>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SharpDX.DXGI, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="SharpDX.DXGI">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.DXGI.dll</HintPath>
|
||||||
<HintPath>..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.DXGI.dll</HintPath>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
@ -10,31 +10,41 @@ using SharpDX;
|
|||||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||||
// For details see: http://anxframework.codeplex.com/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
|
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 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
|
#region Constructor
|
||||||
public DxVertexBuffer(GraphicsDevice graphics, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage)
|
public DxVertexBuffer(GraphicsDevice graphics, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage)
|
||||||
{
|
{
|
||||||
GraphicsDeviceDX gd10 = graphics.NativeDevice as GraphicsDeviceDX;
|
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);
|
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);
|
InitializeBuffer(device, vertexDeclaration, vertexCount, usage);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region InitializeBuffer
|
#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;
|
this.vertexStride = vertexDeclaration.VertexStride;
|
||||||
|
|
||||||
@ -42,34 +52,62 @@ namespace ANX.RenderSystem.Windows.DX10
|
|||||||
|
|
||||||
if (device != null)
|
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,
|
SizeInBytes = vertexDeclaration.VertexStride * vertexCount,
|
||||||
BindFlags = Dx10.BindFlags.VertexBuffer,
|
BindFlags = Dx.BindFlags.VertexBuffer,
|
||||||
CpuAccessFlags = Dx10.CpuAccessFlags.Write,
|
CpuAccessFlags = Dx.CpuAccessFlags.Write,
|
||||||
OptionFlags = Dx10.ResourceOptionFlags.None
|
OptionFlags = Dx.ResourceOptionFlags.None
|
||||||
};
|
};
|
||||||
|
|
||||||
NativeBuffer = new Dx10.Buffer(device, description);
|
NativeBuffer = new Dx.Buffer(device, description);
|
||||||
NativeBuffer.Unmap();
|
NativeBuffer.Unmap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#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();
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ using System.Runtime.InteropServices;
|
|||||||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||||
// übernehmen, indem Sie "*" eingeben:
|
// übernehmen, indem Sie "*" eingeben:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("0.7.20.*")]
|
[assembly: AssemblyVersion("0.7.21.*")]
|
||||||
[assembly: AssemblyFileVersion("0.7.20.0")]
|
[assembly: AssemblyFileVersion("0.7.21.0")]
|
||||||
|
|
||||||
[assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")]
|
[assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")]
|
||||||
|
@ -50,21 +50,17 @@
|
|||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="SharpDX, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="SharpDX">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.dll</HintPath>
|
||||||
<HintPath>..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.dll</HintPath>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SharpDX.D3DCompiler, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="SharpDX.D3DCompiler">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.D3DCompiler.dll</HintPath>
|
||||||
<HintPath>..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.D3DCompiler.dll</HintPath>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SharpDX.Direct3D11, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="SharpDX.Direct3D11">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.Direct3D11.dll</HintPath>
|
||||||
<HintPath>..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.Direct3D11.dll</HintPath>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SharpDX.DXGI, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="SharpDX.DXGI">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.DXGI.dll</HintPath>
|
||||||
<HintPath>..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.DXGI.dll</HintPath>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
|
@ -10,31 +10,41 @@ using SharpDX;
|
|||||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||||
// For details see: http://anxframework.codeplex.com/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
|
namespace ANX.RenderSystem.Windows.DX11
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
public partial class DxVertexBuffer : INativeVertexBuffer, IDisposable
|
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
|
#region Constructor
|
||||||
public DxVertexBuffer(GraphicsDevice graphics, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage)
|
public DxVertexBuffer(GraphicsDevice graphics, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage)
|
||||||
{
|
{
|
||||||
var gd11 = graphics.NativeDevice as GraphicsDeviceDX;
|
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);
|
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);
|
InitializeBuffer(device, vertexDeclaration, vertexCount, usage);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region InitializeBuffer (TODO)
|
#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;
|
vertexStride = vertexDeclaration.VertexStride;
|
||||||
|
|
||||||
@ -42,40 +52,71 @@ namespace ANX.RenderSystem.Windows.DX11
|
|||||||
|
|
||||||
if (device != null)
|
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,
|
SizeInBytes = vertexDeclaration.VertexStride * vertexCount,
|
||||||
BindFlags = Dx11.BindFlags.VertexBuffer,
|
BindFlags = Dx.BindFlags.VertexBuffer,
|
||||||
CpuAccessFlags = Dx11.CpuAccessFlags.Write,
|
CpuAccessFlags = Dx.CpuAccessFlags.Write,
|
||||||
OptionFlags = Dx11.ResourceOptionFlags.None
|
OptionFlags = Dx.ResourceOptionFlags.None
|
||||||
};
|
};
|
||||||
|
|
||||||
NativeBuffer = new Dx11.Buffer(device, description);
|
NativeBuffer = new Dx.Buffer(device, description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
protected SharpDX.DataStream MapBufferWrite()
|
private SharpDX.DataStream MapBufferWrite()
|
||||||
{
|
{
|
||||||
Dx11.DeviceContext context = NativeBuffer.Device.ImmediateContext;
|
Dx.DeviceContext context = NativeBuffer.Device.ImmediateContext;
|
||||||
DataStream stream;
|
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;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected SharpDX.DataStream MapBufferRead()
|
private SharpDX.DataStream MapBufferRead()
|
||||||
{
|
{
|
||||||
Dx11.DeviceContext context = NativeBuffer.Device.ImmediateContext;
|
Dx.DeviceContext context = NativeBuffer.Device.ImmediateContext;
|
||||||
DataStream stream;
|
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;
|
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);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
|||||||
// Buildnummer
|
// Buildnummer
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion("0.7.12.*")]
|
[assembly: AssemblyVersion("0.7.13.*")]
|
||||||
[assembly: AssemblyFileVersion("0.7.12.0")]
|
[assembly: AssemblyFileVersion("0.7.13.0")]
|
||||||
|
@ -70,6 +70,9 @@ namespace VertexIndexBuffer
|
|||||||
graphics.PreferredBackBufferHeight = 486;
|
graphics.PreferredBackBufferHeight = 486;
|
||||||
graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8;
|
graphics.PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8;
|
||||||
graphics.ApplyChanges();
|
graphics.ApplyChanges();
|
||||||
|
|
||||||
|
VertexPositionColor[] vertices23 = new VertexPositionColor[vb.VertexCount];
|
||||||
|
vb.GetData<VertexPositionColor>(vertices23);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update(GameTime gameTime)
|
protected override void Update(GameTime gameTime)
|
||||||
|
@ -33,12 +33,11 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="SharpDX, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="SharpDX">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.dll</HintPath>
|
||||||
<HintPath>..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.dll</HintPath>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="SharpDX.XAudio2">
|
<Reference Include="SharpDX.XAudio2">
|
||||||
<HintPath>..\..\lib\SharpDX\Bin\Standard-net20\SharpDX.XAudio2.dll</HintPath>
|
<HintPath>..\..\lib\SharpDX\Bin\Win8Metro\SharpDX.XAudio2.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@ -67,6 +67,16 @@
|
|||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\ANX.Framework.Content.Pipeline\ANX.Framework.Content.Pipeline.csproj">
|
||||||
|
<Project>{2DAFDFC1-223B-4741-87BB-BE3D0A7617DB}</Project>
|
||||||
|
<Name>ANX.Framework.Content.Pipeline</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\ANX.Framework\ANX.Framework.csproj">
|
||||||
|
<Project>{6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35}</Project>
|
||||||
|
<Name>ANX.Framework</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@ -47,6 +47,22 @@
|
|||||||
<Compile Include="ConsoleTraceListener.cs" />
|
<Compile Include="ConsoleTraceListener.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\ANX.Framework\ANX.Framework.csproj">
|
||||||
|
<Project>{6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35}</Project>
|
||||||
|
<Name>ANX.Framework</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\RenderSystems\ANX.Framework.GL3\ANX.RenderSystem.GL3.csproj">
|
||||||
|
<Project>{EB8258E0-6741-4DB9-B756-1EBDF67B1ED6}</Project>
|
||||||
|
<Name>ANX.RenderSystem.GL3</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\RenderSystems\ANX.RenderSystem.Windows.DX10\ANX.RenderSystem.Windows.DX10.csproj">
|
||||||
|
<Project>{5BE49183-2F6F-4527-AC90-D816911FCF90}</Project>
|
||||||
|
<Name>ANX.RenderSystem.Windows.DX10</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\RenderSystems\ANX.RenderSystem.Windows.DX11\ANX.RenderSystem.Windows.DX11.csproj">
|
||||||
|
<Project>{B30DE9C2-0926-46B6-8351-9AF276C472D5}</Project>
|
||||||
|
<Name>ANX.RenderSystem.Windows.DX11</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\DX11MetroShaderGenerator\DX11MetroShaderGenerator.csproj">
|
<ProjectReference Include="..\DX11MetroShaderGenerator\DX11MetroShaderGenerator.csproj">
|
||||||
<Project>{47B802CC-069D-431E-BF15-E574EDD3BA5D}</Project>
|
<Project>{47B802CC-069D-431E-BF15-E574EDD3BA5D}</Project>
|
||||||
<Name>DX11MetroShaderGenerator</Name>
|
<Name>DX11MetroShaderGenerator</Name>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@ -84,6 +84,12 @@
|
|||||||
<Content Include="anx.ico" />
|
<Content Include="anx.ico" />
|
||||||
<None Include="Resources\ANX.Framework.Logo_220x58.png" />
|
<None Include="Resources\ANX.Framework.Logo_220x58.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\ANX.Framework\ANX.Framework.csproj">
|
||||||
|
<Project>{6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35}</Project>
|
||||||
|
<Name>ANX.Framework</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user