wgpu

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2025 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ArrayLayerCountUndefined        = 0xffffffff
	CopyStrideUndefined             = 0xffffffff
	LimitU32Undefined        uint32 = 0xffffffff
	LimitU64Undefined        uint64 = 0xffffffffffffffff
	MipLevelCountUndefined          = 0xffffffff
	WholeMapSize                    = ^uint(0)
	WholeSize                       = 0xffffffffffffffff
)
View Source
const (
	// Buffer-Texture copies must have `TextureDataLayout.BytesPerRow` aligned to this number.
	//
	// This doesn't apply to `(*Queue).WriteTexture()`.
	CopyBytesPerRowAlignment = 256
	// An offset into the query resolve buffer has to be aligned to this.
	QueryResolveBufferAlignment = 256
	// Buffer to buffer copy as well as buffer clear offsets and sizes must be aligned to this number.
	CopyBufferAlignment = 4
	// Size to align mappings.
	MapAlignment = 8
	// Vertex buffer strides have to be aligned to this number.
	VertexStrideAlignment = 4
	// Alignment all push constants need
	PushConstantAlignment = 4
	// Maximum queries in a query set
	QuerySetMaxQueries = 8192
	// Size of a single piece of query data.
	QuerySize = 8
)

Variables

View Source
var (
	ColorTransparent = Color{0, 0, 0, 0}
	ColorBlack       = Color{0, 0, 0, 1}
	ColorWhite       = Color{1, 1, 1, 1}
	ColorRed         = Color{1, 0, 0, 1}
	ColorGreen       = Color{0, 1, 0, 1}
	ColorBlue        = Color{0, 0, 1, 1}

	BlendComponentReplace = BlendComponent{
		SrcFactor: BlendFactorOne,
		DstFactor: BlendFactorZero,
		Operation: BlendOperationAdd,
	}
	BlendComponentOver = BlendComponent{
		SrcFactor: BlendFactorOne,
		DstFactor: BlendFactorOneMinusSrcAlpha,
		Operation: BlendOperationAdd,
	}

	BlendStateReplace = BlendState{
		Color: BlendComponentReplace,
		Alpha: BlendComponentReplace,
	}
	BlendStateAlphaBlending = BlendState{
		Color: BlendComponent{
			SrcFactor: BlendFactorSrcAlpha,
			DstFactor: BlendFactorOneMinusSrcAlpha,
			Operation: BlendOperationAdd,
		},
		Alpha: BlendComponentOver,
	}
	BlendStatePremultipliedAlphaBlending = BlendState{
		Color: BlendComponentOver,
		Alpha: BlendComponentOver,
	}
)

Functions

func FromBytes

func FromBytes[E any](src []byte) []E

func SetLogLevel

func SetLogLevel(level LogLevel)

no-ops

func ToBytes

func ToBytes[E any](src []E) []byte

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter as described: https://gpuweb.github.io/gpuweb/#gpuadapter

func (Adapter) GetInfo

func (g Adapter) GetInfo() AdapterInfo

func (Adapter) GetLimits

func (g Adapter) GetLimits() SupportedLimits

func (Adapter) Release

func (g Adapter) Release()

func (Adapter) RequestDevice

func (g Adapter) RequestDevice(descriptor *DeviceDescriptor) (*Device, error)

type AdapterInfo

type AdapterInfo struct {
	VendorId          uint32
	VendorName        string
	Architecture      string
	DeviceId          uint32
	Name              string
	DriverDescription string
	AdapterType       AdapterType
	BackendType       BackendType
}

type AdapterType

type AdapterType uint32
const (
	AdapterTypeDiscreteGPU   AdapterType = 0x00000000
	AdapterTypeIntegratedGPU AdapterType = 0x00000001
	AdapterTypeCPU           AdapterType = 0x00000002
	AdapterTypeUnknown       AdapterType = 0x00000003
)

func (AdapterType) String

func (v AdapterType) String() string

type AddressMode

type AddressMode uint32
const (
	AddressModeRepeat       AddressMode = 0x00000000
	AddressModeMirrorRepeat AddressMode = 0x00000001
	AddressModeClampToEdge  AddressMode = 0x00000002
)

func (AddressMode) String

func (v AddressMode) String() string

type BackendType

type BackendType uint32
const (
	BackendTypeUndefined BackendType = 0x00000000
	BackendTypeNull      BackendType = 0x00000001
	BackendTypeWebGPU    BackendType = 0x00000002
	BackendTypeD3D11     BackendType = 0x00000003
	BackendTypeD3D12     BackendType = 0x00000004
	BackendTypeMetal     BackendType = 0x00000005
	BackendTypeVulkan    BackendType = 0x00000006
	BackendTypeOpenGL    BackendType = 0x00000007
	BackendTypeOpenGLES  BackendType = 0x00000008
)

func (BackendType) String

func (v BackendType) String() string

type BindGroup

type BindGroup struct {
	// contains filtered or unexported fields
}

BindGroup as described: https://gpuweb.github.io/gpuweb/#gpubindgroup

func (BindGroup) Release

func (g BindGroup) Release()

type BindGroupDescriptor

type BindGroupDescriptor struct {
	Label   string
	Layout  *BindGroupLayout
	Entries []BindGroupEntry
}

BindGroupDescriptor as described: https://gpuweb.github.io/gpuweb/#dictdef-gpubindgroupdescriptor

type BindGroupEntry

type BindGroupEntry struct {
	Binding     uint32
	Buffer      *Buffer
	Offset      uint64
	Size        uint64
	Sampler     *Sampler
	TextureView *TextureView
}

BindGroupEntry as described: https://gpuweb.github.io/gpuweb/#dictdef-gpubindgroupentry

type BindGroupLayout

type BindGroupLayout struct {
	// contains filtered or unexported fields
}

BindGroupLayout as described: https://gpuweb.github.io/gpuweb/#gpubindgrouplayout

func (BindGroupLayout) Release

func (g BindGroupLayout) Release()

type BindGroupLayoutDescriptor

type BindGroupLayoutDescriptor struct {
	Label   string
	Entries []BindGroupLayoutEntry
}

BindGroupLayoutDescriptor as described: https://gpuweb.github.io/gpuweb/#dictdef-gpubindgrouplayoutdescriptor

type BindGroupLayoutEntry

type BindGroupLayoutEntry struct {
	Binding         uint32
	Visibility      ShaderStage
	Buffer          BufferBindingLayout
	Sampler         SamplerBindingLayout
	Texture         TextureBindingLayout
	StorageTexture  StorageTextureBindingLayout
	ExternalTexture ExternalTextureBindingLayout
}

BindGroupLayoutEntry as described: https://gpuweb.github.io/gpuweb/#dictdef-gpubindgrouplayoutentry

type BlendComponent

type BlendComponent struct {
	Operation BlendOperation
	SrcFactor BlendFactor
	DstFactor BlendFactor
}

BlendComponent as described: https://gpuweb.github.io/gpuweb/#dictdef-gpublendcomponent

type BlendFactor

type BlendFactor uint32
const (
	BlendFactorZero              BlendFactor = 0x00000000
	BlendFactorOne               BlendFactor = 0x00000001
	BlendFactorSrc               BlendFactor = 0x00000002
	BlendFactorOneMinusSrc       BlendFactor = 0x00000003
	BlendFactorSrcAlpha          BlendFactor = 0x00000004
	BlendFactorOneMinusSrcAlpha  BlendFactor = 0x00000005
	BlendFactorDst               BlendFactor = 0x00000006
	BlendFactorOneMinusDst       BlendFactor = 0x00000007
	BlendFactorDstAlpha          BlendFactor = 0x00000008
	BlendFactorOneMinusDstAlpha  BlendFactor = 0x00000009
	BlendFactorSrcAlphaSaturated BlendFactor = 0x0000000A
	BlendFactorConstant          BlendFactor = 0x0000000B
	BlendFactorOneMinusConstant  BlendFactor = 0x0000000C
)

func (BlendFactor) String

func (v BlendFactor) String() string

type BlendOperation

type BlendOperation uint32
const (
	BlendOperationAdd             BlendOperation = 0x00000000
	BlendOperationSubtract        BlendOperation = 0x00000001
	BlendOperationReverseSubtract BlendOperation = 0x00000002
	BlendOperationMin             BlendOperation = 0x00000003
	BlendOperationMax             BlendOperation = 0x00000004
)

func (BlendOperation) String

func (v BlendOperation) String() string

type BlendState

type BlendState struct {
	Color BlendComponent
	Alpha BlendComponent
}

BlendState as described: https://gpuweb.github.io/gpuweb/#dictdef-gpublendstate

type Buffer

type Buffer struct {
	// contains filtered or unexported fields
}

Buffer as described: https://gpuweb.github.io/gpuweb/#gpubuffer

func (Buffer) Destroy

func (g Buffer) Destroy()

Destroy as described: https://gpuweb.github.io/gpuweb/#dom-gpubuffer-destroy

func (Buffer) GetMappedRange

func (g Buffer) GetMappedRange(offset, size uint) []byte

func (Buffer) GetSize

func (g Buffer) GetSize() uint64

func (Buffer) MapAsync

func (g Buffer) MapAsync(mode MapMode, offset uint64, size uint64, callback BufferMapCallback) (err error)

func (Buffer) Release

func (g Buffer) Release()

func (Buffer) Unmap

func (g Buffer) Unmap() (err error)

type BufferBindingLayout

type BufferBindingLayout struct {
	Type             BufferBindingType
	HasDynamicOffset bool
	MinBindingSize   uint64
}

BufferBindingLayout as described: https://gpuweb.github.io/gpuweb/#dictdef-gpubufferbindinglayout

type BufferBindingType

type BufferBindingType uint32
const (
	BufferBindingTypeUndefined       BufferBindingType = 0x00000000
	BufferBindingTypeUniform         BufferBindingType = 0x00000001
	BufferBindingTypeStorage         BufferBindingType = 0x00000002
	BufferBindingTypeReadOnlyStorage BufferBindingType = 0x00000003
)

func (BufferBindingType) String

func (v BufferBindingType) String() string

type BufferDescriptor

type BufferDescriptor struct {
	Label            string
	Usage            BufferUsage
	Size             uint64
	MappedAtCreation bool
}

BufferDescriptor as described: https://gpuweb.github.io/gpuweb/#gpubufferdescriptor

type BufferInitDescriptor

type BufferInitDescriptor struct {
	Label    string
	Contents []byte
	Usage    BufferUsage
}

type BufferMapAsyncStatus

type BufferMapAsyncStatus uint32
const (
	BufferMapAsyncStatusSuccess                 BufferMapAsyncStatus = 0x00000000
	BufferMapAsyncStatusValidationError         BufferMapAsyncStatus = 0x00000001
	BufferMapAsyncStatusUnknown                 BufferMapAsyncStatus = 0x00000002
	BufferMapAsyncStatusDeviceLost              BufferMapAsyncStatus = 0x00000003
	BufferMapAsyncStatusDestroyedBeforeCallback BufferMapAsyncStatus = 0x00000004
	BufferMapAsyncStatusUnmappedBeforeCallback  BufferMapAsyncStatus = 0x00000005
	BufferMapAsyncStatusMappingAlreadyPending   BufferMapAsyncStatus = 0x00000006
	BufferMapAsyncStatusOffsetOutOfRange        BufferMapAsyncStatus = 0x00000007
	BufferMapAsyncStatusSizeOutOfRange          BufferMapAsyncStatus = 0x00000008
)

func (BufferMapAsyncStatus) String

func (v BufferMapAsyncStatus) String() string

type BufferMapCallback

type BufferMapCallback func(BufferMapAsyncStatus)

type BufferMapState

type BufferMapState uint32
const (
	BufferMapStateUnmapped BufferMapState = 0x00000000
	BufferMapStatePending  BufferMapState = 0x00000001
	BufferMapStateMapped   BufferMapState = 0x00000002
)

func (BufferMapState) String

func (v BufferMapState) String() string

type BufferUsage

type BufferUsage uint32
const (
	BufferUsageNone         BufferUsage = 0x00000000
	BufferUsageMapRead      BufferUsage = 0x00000001
	BufferUsageMapWrite     BufferUsage = 0x00000002
	BufferUsageCopySrc      BufferUsage = 0x00000004
	BufferUsageCopyDst      BufferUsage = 0x00000008
	BufferUsageIndex        BufferUsage = 0x00000010
	BufferUsageVertex       BufferUsage = 0x00000020
	BufferUsageUniform      BufferUsage = 0x00000040
	BufferUsageStorage      BufferUsage = 0x00000080
	BufferUsageIndirect     BufferUsage = 0x00000100
	BufferUsageQueryResolve BufferUsage = 0x00000200
)

func (BufferUsage) String

func (v BufferUsage) String() string

type CanvasContext

type CanvasContext struct {
	// contains filtered or unexported fields
}

CanvasContext as described: https://gpuweb.github.io/gpuweb/#gpucanvascontext

func NewCanvasContext

func NewCanvasContext(jsValue js.Value) CanvasContext

NewCanvasContext creates a new GPUCanvasContext using the specified JavaScript reference as the underlying context.

func (CanvasContext) GetCurrentTexture

func (g CanvasContext) GetCurrentTexture() Texture

GetCurrentTexture as described: https://gpuweb.github.io/gpuweb/#dom-gpucanvascontext-getcurrenttexture

type Color

type Color struct {
	R, G, B, A float64
}

Color as described: https://gpuweb.github.io/gpuweb/#typedefdef-gpucolor

type ColorTargetState

type ColorTargetState struct {
	Format    TextureFormat
	Blend     *BlendState
	WriteMask ColorWriteMask
}

ColorTargetState as described: https://gpuweb.github.io/gpuweb/#dictdef-gpucolortargetstate

type ColorWriteMask

type ColorWriteMask uint32
const (
	ColorWriteMaskNone  ColorWriteMask = 0x00000000
	ColorWriteMaskRed   ColorWriteMask = 0x00000001
	ColorWriteMaskGreen ColorWriteMask = 0x00000002
	ColorWriteMaskBlue  ColorWriteMask = 0x00000004
	ColorWriteMaskAlpha ColorWriteMask = 0x00000008
	ColorWriteMaskAll   ColorWriteMask = 0x0000000F
)

func (ColorWriteMask) String

func (v ColorWriteMask) String() string

type CommandBuffer

type CommandBuffer struct {
	// contains filtered or unexported fields
}

CommandBuffer as described: https://gpuweb.github.io/gpuweb/#gpucommandbuffer

func (CommandBuffer) Release

func (g CommandBuffer) Release()

type CommandBufferDescriptor

type CommandBufferDescriptor struct {
	Label string
}

type CommandEncoder

type CommandEncoder struct {
	// contains filtered or unexported fields
}

CommandEncoder as described: https://gpuweb.github.io/gpuweb/#gpucommandencoder

func (CommandEncoder) BeginComputePass

func (g CommandEncoder) BeginComputePass(descriptor *ComputePassDescriptor) *ComputePassEncoder

BeginComputePass as described: https://gpuweb.github.io/gpuweb/#dom-gpucommandencoder-begincomputepass

func (CommandEncoder) BeginRenderPass

func (g CommandEncoder) BeginRenderPass(descriptor *RenderPassDescriptor) *RenderPassEncoder

BeginRenderPass as described: https://gpuweb.github.io/gpuweb/#dom-gpucommandencoder-beginrenderpass

func (CommandEncoder) CopyBufferToBuffer

func (g CommandEncoder) CopyBufferToBuffer(source *Buffer, sourceOffset uint64, destination *Buffer, destinationOffset uint64, size uint64) (err error)

CopyBufferToBuffer as described: https://gpuweb.github.io/gpuweb/#dom-gpucommandencoder-copybuffertobuffer

func (CommandEncoder) CopyBufferToTexture

func (g CommandEncoder) CopyBufferToTexture(source *ImageCopyBuffer, destination *ImageCopyTexture, copySize *Extent3D) (err error)

CopyBufferToTexture as described: https://gpuweb.github.io/gpuweb/#dom-gpucommandencoder-copybuffertotexture

func (CommandEncoder) CopyTextureToBuffer

func (g CommandEncoder) CopyTextureToBuffer(source *ImageCopyTexture, destination *ImageCopyBuffer, copySize *Extent3D) (err error)

CopyTextureToBuffer as described: https://gpuweb.github.io/gpuweb/#dom-gpucommandencoder-copytexturetobuffer

func (CommandEncoder) CopyTextureToTexture

func (g CommandEncoder) CopyTextureToTexture(source *ImageCopyTexture, destination *ImageCopyTexture, copySize *Extent3D) (err error)

CopyTextureToTexture as described: https://gpuweb.github.io/gpuweb/#dom-gpucommandencoder-copytexturetotexture

func (CommandEncoder) Finish

func (g CommandEncoder) Finish(descriptor *CommandBufferDescriptor) (*CommandBuffer, error)

Finish as described: https://gpuweb.github.io/gpuweb/#dom-gpucommandencoder-finish

func (CommandEncoder) Release

func (g CommandEncoder) Release()

type CommandEncoderDescriptor

type CommandEncoderDescriptor struct {
	Label string
}

type CompareFunction

type CompareFunction uint32
const (
	CompareFunctionUndefined    CompareFunction = 0x00000000
	CompareFunctionNever        CompareFunction = 0x00000001
	CompareFunctionLess         CompareFunction = 0x00000002
	CompareFunctionLessEqual    CompareFunction = 0x00000003
	CompareFunctionGreater      CompareFunction = 0x00000004
	CompareFunctionGreaterEqual CompareFunction = 0x00000005
	CompareFunctionEqual        CompareFunction = 0x00000006
	CompareFunctionNotEqual     CompareFunction = 0x00000007
	CompareFunctionAlways       CompareFunction = 0x00000008
)

func (CompareFunction) String

func (v CompareFunction) String() string

type CompilationInfoRequestStatus

type CompilationInfoRequestStatus uint32
const (
	CompilationInfoRequestStatusSuccess    CompilationInfoRequestStatus = 0x00000000
	CompilationInfoRequestStatusError      CompilationInfoRequestStatus = 0x00000001
	CompilationInfoRequestStatusDeviceLost CompilationInfoRequestStatus = 0x00000002
	CompilationInfoRequestStatusUnknown    CompilationInfoRequestStatus = 0x00000003
)

func (CompilationInfoRequestStatus) String

type CompilationMessageType

type CompilationMessageType uint32
const (
	CompilationMessageTypeError   CompilationMessageType = 0x00000000
	CompilationMessageTypeWarning CompilationMessageType = 0x00000001
	CompilationMessageTypeInfo    CompilationMessageType = 0x00000002
)

func (CompilationMessageType) String

func (v CompilationMessageType) String() string

type CompositeAlphaMode

type CompositeAlphaMode uint32
const (
	CompositeAlphaModeAuto            CompositeAlphaMode = 0x00000000
	CompositeAlphaModeOpaque          CompositeAlphaMode = 0x00000001
	CompositeAlphaModePremultiplied   CompositeAlphaMode = 0x00000002
	CompositeAlphaModeUnpremultiplied CompositeAlphaMode = 0x00000003
	CompositeAlphaModeInherit         CompositeAlphaMode = 0x00000004
)

func (CompositeAlphaMode) String

func (v CompositeAlphaMode) String() string

type ComputePassDescriptor

type ComputePassDescriptor struct {
	Label string
}

ComputePassDescriptor as described: https://gpuweb.github.io/gpuweb/#dictdef-gpucomputepassdescriptor

type ComputePassEncoder

type ComputePassEncoder struct {
	// contains filtered or unexported fields
}

ComputePassEncoder as described: https://gpuweb.github.io/gpuweb/#gpucomputepassencoder

func (ComputePassEncoder) DispatchWorkgroups

func (g ComputePassEncoder) DispatchWorkgroups(workgroupCountX, workgroupCountY, workgroupCountZ uint32)

DispatchWorkgroups as described: https://gpuweb.github.io/gpuweb/#dom-gpucomputepassencoder-dispatchworkgroups

func (ComputePassEncoder) End

func (g ComputePassEncoder) End()

End as described: https://gpuweb.github.io/gpuweb/#dom-gpucomputepassencoder-end

func (ComputePassEncoder) Release

func (g ComputePassEncoder) Release()

func (ComputePassEncoder) SetBindGroup

func (g ComputePassEncoder) SetBindGroup(index uint32, bindGroup *BindGroup, dynamicOffsets []uint32)

SetBindGroup as described: https://gpuweb.github.io/gpuweb/#dom-gpubindingcommandsmixin-setbindgroup

func (ComputePassEncoder) SetPipeline

func (g ComputePassEncoder) SetPipeline(pipeline *ComputePipeline)

SetPipeline as described: https://gpuweb.github.io/gpuweb/#dom-gpucomputepassencoder-setpipeline

type ComputePipeline

type ComputePipeline struct {
	// contains filtered or unexported fields
}

ComputePipeline as described: https://gpuweb.github.io/gpuweb/#gpucomputepipeline

func (ComputePipeline) GetBindGroupLayout

func (g ComputePipeline) GetBindGroupLayout(groupIndex uint32) *BindGroupLayout

func (ComputePipeline) Release

func (g ComputePipeline) Release()

type ComputePipelineDescriptor

type ComputePipelineDescriptor struct {
	Label   string
	Layout  *PipelineLayout
	Compute ProgrammableStageDescriptor
}

ComputePipelineDescriptor as described: https://gpuweb.github.io/gpuweb/#dictdef-gpucomputepipelinedescriptor

type CreatePipelineAsyncStatus

type CreatePipelineAsyncStatus uint32
const (
	CreatePipelineAsyncStatusSuccess         CreatePipelineAsyncStatus = 0x00000000
	CreatePipelineAsyncStatusValidationError CreatePipelineAsyncStatus = 0x00000001
	CreatePipelineAsyncStatusInternalError   CreatePipelineAsyncStatus = 0x00000002
	CreatePipelineAsyncStatusDeviceLost      CreatePipelineAsyncStatus = 0x00000003
	CreatePipelineAsyncStatusDeviceDestroyed CreatePipelineAsyncStatus = 0x00000004
	CreatePipelineAsyncStatusUnknown         CreatePipelineAsyncStatus = 0x00000005
)

func (CreatePipelineAsyncStatus) String

func (v CreatePipelineAsyncStatus) String() string

type CullMode

type CullMode uint32
const (
	CullModeNone  CullMode = 0x00000000
	CullModeFront CullMode = 0x00000001
	CullModeBack  CullMode = 0x00000002
)

func (CullMode) String

func (v CullMode) String() string

type DepthStencilState

type DepthStencilState struct {
	Format              TextureFormat
	DepthWriteEnabled   bool
	DepthCompare        CompareFunction
	StencilFront        StencilFaceState
	StencilBack         StencilFaceState
	StencilReadMask     uint32
	StencilWriteMask    uint32
	DepthBias           int32
	DepthBiasSlopeScale float32
	DepthBiasClamp      float32
}

DepthStencilState as described: https://gpuweb.github.io/gpuweb/#dictdef-gpudepthstencilstate

type Device

type Device struct {
	// contains filtered or unexported fields
}

Device as described: https://gpuweb.github.io/gpuweb/#gpudevice

func NewDevice

func NewDevice(jsValue js.Value) Device

NewDevice creates a new GPUDevice that uses the specified JavaScript reference of the device.

func (Device) CreateBindGroup

func (g Device) CreateBindGroup(descriptor *BindGroupDescriptor) (*BindGroup, error)

CreateBindGroup as described: https://gpuweb.github.io/gpuweb/#dom-gpudevice-createbindgroup

func (Device) CreateBindGroupLayout

func (g Device) CreateBindGroupLayout(descriptor *BindGroupLayoutDescriptor) (*BindGroupLayout, error)

CreateBindGroupLayout as described: https://gpuweb.github.io/gpuweb/#dom-gpudevice-createbindgrouplayout

func (Device) CreateBuffer

func (g Device) CreateBuffer(descriptor *BufferDescriptor) (*Buffer, error)

CreateBuffer as described: https://gpuweb.github.io/gpuweb/#dom-gpudevice-createbuffer

func (*Device) CreateBufferInit

func (p *Device) CreateBufferInit(descriptor *BufferInitDescriptor) (*Buffer, error)

TODO(kai): this only needs to be separate for js because Buffer.GetMappedRange does not work correctly without GopherJS.

func (Device) CreateCommandEncoder

func (g Device) CreateCommandEncoder(descriptor *CommandEncoderDescriptor) (*CommandEncoder, error)

CreateCommandEncoder as described: https://gpuweb.github.io/gpuweb/#dom-gpudevice-createcommandencoder

func (Device) CreateComputePipeline

func (g Device) CreateComputePipeline(descriptor *ComputePipelineDescriptor) (*ComputePipeline, error)

CreateComputePipeline as described: https://gpuweb.github.io/gpuweb/#dom-gpudevice-createcomputepipeline

func (Device) CreatePipelineLayout

func (g Device) CreatePipelineLayout(descriptor *PipelineLayoutDescriptor) (*PipelineLayout, error)

CreatePipelineLayout as described: https://gpuweb.github.io/gpuweb/#dom-gpudevice-createpipelinelayout

func (Device) CreateRenderPipeline

func (g Device) CreateRenderPipeline(descriptor *RenderPipelineDescriptor) (*RenderPipeline, error)

CreateRenderPipeline as described: https://gpuweb.github.io/gpuweb/#dom-gpudevice-createrenderpipeline

func (Device) CreateSampler

func (g Device) CreateSampler(descriptor *SamplerDescriptor) (*Sampler, error)

CreateSampler as described: https://gpuweb.github.io/gpuweb/#dom-gpudevice-createsampler

func (Device) CreateShaderModule

func (g Device) CreateShaderModule(desc *ShaderModuleDescriptor) (*ShaderModule, error)

CreateShaderModule as described: https://gpuweb.github.io/gpuweb/#dom-gpudevice-createshadermodule

func (Device) CreateTexture

func (g Device) CreateTexture(descriptor *TextureDescriptor) (*Texture, error)

CreateTexture as described: https://gpuweb.github.io/gpuweb/#dom-gpudevice-createtexture

func (Device) GetLimits

func (g Device) GetLimits() SupportedLimits

func (Device) GetQueue

func (g Device) GetQueue() *Queue

Queue as described: https://gpuweb.github.io/gpuweb/#dom-gpudevice-queue

func (Device) Poll

func (g Device) Poll(wait bool, wrappedSubmissionIndex *WrappedSubmissionIndex) (queueEmpty bool)

func (Device) Release

func (g Device) Release()

type DeviceDescriptor

type DeviceDescriptor struct {
	Label              string
	RequiredFeatures   []FeatureName
	RequiredLimits     *RequiredLimits
	DeviceLostCallback DeviceLostCallback
	TracePath          string
}

type DeviceLostCallback

type DeviceLostCallback func(reason DeviceLostReason, message string)

type DeviceLostReason

type DeviceLostReason uint32
const (
	DeviceLostReasonUnknown   DeviceLostReason = 0x00000001
	DeviceLostReasonDestroyed DeviceLostReason = 0x00000002
)

func (DeviceLostReason) String

func (v DeviceLostReason) String() string

type Dx12Compiler

type Dx12Compiler uint32
const (
	Dx12CompilerUndefined Dx12Compiler = 0x00000000
	Dx12CompilerFxc       Dx12Compiler = 0x00000001
	Dx12CompilerDxc       Dx12Compiler = 0x00000002
)

func (Dx12Compiler) String

func (v Dx12Compiler) String() string

type Error

type Error struct {
	Type    ErrorType
	Message string
}

func (*Error) Error

func (v *Error) Error() string

type ErrorFilter

type ErrorFilter uint32
const (
	ErrorFilterValidation  ErrorFilter = 0x00000000
	ErrorFilterOutOfMemory ErrorFilter = 0x00000001
	ErrorFilterInternal    ErrorFilter = 0x00000002
)

func (ErrorFilter) String

func (v ErrorFilter) String() string

type ErrorType

type ErrorType uint32
const (
	ErrorTypeNoError     ErrorType = 0x00000000
	ErrorTypeValidation  ErrorType = 0x00000001
	ErrorTypeOutOfMemory ErrorType = 0x00000002
	ErrorTypeInternal    ErrorType = 0x00000003
	ErrorTypeUnknown     ErrorType = 0x00000004
	ErrorTypeDeviceLost  ErrorType = 0x00000005
)

func (ErrorType) String

func (v ErrorType) String() string

type Extent3D

type Extent3D struct {
	Width              uint32
	Height             uint32
	DepthOrArrayLayers uint32
}

type ExternalTextureBindingLayout

type ExternalTextureBindingLayout struct {
	// contains filtered or unexported fields
}

ExternalTextureBindingLayout as described:

type FeatureName

type FeatureName uint32
const (
	FeatureNameUndefined                                               FeatureName = 0x00000000
	FeatureNameDepthClipControl                                        FeatureName = 0x00000001
	FeatureNameDepth32FloatStencil8                                    FeatureName = 0x00000002
	FeatureNameTimestampQuery                                          FeatureName = 0x00000003
	FeatureNameTextureCompressionBC                                    FeatureName = 0x00000004
	FeatureNameTextureCompressionETC2                                  FeatureName = 0x00000005
	FeatureNameTextureCompressionASTC                                  FeatureName = 0x00000006
	FeatureNameIndirectFirstInstance                                   FeatureName = 0x00000007
	FeatureNameShaderF16                                               FeatureName = 0x00000008
	FeatureNameRG11B10UfloatRenderable                                 FeatureName = 0x00000009
	FeatureNameBGRA8UnormStorage                                       FeatureName = 0x0000000A
	FeatureNameFloat32Filterable                                       FeatureName = 0x0000000B
	NativeFeaturePushConstants                                         FeatureName = 0x00030001
	NativeFeatureTextureAdapterSpecificFormatFeatures                  FeatureName = 0x00030002
	NativeFeatureMultiDrawIndirect                                     FeatureName = 0x00030003
	NativeFeatureMultiDrawIndirectCount                                FeatureName = 0x00030004
	NativeFeatureVertexWritableStorage                                 FeatureName = 0x00030005
	NativeFeatureTextureBindingArray                                   FeatureName = 0x00030006
	NativeFeatureSampledTextureAndStorageBufferArrayNonUniformIndexing FeatureName = 0x00030007
	NativeFeaturePipelineStatisticsQuery                               FeatureName = 0x00030008
	NativeFeatureStorageResourceBindingArray                           FeatureName = 0x00030009
	NativeFeaturePartiallyBoundBindingArray                            FeatureName = 0x0003000A
	NativeFeatureTextureFormat16bitNorm                                FeatureName = 0x0003000B
	NativeFeatureTextureCompressionAstcHdr                             FeatureName = 0x0003000C
	NativeFeatureMappablePrimaryBuffers                                FeatureName = 0x0003000E
	NativeFeatureBufferBindingArray                                    FeatureName = 0x0003000F
	NativeFeatureUniformBufferAndStorageTextureArrayNonUniformIndexing FeatureName = 0x00030010
	NativeFeatureVertexAttribute64bit                                  FeatureName = 0x00030019
	NativeFeatureShaderUnusedVertexOutput                              FeatureName = 0x0003001A
	NativeFeatureTextureFormatNv12                                     FeatureName = 0x0003001B
	NativeFeatureRayTracingAccelerationStructure                       FeatureName = 0x0003001C
	NativeFeatureRayQuery                                              FeatureName = 0x0003001D
	NativeFeatureShaderF64                                             FeatureName = 0x0003001E
	NativeFeatureShaderI16                                             FeatureName = 0x0003001F
	NativeFeatureShaderPrimitiveIndex                                  FeatureName = 0x00030020
	NativeFeatureShaderEarlyDepthTest                                  FeatureName = 0x00030021
)

func (FeatureName) String

func (v FeatureName) String() string

type FilterMode

type FilterMode uint32
const (
	FilterModeNearest FilterMode = 0x00000000
	FilterModeLinear  FilterMode = 0x00000001
)

func (FilterMode) String

func (v FilterMode) String() string

type FragmentState

type FragmentState struct {
	Module     *ShaderModule
	EntryPoint string
	Targets    []ColorTargetState
}

FragmentState as described: https://gpuweb.github.io/gpuweb/#dictdef-gpufragmentstate

type FrontFace

type FrontFace uint32
const (
	FrontFaceCCW FrontFace = 0x00000000
	FrontFaceCW  FrontFace = 0x00000001
)

func (FrontFace) String

func (v FrontFace) String() string

type Gles3MinorVersion

type Gles3MinorVersion uint32
const (
	Gles3MinorVersionAutomatic Gles3MinorVersion = 0x00000000
	Gles3MinorVersionVersion0  Gles3MinorVersion = 0x00000001
	Gles3MinorVersionVersion1  Gles3MinorVersion = 0x00000002
	Gles3MinorVersionVersion2  Gles3MinorVersion = 0x00000003
)

func (Gles3MinorVersion) String

func (v Gles3MinorVersion) String() string

type ImageCopyBuffer

type ImageCopyBuffer struct {
	Layout TextureDataLayout
	Buffer *Buffer
}

type ImageCopyTexture

type ImageCopyTexture struct {
	Texture  *Texture
	MipLevel uint32
	Origin   Origin3D
	Aspect   TextureAspect
}

type IndexFormat

type IndexFormat uint32
const (
	IndexFormatUndefined IndexFormat = 0x00000000
	IndexFormatUint16    IndexFormat = 0x00000001
	IndexFormatUint32    IndexFormat = 0x00000002
)

func (IndexFormat) String

func (v IndexFormat) String() string

type Instance

type Instance struct {
	// contains filtered or unexported fields
}

Instance as described: https://gpuweb.github.io/gpuweb/#gpu-interface (Instance is called GPU in js)

func CreateInstance

func CreateInstance(descriptor *InstanceDescriptor) *Instance

func (Instance) CreateSurface

func (g Instance) CreateSurface(descriptor *SurfaceDescriptor) *Surface

func (Instance) EnumerateAdapters

func (g Instance) EnumerateAdapters(options *InstanceEnumerateAdapterOptons) []*Adapter

func (Instance) GenerateReport

func (g Instance) GenerateReport() any

func (Instance) Release

func (g Instance) Release()

func (Instance) RequestAdapter

func (g Instance) RequestAdapter(options *RequestAdapterOptions) (*Adapter, error)

type InstanceBackend

type InstanceBackend uint32
const (
	InstanceBackendAll           InstanceBackend = 0x00000000
	InstanceBackendVulkan        InstanceBackend = 0x00000001
	InstanceBackendGL            InstanceBackend = 0x00000002
	InstanceBackendMetal         InstanceBackend = 0x00000004
	InstanceBackendDX12          InstanceBackend = 0x00000008
	InstanceBackendDX11          InstanceBackend = 0x00000010
	InstanceBackendSecondary     InstanceBackend = 0x00000012
	InstanceBackendBrowserWebGPU InstanceBackend = 0x00000020
	InstanceBackendPrimary       InstanceBackend = 0x0000002D
)

func (InstanceBackend) String

func (v InstanceBackend) String() string

type InstanceDescriptor

type InstanceDescriptor struct {
	Backends           InstanceBackend
	Dx12ShaderCompiler Dx12Compiler
	DxilPath           string
	DxcPath            string
}

type InstanceEnumerateAdapterOptons

type InstanceEnumerateAdapterOptons struct {
	Backends InstanceBackend
}

type InstanceFlag

type InstanceFlag uint32
const (
	InstanceFlagDefault          InstanceFlag = 0x00000000
	InstanceFlagDebug            InstanceFlag = 0x00000001
	InstanceFlagValidation       InstanceFlag = 0x00000002
	InstanceFlagDiscardHalLabels InstanceFlag = 0x00000004
)

func (InstanceFlag) String

func (v InstanceFlag) String() string

type Limits

type Limits struct {
	MaxTextureDimension1D                     uint32
	MaxTextureDimension2D                     uint32
	MaxTextureDimension3D                     uint32
	MaxTextureArrayLayers                     uint32
	MaxBindGroups                             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
	MaxInterStageShaderComponents             uint32
	MaxInterStageShaderVariables              uint32
	MaxColorAttachments                       uint32
	MaxColorAttachmentBytesPerSample          uint32
	MaxComputeWorkgroupStorageSize            uint32
	MaxComputeInvocationsPerWorkgroup         uint32
	MaxComputeWorkgroupSizeX                  uint32
	MaxComputeWorkgroupSizeY                  uint32
	MaxComputeWorkgroupSizeZ                  uint32
	MaxComputeWorkgroupsPerDimension          uint32

	MaxPushConstantSize uint32
}

func DefaultLimits

func DefaultLimits() Limits

type LoadOp

type LoadOp uint32
const (
	LoadOpUndefined LoadOp = 0x00000000
	LoadOpClear     LoadOp = 0x00000001
	LoadOpLoad      LoadOp = 0x00000002
)

func (LoadOp) String

func (v LoadOp) String() string

type LogLevel

type LogLevel uint32
const (
	LogLevelOff   LogLevel = 0x00000000
	LogLevelError LogLevel = 0x00000001
	LogLevelWarn  LogLevel = 0x00000002
	LogLevelInfo  LogLevel = 0x00000003
	LogLevelDebug LogLevel = 0x00000004
	LogLevelTrace LogLevel = 0x00000005
)

func (LogLevel) String

func (v LogLevel) String() string

type MapMode

type MapMode uint32
const (
	MapModeNone  MapMode = 0x00000000
	MapModeRead  MapMode = 0x00000001
	MapModeWrite MapMode = 0x00000002
)

func (MapMode) String

func (v MapMode) String() string

type MipmapFilterMode

type MipmapFilterMode uint32
const (
	MipmapFilterModeNearest MipmapFilterMode = 0x00000000
	MipmapFilterModeLinear  MipmapFilterMode = 0x00000001
)

func (MipmapFilterMode) String

func (v MipmapFilterMode) String() string

type MultisampleState

type MultisampleState struct {
	Count                  uint32
	Mask                   uint32
	AlphaToCoverageEnabled bool
}

MultisampleState as described: https://gpuweb.github.io/gpuweb/#dictdef-gpumultisamplestate

type NativeQueryType

type NativeQueryType uint32
const NativeQueryTypePipelineStatistics NativeQueryType = 0x00030000

func (NativeQueryType) String

func (v NativeQueryType) String() string

type NativeTextureFormat

type NativeTextureFormat uint32
const (
	NativeTextureFormatR16Unorm    NativeTextureFormat = 0x00030001
	NativeTextureFormatR16Snorm    NativeTextureFormat = 0x00030002
	NativeTextureFormatRg16Unorm   NativeTextureFormat = 0x00030003
	NativeTextureFormatRg16Snorm   NativeTextureFormat = 0x00030004
	NativeTextureFormatRgba16Unorm NativeTextureFormat = 0x00030005
	NativeTextureFormatRgba16Snorm NativeTextureFormat = 0x00030006
	NativeTextureFormatNV12        NativeTextureFormat = 0x00030007
)

func (NativeTextureFormat) String

func (v NativeTextureFormat) String() string

type Origin3D

type Origin3D struct {
	X, Y, Z uint32
}

type PipelineLayout

type PipelineLayout struct {
	// contains filtered or unexported fields
}

PipelineLayout as described: https://gpuweb.github.io/gpuweb/#gpupipelinelayout

func (PipelineLayout) Release

func (g PipelineLayout) Release()

type PipelineLayoutDescriptor

type PipelineLayoutDescriptor struct {
	Label            string
	BindGroupLayouts []*BindGroupLayout
}

PipelineLayoutDescriptor as described: https://gpuweb.github.io/gpuweb/#dictdef-gpupipelinelayoutdescriptor

type PipelineStatisticName

type PipelineStatisticName uint32
const (
	PipelineStatisticNameVertexShaderInvocations   PipelineStatisticName = 0x00000000
	PipelineStatisticNameClipperInvocations        PipelineStatisticName = 0x00000001
	PipelineStatisticNameClipperPrimitivesOut      PipelineStatisticName = 0x00000002
	PipelineStatisticNameFragmentShaderInvocations PipelineStatisticName = 0x00000003
	PipelineStatisticNameComputeShaderInvocations  PipelineStatisticName = 0x00000004
)

func (PipelineStatisticName) String

func (v PipelineStatisticName) String() string

type PowerPreference

type PowerPreference uint32
const (
	PowerPreferenceUndefined       PowerPreference = 0x00000000
	PowerPreferenceLowPower        PowerPreference = 0x00000001
	PowerPreferenceHighPerformance PowerPreference = 0x00000002
)

func (PowerPreference) String

func (v PowerPreference) String() string

type PresentMode

type PresentMode uint32
const (
	PresentModeFifo        PresentMode = 0x00000000
	PresentModeFifoRelaxed PresentMode = 0x00000001
	PresentModeImmediate   PresentMode = 0x00000002
	PresentModeMailbox     PresentMode = 0x00000003
)

func (PresentMode) String

func (v PresentMode) String() string

type PrimitiveState

type PrimitiveState struct {
	Topology         PrimitiveTopology
	StripIndexFormat IndexFormat
	FrontFace        FrontFace
	CullMode         CullMode
}

PrimitiveState as described: https://gpuweb.github.io/gpuweb/#dictdef-gpuprimitivestate

type PrimitiveTopology

type PrimitiveTopology uint32
const (
	PrimitiveTopologyPointList     PrimitiveTopology = 0x00000000
	PrimitiveTopologyLineList      PrimitiveTopology = 0x00000001
	PrimitiveTopologyLineStrip     PrimitiveTopology = 0x00000002
	PrimitiveTopologyTriangleList  PrimitiveTopology = 0x00000003
	PrimitiveTopologyTriangleStrip PrimitiveTopology = 0x00000004
)

func (PrimitiveTopology) String

func (v PrimitiveTopology) String() string

type ProgrammableStageDescriptor

type ProgrammableStageDescriptor struct {
	Module     *ShaderModule
	EntryPoint string
}

ProgrammableStageDescriptor as described: https://gpuweb.github.io/gpuweb/#gpuprogrammablestage

type QueryType

type QueryType uint32
const (
	QueryTypeOcclusion QueryType = 0x00000000
	QueryTypeTimestamp QueryType = 0x00000001
)

func (QueryType) String

func (v QueryType) String() string

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

Queue as described: https://gpuweb.github.io/gpuweb/#gpuqueue

func (Queue) OnSubmittedWorkDone

func (g Queue) OnSubmittedWorkDone(callback QueueWorkDoneCallback)

OnSubmittedWorkDone as described: https://gpuweb.github.io/gpuweb/#dom-gpuqueue-onsubmittedworkdone

func (Queue) Release

func (g Queue) Release()

func (Queue) Submit

func (g Queue) Submit(commandBuffers ...*CommandBuffer)

Submit as described: https://gpuweb.github.io/gpuweb/#dom-gpuqueue-submit

func (Queue) WriteBuffer

func (g Queue) WriteBuffer(buffer *Buffer, offset uint64, data []byte) (err error)

WriteBuffer as described: https://gpuweb.github.io/gpuweb/#dom-gpuqueue-writebuffer

func (Queue) WriteTexture

func (g Queue) WriteTexture(destination *ImageCopyTexture, data []byte, dataLayout *TextureDataLayout, writeSize *Extent3D) (err error)

WriteTexture as described: https://gpuweb.github.io/gpuweb/#dom-gpuqueue-writetexture

type QueueWorkDoneCallback

type QueueWorkDoneCallback func(QueueWorkDoneStatus)

type QueueWorkDoneStatus

type QueueWorkDoneStatus uint32
const (
	QueueWorkDoneStatusSuccess    QueueWorkDoneStatus = 0x00000000
	QueueWorkDoneStatusError      QueueWorkDoneStatus = 0x00000001
	QueueWorkDoneStatusUnknown    QueueWorkDoneStatus = 0x00000002
	QueueWorkDoneStatusDeviceLost QueueWorkDoneStatus = 0x00000003
)

func (QueueWorkDoneStatus) String

func (v QueueWorkDoneStatus) String() string

type RenderPassColorAttachment

type RenderPassColorAttachment struct {
	View          *TextureView
	ResolveTarget *TextureView
	LoadOp        LoadOp
	StoreOp       StoreOp
	ClearValue    Color
}

RenderPassColorAttachment as described: https://gpuweb.github.io/gpuweb/#dictdef-gpurenderpasscolorattachment

type RenderPassDepthStencilAttachment

type RenderPassDepthStencilAttachment struct {
	View              *TextureView
	DepthLoadOp       LoadOp
	DepthStoreOp      StoreOp
	DepthClearValue   float32
	DepthReadOnly     bool
	StencilLoadOp     LoadOp
	StencilStoreOp    StoreOp
	StencilClearValue uint32
	StencilReadOnly   bool
}

type RenderPassDescriptor

type RenderPassDescriptor struct {
	Label                  string
	ColorAttachments       []RenderPassColorAttachment
	DepthStencilAttachment *RenderPassDepthStencilAttachment
}

RenderPassDescriptor as described: https://gpuweb.github.io/gpuweb/#dictdef-gpurenderpassdescriptor

type RenderPassEncoder

type RenderPassEncoder struct {
	// contains filtered or unexported fields
}

RenderPassEncoder as described: https://gpuweb.github.io/gpuweb/#gpurenderpassencoder

func (RenderPassEncoder) Draw

func (g RenderPassEncoder) Draw(vertexCount uint32, instanceCount, firstVertex, firstInstance uint32)

Draw as described: https://gpuweb.github.io/gpuweb/#dom-gpurendercommandsmixin-draw

func (RenderPassEncoder) DrawIndexed

func (g RenderPassEncoder) DrawIndexed(indexCount uint32, instanceCount uint32, firstIndex uint32, baseVertex int32, firstInstance uint32)

DrawIndexed as described: https://gpuweb.github.io/gpuweb/#dom-gpurendercommandsmixin-drawindexed

func (RenderPassEncoder) End

func (g RenderPassEncoder) End() error

End as described: https://gpuweb.github.io/gpuweb/#dom-gpurenderpassencoder-end

func (RenderPassEncoder) Release

func (g RenderPassEncoder) Release()

func (RenderPassEncoder) SetBindGroup

func (g RenderPassEncoder) SetBindGroup(index uint32, bindGroup *BindGroup, dynamicOffsets []uint32)

SetBindGroup as described: https://gpuweb.github.io/gpuweb/#gpubindingcommandsmixin-setbindgroup

func (RenderPassEncoder) SetIndexBuffer

func (g RenderPassEncoder) SetIndexBuffer(indexBuffer *Buffer, format IndexFormat, offset, size uint64)

SetIndexBuffer as described: https://gpuweb.github.io/gpuweb/#dom-gpurendercommandsmixin-setindexbuffer

func (RenderPassEncoder) SetPipeline

func (g RenderPassEncoder) SetPipeline(pipeline *RenderPipeline)

SetPipeline as described: https://gpuweb.github.io/gpuweb/#dom-gpurendercommandsmixin-setpipeline

func (RenderPassEncoder) SetVertexBuffer

func (g RenderPassEncoder) SetVertexBuffer(slot uint32, vertexBuffer *Buffer, offset, size uint64)

SetVertexBuffer as described: https://gpuweb.github.io/gpuweb/#dom-gpurendercommandsmixin-setvertexbuffer

type RenderPipeline

type RenderPipeline struct {
	// contains filtered or unexported fields
}

RenderPipeline as described: https://gpuweb.github.io/gpuweb/#gpurenderpipeline

func (RenderPipeline) GetBindGroupLayout

func (g RenderPipeline) GetBindGroupLayout(index uint32) *BindGroupLayout

GetBindGroupLayout as described: https://gpuweb.github.io/gpuweb/#dom-gpupipelinebase-getbindgrouplayout

func (RenderPipeline) Release

func (g RenderPipeline) Release()

type RenderPipelineDescriptor

type RenderPipelineDescriptor struct {
	Label        string
	Layout       *PipelineLayout
	Vertex       VertexState
	Primitive    PrimitiveState
	DepthStencil *DepthStencilState
	Multisample  MultisampleState
	Fragment     *FragmentState
}

RenderPipelineDescriptor as described: https://gpuweb.github.io/gpuweb/#dictdef-gpurenderpipelinedescriptor

type RequestAdapterOptions

type RequestAdapterOptions struct {
	CompatibleSurface    *Surface
	PowerPreference      PowerPreference
	ForceFallbackAdapter bool
	BackendType          BackendType
}

RequestAdapterOptions as described: https://gpuweb.github.io/gpuweb/#dictdef-gpurequestadapteroptions

type RequestAdapterStatus

type RequestAdapterStatus uint32
const (
	RequestAdapterStatusSuccess     RequestAdapterStatus = 0x00000000
	RequestAdapterStatusUnavailable RequestAdapterStatus = 0x00000001
	RequestAdapterStatusError       RequestAdapterStatus = 0x00000002
	RequestAdapterStatusUnknown     RequestAdapterStatus = 0x00000003
)

func (RequestAdapterStatus) String

func (v RequestAdapterStatus) String() string

type RequestDeviceStatus

type RequestDeviceStatus uint32
const (
	RequestDeviceStatusSuccess RequestDeviceStatus = 0x00000000
	RequestDeviceStatusError   RequestDeviceStatus = 0x00000001
	RequestDeviceStatusUnknown RequestDeviceStatus = 0x00000002
)

func (RequestDeviceStatus) String

func (v RequestDeviceStatus) String() string

type RequiredLimits

type RequiredLimits struct {
	Limits Limits
}

type Sampler

type Sampler struct {
	// contains filtered or unexported fields
}

Sampler as described: https://gpuweb.github.io/gpuweb/#gpusampler

func (Sampler) Release

func (g Sampler) Release()

type SamplerBindingLayout

type SamplerBindingLayout struct {
	Type SamplerBindingType
}

SamplerBindingLayout as described: https://gpuweb.github.io/gpuweb/#dictdef-gpusamplerbindinglayout

type SamplerBindingType

type SamplerBindingType uint32
const (
	SamplerBindingTypeUndefined    SamplerBindingType = 0x00000000
	SamplerBindingTypeFiltering    SamplerBindingType = 0x00000001
	SamplerBindingTypeNonFiltering SamplerBindingType = 0x00000002
	SamplerBindingTypeComparison   SamplerBindingType = 0x00000003
)

func (SamplerBindingType) String

func (v SamplerBindingType) String() string

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
}

type ShaderModule

type ShaderModule struct {
	// contains filtered or unexported fields
}

ShaderModule as described: https://gpuweb.github.io/gpuweb/#gpushadermodule

func (ShaderModule) Release

func (g ShaderModule) Release()

type ShaderModuleDescriptor

type ShaderModuleDescriptor struct {
	Label          string
	WGSLDescriptor *ShaderModuleWGSLDescriptor
}

ShaderModuleDescriptor as described: https://gpuweb.github.io/gpuweb/#dictdef-gpushadermoduledescriptor

type ShaderModuleWGSLDescriptor

type ShaderModuleWGSLDescriptor struct {
	Code string
}

type ShaderStage

type ShaderStage uint32
const (
	ShaderStageNone     ShaderStage = 0x00000000
	ShaderStageVertex   ShaderStage = 0x00000001
	ShaderStageFragment ShaderStage = 0x00000002
	ShaderStageCompute  ShaderStage = 0x00000004
)

func (ShaderStage) String

func (v ShaderStage) String() string

type StencilFaceState

type StencilFaceState struct {
	Compare     CompareFunction
	FailOp      StencilOperation
	DepthFailOp StencilOperation
	PassOp      StencilOperation
}

StencilFaceState as described: https://gpuweb.github.io/gpuweb/#dictdef-gpustencilfacestate

type StencilOperation

type StencilOperation uint32
const (
	StencilOperationKeep           StencilOperation = 0x00000000
	StencilOperationZero           StencilOperation = 0x00000001
	StencilOperationReplace        StencilOperation = 0x00000002
	StencilOperationInvert         StencilOperation = 0x00000003
	StencilOperationIncrementClamp StencilOperation = 0x00000004
	StencilOperationDecrementClamp StencilOperation = 0x00000005
	StencilOperationIncrementWrap  StencilOperation = 0x00000006
	StencilOperationDecrementWrap  StencilOperation = 0x00000007
)

func (StencilOperation) String

func (v StencilOperation) String() string

type StorageTextureAccess

type StorageTextureAccess uint32
const (
	StorageTextureAccessUndefined StorageTextureAccess = 0x00000000
	StorageTextureAccessWriteOnly StorageTextureAccess = 0x00000001
	StorageTextureAccessReadOnly  StorageTextureAccess = 0x00000002
	StorageTextureAccessReadWrite StorageTextureAccess = 0x00000003
)

func (StorageTextureAccess) String

func (v StorageTextureAccess) String() string

type StorageTextureBindingLayout

type StorageTextureBindingLayout struct {
	Access        StorageTextureAccess
	Format        TextureFormat
	ViewDimension TextureViewDimension
}

StorageTextureBindingLayout as described: https://gpuweb.github.io/gpuweb/#dictdef-gpustoragetexturebindinglayout

type StoreOp

type StoreOp uint32
const (
	StoreOpUndefined StoreOp = 0x00000000
	StoreOpStore     StoreOp = 0x00000001
	StoreOpDiscard   StoreOp = 0x00000002
)

func (StoreOp) String

func (v StoreOp) String() string

type SubmissionIndex

type SubmissionIndex uint64

type SupportedLimits

type SupportedLimits struct {
	Limits Limits
}

type Surface

type Surface struct {
	// contains filtered or unexported fields
}

Surface as described: https://gpuweb.github.io/gpuweb/#gpucanvascontext (CanvasContext is the closest equivalent to Surface in js)

func (Surface) Configure

func (g Surface) Configure(adapter *Adapter, device *Device, config *SurfaceConfiguration)

func (Surface) GetCapabilities

func (g Surface) GetCapabilities(adapter *Adapter) (ret SurfaceCapabilities)

func (Surface) GetCurrentTexture

func (g Surface) GetCurrentTexture() (*Texture, error)

func (Surface) Present

func (g Surface) Present()

func (Surface) Release

func (g Surface) Release()

type SurfaceCapabilities

type SurfaceCapabilities struct {
	Formats      []TextureFormat
	PresentModes []PresentMode
	AlphaModes   []CompositeAlphaMode
}

type SurfaceConfiguration

type SurfaceConfiguration struct {
	Usage       TextureUsage
	Format      TextureFormat
	Width       uint32
	Height      uint32
	PresentMode PresentMode
	AlphaMode   CompositeAlphaMode
	ViewFormats []TextureFormat
}

SurfaceConfiguration, corresponding to GPUCanvasConfiguration: https://gpuweb.github.io/gpuweb/#dictdef-gpucanvasconfiguration

type SurfaceDescriptor

type SurfaceDescriptor struct {
	// Canvas must be specified.
	Canvas js.Value

	Label string
}

SurfaceDescriptor must contain a valid HTML canvas element on web.

type SurfaceGetCurrentTextureStatus

type SurfaceGetCurrentTextureStatus uint32
const (
	SurfaceGetCurrentTextureStatusSuccess     SurfaceGetCurrentTextureStatus = 0x00000000
	SurfaceGetCurrentTextureStatusTimeout     SurfaceGetCurrentTextureStatus = 0x00000001
	SurfaceGetCurrentTextureStatusOutdated    SurfaceGetCurrentTextureStatus = 0x00000002
	SurfaceGetCurrentTextureStatusLost        SurfaceGetCurrentTextureStatus = 0x00000003
	SurfaceGetCurrentTextureStatusOutOfMemory SurfaceGetCurrentTextureStatus = 0x00000004
	SurfaceGetCurrentTextureStatusDeviceLost  SurfaceGetCurrentTextureStatus = 0x00000005
)

func (SurfaceGetCurrentTextureStatus) String

type Texture

type Texture struct {
	// contains filtered or unexported fields
}

Texture as described: https://gpuweb.github.io/gpuweb/#gputexture

func (*Texture) AsImageCopy

func (p *Texture) AsImageCopy() *ImageCopyTexture

func (Texture) CreateView

func (g Texture) CreateView(descriptor *TextureViewDescriptor) (*TextureView, error)

CreateView as described: https://gpuweb.github.io/gpuweb/#dom-gputexture-createview

func (Texture) GetDepthOrArrayLayers

func (g Texture) GetDepthOrArrayLayers() uint32

GetDepthOrArrayLayers as described: https://gpuweb.github.io/gpuweb/#dom-gputexture-depthorarraylayers

func (Texture) GetFormat

func (g Texture) GetFormat() TextureFormat

GetFormat as described: https://gpuweb.github.io/gpuweb/#dom-gputexture-format

func (Texture) GetMipLevelCount

func (g Texture) GetMipLevelCount() uint32

GetMipLevelCount as described: https://gpuweb.github.io/gpuweb/#dom-gputexture-miplevelcount

func (Texture) Present

func (g Texture) Present()

func (Texture) Release

func (g Texture) Release()

type TextureAspect

type TextureAspect uint32
const (
	TextureAspectAll         TextureAspect = 0x00000000
	TextureAspectStencilOnly TextureAspect = 0x00000001
	TextureAspectDepthOnly   TextureAspect = 0x00000002
)

func (TextureAspect) String

func (v TextureAspect) String() string

type TextureBindingLayout

type TextureBindingLayout struct {
	SampleType    TextureSampleType
	ViewDimension TextureViewDimension
	Multisampled  bool
}

TextureBindingLayout as described: https://gpuweb.github.io/gpuweb/#dictdef-gputexturebindinglayout

type TextureDataLayout

type TextureDataLayout struct {
	Offset       uint64
	BytesPerRow  uint32
	RowsPerImage uint32
}

type TextureDescriptor

type TextureDescriptor struct {
	Label         string
	Usage         TextureUsage
	Dimension     TextureDimension
	Size          Extent3D
	Format        TextureFormat
	MipLevelCount uint32
	SampleCount   uint32
}

TextureDescriptor as described: https://gpuweb.github.io/gpuweb/#gputexturedescriptor

type TextureDimension

type TextureDimension uint32
const (
	TextureDimension1D TextureDimension = 0x00000000
	TextureDimension2D TextureDimension = 0x00000001
	TextureDimension3D TextureDimension = 0x00000002
)

func (TextureDimension) String

func (v TextureDimension) String() string

type TextureFormat

type TextureFormat uint32
const (
	TextureFormatUndefined            TextureFormat = 0x00000000
	TextureFormatR8Unorm              TextureFormat = 0x00000001
	TextureFormatR8Snorm              TextureFormat = 0x00000002
	TextureFormatR8Uint               TextureFormat = 0x00000003
	TextureFormatR8Sint               TextureFormat = 0x00000004
	TextureFormatR16Uint              TextureFormat = 0x00000005
	TextureFormatR16Sint              TextureFormat = 0x00000006
	TextureFormatR16Float             TextureFormat = 0x00000007
	TextureFormatRG8Unorm             TextureFormat = 0x00000008
	TextureFormatRG8Snorm             TextureFormat = 0x00000009
	TextureFormatRG8Uint              TextureFormat = 0x0000000A
	TextureFormatRG8Sint              TextureFormat = 0x0000000B
	TextureFormatR32Float             TextureFormat = 0x0000000C
	TextureFormatR32Uint              TextureFormat = 0x0000000D
	TextureFormatR32Sint              TextureFormat = 0x0000000E
	TextureFormatRG16Uint             TextureFormat = 0x0000000F
	TextureFormatRG16Sint             TextureFormat = 0x00000010
	TextureFormatRG16Float            TextureFormat = 0x00000011
	TextureFormatRGBA8Unorm           TextureFormat = 0x00000012
	TextureFormatRGBA8UnormSrgb       TextureFormat = 0x00000013
	TextureFormatRGBA8Snorm           TextureFormat = 0x00000014
	TextureFormatRGBA8Uint            TextureFormat = 0x00000015
	TextureFormatRGBA8Sint            TextureFormat = 0x00000016
	TextureFormatBGRA8Unorm           TextureFormat = 0x00000017
	TextureFormatBGRA8UnormSrgb       TextureFormat = 0x00000018
	TextureFormatRGB10A2Uint          TextureFormat = 0x00000019
	TextureFormatRGB10A2Unorm         TextureFormat = 0x0000001A
	TextureFormatRG11B10Ufloat        TextureFormat = 0x0000001B
	TextureFormatRGB9E5Ufloat         TextureFormat = 0x0000001C
	TextureFormatRG32Float            TextureFormat = 0x0000001D
	TextureFormatRG32Uint             TextureFormat = 0x0000001E
	TextureFormatRG32Sint             TextureFormat = 0x0000001F
	TextureFormatRGBA16Uint           TextureFormat = 0x00000020
	TextureFormatRGBA16Sint           TextureFormat = 0x00000021
	TextureFormatRGBA16Float          TextureFormat = 0x00000022
	TextureFormatRGBA32Float          TextureFormat = 0x00000023
	TextureFormatRGBA32Uint           TextureFormat = 0x00000024
	TextureFormatRGBA32Sint           TextureFormat = 0x00000025
	TextureFormatStencil8             TextureFormat = 0x00000026
	TextureFormatDepth16Unorm         TextureFormat = 0x00000027
	TextureFormatDepth24Plus          TextureFormat = 0x00000028
	TextureFormatDepth24PlusStencil8  TextureFormat = 0x00000029
	TextureFormatDepth32Float         TextureFormat = 0x0000002A
	TextureFormatDepth32FloatStencil8 TextureFormat = 0x0000002B
	TextureFormatBC1RGBAUnorm         TextureFormat = 0x0000002C
	TextureFormatBC1RGBAUnormSrgb     TextureFormat = 0x0000002D
	TextureFormatBC2RGBAUnorm         TextureFormat = 0x0000002E
	TextureFormatBC2RGBAUnormSrgb     TextureFormat = 0x0000002F
	TextureFormatBC3RGBAUnorm         TextureFormat = 0x00000030
	TextureFormatBC3RGBAUnormSrgb     TextureFormat = 0x00000031
	TextureFormatBC4RUnorm            TextureFormat = 0x00000032
	TextureFormatBC4RSnorm            TextureFormat = 0x00000033
	TextureFormatBC5RGUnorm           TextureFormat = 0x00000034
	TextureFormatBC5RGSnorm           TextureFormat = 0x00000035
	TextureFormatBC6HRGBUfloat        TextureFormat = 0x00000036
	TextureFormatBC6HRGBFloat         TextureFormat = 0x00000037
	TextureFormatBC7RGBAUnorm         TextureFormat = 0x00000038
	TextureFormatBC7RGBAUnormSrgb     TextureFormat = 0x00000039
	TextureFormatETC2RGB8Unorm        TextureFormat = 0x0000003A
	TextureFormatETC2RGB8UnormSrgb    TextureFormat = 0x0000003B
	TextureFormatETC2RGB8A1Unorm      TextureFormat = 0x0000003C
	TextureFormatETC2RGB8A1UnormSrgb  TextureFormat = 0x0000003D
	TextureFormatETC2RGBA8Unorm       TextureFormat = 0x0000003E
	TextureFormatETC2RGBA8UnormSrgb   TextureFormat = 0x0000003F
	TextureFormatEACR11Unorm          TextureFormat = 0x00000040
	TextureFormatEACR11Snorm          TextureFormat = 0x00000041
	TextureFormatEACRG11Unorm         TextureFormat = 0x00000042
	TextureFormatEACRG11Snorm         TextureFormat = 0x00000043
	TextureFormatASTC4x4Unorm         TextureFormat = 0x00000044
	TextureFormatASTC4x4UnormSrgb     TextureFormat = 0x00000045
	TextureFormatASTC5x4Unorm         TextureFormat = 0x00000046
	TextureFormatASTC5x4UnormSrgb     TextureFormat = 0x00000047
	TextureFormatASTC5x5Unorm         TextureFormat = 0x00000048
	TextureFormatASTC5x5UnormSrgb     TextureFormat = 0x00000049
	TextureFormatASTC6x5Unorm         TextureFormat = 0x0000004A
	TextureFormatASTC6x5UnormSrgb     TextureFormat = 0x0000004B
	TextureFormatASTC6x6Unorm         TextureFormat = 0x0000004C
	TextureFormatASTC6x6UnormSrgb     TextureFormat = 0x0000004D
	TextureFormatASTC8x5Unorm         TextureFormat = 0x0000004E
	TextureFormatASTC8x5UnormSrgb     TextureFormat = 0x0000004F
	TextureFormatASTC8x6Unorm         TextureFormat = 0x00000050
	TextureFormatASTC8x6UnormSrgb     TextureFormat = 0x00000051
	TextureFormatASTC8x8Unorm         TextureFormat = 0x00000052
	TextureFormatASTC8x8UnormSrgb     TextureFormat = 0x00000053
	TextureFormatASTC10x5Unorm        TextureFormat = 0x00000054
	TextureFormatASTC10x5UnormSrgb    TextureFormat = 0x00000055
	TextureFormatASTC10x6Unorm        TextureFormat = 0x00000056
	TextureFormatASTC10x6UnormSrgb    TextureFormat = 0x00000057
	TextureFormatASTC10x8Unorm        TextureFormat = 0x00000058
	TextureFormatASTC10x8UnormSrgb    TextureFormat = 0x00000059
	TextureFormatASTC10x10Unorm       TextureFormat = 0x0000005A
	TextureFormatASTC10x10UnormSrgb   TextureFormat = 0x0000005B
	TextureFormatASTC12x10Unorm       TextureFormat = 0x0000005C
	TextureFormatASTC12x10UnormSrgb   TextureFormat = 0x0000005D
	TextureFormatASTC12x12Unorm       TextureFormat = 0x0000005E
	TextureFormatASTC12x12UnormSrgb   TextureFormat = 0x0000005F
)

func (TextureFormat) String

func (v TextureFormat) String() string

type TextureSampleType

type TextureSampleType uint32
const (
	TextureSampleTypeUndefined         TextureSampleType = 0x00000000
	TextureSampleTypeFloat             TextureSampleType = 0x00000001
	TextureSampleTypeUnfilterableFloat TextureSampleType = 0x00000002
	TextureSampleTypeDepth             TextureSampleType = 0x00000003
	TextureSampleTypeSint              TextureSampleType = 0x00000004
	TextureSampleTypeUint              TextureSampleType = 0x00000005
)

func (TextureSampleType) String

func (v TextureSampleType) String() string

type TextureUsage

type TextureUsage uint32
const (
	TextureUsageNone             TextureUsage = 0x00000000
	TextureUsageCopySrc          TextureUsage = 0x00000001
	TextureUsageCopyDst          TextureUsage = 0x00000002
	TextureUsageTextureBinding   TextureUsage = 0x00000004
	TextureUsageStorageBinding   TextureUsage = 0x00000008
	TextureUsageRenderAttachment TextureUsage = 0x00000010
)

func (TextureUsage) String

func (v TextureUsage) String() string

type TextureView

type TextureView struct {
	// contains filtered or unexported fields
}

TextureView as described: https://gpuweb.github.io/gpuweb/#gputextureview

func (TextureView) Release

func (g TextureView) Release()

type TextureViewDescriptor

type TextureViewDescriptor struct {
	Label           string
	Format          TextureFormat
	Dimension       TextureViewDimension
	BaseMipLevel    uint32
	MipLevelCount   uint32
	BaseArrayLayer  uint32
	ArrayLayerCount uint32
	Aspect          TextureAspect
}

type TextureViewDimension

type TextureViewDimension uint32
const (
	TextureViewDimensionUndefined TextureViewDimension = 0x00000000
	TextureViewDimension1D        TextureViewDimension = 0x00000001
	TextureViewDimension2D        TextureViewDimension = 0x00000002
	TextureViewDimension2DArray   TextureViewDimension = 0x00000003
	TextureViewDimensionCube      TextureViewDimension = 0x00000004
	TextureViewDimensionCubeArray TextureViewDimension = 0x00000005
	TextureViewDimension3D        TextureViewDimension = 0x00000006
)

func (TextureViewDimension) String

func (v TextureViewDimension) String() string

type Version

type Version uint32

func GetVersion

func GetVersion() Version

func (Version) String

func (v Version) String() string

type VertexAttribute

type VertexAttribute struct {
	Format         VertexFormat
	Offset         uint64
	ShaderLocation uint32
}

VertexAttribute as described: https://gpuweb.github.io/gpuweb/#dictdef-gpuvertexattribute

type VertexBufferLayout

type VertexBufferLayout struct {
	ArrayStride uint64
	StepMode    VertexStepMode
	Attributes  []VertexAttribute
}

VertexBufferLayout as described: https://gpuweb.github.io/gpuweb/#dictdef-gpuvertexbufferlayout

type VertexFormat

type VertexFormat uint32
const (
	VertexFormatUndefined VertexFormat = 0x00000000
	VertexFormatUint8x2   VertexFormat = 0x00000001
	VertexFormatUint8x4   VertexFormat = 0x00000002
	VertexFormatSint8x2   VertexFormat = 0x00000003
	VertexFormatSint8x4   VertexFormat = 0x00000004
	VertexFormatUnorm8x2  VertexFormat = 0x00000005
	VertexFormatUnorm8x4  VertexFormat = 0x00000006
	VertexFormatSnorm8x2  VertexFormat = 0x00000007
	VertexFormatSnorm8x4  VertexFormat = 0x00000008
	VertexFormatUint16x2  VertexFormat = 0x00000009
	VertexFormatUint16x4  VertexFormat = 0x0000000A
	VertexFormatSint16x2  VertexFormat = 0x0000000B
	VertexFormatSint16x4  VertexFormat = 0x0000000C
	VertexFormatUnorm16x2 VertexFormat = 0x0000000D
	VertexFormatUnorm16x4 VertexFormat = 0x0000000E
	VertexFormatSnorm16x2 VertexFormat = 0x0000000F
	VertexFormatSnorm16x4 VertexFormat = 0x00000010
	VertexFormatFloat16x2 VertexFormat = 0x00000011
	VertexFormatFloat16x4 VertexFormat = 0x00000012
	VertexFormatFloat32   VertexFormat = 0x00000013
	VertexFormatFloat32x2 VertexFormat = 0x00000014
	VertexFormatFloat32x3 VertexFormat = 0x00000015
	VertexFormatFloat32x4 VertexFormat = 0x00000016
	VertexFormatUint32    VertexFormat = 0x00000017
	VertexFormatUint32x2  VertexFormat = 0x00000018
	VertexFormatUint32x3  VertexFormat = 0x00000019
	VertexFormatUint32x4  VertexFormat = 0x0000001A
	VertexFormatSint32    VertexFormat = 0x0000001B
	VertexFormatSint32x2  VertexFormat = 0x0000001C
	VertexFormatSint32x3  VertexFormat = 0x0000001D
	VertexFormatSint32x4  VertexFormat = 0x0000001E
)

func (VertexFormat) Size

func (v VertexFormat) Size() uint64

func (VertexFormat) String

func (v VertexFormat) String() string

type VertexState

type VertexState struct {
	Module     *ShaderModule
	EntryPoint string
	Buffers    []VertexBufferLayout
}

VertexState as described: https://gpuweb.github.io/gpuweb/#dictdef-gpuvertexstate

type VertexStepMode

type VertexStepMode uint32
const (
	VertexStepModeVertex              VertexStepMode = 0x00000000
	VertexStepModeInstance            VertexStepMode = 0x00000001
	VertexStepModeVertexBufferNotUsed VertexStepMode = 0x00000002
)

func (VertexStepMode) String

func (v VertexStepMode) String() string

type WGSLFeatureName

type WGSLFeatureName uint32
const (
	WGSLFeatureNameUndefined                           WGSLFeatureName = 0x00000000
	WGSLFeatureNameReadonlyAndReadwriteStorageTextures WGSLFeatureName = 0x00000001
	WGSLFeatureNamePacked4x8IntegerDotProduct          WGSLFeatureName = 0x00000002
	WGSLFeatureNameUnrestrictedPointerParameters       WGSLFeatureName = 0x00000003
	WGSLFeatureNamePointerCompositeAccess              WGSLFeatureName = 0x00000004
)

func (WGSLFeatureName) String

func (v WGSLFeatureName) String() string

type WrappedSubmissionIndex

type WrappedSubmissionIndex struct {
	Queue           *Queue
	SubmissionIndex SubmissionIndex
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL