Skip to content

Commit d8706d4

Browse files
Full cleanup pass
1 parent a50e945 commit d8706d4

53 files changed

Lines changed: 487 additions & 1181 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/ImageSharp.Drawing.WebGPU/RemoteExecutor/RemoteExecutor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace SixLabors.ImageSharp.Drawing.Processing.Backends;
1010
/// <summary>
1111
/// Minimal remote executor that invokes a named method in a child process.
1212
/// The child process entry point (<see cref="Program.Main"/>) dispatches to
13-
/// the requested method by name no reflection is used.
13+
/// the requested method by name; no reflection is used.
1414
/// Adapted from Microsoft.DotNet.RemoteExecutor (MIT license).
1515
/// </summary>
1616
internal static class RemoteExecutor
@@ -49,7 +49,7 @@ static RemoteExecutor()
4949
// Walk up from the runtime directory to find the dotnet host executable.
5050
// The runtime directory is typically:
5151
// <dotnet_root>/shared/Microsoft.NETCore.App/<version>/
52-
// so dotnet.exe is 34 levels up depending on trailing separator.
52+
// so dotnet.exe is 3-4 levels up depending on trailing separator.
5353
string? directory = RuntimeEnvironment.GetRuntimeDirectory();
5454
for (int i = 0; i < 4 && directory is not null; i++)
5555
{

src/ImageSharp.Drawing.WebGPU/WebGPUDeviceContext{TPixel}.cs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ public WebGPUDeviceContext(Configuration configuration)
3838

3939
try
4040
{
41-
if (!WebGPURuntime.TryGetOrCreateDevice(out WebGPUDeviceHandle? deviceHandle, out WebGPUQueueHandle? queueHandle, out WebGPUEnvironmentError errorCode)
41+
if (!WebGPURuntime.TryGetOrCreateDevice(
42+
out WebGPUDeviceHandle? deviceHandle,
43+
out WebGPUQueueHandle? queueHandle,
44+
out WebGPUEnvironmentError errorCode)
4245
|| deviceHandle is null
4346
|| queueHandle is null)
4447
{
@@ -121,10 +124,9 @@ internal WebGPUDeviceContext(Configuration configuration, WebGPUDeviceHandle dev
121124

122125
/// <summary>
123126
/// Gets the WebGPU drawing backend owned by this context.
124-
/// Use this to inspect per-flush diagnostics
125-
/// (<see cref="WebGPUDrawingBackend.DiagnosticLastFlushUsedGPU"/>,
126-
/// <see cref="WebGPUDrawingBackend.DiagnosticLastSceneFailure"/>) when you need to confirm whether the staged
127-
/// GPU path executed or fell back to the CPU backend.
127+
/// Use this to inspect per-flush diagnostics such as
128+
/// <see cref="WebGPUDrawingBackend.DiagnosticLastFlushUsedGPU"/> and
129+
/// <see cref="WebGPUDrawingBackend.DiagnosticLastSceneFailure"/>.
128130
/// </summary>
129131
public WebGPUDrawingBackend Backend { get; }
130132

@@ -154,15 +156,15 @@ public WebGPURenderTarget<TPixel> CreateRenderTarget(int width, int height)
154156
}
155157

156158
/// <summary>
157-
/// Creates a native-only frame over an externally-owned WebGPU texture and view typically the per-frame
159+
/// Creates a frame over an externally-owned WebGPU texture and view, typically the per-frame
158160
/// swap-chain back buffer obtained from <c>wgpuSurfaceGetCurrentTexture</c> on a host-owned surface.
159161
/// </summary>
160162
/// <param name="textureHandle">The external WebGPU texture handle.</param>
161163
/// <param name="textureViewHandle">The external WebGPU texture-view handle.</param>
162164
/// <param name="format">The texture format identifier. Must match the format expected for <typeparamref name="TPixel"/>.</param>
163165
/// <param name="width">The frame width in pixels.</param>
164166
/// <param name="height">The frame height in pixels.</param>
165-
/// <returns>A native-only canvas frame.</returns>
167+
/// <returns>A canvas frame backed by the external WebGPU texture.</returns>
166168
/// <remarks>
167169
/// The caller retains ownership of the texture and view; this context does not release them.
168170
/// The texture must have been created with <c>RenderAttachment | TextureBinding</c> usage.
@@ -178,7 +180,7 @@ public NativeCanvasFrame<TPixel> CreateFrame(
178180
=> this.CreateFrame(CreateExternalTextureHandle(textureHandle), CreateExternalTextureViewHandle(textureViewHandle), format, width, height);
179181

180182
/// <summary>
181-
/// Creates a drawing canvas that renders directly into an externally-owned WebGPU texture typically the per-frame
183+
/// Creates a drawing canvas that renders directly into an externally-owned WebGPU texture, typically the per-frame
182184
/// swap-chain back buffer obtained from <c>wgpuSurfaceGetCurrentTexture</c> on a host-owned surface.
183185
/// </summary>
184186
/// <param name="textureHandle">The external WebGPU texture handle.</param>
@@ -198,10 +200,16 @@ public DrawingCanvas<TPixel> CreateCanvas(
198200
WebGPUTextureFormatId format,
199201
int width,
200202
int height)
201-
=> this.CreateCanvas(CreateExternalTextureHandle(textureHandle), CreateExternalTextureViewHandle(textureViewHandle), format, width, height, new DrawingOptions());
203+
=> this.CreateCanvas(
204+
CreateExternalTextureHandle(textureHandle),
205+
CreateExternalTextureViewHandle(textureViewHandle),
206+
format,
207+
width,
208+
height,
209+
new DrawingOptions());
202210

203211
/// <summary>
204-
/// Creates a drawing canvas that renders directly into an externally-owned WebGPU texture typically the per-frame
212+
/// Creates a drawing canvas that renders directly into an externally-owned WebGPU texture, typically the per-frame
205213
/// swap-chain back buffer obtained from <c>wgpuSurfaceGetCurrentTexture</c> on a host-owned surface.
206214
/// </summary>
207215
/// <param name="textureHandle">The external WebGPU texture handle.</param>
@@ -246,14 +254,14 @@ internal void ThrowIfDisposed()
246254
=> ObjectDisposedException.ThrowIf(this.isDisposed, this);
247255

248256
/// <summary>
249-
/// Creates a native-only frame over wrapped texture handles that are already in this assembly's ownership model.
257+
/// Creates a frame over wrapped texture handles that are already in this assembly's ownership model.
250258
/// </summary>
251259
/// <param name="textureHandle">The wrapped texture handle.</param>
252260
/// <param name="textureViewHandle">The wrapped texture-view handle.</param>
253261
/// <param name="format">The texture format identifier.</param>
254262
/// <param name="width">The frame width in pixels.</param>
255263
/// <param name="height">The frame height in pixels.</param>
256-
/// <returns>A native-only frame over the supplied handles.</returns>
264+
/// <returns>A frame backed by the supplied handles.</returns>
257265
internal NativeCanvasFrame<TPixel> CreateFrame(
258266
WebGPUTextureHandle textureHandle,
259267
WebGPUTextureViewHandle textureViewHandle,

0 commit comments

Comments
 (0)