Skip to main content

Context

Struct Context 

Source
pub struct Context { /* private fields */ }

Implementations§

Source§

impl Context

Source

pub fn new(backend: Rc<BackendImpl>) -> Rc<Context>

Context(RendererBackend&)

Source

pub fn rc(&self) -> Rc<Context>

The owning Rc (resources keep the context alive, as the C++ Context& members assume).

Source

pub fn get_backend(&self) -> &Rc<BackendImpl>

getBackend()

Source

pub fn rendering_stats_mut(&self) -> RefMut<'_, RenderingStats>

Source

pub fn create_offscreen_texture_with( &self, size: Size, type_: TextureChannelDataType, depth: bool, stencil: bool, ) -> OffscreenTexture

createOffscreenTexture(size, type, depth, stencil)

Source

pub fn create_webgpu_texture_2d(&self) -> Rc<RefCell<Texture2D>>

createTexture2D() with the concrete type.

Source

pub fn get_tile_vertex_buffer(&self) -> Option<(Buffer, u64)>

getTileVertexBuffer(): RenderStaticData::tileVertices(), the four corners of the tile extent as short2 (inlined: RenderStaticData is a renderer type).

Source

pub fn get_tile_index_buffer(&self) -> Option<(Buffer, u64)>

getTileIndexBuffer(): RenderStaticData::quadTriangleIndices().

Source

pub fn create_webgpu_uniform_buffer(&self, data: &[u8]) -> Rc<UniformBuffer>

createUniformBuffer with the concrete type.

Trait Implementations§

Source§

impl Context for Context

Source§

fn create_offscreen_texture( &self, size: Size, type_: TextureChannelDataType, ) -> Box<dyn OffscreenTexture>

createOffscreenTexture(size, type): depth, no stencil.

Source§

fn get_generic_shader( &self, registry: &ShaderRegistry, name: &str, variant: ProjectionVariant, ) -> Option<ShaderProgramBasePtr>

Align with Metal - just get the shader from the registry, no caching.

Source§

fn bind_global_uniform_buffers(&self, render_pass: &dyn RenderPass)

In WebGPU, buffers can’t be bound globally to the render pass like in Metal; the pass refers to the context’s array for the drawables’ bind groups (C++ stores a pointer to it).

Source§

fn context_base(&self) -> &ContextBase

Source§

fn as_any(&self) -> &dyn Any

Source§

fn backend_type(&self) -> BackendType

The backend this context is of. C++ builds one backend and asks gfx::Backend::GetType(); the port can build several and asks the context.
Source§

fn begin_frame(&self)

Source§

fn end_frame(&self)

Source§

fn perform_cleanup(&self)

Source§

fn reduce_memory_usage(&self)

Source§

fn create_command_encoder(&self) -> Box<dyn CommandEncoder>

Source§

fn create_vertex_attribute_array(&self) -> VertexAttributeArrayPtr

Source§

fn create_drawable_builder(&self, name: String) -> UniqueDrawableBuilder

Source§

fn create_uniform_buffer( &self, data: &[u8], _persistent: bool, _ssbo: bool, ) -> UniformBufferPtr

Source§

fn create_tile_layer_group( &self, layer_index: i32, initial_capacity: usize, name: String, ) -> Option<LayerGroupBasePtr>

Source§

fn create_layer_group( &self, layer_index: i32, initial_capacity: usize, name: String, ) -> Option<LayerGroupBasePtr>

Source§

fn create_texture_2d(&self) -> Texture2DPtr

Source§

fn emplace_or_update_uniform_buffer( &self, ptr: &mut Option<UniformBufferPtr>, data: &[u8], persistent: bool, ) -> bool

Creates the buffer if ptr is empty (returns true), else updates it.
Source§

fn get_global_uniform_buffers(&self) -> Ref<'_, UniformBufferArray>

Source§

fn mutable_global_uniform_buffers(&self) -> RefMut<'_, UniformBufferArray>

Source§

fn unbind_global_uniform_buffers(&self, render_pass: &dyn RenderPass)

Source§

fn render_tile_clipping_masks( &self, render_pass: &dyn RenderPass, shaders: &ShaderRegistry, tile_ubos: &[ClipUBO], ) -> bool

Draws the tile clipping masks into the stencil buffer of the current render pass, one draw per UBO (stencil reference ubo.stencil_ref). Read more
Source§

fn release_globe_clip_masks(&self)

Drops the meshes and drawables kept for the globe’s tile clipping masks; a Mercator frame calls it. (C++ makes it pure virtual; here backends without globe masks keep the empty default.)
Source§

fn render_globe_tile_clipping_masks( &self, render_pass: &dyn RenderPass, shaders: &ShaderRegistry, masks: &[GlobeClipMask], mesh: &GlobeClipMeshFn<'_>, ) -> bool

The globe’s tile clipping masks, each drawn over the pole-capped mesh of its tile, with a border and then without. Read more
Source§

fn rendering_stats(&self) -> RefMut<'_, RenderingStats>

Source§

fn thread_safe_copy_rendering_stats(&self) -> RenderingStats

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.