[][src]Struct webrender::Device

pub struct Device { /* fields omitted */ }

Methods

impl Device[src]

pub fn new(
    gl: Rc<dyn Gl>,
    resource_override_path: Option<PathBuf>,
    upload_method: UploadMethod,
    cached_programs: Option<Rc<ProgramCache>>
) -> Device
[src]

pub fn gl(&self) -> &dyn Gl[src]

pub fn rc_gl(&self) -> &Rc<dyn Gl>[src]

pub fn set_device_pixel_ratio(&mut self, ratio: f32)[src]

pub fn update_program_cache(&mut self, cached_programs: Rc<ProgramCache>)[src]

pub fn clamp_max_texture_size(&mut self, size: i32)[src]

Ensures that the maximum texture size is less than or equal to the provided value. If the provided value is less than the value supported by the driver, the latter is used.

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

Returns the limit on texture dimensions (width or height).

pub fn max_texture_layers(&self) -> usize[src]

Returns the limit on texture array layers.

pub fn get_capabilities(&self) -> &Capabilities[src]

pub fn reset_state(&mut self)[src]

pub fn compile_shader(
    gl: &dyn Gl,
    name: &str,
    shader_type: GLenum,
    source: &String
) -> Result<GLuint, ShaderError>
[src]

pub fn begin_frame(&mut self) -> GpuFrameId[src]

pub fn bind_texture<S>(&mut self, sampler: S, texture: &Texture) where
    S: Into<TextureSlot>, 
[src]

pub fn bind_external_texture<S>(
    &mut self,
    sampler: S,
    external_texture: &ExternalTexture
) where
    S: Into<TextureSlot>, 
[src]

pub fn bind_read_target_impl(&mut self, fbo_id: FBOId)[src]

pub fn bind_read_target(&mut self, target: ReadTarget)[src]

pub fn reset_read_target(&mut self)[src]

pub fn reset_draw_target(&mut self)[src]

pub fn bind_draw_target(&mut self, target: DrawTarget)[src]

pub fn create_fbo(&mut self) -> FBOId[src]

Creates an unbound FBO object. Additional attachment API calls are required to make it complete.

pub fn create_fbo_for_external_texture(&mut self, texture_id: u32) -> FBOId[src]

Creates an FBO with the given texture bound as the color attachment.

pub fn delete_fbo(&mut self, fbo: FBOId)[src]

pub fn bind_external_draw_target(&mut self, fbo_id: FBOId)[src]

Link a program, attaching the supplied vertex format.

If create_program() finds a binary shader on disk, it will kick off linking immediately, which some drivers (notably ANGLE) run in parallel on background threads. As such, this function should ideally be run sometime later, to give the driver time to do that before blocking due to an API call accessing the shader.

This generally means that the first run of the application will have to do a bunch of blocking work to compile the shader from source, but subsequent runs should load quickly.

pub fn bind_program(&mut self, program: &Program)[src]

pub fn create_texture(
    &mut self,
    target: TextureTarget,
    format: ImageFormat,
    width: i32,
    height: i32,
    filter: TextureFilter,
    render_target: Option<RenderTargetInfo>,
    layer_count: i32
) -> Texture
[src]

pub fn blit_renderable_texture(&mut self, dst: &mut Texture, src: &Texture)[src]

Copies the contents from one renderable texture to another.

pub fn invalidate_render_target(&mut self, texture: &Texture)[src]

Notifies the device that the contents of a render target are no longer needed.

FIXME(bholley): We could/should invalidate the depth targets earlier than the color targets, i.e. immediately after each pass.

pub fn reuse_render_target<T: Texel>(
    &mut self,
    texture: &mut Texture,
    rt_info: RenderTargetInfo
)
[src]

Notifies the device that a render target is about to be reused.

This method adds or removes a depth target as necessary.

pub fn blit_render_target(
    &mut self,
    src_rect: DeviceIntRect,
    dest_rect: DeviceIntRect,
    filter: TextureFilter
)
[src]

pub fn blit_render_target_invert_y(
    &mut self,
    src_rect: DeviceIntRect,
    dest_rect: DeviceIntRect
)
[src]

Performs a blit while flipping vertically. Useful for blitting textures (which use origin-bottom-left) to the main framebuffer (which uses origin-top-left).

pub fn delete_texture(&mut self, texture: Texture)[src]

pub fn delete_program(&mut self, program: Program)[src]

pub fn create_program_linked(
    &mut self,
    base_filename: &'static str,
    features: String,
    descriptor: &VertexDescriptor
) -> Result<Program, ShaderError>
[src]

Create a shader program and link it immediately.

pub fn create_program(
    &mut self,
    base_filename: &'static str,
    features: String
) -> Result<Program, ShaderError>
[src]

Create a shader program. This does minimal amount of work to start loading a binary shader. If a binary shader is found, we invoke glProgramBinary, which, at least on ANGLE, will load and link the binary on a background thread. This can speed things up later when we invoke link_program().

pub fn bind_shader_samplers<S>(
    &mut self,
    program: &Program,
    bindings: &[(&'static str, S)]
) where
    S: Into<TextureSlot> + Copy
[src]

pub fn get_uniform_location(
    &self,
    program: &Program,
    name: &str
) -> UniformLocation
[src]

pub fn set_uniforms(&self, program: &Program, transform: &Transform3D<f32>)[src]

pub fn switch_mode(&self, mode: i32)[src]

pub fn create_pbo(&mut self) -> PBO[src]

pub fn delete_pbo(&mut self, pbo: PBO)[src]

pub fn upload_texture<'a, T>(
    &'a mut self,
    texture: &'a Texture,
    pbo: &PBO,
    upload_count: usize
) -> TextureUploader<'a, T>
[src]

pub fn upload_texture_immediate<T: Texel>(
    &mut self,
    texture: &Texture,
    pixels: &[T]
)
[src]

Performs an immediate (non-PBO) texture upload.

pub fn read_pixels(&mut self, img_desc: &ImageDescriptor) -> Vec<u8>[src]

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

Read rectangle of pixels into the specified output slice.

pub fn get_tex_image_into(
    &mut self,
    texture: &Texture,
    format: ImageFormat,
    output: &mut [u8]
)
[src]

Get texels of a texture into the specified output slice.

pub fn attach_read_texture_external(
    &mut self,
    texture_id: GLuint,
    target: TextureTarget,
    layer_id: i32
)
[src]

pub fn attach_read_texture(&mut self, texture: &Texture, layer_id: i32)[src]

pub fn bind_vao(&mut self, vao: &VAO)[src]

pub fn bind_custom_vao(&mut self, vao: &CustomVAO)[src]

pub fn create_custom_vao(&mut self, streams: &[Stream]) -> CustomVAO[src]

pub fn delete_custom_vao(&mut self, vao: CustomVAO)[src]

pub fn create_vbo<T>(&mut self) -> VBO<T>[src]

pub fn delete_vbo<T>(&mut self, vbo: VBO<T>)[src]

pub fn create_vao(&mut self, descriptor: &VertexDescriptor) -> VAO[src]

pub fn delete_vao(&mut self, vao: VAO)[src]

pub fn allocate_vbo<V>(
    &mut self,
    vbo: &mut VBO<V>,
    count: usize,
    usage_hint: VertexUsageHint
)
[src]

pub fn fill_vbo<V>(&mut self, vbo: &VBO<V>, data: &[V], offset: usize)[src]

pub fn create_vao_with_new_instances(
    &mut self,
    descriptor: &VertexDescriptor,
    base_vao: &VAO
) -> VAO
[src]

pub fn update_vao_main_vertices<V>(
    &mut self,
    vao: &VAO,
    vertices: &[V],
    usage_hint: VertexUsageHint
)
[src]

pub fn update_vao_instances<V>(
    &mut self,
    vao: &VAO,
    instances: &[V],
    usage_hint: VertexUsageHint
)
[src]

pub fn update_vao_indices<I>(
    &mut self,
    vao: &VAO,
    indices: &[I],
    usage_hint: VertexUsageHint
)
[src]

pub fn draw_triangles_u16(&mut self, first_vertex: i32, index_count: i32)[src]

pub fn draw_triangles_u32(&mut self, first_vertex: i32, index_count: i32)[src]

pub fn draw_nonindexed_points(&mut self, first_vertex: i32, vertex_count: i32)[src]

pub fn draw_nonindexed_lines(&mut self, first_vertex: i32, vertex_count: i32)[src]

pub fn draw_indexed_triangles_instanced_u16(
    &mut self,
    index_count: i32,
    instance_count: i32
)
[src]

pub fn end_frame(&mut self)[src]

pub fn clear_target(
    &self,
    color: Option<[f32; 4]>,
    depth: Option<f32>,
    rect: Option<DeviceIntRect>
)
[src]

pub fn enable_depth(&self)[src]

pub fn disable_depth(&self)[src]

pub fn set_depth_func(&self, depth_func: DepthFunction)[src]

pub fn enable_depth_write(&self)[src]

pub fn disable_depth_write(&self)[src]

pub fn disable_stencil(&self)[src]

pub fn set_scissor_rect(&self, rect: DeviceIntRect)[src]

pub fn enable_scissor(&self)[src]

pub fn disable_scissor(&self)[src]

pub fn set_blend(&self, enable: bool)[src]

pub fn set_blend_mode_alpha(&self)[src]

pub fn set_blend_mode_premultiplied_alpha(&self)[src]

pub fn set_blend_mode_premultiplied_dest_out(&self)[src]

pub fn set_blend_mode_multiply(&self)[src]

pub fn set_blend_mode_max(&self)[src]

pub fn set_blend_mode_min(&self)[src]

pub fn set_blend_mode_subpixel_pass0(&self)[src]

pub fn set_blend_mode_subpixel_pass1(&self)[src]

pub fn set_blend_mode_subpixel_with_bg_color_pass0(&self)[src]

pub fn set_blend_mode_subpixel_with_bg_color_pass1(&self)[src]

pub fn set_blend_mode_subpixel_with_bg_color_pass2(&self)[src]

pub fn set_blend_mode_subpixel_constant_text_color(&self, color: ColorF)[src]

pub fn set_blend_mode_subpixel_dual_source(&self)[src]

pub fn set_blend_mode_show_overdraw(&self)[src]

pub fn supports_extension(&self, extension: &str) -> bool[src]

pub fn echo_driver_messages(&self)[src]

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

Generates a memory report for the resources managed by the device layer.

Auto Trait Implementations

impl !Send for Device

impl !Sync for Device

Blanket Implementations

impl<T> From for T[src]

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

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Same for T

type Output = T

Should always be Self