Remove implicit ComPtr<T> operators

このコミットが含まれているのは:
Sergio Pedri committed 2023-10-08 21:07:46 +02:00
1 親 f37e4446f6
コミット 62d81ad03f
19ファイル変更
+28 -48

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

+1 -1
ファイルの表示
@@ -77,7 +77,7 @@ internal static unsafe class ICanvasDeviceExtensions
else
{
// Otherwise, just use the input device context
*d2D1DeviceContextEffective = new ComPtr<ID2D1DeviceContext>(d2D1DeviceContext);
ComPtr.WriteTo(d2D1DeviceContext, out *d2D1DeviceContextEffective);
}
}
}
@@ -153,7 +153,7 @@ internal unsafe partial struct PixelShaderEffect
for (int i = 0; i < resourceTextureDescriptions.Length; i++)
{
using ComPtr<ID2D1ResourceTextureManager> resourceTextureManager = @this->resourceTextureManagerBuffer[i];
using ComPtr<ID2D1ResourceTextureManager> resourceTextureManager = new(@this->resourceTextureManagerBuffer[i]);
// If the current resource texture manager is not set, we cannot render, as there's an unbound resource texture
if (resourceTextureManager.Get() is null)
+3 -3
ファイルの表示
@@ -244,7 +244,7 @@ unsafe partial struct PixelShaderEffect
default(ArgumentNullException).ThrowIfNull(value);
using ComPtr<IUnknown> unknown = (IUnknown*)value;
using ComPtr<IUnknown> unknown = new((IUnknown*)value);
using ComPtr<ID2D1TransformMapper> transformMapper = default;
// Check that the input object implements ID2D1TransformMapper
@@ -280,7 +280,7 @@ unsafe partial struct PixelShaderEffect
default(ArgumentOutOfRangeException).ThrowIfLessThan((int)dataSize, sizeof(void*), nameof(dataSize));
default(ArgumentOutOfRangeException).ThrowIfGreaterThanOrEqual(index, GetGlobals().ResourceTextureCount);
using ComPtr<ID2D1ResourceTextureManager> resourceTextureManager = this.resourceTextureManagerBuffer[index];
using ComPtr<ID2D1ResourceTextureManager> resourceTextureManager = new(this.resourceTextureManagerBuffer[index]);
resourceTextureManager.CopyTo((ID2D1ResourceTextureManager**)data).Assert();
@@ -316,7 +316,7 @@ unsafe partial struct PixelShaderEffect
default(ArgumentNullException).ThrowIfNull(value);
using ComPtr<IUnknown> unknown = (IUnknown*)value;
using ComPtr<IUnknown> unknown = new((IUnknown*)value);
using ComPtr<ID2D1ResourceTextureManager> resourceTextureManager = default;
// Check that the input object implements ID2D1ResourceTextureManager
+1 -1
ファイルの表示
@@ -134,7 +134,7 @@ internal sealed unsafe partial class ShaderCompiler
return dxcBlobBytecode.Move();
}
return ThrowHslsCompilationException(dxcOperationResult);
return ThrowHslsCompilationException(dxcOperationResult.Get());
}
/// <summary>
+1 -1
ファイルの表示
@@ -337,7 +337,7 @@ internal sealed unsafe partial class SwapChainManager<TOwner> : ReferenceTracked
this.d3D12Device.Get()->CreateCommandList(
0,
D3D12_COMMAND_LIST_TYPE.D3D12_COMMAND_LIST_TYPE_DIRECT,
this.d3D12CommandAllocator,
this.d3D12CommandAllocator.Get(),
null,
Win32.__uuidof<ID3D12GraphicsCommandList>(),
(void**)d3D12GraphicsCommandList).Assert();
+2 -2
ファイルの表示
@@ -55,7 +55,7 @@ internal unsafe struct CommandList : IDisposable
// Set the heap descriptor if the command list is not for copy operations
if (d3D12CommandListType is not D3D12_COMMAND_LIST_TYPE_COPY)
{
device.SetDescriptorHeapForCommandList(this.d3D12GraphicsCommandList);
device.SetDescriptorHeapForCommandList(this.d3D12GraphicsCommandList.Get());
}
}
@@ -78,7 +78,7 @@ internal unsafe struct CommandList : IDisposable
out this.d3D12CommandAllocator.GetPinnableReference());
// Set the heap descriptor for the command list
device.SetDescriptorHeapForCommandList(this.d3D12GraphicsCommandList);
device.SetDescriptorHeapForCommandList(this.d3D12GraphicsCommandList.Get());
}
/// <summary>
+1 -1
ファイルの表示
@@ -83,7 +83,7 @@ internal unsafe struct ID3D12DescriptorHandleAllocator : IDisposable
/// <summary>
/// Gets the <see cref="ID3D12DescriptorHeap"/> in use for the current <see cref="ID3D12DescriptorHandleAllocator"/> instance.
/// </summary>
public readonly ID3D12DescriptorHeap* D3D12DescriptorHeap => this.d3D12DescriptorHeap;
public readonly ID3D12DescriptorHeap* D3D12DescriptorHeap => this.d3D12DescriptorHeap.Get();
/// <summary>
/// Rents a new bundle of CPU and GPU handles to use in a resource.
+4 -4
ファイルの表示
@@ -49,14 +49,14 @@ unsafe partial class GraphicsDevice
{
case D3D12_COMMAND_LIST_TYPE_COMPUTE:
commandListPool = ref this.computeCommandListPool;
d3D12CommandQueue = this.d3D12ComputeCommandQueue;
d3D12Fence = this.d3D12ComputeFence;
d3D12CommandQueue = this.d3D12ComputeCommandQueue.Get();
d3D12Fence = this.d3D12ComputeFence.Get();
d3D12FenceValue = ref this.nextD3D12ComputeFenceValue;
break;
case D3D12_COMMAND_LIST_TYPE_COPY:
commandListPool = ref this.copyCommandListPool;
d3D12CommandQueue = this.d3D12CopyCommandQueue;
d3D12Fence = this.d3D12CopyFence;
d3D12CommandQueue = this.d3D12CopyCommandQueue.Get();
d3D12Fence = this.d3D12CopyFence.Get();
d3D12FenceValue = ref this.nextD3D12CopyFenceValue;
break;
default: default(ArgumentException).Throw(nameof(commandList)); return;
+4 -4
ファイルの表示
@@ -31,7 +31,7 @@ unsafe partial class GraphicsDevice
}
else
{
allocation = null;
allocation = default;
d3D12Resource = this.d3D12Device.Get()->CreateCommittedResource(resourceType, sizeInBytes, IsCacheCoherentUMA);
}
}
@@ -68,7 +68,7 @@ unsafe partial class GraphicsDevice
}
else
{
allocation = null;
allocation = default;
d3D12Resource = this.d3D12Device.Get()->CreateCommittedResource(
resourceType,
@@ -114,7 +114,7 @@ unsafe partial class GraphicsDevice
}
else
{
allocation = null;
allocation = default;
d3D12Resource = this.d3D12Device.Get()->CreateCommittedResource(
resourceType,
@@ -164,7 +164,7 @@ unsafe partial class GraphicsDevice
}
else
{
allocation = null;
allocation = default;
d3D12Resource = this.d3D12Device.Get()->CreateCommittedResource(
resourceType,
+1 -1
ファイルの表示
@@ -150,7 +150,7 @@ public abstract unsafe partial class Buffer<T> : IReferenceTrackedObject, IGraph
/// <summary>
/// Gets the <see cref="ID3D12Resource"/> instance currently mapped.
/// </summary>
internal ID3D12Resource* D3D12Resource => this.d3D12Resource;
internal ID3D12Resource* D3D12Resource => this.d3D12Resource.Get();
/// <summary>
/// Gets the <see cref="D3D12_GPU_DESCRIPTOR_HANDLE"/> instance for the current resource.
+1 -1
ファイルの表示
@@ -135,7 +135,7 @@ public abstract unsafe partial class Texture1D<T> : IReferenceTrackedObject, IGr
/// <summary>
/// Gets the <see cref="ID3D12Resource"/> instance currently mapped.
/// </summary>
internal ID3D12Resource* D3D12Resource => this.d3D12Resource;
internal ID3D12Resource* D3D12Resource => this.d3D12Resource.Get();
/// <summary>
/// Gets the <see cref="D3D12_GPU_DESCRIPTOR_HANDLE"/> instance for the current resource.
+1 -1
ファイルの表示
@@ -144,7 +144,7 @@ public abstract unsafe partial class Texture2D<T> : IReferenceTrackedObject, IGr
/// <summary>
/// Gets the <see cref="ID3D12Resource"/> instance currently mapped.
/// </summary>
internal ID3D12Resource* D3D12Resource => this.d3D12Resource;
internal ID3D12Resource* D3D12Resource => this.d3D12Resource.Get();
/// <summary>
/// Gets the <see cref="D3D12_GPU_DESCRIPTOR_HANDLE"/> instance for the current resource.
+1 -1
ファイルの表示
@@ -153,7 +153,7 @@ public abstract unsafe partial class Texture3D<T> : IReferenceTrackedObject, IGr
/// <summary>
/// Gets the <see cref="ID3D12Resource"/> instance currently mapped.
/// </summary>
internal ID3D12Resource* D3D12Resource => this.d3D12Resource;
internal ID3D12Resource* D3D12Resource => this.d3D12Resource.Get();
/// <summary>
/// Gets the <see cref="D3D12_GPU_DESCRIPTOR_HANDLE"/> instance for the current resource.
+1 -1
ファイルの表示
@@ -95,7 +95,7 @@ public abstract unsafe partial class TransferBuffer<T> : IReferenceTrackedObject
/// <summary>
/// Gets the <see cref="ID3D12Resource"/> instance currently mapped.
/// </summary>
internal ID3D12Resource* D3D12Resource => this.d3D12Resource;
internal ID3D12Resource* D3D12Resource => this.d3D12Resource.Get();
/// <summary>
/// Gets the pointer to the start of the mapped buffer data.
+1 -1
ファイルの表示
@@ -100,7 +100,7 @@ public abstract unsafe partial class TransferTexture1D<T> : IReferenceTrackedObj
/// <summary>
/// Gets the <see cref="ID3D12Resource"/> instance currently mapped.
/// </summary>
internal ID3D12Resource* D3D12Resource => this.d3D12Resource;
internal ID3D12Resource* D3D12Resource => this.d3D12Resource.Get();
/// <summary>
/// Gets the <see cref="D3D12_PLACED_SUBRESOURCE_FOOTPRINT"/> value for the current resource.
+1 -1
ファイルの表示
@@ -107,7 +107,7 @@ public abstract unsafe partial class TransferTexture2D<T> : IReferenceTrackedObj
/// <summary>
/// Gets the <see cref="ID3D12Resource"/> instance currently mapped.
/// </summary>
internal ID3D12Resource* D3D12Resource => this.d3D12Resource;
internal ID3D12Resource* D3D12Resource => this.d3D12Resource.Get();
/// <summary>
/// Gets the <see cref="D3D12_PLACED_SUBRESOURCE_FOOTPRINT"/> value for the current resource.
+1 -1
ファイルの表示
@@ -115,7 +115,7 @@ public abstract unsafe partial class TransferTexture3D<T> : IReferenceTrackedObj
/// <summary>
/// Gets the <see cref="ID3D12Resource"/> instance currently mapped.
/// </summary>
internal ID3D12Resource* D3D12Resource => this.d3D12Resource;
internal ID3D12Resource* D3D12Resource => this.d3D12Resource.Get();
/// <summary>
/// Gets the <see cref="D3D12_PLACED_SUBRESOURCE_FOOTPRINT"/> value for the current resource.
+2 -2
ファイルの表示
@@ -35,12 +35,12 @@ internal sealed unsafe class PipelineData : ReferenceTrackedObject
/// <summary>
/// Gets the <see cref="ID3D12RootSignature"/> instance for the current <see cref="PipelineData"/> object.
/// </summary>
public ID3D12RootSignature* D3D12RootSignature => this.d3D12RootSignature;
public ID3D12RootSignature* D3D12RootSignature => this.d3D12RootSignature.Get();
/// <summary>
/// Gets the <see cref="ID3D12PipelineState"/> instance for the current <see cref="PipelineData"/> object.
/// </summary>
public ID3D12PipelineState* D3D12PipelineState => this.d3D12PipelineState;
public ID3D12PipelineState* D3D12PipelineState => this.d3D12PipelineState.Get();
/// <inheritdoc/>
protected override void DangerousOnDispose()
-20
ファイルの表示
@@ -98,26 +98,6 @@ internal unsafe struct ComPtr<T> : IDisposable
InternalAddRef();
}
/// <summary>Creates a new <see cref="ComPtr{T}"/> instance from a second one and increments the ref count.</summary>
/// <param name="other">The other <see cref="ComPtr{T}"/> instance to copy.</param>
public ComPtr(ComPtr<T> other)
{
ptr_ = other.ptr_;
InternalAddRef();
}
/// <summary>Converts a raw pointer to a new <see cref="ComPtr{T}"/> instance and increments the ref count.</summary>
/// <param name="other">The raw pointer to wrap.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator ComPtr<T>(T* other)
=> new ComPtr<T>(other);
/// <summary>Unwraps a <see cref="ComPtr{T}"/> instance and returns the internal raw pointer.</summary>
/// <param name="other">The <see cref="ComPtr{T}"/> instance to unwrap.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator T*(ComPtr<T> other)
=> other.Get();
/// <summary>Converts the current object reference to type <typeparamref name="U"/> and assigns that to a target <see cref="ComPtr{T}"/> value.</summary>
/// <typeparam name="U">The interface type to use to try casting the current COM object.</typeparam>
/// <param name="p">A raw pointer to the target <see cref="ComPtr{T}"/> value to write to.</param>