|
| virtual | ~SkiaSurface ()=default |
| virtual canvas::Canvas * | begin_frame ()=0 |
| | Begin a frame: returns a Canvas to draw into, or nullptr on failure.
|
| virtual FrameOutcome | end_frame ()=0 |
| | End a frame: submits the Graphite recording to the GPU, and reports whether the frame reached its intended output.
|
| virtual FrameOutcome | last_frame_outcome () const |
| | Outcome of the most recent begin_frame()/end_frame() pair.
|
| virtual bool | has_presentable_target () const =0 |
| | Whether this surface has a presentable native drawable.
|
| virtual void | resize (uint32_t width, uint32_t height, float scale=1.0f)=0 |
| | Record a new logical size and backing scale.
|
| virtual bool | set_persistent_scene (bool) |
| | Enable/disable persistent-scene mode (partial-repaint support, FU-2).
|
| virtual bool | persistent_scene () const |
| | Whether persistent-scene mode is currently active.
|
| virtual void | set_text_raster_policy (canvas::TextRasterPolicy) |
| | Change the glyph preblend of every surface this one creates.
|
| virtual canvas::TextRasterPolicy | text_raster_policy () const |
| | The policy surfaces are currently created with.
|
| virtual bool | read_current_rgba (std::vector< uint8_t > &pixels, uint32_t &pixel_width, uint32_t &pixel_height)=0 |
| | Read the current rendered frame into an RGBA buffer.
|
| virtual bool | is_available () const =0 |
| | Check if Skia rendering is available.
|
| virtual skgpu::graphite::Context * | graphite_context () const =0 |
| | The live Graphite Context backing this surface, or nullptr when Skia/Graphite is unavailable — including on the Ganesh/WebGL2 backend, which has no Graphite context at all.
|
| virtual double | gpu_render_time_ms () const =0 |
| | Most recent whole-recording GPU render time in milliseconds, sampled from Skia Graphite's GpuStats(kElapsedTime) finished-with-stats callback.
|
| virtual bool | gpu_render_timing_available () const =0 |
| | Whether GPU render timing is available this run — the adapter offered timestamp-query AND Graphite advertises kElapsedTime.
|
| virtual int | gpu_frames_in_flight () const |
| | Frames submitted to the GPU whose work has not finished yet (see GpuFramesInFlight in gpu_render_time.hpp), or -1 when the surface does not track it.
|
| virtual bool | wait_for_submitted_work () |
| | Block until the GPU has finished the work this surface submitted.
|
| virtual void | trim_gpu_resources (TrimLevel) |
| | Return purgeable GPU memory to the device.
|
| virtual GpuCacheBytes | gpu_cache_bytes () const |
| | Bytes held by this surface's GPU resource caches.
|
| virtual std::uint64_t | idle_trim_count () const |
| | Idle trims end_frame() has run since the surface was created.
|
| virtual std::uint64_t | render_target_allocations () const |
| | Graphite render targets this surface has allocated (the offscreen and persistent-scene targets; the presentable texture is wrapped, not allocated).
|
Skia Graphite rendering surface.
Connects a GpuSurface (WebGPU device) to Skia's GPU 2D rendering. When GpuSurface has a presentable surface, SkiaSurface renders into the swapchain texture each frame (zero-copy presentation). When offscreen, it renders into a standalone GPU texture.
Usage: gpu->begin_frame(); // acquire swapchain texture auto* canvas = skia->begin_frame(); // get Skia canvas targeting that texture root_view.paint_all(*canvas); skia->end_frame(); // submit Graphite recording gpu->end_frame(); // present to native surface
Begin a frame: returns a Canvas to draw into, or nullptr on failure.
The canvas targets, in order: the retained scene surface in persistent-scene mode; the current swapchain texture when GpuSurface has a presentable surface; the offscreen render target when it does not. The canvas is valid until end_frame() is called.
Returns nullptr — rather than quietly redirecting to the offscreen target — when a PRESENTABLE surface exists but its drawable could not be wrapped. The caller must not treat that as a rendered frame; query last_frame_outcome() for whether to recreate the surface or just retry.
| virtual FrameOutcome pulp::render::SkiaSurface::end_frame |
( |
| ) |
|
|
pure virtual |
End a frame: submits the Graphite recording to the GPU, and reports whether the frame reached its intended output.
Actual presentation is handled by GpuSurface::end_frame(); this covers everything up to and including submission of the drawable's contents, so a presented result means "the correct texture was drawn into and
submitted", not "the compositor has shown it".
Hosts must not retire pending damage unless frame_reached_output() is true for the returned outcome, or the failed frame's damage is lost and the retry paints nothing.
| virtual bool pulp::render::SkiaSurface::set_persistent_scene |
( |
bool | | ) |
|
|
inlinevirtual |
Enable/disable persistent-scene mode (partial-repaint support, FU-2).
Returns whether the mode is ACTIVE after the call.
In this mode begin_frame() targets a persistent, window-sized Graphite scene surface that RETAINS its content across frames; end_frame() blits that scene 1:1 onto the presentable drawable, then submits. This is what makes a clipped (partial) repaint correct on the non-preserving Dawn swapchain: the host repaints only the damaged rect into the retained scene and the whole scene is re-presented, so pixels outside the clip are the previous frame's — exactly the "static chrome doesn't re-composite" win. The first frame after enabling (or after a resize) is a full repaint into the fresh scene; the host arms that.
Default: unsupported no-op returning false — the base and the Ganesh/WebGL2 surface do not implement it, so a false return tells the caller it must full-repaint every frame. Only the Dawn/Graphite desktop surface implements it.
| virtual void pulp::render::SkiaSurface::trim_gpu_resources |
( |
TrimLevel | | ) |
|
|
inlinevirtual |
Return purgeable GPU memory to the device.
Call it between frames, on the render thread: it uses the surface's GPU context, which is not thread-safe. The same holds for gpu_cache_bytes(). Resources still referenced (cached images, retained layers, the scene) and work the GPU has not finished are not freed; a host that wants everything back calls wait_for_submitted_work() first.
end_frame() already runs an idle trim on the GpuIdleTrimSchedule throttle, freeing what went unused for both kUnusedAge and kUnusedFrames frames, so a host calls this directly only for everything(), when its editor is hidden or stops drawing. Default: no-op, for surfaces with no GPU cache.