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
impl NullBackend
Trait Implementations§
Source§impl BufferOps for NullBackend
impl BufferOps for NullBackend
Source§fn create_buffer(
&mut self,
buffer_type: BufferType,
_usage: BufferUsage,
data: &[u8],
) -> GoudResult<BufferHandle>
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<()>
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
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
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>
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<()>
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)
fn unbind_buffer(&mut self, _buffer_type: BufferType)
Unbinds the currently bound buffer of the specified type.
Source§impl ClearOps for NullBackend
impl ClearOps for NullBackend
Source§fn set_clear_color(&mut self, r: f32, g: f32, b: f32, a: f32)
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)
fn clear_color(&mut self)
Clears the color buffer using the current clear color.
Source§fn clear_depth(&mut self)
fn clear_depth(&mut self)
Clears the depth buffer.
Source§impl Default for NullBackend
impl Default for NullBackend
Source§impl DrawOps for NullBackend
impl DrawOps for NullBackend
Source§fn set_vertex_attributes(&mut self, _layout: &VertexLayout)
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<()>
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<()>
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<()>
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<()>
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<()>
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
impl FrameOps for NullBackend
Source§fn begin_frame(&mut self) -> GoudResult<()>
fn begin_frame(&mut self) -> GoudResult<()>
Begins a new frame. Called once per frame before any rendering. Read more
Source§impl RenderBackend for NullBackend
impl RenderBackend for NullBackend
Source§fn info(&self) -> &BackendInfo
fn info(&self) -> &BackendInfo
Returns information about this backend implementation.
Source§fn capabilities(&self) -> &BackendCapabilities
fn capabilities(&self) -> &BackendCapabilities
Returns the capabilities of this backend.
Source§impl ShaderOps for NullBackend
impl ShaderOps for NullBackend
Source§fn create_shader(
&mut self,
_vertex_src: &str,
_fragment_src: &str,
) -> GoudResult<ShaderHandle>
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
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
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<()>
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)
fn unbind_shader(&mut self)
Unbinds the currently bound shader program.
Source§fn get_uniform_location(&self, handle: ShaderHandle, _name: &str) -> Option<i32>
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)
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)
fn set_uniform_float(&mut self, _location: i32, _value: f32)
Sets a uniform float value.
Source§fn set_uniform_vec3(&mut self, _location: i32, _x: f32, _y: f32, _z: f32)
fn set_uniform_vec3(&mut self, _location: i32, _x: f32, _y: f32, _z: f32)
Sets a uniform vec3 value.
Source§impl StateOps for NullBackend
impl StateOps for NullBackend
Source§fn set_viewport(&mut self, x: i32, y: i32, width: u32, height: u32)
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)
fn enable_depth_test(&mut self)
Enables depth testing.
Source§fn disable_depth_test(&mut self)
fn disable_depth_test(&mut self)
Disables depth testing.
Source§fn enable_blending(&mut self)
fn enable_blending(&mut self)
Enables alpha blending.
Source§fn disable_blending(&mut self)
fn disable_blending(&mut self)
Disables alpha blending.
Source§fn set_blend_func(&mut self, _src: BlendFactor, _dst: BlendFactor)
fn set_blend_func(&mut self, _src: BlendFactor, _dst: BlendFactor)
Sets the blend function. Read more
Source§fn enable_culling(&mut self)
fn enable_culling(&mut self)
Enables face culling.
Source§fn disable_culling(&mut self)
fn disable_culling(&mut self)
Disables face culling.
Source§fn set_cull_face(&mut self, _face: CullFace)
fn set_cull_face(&mut self, _face: CullFace)
Sets which faces to cull.
Source§fn set_depth_func(&mut self, _func: DepthFunc)
fn set_depth_func(&mut self, _func: DepthFunc)
Sets the depth comparison function.
Source§fn set_front_face(&mut self, _face: FrontFace)
fn set_front_face(&mut self, _face: FrontFace)
Sets the front face winding order.
Source§fn set_depth_mask(&mut self, enabled: bool)
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)
fn set_line_width(&mut self, width: f32)
Sets the line width for line primitives.
Source§impl TextureOps for NullBackend
impl TextureOps for NullBackend
Source§fn create_texture(
&mut self,
width: u32,
height: u32,
_format: TextureFormat,
_filter: TextureFilter,
_wrap: TextureWrap,
_data: &[u8],
) -> GoudResult<TextureHandle>
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<()>
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
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
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)>
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<()>
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)
fn unbind_texture(&mut self, _unit: u32)
Unbinds any texture from the specified texture unit.
impl Send for NullBackend
impl Sync for NullBackend
Auto Trait Implementations§
impl Freeze for NullBackend
impl RefUnwindSafe for NullBackend
impl Unpin for NullBackend
impl UnsafeUnpin for NullBackend
impl UnwindSafe for NullBackend
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
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
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().