Versions in this module Expand all Collapse all v0 v0.31.0 Aug 2, 2026 Changes in this version + var ErrAdapterNotFound = errors.New("wgpu: no suitable GPU adapter found") — js/wasm + var ErrCanvasContextFailed = errors.New(...) — js/wasm + var ErrDeviceCreationFailed = errors.New("wgpu: device creation failed") — js/wasm + var ErrNavigatorUnavailable = errors.New("wgpu: navigator not available") — js/wasm + var ErrWebGPUNotSupported = errors.New("wgpu: WebGPU not supported in this browser") — js/wasm + func AddressModeToJS(m gputypes.AddressMode) string + func AwaitPromise(promise js.Value) (js.Value, error) — js/wasm + func BlendFactorToJS(f gputypes.BlendFactor) string + func BlendOperationToJS(op gputypes.BlendOperation) string + func BufferBindingTypeToJS(t gputypes.BufferBindingType) string + func BuildBindGroupDescriptor(label string, layoutRef js.Value, entries []BindGroupEntryJS) js.Value — js/wasm + func BuildBindGroupLayoutDescriptor(label string, entries []BindGroupLayoutEntryJS) js.Value — js/wasm + func BuildBufferDescriptor(label string, size uint64, usage uint64, mappedAtCreation bool) js.Value — js/wasm + func BuildColorDict(r, g, b, a float64) js.Value — js/wasm + func BuildCommandEncoderDescriptor(label string) js.Value — js/wasm + func BuildComputePassDescriptor(label string) js.Value — js/wasm + func BuildComputePipelineDescriptor(label string, layoutRef js.Value, moduleRef js.Value, entryPoint string) js.Value — js/wasm + func BuildDeviceDescriptor(label string, requiredFeatures gputypes.Features, ...) js.Value — js/wasm + func BuildExtent3D(width, height, depthOrArrayLayers uint32) js.Value — js/wasm + func BuildImageCopyBuffer(buffer js.Value, offset uint64, bytesPerRow, rowsPerImage uint32) js.Value — js/wasm + func BuildImageCopyTexture(texture js.Value, mipLevel uint32, originX, originY, originZ uint32) js.Value — js/wasm + func BuildPipelineLayoutDescriptor(label string, layoutRefs []js.Value) js.Value — js/wasm + func BuildRenderPassDescriptor(label string, colorAttachments []RenderPassColorAttachmentJS, ...) js.Value — js/wasm + func BuildRenderPipelineDescriptor(desc *RenderPipelineDescriptorJS) js.Value — js/wasm + func BuildRequestAdapterOptions(powerPreference gputypes.PowerPreference, forceFallback bool) js.Value — js/wasm + func BuildSamplerDescriptor(label string, addressModeU, addressModeV, addressModeW gputypes.AddressMode, ...) js.Value — js/wasm + func BuildShaderModuleDescriptor(label string, code string) js.Value — js/wasm + func BuildSurfaceConfiguration(deviceRef js.Value, format gputypes.TextureFormat, usage gputypes.TextureUsage, ...) js.Value — js/wasm + func BuildTexelCopyBufferLayout(offset uint64, bytesPerRow, rowsPerImage uint32) js.Value — js/wasm + func BuildTextureDescriptor(label string, width, height, depthOrArrayLayers uint32, ...) js.Value — js/wasm + func BuildTextureViewDescriptor(label string, format gputypes.TextureFormat, ...) js.Value — js/wasm + func CompareFunctionToJS(f gputypes.CompareFunction) string + func CompositeAlphaModeToJS(mode gputypes.CompositeAlphaMode) string + func CullModeToJS(m gputypes.CullMode) string + func ExtractFeatures(supported js.Value) gputypes.Features — js/wasm + func ExtractLimits(jsLimits js.Value) gputypes.Limits — js/wasm + func FilterModeToJS(m gputypes.FilterMode) string + func FrontFaceToJS(f gputypes.FrontFace) string + func GPUAvailable() bool — js/wasm + func IndexFormatToJS(f gputypes.IndexFormat) string + func LoadOpToJS(op gputypes.LoadOp) string + func PowerPreferenceToJS(pref gputypes.PowerPreference) string — js/wasm + func PresentModeToJS(mode gputypes.PresentMode) string + func PrimitiveTopologyToJS(t gputypes.PrimitiveTopology) string + func SamplerBindingTypeToJS(t gputypes.SamplerBindingType) string + func StencilOperationToJS(op gputypes.StencilOperation) string + func StorageTextureAccessToJS(a gputypes.StorageTextureAccess) string + func StoreOpToJS(op gputypes.StoreOp) string + func TextureAspectToJS(a gputypes.TextureAspect) string + func TextureDimensionToJS(d gputypes.TextureDimension) string + func TextureFormatFromJS(s string) gputypes.TextureFormat + func TextureFormatToJS(f gputypes.TextureFormat) string + func TextureSampleTypeToJS(t gputypes.TextureSampleType) string + func TextureViewDimensionToJS(d gputypes.TextureViewDimension) string + func VertexFormatToJS(f gputypes.VertexFormat) string + func VertexStepModeToJS(m gputypes.VertexStepMode) string + type Adapter struct — js/wasm + func (a *Adapter) Features() js.Value + func (a *Adapter) Limits() js.Value + func (a *Adapter) Ref() js.Value + func (a *Adapter) RequestDevice(descriptor js.Value) (*Device, error) + type BindGroup struct — js/wasm + func NewBindGroup(ref js.Value) *BindGroup + func (g *BindGroup) Ref() js.Value + type BindGroupEntryJS struct — js/wasm + Binding uint32 + BufferOffset uint64 + BufferRef js.Value + BufferSize uint64 + SamplerRef js.Value + TextureViewRef js.Value + type BindGroupLayout struct — js/wasm + func NewBindGroupLayout(ref js.Value) *BindGroupLayout + func (l *BindGroupLayout) Ref() js.Value + type BindGroupLayoutEntryJS struct — js/wasm + Binding uint32 + Buffer *BufferBindingLayoutJS + Sampler *SamplerBindingLayoutJS + StorageTexture *StorageTextureBindingLayoutJS + Texture *TextureBindingLayoutJS + Visibility uint32 + func (e *BindGroupLayoutEntryJS) ToJS() js.Value + type BlendComponentJS struct — js/wasm + DstFactor string + Operation string + SrcFactor string + func (bc *BlendComponentJS) ToJS() js.Value + type BlendStateJS struct — js/wasm + Alpha BlendComponentJS + Color BlendComponentJS + func (b *BlendStateJS) ToJS() js.Value + type Buffer struct — js/wasm + func NewBuffer(ref js.Value) *Buffer + func (b *Buffer) Destroy() + func (b *Buffer) GetMappedRangeBytes(offset, size uint64) ([]byte, error) + func (b *Buffer) MapAsync(mode uint32, offset, size uint64) error + func (b *Buffer) Ref() js.Value + func (b *Buffer) SetMappedAtCreation() + func (b *Buffer) Size() uint64 + func (b *Buffer) Unmap() + func (b *Buffer) Usage() uint32 + func (b *Buffer) WriteMappedRange(offset uint64, data []byte) error + type BufferBindingLayoutJS struct — js/wasm + HasDynamicOffset bool + MinBindingSize uint64 + Type string + func (b *BufferBindingLayoutJS) ToJS() js.Value + type ColorTargetStateJS struct — js/wasm + Blend *BlendStateJS + Format string + WriteMask uint32 + func (c *ColorTargetStateJS) ToJS() js.Value + type CommandBuffer struct — js/wasm + func (cb *CommandBuffer) Ref() js.Value + type CommandEncoder struct — js/wasm + func NewCommandEncoder(ref js.Value) *CommandEncoder + func (e *CommandEncoder) BeginComputePass(desc js.Value) *ComputePassEncoder + func (e *CommandEncoder) BeginRenderPass(desc js.Value) *RenderPassEncoder + func (e *CommandEncoder) ClearBuffer(buffer js.Value, offset, size uint64) + func (e *CommandEncoder) CopyBufferToBuffer(src js.Value, srcOffset uint64, dst js.Value, dstOffset uint64, size uint64) + func (e *CommandEncoder) CopyBufferToTexture(source, destination, copySize js.Value) + func (e *CommandEncoder) CopyTextureToBuffer(source, destination, copySize js.Value) + func (e *CommandEncoder) CopyTextureToTexture(source, destination, copySize js.Value) + func (e *CommandEncoder) Finish(desc js.Value) *CommandBuffer + func (e *CommandEncoder) Ref() js.Value + type ComputePassEncoder struct — js/wasm + func NewComputePassEncoder(ref js.Value) *ComputePassEncoder + func (p *ComputePassEncoder) DispatchIndirect(buffer js.Value, offset uint64) + func (p *ComputePassEncoder) DispatchWorkgroups(x, y, z uint32) + func (p *ComputePassEncoder) End() + func (p *ComputePassEncoder) Ref() js.Value + func (p *ComputePassEncoder) SetBindGroup(index uint32, group js.Value, dynamicOffsets []uint32) + func (p *ComputePassEncoder) SetPipeline(pipeline js.Value) + type ComputePipeline struct — js/wasm + func NewComputePipeline(ref js.Value) *ComputePipeline + func (p *ComputePipeline) GetBindGroupLayout(index uint32) *BindGroupLayout + func (p *ComputePipeline) Ref() js.Value + type DepthStencilStateJS struct — js/wasm + DepthBias int32 + DepthBiasClamp float32 + DepthBiasSlopeScale float32 + DepthCompare string + DepthWriteEnabled bool + Format string + StencilBack *StencilFaceStateJS + StencilFront *StencilFaceStateJS + StencilReadMask uint32 + StencilWriteMask uint32 + func (d *DepthStencilStateJS) ToJS() js.Value + type Device struct — js/wasm + func NewDevice(ref js.Value) *Device + func (d *Device) CreateBindGroup() js.Value + func (d *Device) CreateBindGroupFromDesc(desc js.Value) *BindGroup + func (d *Device) CreateBindGroupLayout() js.Value + func (d *Device) CreateBindGroupLayoutFromDesc(desc js.Value) *BindGroupLayout + func (d *Device) CreateBuffer() js.Value + func (d *Device) CreateBufferFromDesc(desc js.Value) *Buffer + func (d *Device) CreateCommandEncoder() js.Value + func (d *Device) CreateComputePipeline() js.Value + func (d *Device) CreateComputePipelineFromDesc(desc js.Value) *ComputePipeline + func (d *Device) CreatePipelineLayout() js.Value + func (d *Device) CreatePipelineLayoutFromDesc(desc js.Value) *PipelineLayout + func (d *Device) CreateQuerySet() js.Value + func (d *Device) CreateRenderPipeline() js.Value + func (d *Device) CreateRenderPipelineFromDesc(desc js.Value) *RenderPipeline + func (d *Device) CreateSampler() js.Value + func (d *Device) CreateSamplerFromDesc(desc js.Value) *Sampler + func (d *Device) CreateShaderModule() js.Value + func (d *Device) CreateShaderModuleFromDesc(desc js.Value) *ShaderModule + func (d *Device) CreateTexture() js.Value + func (d *Device) CreateTextureFromDesc(desc js.Value) *Texture + func (d *Device) Destroy() + func (d *Device) Features() js.Value + func (d *Device) Limits() js.Value + func (d *Device) Queue() *Queue + func (d *Device) Ref() js.Value + type FragmentStateJS struct — js/wasm + EntryPoint string + ModuleRef js.Value + Targets []ColorTargetStateJS + func (f *FragmentStateJS) ToJS() js.Value + type Instance struct — js/wasm + func NewInstance() (*Instance, error) + func (inst *Instance) GPU() js.Value + func (inst *Instance) RequestAdapter(options js.Value) (*Adapter, error) + type JSError struct — js/wasm + Message string + Name string + func NewJSError(v js.Value) *JSError + func (e *JSError) Error() string + type MultisampleStateJS struct — js/wasm + AlphaToCoverageEnabled bool + Count uint32 + Mask uint64 + func (m *MultisampleStateJS) ToJS() js.Value + type PipelineLayout struct — js/wasm + func NewPipelineLayout(ref js.Value) *PipelineLayout + func (l *PipelineLayout) Ref() js.Value + type PrimitiveStateJS struct — js/wasm + CullMode string + FrontFace string + StripIndexFormat string + Topology string + UnclippedDepth bool + func (p *PrimitiveStateJS) ToJS() js.Value + type Queue struct — js/wasm + func NewQueue(ref js.Value) *Queue + func (q *Queue) Ref() js.Value + func (q *Queue) Submit(commandBuffers []js.Value) + func (q *Queue) WriteBuffer(buffer js.Value, bufferOffset uint64, data []byte) + func (q *Queue) WriteTexture(destination js.Value, data []byte, dataLayout js.Value, size js.Value) + type RenderPassColorAttachmentJS struct — js/wasm + ClearA float64 + ClearB float64 + ClearG float64 + ClearR float64 + LoadOp string + ResolveTarget js.Value + StoreOp string + View js.Value + type RenderPassDepthStencilAttachmentJS struct — js/wasm + DepthClearValue float32 + DepthLoadOp string + DepthReadOnly bool + DepthStoreOp string + StencilClearValue uint32 + StencilLoadOp string + StencilReadOnly bool + StencilStoreOp string + View js.Value + type RenderPassEncoder struct — js/wasm + func NewRenderPassEncoder(ref js.Value) *RenderPassEncoder + func (p *RenderPassEncoder) Draw(vertexCount, instanceCount, firstVertex, firstInstance uint32) + func (p *RenderPassEncoder) DrawIndexed(indexCount, instanceCount, firstIndex uint32, baseVertex int32, ...) + func (p *RenderPassEncoder) DrawIndexedIndirect(buffer js.Value, offset uint64) + func (p *RenderPassEncoder) DrawIndirect(buffer js.Value, offset uint64) + func (p *RenderPassEncoder) End() + func (p *RenderPassEncoder) Ref() js.Value + func (p *RenderPassEncoder) SetBindGroup(index uint32, group js.Value, dynamicOffsets []uint32) + func (p *RenderPassEncoder) SetBlendConstant(color js.Value) + func (p *RenderPassEncoder) SetIndexBuffer(buffer js.Value, format string, offset uint64, size uint64) + func (p *RenderPassEncoder) SetPipeline(pipeline js.Value) + func (p *RenderPassEncoder) SetScissorRect(x, y, w, h uint32) + func (p *RenderPassEncoder) SetStencilReference(ref uint32) + func (p *RenderPassEncoder) SetVertexBuffer(slot uint32, buffer js.Value, offset uint64, size uint64) + func (p *RenderPassEncoder) SetViewport(x, y, w, h, minDepth, maxDepth float32) + type RenderPipeline struct — js/wasm + func NewRenderPipeline(ref js.Value) *RenderPipeline + func (p *RenderPipeline) GetBindGroupLayout(index uint32) *BindGroupLayout + func (p *RenderPipeline) Ref() js.Value + type RenderPipelineDescriptorJS struct — js/wasm + DepthStencil *DepthStencilStateJS + Fragment *FragmentStateJS + Label string + LayoutRef js.Value + Multisample *MultisampleStateJS + Primitive *PrimitiveStateJS + Vertex VertexStateJS + type Sampler struct — js/wasm + func NewSampler(ref js.Value) *Sampler + func (s *Sampler) Ref() js.Value + type SamplerBindingLayoutJS struct — js/wasm + Type string + func (s *SamplerBindingLayoutJS) ToJS() js.Value + type ShaderModule struct — js/wasm + func NewShaderModule(ref js.Value) *ShaderModule + func (m *ShaderModule) Ref() js.Value + type StencilFaceStateJS struct — js/wasm + Compare string + DepthFailOp string + FailOp string + PassOp string + func (s *StencilFaceStateJS) ToJS() js.Value + type StorageTextureBindingLayoutJS struct — js/wasm + Access string + Format string + ViewDimension string + func (s *StorageTextureBindingLayoutJS) ToJS() js.Value + type Surface struct — js/wasm + func NewSurface(gpu js.Value, canvas js.Value) (*Surface, error) + func (s *Surface) Canvas() js.Value + func (s *Surface) Configure(config js.Value, width, height uint32, format string) + func (s *Surface) Configured() bool + func (s *Surface) Context() js.Value + func (s *Surface) Destroy() + func (s *Surface) Format() string + func (s *Surface) GetCurrentTexture() (*Texture, error) + func (s *Surface) GetPreferredCanvasFormat() string + func (s *Surface) Height() uint32 + func (s *Surface) Unconfigure() + func (s *Surface) Width() uint32 + type Texture struct — js/wasm + func NewTexture(ref js.Value) *Texture + func (t *Texture) CreateView(desc js.Value) *TextureView + func (t *Texture) Destroy() + func (t *Texture) Format() string + func (t *Texture) Height() uint32 + func (t *Texture) Ref() js.Value + func (t *Texture) Width() uint32 + type TextureBindingLayoutJS struct — js/wasm + Multisampled bool + SampleType string + ViewDimension string + func (t *TextureBindingLayoutJS) ToJS() js.Value + type TextureView struct — js/wasm + func (v *TextureView) Ref() js.Value + type VertexAttributeJS struct — js/wasm + Format string + Offset uint64 + ShaderLocation uint32 + type VertexBufferLayoutJS struct — js/wasm + ArrayStride uint64 + Attributes []VertexAttributeJS + StepMode string + func (l *VertexBufferLayoutJS) ToJS() js.Value + type VertexStateJS struct — js/wasm + Buffers []VertexBufferLayoutJS + EntryPoint string + ModuleRef js.Value + func (v *VertexStateJS) ToJS() js.Value