Code refactoring, removed TextureType enum

このコミットが含まれているのは:
Sergio Pedri committed 2020-12-02 23:51:23 +01:00
1 親 02a6fb266e
コミット fcdc69f9fb
12ファイル変更
+79 -94

検索条件に一致するファイルはありません

+7 -7
ファイルの表示
@@ -39,8 +39,8 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
/// <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="elementSizeInBytes">The size in bytes of each buffer item (including padding, if any).</param>
/// <param name="bufferType">The buffer type for the current buffer.</param>
private protected Buffer(GraphicsDevice device, int length, uint elementSizeInBytes, BufferType bufferType)
/// <param name="resourceType">The resource type for the current buffer.</param>
private protected Buffer(GraphicsDevice device, int length, uint elementSizeInBytes, ResourceType resourceType)
{
device.ThrowIfDisposed();
@@ -50,19 +50,19 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
GraphicsDevice = device;
Length = length;
this.d3D12Resource = device.D3D12Device->CreateCommittedResource(bufferType, (ulong)SizeInBytes);
this.d3D12Resource = device.D3D12Device->CreateCommittedResource(resourceType, (ulong)SizeInBytes);
device.AllocateShaderResourceViewDescriptorHandles(out D3D12_CPU_DESCRIPTOR_HANDLE d3D12CpuDescriptorHandle, out D3D12GpuDescriptorHandle);
switch (bufferType)
switch (resourceType)
{
case BufferType.Constant:
case ResourceType.Constant:
device.D3D12Device->CreateConstantBufferView(this.d3D12Resource, SizeInBytes, d3D12CpuDescriptorHandle);
break;
case BufferType.ReadOnly:
case ResourceType.ReadOnly:
device.D3D12Device->CreateShaderResourceView(this.d3D12Resource, (uint)length, elementSizeInBytes, d3D12CpuDescriptorHandle);
break;
case BufferType.ReadWrite:
case ResourceType.ReadWrite:
device.D3D12Device->CreateUnorderedAccessView(this.d3D12Resource, (uint)length, elementSizeInBytes, d3D12CpuDescriptorHandle);
break;
}
+5 -5
ファイルの表示
@@ -23,9 +23,9 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
/// </summary>
/// <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="bufferType">The buffer type for the current buffer.</param>
private protected StructuredBuffer(GraphicsDevice device, int length, BufferType bufferType)
: base(device, length, (uint)Unsafe.SizeOf<T>(), bufferType)
/// <param name="resourceType">The buffer type for the current buffer.</param>
private protected StructuredBuffer(GraphicsDevice device, int length, ResourceType resourceType)
: base(device, length, (uint)Unsafe.SizeOf<T>(), resourceType)
{
}
@@ -43,7 +43,7 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
byteOffset = (nint)offset * ElementSizeInBytes,
byteSize = (nint)destination.Length * ElementSizeInBytes;
using ComPtr<ID3D12Resource> d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource(BufferType.ReadBack, (ulong)byteSize);
using ComPtr<ID3D12Resource> d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource(ResourceType.ReadBack, (ulong)byteSize);
using (CommandList copyCommandList = new(GraphicsDevice, D3D12_COMMAND_LIST_TYPE_COPY))
{
@@ -70,7 +70,7 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
byteOffset = (nint)offset * ElementSizeInBytes,
byteSize = (nint)source.Length * ElementSizeInBytes;
using ComPtr<ID3D12Resource> d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource(BufferType.Upload, (ulong)byteSize);
using ComPtr<ID3D12Resource> d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource(ResourceType.Upload, (ulong)byteSize);
using (ID3D12ResourceMap resource = d3D12Resource.Get()->Map())
{
+6 -6
ファイルの表示
@@ -34,8 +34,8 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
/// <param name="device">The <see cref="Graphics.GraphicsDevice"/> associated with the current instance.</param>
/// <param name="height">The height of the texture.</param>
/// <param name="width">The width of the texture.</param>
/// <param name="textureType">The texture type for the current texture.</param>
private protected Texture2D(GraphicsDevice device, int width, int height, TextureType textureType)
/// <param name="resourceType">The resource type for the current texture.</param>
private protected Texture2D(GraphicsDevice device, int width, int height, ResourceType resourceType)
{
device.ThrowIfDisposed();
@@ -46,16 +46,16 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
Width = width;
Height = height;
this.d3D12Resource = device.D3D12Device->CreateCommittedResource(textureType, DXGIFormatHelper.GetForType<T>(), (uint)width, (uint)height);
this.d3D12Resource = device.D3D12Device->CreateCommittedResource(resourceType, DXGIFormatHelper.GetForType<T>(), (uint)width, (uint)height);
device.AllocateShaderResourceViewDescriptorHandles(out D3D12_CPU_DESCRIPTOR_HANDLE d3D12CpuDescriptorHandle, out D3D12GpuDescriptorHandle);
switch (textureType)
switch (resourceType)
{
case TextureType.ReadOnly:
case ResourceType.ReadOnly:
device.D3D12Device->CreateShaderResourceView(this.d3D12Resource, DXGIFormatHelper.GetForType<T>(), d3D12CpuDescriptorHandle);
break;
case TextureType.ReadWrite:
case ResourceType.ReadWrite:
device.D3D12Device->CreateUnorderedAccessView(this.d3D12Resource, DXGIFormatHelper.GetForType<T>(), d3D12CpuDescriptorHandle);
break;
}