Added AllocationMode option to create resources
このコミットが含まれているのは:
1 親
97a2bbc69b
コミット
052e50a8d2
20ファイル変更
+140
-83
検索条件に一致するファイルはありません
@@ -50,7 +50,8 @@ namespace ComputeSharp.Resources
|
||||
/// <param name="length">The number of items to store in the current buffer.</param>
|
||||
/// <param name="elementSizeInBytes">The size in bytes of each buffer item (including padding, if any).</param>
|
||||
/// <param name="resourceType">The resource type for the current buffer.</param>
|
||||
private protected Buffer(GraphicsDevice device, int length, uint elementSizeInBytes, ResourceType resourceType)
|
||||
/// <param name="allocationMode">The allocation mode to use for the new resource.</param>
|
||||
private protected Buffer(GraphicsDevice device, int length, uint elementSizeInBytes, ResourceType resourceType, AllocationMode allocationMode)
|
||||
{
|
||||
device.ThrowIfDisposed();
|
||||
|
||||
@@ -68,7 +69,7 @@ namespace ComputeSharp.Resources
|
||||
GraphicsDevice = device;
|
||||
Length = length;
|
||||
|
||||
this.d3D12Resource = device.D3D12Device->CreateCommittedResource(resourceType, (ulong)SizeInBytes, device.IsCacheCoherentUMA);
|
||||
this.d3D12Resource = device.D3D12Device->CreateCommittedResource(resourceType, allocationMode, (ulong)SizeInBytes, device.IsCacheCoherentUMA);
|
||||
|
||||
device.RentShaderResourceViewDescriptorHandles(out D3D12CpuDescriptorHandle, out D3D12GpuDescriptorHandle);
|
||||
|
||||
|
||||
@@ -22,8 +22,9 @@ namespace ComputeSharp.Resources
|
||||
/// <param name="device">The <see cref="GraphicsDevice"/> associated with the current instance.</param>
|
||||
/// <param name="length">The number of items to store in the current buffer.</param>
|
||||
/// <param name="resourceType">The buffer type for the current buffer.</param>
|
||||
private protected unsafe StructuredBuffer(GraphicsDevice device, int length, ResourceType resourceType)
|
||||
: base(device, length, (uint)sizeof(T), resourceType)
|
||||
/// <param name="allocationMode">The allocation mode to use for the new resource.</param>
|
||||
private protected unsafe StructuredBuffer(GraphicsDevice device, int length, ResourceType resourceType, AllocationMode allocationMode)
|
||||
: base(device, length, (uint)sizeof(T), resourceType, allocationMode)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -57,7 +58,7 @@ namespace ComputeSharp.Resources
|
||||
byteOffset = (nint)offset * sizeof(T),
|
||||
byteSize = size * sizeof(T);
|
||||
|
||||
using ComPtr<ID3D12Resource> d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource(ResourceType.ReadBack, (ulong)byteSize, false);
|
||||
using ComPtr<ID3D12Resource> d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource(ResourceType.ReadBack, AllocationMode.Default, (ulong)byteSize, false);
|
||||
|
||||
using (CommandList copyCommandList = new(GraphicsDevice, D3D12_COMMAND_LIST_TYPE_COPY))
|
||||
{
|
||||
@@ -109,7 +110,7 @@ namespace ComputeSharp.Resources
|
||||
byteOffset = (nint)offset * sizeof(T),
|
||||
byteSize = size * sizeof(T);
|
||||
|
||||
using ComPtr<ID3D12Resource> d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource(ResourceType.Upload, (ulong)byteSize, false);
|
||||
using ComPtr<ID3D12Resource> d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource(ResourceType.Upload, AllocationMode.Default, (ulong)byteSize, false);
|
||||
|
||||
using (ID3D12ResourceMap resource = d3D12Resource.Get()->Map())
|
||||
fixed (void* sourcePointer = &source)
|
||||
|
||||
@@ -59,8 +59,9 @@ namespace ComputeSharp.Resources
|
||||
/// <param name="height">The height of the texture.</param>
|
||||
/// <param name="width">The width of the texture.</param>
|
||||
/// <param name="resourceType">The resource type for the current texture.</param>
|
||||
/// <param name="allocationMode">The allocation mode to use for the new resource.</param>
|
||||
/// <param name="d3D12FormatSupport">The format support for the current texture type.</param>
|
||||
private protected Texture2D(GraphicsDevice device, int width, int height, ResourceType resourceType, D3D12_FORMAT_SUPPORT1 d3D12FormatSupport)
|
||||
private protected Texture2D(GraphicsDevice device, int width, int height, ResourceType resourceType, AllocationMode allocationMode, D3D12_FORMAT_SUPPORT1 d3D12FormatSupport)
|
||||
{
|
||||
device.ThrowIfDisposed();
|
||||
|
||||
@@ -78,6 +79,7 @@ namespace ComputeSharp.Resources
|
||||
|
||||
this.d3D12Resource = device.D3D12Device->CreateCommittedResource(
|
||||
resourceType,
|
||||
allocationMode,
|
||||
DXGIFormatHelper.GetForType<T>(),
|
||||
(uint)width,
|
||||
(uint)height,
|
||||
@@ -152,7 +154,7 @@ namespace ComputeSharp.Resources
|
||||
out ulong rowSizeInBytes,
|
||||
out ulong totalSizeInBytes);
|
||||
|
||||
using ComPtr<ID3D12Resource> d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource(ResourceType.ReadBack, totalSizeInBytes, GraphicsDevice.IsCacheCoherentUMA);
|
||||
using ComPtr<ID3D12Resource> d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource(ResourceType.ReadBack, AllocationMode.Default, totalSizeInBytes, GraphicsDevice.IsCacheCoherentUMA);
|
||||
|
||||
using (CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType))
|
||||
{
|
||||
@@ -224,7 +226,7 @@ namespace ComputeSharp.Resources
|
||||
out ulong rowSizeInBytes,
|
||||
out ulong totalSizeInBytes);
|
||||
|
||||
using ComPtr<ID3D12Resource> d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource(ResourceType.Upload, totalSizeInBytes, GraphicsDevice.IsCacheCoherentUMA);
|
||||
using ComPtr<ID3D12Resource> d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource(ResourceType.Upload, AllocationMode.Default, totalSizeInBytes, GraphicsDevice.IsCacheCoherentUMA);
|
||||
|
||||
using (ID3D12ResourceMap resource = d3D12Resource.Get()->Map())
|
||||
fixed (void* sourcePointer = &source)
|
||||
|
||||
@@ -60,8 +60,9 @@ namespace ComputeSharp.Resources
|
||||
/// <param name="width">The width of the texture.</param>
|
||||
/// <param name="depth">The depth of the texture.</param>
|
||||
/// <param name="resourceType">The resource type for the current texture.</param>
|
||||
/// <param name="allocationMode">The allocation mode to use for the new resource.</param>
|
||||
/// <param name="d3D12FormatSupport">The format support for the current texture type.</param>
|
||||
private protected Texture3D(GraphicsDevice device, int width, int height, int depth, ResourceType resourceType, D3D12_FORMAT_SUPPORT1 d3D12FormatSupport)
|
||||
private protected Texture3D(GraphicsDevice device, int width, int height, int depth, ResourceType resourceType, AllocationMode allocationMode, D3D12_FORMAT_SUPPORT1 d3D12FormatSupport)
|
||||
{
|
||||
device.ThrowIfDisposed();
|
||||
|
||||
@@ -81,6 +82,7 @@ namespace ComputeSharp.Resources
|
||||
|
||||
this.d3D12Resource = device.D3D12Device->CreateCommittedResource(
|
||||
resourceType,
|
||||
allocationMode,
|
||||
DXGIFormatHelper.GetForType<T>(),
|
||||
(uint)width,
|
||||
(uint)height,
|
||||
@@ -166,7 +168,7 @@ namespace ComputeSharp.Resources
|
||||
out ulong rowSizeInBytes,
|
||||
out ulong totalSizeInBytes);
|
||||
|
||||
using ComPtr<ID3D12Resource> d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource(ResourceType.ReadBack, totalSizeInBytes, GraphicsDevice.IsCacheCoherentUMA);
|
||||
using ComPtr<ID3D12Resource> d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource(ResourceType.ReadBack, AllocationMode.Default, totalSizeInBytes, GraphicsDevice.IsCacheCoherentUMA);
|
||||
|
||||
using (CommandList copyCommandList = new(GraphicsDevice, this.d3D12CommandListType))
|
||||
{
|
||||
@@ -245,7 +247,7 @@ namespace ComputeSharp.Resources
|
||||
out ulong rowSizeInBytes,
|
||||
out ulong totalSizeInBytes);
|
||||
|
||||
using ComPtr<ID3D12Resource> d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource(ResourceType.Upload, totalSizeInBytes, GraphicsDevice.IsCacheCoherentUMA);
|
||||
using ComPtr<ID3D12Resource> d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource(ResourceType.Upload, AllocationMode.Default, totalSizeInBytes, GraphicsDevice.IsCacheCoherentUMA);
|
||||
|
||||
using (ID3D12ResourceMap resource = d3D12Resource.Get()->Map())
|
||||
fixed (void* sourcePointer = &source)
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする