[][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>>,
    allow_pixel_local_storage_support: bool,
    allow_texture_storage_support: bool,
    allow_texture_swizzling: bool,
    dump_shader_source: Option<String>,
    surface_origin_is_top_left: bool,
    panic_on_gl_error: bool
) -> Device
[src]

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

pub fn rc_gl(&self) -> &Rc<dyn Gl>[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 surface_origin_is_top_left(&self) -> bool[src]

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

Returns the limit on texture array layers.

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

pub fn preferred_color_formats(&self) -> TextureFormatPair<ImageFormat>[src]

pub fn swizzle_settings(&self) -> Option<SwizzleSettings>[src]

pub fn optimal_pbo_stride(&self) -> NonZeroUsize[src]

pub fn reset_state(&mut self)[src]

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

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

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

pub fn bind_external_texture<S>(
    &mut self,
    slot: 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_target: ReadTarget,
    src_rect: FramebufferIntRect,
    dest_target: DrawTarget,
    dest_rect: FramebufferIntRect,
    filter: TextureFilter
)
[src]

Perform a blit between src_target and dest_target. This will overwrite self.bound_read_fbo and self.bound_draw_fbo.

pub fn blit_render_target_invert_y(
    &mut self,
    src_target: ReadTarget,
    src_rect: FramebufferIntRect,
    dest_target: DrawTarget,
    dest_rect: FramebufferIntRect
)
[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 create_pbo_with_size(&mut self, size: usize) -> PBO[src]

pub fn read_pixels_into_pbo(
    &mut self,
    read_target: ReadTarget,
    rect: DeviceIntRect,
    format: ImageFormat,
    pbo: &PBO
)
[src]

pub fn map_pbo_for_readback<'a>(
    &'a mut self,
    pbo: &'a PBO
) -> Option<BoundPBO<'a>>
[src]

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

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

Returns the size and stride in bytes required to upload an area of pixels of the specified size, to a texture of the specified format.

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

Returns a TextureUploader which can be used to upload texture data to texture. The total size in bytes is specified by upload_size, and must be greater than zero and at least as large as the sum of the sizes returned from required_upload_size_and_stride() for each subsequent call to TextureUploader.upload().

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: FramebufferIntRect,
    format: ImageFormat,
    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<FramebufferIntRect>
)
[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: FramebufferIntRect)[src]

pub fn enable_scissor(&self)[src]

pub fn disable_scissor(&self)[src]

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

pub fn set_blend_mode_alpha(&mut self)[src]

pub fn set_blend_mode_premultiplied_alpha(&mut self)[src]

pub fn set_blend_mode_premultiplied_dest_out(&mut self)[src]

pub fn set_blend_mode_multiply(&mut self)[src]

pub fn set_blend_mode_subpixel_pass0(&mut self)[src]

pub fn set_blend_mode_subpixel_pass1(&mut self)[src]

pub fn set_blend_mode_subpixel_with_bg_color_pass0(&mut self)[src]

pub fn set_blend_mode_subpixel_with_bg_color_pass1(&mut self)[src]

pub fn set_blend_mode_subpixel_with_bg_color_pass2(&mut self)[src]

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

pub fn set_blend_mode_subpixel_dual_source(&mut self)[src]

pub fn set_blend_mode_show_overdraw(&mut self)[src]

pub fn set_blend_mode_max(&mut self)[src]

pub fn set_blend_mode_min(&mut self)[src]

pub fn set_blend_mode_advanced(&mut self, mode: MixBlendMode)[src]

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

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

Enable the pixel local storage functionality. Caller must have already confirmed the device supports this.

pub fn echo_driver_messages(&self)[src]

pub fn gl_describe_format(&self, format: ImageFormat) -> FormatDesc[src]

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

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

Auto Trait Implementations

impl !RefUnwindSafe for Device

impl !Send for Device

impl !Sync for Device

impl Unpin for Device

impl !UnwindSafe for Device

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> Same<T> for T

type Output = T

Should always be Self

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.