pub struct Context { /* private fields */ }Implementations§
Source§impl Context
impl Context
Sourcepub fn rc(&self) -> Rc<Context>
pub fn rc(&self) -> Rc<Context>
The owning Rc (resources keep the context alive, as the C++
Context& members assume).
Sourcepub fn get_backend(&self) -> &Rc<BackendImpl>
pub fn get_backend(&self) -> &Rc<BackendImpl>
getBackend()
pub fn rendering_stats_mut(&self) -> RefMut<'_, RenderingStats>
Sourcepub fn create_offscreen_texture_with(
&self,
size: Size,
type_: TextureChannelDataType,
depth: bool,
stencil: bool,
) -> OffscreenTexture
pub fn create_offscreen_texture_with( &self, size: Size, type_: TextureChannelDataType, depth: bool, stencil: bool, ) -> OffscreenTexture
createOffscreenTexture(size, type, depth, stencil)
Sourcepub fn create_webgpu_texture_2d(&self) -> Rc<RefCell<Texture2D>>
pub fn create_webgpu_texture_2d(&self) -> Rc<RefCell<Texture2D>>
createTexture2D() with the concrete type.
Sourcepub fn get_tile_vertex_buffer(&self) -> Option<(Buffer, u64)>
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).
Sourcepub fn get_tile_index_buffer(&self) -> Option<(Buffer, u64)>
pub fn get_tile_index_buffer(&self) -> Option<(Buffer, u64)>
getTileIndexBuffer(): RenderStaticData::quadTriangleIndices().
Sourcepub fn create_webgpu_uniform_buffer(&self, data: &[u8]) -> Rc<UniformBuffer>
pub fn create_webgpu_uniform_buffer(&self, data: &[u8]) -> Rc<UniformBuffer>
createUniformBuffer with the concrete type.
Trait Implementations§
Source§impl Context for Context
impl Context for Context
Source§fn create_offscreen_texture(
&self,
size: Size,
type_: TextureChannelDataType,
) -> Box<dyn OffscreenTexture>
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,
) -> Option<ShaderProgramBasePtr>
fn get_generic_shader( &self, registry: &ShaderRegistry, name: &str, ) -> 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)
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).
fn context_base(&self) -> &ContextBase
fn as_any(&self) -> &dyn Any
fn begin_frame(&self)
fn end_frame(&self)
fn perform_cleanup(&self)
fn reduce_memory_usage(&self)
fn create_command_encoder(&self) -> Box<dyn CommandEncoder>
fn clear_stencil_buffer(&self, _value: i32)
fn set_dirty_state(&self)
fn create_vertex_attribute_array(&self) -> VertexAttributeArrayPtr
fn create_drawable_builder(&self, name: String) -> UniqueDrawableBuilder
fn create_uniform_buffer( &self, data: &[u8], _persistent: bool, _ssbo: bool, ) -> UniformBufferPtr
fn create_layer_uniform_buffer_array(&self) -> UniqueUniformBufferArray
fn create_tile_layer_group( &self, layer_index: i32, initial_capacity: usize, name: String, ) -> Option<LayerGroupBasePtr>
fn create_layer_group( &self, layer_index: i32, initial_capacity: usize, name: String, ) -> Option<LayerGroupBasePtr>
fn create_texture_2d(&self) -> Texture2DPtr
fn reset_state(&self, _depth_mode: DepthMode, _color_mode: ColorMode)
Source§fn emplace_or_update_uniform_buffer(
&self,
ptr: &mut Option<UniformBufferPtr>,
data: &[u8],
persistent: bool,
) -> bool
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.fn get_global_uniform_buffers(&self) -> Ref<'_, UniformBufferArray>
fn mutable_global_uniform_buffers(&self) -> RefMut<'_, UniformBufferArray>
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
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 moreSource§fn set_observer(&self, observer: Option<Rc<dyn ContextObserver>>)
fn set_observer(&self, observer: Option<Rc<dyn ContextObserver>>)
setObserver(nullptr) restores the null observer.fn get_observer(&self) -> Option<Rc<dyn ContextObserver>>
fn rendering_stats(&self) -> RefMut<'_, RenderingStats>
fn thread_safe_copy_rendering_stats(&self) -> RenderingStats
Auto Trait Implementations§
impl !Freeze for Context
impl !RefUnwindSafe for Context
impl !Send for Context
impl !Sync for Context
impl !UnwindSafe for Context
impl Forget for Context
impl Unpin for Context
impl UnsafeUnpin for Context
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more