Move ComPtr<T> static helpers to ComPtr type

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

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

@@ -311,7 +311,7 @@ partial struct PixelShaderEffect
try
{
// Store the new ID2D1DrawInfo object
ComPtr<ID2D1DrawInfo>.CopyTo(drawInfo, ref @this->d2D1DrawInfo);
ComPtr.CopyTo(drawInfo, ref @this->d2D1DrawInfo);
Guid shaderId = @this->GetGlobals().EffectId;
D2D1PixelOptions pixelOptions = @this->GetGlobals().PixelOptions;
@@ -115,7 +115,7 @@ internal unsafe partial struct PixelShaderEffect
transformGraph->SetSingleTransformNode((ID2D1TransformNode*)&@this->lpVtblForID2D1DrawTransform).Assert();
// Store the new ID2D1EffectContext object
ComPtr<ID2D1EffectContext>.CopyTo(effectContext, ref @this->d2D1EffectContext);
ComPtr.CopyTo(effectContext, ref @this->d2D1EffectContext);
return S.S_OK;
}
+2 -2
ファイルの表示
@@ -251,7 +251,7 @@ unsafe partial struct PixelShaderEffect
unknown.CopyTo(transformMapper.GetAddressOf()).Assert();
// If there's already an existing manager, release it
ComPtr<ID2D1TransformMapper>.Release(@this->d2D1TransformMapper);
ComPtr.Release(@this->d2D1TransformMapper);
// Store the transform mapper manager into the effect
@this->d2D1TransformMapper = transformMapper.Detach();
@@ -343,7 +343,7 @@ unsafe partial struct PixelShaderEffect
ref ID2D1ResourceTextureManager* currentResourceTextureManager = ref this.resourceTextureManagerBuffer[index];
// If there's already an existing manager at this index, release it
ComPtr<ID2D1ResourceTextureManager>.Release(currentResourceTextureManager);
ComPtr.Release(currentResourceTextureManager);
// Store the resource texture manager into the buffer
currentResourceTextureManager = resourceTextureManager.Detach();
+4 -5
ファイルの表示
@@ -2,7 +2,6 @@ using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
using ComputeSharp.D2D1.Shaders.Interop.Effects.ResourceManagers;
using ComputeSharp.D2D1.Shaders.Interop.Effects.TransformMappers;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
@@ -232,16 +231,16 @@ internal unsafe partial struct PixelShaderEffect
NativeMemory.Free(this.constantBuffer);
ComPtr<ID2D1TransformMapper>.Release(this.d2D1TransformMapper);
ComPtr<ID2D1DrawInfo>.Release(this.d2D1DrawInfo);
ComPtr<ID2D1EffectContext>.Release(this.d2D1EffectContext);
ComPtr.Release(this.d2D1TransformMapper);
ComPtr.Release(this.d2D1DrawInfo);
ComPtr.Release(this.d2D1EffectContext);
// Retrieve all possible resource texture managers in use and release the ones that had been
// assigned (from one of the property bindings). We just hardcode 16 here and dont access
// the globals, as technically invoking APIs on it might throw an exception.
for (int i = 0; i < 16; i++)
{
ComPtr<ID2D1ResourceTextureManager>.Release(this.resourceTextureManagerBuffer[i]);
ComPtr.Release(this.resourceTextureManagerBuffer[i]);
}
NativeMemory.Free(Unsafe.AsPointer(ref this));
@@ -124,7 +124,7 @@ partial struct D2D1ResourceTextureManagerImpl
// Now, the effect context can actually be stored safely while holding the lock.
// This is guaranteed to be the case here, as this method is only called (as per
// contact of the COM interface) from ID2D1EffectImpl, which holds the D2D lock.
ComPtr<ID2D1EffectContext>.WriteTo(effectContext, out @this->d2D1EffectContext);
ComPtr.WriteTo(effectContext, out @this->d2D1EffectContext);
@this->d2D1Multithread = d2D1Multithread.Detach();
}
@@ -161,7 +161,7 @@ partial struct D2D1ResourceTextureManagerImpl
// If the texture has already been created, just return it
if (@this->d2D1ResourceTexture is not null)
{
ComPtr<ID2D1ResourceTexture>.WriteTo(@this->d2D1ResourceTexture, out *resourceTexture);
ComPtr.WriteTo(@this->d2D1ResourceTexture, out *resourceTexture);
return S.S_OK;
}
@@ -249,7 +249,7 @@ internal unsafe partial struct D2D1ResourceTextureManagerImpl
this.d2D1Multithread->Enter();
// Release the resource too if it has been created
ComPtr<ID2D1ResourceTexture>.Release(this.d2D1ResourceTexture);
ComPtr.Release(this.d2D1ResourceTexture);
// Now that the resource, if any, has been released, the effect context can also
// be released. This must be done only after any associated resource textures have