Struct webrender::renderer::Renderer [] [src]

pub struct Renderer {
    result_rx: Receiver<ResultMsg>,
    device: Device,
    pending_texture_updates: Vec<TextureUpdateList>,
    pending_gpu_cache_updates: Vec<GpuCacheUpdateList>,
    pending_shader_updates: Vec<PathBuf>,
    current_frame: Option<RendererFrame>,
    cs_box_shadow: LazilyCompiledShader,
    cs_text_run: LazilyCompiledShader,
    cs_line: LazilyCompiledShader,
    cs_blur: LazilyCompiledShader,
    cs_clip_rectangle: LazilyCompiledShader,
    cs_clip_image: LazilyCompiledShader,
    cs_clip_border: LazilyCompiledShader,
    ps_rectangle: PrimitiveShader,
    ps_rectangle_clip: PrimitiveShader,
    ps_text_run: PrimitiveShader,
    ps_text_run_subpixel: PrimitiveShader,
    ps_image: Vec<Option<PrimitiveShader>>,
    ps_yuv_image: Vec<Option<PrimitiveShader>>,
    ps_border_corner: PrimitiveShader,
    ps_border_edge: PrimitiveShader,
    ps_gradient: PrimitiveShader,
    ps_angle_gradient: PrimitiveShader,
    ps_radial_gradient: PrimitiveShader,
    ps_box_shadow: PrimitiveShader,
    ps_cache_image: PrimitiveShader,
    ps_line: PrimitiveShader,
    ps_blend: LazilyCompiledShader,
    ps_hw_composite: LazilyCompiledShader,
    ps_split_composite: LazilyCompiledShader,
    ps_composite: LazilyCompiledShader,
    notifier: Arc<Mutex<Option<Box<RenderNotifier>>>>,
    max_texture_size: u32,
    max_recorded_profiles: usize,
    clear_framebuffer: bool,
    clear_color: ColorF,
    enable_clear_scissor: bool,
    debug: DebugRenderer,
    debug_flags: DebugFlags,
    enable_batcher: bool,
    backend_profile_counters: BackendProfileCounters,
    profile_counters: RendererProfileCounters,
    profiler: Profiler,
    last_time: u64,
    color_render_targets: Vec<TextureId>,
    alpha_render_targets: Vec<TextureId>,
    gpu_profile: GpuProfiler<GpuProfileTag>,
    prim_vao_id: VAOId,
    blur_vao_id: VAOId,
    clip_vao_id: VAOId,
    gdt_index: usize,
    gpu_data_textures: [GpuDataTextures; 5],
    gpu_cache_texture: CacheTexture,
    pipeline_epoch_map: HashMap<PipelineId, Epoch, BuildHasherDefault<FxHasher>>,
    main_thread_dispatcher: Arc<Mutex<Option<Box<RenderDispatcher>>>>,
    cache_texture_id_map: Vec<TextureId>,
    dummy_cache_texture_id: TextureId,
    dither_matrix_texture_id: Option<TextureId>,
    external_image_handler: Option<Box<ExternalImageHandler>>,
    external_images: HashMap<(ExternalImageId, u8), TextureId, BuildHasherDefault<FxHasher>>,
    vr_compositor_handler: Arc<Mutex<Option<Box<VRCompositorHandler>>>>,
    cpu_profiles: VecDeque<CpuProfile>,
    gpu_profiles: VecDeque<GpuProfile>,
}

The renderer is responsible for submitting to the GPU the work prepared by the RenderBackend.

Fields

These are "cache clip shaders". These shaders are used to draw clip instances into the cached clip mask. The results of these shaders are also used by the primitive shaders.

Used to dispatch functions to the main thread's event loop. Required to allow GLContext sharing in some implementations like WGL.

A vector for fast resolves of texture cache IDs to native texture IDs. This maps to a free-list managed by the backend thread / texture cache. We free the texture memory associated with a TextureId when its texture cache ID is freed by the texture cache, but reuse the TextureId when the texture caches's free list reuses the texture cache ID. This saves having to use a hashmap, and allows a flat vector for performance.

A special 1x1 dummy cache texture used for shaders that expect to work with the cache but are actually running in the first pass when no target is yet provided as a cache texture input.

Optional trait object that allows the client application to provide external buffers for image data.

Map of external image IDs to native textures.

List of profile results from previous frames. Can be retrieved via get_frame_profiles().

Methods

impl Renderer
[src]

[src]

Initializes webrender and creates a Renderer and RenderApiSender.

Examples

Initializes a Renderer with some reasonable values. For more information see RendererOptions.

let opts = webrender::RendererOptions {
   device_pixel_ratio: 1.0,
   resource_override_path: None,
   enable_aa: false,
};
let (renderer, sender) = Renderer::new(opts);

[src]

[src]

[src]

[src]

Sets the new RenderNotifier.

The RenderNotifier will be called when processing e.g. of a (scrolling) frame is done, and therefore the screen should be updated.

[src]

Sets the new main thread dispatcher.

Allows to dispatch functions to the main thread's event loop.

[src]

Sets the VRCompositorHandler.

It's used to handle WebVR render commands. Some WebVR commands such as Vsync and SubmitFrame must be called in the WebGL render thread.

[src]

Returns the Epoch of the current frame in a pipeline.

[src]

Returns a HashMap containing the pipeline ids that have been received by the renderer and their respective epochs since the last time the method was called.

[src]

Processes the result queue.

Should be called before render(), as texture cache updates are done here.

[src]

[src]

Set a callback for handling external images.

[src]

Retrieve (and clear) the current list of recorded frame profiles.

[src]

Renders the current frame.

A Frame is supplied by calling generate_frame().

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]