From f30f566328f6ab54bba7ed84515ec08be5d03c78 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Tue, 28 Dec 2021 18:55:28 +0100 Subject: [PATCH] Remove unnecessary AllocationMode params on .NET Standard 2.0 --- .../Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs | 6 ------ src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs | 2 +- .../Graphics/Resources/Abstract/StructuredBuffer{T}.cs | 2 -- .../Graphics/Resources/Abstract/Texture2D{T}.cs | 3 --- .../Graphics/Resources/Abstract/Texture3D{T}.cs | 3 --- .../Graphics/Resources/Abstract/TransferBuffer{T}.cs | 2 +- .../Graphics/Resources/Abstract/TransferTexture2D{T}.cs | 2 +- .../Graphics/Resources/Abstract/TransferTexture3D{T}.cs | 2 +- 8 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs index b1a0161c..477f68c1 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs @@ -63,14 +63,12 @@ internal static unsafe class ID3D12DeviceExtensions /// /// The instance in use. /// The resource type currently in use. - /// The allocation mode to use for the new resource. /// The size in bytes of the current buffer. /// Indicates whether or not the current device has a cache coherent UMA architecture. /// An reference for the current buffer. public static ComPtr CreateCommittedResource( this ref ID3D12Device d3D12Device, ResourceType resourceType, - AllocationMode allocationMode, ulong sizeInBytes, bool isCacheCoherentUMA) { @@ -124,7 +122,6 @@ internal static unsafe class ID3D12DeviceExtensions /// /// The instance in use. /// The resource type currently in use. - /// The allocation mode to use for the new resource. /// The value to use. /// The width of the texture resource. /// The height of the texture resource. @@ -134,7 +131,6 @@ internal static unsafe class ID3D12DeviceExtensions public static ComPtr CreateCommittedResource( this ref ID3D12Device d3D12Device, ResourceType resourceType, - AllocationMode allocationMode, DXGI_FORMAT dxgiFormat, uint width, uint height, @@ -188,7 +184,6 @@ internal static unsafe class ID3D12DeviceExtensions /// /// The instance in use. /// The resource type currently in use. - /// The allocation mode to use for the new resource. /// The value to use. /// The width of the texture resource. /// The height of the texture resource. @@ -199,7 +194,6 @@ internal static unsafe class ID3D12DeviceExtensions public static ComPtr CreateCommittedResource( this ref ID3D12Device d3D12Device, ResourceType resourceType, - AllocationMode allocationMode, DXGI_FORMAT dxgiFormat, uint width, uint height, diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs index b61cf390..c9fd0889 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs @@ -91,7 +91,7 @@ public unsafe abstract class Buffer : NativeObject this.allocation = device.Allocator->CreateResource(device.Pool, resourceType, allocationMode, (ulong)effectiveSizeInBytes); this.d3D12Resource = new ComPtr(this.allocation.Get()->GetResource()); #else - this.d3D12Resource = device.D3D12Device->CreateCommittedResource(resourceType, allocationMode, (ulong)effectiveSizeInBytes, device.IsCacheCoherentUMA); + this.d3D12Resource = device.D3D12Device->CreateCommittedResource(resourceType, (ulong)effectiveSizeInBytes, device.IsCacheCoherentUMA); #endif device.RegisterAllocatedResource(); diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs index b92907c1..d9dd43dd 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs @@ -66,7 +66,6 @@ public abstract class StructuredBuffer : Buffer #else using ComPtr d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource( ResourceType.ReadBack, - AllocationMode.Default, (ulong)byteLength, GraphicsDevice.IsCacheCoherentUMA); #endif @@ -225,7 +224,6 @@ public abstract class StructuredBuffer : Buffer #else using ComPtr d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource( ResourceType.Upload, - AllocationMode.Default, (ulong)byteLength, GraphicsDevice.IsCacheCoherentUMA); #endif diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs index edd0a980..ad3ad054 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs @@ -100,7 +100,6 @@ public unsafe abstract class Texture2D : NativeObject, GraphicsResourceHelper #else this.d3D12Resource = device.D3D12Device->CreateCommittedResource( resourceType, - allocationMode, DXGIFormatHelper.GetForType(), (uint)width, (uint)height, @@ -198,7 +197,6 @@ public unsafe abstract class Texture2D : NativeObject, GraphicsResourceHelper #else using ComPtr d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource( ResourceType.ReadBack, - AllocationMode.Default, totalSizeInBytes, GraphicsDevice.IsCacheCoherentUMA); #endif @@ -419,7 +417,6 @@ public unsafe abstract class Texture2D : NativeObject, GraphicsResourceHelper #else using ComPtr d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource( ResourceType.Upload, - AllocationMode.Default, totalSizeInBytes, GraphicsDevice.IsCacheCoherentUMA); #endif diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs index 7c93eacb..8cd5ef65 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs @@ -103,7 +103,6 @@ public unsafe abstract class Texture3D : NativeObject, GraphicsResourceHelper #else this.d3D12Resource = device.D3D12Device->CreateCommittedResource( resourceType, - allocationMode, DXGIFormatHelper.GetForType(), (uint)width, (uint)height, @@ -214,7 +213,6 @@ public unsafe abstract class Texture3D : NativeObject, GraphicsResourceHelper #else using ComPtr d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource( ResourceType.ReadBack, - AllocationMode.Default, totalSizeInBytes, GraphicsDevice.IsCacheCoherentUMA); #endif @@ -461,7 +459,6 @@ public unsafe abstract class Texture3D : NativeObject, GraphicsResourceHelper #else using ComPtr d3D12Resource = GraphicsDevice.D3D12Device->CreateCommittedResource( ResourceType.Upload, - AllocationMode.Default, totalSizeInBytes, GraphicsDevice.IsCacheCoherentUMA); #endif diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/TransferBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/TransferBuffer{T}.cs index 771a7a66..04bb5bfd 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/TransferBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/TransferBuffer{T}.cs @@ -58,7 +58,7 @@ public abstract unsafe class TransferBuffer : NativeObject, IMemoryOwner this.allocation = device.Allocator->CreateResource(device.Pool, resourceType, allocationMode, sizeInBytes); this.d3D12Resource = new ComPtr(this.allocation.Get()->GetResource()); #else - this.d3D12Resource = device.D3D12Device->CreateCommittedResource(resourceType, allocationMode, sizeInBytes, device.IsCacheCoherentUMA); + this.d3D12Resource = device.D3D12Device->CreateCommittedResource(resourceType, sizeInBytes, device.IsCacheCoherentUMA); #endif device.RegisterAllocatedResource(); diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs index ab815e0f..dd94a193 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs @@ -74,7 +74,7 @@ public unsafe abstract class TransferTexture2D : NativeObject this.allocation = device.Allocator->CreateResource(device.Pool, resourceType, allocationMode, totalSizeInBytes); this.d3D12Resource = new ComPtr(this.allocation.Get()->GetResource()); #else - this.d3D12Resource = device.D3D12Device->CreateCommittedResource(resourceType, allocationMode, totalSizeInBytes, device.IsCacheCoherentUMA); + this.d3D12Resource = device.D3D12Device->CreateCommittedResource(resourceType, totalSizeInBytes, device.IsCacheCoherentUMA); #endif device.RegisterAllocatedResource(); diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs index e9bd0498..20c7adb9 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs @@ -77,7 +77,7 @@ public unsafe abstract class TransferTexture3D : NativeObject this.allocation = device.Allocator->CreateResource(device.Pool, resourceType, allocationMode, totalSizeInBytes); this.d3D12Resource = new ComPtr(this.allocation.Get()->GetResource()); #else - this.d3D12Resource = device.D3D12Device->CreateCommittedResource(resourceType, allocationMode, totalSizeInBytes, device.IsCacheCoherentUMA); + this.d3D12Resource = device.D3D12Device->CreateCommittedResource(resourceType, totalSizeInBytes, device.IsCacheCoherentUMA); #endif device.RegisterAllocatedResource();