Skip to main content

NullBackend

Struct NullBackend 

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

A no-op render backend that tracks resource state without GPU access.

This backend is designed for headless testing in CI environments where no GPU or display server is available. All operations succeed immediately, and resource handles are tracked via generational allocators so that lifecycle tests (create/destroy/use-after-free) work correctly.

Implementations§

Source§

impl NullBackend

Source

pub fn new() -> Self

Creates a new headless null backend.

Trait Implementations§

Source§

impl BufferOps for NullBackend

Source§

fn create_buffer( &mut self, buffer_type: BufferType, _usage: BufferUsage, data: &[u8], ) -> GoudResult<BufferHandle>

Creates a GPU buffer with the specified type, usage, and initial data. Read more
Source§

fn update_buffer( &mut self, handle: BufferHandle, _offset: usize, _data: &[u8], ) -> GoudResult<()>

Updates the contents of an existing buffer. Read more
Source§

fn destroy_buffer(&mut self, handle: BufferHandle) -> bool

Destroys a buffer and frees GPU memory. Read more
Source§

fn is_buffer_valid(&self, handle: BufferHandle) -> bool

Checks if a buffer handle is valid and refers to an existing buffer.
Source§

fn buffer_size(&self, handle: BufferHandle) -> Option<usize>

Returns the size in bytes of a buffer, or None if the handle is invalid.
Source§

fn bind_buffer(&mut self, handle: BufferHandle) -> GoudResult<()>

Binds a buffer for use in subsequent draw calls. Read more
Source§

fn unbind_buffer(&mut self, _buffer_type: BufferType)

Unbinds the currently bound buffer of the specified type.
Source§

impl ClearOps for NullBackend

Source§

fn set_clear_color(&mut self, r: f32, g: f32, b: f32, a: f32)

Sets the clear color for subsequent clear operations. Read more
Source§

fn clear_color(&mut self)

Clears the color buffer using the current clear color.
Source§

fn clear_depth(&mut self)

Clears the depth buffer.
Source§

fn clear(&mut self)

Clears both color and depth buffers. Read more
Source§

impl Default for NullBackend

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl DrawOps for NullBackend

Source§

fn set_vertex_attributes(&mut self, _layout: &VertexLayout)

Sets up vertex attribute pointers for the currently bound vertex buffer. Read more
Source§

fn draw_arrays( &mut self, _topology: PrimitiveTopology, _first: u32, _count: u32, ) -> GoudResult<()>

Draws primitives using array-based vertex data. Read more
Source§

fn draw_indexed( &mut self, _topology: PrimitiveTopology, _count: u32, _offset: usize, ) -> GoudResult<()>

Draws primitives using indexed vertex data. Read more
Source§

fn draw_indexed_u16( &mut self, _topology: PrimitiveTopology, _count: u32, _offset: usize, ) -> GoudResult<()>

Draws primitives using indexed vertex data with u16 indices. Read more
Source§

fn draw_arrays_instanced( &mut self, _topology: PrimitiveTopology, _first: u32, _count: u32, _instance_count: u32, ) -> GoudResult<()>

Draws multiple instances of primitives using array-based vertex data. Read more
Source§

fn draw_indexed_instanced( &mut self, _topology: PrimitiveTopology, _count: u32, _offset: usize, _instance_count: u32, ) -> GoudResult<()>

Draws multiple instances of primitives using indexed vertex data. Read more
Source§

impl FrameOps for NullBackend

Source§

fn begin_frame(&mut self) -> GoudResult<()>

Begins a new frame. Called once per frame before any rendering. Read more
Source§

fn end_frame(&mut self) -> GoudResult<()>

Ends the current frame. Called once per frame after all rendering. Read more
Source§

impl RenderBackend for NullBackend

Source§

fn info(&self) -> &BackendInfo

Returns information about this backend implementation.
Source§

fn capabilities(&self) -> &BackendCapabilities

Returns the capabilities of this backend.
Source§

impl ShaderOps for NullBackend

Source§

fn create_shader( &mut self, _vertex_src: &str, _fragment_src: &str, ) -> GoudResult<ShaderHandle>

Compiles and links a shader program from vertex and fragment shader sources. Read more
Source§

fn destroy_shader(&mut self, handle: ShaderHandle) -> bool

Destroys a shader program and frees GPU memory. Read more
Source§

fn is_shader_valid(&self, handle: ShaderHandle) -> bool

Checks if a shader handle is valid and refers to an existing shader program.
Source§

fn bind_shader(&mut self, handle: ShaderHandle) -> GoudResult<()>

Binds a shader program for use in subsequent draw calls. Read more
Source§

fn unbind_shader(&mut self)

Unbinds the currently bound shader program.
Source§

fn get_uniform_location(&self, handle: ShaderHandle, _name: &str) -> Option<i32>

Gets the location of a uniform variable in a shader program. Read more
Source§

fn set_uniform_int(&mut self, _location: i32, _value: i32)

Sets a uniform integer value.
Source§

fn set_uniform_float(&mut self, _location: i32, _value: f32)

Sets a uniform float value.
Source§

fn set_uniform_vec2(&mut self, _location: i32, _x: f32, _y: f32)

Sets a uniform vec2 value.
Source§

fn set_uniform_vec3(&mut self, _location: i32, _x: f32, _y: f32, _z: f32)

Sets a uniform vec3 value.
Source§

fn set_uniform_vec4( &mut self, _location: i32, _x: f32, _y: f32, _z: f32, _w: f32, )

Sets a uniform vec4 value.
Source§

fn set_uniform_mat4(&mut self, _location: i32, _matrix: &[f32; 16])

Sets a uniform mat4 value. Read more
Source§

impl StateOps for NullBackend

Source§

fn set_viewport(&mut self, x: i32, y: i32, width: u32, height: u32)

Sets the viewport rectangle. Read more
Source§

fn enable_depth_test(&mut self)

Enables depth testing.
Source§

fn disable_depth_test(&mut self)

Disables depth testing.
Source§

fn enable_blending(&mut self)

Enables alpha blending.
Source§

fn disable_blending(&mut self)

Disables alpha blending.
Source§

fn set_blend_func(&mut self, _src: BlendFactor, _dst: BlendFactor)

Sets the blend function. Read more
Source§

fn enable_culling(&mut self)

Enables face culling.
Source§

fn disable_culling(&mut self)

Disables face culling.
Source§

fn set_cull_face(&mut self, _face: CullFace)

Sets which faces to cull.
Source§

fn set_depth_func(&mut self, _func: DepthFunc)

Sets the depth comparison function.
Source§

fn set_front_face(&mut self, _face: FrontFace)

Sets the front face winding order.
Source§

fn set_depth_mask(&mut self, enabled: bool)

Enables or disables writing to the depth buffer.
Source§

fn set_line_width(&mut self, width: f32)

Sets the line width for line primitives.
Source§

impl TextureOps for NullBackend

Source§

fn create_texture( &mut self, width: u32, height: u32, _format: TextureFormat, _filter: TextureFilter, _wrap: TextureWrap, _data: &[u8], ) -> GoudResult<TextureHandle>

Creates a GPU texture with the specified dimensions, format, and initial data. Read more
Source§

fn update_texture( &mut self, handle: TextureHandle, _x: u32, _y: u32, _width: u32, _height: u32, _data: &[u8], ) -> GoudResult<()>

Updates a region of an existing texture with new pixel data. Read more
Source§

fn destroy_texture(&mut self, handle: TextureHandle) -> bool

Destroys a texture and frees GPU memory. Read more
Source§

fn is_texture_valid(&self, handle: TextureHandle) -> bool

Checks if a texture handle is valid and refers to an existing texture.
Source§

fn texture_size(&self, handle: TextureHandle) -> Option<(u32, u32)>

Returns the dimensions (width, height) of a texture, or None if invalid.
Source§

fn bind_texture(&mut self, handle: TextureHandle, _unit: u32) -> GoudResult<()>

Binds a texture to a texture unit for use in subsequent draw calls. Read more
Source§

fn unbind_texture(&mut self, _unit: u32)

Unbinds any texture from the specified texture unit.
Source§

impl Send for NullBackend

Source§

impl Sync for NullBackend

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> Event for T
where T: Send + Sync + 'static,

Source§

impl<T> Resource for T
where T: Send + Sync + 'static,