#include <plugin_view_host.hpp>
Classes | |
| struct | Size |
| struct | Options |
| struct | GpuCacheUsage |
| Bytes held by this host's GPU resource caches: budgeted against Skia's budget, purgeable what a trim can return. More... | |
| struct | GpuSurfaceStatus |
| class | GpuSurfaceSubscription |
Public Types | |
| enum class | PresentPolicy { vsync , nonblocking } |
| How a host presents finished frames (WAH-13). More... | |
| enum class | GpuSurfaceState : uint8_t { pending , ready , unavailable } |
| using | Factory |
| using | GpuSurfaceObserver = std::function<void(const GpuSurfaceStatus&)> |
Public Member Functions | |
| virtual | ~PluginViewHost () |
| Out-of-line, and NOT trivial: it clears the back-pointer of every NativeViewHost still attached to this host. | |
| virtual NativeViewHandle | native_handle ()=0 |
| virtual bool | start_file_drag (const FileDragRequest &request) |
| virtual void | attach_to_parent (NativeViewHandle parent)=0 |
| virtual bool | try_attach_to_parent (NativeViewHandle parent) |
| virtual bool | is_attached () const noexcept |
| virtual void | detach ()=0 |
| virtual void | repaint ()=0 |
| virtual bool | present_first_frame () |
| void | mark_dirty_region (const Rect &root_rect) |
| void | mark_dirty_full () |
| virtual void | request_frame () |
| A frame without damage (see WindowHost::request_frame()). | |
| bool | pending_repaint_is_full () const |
| bool | has_pending_dirty_bounds () const |
| Rect | pending_dirty_bounds () const |
| void | clear_pending_dirty () |
| Host calls this once the frame is painted and submitted. | |
| virtual void | set_size (uint32_t width, uint32_t height)=0 |
| virtual Size | get_size () const =0 |
| virtual bool | is_gpu_backed () const |
| virtual render::GpuSurface * | gpu_surface () const |
| virtual GpuCacheUsage | gpu_cache_usage () const |
| virtual void | release_gpu_caches () |
| Return every GPU cache resource nothing references to the device. | |
| GpuSurfaceStatus | gpu_surface_status () const noexcept |
| GpuSurfaceState | gpu_surface_state () const noexcept |
| GpuSurfaceSubscription | observe_gpu_surface (GpuSurfaceObserver observer) |
| virtual void | set_resize_callback (std::function< void(uint32_t, uint32_t)> cb) |
| virtual void | set_idle_callback (std::function< void()> callback) |
| virtual void | advance_frame (double timestamp_seconds) |
| virtual std::vector< uint8_t > | capture_back_buffer_png () |
| virtual bool | attach_native_child_view (NativeViewHandle child_view, float x, float y, float width, float height) |
| virtual bool | set_native_child_view_bounds (NativeViewHandle child_view, float x, float y, float width, float height) |
| virtual void | detach_native_child_view (NativeViewHandle child_view) |
| virtual bool | set_native_child_view_clip (NativeViewHandle child_view, bool has_clip, float x, float y, float width, float height) |
| virtual void | pump_x_events () |
| virtual void | set_fixed_aspect_ratio (float ratio) |
| virtual void | set_design_viewport (float design_w, float design_h) |
| virtual void | set_design_viewport_top_align (bool top_align) |
| virtual Point | window_to_root_point (Point pt) const |
| virtual bool | design_viewport_transform (float &sx, float &sy, float &tx, float &ty) const |
| virtual void | set_scale_factor (float scale) |
| virtual float | scale_factor () const |
Static Public Member Functions | |
| static std::unique_ptr< PluginViewHost > | create (View &root, Size size) |
| static std::unique_ptr< PluginViewHost > | create (View &root, const Options &options) |
| static void | set_factory (Factory factory) |
| static void | clear_factory () |
| static bool | has_factory () |
Protected Member Functions | |
| void | publish_gpu_surface (render::GpuSurface *surface, GpuSurfaceState state) |
| void | mark_gpu_surface_pending () |
Protected Attributes | |
| PendingDamage | damage_ |
Friends | |
| class | NativeViewHost |
| using pulp::view::PluginViewHost::GpuSurfaceObserver = std::function<void(const GpuSurfaceStatus&)> |
|
strong |
|
strong |
How a host presents finished frames (WAH-13).
This was an unexplained cfg.vsync = false buried in the Windows host and an unexplained true elsewhere. Two different hosts had two different answers with no shared statement of WHY, which is how a measured fix in one place fails to reach the other.
| Enumerator | |
|---|---|
| vsync | Block until the display's next refresh (Fifo). Correct for a host that OWNS its frame loop — a standalone window driven by a display link, where pacing to the refresh is the point. |
| nonblocking | Do not block on acquire (Mailbox, then Immediate, then Fifo). Correct for an EMBEDDED editor: it renders synchronously from the DAW's paint message, on the DAW's UI thread, and the DAW already composites at its own cadence. Blocking there stalls the message pump that delivers further input. Measured on the REAPER VM during a knob drag (Perfetto): the frame's own work was ~2 ms (paint ~1 ms, submit ~1 ms, present ~0.1 ms) while whole frames took 19-45 ms — the difference was all acquire. Seven frames were produced across eight drag sweeps. On macOS this does not currently avoid vsync pacing: Dawn's Metal swapchain can only toggle CAMetalLayer.displaySyncEnabled, and Mailbox leaves it on exactly as Fifo does, so the preferred Mailbox still waits for a free drawable in acquire. |
|
virtual |
Out-of-line, and NOT trivial: it clears the back-pointer of every NativeViewHost still attached to this host.
See the registry at the bottom of this class.
|
inlinevirtual |
|
inlinevirtual |
|
pure virtual |
|
inlinevirtual |
|
static |
|
inline |
Host calls this once the frame is painted and submitted.
|
static |
|
static |
|
inlinevirtual |
|
pure virtual |
|
inlinevirtual |
|
pure virtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinenoexcept |
|
inlinenoexcept |
|
static |
|
inline |
|
inlinevirtualnoexcept |
|
inlinevirtual |
|
inline |
|
inline |
|
inlineprotected |
|
pure virtual |
|
nodiscard |
|
inline |
|
inline |
|
inlinevirtual |
|
protected |
|
inlinevirtual |
|
inlinevirtual |
Return every GPU cache resource nothing references to the device.
A format adapter calls this when the host hides the editor without closing it (CLAP gui_hide, an AU view leaving its window), so a hidden editor stops holding GPU memory it is not drawing with. The surfaces stay, so showing the editor again repaints without recreating them. Call it on the thread that renders, between frames. A no-op on a host with no GPU surface yet, and on CPU hosts.
|
pure virtual |
|
inlinevirtual |
A frame without damage (see WindowHost::request_frame()).
A host that paints from repaint() needs nothing more; a recorder can tell it apart from a whole-surface request by overriding it.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
static |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
pure virtual |
|
inlinevirtual |
|
inlinenodiscardvirtual |
|
friend |
|
protected |