wasmgpu

package module
v0.0.0-...-46ebe79 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: MIT Imports: 5 Imported by: 4

README

Go WASM GPU

This project aims to expose the WebGPU API as Go API that can be used in wasm projects.

Warning: The project is in early development and the API is likely to change in backward incompatible ways!

Getting Started

You need to add the project as a dependency.

go get github.com/mokiat/wasmgpu@latest

The implementation uses syscall/js calls and as such requires that client applications are compiled with the GOOS=js and GOARCH=wasm options.

If you are unfamiliar with how Go and WASM works, then you should have a look at the official WebAssembly with Go documentation.

Following is an example Go code that clears the canvas with a green color.

package main

import (
	"syscall/js"

	"github.com/mokiat/gog/opt"
	"github.com/mokiat/wasmgpu"
)

func main() {
	// You need to ensure that getContext and getDevice methods exist.
	jsContext := js.Global().Call("getContext")
	jsDevice := js.Global().Call("getDevice")

	context := wasmgpu.NewCanvasContext(jsContext)

	device := wasmgpu.NewDevice(jsDevice)
	commandEncoder := device.CreateCommandEncoder()

	renderPass := commandEncoder.BeginRenderPass(wasmgpu.GPURenderPassDescriptor{
		ColorAttachments: []wasmgpu.GPURenderPassColorAttachment{
			{
				View: context.GetCurrentTexture().CreateView(),
				ClearValue: opt.V(wasmgpu.GPUColor{
					R: 0.0,
					G: 1.0,
					B: 0.0,
					A: 1.0,
				}),
				LoadOp:  wasmgpu.GPULoadOpClear,
				StoreOp: wasmgpu.GPUStoreOPStore,
			},
		},
	})
	renderPass.End()

	device.Queue().Submit([]wasmgpu.GPUCommandBuffer{
		commandEncoder.Finish(),
	})
}

NOTE: In order to get this working, the code needs access to getContext and getDevice functions that don't exist by default. You need to expose those from your page's JavaScript.

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>Experiment</title>
    <script type="text/javascript" src="wasm_exec.js"></script>
  </head>
  <body>
    <canvas width="512" height="512"></canvas>
    <script type="module">
      // Prepare a Canvas with WebGPU support.
      if (!navigator.gpu) {
        throw new Error("WebGPU not suppored :(");
      }
      const adapter = await navigator.gpu.requestAdapter({
        powerPreference: "high-performance",
      });
      if (!adapter) {
        throw new Error("No WebGPU adapter available :(");
      }
      const device = await adapter.requestDevice();
      if (!device) {
        throw new Error("No Device available :(");
      }
      const canvas = document.querySelector("canvas");
      const context = canvas.getContext("webgpu");
      const canvasFormat = navigator.gpu.getPreferredCanvasFormat();
      context.configure({
        device: device,
        format: canvasFormat,
      });

      // The following functions are needed by the Go code to get access
      // to the context and device.
      window.getDevice = () => {
        return device;
      };
      window.getContext = () => {
        return context;
      };

      // This is the standard code to get WebAssembly going with Go.
      const go = new Go();
      const result = await WebAssembly.instantiateStreaming(
        fetch("main.wasm"),
        go.importObject
      );
      await go.run(result.instance);
    </script>
  </body>
</html>

Demo

The project includes a working Demo based on Google's Codelab Tutorial.

You can check it live on the GitHub page of this project. Alternatively, you can run it yourself. It is located in the demo folder of the repository.

Run the following script to build the WASM file.

demo/build

Run the following script to run an HTTP server to host the demo/web folder.

demo/run

Next, open http://localhost:8080 with a browser that supports WebGPU. You should see the Demo running.

Extending the API

If something is not available in the API, in some cases, you can extend it as a workaround by extracting the js.Value object using obj.ToJS().(js.Value) and assigning it to a wrapper structure.

Example:

func ExtendQueue(queue GPUQueue) GPUQueueExt {
  return GPUQueueExt {
    GPUQueue: queue,
    jsValue:  queue.ToJS().(js.Value),
  }
}

type GPUQueueExt struct {
  GPUQueue
  jsValue js.Value
}

func (g GPUQueueExt) DoSomethingNew() {
  g.jsValue.Call("somethingNew")
}

In the meantime you can open a Github Issue so that the actual implementation can be adjusted.

Contributing

The project is still very early in the design phase. At this point in time Issues would be the preferred contribution mechanism.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataTypes

type DataTypes interface {
	~int8 | ~uint8 | ~int16 | ~uint16 | ~int32 | ~uint32 | ~float32 | ~float64
}

DataTypes represents allowed data slice types.

type GPUBindGroup

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

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

func (GPUBindGroup) ToJS

func (g GPUBindGroup) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUBindGroupDescriptor

type GPUBindGroupDescriptor struct {
	Layout  GPUBindGroupLayout
	Entries []GPUBindGroupEntry
}

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

func (GPUBindGroupDescriptor) ToJS

func (g GPUBindGroupDescriptor) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUBindGroupEntry

type GPUBindGroupEntry struct {
	Binding  GPUIndex32
	Resource GPUBindingResource
}

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

func (GPUBindGroupEntry) ToJS

func (g GPUBindGroupEntry) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUBindGroupLayout

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

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

func (GPUBindGroupLayout) ToJS

func (g GPUBindGroupLayout) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUBindGroupLayoutDescriptor

type GPUBindGroupLayoutDescriptor struct {
	Entries []GPUBindGroupLayoutEntry
}

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

func (GPUBindGroupLayoutDescriptor) ToJS

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUBindGroupLayoutEntry

type GPUBindGroupLayoutEntry struct {
	Binding         GPUIndex32
	Visibility      GPUShaderStageFlags
	Buffer          opt.T[GPUBufferBindingLayout]
	Sampler         opt.T[GPUSamplerBindingLayout]
	Texture         opt.T[GPUTextureBindingLayout]
	StorageTexture  opt.T[GPUStorageTextureBindingLayout]
	ExternalTexture opt.T[GPUExternalTextureBindingLayout]
}

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

func (GPUBindGroupLayoutEntry) ToJS

func (g GPUBindGroupLayoutEntry) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUBindingResource

type GPUBindingResource interface {
	ToJS() any
	// contains filtered or unexported methods
}

GPUBindingResource as described: https://gpuweb.github.io/gpuweb/#typedefdef-gpubindingresource

type GPUBlendComponent

type GPUBlendComponent struct {
	Operation opt.T[GPUBlendOperation]
	SrcFactor opt.T[GPUBlendFactor]
	DstFactor opt.T[GPUBlendFactor]
}

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

func (GPUBlendComponent) ToJS

func (g GPUBlendComponent) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUBlendFactor

type GPUBlendFactor string

GPUBlendFactor as described: https://gpuweb.github.io/gpuweb/#enumdef-gpublendfactor

const (
	GPUBlendFactorZero              GPUBlendFactor = "zero"
	GPUBlendFactorOne               GPUBlendFactor = "one"
	GPUBlendFactorSrc               GPUBlendFactor = "src"
	GPUBlendFactorOneMinusSrc       GPUBlendFactor = "one-minus-src"
	GPUBlendFactorSrcAlpha          GPUBlendFactor = "src-alpha"
	GPUBlendFactorOneMinusSrcAlpha  GPUBlendFactor = "one-minus-src-alpha"
	GPUBlendFactorDst               GPUBlendFactor = "dst"
	GPUBlendFactorOneMinusDst       GPUBlendFactor = "one-minus-dst"
	GPUBlendFactorDstAlpha          GPUBlendFactor = "dst-alpha"
	GPUBlendFactorOneMinusDstAlpha  GPUBlendFactor = "one-minus-dst-alpha"
	GPUBlendFactorSrcAlphaSaturated GPUBlendFactor = "src-alpha-saturated"
	GPUBlendFactorConstant          GPUBlendFactor = "constant"
	GPUBlendFactorOneMinusConstant  GPUBlendFactor = "one-minus-constant"
)

func (GPUBlendFactor) ToJS

func (g GPUBlendFactor) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUBlendOperation

type GPUBlendOperation string

GPUBlendOperation as described: https://gpuweb.github.io/gpuweb/#enumdef-gpublendoperation

const (
	GPUBlendOperationAdd             GPUBlendOperation = "add"
	GPUBlendOperationSubtract        GPUBlendOperation = "subtract"
	GPUBlendOperationReverseSubtract GPUBlendOperation = "reverse-subtract"
	GPUBlendOperationMin             GPUBlendOperation = "min"
	GPUBlendOperationMax             GPUBlendOperation = "max"
)

func (GPUBlendOperation) ToJS

func (g GPUBlendOperation) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUBlendState

type GPUBlendState struct {
	Color GPUBlendComponent
	Alpha GPUBlendComponent
}

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

func (GPUBlendState) ToJS

func (g GPUBlendState) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUBuffer

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

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

func (GPUBuffer) Destroy

func (g GPUBuffer) Destroy()

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

func (GPUBuffer) ToJS

func (g GPUBuffer) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUBufferBinding

type GPUBufferBinding struct {
	Buffer GPUBuffer
	Offset opt.T[GPUSize64]
	Size   opt.T[GPUSize64]
}

GPUBufferBinding as described: https://gpuweb.github.io/gpuweb/#dictdef-gpubufferbinding

func (GPUBufferBinding) ToJS

func (g GPUBufferBinding) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUBufferBindingLayout

type GPUBufferBindingLayout struct {
	Type             opt.T[GPUBufferBindingType]
	HasDynamicOffset opt.T[bool]
	MinBindingSize   opt.T[GPUSize64]
}

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

func (GPUBufferBindingLayout) ToJS

func (g GPUBufferBindingLayout) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUBufferBindingType

type GPUBufferBindingType string

GPUBufferBindingType as described: https://gpuweb.github.io/gpuweb/#enumdef-gpubufferbindingtype

const (
	GPUBufferBindingTypeUniform         GPUBufferBindingType = "uniform"
	GPUBufferBindingTypeStorage         GPUBufferBindingType = "storage"
	GPUBufferBindingTypeReadOnlyStorage GPUBufferBindingType = "read-only-storage"
)

func (GPUBufferBindingType) ToJS

func (g GPUBufferBindingType) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUBufferDescriptor

type GPUBufferDescriptor struct {
	Size  GPUSize64
	Usage GPUBufferUsageFlags
}

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

func (GPUBufferDescriptor) ToJS

func (g GPUBufferDescriptor) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUBufferDynamicOffset

type GPUBufferDynamicOffset uint32

GPUBufferDynamicOffset as described: https://gpuweb.github.io/gpuweb/#typedefdef-gpubufferdynamicoffset

func (GPUBufferDynamicOffset) ToJS

func (g GPUBufferDynamicOffset) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUBufferUsageFlags

type GPUBufferUsageFlags GPUFlagsConstant

GPUBufferUsageFlags as described: https://gpuweb.github.io/gpuweb/#typedefdef-gpubufferusageflags

const (
	GPUBufferUsageFlagsMapRead      GPUBufferUsageFlags = 0x0001
	GPUBufferUsageFlagsMapWrite     GPUBufferUsageFlags = 0x0002
	GPUBufferUsageFlagsCopySrc      GPUBufferUsageFlags = 0x0004
	GPUBufferUsageFlagsCopyDst      GPUBufferUsageFlags = 0x0008
	GPUBufferUsageFlagsIndex        GPUBufferUsageFlags = 0x0010
	GPUBufferUsageFlagsVertex       GPUBufferUsageFlags = 0x0020
	GPUBufferUsageFlagsUniform      GPUBufferUsageFlags = 0x0040
	GPUBufferUsageFlagsStorage      GPUBufferUsageFlags = 0x0080
	GPUBufferUsageFlagsIndirect     GPUBufferUsageFlags = 0x0100
	GPUBufferUsageFlagsQueryResolve GPUBufferUsageFlags = 0x0200
)

func (GPUBufferUsageFlags) ToJS

func (g GPUBufferUsageFlags) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUCanvasContext

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

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

func NewCanvasContext

func NewCanvasContext(jsValue js.Value) GPUCanvasContext

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

func (GPUCanvasContext) GetCurrentTexture

func (g GPUCanvasContext) GetCurrentTexture() GPUTexture

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

func (GPUCanvasContext) ToJS

func (g GPUCanvasContext) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUColor

type GPUColor struct {
	R float64
	G float64
	B float64
	A float64
}

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

func (GPUColor) ToJS

func (g GPUColor) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUColorTargetState

type GPUColorTargetState struct {
	Format    GPUTextureFormat
	Blend     opt.T[GPUBlendState]
	WriteMask opt.T[GPUColorWriteFlags]
}

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

func (GPUColorTargetState) ToJS

func (g GPUColorTargetState) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUColorWriteFlags

type GPUColorWriteFlags GPUFlagsConstant

GPUColorWriteFlags as described: https://gpuweb.github.io/gpuweb/#typedefdef-gpucolorwriteflags

const (
	GPUColorWriteFlagsRed   GPUColorWriteFlags = 0x1
	GPUColorWriteFlagsGreen GPUColorWriteFlags = 0x2
	GPUColorWriteFlagsBlue  GPUColorWriteFlags = 0x4
	GPUColorWriteFlagsAlpha GPUColorWriteFlags = 0x8
	GPUColorWriteFlagsAll   GPUColorWriteFlags = 0xF
)

func (GPUColorWriteFlags) ToJS

func (g GPUColorWriteFlags) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUCommandBuffer

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

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

func (GPUCommandBuffer) ToJS

func (g GPUCommandBuffer) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUCommandEncoder

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

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

func (GPUCommandEncoder) BeginComputePass

func (g GPUCommandEncoder) BeginComputePass(descriptor opt.T[GPUComputePassDescriptor]) GPUComputePassEncoder

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

func (GPUCommandEncoder) BeginRenderPass

func (g GPUCommandEncoder) BeginRenderPass(descriptor GPURenderPassDescriptor) GPURenderPassEncoder

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

func (GPUCommandEncoder) Finish

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

func (GPUCommandEncoder) ToJS

func (g GPUCommandEncoder) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUCompareFunction

type GPUCompareFunction string

GPUCompareFunction as described: https://gpuweb.github.io/gpuweb/#enumdef-gpucomparefunction

const (
	GPUCompareFunctionNever        GPUCompareFunction = "never"
	GPUCompareFunctionLess         GPUCompareFunction = "less"
	GPUCompareFunctionEqual        GPUCompareFunction = "equal"
	GPUCompareFunctionLessEqual    GPUCompareFunction = "less-equal"
	GPUCompareFunctionGreater      GPUCompareFunction = "greater"
	GPUCompareFunctionNotEqual     GPUCompareFunction = "not-equal"
	GPUCompareFunctionGreaterEqual GPUCompareFunction = "greater-equal"
	GPUCompareFunctionAlways       GPUCompareFunction = "always"
)

func (GPUCompareFunction) ToJS

func (g GPUCompareFunction) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUComputePassDescriptor

type GPUComputePassDescriptor struct{}

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

func (GPUComputePassDescriptor) ToJS

func (g GPUComputePassDescriptor) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUComputePassEncoder

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

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

func (GPUComputePassEncoder) DispatchWorkgroups

func (g GPUComputePassEncoder) DispatchWorkgroups(workgroupCountX, workgroupCountY, workgroupCountZ GPUSize32)

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

func (GPUComputePassEncoder) End

func (g GPUComputePassEncoder) End()

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

func (GPUComputePassEncoder) SetBindGroup

func (g GPUComputePassEncoder) SetBindGroup(index GPUIndex32, bindGroup GPUBindGroup, dynamicOffsets []GPUBufferDynamicOffset)

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

func (GPUComputePassEncoder) SetPipeline

func (g GPUComputePassEncoder) SetPipeline(pipeline GPUComputePipeline)

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

func (GPUComputePassEncoder) ToJS

func (g GPUComputePassEncoder) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUComputePipeline

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

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

func (GPUComputePipeline) ToJS

func (g GPUComputePipeline) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUComputePipelineDescriptor

type GPUComputePipelineDescriptor struct {
	Layout  opt.T[GPUPipelineLayout]
	Compute GPUProgrammableStage
}

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

func (GPUComputePipelineDescriptor) ToJS

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUCullMode

type GPUCullMode string

GPUCullMode as described: https://gpuweb.github.io/gpuweb/#enumdef-gpucullmode

const (
	GPUCullModeNone  GPUCullMode = "none"
	GPUCullModeFront GPUCullMode = "front"
	GPUCullModeBack  GPUCullMode = "back"
)

func (GPUCullMode) ToJS

func (g GPUCullMode) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUDepthBias

type GPUDepthBias int32

GPUDepthBias as described: https://gpuweb.github.io/gpuweb/#typedefdef-gpudepthbias

func (GPUDepthBias) ToJS

func (g GPUDepthBias) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUDepthStencilState

type GPUDepthStencilState struct {
	Format              GPUTextureFormat
	DepthWriteEnabled   bool
	DepthCompare        GPUCompareFunction
	StencilFront        opt.T[GPUStencilFaceState]
	StencilBack         opt.T[GPUStencilFaceState]
	StencilReadMask     opt.T[GPUStencilValue]
	StencilWriteMask    opt.T[GPUStencilValue]
	DepthBias           opt.T[GPUDepthBias]
	DepthBiasSlopeScale opt.T[float32]
	DepthBiasClamp      opt.T[float32]
}

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

func (GPUDepthStencilState) ToJS

func (g GPUDepthStencilState) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUDevice

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

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

func NewDevice

func NewDevice(jsValue js.Value) GPUDevice

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

func (GPUDevice) CreateBindGroup

func (g GPUDevice) CreateBindGroup(descriptor GPUBindGroupDescriptor) GPUBindGroup

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

func (GPUDevice) CreateBindGroupLayout

func (g GPUDevice) CreateBindGroupLayout(descriptor GPUBindGroupLayoutDescriptor) GPUBindGroupLayout

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

func (GPUDevice) CreateBuffer

func (g GPUDevice) CreateBuffer(descriptor GPUBufferDescriptor) GPUBuffer

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

func (GPUDevice) CreateCommandEncoder

func (g GPUDevice) CreateCommandEncoder() GPUCommandEncoder

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

func (GPUDevice) CreateComputePipeline

func (g GPUDevice) CreateComputePipeline(descriptor GPUComputePipelineDescriptor) GPUComputePipeline

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

func (GPUDevice) CreatePipelineLayout

func (g GPUDevice) CreatePipelineLayout(descriptor GPUPipelineLayoutDescriptor) GPUPipelineLayout

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

func (GPUDevice) CreateRenderPipeline

func (g GPUDevice) CreateRenderPipeline(descriptor GPURenderPipelineDescriptor) GPURenderPipeline

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

func (GPUDevice) CreateShaderModule

func (g GPUDevice) CreateShaderModule(desc GPUShaderModuleDescriptor) GPUShaderModule

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

func (GPUDevice) Queue

func (g GPUDevice) Queue() GPUQueue

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

func (GPUDevice) ToJS

func (g GPUDevice) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUExternalTextureBindingLayout

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

GPUExternalTextureBindingLayout as described:

func (GPUExternalTextureBindingLayout) ToJS

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUFlagsConstant

type GPUFlagsConstant uint32

GPUFlagsConstant as described: https://gpuweb.github.io/gpuweb/#typedefdef-gpuflagsconstant

func (GPUFlagsConstant) ToJS

func (g GPUFlagsConstant) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUFragmentState

type GPUFragmentState struct {
	Module     GPUShaderModule
	EntryPoint string
	Targets    []GPUColorTargetState
}

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

func (GPUFragmentState) ToJS

func (g GPUFragmentState) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUFrontFace

type GPUFrontFace string

GPUFrontFace as described: https://gpuweb.github.io/gpuweb/#enumdef-gpufrontface

const (
	GPUFrontFaceCCW GPUFrontFace = "ccw"
	GPUFrontFaceCW  GPUFrontFace = "cw"
)

func (GPUFrontFace) ToJS

func (g GPUFrontFace) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUIndex32

type GPUIndex32 uint32

GPUIndex32 as described: https://gpuweb.github.io/gpuweb/#typedefdef-gpuindex32

func (GPUIndex32) ToJS

func (g GPUIndex32) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUIndexFormat

type GPUIndexFormat string

GPUIndexFormat as described: https://gpuweb.github.io/gpuweb/#enumdef-gpuindexformat

const (
	GPUIndexFormatUint16 GPUIndexFormat = "uint16"
	GPUIndexFormatUint32 GPUIndexFormat = "uint32"
)

func (GPUIndexFormat) ToJS

func (g GPUIndexFormat) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUIntegerCoordinate

type GPUIntegerCoordinate uint32

GPUIntegerCoordinate as described: https://gpuweb.github.io/gpuweb/#typedefdef-gpuintegercoordinate

func (GPUIntegerCoordinate) ToJS

func (g GPUIntegerCoordinate) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPULoadOp

type GPULoadOp string

GPULoadOp as described: https://gpuweb.github.io/gpuweb/#enumdef-gpuloadop

const (
	GPULoadOpLoad  GPULoadOp = "load"
	GPULoadOpClear GPULoadOp = "clear"
)

func (GPULoadOp) ToJS

func (g GPULoadOp) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUMultisampleState

type GPUMultisampleState struct {
	Count                  opt.T[GPUSize32]
	Mask                   opt.T[GPUSampleMask]
	AlphaToCoverageEnabled opt.T[bool]
}

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

func (GPUMultisampleState) ToJS

func (g GPUMultisampleState) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUPipelineLayout

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

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

func (GPUPipelineLayout) ToJS

func (g GPUPipelineLayout) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUPipelineLayoutDescriptor

type GPUPipelineLayoutDescriptor struct {
	BindGroupLayouts []GPUBindGroupLayout
}

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

func (GPUPipelineLayoutDescriptor) ToJS

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUPrimitiveState

type GPUPrimitiveState struct {
	Topology         opt.T[GPUPrimitiveTopology]
	StripIndexFormat opt.T[GPUIndexFormat]
	FrontFace        opt.T[GPUFrontFace]
	CullMode         opt.T[GPUCullMode]
}

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

func (GPUPrimitiveState) ToJS

func (g GPUPrimitiveState) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUPrimitiveTopology

type GPUPrimitiveTopology string

GPUPrimitiveTopology as described: https://gpuweb.github.io/gpuweb/#enumdef-gpuprimitivetopology

const (
	GPUPrimitiveTopologyPointList     GPUPrimitiveTopology = "point-list"
	GPUPrimitiveTopologyLineList      GPUPrimitiveTopology = "line-list"
	GPUPrimitiveTopologyLineStrip     GPUPrimitiveTopology = "line-strip"
	GPUPrimitiveTopologyTriangleList  GPUPrimitiveTopology = "triangle-list"
	GPUPrimitiveTopologyTriangleStrip GPUPrimitiveTopology = "triangle-strip"
)

func (GPUPrimitiveTopology) ToJS

func (g GPUPrimitiveTopology) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUProgrammableStage

type GPUProgrammableStage struct {
	Module     GPUShaderModule
	EntryPoint string
}

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

func (GPUProgrammableStage) ToJS

func (g GPUProgrammableStage) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUQueue

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

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

func (GPUQueue) Submit

func (g GPUQueue) Submit(commandBuffers []GPUCommandBuffer)

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

func (GPUQueue) ToJS

func (g GPUQueue) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

func (GPUQueue) WriteBuffer

func (g GPUQueue) WriteBuffer(buffer GPUBuffer, offset uint64, data []byte)

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

type GPURenderPassColorAttachment

type GPURenderPassColorAttachment struct {
	View          GPUTextureView
	ResolveTarget opt.T[GPUTextureView]
	ClearValue    opt.T[GPUColor]
	LoadOp        GPULoadOp
	StoreOp       GPUStoreOp
}

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

func (GPURenderPassColorAttachment) ToJS

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPURenderPassDescriptor

type GPURenderPassDescriptor struct {
	ColorAttachments []GPURenderPassColorAttachment
}

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

func (GPURenderPassDescriptor) ToJS

func (g GPURenderPassDescriptor) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPURenderPassEncoder

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

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

func (GPURenderPassEncoder) Draw

func (g GPURenderPassEncoder) Draw(vertexCount GPUSize32, instanceCount, firstVertex, firstInstance opt.T[GPUSize32])

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

func (GPURenderPassEncoder) End

func (g GPURenderPassEncoder) End()

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

func (GPURenderPassEncoder) SetBindGroup

func (g GPURenderPassEncoder) SetBindGroup(index GPUIndex32, bindGroup GPUBindGroup, dynamicOffsets []GPUBufferDynamicOffset)

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

func (GPURenderPassEncoder) SetPipeline

func (g GPURenderPassEncoder) SetPipeline(pipeline GPURenderPipeline)

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

func (GPURenderPassEncoder) SetVertexBuffer

func (g GPURenderPassEncoder) SetVertexBuffer(slot GPUIndex32, vertexBuffer GPUBuffer, offset, size opt.T[GPUSize64])

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

func (GPURenderPassEncoder) ToJS

func (g GPURenderPassEncoder) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPURenderPipeline

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

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

func (GPURenderPipeline) GetBindGroupLayout

func (g GPURenderPipeline) GetBindGroupLayout(index uint32) GPUBindGroupLayout

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

func (GPURenderPipeline) ToJS

func (g GPURenderPipeline) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPURenderPipelineDescriptor

type GPURenderPipelineDescriptor struct {
	Layout       opt.T[GPUPipelineLayout]
	Vertex       GPUVertexState
	Primitive    opt.T[GPUPrimitiveState]
	DepthStencil opt.T[GPUDepthStencilState]
	Multisample  opt.T[GPUMultisampleState]
	Fragment     opt.T[GPUFragmentState]
}

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

func (GPURenderPipelineDescriptor) ToJS

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUSampleMask

type GPUSampleMask uint32

GPUSampleMask as described: https://gpuweb.github.io/gpuweb/#typedefdef-gpusamplemask

func (GPUSampleMask) ToJS

func (g GPUSampleMask) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUSamplerBindingLayout

type GPUSamplerBindingLayout struct {
	Type opt.T[GPUSamplerBindingType]
}

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

func (GPUSamplerBindingLayout) ToJS

func (g GPUSamplerBindingLayout) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUSamplerBindingType

type GPUSamplerBindingType string

GPUSamplerBindingType as described: https://gpuweb.github.io/gpuweb/#enumdef-gpusamplerbindingtype

const (
	GPUSamplerBindingTypeFiltering    GPUSamplerBindingType = "filtering"
	GPUSamplerBindingTypeNonFiltering GPUSamplerBindingType = "non-filtering"
	GPUSamplerBindingTypeComparison   GPUSamplerBindingType = "comparison"
)

func (GPUSamplerBindingType) ToJS

func (g GPUSamplerBindingType) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUShaderModule

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

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

func (GPUShaderModule) ToJS

func (g GPUShaderModule) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUShaderModuleDescriptor

type GPUShaderModuleDescriptor struct {
	Code string
}

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

func (GPUShaderModuleDescriptor) ToJS

func (g GPUShaderModuleDescriptor) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUShaderStageFlags

type GPUShaderStageFlags GPUFlagsConstant

GPUShaderStageFlags as described: https://gpuweb.github.io/gpuweb/#typedefdef-gpushaderstageflags

const (
	GPUShaderStageFlagsVertex   GPUShaderStageFlags = 0x1
	GPUShaderStageFlagsFragment GPUShaderStageFlags = 0x2
	GPUShaderStageFlagsCompute  GPUShaderStageFlags = 0x4
)

func (GPUShaderStageFlags) ToJS

func (g GPUShaderStageFlags) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUSize32

type GPUSize32 uint32

GPUSize32 as described: https://gpuweb.github.io/gpuweb/#typedefdef-gpusize32

func (GPUSize32) ToJS

func (g GPUSize32) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUSize64

type GPUSize64 uint64

GPUSize64 as described: https://gpuweb.github.io/gpuweb/#typedefdef-gpusize64

func (GPUSize64) ToJS

func (g GPUSize64) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUStencilFaceState

type GPUStencilFaceState struct {
	Compare     opt.T[GPUCompareFunction]
	FailOp      opt.T[GPUStencilOperation]
	DepthFailOp opt.T[GPUStencilOperation]
	PassOp      opt.T[GPUStencilOperation]
}

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

func (GPUStencilFaceState) ToJS

func (g GPUStencilFaceState) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUStencilOperation

type GPUStencilOperation string

GPUStencilOperation as described: https://gpuweb.github.io/gpuweb/#enumdef-gpustenciloperation

const (
	GPUStencilOperationKeep           GPUStencilOperation = "keep"
	GPUStencilOperationZero           GPUStencilOperation = "zero"
	GPUStencilOperationReplace        GPUStencilOperation = "replace"
	GPUStencilOperationInvert         GPUStencilOperation = "invert"
	GPUStencilOperationIncrementClamp GPUStencilOperation = "increment-clamp"
	GPUStencilOperationDecrementClamp GPUStencilOperation = "decrement-clamp"
	GPUStencilOperationIncrementWrap  GPUStencilOperation = "increment-wrap"
	GPUStencilOperationDecrementWrap  GPUStencilOperation = "decrement-wrap"
)

func (GPUStencilOperation) ToJS

func (g GPUStencilOperation) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUStencilValue

type GPUStencilValue uint32

GPUStencilValue as described: https://gpuweb.github.io/gpuweb/#typedefdef-gpustencilvalue

func (GPUStencilValue) ToJS

func (g GPUStencilValue) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUStorageTextureAccess

type GPUStorageTextureAccess string

GPUStorageTextureAccess as described: https://gpuweb.github.io/gpuweb/#enumdef-gpustoragetextureaccess

const (
	GPUStorageTextureAccessWriteOnly GPUStorageTextureAccess = "write-only"
)

func (GPUStorageTextureAccess) ToJS

func (g GPUStorageTextureAccess) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUStorageTextureBindingLayout

type GPUStorageTextureBindingLayout struct {
	Access        opt.T[GPUStorageTextureAccess]
	Format        GPUTextureFormat
	ViewDimension opt.T[GPUTextureViewDimension]
}

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

func (GPUStorageTextureBindingLayout) ToJS

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUStoreOp

type GPUStoreOp string

GPUStoreOp as described: https://gpuweb.github.io/gpuweb/#enumdef-gpustoreop

const (
	GPUStoreOPStore   GPUStoreOp = "store"
	GPUStoreOpDiscard GPUStoreOp = "discard"
)

func (GPUStoreOp) ToJS

func (g GPUStoreOp) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUTexture

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

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

func (GPUTexture) CreateView

func (g GPUTexture) CreateView() GPUTextureView

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

func (GPUTexture) Format

func (g GPUTexture) Format() GPUTextureFormat

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

func (GPUTexture) ToJS

func (g GPUTexture) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUTextureBindingLayout

type GPUTextureBindingLayout struct {
	SampleType    opt.T[GPUTextureSampleType]
	ViewDimension opt.T[GPUTextureViewDimension]
	Multisampled  opt.T[bool]
}

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

func (GPUTextureBindingLayout) ToJS

func (g GPUTextureBindingLayout) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUTextureFormat

type GPUTextureFormat string

GPUTextureFormat as described: https://gpuweb.github.io/gpuweb/#enumdef-gputextureformat

const (
	GPUTextureFormatR8Unorm GPUTextureFormat = "r8unorm"
	GPUTextureFormatR8Snorm GPUTextureFormat = "r8snorm"
	GPUTextureFormatR8Uint  GPUTextureFormat = "r8uint"
	GPUTextureFormatR8Sint  GPUTextureFormat = "r8sint"

	GPUTextureFormatR16Uint  GPUTextureFormat = "r16uint"
	GPUTextureFormatR16Sint  GPUTextureFormat = "r16sint"
	GPUTextureFormatR16float GPUTextureFormat = "r16float"
	GPUTextureFormatRG8Unorm GPUTextureFormat = "rg8unorm"
	GPUTextureFormatRG8Snorm GPUTextureFormat = "rg8snorm"
	GPUTextureFormatRG8Uint  GPUTextureFormat = "rg8uint"
	GPUTextureFormatRG8Sint  GPUTextureFormat = "rg8sint"

	GPUTextureFormatR32Uint        GPUTextureFormat = "r32uint"
	GPUTextureFormatR32Sint        GPUTextureFormat = "r32sint"
	GPUTextureFormatR32float       GPUTextureFormat = "r32float"
	GPUTextureFormatRG16Uint       GPUTextureFormat = "rg16uint"
	GPUTextureFormatRG16Sint       GPUTextureFormat = "rg16sint"
	GPUTextureFormatRG16float      GPUTextureFormat = "rg16float"
	GPUTextureFormatRGBA8Unorm     GPUTextureFormat = "rgba8unorm"
	GPUTextureFormatRGBA8UnormSRGB GPUTextureFormat = "rgba8unorm-srgb"
	GPUTextureFormatRGBA8Snorm     GPUTextureFormat = "rgba8snorm"
	GPUTextureFormatRGBA8Uint      GPUTextureFormat = "rgba8uint"
	GPUTextureFormatRGBA8Sint      GPUTextureFormat = "rgba8sint"
	GPUTextureFormatBGRA8Unorm     GPUTextureFormat = "bgra8unorm"
	GPUTextureFormatBGRA8UnormSRGB GPUTextureFormat = "bgra8unorm-srgb"
	GPUTextureFormatRGB9E5UFloat   GPUTextureFormat = "rgb9e5ufloat"
	GPUTextureFormatRGB10A2Uint    GPUTextureFormat = "rgb10a2uint"
	GPUTextureFormatRGB10A2Unorm   GPUTextureFormat = "rgb10a2unorm"
	GPUTextureFormatRG11B10Ufloat  GPUTextureFormat = "rg11b10ufloat"

	GPUTextureFormatRG32Uint    GPUTextureFormat = "rg32uint"
	GPUTextureFormatRG32Sint    GPUTextureFormat = "rg32sint"
	GPUTextureFormatRG32Float   GPUTextureFormat = "rg32float"
	GPUTextureFormatRGBA16Uint  GPUTextureFormat = "rgba16uint"
	GPUTextureFormatRGBA16Sint  GPUTextureFormat = "rgba16sint"
	GPUTextureFormatRGBA16Float GPUTextureFormat = "rgba16float"

	GPUTextureFormatRGBA32Uint  GPUTextureFormat = "rgba32uint"
	GPUTextureFormatRGBA32Sint  GPUTextureFormat = "rgba32sint"
	GPUTextureFormatRGBA32Float GPUTextureFormat = "rgba32float"

	GPUTextureFormatStencil8            GPUTextureFormat = "stencil8"
	GPUTextureFormatDepth16Unorm        GPUTextureFormat = "depth16unorm"
	GPUTextureFormatDepth24Plus         GPUTextureFormat = "depth24plus"
	GPUTextureFormatDepth24PlusStencil8 GPUTextureFormat = "depth24plus-stencil8"
	GPUTextureFormatDepth32Float        GPUTextureFormat = "depth32float"

	GPUTextureFormatDepth32FloatStencil8 GPUTextureFormat = "depth32float-stencil8"
)

func (GPUTextureFormat) ToJS

func (g GPUTextureFormat) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUTextureSampleType

type GPUTextureSampleType string

GPUTextureSampleType as described: https://gpuweb.github.io/gpuweb/#enumdef-gputexturesampletype

const (
	GPUTextureSampleTypeFloat             GPUTextureSampleType = "float"
	GPUTextureSampleTypeUnfilterableFloat GPUTextureSampleType = "unfilterable-float"
	GPUTextureSampleTypeDepth             GPUTextureSampleType = "depth"
	GPUTextureSampleTypeSint              GPUTextureSampleType = "sint"
	GPUTextureSampleTypeUint              GPUTextureSampleType = "uint"
)

func (GPUTextureSampleType) ToJS

func (g GPUTextureSampleType) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUTextureView

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

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

func (GPUTextureView) ToJS

func (g GPUTextureView) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUTextureViewDimension

type GPUTextureViewDimension string

GPUTextureViewDimension as described: https://gpuweb.github.io/gpuweb/#enumdef-gputextureviewdimension

const (
	GPUTextureViewDimension1D        GPUTextureViewDimension = "1d"
	GPUTextureViewDimension2D        GPUTextureViewDimension = "2d"
	GPUTextureViewDimension2DArray   GPUTextureViewDimension = "2d-array"
	GPUTextureViewDimensionCube      GPUTextureViewDimension = "cube"
	GPUTextureViewDimensionCubeArray GPUTextureViewDimension = "cube-array"
	GPUTextureViewDimension3D        GPUTextureViewDimension = "3d"
)

func (GPUTextureViewDimension) ToJS

func (g GPUTextureViewDimension) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUVertexAttribute

type GPUVertexAttribute struct {
	Format         GPUVertexFormat
	Offset         GPUSize64
	ShaderLocation GPUIndex32
}

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

func (GPUVertexAttribute) ToJS

func (g GPUVertexAttribute) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUVertexBufferLayout

type GPUVertexBufferLayout struct {
	ArrayStride GPUSize64
	StepMode    opt.T[GPUVertexStepMode]
	Attributes  []GPUVertexAttribute
}

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

func (GPUVertexBufferLayout) ToJS

func (g GPUVertexBufferLayout) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUVertexFormat

type GPUVertexFormat string

GPUVertexFormat as described: https://gpuweb.github.io/gpuweb/#enumdef-gpuvertexformat

const (
	GPUVertexFormatUint8x2   GPUVertexFormat = "uint8x2"
	GPUVertexFormatUint8x4   GPUVertexFormat = "uint8x4"
	GPUVertexFormatSint8x2   GPUVertexFormat = "sint8x2"
	GPUVertexFormatSint8x4   GPUVertexFormat = "sint8x4"
	GPUVertexFormatUnorm8x2  GPUVertexFormat = "unorm8x2"
	GPUVertexFormatUnorm8x4  GPUVertexFormat = "unorm8x4"
	GPUVertexFormatSnorm8x2  GPUVertexFormat = "snorm8x2"
	GPUVertexFormatSnorm8x4  GPUVertexFormat = "snorm8x4"
	GPUVertexFormatUint16x2  GPUVertexFormat = "uint16x2"
	GPUVertexFormatUint16x4  GPUVertexFormat = "uint16x4"
	GPUVertexFormatSint16x2  GPUVertexFormat = "sint16x2"
	GPUVertexFormatSint16x4  GPUVertexFormat = "sint16x4"
	GPUVertexFormatUnorm16x2 GPUVertexFormat = "unorm16x2"
	GPUVertexFormatUnorm16x4 GPUVertexFormat = "unorm16x4"
	GPUVertexFormatSnorm16x2 GPUVertexFormat = "snorm16x2"
	GPUVertexFormatSnorm16x4 GPUVertexFormat = "snorm16x4"
	GPUVertexFormatFloat16x2 GPUVertexFormat = "float16x2"
	GPUVertexFormatFloat16x4 GPUVertexFormat = "float16x4"
	GPUVertexFormatFloat32   GPUVertexFormat = "float32"
	GPUVertexFormatFloat32x2 GPUVertexFormat = "float32x2"
	GPUVertexFormatFloat32x3 GPUVertexFormat = "float32x3"
	GPUVertexFormatFloat32x4 GPUVertexFormat = "float32x4"
	GPUVertexFormatUint32    GPUVertexFormat = "uint32"
	GPUVertexFormatUint32x2  GPUVertexFormat = "uint32x2"
	GPUVertexFormatUint32x3  GPUVertexFormat = "uint32x3"
	GPUVertexFormatUint32x4  GPUVertexFormat = "uint32x4"
	GPUVertexFormatSint32    GPUVertexFormat = "sint32"
	GPUVertexFormatSint32x2  GPUVertexFormat = "sint32x2"
	GPUVertexFormatSint32x3  GPUVertexFormat = "sint32x3"
	GPUVertexFormatSint32x4  GPUVertexFormat = "sint32x4"
)

func (GPUVertexFormat) ToJS

func (g GPUVertexFormat) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUVertexState

type GPUVertexState struct {
	Module     GPUShaderModule
	EntryPoint string
	Buffers    []GPUVertexBufferLayout
}

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

func (GPUVertexState) ToJS

func (g GPUVertexState) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

type GPUVertexStepMode

type GPUVertexStepMode string

GPUVertexStepMode as described: https://gpuweb.github.io/gpuweb/#enumdef-gpuvertexstepmode

const (
	GPUVertexStepModeVertex   GPUVertexStepMode = "vertex"
	GPUVertexStepModeInstance GPUVertexStepMode = "instance"
)

func (GPUVertexStepMode) ToJS

func (g GPUVertexStepMode) ToJS() any

ToJS converts this type to one that can be passed as an argument to JavaScript.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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