Skip to main content

HeadlessBackend

Struct HeadlessBackend 

Source
pub struct HeadlessBackend { /* private fields */ }
Expand description

webgpu::HeadlessBackend: a webgpu::RendererBackend that is its own default renderable (an offscreen texture).

Implementations§

Source§

impl HeadlessBackend

Source

pub fn new( size: Size, _swap_behaviour: SwapBehaviour, mode: ContextMode, ) -> Self

HeadlessBackend(size = {256, 256}, swapBehaviour = NoFlush, contextMode = Unique)

Source

pub fn create(size: Size) -> Self

HeadlessBackend::Create(size) with the C++ defaults.

Source

pub fn webgpu_backend(&self) -> &RendererBackend

Source

pub fn get_device(&self) -> Option<Device>

The device, for tests and tools.

Source

pub fn get_adapter_info(&self) -> Option<AdapterInfo>

Info about the adapter in use (e.g. “llvmpipe” on lavapipe).

Source

pub fn take_texture(&self) -> Option<Texture2DPtr>

takeTexture(): take ownership of the current texture

Source

pub fn get_framebuffer_size(&self) -> Size

getFramebufferSize()

Trait Implementations§

Source§

impl Drop for HeadlessBackend

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl HeadlessBackend for HeadlessBackend

Source§

fn read_still_image(&self) -> PremultipliedImage

Source§

fn get_renderer_backend(&self) -> &dyn RendererBackend

Source§

fn set_size(&self, size: Size)

setSize: resizes and drops the resource (recreated lazily by getDefaultRenderable).
Source§

impl Renderable for HeadlessBackend

Source§

fn renderable_base(&self) -> &RenderableBase

Source§

fn get_size(&self) -> Size

Source§

fn get_resource(&self) -> Option<Rc<dyn RenderableResource>>

getResource<T>() without the cast: the caller downcasts.
Source§

fn has_resource(&self) -> bool

Source§

fn set_resource(&self, resource: Option<Rc<dyn RenderableResource>>)

Source§

fn wait(&self)

Source§

fn set_renderable_size(&self, size: Size)

setRenderableSize (protected in C++).
Source§

fn is_same_renderable(&self, other: &dyn Renderable) -> bool

operator!=: compares the resource pointers.
Source§

impl RendererBackend for HeadlessBackend

Source§

fn renderer_backend_base(&self) -> &RendererBackendBase

Source§

fn as_any(&self) -> &dyn Any

Source§

fn get_default_renderable(&self) -> &dyn Renderable

Returns a reference to the default surface that should be rendered on.
Source§

fn init_shaders( &self, registry: &ShaderRegistry, parameters: &ProgramParameters, )

One-time shader initialization
Source§

fn create_context(&self) -> Rc<dyn GfxContext>

Called when the backend’s GL context needs to be made active or inactive (protected + friend class BackendScope in C++).
Source§

fn activate(&self)

Source§

fn deactivate(&self)

Source§

fn get_context(&self) -> &(dyn Context + 'static)

Returns the device’s context, created on first use (std::call_once). Must be called inside a BackendScope.
Source§

fn get_context_ptr(&self) -> &Rc<dyn Context>

The context as a shared pointer (the C++ context is owned by the backend; passes and resources in the port hold Rcs instead of references).
Source§

fn context_is_shared(&self) -> bool

Source§

fn unique_id(&self) -> SimpleIdentity

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> AsAny for T
where T: 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

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

Source§

fn downcast(&self) -> &T

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>