Documentation
¶
Overview ¶
Package noop provides a no-operation GPU backend.
The noop backend implements all HAL interfaces but performs no actual GPU operations. It is useful for:
- Testing code without GPU hardware
- CI/CD environments without GPU access
- Reference implementation showing minimal HAL requirements
- Fallback when no real backend is available
All operations succeed immediately and return placeholder resources. The backend is identified as types.BackendEmpty.
Index ¶
- type API
- type Adapter
- type Buffer
- type CommandEncoder
- func (c *CommandEncoder) BeginComputePass(_ *hal.ComputePassDescriptor) hal.ComputePassEncoder
- func (c *CommandEncoder) BeginEncoding(_ string) error
- func (c *CommandEncoder) BeginRenderPass(_ *hal.RenderPassDescriptor) hal.RenderPassEncoder
- func (c *CommandEncoder) ClearBuffer(_ hal.Buffer, _, _ uint64)
- func (c *CommandEncoder) CopyBufferToBuffer(_, _ hal.Buffer, _ []hal.BufferCopy)
- func (c *CommandEncoder) CopyBufferToTexture(_ hal.Buffer, _ hal.Texture, _ []hal.BufferTextureCopy)
- func (c *CommandEncoder) CopyTextureToBuffer(_ hal.Texture, _ hal.Buffer, _ []hal.BufferTextureCopy)
- func (c *CommandEncoder) CopyTextureToTexture(_, _ hal.Texture, _ []hal.TextureCopy)
- func (c *CommandEncoder) DiscardEncoding()
- func (c *CommandEncoder) EndEncoding() (hal.CommandBuffer, error)
- func (c *CommandEncoder) ResetAll(_ []hal.CommandBuffer)
- func (c *CommandEncoder) ResolveQuerySet(_ hal.QuerySet, _, _ uint32, _ hal.Buffer, _ uint64)
- func (c *CommandEncoder) TransitionBuffers(_ []hal.BufferBarrier)
- func (c *CommandEncoder) TransitionTextures(_ []hal.TextureBarrier)
- type ComputePassEncoder
- func (c *ComputePassEncoder) Dispatch(_, _, _ uint32)
- func (c *ComputePassEncoder) DispatchIndirect(_ hal.Buffer, _ uint64)
- func (c *ComputePassEncoder) End()
- func (c *ComputePassEncoder) SetBindGroup(_ uint32, _ hal.BindGroup, _ []uint32)
- func (c *ComputePassEncoder) SetPipeline(_ hal.ComputePipeline)
- type Device
- func (d *Device) CreateBindGroup(_ *hal.BindGroupDescriptor) (hal.BindGroup, error)
- func (d *Device) CreateBindGroupLayout(_ *hal.BindGroupLayoutDescriptor) (hal.BindGroupLayout, error)
- func (d *Device) CreateBuffer(desc *hal.BufferDescriptor) (hal.Buffer, error)
- func (d *Device) CreateCommandEncoder(_ *hal.CommandEncoderDescriptor) (hal.CommandEncoder, error)
- func (d *Device) CreateComputePipeline(_ *hal.ComputePipelineDescriptor) (hal.ComputePipeline, error)
- func (d *Device) CreateFence() (hal.Fence, error)
- func (d *Device) CreatePipelineLayout(_ *hal.PipelineLayoutDescriptor) (hal.PipelineLayout, error)
- func (d *Device) CreateQuerySet(_ *hal.QuerySetDescriptor) (hal.QuerySet, error)
- func (d *Device) CreateRenderBundleEncoder(desc *hal.RenderBundleEncoderDescriptor) (hal.RenderBundleEncoder, error)
- func (d *Device) CreateRenderPipeline(_ *hal.RenderPipelineDescriptor) (hal.RenderPipeline, error)
- func (d *Device) CreateSampler(_ *hal.SamplerDescriptor) (hal.Sampler, error)
- func (d *Device) CreateShaderModule(_ *hal.ShaderModuleDescriptor) (hal.ShaderModule, error)
- func (d *Device) CreateTexture(_ *hal.TextureDescriptor) (hal.Texture, error)
- func (d *Device) CreateTextureView(_ hal.Texture, _ *hal.TextureViewDescriptor) (hal.TextureView, error)
- func (d *Device) Destroy()
- func (d *Device) DestroyBindGroup(_ hal.BindGroup)
- func (d *Device) DestroyBindGroupLayout(_ hal.BindGroupLayout)
- func (d *Device) DestroyBuffer(_ hal.Buffer)
- func (d *Device) DestroyComputePipeline(_ hal.ComputePipeline)
- func (d *Device) DestroyFence(_ hal.Fence)
- func (d *Device) DestroyPipelineLayout(_ hal.PipelineLayout)
- func (d *Device) DestroyQuerySet(_ hal.QuerySet)
- func (d *Device) DestroyRenderBundle(bundle hal.RenderBundle)
- func (d *Device) DestroyRenderPipeline(_ hal.RenderPipeline)
- func (d *Device) DestroySampler(_ hal.Sampler)
- func (d *Device) DestroyShaderModule(_ hal.ShaderModule)
- func (d *Device) DestroyTexture(_ hal.Texture)
- func (d *Device) DestroyTextureView(_ hal.TextureView)
- func (d *Device) FreeCommandBuffer(cmdBuffer hal.CommandBuffer)
- func (d *Device) GetFenceStatus(fence hal.Fence) (bool, error)
- func (d *Device) ResetFence(fence hal.Fence) error
- func (d *Device) Wait(fence hal.Fence, value uint64, _ time.Duration) (bool, error)
- func (d *Device) WaitIdle() error
- type Fence
- type Instance
- type Queue
- func (q *Queue) GetTimestampPeriod() float32
- func (q *Queue) Present(_ hal.Surface, _ hal.SurfaceTexture) error
- func (q *Queue) ReadBuffer(buffer hal.Buffer, offset uint64, data []byte) error
- func (q *Queue) Submit(_ []hal.CommandBuffer, fence hal.Fence, fenceValue uint64) error
- func (q *Queue) WriteBuffer(buffer hal.Buffer, offset uint64, data []byte) error
- func (q *Queue) WriteTexture(_ *hal.ImageCopyTexture, _ []byte, _ *hal.ImageDataLayout, _ *hal.Extent3D) error
- type RenderPassEncoder
- func (r *RenderPassEncoder) Draw(_, _, _, _ uint32)
- func (r *RenderPassEncoder) DrawIndexed(_, _, _ uint32, _ int32, _ uint32)
- func (r *RenderPassEncoder) DrawIndexedIndirect(_ hal.Buffer, _ uint64)
- func (r *RenderPassEncoder) DrawIndirect(_ hal.Buffer, _ uint64)
- func (r *RenderPassEncoder) End()
- func (r *RenderPassEncoder) ExecuteBundle(_ hal.RenderBundle)
- func (r *RenderPassEncoder) SetBindGroup(_ uint32, _ hal.BindGroup, _ []uint32)
- func (r *RenderPassEncoder) SetBlendConstant(_ *gputypes.Color)
- func (r *RenderPassEncoder) SetIndexBuffer(_ hal.Buffer, _ gputypes.IndexFormat, _ uint64)
- func (r *RenderPassEncoder) SetPipeline(_ hal.RenderPipeline)
- func (r *RenderPassEncoder) SetScissorRect(_, _, _, _ uint32)
- func (r *RenderPassEncoder) SetStencilReference(_ uint32)
- func (r *RenderPassEncoder) SetVertexBuffer(_ uint32, _ hal.Buffer, _ uint64)
- func (r *RenderPassEncoder) SetViewport(_, _, _, _, _, _ float32)
- type Resource
- type Surface
- type SurfaceTexture
- type Texture
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct{}
API implements hal.Backend for the noop backend.
func (API) CreateInstance ¶
CreateInstance creates a new noop instance. Always succeeds and returns a placeholder instance.
type Adapter ¶
type Adapter struct{}
Adapter implements hal.Adapter for the noop backend.
func (*Adapter) Open ¶
Open creates a noop device with the requested features and limits. Always succeeds and returns a device/queue pair.
func (*Adapter) SurfaceCapabilities ¶
func (a *Adapter) SurfaceCapabilities(_ hal.Surface) *hal.SurfaceCapabilities
SurfaceCapabilities returns default surface capabilities.
func (*Adapter) TextureFormatCapabilities ¶
func (a *Adapter) TextureFormatCapabilities(_ gputypes.TextureFormat) hal.TextureFormatCapabilities
TextureFormatCapabilities returns default capabilities for all formats.
type Buffer ¶
type Buffer struct {
Resource
// contains filtered or unexported fields
}
Buffer implements hal.Buffer with optional data storage. If created with MappedAtCreation, it stores the buffer data.
func (*Buffer) NativeHandle ¶ added in v0.12.0
NativeHandle returns 0 for noop buffers.
type CommandEncoder ¶
type CommandEncoder struct{}
CommandEncoder implements hal.CommandEncoder for the noop backend.
func (*CommandEncoder) BeginComputePass ¶
func (c *CommandEncoder) BeginComputePass(_ *hal.ComputePassDescriptor) hal.ComputePassEncoder
BeginComputePass returns a noop compute pass encoder.
func (*CommandEncoder) BeginEncoding ¶
func (c *CommandEncoder) BeginEncoding(_ string) error
BeginEncoding is a no-op.
func (*CommandEncoder) BeginRenderPass ¶
func (c *CommandEncoder) BeginRenderPass(_ *hal.RenderPassDescriptor) hal.RenderPassEncoder
BeginRenderPass returns a noop render pass encoder.
func (*CommandEncoder) ClearBuffer ¶
func (c *CommandEncoder) ClearBuffer(_ hal.Buffer, _, _ uint64)
ClearBuffer is a no-op.
func (*CommandEncoder) CopyBufferToBuffer ¶
func (c *CommandEncoder) CopyBufferToBuffer(_, _ hal.Buffer, _ []hal.BufferCopy)
CopyBufferToBuffer is a no-op.
func (*CommandEncoder) CopyBufferToTexture ¶
func (c *CommandEncoder) CopyBufferToTexture(_ hal.Buffer, _ hal.Texture, _ []hal.BufferTextureCopy)
CopyBufferToTexture is a no-op.
func (*CommandEncoder) CopyTextureToBuffer ¶
func (c *CommandEncoder) CopyTextureToBuffer(_ hal.Texture, _ hal.Buffer, _ []hal.BufferTextureCopy)
CopyTextureToBuffer is a no-op.
func (*CommandEncoder) CopyTextureToTexture ¶
func (c *CommandEncoder) CopyTextureToTexture(_, _ hal.Texture, _ []hal.TextureCopy)
CopyTextureToTexture is a no-op.
func (*CommandEncoder) DiscardEncoding ¶
func (c *CommandEncoder) DiscardEncoding()
DiscardEncoding is a no-op.
func (*CommandEncoder) EndEncoding ¶
func (c *CommandEncoder) EndEncoding() (hal.CommandBuffer, error)
EndEncoding returns a placeholder command buffer.
func (*CommandEncoder) ResetAll ¶
func (c *CommandEncoder) ResetAll(_ []hal.CommandBuffer)
ResetAll is a no-op.
func (*CommandEncoder) ResolveQuerySet ¶ added in v0.16.4
ResolveQuerySet is a no-op.
func (*CommandEncoder) TransitionBuffers ¶
func (c *CommandEncoder) TransitionBuffers(_ []hal.BufferBarrier)
TransitionBuffers is a no-op.
func (*CommandEncoder) TransitionTextures ¶
func (c *CommandEncoder) TransitionTextures(_ []hal.TextureBarrier)
TransitionTextures is a no-op.
type ComputePassEncoder ¶
type ComputePassEncoder struct{}
ComputePassEncoder implements hal.ComputePassEncoder for the noop backend.
func (*ComputePassEncoder) Dispatch ¶
func (c *ComputePassEncoder) Dispatch(_, _, _ uint32)
Dispatch is a no-op.
func (*ComputePassEncoder) DispatchIndirect ¶
func (c *ComputePassEncoder) DispatchIndirect(_ hal.Buffer, _ uint64)
DispatchIndirect is a no-op.
func (*ComputePassEncoder) SetBindGroup ¶
func (c *ComputePassEncoder) SetBindGroup(_ uint32, _ hal.BindGroup, _ []uint32)
SetBindGroup is a no-op.
func (*ComputePassEncoder) SetPipeline ¶
func (c *ComputePassEncoder) SetPipeline(_ hal.ComputePipeline)
SetPipeline is a no-op.
type Device ¶
type Device struct{}
Device implements hal.Device for the noop backend.
func (*Device) CreateBindGroup ¶
CreateBindGroup creates a noop bind group.
func (*Device) CreateBindGroupLayout ¶
func (d *Device) CreateBindGroupLayout(_ *hal.BindGroupLayoutDescriptor) (hal.BindGroupLayout, error)
CreateBindGroupLayout creates a noop bind group layout.
func (*Device) CreateBuffer ¶
CreateBuffer creates a noop buffer. Optionally stores data if MappedAtCreation is true.
func (*Device) CreateCommandEncoder ¶
func (d *Device) CreateCommandEncoder(_ *hal.CommandEncoderDescriptor) (hal.CommandEncoder, error)
CreateCommandEncoder creates a noop command encoder.
func (*Device) CreateComputePipeline ¶
func (d *Device) CreateComputePipeline(_ *hal.ComputePipelineDescriptor) (hal.ComputePipeline, error)
CreateComputePipeline creates a noop compute pipeline.
func (*Device) CreateFence ¶
CreateFence creates a noop fence with atomic counter.
func (*Device) CreatePipelineLayout ¶
func (d *Device) CreatePipelineLayout(_ *hal.PipelineLayoutDescriptor) (hal.PipelineLayout, error)
CreatePipelineLayout creates a noop pipeline layout.
func (*Device) CreateQuerySet ¶ added in v0.16.4
CreateQuerySet returns ErrTimestampsNotSupported (noop backend has no GPU).
func (*Device) CreateRenderBundleEncoder ¶ added in v0.13.0
func (d *Device) CreateRenderBundleEncoder(desc *hal.RenderBundleEncoderDescriptor) (hal.RenderBundleEncoder, error)
CreateRenderBundleEncoder is a no-op for the noop device.
func (*Device) CreateRenderPipeline ¶
func (d *Device) CreateRenderPipeline(_ *hal.RenderPipelineDescriptor) (hal.RenderPipeline, error)
CreateRenderPipeline creates a noop render pipeline.
func (*Device) CreateSampler ¶
CreateSampler creates a noop sampler.
func (*Device) CreateShaderModule ¶
func (d *Device) CreateShaderModule(_ *hal.ShaderModuleDescriptor) (hal.ShaderModule, error)
CreateShaderModule creates a noop shader module.
func (*Device) CreateTexture ¶
CreateTexture creates a noop texture.
func (*Device) CreateTextureView ¶
func (d *Device) CreateTextureView(_ hal.Texture, _ *hal.TextureViewDescriptor) (hal.TextureView, error)
CreateTextureView creates a noop texture view.
func (*Device) DestroyBindGroup ¶
DestroyBindGroup is a no-op.
func (*Device) DestroyBindGroupLayout ¶
func (d *Device) DestroyBindGroupLayout(_ hal.BindGroupLayout)
DestroyBindGroupLayout is a no-op.
func (*Device) DestroyBuffer ¶
DestroyBuffer is a no-op.
func (*Device) DestroyComputePipeline ¶
func (d *Device) DestroyComputePipeline(_ hal.ComputePipeline)
DestroyComputePipeline is a no-op.
func (*Device) DestroyPipelineLayout ¶
func (d *Device) DestroyPipelineLayout(_ hal.PipelineLayout)
DestroyPipelineLayout is a no-op.
func (*Device) DestroyQuerySet ¶ added in v0.16.4
DestroyQuerySet is a no-op.
func (*Device) DestroyRenderBundle ¶ added in v0.13.0
func (d *Device) DestroyRenderBundle(bundle hal.RenderBundle)
DestroyRenderBundle is a no-op for the noop device.
func (*Device) DestroyRenderPipeline ¶
func (d *Device) DestroyRenderPipeline(_ hal.RenderPipeline)
DestroyRenderPipeline is a no-op.
func (*Device) DestroySampler ¶
DestroySampler is a no-op.
func (*Device) DestroyShaderModule ¶
func (d *Device) DestroyShaderModule(_ hal.ShaderModule)
DestroyShaderModule is a no-op.
func (*Device) DestroyTexture ¶
DestroyTexture is a no-op.
func (*Device) DestroyTextureView ¶
func (d *Device) DestroyTextureView(_ hal.TextureView)
DestroyTextureView is a no-op.
func (*Device) FreeCommandBuffer ¶ added in v0.13.0
func (d *Device) FreeCommandBuffer(cmdBuffer hal.CommandBuffer)
FreeCommandBuffer is a no-op for the noop device.
func (*Device) GetFenceStatus ¶ added in v0.13.0
GetFenceStatus returns true if the fence is signaled (non-blocking).
func (*Device) ResetFence ¶ added in v0.13.0
ResetFence resets a fence to the unsignaled state.
type Fence ¶
type Fence struct {
Resource
// contains filtered or unexported fields
}
Fence implements hal.Fence with an atomic counter for synchronization.
type Instance ¶
type Instance struct{}
Instance implements hal.Instance for the noop backend.
func (*Instance) CreateSurface ¶
CreateSurface creates a noop surface. Always succeeds regardless of display/window handles.
func (*Instance) EnumerateAdapters ¶
func (i *Instance) EnumerateAdapters(_ hal.Surface) []hal.ExposedAdapter
EnumerateAdapters returns a single default noop adapter. The surfaceHint is ignored.
type Queue ¶
type Queue struct{}
Queue implements hal.Queue for the noop backend.
func (*Queue) GetTimestampPeriod ¶
GetTimestampPeriod returns 1.0 nanosecond timestamp period.
func (*Queue) ReadBuffer ¶ added in v0.15.0
ReadBuffer reads data from a buffer.
func (*Queue) Submit ¶
Submit simulates command buffer submission. If a fence is provided, it is signaled with the given value.
func (*Queue) WriteBuffer ¶
WriteBuffer simulates immediate buffer writes. If the buffer has storage, copies data to it.
func (*Queue) WriteTexture ¶
func (q *Queue) WriteTexture(_ *hal.ImageCopyTexture, _ []byte, _ *hal.ImageDataLayout, _ *hal.Extent3D) error
WriteTexture simulates immediate texture writes. This is a no-op since textures don't store data.
type RenderPassEncoder ¶
type RenderPassEncoder struct{}
RenderPassEncoder implements hal.RenderPassEncoder for the noop backend.
func (*RenderPassEncoder) Draw ¶
func (r *RenderPassEncoder) Draw(_, _, _, _ uint32)
Draw is a no-op.
func (*RenderPassEncoder) DrawIndexed ¶
func (r *RenderPassEncoder) DrawIndexed(_, _, _ uint32, _ int32, _ uint32)
DrawIndexed is a no-op.
func (*RenderPassEncoder) DrawIndexedIndirect ¶
func (r *RenderPassEncoder) DrawIndexedIndirect(_ hal.Buffer, _ uint64)
DrawIndexedIndirect is a no-op.
func (*RenderPassEncoder) DrawIndirect ¶
func (r *RenderPassEncoder) DrawIndirect(_ hal.Buffer, _ uint64)
DrawIndirect is a no-op.
func (*RenderPassEncoder) ExecuteBundle ¶
func (r *RenderPassEncoder) ExecuteBundle(_ hal.RenderBundle)
ExecuteBundle is a no-op.
func (*RenderPassEncoder) SetBindGroup ¶
func (r *RenderPassEncoder) SetBindGroup(_ uint32, _ hal.BindGroup, _ []uint32)
SetBindGroup is a no-op.
func (*RenderPassEncoder) SetBlendConstant ¶
func (r *RenderPassEncoder) SetBlendConstant(_ *gputypes.Color)
SetBlendConstant is a no-op.
func (*RenderPassEncoder) SetIndexBuffer ¶
func (r *RenderPassEncoder) SetIndexBuffer(_ hal.Buffer, _ gputypes.IndexFormat, _ uint64)
SetIndexBuffer is a no-op.
func (*RenderPassEncoder) SetPipeline ¶
func (r *RenderPassEncoder) SetPipeline(_ hal.RenderPipeline)
SetPipeline is a no-op.
func (*RenderPassEncoder) SetScissorRect ¶
func (r *RenderPassEncoder) SetScissorRect(_, _, _, _ uint32)
SetScissorRect is a no-op.
func (*RenderPassEncoder) SetStencilReference ¶
func (r *RenderPassEncoder) SetStencilReference(_ uint32)
SetStencilReference is a no-op.
func (*RenderPassEncoder) SetVertexBuffer ¶
func (r *RenderPassEncoder) SetVertexBuffer(_ uint32, _ hal.Buffer, _ uint64)
SetVertexBuffer is a no-op.
func (*RenderPassEncoder) SetViewport ¶
func (r *RenderPassEncoder) SetViewport(_, _, _, _, _, _ float32)
SetViewport is a no-op.
type Resource ¶
type Resource struct{}
Resource is a placeholder implementation for most HAL resource types. It implements the hal.Resource interface with a no-op Destroy method.
func (*Resource) NativeHandle ¶ added in v0.12.0
NativeHandle returns 0 for noop resources (no real handle).
type Surface ¶
type Surface struct {
Resource
// contains filtered or unexported fields
}
Surface implements hal.Surface for the noop backend.
func (*Surface) AcquireTexture ¶
AcquireTexture returns a placeholder surface texture. The fence parameter is ignored.
func (*Surface) DiscardTexture ¶
func (s *Surface) DiscardTexture(_ hal.SurfaceTexture)
DiscardTexture is a no-op.
func (*Surface) Unconfigure ¶
Unconfigure marks the surface as unconfigured.
type SurfaceTexture ¶
type SurfaceTexture struct {
Texture
}
SurfaceTexture implements hal.SurfaceTexture.