Fix build errors due to .editorconfig warnings
このコミットが含まれているのは:
1 親
f6160a2062
コミット
ac7010a730
12ファイル変更
+132
-90
検索条件に一致するファイルはありません
+29
-1
@@ -3,9 +3,37 @@
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>11.0</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<Features>strict</Features>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
|
||||
<!--
|
||||
Enable the latest warning wave, which shows additional warnings for invalid language features that are disabled by default.
|
||||
For additional info, see https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/warning-waves.
|
||||
-->
|
||||
<AnalysisLevel>7</AnalysisLevel>
|
||||
|
||||
<!--
|
||||
Enable the compiler strict mode (see https://www.meziantou.net/csharp-compiler-strict-mode.htm).
|
||||
This (poorly documented) mode enables additional warnings for incorrect usages of some features.
|
||||
For instance, this will warn when using the == operator to compare a struct with a null literal.
|
||||
-->
|
||||
<Features>strict</Features>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
<!--
|
||||
This ignores the following warning:
|
||||
"MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the
|
||||
processor architecture of the reference". It pops up because all samples are only targeting x64/Arm64.
|
||||
-->
|
||||
<NoWarn>$(NoWarn);MSB3270</NoWarn>
|
||||
|
||||
<!--
|
||||
This ignores the following warning:
|
||||
"CA1060: Move P/Invokes to NativeMethods class". The whole repository is full of P/Invoke-s everywhere.
|
||||
See: https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1060.
|
||||
-->
|
||||
<NoWarn>$(NoWarn);CA1060</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -3,6 +3,8 @@ using System.Buffers;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Engines;
|
||||
|
||||
#pragma warning disable CA1063
|
||||
|
||||
namespace ComputeSharp.Benchmark.Blas;
|
||||
|
||||
/// <summary>
|
||||
@@ -17,64 +19,64 @@ public class BlasBenchmark : IDisposable
|
||||
private const int C = 128;
|
||||
|
||||
/// <summary>
|
||||
/// The nummber of rows in the <see cref="X"/> matrix.
|
||||
/// The nummber of rows in the <see cref="x"/> matrix.
|
||||
/// </summary>
|
||||
private const int N = 512;
|
||||
|
||||
/// <summary>
|
||||
/// The number of columns in the <see cref="X"/> matrix (same as the number of rows in the <see cref="W"/> matrix)
|
||||
/// The number of columns in the <see cref="x"/> matrix (same as the number of rows in the <see cref="w"/> matrix)
|
||||
/// </summary>
|
||||
private const int M = 512;
|
||||
|
||||
/// <summary>
|
||||
/// The number of columns in the <see cref="W"/> matrix.
|
||||
/// The number of columns in the <see cref="w"/> matrix.
|
||||
/// </summary>
|
||||
private const int P = 256;
|
||||
|
||||
/// <summary>
|
||||
/// The input tensor.
|
||||
/// </summary>
|
||||
private float[]? X;
|
||||
private float[]? x;
|
||||
|
||||
/// <summary>
|
||||
/// The weights tensor.
|
||||
/// </summary>
|
||||
private float[]? W;
|
||||
private float[]? w;
|
||||
|
||||
/// <summary>
|
||||
/// The bias tensor.
|
||||
/// </summary>
|
||||
private float[]? B;
|
||||
private float[]? b;
|
||||
|
||||
/// <summary>
|
||||
/// The result tensor.
|
||||
/// </summary>
|
||||
private float[]? Y;
|
||||
private float[]? y;
|
||||
|
||||
/// <summary>
|
||||
/// The input tensor (GPU).
|
||||
/// </summary>
|
||||
private ReadOnlyBuffer<float>? BufferX;
|
||||
private ReadOnlyBuffer<float>? bufferX;
|
||||
|
||||
/// <summary>
|
||||
/// The weights tensor (GPU).
|
||||
/// </summary>
|
||||
private ReadOnlyBuffer<float>? BufferW;
|
||||
private ReadOnlyBuffer<float>? bufferW;
|
||||
|
||||
/// <summary>
|
||||
/// The bias tensor (GPU).
|
||||
/// </summary>
|
||||
private ReadOnlyBuffer<float>? BufferB;
|
||||
private ReadOnlyBuffer<float>? bufferB;
|
||||
|
||||
/// <summary>
|
||||
/// The result tensor (GPU).
|
||||
/// </summary>
|
||||
private ReadWriteBuffer<float>? BufferY;
|
||||
private ReadWriteBuffer<float>? bufferY;
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="System.Random"/> instance to initialize the tensors.
|
||||
/// </summary>
|
||||
private readonly Random Random = new Random();
|
||||
private readonly Random random = new();
|
||||
|
||||
/// <summary>
|
||||
/// Initial setup for a benchmarking session.
|
||||
@@ -89,21 +91,21 @@ public class BlasBenchmark : IDisposable
|
||||
|
||||
foreach (ref float x in array.AsSpan())
|
||||
{
|
||||
x = (float)Random.NextDouble();
|
||||
x = (float)this.random.NextDouble();
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
X = CreateRandomArray(C * N * M);
|
||||
W = CreateRandomArray(M * P);
|
||||
B = CreateRandomArray(P);
|
||||
Y = CreateRandomArray(C * N * P);
|
||||
this.x = CreateRandomArray(C * N * M);
|
||||
this.w = CreateRandomArray(M * P);
|
||||
this.b = CreateRandomArray(P);
|
||||
this.y = CreateRandomArray(C * N * P);
|
||||
|
||||
BufferX = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(X);
|
||||
BufferW = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(W);
|
||||
BufferB = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(B);
|
||||
BufferY = GraphicsDevice.GetDefault().AllocateReadWriteBuffer(Y);
|
||||
this.bufferX = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(this.x);
|
||||
this.bufferW = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(this.w);
|
||||
this.bufferB = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(this.b);
|
||||
this.bufferY = GraphicsDevice.GetDefault().AllocateReadWriteBuffer(this.y);
|
||||
|
||||
Cpu();
|
||||
GpuWithNoTemporaryBuffers();
|
||||
@@ -114,15 +116,15 @@ public class BlasBenchmark : IDisposable
|
||||
[GlobalCleanup]
|
||||
public void Dispose()
|
||||
{
|
||||
ArrayPool<float>.Shared.Return(X!);
|
||||
ArrayPool<float>.Shared.Return(W!);
|
||||
ArrayPool<float>.Shared.Return(B!);
|
||||
ArrayPool<float>.Shared.Return(Y!);
|
||||
ArrayPool<float>.Shared.Return(this.x!);
|
||||
ArrayPool<float>.Shared.Return(this.w!);
|
||||
ArrayPool<float>.Shared.Return(this.b!);
|
||||
ArrayPool<float>.Shared.Return(this.y!);
|
||||
|
||||
BufferX!.Dispose();
|
||||
BufferW!.Dispose();
|
||||
BufferB!.Dispose();
|
||||
BufferY!.Dispose();
|
||||
this.bufferX!.Dispose();
|
||||
this.bufferW!.Dispose();
|
||||
this.bufferB!.Dispose();
|
||||
this.bufferY!.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -131,7 +133,7 @@ public class BlasBenchmark : IDisposable
|
||||
[Benchmark(Baseline = true)]
|
||||
public void Cpu()
|
||||
{
|
||||
BlasHelpers.FullyConnectedForwardCpu(C, N, M, P, X!, W!, B!, Y!);
|
||||
BlasHelpers.FullyConnectedForwardCpu(C, N, M, P, this.x!, this.w!, this.b!, this.y!);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -140,7 +142,7 @@ public class BlasBenchmark : IDisposable
|
||||
[Benchmark]
|
||||
public void GpuWithNoTemporaryBuffers()
|
||||
{
|
||||
BlasHelpers.FullyConnectedForwardGpu(GraphicsDevice.GetDefault(), C, N, M, P, BufferX!, BufferW!, BufferB!, BufferY!);
|
||||
BlasHelpers.FullyConnectedForwardGpu(GraphicsDevice.GetDefault(), C, N, M, P, this.bufferX!, this.bufferW!, this.bufferB!, this.bufferY!);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -149,13 +151,13 @@ public class BlasBenchmark : IDisposable
|
||||
[Benchmark]
|
||||
public void GpuWithTemporaryBuffers()
|
||||
{
|
||||
using ReadOnlyBuffer<float> x = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(X!);
|
||||
using ReadOnlyBuffer<float> w = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(W!);
|
||||
using ReadOnlyBuffer<float> b = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(B!);
|
||||
using ReadWriteBuffer<float> y = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(Y!.Length);
|
||||
using ReadOnlyBuffer<float> x = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(this.x!);
|
||||
using ReadOnlyBuffer<float> w = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(this.w!);
|
||||
using ReadOnlyBuffer<float> b = GraphicsDevice.GetDefault().AllocateReadOnlyBuffer(this.b!);
|
||||
using ReadWriteBuffer<float> y = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(this.y!.Length);
|
||||
|
||||
BlasHelpers.FullyConnectedForwardGpu(GraphicsDevice.GetDefault(), C, N, M, P, x, w, b, y);
|
||||
|
||||
y.CopyTo(Y);
|
||||
y.CopyTo(this.y);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,8 @@ using System.Threading.Tasks;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Configs;
|
||||
|
||||
#pragma warning disable CA1063
|
||||
|
||||
namespace ComputeSharp.Benchmark.Blas;
|
||||
|
||||
/// <summary>
|
||||
@@ -15,7 +17,7 @@ public partial class DispatchingBenchmark : IDisposable
|
||||
/// <summary>
|
||||
/// The test buffer.
|
||||
/// </summary>
|
||||
private ReadWriteBuffer<float>? Buffer;
|
||||
private ReadWriteBuffer<float>? buffer;
|
||||
|
||||
/// <summary>
|
||||
/// Initial setup for a benchmarking session.
|
||||
@@ -23,14 +25,14 @@ public partial class DispatchingBenchmark : IDisposable
|
||||
[GlobalSetup]
|
||||
public void Setup()
|
||||
{
|
||||
Buffer = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(128);
|
||||
this.buffer = GraphicsDevice.GetDefault().AllocateReadWriteBuffer<float>(128);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
[GlobalCleanup]
|
||||
public void Dispose()
|
||||
{
|
||||
Buffer!.Dispose();
|
||||
this.buffer!.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -40,7 +42,7 @@ public partial class DispatchingBenchmark : IDisposable
|
||||
[BenchmarkCategory("SINGLE")]
|
||||
public void Compute_Single()
|
||||
{
|
||||
GraphicsDevice.GetDefault().For(64, new TestShader(Buffer!));
|
||||
GraphicsDevice.GetDefault().For(64, new TestShader(this.buffer!));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -50,9 +52,9 @@ public partial class DispatchingBenchmark : IDisposable
|
||||
[BenchmarkCategory("SINGLE")]
|
||||
public void Compute_Single_WithContext()
|
||||
{
|
||||
using var context = GraphicsDevice.GetDefault().CreateComputeContext();
|
||||
using ComputeContext context = GraphicsDevice.GetDefault().CreateComputeContext();
|
||||
|
||||
context.For(64, new TestShader(Buffer!));
|
||||
context.For(64, new TestShader(this.buffer!));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -62,9 +64,9 @@ public partial class DispatchingBenchmark : IDisposable
|
||||
[BenchmarkCategory("SINGLE")]
|
||||
public async Task Compute_Single_WithContext_Async()
|
||||
{
|
||||
await using var context = GraphicsDevice.GetDefault().CreateComputeContext();
|
||||
await using ComputeContext context = GraphicsDevice.GetDefault().CreateComputeContext();
|
||||
|
||||
context.For(64, new TestShader(Buffer!));
|
||||
context.For(64, new TestShader(this.buffer!));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -74,8 +76,8 @@ public partial class DispatchingBenchmark : IDisposable
|
||||
[BenchmarkCategory("MULTIPLE")]
|
||||
public void Compute_Multiple()
|
||||
{
|
||||
GraphicsDevice.GetDefault().For(64, new TestShader(Buffer!));
|
||||
GraphicsDevice.GetDefault().For(64, new TestShader(Buffer!));
|
||||
GraphicsDevice.GetDefault().For(64, new TestShader(this.buffer!));
|
||||
GraphicsDevice.GetDefault().For(64, new TestShader(this.buffer!));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -85,11 +87,11 @@ public partial class DispatchingBenchmark : IDisposable
|
||||
[BenchmarkCategory("MULTIPLE")]
|
||||
public void Compute_Multiple_WithContext()
|
||||
{
|
||||
using var context = GraphicsDevice.GetDefault().CreateComputeContext();
|
||||
using ComputeContext context = GraphicsDevice.GetDefault().CreateComputeContext();
|
||||
|
||||
context.For(64, new TestShader(Buffer!));
|
||||
context.Barrier(Buffer!);
|
||||
context.For(64, new TestShader(Buffer!));
|
||||
context.For(64, new TestShader(this.buffer!));
|
||||
context.Barrier(this.buffer!);
|
||||
context.For(64, new TestShader(this.buffer!));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -99,11 +101,11 @@ public partial class DispatchingBenchmark : IDisposable
|
||||
[BenchmarkCategory("MULTIPLE")]
|
||||
public async Task Compute_Multiple_WithContext_Async()
|
||||
{
|
||||
await using var context = GraphicsDevice.GetDefault().CreateComputeContext();
|
||||
await using ComputeContext context = GraphicsDevice.GetDefault().CreateComputeContext();
|
||||
|
||||
context.For(64, new TestShader(Buffer!));
|
||||
context.Barrier(Buffer!);
|
||||
context.For(64, new TestShader(Buffer!));
|
||||
context.For(64, new TestShader(this.buffer!));
|
||||
context.Barrier(this.buffer!);
|
||||
context.For(64, new TestShader(this.buffer!));
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
|
||||
@@ -10,6 +10,8 @@ using SixLabors.ImageSharp.Processing;
|
||||
using SixLabors.ImageSharp.Processing.Processors.Convolution;
|
||||
using ImageSharpRgba32 = SixLabors.ImageSharp.PixelFormats.Rgba32;
|
||||
|
||||
#pragma warning disable CA1063
|
||||
|
||||
namespace ComputeSharp.Benchmark.Imaging;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\ARM64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<NoWarn>$(NoWarn);2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>ARM64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
@@ -36,7 +36,7 @@
|
||||
<OutputPath>bin\ARM64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<NoWarn>$(NoWarn);2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>ARM64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
@@ -48,7 +48,7 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<NoWarn>$(NoWarn);2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
@@ -59,7 +59,7 @@
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<NoWarn>$(NoWarn);2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
|
||||
@@ -3,6 +3,8 @@ using System.Threading;
|
||||
using ComputeSharp.SwapChain.WinUI.Views;
|
||||
using Microsoft.UI.Xaml;
|
||||
|
||||
#pragma warning disable CA1001
|
||||
|
||||
namespace ComputeSharp.SwapChain.WinUI;
|
||||
|
||||
/// <summary>
|
||||
@@ -27,25 +29,26 @@ public sealed partial class App : Application
|
||||
/// </summary>
|
||||
public App()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override void OnLaunched(LaunchActivatedEventArgs args)
|
||||
{
|
||||
mainWindow = new MainWindow();
|
||||
mainWindow.Closed += (_, _) =>
|
||||
this.mainWindow = new MainWindow();
|
||||
this.mainWindow.Closed += (_, _) =>
|
||||
{
|
||||
// Due to an issue (https://discord.com/channels/372137812037730304/663434534087426129/979543152853663744), the WinUI 3 app
|
||||
// will keep running after the window is closed if any render thread is still going. To work around this, each loaded shader
|
||||
// panel is tracked in a conditional weak table, and then when the window is closed they're all manually stopped by setting
|
||||
// their shader runners to null. After this, the app should just be able to close automatically when the panels are done.
|
||||
mainWindow.OnShutdown();
|
||||
this.mainWindow.OnShutdown();
|
||||
|
||||
// For good measure, also start a timer of one second. If the app is still alive by then (ie. if the timer callback is
|
||||
// executed at all), then just force the whole process to terminate, and exit with the E_APPLICATION_EXITING error code.
|
||||
shutdownTimer = new Timer(_ => Environment.Exit(unchecked((int)(0x8000001A))), this, 1000, Timeout.Infinite);
|
||||
this.shutdownTimer = new Timer(_ => Environment.Exit(unchecked((int)(0x8000001A))), this, 1000, Timeout.Infinite);
|
||||
};
|
||||
mainWindow.Activate();
|
||||
|
||||
this.mainWindow.Activate();
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,8 @@ using RuntimeHelpers = System.Runtime.CompilerServices.RuntimeHelpers;
|
||||
using RuntimeHelpers = ComputeSharp.D2D1.NetStandard.System.Runtime.CompilerServices.RuntimeHelpers;
|
||||
#endif
|
||||
|
||||
#pragma warning disable CA2002
|
||||
|
||||
namespace ComputeSharp.D2D1.Interop.Effects;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -43,17 +43,18 @@ internal unsafe partial struct PixelShaderEffect
|
||||
/// <summary>
|
||||
/// The shared vtable pointer for <see cref="PixelShaderEffect"/> instance, for <see cref="ID2D1EffectImplMethods"/>.
|
||||
/// </summary>
|
||||
private static readonly void** VtblForID2D1EffectImpl;
|
||||
private static readonly void** VtblForID2D1EffectImpl = InitVtblForID2D1EffectImplAndID2D1DrawTransform();
|
||||
|
||||
/// <summary>
|
||||
/// The shared vtable pointer for <see cref="PixelShaderEffect"/> instance, for <see cref="ID2D1DrawTransform"/>.
|
||||
/// </summary>
|
||||
private static readonly void** VtblForID2D1DrawTransform;
|
||||
private static readonly void** VtblForID2D1DrawTransform = &VtblForID2D1EffectImpl[6];
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the shared state for <see cref="PixelShaderEffect"/>.
|
||||
/// Initializes the combined vtable for <see cref="ID2D1EffectImpl"/> and <see cref="ID2D1DrawTransform"/>.
|
||||
/// </summary>
|
||||
static PixelShaderEffect()
|
||||
/// <returns>The combined vtable for <see cref="ID2D1EffectImpl"/> and <see cref="ID2D1DrawTransform"/>.</returns>
|
||||
private static void** InitVtblForID2D1EffectImplAndID2D1DrawTransform()
|
||||
{
|
||||
void** lpVtbl = (void**)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(PixelShaderEffect), sizeof(void*) * 14);
|
||||
|
||||
@@ -95,8 +96,7 @@ internal unsafe partial struct PixelShaderEffect
|
||||
lpVtbl[6 + 7] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1DrawTransformMethods.SetDrawInfoWrapper);
|
||||
#endif
|
||||
|
||||
VtblForID2D1EffectImpl = lpVtbl;
|
||||
VtblForID2D1DrawTransform = &lpVtbl[6];
|
||||
return lpVtbl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -363,7 +363,7 @@ internal unsafe partial struct PixelShaderEffect
|
||||
// Then, retrieve all of them and release the ones that had been assigned (from one of the property bindings).
|
||||
foreach (ref readonly D2D1ResourceTextureDescription resourceTextureDescription in new ReadOnlySpan<D2D1ResourceTextureDescription>(this.resourceTextureDescriptions, this.resourceTextureDescriptionCount))
|
||||
{
|
||||
ID2D1ResourceTextureManager* resourceTextureManager = resourceTextureManagerBuffer[resourceTextureDescription.Index];
|
||||
ID2D1ResourceTextureManager* resourceTextureManager = this.resourceTextureManagerBuffer[resourceTextureDescription.Index];
|
||||
|
||||
if (resourceTextureManager is not null)
|
||||
{
|
||||
|
||||
+10
-9
@@ -32,17 +32,18 @@ internal unsafe partial struct D2D1ResourceTextureManagerImpl
|
||||
/// <summary>
|
||||
/// The shared vtable pointer for <see cref="D2D1ResourceTextureManagerImpl"/> instance, for <c>ID2D1ResourceTextureManager</c>.
|
||||
/// </summary>
|
||||
private static readonly void** VtblForID2D1ResourceTextureManager;
|
||||
private static readonly void** VtblForID2D1ResourceTextureManager = InitVtblForID2D1ResourceTextureManagerAndID2D1ResourceTextureManagerInternal();
|
||||
|
||||
/// <summary>
|
||||
/// The shared vtable pointer for <see cref="D2D1ResourceTextureManagerImpl"/> instance, for <c>ID2D1ResourceTextureManagerInternal</c>.
|
||||
/// </summary>
|
||||
private static readonly void** VtblForID2D1ResourceTextureManagerInternal;
|
||||
private static readonly void** VtblForID2D1ResourceTextureManagerInternal = &VtblForID2D1ResourceTextureManager[5];
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the shared state for <see cref="D2D1ResourceTextureManagerImpl"/>.
|
||||
/// Initializes the combined vtable for <c>ID2D1ResourceTextureManager</c> and <c>ID2D1ResourceTextureManagerInternal</c>.
|
||||
/// </summary>
|
||||
static D2D1ResourceTextureManagerImpl()
|
||||
/// <returns>The combined vtable for <c>ID2D1ResourceTextureManager</c> and <c>ID2D1ResourceTextureManagerInternal</c>.</returns>
|
||||
private static void** InitVtblForID2D1ResourceTextureManagerAndID2D1ResourceTextureManagerInternal()
|
||||
{
|
||||
void** lpVtbl = (void**)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(D2D1ResourceTextureManagerImpl), sizeof(void*) * 10);
|
||||
|
||||
@@ -76,8 +77,7 @@ internal unsafe partial struct D2D1ResourceTextureManagerImpl
|
||||
lpVtbl[5 + 4] = (void*)Marshal.GetFunctionPointerForDelegate(ID2D1ResourceTextureManagerInternalMethods.GetResourceTextureWrapper);
|
||||
#endif
|
||||
|
||||
VtblForID2D1ResourceTextureManager = lpVtbl;
|
||||
VtblForID2D1ResourceTextureManagerInternal = &lpVtbl[5];
|
||||
return lpVtbl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -249,17 +249,18 @@ internal unsafe partial struct D2D1ResourceTextureManagerImpl
|
||||
// Release the resource too if it has been created
|
||||
if (this.d2D1ResourceTexture is not null)
|
||||
{
|
||||
this.d2D1ResourceTexture->Release();
|
||||
_ = this.d2D1ResourceTexture->Release();
|
||||
}
|
||||
|
||||
// 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
|
||||
// been released. Releasing an effect context first, in case it was the last reference
|
||||
// to it, will otherwise cause the Release() call on the resource texture to explode.
|
||||
this.d2D1EffectContext->Release();
|
||||
_ = this.d2D1EffectContext->Release();
|
||||
|
||||
this.d2D1Multithread->Leave();
|
||||
this.d2D1Multithread->Release();
|
||||
|
||||
_ = this.d2D1Multithread->Release();
|
||||
}
|
||||
|
||||
if (this.resourceId is not null)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using System;
|
||||
|
||||
#pragma warning disable CA1063
|
||||
|
||||
namespace ComputeSharp.Interop;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
|
||||
#pragma warning disable CS0809
|
||||
#pragma warning disable CS0809, CA1065
|
||||
|
||||
namespace ComputeSharp;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace ComputeSharp;
|
||||
/// It is recommended to execute as much computation on the GPU side as possible.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of items in the current <see cref="TextureView2D{T}"/> instance.</typeparam>
|
||||
public readonly unsafe ref partial struct TextureView2D<T>
|
||||
public readonly unsafe ref struct TextureView2D<T>
|
||||
where T : unmanaged
|
||||
{
|
||||
// Let's consider a representation of a 2D texture or a generic 2D memory region.
|
||||
@@ -339,7 +339,7 @@ public readonly unsafe ref partial struct TextureView2D<T>
|
||||
|
||||
/// <inheritdoc cref="Span{T}.Equals(object)"/>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("Equals() on Span will always throw an exception. Use == instead.")]
|
||||
[Obsolete("Equals() on TextureView2D<T> will always throw an exception. Use == instead.")]
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
throw new NotSupportedException("ComputeSharp.TextureView2D<T>.Equals(object) is not supported");
|
||||
@@ -347,7 +347,7 @@ public readonly unsafe ref partial struct TextureView2D<T>
|
||||
|
||||
/// <inheritdoc cref="Span{T}.GetHashCode()"/>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("GetHashCode() on Span will always throw an exception.")]
|
||||
[Obsolete("GetHashCode() on TextureView2D<T> will always throw an exception.")]
|
||||
public override int GetHashCode()
|
||||
{
|
||||
throw new NotSupportedException("ComputeSharp.TextureView2D<T>.GetHashCode() is not supported");
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
|
||||
#pragma warning disable CS0809
|
||||
#pragma warning disable CS0809, CA1065
|
||||
|
||||
namespace ComputeSharp;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace ComputeSharp;
|
||||
/// It is recommended to execute as much computation on the GPU side as possible.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of items in the current <see cref="TextureView3D{T}"/> instance.</typeparam>
|
||||
public readonly unsafe ref partial struct TextureView3D<T>
|
||||
public readonly unsafe ref struct TextureView3D<T>
|
||||
where T : unmanaged
|
||||
{
|
||||
// The internal layout of a 3D texture mapped in memory is the same as that of a
|
||||
@@ -396,7 +396,7 @@ public readonly unsafe ref partial struct TextureView3D<T>
|
||||
|
||||
/// <inheritdoc cref="Span{T}.Equals(object)"/>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("Equals() on Span will always throw an exception. Use == instead.")]
|
||||
[Obsolete("Equals() on TextureView3D<T> will always throw an exception. Use == instead.")]
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
throw new NotSupportedException("ComputeSharp.TextureView3D<T>.Equals(object) is not supported");
|
||||
@@ -404,7 +404,7 @@ public readonly unsafe ref partial struct TextureView3D<T>
|
||||
|
||||
/// <inheritdoc cref="Span{T}.GetHashCode()"/>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[Obsolete("GetHashCode() on Span will always throw an exception.")]
|
||||
[Obsolete("GetHashCode() on TextureView3D<T> will always throw an exception.")]
|
||||
public override int GetHashCode()
|
||||
{
|
||||
throw new NotSupportedException("ComputeSharp.TextureView3D<T>.GetHashCode() is not supported");
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする