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):
BrowserSurfaceSharedis what both threads know about a canvas, andBrowserRenderSurfacethe render surface over it that the compositor is handed. Neither holds an object of a thread.BrowserRenderTarget(BrowserWebGlRenderTarget,BrowserSoftwareRenderTarget) is the render target of a canvas on the thread that draws to it, kept in a table of that thread (get_render_target).RenderTargetBrowserSurfaceis the surface of a view on the thread of the user interface.
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§
- Browser
Render Surface - The render surface of a canvas, as it is handed to the compositor.
- Browser
Render Timer - 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.
- Browser
Shared Render Loop - 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). - Browser
Software Render Target - 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.
- Browser
Surface - The state every surface of a view has: its canvas, its compositor and its size in device pixels and logical units.
- Browser
Surface Shared - What the thread of the user interface and the thread that renders both know about one canvas.
- Browser
WebGl Render Target - 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.
- Render
Statistics - 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.
- Render
Target Browser Surface - The surface of a view that is rendered through a render target of the page (a WebGL context or a 2D canvas).
- Render
Worker - The render thread of the page: a thread of the module whose worker takes the canvases of the views and draws to them.
- WebGl
Context - A WebGL context registered with the module.
Enums§
- Browser
Render Target - 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
idon 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
idout 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.