[][src]Struct azul_webrender::Renderer

pub struct Renderer {
    pub device: Device,
    pub gpu_profile: GpuProfiler<GpuProfileTag>,
    pub renderer_errors: Vec<RendererError>,
    // some fields omitted
}

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

We have a separate Renderer instance for each instance of WebRender (generally one per OS window), and all instances share the same thread.

Fields

device: Devicegpu_profile: GpuProfiler<GpuProfileTag>renderer_errors: Vec<RendererError>

Implementations

impl Renderer[src]

pub fn new(
    gl: Rc<dyn Gl>,
    notifier: Box<dyn RenderNotifier>,
    options: RendererOptions,
    shaders: Option<&mut WrShaders>,
    start_size: DeviceIntSize
) -> Result<(Self, RenderApiSender), RendererError>
[src]

Initializes WebRender and creates a Renderer and RenderApiSender.

Examples

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

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

pub fn device_size(&self) -> Option<DeviceIntSize>[src]

pub fn set_cursor_position(&mut self, position: DeviceIntPoint)[src]

Update the current position of the debug cursor.

pub fn get_max_texture_size(&self) -> i32[src]

pub fn get_graphics_api_info(&self) -> GraphicsApiInfo[src]

pub fn preferred_color_format(&self) -> ImageFormat[src]

pub fn optimal_texture_stride_alignment(&self, format: ImageFormat) -> usize[src]

pub fn flush_pipeline_info(&mut self) -> PipelineInfo[src]

pub fn current_epoch(
    &self,
    document_id: DocumentId,
    pipeline_id: PipelineId
) -> Option<Epoch>
[src]

Returns the Epoch of the current frame in a pipeline.

pub fn update(&mut self)[src]

Processes the result queue.

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

pub fn set_external_image_handler(
    &mut self,
    handler: Box<dyn ExternalImageHandler>
)
[src]

Set a callback for handling external images.

pub fn set_output_image_handler(&mut self, handler: Box<dyn OutputImageHandler>)[src]

Set a callback for handling external outputs.

pub fn get_frame_profiles(&mut self) -> (Vec<CpuProfile>, Vec<GpuProfile>)[src]

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

pub fn force_redraw(&mut self)[src]

Reset the current partial present state. This forces the entire framebuffer to be refreshed next time render is called.

pub fn render(
    &mut self,
    device_size: DeviceIntSize
) -> Result<RenderResults, Vec<RendererError>>
[src]

Renders the current frame.

A Frame is supplied by calling [generate_frame()][webrender_api::Transaction::generate_frame].

pub fn init_pixel_local_storage(
    &mut self,
    task_rect: DeviceIntRect,
    projection: &Transform3D<f32>,
    stats: &mut RendererStats
)
[src]

Initialize the PLS block, by reading the current framebuffer color.

pub fn resolve_pixel_local_storage(
    &mut self,
    task_rect: DeviceIntRect,
    projection: &Transform3D<f32>,
    stats: &mut RendererStats
)
[src]

Resolve the current PLS structure, writing it to a fragment color output.

pub fn debug_renderer(&mut self) -> Option<&mut DebugRenderer>[src]

pub fn get_debug_flags(&self) -> DebugFlags[src]

pub fn set_debug_flags(&mut self, flags: DebugFlags)[src]

pub fn read_pixels_into(
    &mut self,
    rect: FramebufferIntRect,
    format: ImageFormat,
    output: &mut [u8]
)
[src]

Pass-through to Device::read_pixels_into, used by Gecko's WR bindings.

pub fn read_pixels_rgba8(&mut self, rect: FramebufferIntRect) -> Vec<u8>[src]

pub fn read_gpu_cache(&mut self) -> (DeviceIntSize, Vec<u8>)[src]

pub fn deinit(self)[src]

pub fn report_memory(&self) -> MemoryReport[src]

Collects a memory report.

impl Renderer[src]

pub fn record_frame(
    &mut self,
    image_format: ImageFormat
) -> Option<(RecordedFrameHandle, DeviceIntSize)>
[src]

Record a frame for the Composition Recorder.

The returned handle can be passed to map_recorded_frame to copy it into a buffer. The returned size is the size of the frame.

pub fn map_recorded_frame(
    &mut self,
    handle: RecordedFrameHandle,
    dst_buffer: &mut [u8],
    dst_stride: usize
) -> bool
[src]

Map a frame captured for the composition recorder into the given buffer.

pub fn release_composition_recorder_structures(&mut self)[src]

Free the data structures used by the composition recorder.

pub fn get_screenshot_async(
    &mut self,
    window_rect: DeviceIntRect,
    buffer_size: DeviceIntSize,
    image_format: ImageFormat
) -> (AsyncScreenshotHandle, DeviceIntSize)
[src]

Take a screenshot and scale it asynchronously.

The returned handle can be used to access the mapped screenshot data via map_and_recycle_screenshot.

The returned size is the size of the screenshot.

pub fn map_and_recycle_screenshot(
    &mut self,
    handle: AsyncScreenshotHandle,
    dst_buffer: &mut [u8],
    dst_stride: usize
) -> bool
[src]

Map the contents of the screenshot given by the handle and copy it into the given buffer.

pub fn release_profiler_structures(&mut self)[src]

Release the screenshot grabbing structures that the profiler was using.

Auto Trait Implementations

impl !RefUnwindSafe for Renderer

impl !Send for Renderer

impl !Sync for Renderer

impl Unpin for Renderer

impl !UnwindSafe for Renderer

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.