Skip to content

Commit

Permalink
fix ProgrammableStageDescriptor on js
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoreilly committed Sep 6, 2024
1 parent d7ffa75 commit 27294de
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 23 deletions.
7 changes: 7 additions & 0 deletions wgpu/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,3 +303,10 @@ type BindGroupEntry struct {
Sampler *Sampler
TextureView *TextureView
}

// ProgrammableStageDescriptor as described:
// https://gpuweb.github.io/gpuweb/#gpuprogrammablestage
type ProgrammableStageDescriptor struct {
Module *ShaderModule
EntryPoint string
}
2 changes: 1 addition & 1 deletion wgpu/compute_pipeline_js.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// https://gpuweb.github.io/gpuweb/#dictdef-gpucomputepipelinedescriptor
type ComputePipelineDescriptor struct {
Layout *PipelineLayout
Compute ProgrammableStage
Compute ProgrammableStageDescriptor
}

func (g ComputePipelineDescriptor) toJS() any {
Expand Down
8 changes: 0 additions & 8 deletions wgpu/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,14 +368,6 @@ type ConstantEntry struct {
Value float64
}

type ProgrammableStageDescriptor struct {
Module *ShaderModule
EntryPoint string

// unused in wgpu
// Constants []ConstantEntry
}

type ComputePipelineDescriptor struct {
Label string
Layout *PipelineLayout
Expand Down
14 changes: 0 additions & 14 deletions wgpu/shader_js.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,6 @@ package wgpu

import "syscall/js"

// ProgrammableStage as described:
// https://gpuweb.github.io/gpuweb/#gpuprogrammablestage
type ProgrammableStage struct {
Module *ShaderModule
EntryPoint string
}

func (g ProgrammableStage) toJS() any {
return map[string]any{
"module": pointerToJS(g.Module),
"entryPoint": g.EntryPoint,
}
}

// ShaderModuleDescriptor as described:
// https://gpuweb.github.io/gpuweb/#dictdef-gpushadermoduledescriptor
type ShaderModuleDescriptor struct {
Expand Down
7 changes: 7 additions & 0 deletions wgpu/to_js.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ func (g *SamplerDescriptor) toJS() any {
return result
}

func (g *ProgrammableStageDescriptor) toJS() any {
return map[string]any{
"module": pointerToJS(g.Module),
"entryPoint": g.EntryPoint,
}
}

func limitsFromJS(j js.Value) Limits {
return Limits{
MaxTextureDimension1D: uint32(j.Get("maxTextureDimension1D").Int()),
Expand Down

0 comments on commit 27294de

Please sign in to comment.