Documentation
¶
Index ¶
- Constants
- func FromBytes[T any](data []byte) []T
- func HasInstanceFeature(feature InstanceFeatureName) bool
- func ToBytes[T any, E ~[]T](data E) []byte
- type Adapter
- func (a *Adapter) GetFeatures() []FeatureName
- func (a *Adapter) GetInfo() AdapterInfo
- func (a *Adapter) GetLimits() Limits
- func (a *Adapter) HasFeature(feature FeatureName) bool
- func (a *Adapter) Release()
- func (a *Adapter) RequestDevice(descriptor *DeviceDescriptor) *Device
- func (a *Adapter) TryGetInfo() (AdapterInfo, error)
- func (a *Adapter) TryGetLimits() (Limits, error)
- func (a *Adapter) TryRequestDevice(descriptor *DeviceDescriptor) (*Device, error)
- type AdapterInfo
- type AdapterType
- type AddressMode
- type BackendType
- type BindGroup
- type BindGroupDescriptor
- type BindGroupEntry
- type BindGroupLayout
- type BindGroupLayoutDescriptor
- type BindGroupLayoutEntry
- type BlendComponent
- type BlendFactor
- type BlendOperation
- type BlendState
- type Buffer
- func (b *Buffer) AsImageCopyBuffer(bytesPerRow, rowsPerImage uint32) TexelCopyBufferInfo
- func (b *Buffer) Destroy()
- func (b *Buffer) GetConstMappedRange(offset int, size int) []byte
- func (b *Buffer) GetMapState() BufferMapState
- func (b *Buffer) GetMappedRange(offset int, size int) []byte
- func (b *Buffer) GetSize() uint64
- func (b *Buffer) GetUsage() BufferUsage
- func (b *Buffer) MapAsync(mode MapMode, offset int, size int, callback BufferMapCallback) Future
- func (b *Buffer) Release()
- func (b *Buffer) SetLabel(label string)
- func (b *Buffer) Unmap()
- type BufferBindingLayout
- type BufferBindingType
- type BufferDescriptor
- type BufferInitDescriptor
- type BufferMapCallback
- type BufferMapState
- type BufferUsage
- type Color
- type ColorTargetState
- type ColorWriteMask
- type CommandBuffer
- type CommandBufferDescriptor
- type CommandEncoder
- func (c *CommandEncoder) BeginComputePass(descriptor *ComputePassDescriptor) *ComputePassEncoder
- func (c *CommandEncoder) BeginRenderPass(descriptor RenderPassDescriptor) *RenderPassEncoder
- func (c *CommandEncoder) ClearBuffer(buffer *Buffer, offset uint64, size uint64)
- func (c *CommandEncoder) CopyBufferToBuffer(source *Buffer, sourceOffset uint64, destination *Buffer, ...)
- func (c *CommandEncoder) CopyBufferToTexture(source TexelCopyBufferInfo, destination TexelCopyTextureInfo, ...)
- func (c *CommandEncoder) CopyTextureToBuffer(source TexelCopyTextureInfo, destination TexelCopyBufferInfo, ...)
- func (c *CommandEncoder) CopyTextureToTexture(source TexelCopyTextureInfo, destination TexelCopyTextureInfo, ...)
- func (c *CommandEncoder) Finish(descriptor *CommandBufferDescriptor) *CommandBuffer
- func (c *CommandEncoder) InsertDebugMarker(markerLabel string)
- func (c *CommandEncoder) PopDebugGroup()
- func (c *CommandEncoder) PushDebugGroup(groupLabel string)
- func (c *CommandEncoder) Release()
- func (c *CommandEncoder) ResolveQuerySet(querySet *QuerySet, firstQuery uint32, queryCount uint32, destination *Buffer, ...)
- func (c *CommandEncoder) SetLabel(label string)
- func (c *CommandEncoder) WriteTimestamp(querySet *QuerySet, queryIndex uint32)
- type CommandEncoderDescriptor
- type CompareFunction
- type CompatibilityModeLimits
- type CompilationMessage
- type CompilationMessageType
- type ComponentSwizzle
- type CompositeAlphaMode
- type ComputePassDescriptor
- type ComputePassEncoder
- func (c *ComputePassEncoder) DispatchWorkgroups(workgroupCountX uint32, workgroupCountY uint32, workgroupCountZ uint32)
- func (c *ComputePassEncoder) DispatchWorkgroupsIndirect(indirectBuffer *Buffer, indirectOffset uint64)
- func (c *ComputePassEncoder) End()
- func (c *ComputePassEncoder) InsertDebugMarker(markerLabel string)
- func (c *ComputePassEncoder) PopDebugGroup()
- func (c *ComputePassEncoder) PushDebugGroup(groupLabel string)
- func (c *ComputePassEncoder) Release()
- func (c *ComputePassEncoder) SetBindGroup(groupIndex uint32, group *BindGroup, dynamicOffsets []uint32)
- func (c *ComputePassEncoder) SetLabel(label string)
- func (c *ComputePassEncoder) SetPipeline(pipeline *ComputePipeline)
- type ComputePipeline
- type ComputePipelineDescriptor
- type ComputeState
- type CreateComputePipelineAsyncCallback
- type CreatePipelineAsyncStatus
- type CreateRenderPipelineAsyncCallback
- type CullMode
- type DepthStencilState
- type Device
- func (d *Device) CreateBindGroup(descriptor BindGroupDescriptor) *BindGroup
- func (d *Device) CreateBindGroupLayout(descriptor BindGroupLayoutDescriptor) *BindGroupLayout
- func (d *Device) CreateBuffer(descriptor BufferDescriptor) *Buffer
- func (d *Device) CreateBufferInit(descriptor BufferInitDescriptor) *Buffer
- func (d *Device) CreateCommandEncoder(descriptor *CommandEncoderDescriptor) *CommandEncoder
- func (d *Device) CreateComputePipeline(descriptor ComputePipelineDescriptor) *ComputePipeline
- func (d *Device) CreateComputePipelineAsync(descriptor ComputePipelineDescriptor, ...) Future
- func (d *Device) CreatePipelineLayout(descriptor PipelineLayoutDescriptor) *PipelineLayout
- func (d *Device) CreateQuerySet(descriptor QuerySetDescriptor) QuerySet
- func (d *Device) CreateRenderBundleEncoder(descriptor RenderBundleEncoderDescriptor) RenderBundleEncoder
- func (d *Device) CreateRenderPipeline(descriptor RenderPipelineDescriptor) *RenderPipeline
- func (d *Device) CreateRenderPipelineAsync(descriptor RenderPipelineDescriptor, ...) Future
- func (d *Device) CreateSampler(descriptor *SamplerDescriptor) *Sampler
- func (d *Device) CreateShaderModule(descriptor ShaderModuleDescriptor) *ShaderModule
- func (d *Device) CreateTexture(descriptor *TextureDescriptor) *Texture
- func (d *Device) Destroy()
- func (d *Device) GetAdapterInfo() (AdapterInfo, error)
- func (d *Device) GetFeatures() []FeatureName
- func (d *Device) GetLimits() (Limits, error)
- func (d *Device) GetQueue() *Queue
- func (d *Device) HasFeature(feature FeatureName) bool
- func (d *Device) PopErrorScope(callback PopErrorScopeCallback)
- func (d *Device) PushErrorScope(filter ErrorFilter)
- func (d *Device) Release()
- func (d *Device) SetLabel(label string)
- func (d *Device) Try(fn func(), filters ...ErrorFilter) error
- type DeviceDescriptor
- type DeviceLostCallback
- type DeviceLostReason
- type ErrorFilter
- type ErrorType
- type Extent3D
- type FeatureLevel
- type FeatureName
- type FilterMode
- type FragmentState
- type FrontFace
- type Future
- type IndexFormat
- type Instance
- func (i *Instance) CreateSurface(descriptor SurfaceDescriptor) *Surface
- func (i *Instance) GetWGSLLanguageFeatures() []WGSLLanguageFeatureName
- func (i *Instance) HasWGSLLanguageFeature(feature WGSLLanguageFeatureName) bool
- func (i *Instance) ProcessEvents()
- func (i *Instance) Release()
- func (i *Instance) RequestAdapter(options *RequestAdapterOptions) (*Adapter, error)
- func (i *Instance) Wait(future Future, timeout time.Duration) error
- func (i *Instance) WaitAny(futures []Future, timeout time.Duration) error
- type InstanceDescriptor
- type InstanceFeatureName
- type InstanceLimits
- type Limits
- type LoadOp
- type MapAsyncStatus
- type MapMode
- type MipmapFilterMode
- type MultisampleState
- type OptionalBool
- type Origin3D
- type PassTimestampWrites
- type PipelineLayout
- type PipelineLayoutDescriptor
- type PopErrorScopeCallback
- type PowerPreference
- type PredefinedColorSpace
- type PresentMode
- type PrimitiveState
- type PrimitiveTopology
- type QuerySet
- type QuerySetDescriptor
- type QueryType
- type Queue
- func (q *Queue) OnSubmittedWorkDone(callback QueueWorkDoneCallback)
- func (q *Queue) Release()
- func (q *Queue) SetLabel(label string)
- func (q *Queue) Submit(commands ...*CommandBuffer)
- func (q *Queue) WriteBuffer(buffer *Buffer, offset uint64, data []byte)
- func (q *Queue) WriteTexture(destination TexelCopyTextureInfo, data []byte, ...)
- type QueueDescriptor
- type QueueWorkDoneCallback
- type QueueWorkDoneCallbackInfo
- type QueueWorkDoneStatus
- type RenderBundle
- type RenderBundleDescriptor
- type RenderBundleEncoder
- func (r *RenderBundleEncoder) Draw(vertexCount uint32, instanceCount uint32, firstVertex uint32, ...)
- func (r *RenderBundleEncoder) DrawIndexed(indexCount uint32, instanceCount uint32, firstIndex uint32, baseVertex int32, ...)
- func (r *RenderBundleEncoder) DrawIndexedIndirect(indirectBuffer *Buffer, indirectOffset uint64)
- func (r *RenderBundleEncoder) DrawIndirect(indirectBuffer *Buffer, indirectOffset uint64)
- func (r *RenderBundleEncoder) Finish(descriptor *RenderBundleDescriptor) RenderBundle
- func (r *RenderBundleEncoder) InsertDebugMarker(markerLabel string)
- func (r *RenderBundleEncoder) PopDebugGroup()
- func (r *RenderBundleEncoder) PushDebugGroup(groupLabel string)
- func (r *RenderBundleEncoder) SetBindGroup(groupIndex uint32, group *BindGroup, dynamicOffsets []uint32)
- func (r *RenderBundleEncoder) SetIndexBuffer(buffer *Buffer, format IndexFormat, offset uint64, size uint64)
- func (r *RenderBundleEncoder) SetLabel(label string)
- func (r *RenderBundleEncoder) SetPipeline(pipeline *RenderPipeline)
- func (r *RenderBundleEncoder) SetVertexBuffer(slot uint32, buffer *Buffer, offset uint64, size uint64)
- type RenderBundleEncoderDescriptor
- type RenderPassColorAttachment
- type RenderPassDepthStencilAttachment
- type RenderPassDescriptor
- type RenderPassEncoder
- func (r *RenderPassEncoder) BeginOcclusionQuery(queryIndex uint32)
- func (r *RenderPassEncoder) Draw(vertexCount uint32, instanceCount uint32, firstVertex uint32, ...)
- func (r *RenderPassEncoder) DrawIndexed(indexCount uint32, instanceCount uint32, firstIndex uint32, baseVertex int32, ...)
- func (r *RenderPassEncoder) DrawIndexedIndirect(indirectBuffer *Buffer, indirectOffset uint64)
- func (r *RenderPassEncoder) DrawIndirect(indirectBuffer *Buffer, indirectOffset uint64)
- func (r *RenderPassEncoder) End()
- func (r *RenderPassEncoder) EndOcclusionQuery()
- func (r *RenderPassEncoder) ExecuteBundles(bundles ...*RenderBundle)
- func (r *RenderPassEncoder) InsertDebugMarker(markerLabel string)
- func (r *RenderPassEncoder) PopDebugGroup()
- func (r *RenderPassEncoder) PushDebugGroup(groupLabel string)
- func (r *RenderPassEncoder) Release()
- func (r *RenderPassEncoder) SetBindGroup(groupIndex uint32, group *BindGroup, dynamicOffsets []uint32)
- func (r *RenderPassEncoder) SetBlendConstant(color Color)
- func (r *RenderPassEncoder) SetIndexBuffer(buffer *Buffer, format IndexFormat, offset uint64, size uint64)
- func (r *RenderPassEncoder) SetLabel(label string)
- func (r *RenderPassEncoder) SetPipeline(pipeline *RenderPipeline)
- func (r *RenderPassEncoder) SetScissorRect(x uint32, y uint32, width uint32, height uint32)
- func (r *RenderPassEncoder) SetStencilReference(reference uint32)
- func (r *RenderPassEncoder) SetVertexBuffer(slot uint32, buffer *Buffer, offset uint64, size uint64)
- func (r *RenderPassEncoder) SetViewport(x float32, y float32, width float32, height float32, minDepth float32, ...)
- type RenderPassMaxDrawCount
- type RenderPipeline
- type RenderPipelineDescriptor
- type RequestAdapterOptions
- type SType
- type Sampler
- type SamplerBindingLayout
- type SamplerBindingType
- type SamplerDescriptor
- type ShaderModule
- type ShaderModuleDescriptor
- type ShaderSourceSPIRV
- type ShaderSourceWGSL
- type ShaderStage
- type StencilFaceState
- type StencilOperation
- type StorageTextureAccess
- type StorageTextureBindingLayout
- type StoreOp
- type Surface
- func (s *Surface) Configure(config SurfaceConfiguration)
- func (s *Surface) GetCapabilities(adapter *Adapter) (SurfaceCapabilities, error)
- func (s *Surface) GetCurrentTexture() *Texture
- func (s *Surface) Present()
- func (s *Surface) Release()
- func (s *Surface) SetLabel(label string)
- func (s *Surface) TryGetCurrentTexture() (*Texture, error)
- func (s *Surface) TryPresent() error
- func (s *Surface) Unconfigure()
- type SurfaceCapabilities
- type SurfaceColorManagement
- type SurfaceConfiguration
- type SurfaceDescriptor
- type SurfaceSourceMetalLayer
- type SurfaceSourceWaylandSurface
- type SurfaceSourceWindowsHWND
- type SurfaceSourceXlibWindow
- type TexelCopyBufferInfo
- type TexelCopyBufferLayout
- type TexelCopyTextureInfo
- type Texture
- func (t *Texture) AsImageCopy() TexelCopyTextureInfo
- func (t *Texture) CreateView(descriptor *TextureViewDescriptor) *TextureView
- func (t *Texture) Destroy()
- func (t *Texture) GetDepthOrArrayLayers() uint32
- func (t *Texture) GetDimension() TextureDimension
- func (t *Texture) GetFormat() TextureFormat
- func (t *Texture) GetHeight() uint32
- func (t *Texture) GetMipLevelCount() uint32
- func (t *Texture) GetSampleCount() uint32
- func (t *Texture) GetTextureBindingViewDimension() TextureViewDimension
- func (t *Texture) GetUsage() TextureUsage
- func (t *Texture) GetWidth() uint32
- func (t *Texture) SetLabel(label string)
- type TextureAspect
- type TextureBindingLayout
- type TextureBindingViewDimension
- type TextureComponentSwizzle
- type TextureComponentSwizzleDescriptor
- type TextureDescriptor
- type TextureDimension
- type TextureFormat
- type TextureSampleType
- type TextureUsage
- type TextureView
- type TextureViewDescriptor
- type TextureViewDimension
- type ToneMappingMode
- type UncapturedErrorCallback
- type UncapturedErrorCallbackInfo
- type VertexAttribute
- type VertexBufferLayout
- type VertexFormat
- type VertexState
- type VertexStepMode
- type WGSLLanguageFeatureName
Constants ¶
const ( ArrayLayerCountUndefined = 0xffffffff CopyStrideUndefined = 0xffffffff LimitU32Undefined uint32 = 0xffffffff LimitU64Undefined uint64 = 0xffffffffffffffff MipLevelCountUndefined = 0xffffffff WholeMapSize = ^uint(0) WholeSize = 0xffffffffffffffff )
Variables ¶
This section is empty.
Functions ¶
func FromBytes ¶
FromBytes converts a slice of bytes to a slice of a specific type. This is useful for reading data from C functions that return byte arrays. Returns nil if the input slice is empty.
func HasInstanceFeature ¶
func HasInstanceFeature(feature InstanceFeatureName) bool
HasInstanceFeature checks if the given instance feature is supported by the WebGPU implementation. Returns true if the feature is supported, false otherwise.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter represents a GPU adapter, which is a physical or virtual device that can be used to create WebGPU resources.
func (*Adapter) GetFeatures ¶
func (a *Adapter) GetFeatures() []FeatureName
GetFeatures returns a list of all features supported by the adapter.
func (*Adapter) GetInfo ¶
func (a *Adapter) GetInfo() AdapterInfo
GetInfo returns information about the adapter, such as vendor, device name, and backend type. Panics if the information cannot be retrieved.
func (*Adapter) GetLimits ¶
GetLimits returns the limits supported by the adapter. Returns the limits, panics if they cannot be retrieved.
func (*Adapter) HasFeature ¶
func (a *Adapter) HasFeature(feature FeatureName) bool
HasFeature checks if the adapter supports the given feature. Returns true if the feature is supported, false otherwise.
func (*Adapter) Release ¶
func (a *Adapter) Release()
Release releases the adapter and all associated resources. After calling this method, the adapter should no longer be used.
func (*Adapter) RequestDevice ¶
func (a *Adapter) RequestDevice(descriptor *DeviceDescriptor) *Device
RequestDevice requests a logical GPU device from the adapter with the given descriptor. Panics if the request fails.
func (*Adapter) TryGetInfo ¶
func (a *Adapter) TryGetInfo() (AdapterInfo, error)
TryGetInfo returns information about the adapter, or an error if it cannot be retrieved.
func (*Adapter) TryGetLimits ¶
TryGetLimits returns the limits supported by the adapter, or an error if they cannot be retrieved.
func (*Adapter) TryRequestDevice ¶
func (a *Adapter) TryRequestDevice(descriptor *DeviceDescriptor) (*Device, error)
TryRequestDevice requests a logical GPU device from the adapter, returning the device and any error.
type AdapterInfo ¶
type AdapterInfo struct {
Vendor string
Architecture string
Device string
Description string
BackendType BackendType
AdapterType AdapterType
VendorID uint32
DeviceID uint32
SubgroupMinSize uint32
SubgroupMaxSize uint32
}
AdapterInfo contains information about a GPU adapter, including vendor, device, and backend details.
type AdapterType ¶
type AdapterType uint32
const ( AdapterTypeDiscreteGPU AdapterType = 1 AdapterTypeIntegratedGPU AdapterType = 2 AdapterTypeCPU AdapterType = 3 AdapterTypeUnknown AdapterType = 4 )
func (AdapterType) String ¶
func (a AdapterType) String() string
type AddressMode ¶
type AddressMode uint32
const ( AddressModeUndefined AddressMode = 0 AddressModeClampToEdge AddressMode = 1 AddressModeRepeat AddressMode = 2 AddressModeMirrorRepeat AddressMode = 3 )
type BackendType ¶
type BackendType uint32
const ( BackendTypeUndefined BackendType = 0 BackendTypeNull BackendType = 1 BackendTypeWebGPU BackendType = 2 BackendTypeD3D11 BackendType = 3 BackendTypeD3D12 BackendType = 4 BackendTypeMetal BackendType = 5 BackendTypeVulkan BackendType = 6 BackendTypeOpenGL BackendType = 7 BackendTypeOpenGLES BackendType = 8 )
func (BackendType) String ¶
func (b BackendType) String() string
type BindGroup ¶
type BindGroup struct {
// contains filtered or unexported fields
}
BindGroup represents a group of resources that are bound together and used in GPU commands. Bind groups are created from a device using a bind group layout and a set of resources.
type BindGroupDescriptor ¶
type BindGroupDescriptor struct {
Label string
Layout *BindGroupLayout
Entries []BindGroupEntry
}
BindGroupDescriptor describes a bind group, which is a collection of resources bound together for rendering.
type BindGroupEntry ¶
type BindGroupEntry struct {
Binding uint32
Buffer *Buffer
Offset uint64
Size uint64
Sampler *Sampler
TextureView *TextureView
}
BindGroupEntry represents a single entry in a bind group, binding a resource to a specific binding point.
type BindGroupLayout ¶
type BindGroupLayout struct {
// contains filtered or unexported fields
}
BindGroupLayout represents the interface for a bind group, defining the types and access patterns of its resources. Bind group layouts are created from a device and are used to create bind groups.
func (*BindGroupLayout) Release ¶
func (b *BindGroupLayout) Release()
Release releases the bind group layout and all associated resources. After calling this method, the layout should no longer be used.
func (*BindGroupLayout) SetLabel ¶
func (b *BindGroupLayout) SetLabel(label string)
SetLabel sets the debug label for the bind group layout. This label appears in debuggers and validation layers.
type BindGroupLayoutDescriptor ¶
type BindGroupLayoutDescriptor struct {
Label string
Entries []BindGroupLayoutEntry
}
BindGroupLayoutDescriptor describes a bind group layout, which defines the interface for a bind group.
type BindGroupLayoutEntry ¶
type BindGroupLayoutEntry struct {
Binding uint32
Visibility ShaderStage
BindingArraySize uint32
Buffer BufferBindingLayout
Sampler SamplerBindingLayout
Texture TextureBindingLayout
StorageTexture StorageTextureBindingLayout
}
BindGroupLayoutEntry describes a single entry in a bind group layout, defining the type and access pattern for a binding.
type BlendComponent ¶
type BlendComponent struct {
Operation BlendOperation
SrcFactor BlendFactor
DstFactor BlendFactor
}
BlendComponent describes how to blend a single color component (red, green, blue, or alpha) during rendering.
type BlendFactor ¶
type BlendFactor uint32
const ( BlendFactorUndefined BlendFactor = 0 BlendFactorZero BlendFactor = 1 BlendFactorOne BlendFactor = 2 BlendFactorSrc BlendFactor = 3 BlendFactorOneMinusSrc BlendFactor = 4 BlendFactorSrcAlpha BlendFactor = 5 BlendFactorOneMinusSrcAlpha BlendFactor = 6 BlendFactorDst BlendFactor = 7 BlendFactorOneMinusDst BlendFactor = 8 BlendFactorDstAlpha BlendFactor = 9 BlendFactorOneMinusDstAlpha BlendFactor = 10 BlendFactorSrcAlphaSaturated BlendFactor = 11 BlendFactorConstant BlendFactor = 12 BlendFactorOneMinusConstant BlendFactor = 13 BlendFactorSrc1 BlendFactor = 14 BlendFactorOneMinusSrc1 BlendFactor = 15 BlendFactorSrc1Alpha BlendFactor = 16 BlendFactorOneMinusSrc1Alpha BlendFactor = 17 )
type BlendOperation ¶
type BlendOperation uint32
const ( BlendOperationUndefined BlendOperation = 0 BlendOperationAdd BlendOperation = 1 BlendOperationSubtract BlendOperation = 2 BlendOperationReverseSubtract BlendOperation = 3 BlendOperationMin BlendOperation = 4 BlendOperationMax BlendOperation = 5 )
type BlendState ¶
type BlendState struct {
Color BlendComponent
Alpha BlendComponent
}
BlendState describes how to blend color and alpha components during rendering.
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer represents a GPU buffer, which is a region of memory that can be used to store data. Buffers are created from a device and can be mapped for reading or writing.
func (*Buffer) AsImageCopyBuffer ¶
func (b *Buffer) AsImageCopyBuffer(bytesPerRow, rowsPerImage uint32) TexelCopyBufferInfo
AsImageCopyBuffer returns a TexelCopyBufferInfo for use in image copy operations. The bytesPerRow and rowsPerImage parameters define the layout of the data.
func (*Buffer) Destroy ¶
func (b *Buffer) Destroy()
Destroy destroys the buffer and frees all associated GPU resources.
func (*Buffer) GetConstMappedRange ¶
MapModeRead GetConstMappedRange returns a slice of bytes representing the mapped range of the buffer for reading. The buffer must have been mapped with MapModeRead.
func (*Buffer) GetMapState ¶
func (b *Buffer) GetMapState() BufferMapState
GetMapState returns the current mapping state of the buffer.
func (*Buffer) GetMappedRange ¶
MapModeWrite GetMappedRange returns a slice of bytes representing the mapped range of the buffer for writing. The buffer must have been mapped with MapModeWrite.
func (*Buffer) GetUsage ¶
func (b *Buffer) GetUsage() BufferUsage
GetUsage returns the usage flags for the buffer.
func (*Buffer) MapAsync ¶
MapAsync maps the buffer for reading or writing asynchronously. The mode specifies whether to map for reading or writing. The offset and size specify the range of the buffer to map. The callback is called when the mapping is complete. Returns a Future that can be used to wait for the mapping to complete.
func (*Buffer) Release ¶
func (b *Buffer) Release()
Release releases the buffer and all associated resources. After calling this method, the buffer should no longer be used.
type BufferBindingLayout ¶
type BufferBindingLayout struct {
Type BufferBindingType
HasDynamicOffset bool
MinBindingSize uint64
}
BufferBindingLayout describes the layout for a buffer binding, including type and whether it has a dynamic offset.
type BufferBindingType ¶
type BufferBindingType uint32
const ( BufferBindingTypeBindingNotUsed BufferBindingType = 0 BufferBindingTypeUndefined BufferBindingType = 1 BufferBindingTypeUniform BufferBindingType = 2 BufferBindingTypeStorage BufferBindingType = 3 BufferBindingTypeReadOnlyStorage BufferBindingType = 4 )
type BufferDescriptor ¶
type BufferDescriptor struct {
Label string
Usage BufferUsage
Size uint64
MappedAtCreation bool
}
BufferDescriptor describes a buffer, including its size, usage flags, and whether it should be mapped at creation.
type BufferInitDescriptor ¶
type BufferInitDescriptor struct {
Label string
Usage BufferUsage
Contents []byte
}
BufferInitDescriptor describes a buffer to be created and initialized with data in a single operation.
type BufferMapCallback ¶
type BufferMapCallback func(status MapAsyncStatus, message string)
BufferMapCallback is called when a buffer mapping operation completes. The callback receives the status of the operation and any error message.
type BufferMapState ¶
type BufferMapState uint32
const ( BufferMapStateUnmapped BufferMapState = 1 BufferMapStatePending BufferMapState = 2 BufferMapStateMapped BufferMapState = 3 )
type BufferUsage ¶
type BufferUsage uint32
const ( BufferUsageNone BufferUsage = 0 BufferUsageMapRead BufferUsage = 1 BufferUsageMapWrite BufferUsage = 2 BufferUsageCopySrc BufferUsage = 4 BufferUsageCopyDst BufferUsage = 8 BufferUsageIndex BufferUsage = 16 BufferUsageVertex BufferUsage = 32 BufferUsageUniform BufferUsage = 64 BufferUsageStorage BufferUsage = 128 BufferUsageIndirect BufferUsage = 256 BufferUsageQueryResolve BufferUsage = 512 BufferUsageTexelBuffer BufferUsage = 1024 )
type ColorTargetState ¶
type ColorTargetState struct {
Format TextureFormat
Blend *BlendState
WriteMask ColorWriteMask
}
ColorTargetState describes the state of a color target in a render pipeline, including format, blend, and write mask.
type ColorWriteMask ¶
type ColorWriteMask uint32
const ( ColorWriteMaskNone ColorWriteMask = 0 ColorWriteMaskRed ColorWriteMask = 1 ColorWriteMaskGreen ColorWriteMask = 2 ColorWriteMaskBlue ColorWriteMask = 4 ColorWriteMaskAlpha ColorWriteMask = 8 ColorWriteMaskAll ColorWriteMask = 15 )
type CommandBuffer ¶
type CommandBuffer struct {
// contains filtered or unexported fields
}
CommandBuffer represents a sequence of GPU commands that can be submitted to a queue. Command buffers are created from a command encoder and contain recorded commands.
func (*CommandBuffer) Release ¶
func (c *CommandBuffer) Release()
Release releases the command buffer and all associated resources. After calling this method, the buffer should no longer be used.
func (*CommandBuffer) SetLabel ¶
func (c *CommandBuffer) SetLabel(label string)
SetLabel sets the debug label for the command buffer. This label appears in debuggers and validation layers.
type CommandBufferDescriptor ¶
type CommandBufferDescriptor struct {
Label string
}
CommandBufferDescriptor describes a command buffer, primarily for setting its label.
type CommandEncoder ¶
type CommandEncoder struct {
// contains filtered or unexported fields
}
CommandEncoder encodes a sequence of GPU commands that can be submitted to a queue. Command encoders are created from a device and are used to build command buffers.
func (*CommandEncoder) BeginComputePass ¶
func (c *CommandEncoder) BeginComputePass(descriptor *ComputePassDescriptor) *ComputePassEncoder
BeginComputePass begins a compute pass and returns a compute pass encoder. The descriptor can be used to set the label and timestamp writes for the pass.
func (*CommandEncoder) BeginRenderPass ¶
func (c *CommandEncoder) BeginRenderPass(descriptor RenderPassDescriptor) *RenderPassEncoder
BeginRenderPass begins a render pass and returns a render pass encoder. The descriptor defines the color attachments, depth stencil attachment, and other settings for the pass.
func (*CommandEncoder) ClearBuffer ¶
func (c *CommandEncoder) ClearBuffer(buffer *Buffer, offset uint64, size uint64)
ClearBuffer fills a buffer with zeros or a specific value. The offset and size specify the range of the buffer to clear. If size is 0, the whole buffer is cleared.
func (*CommandEncoder) CopyBufferToBuffer ¶
func (c *CommandEncoder) CopyBufferToBuffer(source *Buffer, sourceOffset uint64, destination *Buffer, destinationOffset uint64, size uint64)
CopyBufferToBuffer copies data from one buffer to another. The source and destination buffers must have the CopySrc and CopyDst usage flags respectively.
func (*CommandEncoder) CopyBufferToTexture ¶
func (c *CommandEncoder) CopyBufferToTexture(source TexelCopyBufferInfo, destination TexelCopyTextureInfo, copySize Extent3D)
CopyBufferToTexture copies data from a buffer to a texture. The source defines the buffer and layout, and the destination defines the texture and region.
func (*CommandEncoder) CopyTextureToBuffer ¶
func (c *CommandEncoder) CopyTextureToBuffer(source TexelCopyTextureInfo, destination TexelCopyBufferInfo, copySize Extent3D)
CopyTextureToBuffer copies data from a texture to a buffer. The source defines the texture and region, and the destination defines the buffer and layout.
func (*CommandEncoder) CopyTextureToTexture ¶
func (c *CommandEncoder) CopyTextureToTexture(source TexelCopyTextureInfo, destination TexelCopyTextureInfo, copySize Extent3D)
CopyTextureToTexture copies data from one texture to another. The source and destination define their respective textures and regions.
func (*CommandEncoder) Finish ¶
func (c *CommandEncoder) Finish(descriptor *CommandBufferDescriptor) *CommandBuffer
Finish finishes recording commands and returns a command buffer. The descriptor can be used to set the label of the command buffer.
func (*CommandEncoder) InsertDebugMarker ¶
func (c *CommandEncoder) InsertDebugMarker(markerLabel string)
InsertDebugMarker inserts a debug marker into the command encoder. The marker label is used to identify the marker in debuggers and profilers.
func (*CommandEncoder) PopDebugGroup ¶
func (c *CommandEncoder) PopDebugGroup()
PopDebugGroup pops the most recently pushed debug group from the command encoder.
func (*CommandEncoder) PushDebugGroup ¶
func (c *CommandEncoder) PushDebugGroup(groupLabel string)
PushDebugGroup pushes a debug group into the command encoder with the given label. Debug groups can be nested and are used to group commands in debuggers and profilers.
func (*CommandEncoder) Release ¶
func (c *CommandEncoder) Release()
Release releases the command encoder and all associated resources. After calling this method, the encoder should no longer be used.
func (*CommandEncoder) ResolveQuerySet ¶
func (c *CommandEncoder) ResolveQuerySet(querySet *QuerySet, firstQuery uint32, queryCount uint32, destination *Buffer, destinationOffset uint64)
ResolveQuerySet resolves an occlusion or timestamp query set to a buffer. The query results are written to the destination buffer starting at destinationOffset.
func (*CommandEncoder) SetLabel ¶
func (c *CommandEncoder) SetLabel(label string)
SetLabel sets the debug label for the command encoder. This label appears in debuggers and validation layers.
func (*CommandEncoder) WriteTimestamp ¶
func (c *CommandEncoder) WriteTimestamp(querySet *QuerySet, queryIndex uint32)
WriteTimestamp writes a timestamp to a query set at the current point in the command encoder. Timestamps can be used to measure GPU execution times.
type CommandEncoderDescriptor ¶
type CommandEncoderDescriptor struct {
Label string
}
CommandEncoderDescriptor describes a command encoder, primarily for setting its label.
type CompareFunction ¶
type CompareFunction uint32
const ( CompareFunctionUndefined CompareFunction = 0 CompareFunctionNever CompareFunction = 1 CompareFunctionLess CompareFunction = 2 CompareFunctionEqual CompareFunction = 3 CompareFunctionLessEqual CompareFunction = 4 CompareFunctionGreater CompareFunction = 5 CompareFunctionNotEqual CompareFunction = 6 CompareFunctionGreaterEqual CompareFunction = 7 CompareFunctionAlways CompareFunction = 8 )
type CompatibilityModeLimits ¶
type CompatibilityModeLimits struct {
MaxStorageBuffersInVertexStage uint32
MaxStorageTexturesInVertexStage uint32
MaxStorageBuffersInFragmentStage uint32
MaxStorageTexturesInFragmentStage uint32
}
CompatibilityModeLimits contains limits specific to WebGPU compatibility mode.
type CompilationMessage ¶
type CompilationMessage struct {
Message string
Type CompilationMessageType
LineNum uint64
LinePos uint64
Offset uint64
Length uint64
}
CompilationMessage contains a message from shader compilation, including type, text, and location information.
type CompilationMessageType ¶
type CompilationMessageType uint32
const ( CompilationMessageTypeError CompilationMessageType = 1 CompilationMessageTypeWarning CompilationMessageType = 2 CompilationMessageTypeInfo CompilationMessageType = 3 )
type ComponentSwizzle ¶
type ComponentSwizzle uint32
const ( ComponentSwizzleUndefined ComponentSwizzle = 0 ComponentSwizzleZero ComponentSwizzle = 1 ComponentSwizzleOne ComponentSwizzle = 2 ComponentSwizzleR ComponentSwizzle = 3 ComponentSwizzleG ComponentSwizzle = 4 ComponentSwizzleB ComponentSwizzle = 5 ComponentSwizzleA ComponentSwizzle = 6 )
type CompositeAlphaMode ¶
type CompositeAlphaMode uint32
const ( CompositeAlphaModeAuto CompositeAlphaMode = 0 CompositeAlphaModeOpaque CompositeAlphaMode = 1 CompositeAlphaModePremultiplied CompositeAlphaMode = 2 CompositeAlphaModeUnpremultiplied CompositeAlphaMode = 3 CompositeAlphaModeInherit CompositeAlphaMode = 4 )
type ComputePassDescriptor ¶
type ComputePassDescriptor struct {
Label string
TimestampWrites *PassTimestampWrites
}
ComputePassDescriptor describes a compute pass, including label and timestamp writes.
type ComputePassEncoder ¶
type ComputePassEncoder struct {
// contains filtered or unexported fields
}
ComputePassEncoder encodes compute commands that will be dispatched to the GPU. Compute pass encoders are created from a command encoder and are used to issue compute work.
func (*ComputePassEncoder) DispatchWorkgroups ¶
func (c *ComputePassEncoder) DispatchWorkgroups(workgroupCountX uint32, workgroupCountY uint32, workgroupCountZ uint32)
DispatchWorkgroups dispatches compute workgroups with the specified dimensions. Each workgroup runs the compute shader with the given number of threads.
func (*ComputePassEncoder) DispatchWorkgroupsIndirect ¶
func (c *ComputePassEncoder) DispatchWorkgroupsIndirect(indirectBuffer *Buffer, indirectOffset uint64)
DispatchWorkgroupsIndirect dispatches compute workgroups indirectly using parameters from a buffer. The indirectBuffer contains the workgroup count parameters and indirectOffset specifies the offset into that buffer.
func (*ComputePassEncoder) End ¶
func (c *ComputePassEncoder) End()
End ends the compute pass. After calling this method, no more commands can be recorded in this pass.
func (*ComputePassEncoder) InsertDebugMarker ¶
func (c *ComputePassEncoder) InsertDebugMarker(markerLabel string)
InsertDebugMarker inserts a debug marker into the compute pass. The marker label is used to identify the marker in debuggers and profilers.
func (*ComputePassEncoder) PopDebugGroup ¶
func (c *ComputePassEncoder) PopDebugGroup()
PopDebugGroup pops the most recently pushed debug group from the compute pass.
func (*ComputePassEncoder) PushDebugGroup ¶
func (c *ComputePassEncoder) PushDebugGroup(groupLabel string)
PushDebugGroup pushes a debug group into the compute pass with the given label. Debug groups can be nested and are used to group commands in debuggers and profilers.
func (*ComputePassEncoder) Release ¶
func (c *ComputePassEncoder) Release()
Release releases the compute pass encoder and all associated resources. After calling this method, the encoder should no longer be used.
func (*ComputePassEncoder) SetBindGroup ¶
func (c *ComputePassEncoder) SetBindGroup(groupIndex uint32, group *BindGroup, dynamicOffsets []uint32)
SetBindGroup sets a bind group to be used for subsequent compute commands. The groupIndex specifies which bind group slot to use. The dynamicOffsets provide values for any dynamic buffer offsets in the bind group.
func (*ComputePassEncoder) SetLabel ¶
func (c *ComputePassEncoder) SetLabel(label string)
SetLabel sets the debug label for the compute pass encoder. This label appears in debuggers and validation layers.
func (*ComputePassEncoder) SetPipeline ¶
func (c *ComputePassEncoder) SetPipeline(pipeline *ComputePipeline)
SetPipeline sets the compute pipeline to be used for subsequent compute commands.
type ComputePipeline ¶
type ComputePipeline struct {
// contains filtered or unexported fields
}
ComputePipeline represents a compute pipeline that can execute compute shaders. Compute pipelines are created from a device and a compute pipeline descriptor.
func (*ComputePipeline) GetBindGroupLayout ¶
func (c *ComputePipeline) GetBindGroupLayout(groupIndex uint32) *BindGroupLayout
GetBindGroupLayout returns the bind group layout at the specified group index for this compute pipeline. This layout defines the interface for bind groups used with this pipeline.
func (*ComputePipeline) Release ¶
func (c *ComputePipeline) Release()
Release releases the compute pipeline and all associated resources. After calling this method, the pipeline should no longer be used.
func (*ComputePipeline) SetLabel ¶
func (c *ComputePipeline) SetLabel(label string)
SetLabel sets the debug label for the compute pipeline. This label appears in debuggers and validation layers.
type ComputePipelineDescriptor ¶
type ComputePipelineDescriptor struct {
Label string
Layout *PipelineLayout
Compute ComputeState
}
ComputePipelineDescriptor describes a compute pipeline, including label, layout, and compute stage.
type ComputeState ¶
type ComputeState struct {
Module *ShaderModule
EntryPoint string
Constants map[string]float64
}
ComputeState describes the compute stage of a compute pipeline, including the shader module and entry point.
type CreateComputePipelineAsyncCallback ¶
type CreateComputePipelineAsyncCallback func(status CreatePipelineAsyncStatus, pipeline *ComputePipeline, message string)
CreateComputePipelineAsyncCallback is called when an asynchronous compute pipeline creation completes. The callback receives the status, the created pipeline (if successful), and any error message.
type CreatePipelineAsyncStatus ¶
type CreatePipelineAsyncStatus uint32
const ( CreatePipelineAsyncStatusSuccess CreatePipelineAsyncStatus = 1 CreatePipelineAsyncStatusCallbackCancelled CreatePipelineAsyncStatus = 2 CreatePipelineAsyncStatusValidationError CreatePipelineAsyncStatus = 3 CreatePipelineAsyncStatusInternalError CreatePipelineAsyncStatus = 4 )
type CreateRenderPipelineAsyncCallback ¶
type CreateRenderPipelineAsyncCallback func(status CreatePipelineAsyncStatus, pipeline *RenderPipeline, message string)
CreateRenderPipelineAsyncCallback is called when an asynchronous render pipeline creation completes. The callback receives the status, the created pipeline (if successful), and any error message.
type DepthStencilState ¶
type DepthStencilState struct {
Format TextureFormat
DepthWriteEnabled OptionalBool
DepthCompare CompareFunction
StencilFront StencilFaceState
StencilBack StencilFaceState
StencilReadMask uint32
StencilWriteMask uint32
DepthBias int32
DepthBiasSlopeScale float32
DepthBiasClamp float32
}
DepthStencilState describes the depth-stencil state for a render pipeline, including format, compare function, and stencil operations.
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device represents a logical GPU device that can be used to create resources and execute commands. It is the main interface for interacting with the GPU.
func (*Device) CreateBindGroup ¶
func (d *Device) CreateBindGroup(descriptor BindGroupDescriptor) *BindGroup
CreateBindGroup creates a bind group from the given descriptor, which defines a set of resources to be bound together.
func (*Device) CreateBindGroupLayout ¶
func (d *Device) CreateBindGroupLayout(descriptor BindGroupLayoutDescriptor) *BindGroupLayout
CreateBindGroupLayout creates a bind group layout from the given descriptor, which defines the interface for a bind group.
func (*Device) CreateBuffer ¶
func (d *Device) CreateBuffer(descriptor BufferDescriptor) *Buffer
CreateBuffer creates a new buffer with the given descriptor. Buffers are used to store data that can be read and written by shaders.
func (*Device) CreateBufferInit ¶
func (d *Device) CreateBufferInit(descriptor BufferInitDescriptor) *Buffer
CreateBufferInit creates a buffer and initializes it with the given contents in a single operation. This is more efficient than creating and then writing to the buffer separately.
func (*Device) CreateCommandEncoder ¶
func (d *Device) CreateCommandEncoder(descriptor *CommandEncoderDescriptor) *CommandEncoder
CreateCommandEncoder creates a command encoder from the given descriptor. Command encoders are used to record commands that will be submitted to the GPU queue.
func (*Device) CreateComputePipeline ¶
func (d *Device) CreateComputePipeline(descriptor ComputePipelineDescriptor) *ComputePipeline
CreateComputePipeline creates a compute pipeline from the given descriptor. Compute pipelines execute compute shaders on the GPU.
func (*Device) CreateComputePipelineAsync ¶
func (d *Device) CreateComputePipelineAsync(descriptor ComputePipelineDescriptor, callback CreateComputePipelineAsyncCallback) Future
CreateComputePipelineAsync creates a compute pipeline asynchronously from the given descriptor. Returns a Future that can be used to wait for the pipeline to be created. The callback is called when the pipeline is ready or an error occurs.
func (*Device) CreatePipelineLayout ¶
func (d *Device) CreatePipelineLayout(descriptor PipelineLayoutDescriptor) *PipelineLayout
CreatePipelineLayout creates a pipeline layout from the given descriptor. Pipeline layouts define the resource bindings used by pipelines.
func (*Device) CreateQuerySet ¶
func (d *Device) CreateQuerySet(descriptor QuerySetDescriptor) QuerySet
CreateQuerySet creates a query set from the given descriptor. Query sets are used to collect timestamp and occlusion query results.
func (*Device) CreateRenderBundleEncoder ¶
func (d *Device) CreateRenderBundleEncoder(descriptor RenderBundleEncoderDescriptor) RenderBundleEncoder
CreateRenderBundleEncoder creates a render bundle encoder from the given descriptor. Render bundles are pre-recorded render commands that can be executed efficiently multiple times.
func (*Device) CreateRenderPipeline ¶
func (d *Device) CreateRenderPipeline(descriptor RenderPipelineDescriptor) *RenderPipeline
CreateRenderPipeline creates a render pipeline from the given descriptor. Render pipelines define how graphics are rendered.
func (*Device) CreateRenderPipelineAsync ¶
func (d *Device) CreateRenderPipelineAsync(descriptor RenderPipelineDescriptor, callback CreateRenderPipelineAsyncCallback) Future
CreateRenderPipelineAsync creates a render pipeline asynchronously from the given descriptor. Returns a Future that can be used to wait for the pipeline to be created. The callback is called when the pipeline is ready or an error occurs.
func (*Device) CreateSampler ¶
func (d *Device) CreateSampler(descriptor *SamplerDescriptor) *Sampler
CreateSampler creates a sampler from the given descriptor. Samplers define how textures are sampled in shaders.
func (*Device) CreateShaderModule ¶
func (d *Device) CreateShaderModule(descriptor ShaderModuleDescriptor) *ShaderModule
CreateShaderModule creates a shader module from the given descriptor. Shader modules contain shader code (WGSL or SPIR-V) that can be used in pipelines.
func (*Device) CreateTexture ¶
func (d *Device) CreateTexture(descriptor *TextureDescriptor) *Texture
CreateTexture creates a new texture with the given descriptor. Textures are used to store image data that can be sampled by shaders.
func (*Device) Destroy ¶
func (d *Device) Destroy()
Destroy destroys the device and all associated resources. This is similar to Release but also frees all GPU resources associated with the device.
func (*Device) GetAdapterInfo ¶
func (d *Device) GetAdapterInfo() (AdapterInfo, error)
GetAdapterInfo returns information about the adapter that created this device. Returns the adapter info and an error if it cannot be retrieved.
func (*Device) GetFeatures ¶
func (d *Device) GetFeatures() []FeatureName
GetFeatures returns a list of all features supported by the device.
func (*Device) GetLimits ¶
GetLimits returns the limits supported by the device. Returns the limits and an error if they cannot be retrieved.
func (*Device) GetQueue ¶
GetQueue returns the default queue for this device. The queue is used to submit commands to the GPU.
func (*Device) HasFeature ¶
func (d *Device) HasFeature(feature FeatureName) bool
HasFeature checks if the device supports the given feature. Returns true if the feature is supported, false otherwise.
func (*Device) PopErrorScope ¶
func (d *Device) PopErrorScope(callback PopErrorScopeCallback)
PopErrorScope pops an error scope from the device's error scope stack and calls the callback with the result. The callback is called with the error type and message, or no error if the scope was empty.
func (*Device) PushErrorScope ¶
func (d *Device) PushErrorScope(filter ErrorFilter)
PushErrorScope pushes an error scope onto the device's error scope stack. Errors that match the filter will be captured in the scope.
func (*Device) Release ¶
func (d *Device) Release()
Release releases the device and all associated resources. After calling this method, the device should no longer be used.
func (*Device) SetLabel ¶
SetLabel sets the debug label for the device. This label appears in debuggers and validation layers.
func (*Device) Try ¶
func (d *Device) Try(fn func(), filters ...ErrorFilter) error
Try executes the given function and captures any errors that occur. The optional filters specify which error types to capture; if not provided, all error types are captured. Returns the captured error, if any.
type DeviceDescriptor ¶
type DeviceDescriptor struct {
Label string
RequiredFeatures []FeatureName
RequiredLimits *Limits
DefaultQueue QueueDescriptor
DeviceLostCallback DeviceLostCallback
UncapturedErrorCallback UncapturedErrorCallback
}
DeviceDescriptor describes a logical device, including required features, limits, and callbacks for errors and device loss.
type DeviceLostCallback ¶
type DeviceLostCallback func(device *Device, reason DeviceLostReason, message string)
DeviceLostCallback is called when a device is lost. The callback receives the device, the reason for loss, and a message describing what happened.
type DeviceLostReason ¶
type DeviceLostReason uint32
const ( DeviceLostReasonUnknown DeviceLostReason = 1 DeviceLostReasonDestroyed DeviceLostReason = 2 DeviceLostReasonCallbackCancelled DeviceLostReason = 3 DeviceLostReasonFailedCreation DeviceLostReason = 4 )
type ErrorFilter ¶
type ErrorFilter uint32
const ( ErrorFilterValidation ErrorFilter = 1 ErrorFilterOutOfMemory ErrorFilter = 2 ErrorFilterInternal ErrorFilter = 3 )
func (ErrorFilter) String ¶
func (e ErrorFilter) String() string
type Extent3D ¶
Extent3D defines the size of a resource in three dimensions, used for textures and other resources.
type FeatureLevel ¶
type FeatureLevel uint32
const ( FeatureLevelUndefined FeatureLevel = 0 FeatureLevelCompatibility FeatureLevel = 1 FeatureLevelCore FeatureLevel = 2 )
type FeatureName ¶
type FeatureName uint32
const ( FeatureNameCoreFeaturesAndLimits FeatureName = 1 FeatureNameDepthClipControl FeatureName = 2 FeatureNameDepth32FloatStencil8 FeatureName = 3 FeatureNameTextureCompressionBC FeatureName = 4 FeatureNameTextureCompressionBCSliced3D FeatureName = 5 FeatureNameTextureCompressionETC2 FeatureName = 6 FeatureNameTextureCompressionASTC FeatureName = 7 FeatureNameTextureCompressionASTCSliced3D FeatureName = 8 FeatureNameTimestampQuery FeatureName = 9 FeatureNameIndirectFirstInstance FeatureName = 10 FeatureNameShaderF16 FeatureName = 11 FeatureNameRG11B10UfloatRenderable FeatureName = 12 FeatureNameBGRA8UnormStorage FeatureName = 13 FeatureNameFloat32Filterable FeatureName = 14 FeatureNameFloat32Blendable FeatureName = 15 FeatureNameClipDistances FeatureName = 16 FeatureNameDualSourceBlending FeatureName = 17 FeatureNameSubgroups FeatureName = 18 FeatureNameTextureFormatsTier1 FeatureName = 19 FeatureNameTextureFormatsTier2 FeatureName = 20 FeatureNamePrimitiveIndex FeatureName = 21 FeatureNameTextureComponentSwizzle FeatureName = 22 )
type FilterMode ¶
type FilterMode uint32
const ( FilterModeUndefined FilterMode = 0 FilterModeNearest FilterMode = 1 FilterModeLinear FilterMode = 2 )
type FragmentState ¶
type FragmentState struct {
Module *ShaderModule
EntryPoint string
Constants map[string]float64
Targets []ColorTargetState
}
FragmentState describes the fragment stage of a render pipeline, including shader module, entry point, constants, and color targets.
type Future ¶
type Future struct {
// contains filtered or unexported fields
}
Future represents a handle to an asynchronous operation that can be waited on.
type IndexFormat ¶
type IndexFormat uint32
const ( IndexFormatUndefined IndexFormat = 0 IndexFormatUint16 IndexFormat = 1 IndexFormatUint32 IndexFormat = 2 )
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
Instance is a WebGPU instance, which serves as the entry point for all WebGPU operations. It manages the underlying GPU backend and is used to request adapters.
func CreateInstance ¶
func CreateInstance(descriptor *InstanceDescriptor) *Instance
CreateInstance creates a new WebGPU instance with optional descriptor. The instance is the entry point for all WebGPU operations.
func (*Instance) CreateSurface ¶
func (i *Instance) CreateSurface(descriptor SurfaceDescriptor) *Surface
CreateSurface creates a surface for rendering to a window. The surface is configured for the specified descriptor, which defines how the surface should be presented.
func (*Instance) GetWGSLLanguageFeatures ¶
func (i *Instance) GetWGSLLanguageFeatures() []WGSLLanguageFeatureName
GetWGSLLanguageFeatures returns all WGSL language features supported by the instance.
func (*Instance) HasWGSLLanguageFeature ¶
func (i *Instance) HasWGSLLanguageFeature(feature WGSLLanguageFeatureName) bool
HasWGSLLanguageFeature checks if the instance supports the given WGSL language feature. Returns true if the feature is supported, false otherwise.
func (*Instance) ProcessEvents ¶
func (i *Instance) ProcessEvents()
ProcessEvents processes any pending events in the instance, such as callbacks and device lost notifications. This must be called periodically to ensure callbacks are executed.
func (*Instance) Release ¶
func (i *Instance) Release()
Release releases the instance and all associated resources. After calling this method, the instance should no longer be used.
func (*Instance) RequestAdapter ¶
func (i *Instance) RequestAdapter(options *RequestAdapterOptions) (*Adapter, error)
RequestAdapter requests a GPU adapter from the instance based on the provided options. Returns the adapter and an error if the request fails.
type InstanceDescriptor ¶
type InstanceDescriptor struct {
RequiredFeatures []InstanceFeatureName
RequiredLimits *InstanceLimits
}
InstanceDescriptor describes an instance, including required features and limits.
type InstanceFeatureName ¶
type InstanceFeatureName uint32
const ( InstanceFeatureNameTimedWaitAny InstanceFeatureName = 1 InstanceFeatureNameShaderSourceSPIRV InstanceFeatureName = 2 InstanceFeatureNameMultipleDevicesPerAdapter InstanceFeatureName = 3 )
func GetInstanceFeatures ¶
func GetInstanceFeatures() []InstanceFeatureName
GetInstanceFeatures returns a list of all instance-level features supported by the WebGPU implementation.
type InstanceLimits ¶
type InstanceLimits struct {
TimedWaitAnyMaxCount int
}
InstanceLimits contains instance-level limits, such as the maximum number of futures that can be waited on concurrently.
func GetInstanceLimits ¶
func GetInstanceLimits() (InstanceLimits, error)
GetInstanceLimits returns the instance-level limits supported by the WebGPU implementation. Returns the limits and an error if they cannot be retrieved.
type Limits ¶
type Limits struct {
MaxTextureDimension1D uint32
MaxTextureDimension2D uint32
MaxTextureDimension3D uint32
MaxTextureArrayLayers uint32
MaxBindGroups uint32
MaxBindGroupsPlusVertexBuffers uint32
MaxBindingsPerBindGroup uint32
MaxDynamicUniformBuffersPerPipelineLayout uint32
MaxDynamicStorageBuffersPerPipelineLayout uint32
MaxSampledTexturesPerShaderStage uint32
MaxSamplersPerShaderStage uint32
MaxStorageBuffersPerShaderStage uint32
MaxStorageTexturesPerShaderStage uint32
MaxUniformBuffersPerShaderStage uint32
MaxUniformBufferBindingSize uint64
MaxStorageBufferBindingSize uint64
MinUniformBufferOffsetAlignment uint32
MinStorageBufferOffsetAlignment uint32
MaxVertexBuffers uint32
MaxBufferSize uint64
MaxVertexAttributes uint32
MaxVertexBufferArrayStride uint32
MaxInterStageShaderVariables uint32
MaxColorAttachments uint32
MaxColorAttachmentBytesPerSample uint32
MaxComputeWorkgroupStorageSize uint32
MaxComputeInvocationsPerWorkgroup uint32
MaxComputeWorkgroupSizeX uint32
MaxComputeWorkgroupSizeY uint32
MaxComputeWorkgroupSizeZ uint32
MaxComputeWorkgroupsPerDimension uint32
MaxImmediateSize uint32
}
Limits contains device-level limits for various GPU capabilities, such as maximum texture dimensions and buffer sizes.
type MapAsyncStatus ¶
type MapAsyncStatus uint32
const ( MapAsyncStatusSuccess MapAsyncStatus = 1 MapAsyncStatusCallbackCancelled MapAsyncStatus = 2 MapAsyncStatusError MapAsyncStatus = 3 MapAsyncStatusAborted MapAsyncStatus = 4 )
type MipmapFilterMode ¶
type MipmapFilterMode uint32
const ( MipmapFilterModeUndefined MipmapFilterMode = 0 MipmapFilterModeNearest MipmapFilterMode = 1 MipmapFilterModeLinear MipmapFilterMode = 2 )
type MultisampleState ¶
MultisampleState describes multisampling settings for a render pipeline, including sample count, mask, and alpha-to-coverage.
type OptionalBool ¶
type OptionalBool uint32
const ( OptionalBoolFalse OptionalBool = 0 OptionalBoolTrue OptionalBool = 1 OptionalBoolUndefined OptionalBool = 2 )
type Origin3D ¶
Origin3D defines a three-dimensional origin point, used for texture copy origins and viewport origins.
type PassTimestampWrites ¶
type PassTimestampWrites struct {
QuerySet *QuerySet
BeginningOfPassWriteIndex uint32
EndOfPassWriteIndex uint32
}
PassTimestampWrites defines where to write timestamps in a render or compute pass.
type PipelineLayout ¶
type PipelineLayout struct {
// contains filtered or unexported fields
}
PipelineLayout represents a pipeline layout that defines the bind group layouts used by a pipeline. Pipeline layouts are created from a device and are used when creating pipelines.
func (*PipelineLayout) Release ¶ added in v0.0.11
func (p *PipelineLayout) Release()
Release releases the device and all associated resources. After calling this method, the device should no longer be used.
func (*PipelineLayout) SetLabel ¶
func (p *PipelineLayout) SetLabel(label string)
SetLabel sets the debug label for the pipeline layout. This label appears in debuggers and validation layers.
type PipelineLayoutDescriptor ¶
type PipelineLayoutDescriptor struct {
Label string
BindGroupLayouts []*BindGroupLayout
ImmediateSize uint32
}
PipelineLayoutDescriptor describes a pipeline layout, which defines the bind group layouts used by a pipeline.
type PopErrorScopeCallback ¶
PopErrorScopeCallback is called when popping an error scope from the error scope stack. The callback receives the error type and any error message.
type PowerPreference ¶
type PowerPreference uint32
const ( PowerPreferenceUndefined PowerPreference = 0 PowerPreferenceLowPower PowerPreference = 1 PowerPreferenceHighPerformance PowerPreference = 2 )
type PredefinedColorSpace ¶
type PredefinedColorSpace uint32
const ( PredefinedColorSpaceSRGB PredefinedColorSpace = 1 PredefinedColorSpaceDisplayP3 PredefinedColorSpace = 2 PredefinedColorSpaceSRGBLinear PredefinedColorSpace = 3 PredefinedColorSpaceDisplayP3Linear PredefinedColorSpace = 4 )
type PresentMode ¶
type PresentMode uint32
const ( PresentModeUndefined PresentMode = 0 PresentModeFifo PresentMode = 1 PresentModeFifoRelaxed PresentMode = 2 PresentModeImmediate PresentMode = 3 PresentModeMailbox PresentMode = 4 )
func (PresentMode) String ¶
func (p PresentMode) String() string
type PrimitiveState ¶
type PrimitiveState struct {
Topology PrimitiveTopology
StripIndexFormat IndexFormat
FrontFace FrontFace
CullMode CullMode
UnclippedDepth bool
}
PrimitiveState describes the primitive topology and rasterization settings for a render pipeline.
type PrimitiveTopology ¶
type PrimitiveTopology uint32
const ( PrimitiveTopologyUndefined PrimitiveTopology = 0 PrimitiveTopologyPointList PrimitiveTopology = 1 PrimitiveTopologyLineList PrimitiveTopology = 2 PrimitiveTopologyLineStrip PrimitiveTopology = 3 PrimitiveTopologyTriangleList PrimitiveTopology = 4 PrimitiveTopologyTriangleStrip PrimitiveTopology = 5 )
type QuerySet ¶
type QuerySet struct {
// contains filtered or unexported fields
}
QuerySet represents a query set that can be used to collect timestamp and occlusion query results. Query sets are created from a device and have a specific type and count.
func (*QuerySet) Destroy ¶
func (q *QuerySet) Destroy()
Destroy destroys the query set and frees all associated GPU resources.
type QuerySetDescriptor ¶
QuerySetDescriptor describes a query set, which is used to collect timestamp and occlusion query results.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue represents a command queue that is used to submit commands to the GPU. Queues are obtained from a device and are used to execute command buffers.
func (*Queue) OnSubmittedWorkDone ¶
func (q *Queue) OnSubmittedWorkDone(callback QueueWorkDoneCallback)
OnSubmittedWorkDone registers a callback that is called when all previously submitted commands complete. The callback is called when the GPU has finished executing all commands submitted up to this point.
func (*Queue) Release ¶
func (q *Queue) Release()
Release releases the queue and all associated resources. After calling this method, the queue should no longer be used.
func (*Queue) SetLabel ¶
SetLabel sets the debug label for the queue. This label appears in debuggers and validation layers.
func (*Queue) Submit ¶
func (q *Queue) Submit(commands ...*CommandBuffer)
Submit submits command buffers to the queue for execution. The command buffers contain recorded commands that will be executed on the GPU.
func (*Queue) WriteBuffer ¶
WriteBuffer writes data from the CPU to a buffer on the GPU. The offset specifies where to start writing in the buffer.
func (*Queue) WriteTexture ¶
func (q *Queue) WriteTexture(destination TexelCopyTextureInfo, data []byte, dataLayout TexelCopyBufferLayout, writeSize Extent3D)
WriteTexture writes data from the CPU to a texture on the GPU. The destination defines the texture region to write to, and the dataLayout defines the layout of the source data.
type QueueDescriptor ¶
type QueueDescriptor struct {
Label string
}
QueueDescriptor describes a queue, primarily for setting its label.
type QueueWorkDoneCallback ¶
type QueueWorkDoneCallback func(status QueueWorkDoneStatus, message string)
QueueWorkDoneCallback is called when work submitted to a queue completes. The callback receives the status of the work and any error message.
type QueueWorkDoneCallbackInfo ¶
type QueueWorkDoneCallbackInfo struct {
Mode callbackMode
Callback QueueWorkDoneCallback
}
type QueueWorkDoneStatus ¶
type QueueWorkDoneStatus uint32
const ( QueueWorkDoneStatusSuccess QueueWorkDoneStatus = 1 QueueWorkDoneStatusCallbackCancelled QueueWorkDoneStatus = 2 QueueWorkDoneStatusError QueueWorkDoneStatus = 3 )
type RenderBundle ¶
type RenderBundle struct {
// contains filtered or unexported fields
}
RenderBundle represents a pre-recorded sequence of render commands that can be executed efficiently multiple times. Render bundles are created from a render bundle encoder and can be executed in render passes.
func (*RenderBundle) SetLabel ¶
func (r *RenderBundle) SetLabel(label string)
SetLabel sets the debug label for the render bundle. This label appears in debuggers and validation layers.
type RenderBundleDescriptor ¶
type RenderBundleDescriptor struct {
Label string
}
RenderBundleDescriptor describes a render bundle, primarily for setting its label.
type RenderBundleEncoder ¶
type RenderBundleEncoder struct {
// contains filtered or unexported fields
}
RenderBundleEncoder encodes a sequence of render commands that can be recorded into a render bundle. Render bundle encoders are created from a device and are used to pre-record render commands.
func (*RenderBundleEncoder) Draw ¶
func (r *RenderBundleEncoder) Draw(vertexCount uint32, instanceCount uint32, firstVertex uint32, firstInstance uint32)
Draw draws non-indexed primitives using the currently set pipeline and vertex buffers in the bundle. The vertexCount specifies the number of vertices to draw.
func (*RenderBundleEncoder) DrawIndexed ¶
func (r *RenderBundleEncoder) DrawIndexed(indexCount uint32, instanceCount uint32, firstIndex uint32, baseVertex int32, firstInstance uint32)
DrawIndexed draws indexed primitives using the currently set pipeline, index buffer, and vertex buffers in the bundle. The indexCount specifies the number of indices to draw.
func (*RenderBundleEncoder) DrawIndexedIndirect ¶
func (r *RenderBundleEncoder) DrawIndexedIndirect(indirectBuffer *Buffer, indirectOffset uint64)
DrawIndexedIndirect draws indexed primitives using parameters from a buffer in the bundle. The indirectBuffer contains the draw parameters and indirectOffset specifies the offset into that buffer.
func (*RenderBundleEncoder) DrawIndirect ¶
func (r *RenderBundleEncoder) DrawIndirect(indirectBuffer *Buffer, indirectOffset uint64)
DrawIndirect draws primitives using parameters from a buffer in the bundle. The indirectBuffer contains the draw parameters and indirectOffset specifies the offset into that buffer.
func (*RenderBundleEncoder) Finish ¶
func (r *RenderBundleEncoder) Finish(descriptor *RenderBundleDescriptor) RenderBundle
Finish finishes recording and returns a render bundle. The descriptor can be used to set the label of the render bundle.
func (*RenderBundleEncoder) InsertDebugMarker ¶
func (r *RenderBundleEncoder) InsertDebugMarker(markerLabel string)
InsertDebugMarker inserts a debug marker into the render bundle encoder. The marker label is used to identify the marker in debuggers and profilers.
func (*RenderBundleEncoder) PopDebugGroup ¶
func (r *RenderBundleEncoder) PopDebugGroup()
PopDebugGroup pops the most recently pushed debug group from the render bundle encoder.
func (*RenderBundleEncoder) PushDebugGroup ¶
func (r *RenderBundleEncoder) PushDebugGroup(groupLabel string)
PushDebugGroup pushes a debug group into the render bundle encoder with the given label. Debug groups can be nested and are used to group commands in debuggers and profilers.
func (*RenderBundleEncoder) SetBindGroup ¶
func (r *RenderBundleEncoder) SetBindGroup(groupIndex uint32, group *BindGroup, dynamicOffsets []uint32)
SetBindGroup sets a bind group to be used for subsequent render commands in the bundle. The groupIndex specifies which bind group slot to use. The dynamicOffsets provide values for any dynamic buffer offsets in the bind group.
func (*RenderBundleEncoder) SetIndexBuffer ¶
func (r *RenderBundleEncoder) SetIndexBuffer(buffer *Buffer, format IndexFormat, offset uint64, size uint64)
SetIndexBuffer sets an index buffer for subsequent indexed draw commands in the bundle. The format specifies the type of indices and the offset and size specify the region of the buffer to use.
func (*RenderBundleEncoder) SetLabel ¶
func (r *RenderBundleEncoder) SetLabel(label string)
SetLabel sets the debug label for the render bundle encoder. This label appears in debuggers and validation layers.
func (*RenderBundleEncoder) SetPipeline ¶
func (r *RenderBundleEncoder) SetPipeline(pipeline *RenderPipeline)
SetPipeline sets the render pipeline to be used for subsequent render commands in the bundle.
func (*RenderBundleEncoder) SetVertexBuffer ¶
func (r *RenderBundleEncoder) SetVertexBuffer(slot uint32, buffer *Buffer, offset uint64, size uint64)
SetVertexBuffer sets a vertex buffer at the specified slot for subsequent draw commands in the bundle. The offset and size specify the region of the buffer to use.
type RenderBundleEncoderDescriptor ¶
type RenderBundleEncoderDescriptor struct {
Label string
ColorFormats []TextureFormat
DepthStencilFormat TextureFormat
SampleCount uint32
DepthReadOnly bool
StencilReadOnly bool
}
RenderBundleEncoderDescriptor describes a render bundle encoder, including color formats, depth stencil format, and sample count.
type RenderPassColorAttachment ¶
type RenderPassColorAttachment struct {
View *TextureView
DepthSlice uint32
ResolveTarget *TextureView
LoadOp LoadOp
StoreOp StoreOp
ClearValue Color
}
RenderPassColorAttachment describes a color attachment for a render pass, including the texture view, load/store operations, and clear value.
type RenderPassDepthStencilAttachment ¶
type RenderPassDepthStencilAttachment struct {
View *TextureView
DepthLoadOp LoadOp
DepthStoreOp StoreOp
DepthClearValue float32
DepthReadOnly bool
StencilLoadOp LoadOp
StencilStoreOp StoreOp
StencilClearValue uint32
StencilReadOnly bool
}
RenderPassDepthStencilAttachment describes a depth-stencil attachment for a render pass, including format, load/store operations, and clear values.
type RenderPassDescriptor ¶
type RenderPassDescriptor struct {
Label string
ColorAttachments []RenderPassColorAttachment
DepthStencilAttachment *RenderPassDepthStencilAttachment
OcclusionQuerySet *QuerySet
TimestampWrites *PassTimestampWrites
}
RenderPassDescriptor describes a render pass, including label, color attachments, depth stencil attachment, and timestamp writes.
type RenderPassEncoder ¶
type RenderPassEncoder struct {
// contains filtered or unexported fields
}
RenderPassEncoder encodes render commands that will be drawn to a set of render targets. Render pass encoders are created from a command encoder and are used to issue rendering commands.
func (*RenderPassEncoder) BeginOcclusionQuery ¶
func (r *RenderPassEncoder) BeginOcclusionQuery(queryIndex uint32)
BeginOcclusionQuery begins an occlusion query at the specified query index. Occlusion queries can be used to determine how many samples pass the depth test.
func (*RenderPassEncoder) Draw ¶
func (r *RenderPassEncoder) Draw(vertexCount uint32, instanceCount uint32, firstVertex uint32, firstInstance uint32)
Draw draws non-indexed primitives using the currently set pipeline and vertex buffers. The vertexCount specifies the number of vertices to draw.
func (*RenderPassEncoder) DrawIndexed ¶
func (r *RenderPassEncoder) DrawIndexed(indexCount uint32, instanceCount uint32, firstIndex uint32, baseVertex int32, firstInstance uint32)
DrawIndexed draws indexed primitives using the currently set pipeline, index buffer, and vertex buffers. The indexCount specifies the number of indices to draw.
func (*RenderPassEncoder) DrawIndexedIndirect ¶
func (r *RenderPassEncoder) DrawIndexedIndirect(indirectBuffer *Buffer, indirectOffset uint64)
DrawIndexedIndirect draws indexed primitives using parameters from a buffer. The indirectBuffer contains the draw parameters and indirectOffset specifies the offset into that buffer.
func (*RenderPassEncoder) DrawIndirect ¶
func (r *RenderPassEncoder) DrawIndirect(indirectBuffer *Buffer, indirectOffset uint64)
DrawIndirect draws primitives using parameters from a buffer. The indirectBuffer contains the draw parameters and indirectOffset specifies the offset into that buffer.
func (*RenderPassEncoder) End ¶
func (r *RenderPassEncoder) End()
End ends the render pass. After calling this method, no more commands can be recorded in this pass.
func (*RenderPassEncoder) EndOcclusionQuery ¶
func (r *RenderPassEncoder) EndOcclusionQuery()
EndOcclusionQuery ends the current occlusion query.
func (*RenderPassEncoder) ExecuteBundles ¶
func (r *RenderPassEncoder) ExecuteBundles(bundles ...*RenderBundle)
ExecuteBundles executes a sequence of render bundles in the render pass. Render bundles are pre-recorded render commands that can be executed efficiently.
func (*RenderPassEncoder) InsertDebugMarker ¶
func (r *RenderPassEncoder) InsertDebugMarker(markerLabel string)
InsertDebugMarker inserts a debug marker into the render pass. The marker label is used to identify the marker in debuggers and profilers.
func (*RenderPassEncoder) PopDebugGroup ¶
func (r *RenderPassEncoder) PopDebugGroup()
PopDebugGroup pops the most recently pushed debug group from the render pass.
func (*RenderPassEncoder) PushDebugGroup ¶
func (r *RenderPassEncoder) PushDebugGroup(groupLabel string)
PushDebugGroup pushes a debug group into the render pass with the given label. Debug groups can be nested and are used to group commands in debuggers and profilers.
func (*RenderPassEncoder) Release ¶ added in v0.0.11
func (r *RenderPassEncoder) Release()
Release releases the device and all associated resources. After calling this method, the device should no longer be used.
func (*RenderPassEncoder) SetBindGroup ¶
func (r *RenderPassEncoder) SetBindGroup(groupIndex uint32, group *BindGroup, dynamicOffsets []uint32)
SetBindGroup sets a bind group to be used for subsequent render commands. The groupIndex specifies which bind group slot to use. The dynamicOffsets provide values for any dynamic buffer offsets in the bind group.
func (*RenderPassEncoder) SetBlendConstant ¶
func (r *RenderPassEncoder) SetBlendConstant(color Color)
SetBlendConstant sets the blend constant color used for blend operations that use a constant color.
func (*RenderPassEncoder) SetIndexBuffer ¶
func (r *RenderPassEncoder) SetIndexBuffer(buffer *Buffer, format IndexFormat, offset uint64, size uint64)
SetIndexBuffer sets an index buffer for subsequent indexed draw commands. The format specifies the type of indices and the offset and size specify the region of the buffer to use.
func (*RenderPassEncoder) SetLabel ¶
func (r *RenderPassEncoder) SetLabel(label string)
SetLabel sets the debug label for the render pass encoder. This label appears in debuggers and validation layers.
func (*RenderPassEncoder) SetPipeline ¶
func (r *RenderPassEncoder) SetPipeline(pipeline *RenderPipeline)
SetPipeline sets the render pipeline to be used for subsequent render commands.
func (*RenderPassEncoder) SetScissorRect ¶
func (r *RenderPassEncoder) SetScissorRect(x uint32, y uint32, width uint32, height uint32)
SetScissorRect sets the scissor rectangle for subsequent render commands. Pixels outside this rectangle will be discarded.
func (*RenderPassEncoder) SetStencilReference ¶
func (r *RenderPassEncoder) SetStencilReference(reference uint32)
SetStencilReference sets the stencil reference value for subsequent stencil operations.
func (*RenderPassEncoder) SetVertexBuffer ¶
func (r *RenderPassEncoder) SetVertexBuffer(slot uint32, buffer *Buffer, offset uint64, size uint64)
SetVertexBuffer sets a vertex buffer at the specified slot for subsequent draw commands. The offset and size specify the region of the buffer to use.
func (*RenderPassEncoder) SetViewport ¶
func (r *RenderPassEncoder) SetViewport(x float32, y float32, width float32, height float32, minDepth float32, maxDepth float32)
SetViewport sets the viewport for subsequent render commands. The viewport defines the region of the render target that output is drawn to.
type RenderPassMaxDrawCount ¶
type RenderPassMaxDrawCount struct {
MaxDrawCount uint64
}
RenderPassMaxDrawCount defines the maximum number of draws allowed in a render pass.
type RenderPipeline ¶
type RenderPipeline struct {
// contains filtered or unexported fields
}
RenderPipeline represents a render pipeline that defines how graphics are rendered. Render pipelines are created from a device and a render pipeline descriptor. They define the shader modules, vertex and fragment stages, and render state.
func (*RenderPipeline) GetBindGroupLayout ¶
func (r *RenderPipeline) GetBindGroupLayout(groupIndex uint32) *BindGroupLayout
GetBindGroupLayout returns the bind group layout at the specified group index for this render pipeline. This layout defines the interface for bind groups used with this pipeline.
func (*RenderPipeline) Release ¶
func (r *RenderPipeline) Release()
Release releases the render pipeline and all associated resources. After calling this method, the pipeline should no longer be used.
func (*RenderPipeline) SetLabel ¶
func (r *RenderPipeline) SetLabel(label string)
SetLabel sets the debug label for the render pipeline. This label appears in debuggers and validation layers.
type RenderPipelineDescriptor ¶
type RenderPipelineDescriptor struct {
Label string
Layout *PipelineLayout
Vertex VertexState
Primitive PrimitiveState
DepthStencil *DepthStencilState
Multisample MultisampleState
Fragment *FragmentState
}
RenderPipelineDescriptor describes a render pipeline, including label, layout, vertex, primitive, depth stencil, multisample, and fragment states.
type RequestAdapterOptions ¶
type RequestAdapterOptions struct {
FeatureLevel FeatureLevel
PowerPreference PowerPreference
ForceFallbackAdapter bool
BackendType BackendType
CompatibleSurface *Surface
}
RequestAdapterOptions contains options for requesting an adapter, such as power preference and compatible surface.
type SType ¶
type SType uint32
const ( STypeShaderSourceSPIRV SType = 1 STypeShaderSourceWGSL SType = 2 STypeRenderPassMaxDrawCount SType = 3 STypeSurfaceSourceMetalLayer SType = 4 STypeSurfaceSourceWindowsHWND SType = 5 STypeSurfaceSourceXlibWindow SType = 6 STypeSurfaceSourceWaylandSurface SType = 7 STypeSurfaceSourceAndroidNativeWindow SType = 8 STypeSurfaceSourceXCBWindow SType = 9 STypeSurfaceColorManagement SType = 10 STypeRequestAdapterWebXROptions SType = 11 STypeTextureComponentSwizzleDescriptor SType = 12 STypeExternalTextureBindingLayout SType = 13 STypeExternalTextureBindingEntry SType = 14 STypeCompatibilityModeLimits SType = 15 STypeTextureBindingViewDimension SType = 16 )
type Sampler ¶
type Sampler struct {
// contains filtered or unexported fields
}
Sampler represents a sampler that defines how textures are sampled in shaders. Samplers are created from a device and define filtering modes, addressing modes, and other sampling parameters.
type SamplerBindingLayout ¶
type SamplerBindingLayout struct {
Type SamplerBindingType
}
SamplerBindingLayout describes the layout for a sampler binding, including the sampler type.
type SamplerBindingType ¶
type SamplerBindingType uint32
const ( SamplerBindingTypeBindingNotUsed SamplerBindingType = 0 SamplerBindingTypeUndefined SamplerBindingType = 1 SamplerBindingTypeFiltering SamplerBindingType = 2 SamplerBindingTypeNonFiltering SamplerBindingType = 3 SamplerBindingTypeComparison SamplerBindingType = 4 )
type SamplerDescriptor ¶
type SamplerDescriptor struct {
Label string
AddressModeU AddressMode
AddressModeV AddressMode
AddressModeW AddressMode
MagFilter FilterMode
MinFilter FilterMode
MipmapFilter MipmapFilterMode
LodMinClamp float32
LodMaxClamp float32
Compare CompareFunction
MaxAnisotropy uint16
}
SamplerDescriptor describes a sampler, including addressing modes, filtering modes, and comparison function.
type ShaderModule ¶
type ShaderModule struct {
// contains filtered or unexported fields
}
ShaderModule represents a compiled shader module that can be used in GPU pipelines. Shader modules are created from WGSL or SPIR-V source code.
func (*ShaderModule) GetCompilationInfo ¶
func (s *ShaderModule) GetCompilationInfo() []CompilationMessage
GetCompilationInfo returns compilation messages from the shader module compilation. Panics if the information cannot be retrieved.
func (*ShaderModule) Release ¶
func (s *ShaderModule) Release()
Release releases the shader module and all associated resources. After calling this method, the module should no longer be used.
func (*ShaderModule) SetLabel ¶
func (s *ShaderModule) SetLabel(label string)
SetLabel sets the debug label for the shader module. This label appears in debuggers and validation layers.
func (*ShaderModule) TryGetCompilationInfo ¶
func (s *ShaderModule) TryGetCompilationInfo() ([]CompilationMessage, error)
TryGetCompilationInfo returns compilation messages from the shader module compilation, or an error if they cannot be retrieved.
type ShaderModuleDescriptor ¶
type ShaderModuleDescriptor struct {
Label string
SPIRVSource *ShaderSourceSPIRV
WGSLSource *ShaderSourceWGSL
}
ShaderModuleDescriptor describes a shader module, which can contain either WGSL or SPIR-V source code.
type ShaderSourceSPIRV ¶
type ShaderSourceSPIRV struct {
Code []uint32
}
ShaderSourceSPIRV contains SPIR-V shader source code as a slice of uint32 words.
type ShaderSourceWGSL ¶
type ShaderSourceWGSL struct {
Code string
}
ShaderSourceWGSL contains WGSL (WebGPU Shading Language) shader source code as a string.
type ShaderStage ¶
type ShaderStage uint32
const ( ShaderStageNone ShaderStage = 0 ShaderStageVertex ShaderStage = 1 ShaderStageFragment ShaderStage = 2 ShaderStageCompute ShaderStage = 4 )
type StencilFaceState ¶
type StencilFaceState struct {
Compare CompareFunction
FailOp StencilOperation
DepthFailOp StencilOperation
PassOp StencilOperation
}
StencilFaceState describes the stencil state for a single face (front or back) of a depth-stencil attachment.
type StencilOperation ¶
type StencilOperation uint32
const ( StencilOperationUndefined StencilOperation = 0 StencilOperationKeep StencilOperation = 1 StencilOperationZero StencilOperation = 2 StencilOperationReplace StencilOperation = 3 StencilOperationInvert StencilOperation = 4 StencilOperationIncrementClamp StencilOperation = 5 StencilOperationDecrementClamp StencilOperation = 6 StencilOperationIncrementWrap StencilOperation = 7 StencilOperationDecrementWrap StencilOperation = 8 )
type StorageTextureAccess ¶
type StorageTextureAccess uint32
const ( StorageTextureAccessBindingNotUsed StorageTextureAccess = 0 StorageTextureAccessUndefined StorageTextureAccess = 1 StorageTextureAccessWriteOnly StorageTextureAccess = 2 StorageTextureAccessReadOnly StorageTextureAccess = 3 StorageTextureAccessReadWrite StorageTextureAccess = 4 )
type StorageTextureBindingLayout ¶
type StorageTextureBindingLayout struct {
Access StorageTextureAccess
Format TextureFormat
ViewDimension TextureViewDimension
}
StorageTextureBindingLayout describes the layout for a storage texture binding, including access mode, format, and view dimension.
type Surface ¶
type Surface struct {
// contains filtered or unexported fields
}
Surface represents a surface that can be used to present rendered graphics to a window. Surfaces are created from an instance and a platform-specific surface descriptor.
func (*Surface) Configure ¶
func (s *Surface) Configure(config SurfaceConfiguration)
Configure configures the surface for rendering with the specified device and settings. The configuration defines the format, size, and present mode for the surface.
func (*Surface) GetCapabilities ¶
func (s *Surface) GetCapabilities(adapter *Adapter) (SurfaceCapabilities, error)
GetCapabilities returns the capabilities of the surface when used with the given adapter. The capabilities include supported usages, formats, present modes, and alpha modes.
func (*Surface) GetCurrentTexture ¶
GetCurrentTexture obtains the current texture to render to from the surface. Panics if the texture cannot be obtained.
func (*Surface) Present ¶
func (s *Surface) Present()
Present presents the current texture to the screen. Panics if presentation fails.
func (*Surface) Release ¶
func (s *Surface) Release()
Release releases the surface and all associated resources. After calling this method, the surface should no longer be used.
func (*Surface) SetLabel ¶
SetLabel sets the debug label for the surface. This label appears in debuggers and validation layers.
func (*Surface) TryGetCurrentTexture ¶
TryGetCurrentTexture obtains the current texture to render to from the surface, or returns an error if it cannot be obtained.
func (*Surface) TryPresent ¶
TryPresent presents the current texture to the screen, returning an error if presentation fails.
func (*Surface) Unconfigure ¶
func (s *Surface) Unconfigure()
Unconfigure unconfigures the surface, releasing any resources associated with it. After calling this method, the surface must be reconfigured before it can be used again.
type SurfaceCapabilities ¶
type SurfaceCapabilities struct {
Usages TextureUsage
Formats []TextureFormat
PresentModes []PresentMode
AlphaModes []CompositeAlphaMode
}
SurfaceCapabilities contains the capabilities of a surface, including supported usages, formats, present modes, and alpha modes.
type SurfaceColorManagement ¶
type SurfaceColorManagement struct {
ColorSpace PredefinedColorSpace
ToneMappingMode ToneMappingMode
}
SurfaceColorManagement defines color management settings for a surface, including color space and tone mapping mode.
type SurfaceConfiguration ¶
type SurfaceConfiguration struct {
Device *Device
Format TextureFormat
Usage TextureUsage
Width uint32
Height uint32
ViewFormats []TextureFormat
AlphaMode CompositeAlphaMode
PresentMode PresentMode
}
SurfaceConfiguration configures a surface for rendering, including the device, format, usage, dimensions, and present mode.
type SurfaceDescriptor ¶
type SurfaceDescriptor struct {
Label string
MetalLayer *SurfaceSourceMetalLayer
WaylandSurface *SurfaceSourceWaylandSurface
XlibWindow *SurfaceSourceXlibWindow
WindowsHWND *SurfaceSourceWindowsHWND
CanvasID string // JS/WASM only: HTML canvas element ID
}
SurfaceDescriptor describes a surface, which can be created from various platform-specific sources like Metal layer, Windows HWND, or Wayland surface. When targeting WebAssembly/JS, set CanvasID to the HTML canvas element ID.
type SurfaceSourceMetalLayer ¶
SurfaceSourceMetalLayer contains a pointer to a Metal layer for creating a surface on macOS and iOS.
type SurfaceSourceWaylandSurface ¶
SurfaceSourceWaylandSurface contains pointers to a Wayland display and surface for creating a surface on Linux.
type SurfaceSourceWindowsHWND ¶
SurfaceSourceWindowsHWND contains window handle and instance for creating a surface on Windows.
type SurfaceSourceXlibWindow ¶
SurfaceSourceXlibWindow contains display and window handles for creating a surface using Xlib on Linux.
type TexelCopyBufferInfo ¶
type TexelCopyBufferInfo struct {
Layout TexelCopyBufferLayout
Buffer *Buffer
}
TexelCopyBufferInfo contains information about a buffer for texel copy operations, including layout and the buffer itself.
type TexelCopyBufferLayout ¶
TexelCopyBufferLayout defines the layout of data in a buffer for texel copy operations, including offset, bytes per row, and rows per image.
type TexelCopyTextureInfo ¶
type TexelCopyTextureInfo struct {
Texture *Texture
MipLevel uint32
Origin Origin3D
Aspect TextureAspect
}
TexelCopyTextureInfo contains information about a texture for texel copy operations, including the texture, mip level, origin, and aspect.
type Texture ¶
type Texture struct {
// contains filtered or unexported fields
}
Texture represents a GPU texture, which is a structured collection of pixels used for rendering and data storage. Textures are created from a device and can be used as render targets or sampled in shaders.
func (*Texture) AsImageCopy ¶
func (t *Texture) AsImageCopy() TexelCopyTextureInfo
AsImageCopy returns a TexelCopyTextureInfo for use in image copy operations. The texture is treated as having all aspects, full mip levels, and the full extent.
func (*Texture) CreateView ¶
func (t *Texture) CreateView(descriptor *TextureViewDescriptor) *TextureView
CreateView creates a texture view from this texture. Texture views can have different dimensions and mip level ranges than the underlying texture.
func (*Texture) Destroy ¶
func (t *Texture) Destroy()
Destroy destroys the texture and frees all associated GPU resources.
func (*Texture) GetDepthOrArrayLayers ¶
GetDepthOrArrayLayers returns the depth or array layer count of the texture. For 3D textures, this is the depth; for 2D array textures, this is the number of layers.
func (*Texture) GetDimension ¶
func (t *Texture) GetDimension() TextureDimension
GetDimension returns the dimension of the texture (1D, 2D, or 3D).
func (*Texture) GetFormat ¶
func (t *Texture) GetFormat() TextureFormat
GetFormat returns the pixel format of the texture.
func (*Texture) GetMipLevelCount ¶
GetMipLevelCount returns the number of mip levels in the texture.
func (*Texture) GetSampleCount ¶
GetSampleCount returns the sample count of the texture. A value of 1 means single-sampled; values greater than 1 indicate multisampling.
func (*Texture) GetTextureBindingViewDimension ¶
func (t *Texture) GetTextureBindingViewDimension() TextureViewDimension
GetTextureBindingViewDimension returns the view dimension for texture binding. This is useful for determining how the texture can be sampled in shaders.
func (*Texture) GetUsage ¶
func (t *Texture) GetUsage() TextureUsage
GetUsage returns the usage flags for the texture.
type TextureAspect ¶
type TextureAspect uint32
const ( TextureAspectUndefined TextureAspect = 0 TextureAspectAll TextureAspect = 1 TextureAspectStencilOnly TextureAspect = 2 TextureAspectDepthOnly TextureAspect = 3 TextureAspectPlane0Only TextureAspect = 0 TextureAspectPlane1Only TextureAspect = 1 TextureAspectPlane2Only TextureAspect = 2 )
type TextureBindingLayout ¶
type TextureBindingLayout struct {
SampleType TextureSampleType
ViewDimension TextureViewDimension
Multisampled bool
}
TextureBindingLayout describes the layout for a texture binding, including sample type, view dimension, and whether it is multisampled.
type TextureBindingViewDimension ¶
type TextureBindingViewDimension struct {
TextureBindingViewDimension TextureViewDimension
}
TextureBindingViewDimension is used to specify the expected view dimension for a texture binding.
type TextureComponentSwizzle ¶
type TextureComponentSwizzle struct {
R ComponentSwizzle
G ComponentSwizzle
B ComponentSwizzle
A ComponentSwizzle
}
TextureComponentSwizzle describes how to swizzle the components of a texture view.
type TextureComponentSwizzleDescriptor ¶
type TextureComponentSwizzleDescriptor struct {
Swizzle TextureComponentSwizzle
}
TextureComponentSwizzleDescriptor describes a swizzle to be applied to a texture view.
type TextureDescriptor ¶
type TextureDescriptor struct {
Label string
Usage TextureUsage
Dimension TextureDimension
Size Extent3D
Format TextureFormat
MipLevelCount uint32
SampleCount uint32
ViewFormats []TextureFormat
}
TextureDescriptor describes a texture, including its dimensions, format, usage, mip level count, and sample count.
type TextureDimension ¶
type TextureDimension uint32
const ( TextureDimensionUndefined TextureDimension = 0 TextureDimension1D TextureDimension = 1 TextureDimension2D TextureDimension = 2 TextureDimension3D TextureDimension = 3 )
type TextureFormat ¶
type TextureFormat uint32
const ( TextureFormatUndefined TextureFormat = 0 TextureFormatR8Unorm TextureFormat = 1 TextureFormatR8Snorm TextureFormat = 2 TextureFormatR8Uint TextureFormat = 3 TextureFormatR8Sint TextureFormat = 4 TextureFormatR16Unorm TextureFormat = 5 TextureFormatR16Snorm TextureFormat = 6 TextureFormatR16Uint TextureFormat = 7 TextureFormatR16Sint TextureFormat = 8 TextureFormatR16Float TextureFormat = 9 TextureFormatRG8Unorm TextureFormat = 10 TextureFormatRG8Snorm TextureFormat = 11 TextureFormatRG8Uint TextureFormat = 12 TextureFormatRG8Sint TextureFormat = 13 TextureFormatR32Float TextureFormat = 14 TextureFormatR32Uint TextureFormat = 15 TextureFormatR32Sint TextureFormat = 16 TextureFormatRG16Unorm TextureFormat = 17 TextureFormatRG16Snorm TextureFormat = 18 TextureFormatRG16Uint TextureFormat = 19 TextureFormatRG16Sint TextureFormat = 20 TextureFormatRG16Float TextureFormat = 21 TextureFormatRGBA8Unorm TextureFormat = 22 TextureFormatRGBA8UnormSRGB TextureFormat = 23 TextureFormatRGBA8Snorm TextureFormat = 24 TextureFormatRGBA8Uint TextureFormat = 25 TextureFormatRGBA8Sint TextureFormat = 26 TextureFormatBGRA8Unorm TextureFormat = 27 TextureFormatBGRA8UnormSRGB TextureFormat = 28 TextureFormatRGB10A2Uint TextureFormat = 29 TextureFormatRGB10A2Unorm TextureFormat = 30 TextureFormatRG11B10Ufloat TextureFormat = 31 TextureFormatRGB9E5Ufloat TextureFormat = 32 TextureFormatRG32Float TextureFormat = 33 TextureFormatRG32Uint TextureFormat = 34 TextureFormatRG32Sint TextureFormat = 35 TextureFormatRGBA16Unorm TextureFormat = 36 TextureFormatRGBA16Snorm TextureFormat = 37 TextureFormatRGBA16Uint TextureFormat = 38 TextureFormatRGBA16Sint TextureFormat = 39 TextureFormatRGBA16Float TextureFormat = 40 TextureFormatRGBA32Float TextureFormat = 41 TextureFormatRGBA32Uint TextureFormat = 42 TextureFormatRGBA32Sint TextureFormat = 43 TextureFormatStencil8 TextureFormat = 44 TextureFormatDepth16Unorm TextureFormat = 45 TextureFormatDepth24Plus TextureFormat = 46 TextureFormatDepth24PlusStencil8 TextureFormat = 47 TextureFormatDepth32Float TextureFormat = 48 TextureFormatDepth32FloatStencil8 TextureFormat = 49 TextureFormatBC1RGBAUnorm TextureFormat = 50 TextureFormatBC1RGBAUnormSRGB TextureFormat = 51 TextureFormatBC2RGBAUnorm TextureFormat = 52 TextureFormatBC2RGBAUnormSRGB TextureFormat = 53 TextureFormatBC3RGBAUnorm TextureFormat = 54 TextureFormatBC3RGBAUnormSRGB TextureFormat = 55 TextureFormatBC4RUnorm TextureFormat = 56 TextureFormatBC4RSnorm TextureFormat = 57 TextureFormatBC5RGUnorm TextureFormat = 58 TextureFormatBC5RGSnorm TextureFormat = 59 TextureFormatBC6HRGBUfloat TextureFormat = 60 TextureFormatBC6HRGBFloat TextureFormat = 61 TextureFormatBC7RGBAUnorm TextureFormat = 62 TextureFormatBC7RGBAUnormSRGB TextureFormat = 63 TextureFormatETC2RGB8Unorm TextureFormat = 64 TextureFormatETC2RGB8UnormSRGB TextureFormat = 65 TextureFormatETC2RGB8A1Unorm TextureFormat = 66 TextureFormatETC2RGB8A1UnormSRGB TextureFormat = 67 TextureFormatETC2RGBA8Unorm TextureFormat = 68 TextureFormatETC2RGBA8UnormSRGB TextureFormat = 69 TextureFormatEACR11Unorm TextureFormat = 70 TextureFormatEACR11Snorm TextureFormat = 71 TextureFormatEACRG11Unorm TextureFormat = 72 TextureFormatEACRG11Snorm TextureFormat = 73 TextureFormatASTC4x4Unorm TextureFormat = 74 TextureFormatASTC4x4UnormSRGB TextureFormat = 75 TextureFormatASTC5x4Unorm TextureFormat = 76 TextureFormatASTC5x4UnormSRGB TextureFormat = 77 TextureFormatASTC5x5Unorm TextureFormat = 78 TextureFormatASTC5x5UnormSRGB TextureFormat = 79 TextureFormatASTC6x5Unorm TextureFormat = 80 TextureFormatASTC6x5UnormSRGB TextureFormat = 81 TextureFormatASTC6x6Unorm TextureFormat = 82 TextureFormatASTC6x6UnormSRGB TextureFormat = 83 TextureFormatASTC8x5Unorm TextureFormat = 84 TextureFormatASTC8x5UnormSRGB TextureFormat = 85 TextureFormatASTC8x6Unorm TextureFormat = 86 TextureFormatASTC8x6UnormSRGB TextureFormat = 87 TextureFormatASTC8x8Unorm TextureFormat = 88 TextureFormatASTC8x8UnormSRGB TextureFormat = 89 TextureFormatASTC10x5Unorm TextureFormat = 90 TextureFormatASTC10x5UnormSRGB TextureFormat = 91 TextureFormatASTC10x6Unorm TextureFormat = 92 TextureFormatASTC10x6UnormSRGB TextureFormat = 93 TextureFormatASTC10x8Unorm TextureFormat = 94 TextureFormatASTC10x8UnormSRGB TextureFormat = 95 TextureFormatASTC10x10Unorm TextureFormat = 96 TextureFormatASTC10x10UnormSRGB TextureFormat = 97 TextureFormatASTC12x10Unorm TextureFormat = 98 TextureFormatASTC12x10UnormSRGB TextureFormat = 99 TextureFormatASTC12x12Unorm TextureFormat = 100 TextureFormatASTC12x12UnormSRGB TextureFormat = 101 )
func (TextureFormat) String ¶
func (t TextureFormat) String() string
type TextureSampleType ¶
type TextureSampleType uint32
const ( TextureSampleTypeBindingNotUsed TextureSampleType = 0 TextureSampleTypeUndefined TextureSampleType = 1 TextureSampleTypeFloat TextureSampleType = 2 TextureSampleTypeUnfilterableFloat TextureSampleType = 3 TextureSampleTypeDepth TextureSampleType = 4 TextureSampleTypeSint TextureSampleType = 5 TextureSampleTypeUint TextureSampleType = 6 )
type TextureUsage ¶
type TextureUsage uint32
const ( TextureUsageNone TextureUsage = 0 TextureUsageCopySrc TextureUsage = 1 TextureUsageCopyDst TextureUsage = 2 TextureUsageTextureBinding TextureUsage = 4 TextureUsageStorageBinding TextureUsage = 8 TextureUsageRenderAttachment TextureUsage = 16 TextureUsageTransientAttachment TextureUsage = 32 TextureUsageStorageAttachment TextureUsage = 64 )
type TextureView ¶
type TextureView struct {
// contains filtered or unexported fields
}
TextureView represents a view of a texture with specific dimensions, mip levels, and array layers. Texture views are created from textures and can be used as render targets or sampled in shaders.
func (*TextureView) Release ¶
func (t *TextureView) Release()
Release releases the texture view and all associated resources. After calling this method, the view should no longer be used.
func (*TextureView) SetLabel ¶
func (t *TextureView) SetLabel(label string)
SetLabel sets the debug label for the texture view. This label appears in debuggers and validation layers.
type TextureViewDescriptor ¶
type TextureViewDescriptor struct {
Label string
Format TextureFormat
Dimension TextureViewDimension
BaseMipLevel uint32
MipLevelCount uint32
BaseArrayLayer uint32
ArrayLayerCount uint32
Aspect TextureAspect
Usage TextureUsage
}
TextureViewDescriptor describes a texture view, including format, dimension, mip level range, array layer range, and aspect.
type TextureViewDimension ¶
type TextureViewDimension uint32
const ( TextureViewDimensionUndefined TextureViewDimension = 0 TextureViewDimension1D TextureViewDimension = 1 TextureViewDimension2D TextureViewDimension = 2 TextureViewDimension2DArray TextureViewDimension = 3 TextureViewDimensionCube TextureViewDimension = 4 TextureViewDimensionCubeArray TextureViewDimension = 5 TextureViewDimension3D TextureViewDimension = 6 )
type ToneMappingMode ¶
type ToneMappingMode uint32
const ( ToneMappingModeStandard ToneMappingMode = 1 ToneMappingModeExtended ToneMappingMode = 2 )
type UncapturedErrorCallback ¶
UncapturedErrorCallback is called when an uncaptured error occurs on a device. The callback receives the device, the error type, and the error message.
type UncapturedErrorCallbackInfo ¶
type UncapturedErrorCallbackInfo struct {
Callback UncapturedErrorCallback
}
type VertexAttribute ¶
type VertexAttribute struct {
Format VertexFormat
Offset uint64
ShaderLocation uint32
}
VertexAttribute describes a vertex attribute, including format, offset, and shader location.
type VertexBufferLayout ¶
type VertexBufferLayout struct {
StepMode VertexStepMode
ArrayStride uint64
Attributes []VertexAttribute
}
VertexBufferLayout describes the layout of a vertex buffer, including step mode, array stride, and attributes.
type VertexFormat ¶
type VertexFormat uint32
const ( VertexFormatUint8 VertexFormat = 1 VertexFormatUint8x2 VertexFormat = 2 VertexFormatUint8x4 VertexFormat = 3 VertexFormatSint8 VertexFormat = 4 VertexFormatSint8x2 VertexFormat = 5 VertexFormatSint8x4 VertexFormat = 6 VertexFormatUnorm8 VertexFormat = 7 VertexFormatUnorm8x2 VertexFormat = 8 VertexFormatUnorm8x4 VertexFormat = 9 VertexFormatSnorm8 VertexFormat = 10 VertexFormatSnorm8x2 VertexFormat = 11 VertexFormatSnorm8x4 VertexFormat = 12 VertexFormatUint16 VertexFormat = 13 VertexFormatUint16x2 VertexFormat = 14 VertexFormatUint16x4 VertexFormat = 15 VertexFormatSint16 VertexFormat = 16 VertexFormatSint16x2 VertexFormat = 17 VertexFormatSint16x4 VertexFormat = 18 VertexFormatUnorm16 VertexFormat = 19 VertexFormatUnorm16x2 VertexFormat = 20 VertexFormatUnorm16x4 VertexFormat = 21 VertexFormatSnorm16 VertexFormat = 22 VertexFormatSnorm16x2 VertexFormat = 23 VertexFormatSnorm16x4 VertexFormat = 24 VertexFormatFloat16 VertexFormat = 25 VertexFormatFloat16x2 VertexFormat = 26 VertexFormatFloat16x4 VertexFormat = 27 VertexFormatFloat32 VertexFormat = 28 VertexFormatFloat32x2 VertexFormat = 29 VertexFormatFloat32x3 VertexFormat = 30 VertexFormatFloat32x4 VertexFormat = 31 VertexFormatUint32 VertexFormat = 32 VertexFormatUint32x2 VertexFormat = 33 VertexFormatUint32x3 VertexFormat = 34 VertexFormatUint32x4 VertexFormat = 35 VertexFormatSint32 VertexFormat = 36 VertexFormatSint32x2 VertexFormat = 37 VertexFormatSint32x3 VertexFormat = 38 VertexFormatSint32x4 VertexFormat = 39 VertexFormatUnorm10_10_10_2 VertexFormat = 40 VertexFormatUnorm8x4BGRA VertexFormat = 41 )
func (VertexFormat) Size ¶
func (f VertexFormat) Size() int
type VertexState ¶
type VertexState struct {
Module *ShaderModule
EntryPoint string
Constants map[string]float64
Buffers []VertexBufferLayout
}
VertexState describes the vertex stage of a render pipeline, including shader module, entry point, constants, and buffer layouts.
type VertexStepMode ¶
type VertexStepMode uint32
const ( VertexStepModeUndefined VertexStepMode = 0 VertexStepModeVertex VertexStepMode = 1 VertexStepModeInstance VertexStepMode = 2 )
type WGSLLanguageFeatureName ¶
type WGSLLanguageFeatureName uint32
const ( WGSLLanguageFeatureNameReadonlyAndReadwriteStorageTextures WGSLLanguageFeatureName = 1 WGSLLanguageFeatureNamePacked4x8IntegerDotProduct WGSLLanguageFeatureName = 2 WGSLLanguageFeatureNameUnrestrictedPointerParameters WGSLLanguageFeatureName = 3 WGSLLanguageFeatureNamePointerCompositeAccess WGSLLanguageFeatureName = 4 WGSLLanguageFeatureNameUniformBufferStandardLayout WGSLLanguageFeatureName = 5 WGSLLanguageFeatureNameSubgroupId WGSLLanguageFeatureName = 6 WGSLLanguageFeatureNameTextureAndSamplerLet WGSLLanguageFeatureName = 7 WGSLLanguageFeatureNameSubgroupUniformity WGSLLanguageFeatureName = 8 WGSLLanguageFeatureNameTextureFormatsTier1 WGSLLanguageFeatureName = 9 )
func (WGSLLanguageFeatureName) String ¶
func (f WGSLLanguageFeatureName) String() string
Source Files
¶
- adapter.go
- bind_group.go
- bind_group_layout.go
- buffer.go
- command_buffer.go
- command_encoder.go
- compute_pass_encoder.go
- compute_pipeline.go
- device.go
- enums.go
- future.go
- instance.go
- pipeline_layout.go
- query_set.go
- queue.go
- render_bundle.go
- render_pass_encoder.go
- render_pipeline.go
- sampler.go
- shader_module.go
- surface.go
- texture.go
- types.go
- util.go
- wgpu_c.go