You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: samples/DrawingBackendBenchmark/README.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,21 +45,21 @@ For each iteration the form:
45
45
4. updates the running mean and standard deviation
46
46
5. captures a preview image only on the last iteration
47
47
48
-
That last point matters: preview capture is intentionally outside the measured timing path. The reported time measures scene submission and backend flush work only. Any readback, clone, or bitmap conversion needed for the UI happens afterward.
48
+
That last point matters: preview capture is intentionally outside the measured timing path. The reported time measures canvas replay and backend submission work only. Any readback, clone, or bitmap conversion needed for the UI happens afterward.
49
49
50
50
## Timing model
51
51
52
52
All backends follow the same basic timing rule:
53
53
54
54
- start the stopwatch immediately before drawing the scene
55
-
- stop it immediately after the backend flush or submission boundary
55
+
- stop it immediately after the backend render or submission boundary
56
56
- capture preview pixels only after the stopwatch stops
57
57
58
58
In practice that means:
59
59
60
-
-`CPU` measures drawing into the cached `Image<Bgra32>` through `DrawingCanvas.Flush()`
60
+
-`CPU` measures drawing into the cached `Image<Bgra32>` through canvas disposal replay
61
61
-`SkiaSharp` measures drawing through `SKCanvas.Flush()` and optional GPU context flush
62
-
-`WebGPU` measures drawing through `DrawingCanvas.Flush()`into the offscreen `WebGPURenderTarget<Bgra32>`
62
+
-`WebGPU` measures drawing through canvas disposal replay into the offscreen `WebGPURenderTarget`
63
63
64
64
So the numbers are comparable as "render and submit" timings, not "render plus preview extraction" timings.
65
65
@@ -69,7 +69,7 @@ The sample uses a fixed benchmark size, so the backends keep their render target
69
69
70
70
-`CpuBenchmarkBackend` caches one `Image<Bgra32>`
71
71
-`SkiaSharpBenchmarkBackend` caches one `SKSurface`
72
-
-`WebGpuBenchmarkBackend` caches one `WebGPURenderTarget<Bgra32>`
72
+
-`WebGpuBenchmarkBackend` caches one `WebGPURenderTarget`
73
73
74
74
This keeps the benchmark focused on scene rendering rather than repeated target allocation noise.
75
75
@@ -78,11 +78,11 @@ This keeps the benchmark focused on scene rendering rather than repeated target
78
78
The WebGPU backend is intentionally small:
79
79
80
80
- it probes support up front with `WebGPUEnvironment.ProbeComputePipelineSupport()`
81
-
- it renders into an owned offscreen `WebGPURenderTarget<Bgra32>`
82
-
- it draws through `CreateCanvas(...)`, not a hybrid CPU plus GPU canvas
81
+
- it renders into an owned offscreen `WebGPURenderTarget`
82
+
- it draws through `CreateCanvas(...)`
83
83
- it reads back the final frame only when the UI requests the last-iteration preview
84
84
85
-
The status line also reports whether the last WebGPU flush completed on the staged GPU path or had to fall back to CPU execution.
85
+
The status line also reports whether the last WebGPU render used chunked staged execution.
- a WebGPU-capable desktop backend such as D3D12 or Vulkan
24
-
- adapter support for the storage-capable BGRA format required by `Bgra32`
24
+
- adapter support for the storage-capable BGRA format selected by the sample
25
25
26
26
When the sample starts you should see a WinForms window with three tabs:
27
27
@@ -31,7 +31,7 @@ When the sample starts you should see a WinForms window with three tabs:
31
31
32
32
## Why This Sample Matters
33
33
34
-
`WebGPUWindow<TPixel>` owns a top-level native window. `WebGPUExternalSurface<TPixel>` is different: it attaches WebGPU rendering to something the application already owns, such as a control, view, widget, or native surface.
34
+
`WebGPUWindow` owns a top-level native window. `WebGPUExternalSurface` is different: it attaches WebGPU rendering to something the application already owns, such as a control, view, widget, or native surface.
35
35
36
36
That makes it the integration path for UI frameworks. The host owns:
37
37
@@ -57,18 +57,22 @@ The reusable integration point is [WebGPURenderControl.cs](d:/GitHub/SixLabors/I
57
57
`WebGPURenderControl.OnHandleCreated(...)` creates the external surface from the WinForms control handle:
`WebGPUSurfaceHost` is a small public descriptor for externally-owned native handles. The host keeps ownership of those handles; `WebGPUExternalSurface<TPixel>` only uses them to create and manage the WebGPU rendering surface.
71
+
`WebGPUSurfaceHost` is a small public descriptor for externally-owned native handles. The host keeps ownership of those handles; `WebGPUExternalSurface` only uses them to create and manage the WebGPU rendering surface.
68
72
69
73
### Resize
70
74
71
-
`WebGPUExternalSurface<TPixel>.Resize(...)` expects the drawable framebuffer size in pixels:
75
+
`WebGPUExternalSurface.Resize(...)` expects the drawable framebuffer size in pixels:
72
76
73
77
```csharp
74
78
this.framebufferSize=this.ClientSize;
@@ -82,7 +86,7 @@ The acquired frame exposes the same pixel coordinate space through `frame.Canvas
82
86
`RenderOnce()` acquires a frame, invokes user drawing code, and disposes the frame:
83
87
84
88
```csharp
85
-
if (!this.surface.TryAcquireFrame(outWebGPUSurfaceFrame<Bgra32>? frame))
89
+
if (!this.surface.TryAcquireFrame(outWebGPUSurfaceFrame? frame))
86
90
{
87
91
return;
88
92
}
@@ -93,7 +97,7 @@ using (frame)
93
97
}
94
98
```
95
99
96
-
Disposing the frame flushes pending canvas work, presents the surface texture, and releases the per-frame WebGPU handles.
100
+
Disposing the frame renders pending canvas work, presents the surface texture, and releases the per-frame WebGPU handles.
0 commit comments