Skip to main content

Module rendering

Module rendering 

Source
Expand description

Rendering to the canvas of a view: the surface, its render targets (a WebGL context or a framebuffer copied to a 2D canvas), the render timer driven by the animation frames of the page or of a render worker, the render worker, and what the thread of the user interface and a render thread share about a canvas.

By who holds what (docs/porting/browser-render-worker.md, section 4):

Without a render thread the three live on the one thread of the page.

With one (BrowserSharedRenderLoop::start_render_thread, which the platform calls in a module built with threads) the compositor of a view is confined to it: the frame loop ticks there, the canvas of a view is transferred to its worker, and the thread of the user interface commits batches and waits. RenderStatistics is where the page reads which thread drew its frames.

Structs§

BrowserRenderSurface
The render surface of a canvas, as it is handed to the compositor.
BrowserRenderTimer
A render timer that ticks with the animation frames of the thread it is started on: the page, or the worker of a render thread.
BrowserSharedRenderLoop
The one render loop of the page. Every view renders in the animation frames of one thread: the thread of the user interface, or the render thread when the platform started one (start_render_thread).
BrowserSoftwareRenderTarget
A canvas that is rendered to in memory, as the thread that draws to it holds it: each frame is drawn into a retained framebuffer and copied to the 2D context of the canvas through the object of the script side of that thread.
BrowserSurface
The state every surface of a view has: its canvas, its compositor and its size in device pixels and logical units.
BrowserSurfaceShared
What the thread of the user interface and the thread that renders both know about one canvas.
BrowserWebGlRenderTarget
A canvas that is rendered to with WebGL, as the thread that draws to it holds it: the object of the script side of that thread, what the script knows about the WebGL context, and the context itself.
RenderStatistics
What the page can read about the frames that reached its canvases: how many, which thread drew the last one and to what, and what the ticks of a render thread cost the thread of the page.
RenderTargetBrowserSurface
The surface of a view that is rendered through a render target of the page (a WebGL context or a 2D canvas).
RenderWorker
The render thread of the page: a thread of the module whose worker takes the canvases of the views and draws to them.
WebGlContext
A WebGL context registered with the module.

Enums§

BrowserRenderTarget
The render target of a canvas, as the thread that draws to it holds it.

Constants§

PENDING_RENDER_THREAD
The id a canvas is created with for a render thread that has been started and has not reported itself yet: the registry of the script side transfers the control of the canvas at once and keeps the message for the worker until [worker_started] names it.

Functions§

get_render_target
The render target with the id id on the calling thread, when the script of this thread has created it.
initialize_worker
Makes the worker of the calling thread take the canvases that are transferred to it: installs the message handler of the registry of the thread’s script, which creates the render target of each canvas and reports it (on_render_target_registered).
remove_render_target
Takes the render target with the id id out of the table of the calling thread; returns whether it was there. What still draws to the target (a render target a backend created from it) keeps it alive until it is released, on this thread.