github.com/primecitizens/pcz/std@v0.2.1/plat/js/web/apis16_js_wasm.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright 2023 The Prime Citizens
     3  
     4  package web
     5  
     6  import (
     7  	"github.com/primecitizens/pcz/std/ffi/js"
     8  	"github.com/primecitizens/pcz/std/plat/js/web/bindings"
     9  )
    10  
    11  type GPUAutoLayoutMode uint32
    12  
    13  const (
    14  	_ GPUAutoLayoutMode = iota
    15  
    16  	GPUAutoLayoutMode_AUTO
    17  )
    18  
    19  func (GPUAutoLayoutMode) FromRef(str js.Ref) GPUAutoLayoutMode {
    20  	return GPUAutoLayoutMode(bindings.ConstOfGPUAutoLayoutMode(str))
    21  }
    22  
    23  func (x GPUAutoLayoutMode) String() (string, bool) {
    24  	switch x {
    25  	case GPUAutoLayoutMode_AUTO:
    26  		return "auto", true
    27  	default:
    28  		return "", false
    29  	}
    30  }
    31  
    32  type OneOf_GPUPipelineLayout_GPUAutoLayoutMode struct {
    33  	ref js.Ref
    34  }
    35  
    36  func (x OneOf_GPUPipelineLayout_GPUAutoLayoutMode) Ref() js.Ref {
    37  	return x.ref
    38  }
    39  
    40  func (x OneOf_GPUPipelineLayout_GPUAutoLayoutMode) Free() {
    41  	x.ref.Free()
    42  }
    43  
    44  func (x OneOf_GPUPipelineLayout_GPUAutoLayoutMode) FromRef(ref js.Ref) OneOf_GPUPipelineLayout_GPUAutoLayoutMode {
    45  	return OneOf_GPUPipelineLayout_GPUAutoLayoutMode{
    46  		ref: ref,
    47  	}
    48  }
    49  
    50  func (x OneOf_GPUPipelineLayout_GPUAutoLayoutMode) GPUPipelineLayout() GPUPipelineLayout {
    51  	return GPUPipelineLayout{}.FromRef(x.ref)
    52  }
    53  
    54  func (x OneOf_GPUPipelineLayout_GPUAutoLayoutMode) GPUAutoLayoutMode() GPUAutoLayoutMode {
    55  	return GPUAutoLayoutMode(0).FromRef(x.ref)
    56  }
    57  
    58  type GPUShaderModuleCompilationHint struct {
    59  	// Layout is "GPUShaderModuleCompilationHint.layout"
    60  	//
    61  	// Optional
    62  	Layout OneOf_GPUPipelineLayout_GPUAutoLayoutMode
    63  
    64  	FFI_USE bool
    65  }
    66  
    67  // FromRef calls UpdateFrom and returns a GPUShaderModuleCompilationHint with all fields set.
    68  func (p GPUShaderModuleCompilationHint) FromRef(ref js.Ref) GPUShaderModuleCompilationHint {
    69  	p.UpdateFrom(ref)
    70  	return p
    71  }
    72  
    73  // New creates a new GPUShaderModuleCompilationHint in the application heap.
    74  func (p GPUShaderModuleCompilationHint) New() js.Ref {
    75  	return bindings.GPUShaderModuleCompilationHintJSLoad(
    76  		js.Pointer(&p), js.True, 0,
    77  	)
    78  }
    79  
    80  // UpdateFrom copies value of all fields of the heap object to p.
    81  func (p *GPUShaderModuleCompilationHint) UpdateFrom(ref js.Ref) {
    82  	bindings.GPUShaderModuleCompilationHintJSStore(
    83  		js.Pointer(p), ref,
    84  	)
    85  }
    86  
    87  // Update writes all fields of the p to the heap object referenced by ref.
    88  func (p *GPUShaderModuleCompilationHint) Update(ref js.Ref) {
    89  	bindings.GPUShaderModuleCompilationHintJSLoad(
    90  		js.Pointer(p), js.False, ref,
    91  	)
    92  }
    93  
    94  // FreeMembers frees fields with heap reference, if recursive is true
    95  // free all heap references reachable from p.
    96  func (p *GPUShaderModuleCompilationHint) FreeMembers(recursive bool) {
    97  	js.Free(
    98  		p.Layout.Ref(),
    99  	)
   100  	p.Layout = p.Layout.FromRef(js.Undefined)
   101  }
   102  
   103  type GPUShaderModuleDescriptor struct {
   104  	// Code is "GPUShaderModuleDescriptor.code"
   105  	//
   106  	// Required
   107  	Code js.String
   108  	// SourceMap is "GPUShaderModuleDescriptor.sourceMap"
   109  	//
   110  	// Optional
   111  	SourceMap js.Object
   112  	// Hints is "GPUShaderModuleDescriptor.hints"
   113  	//
   114  	// Optional
   115  	Hints js.Record[GPUShaderModuleCompilationHint]
   116  	// Label is "GPUShaderModuleDescriptor.label"
   117  	//
   118  	// Optional, defaults to "".
   119  	Label js.String
   120  
   121  	FFI_USE bool
   122  }
   123  
   124  // FromRef calls UpdateFrom and returns a GPUShaderModuleDescriptor with all fields set.
   125  func (p GPUShaderModuleDescriptor) FromRef(ref js.Ref) GPUShaderModuleDescriptor {
   126  	p.UpdateFrom(ref)
   127  	return p
   128  }
   129  
   130  // New creates a new GPUShaderModuleDescriptor in the application heap.
   131  func (p GPUShaderModuleDescriptor) New() js.Ref {
   132  	return bindings.GPUShaderModuleDescriptorJSLoad(
   133  		js.Pointer(&p), js.True, 0,
   134  	)
   135  }
   136  
   137  // UpdateFrom copies value of all fields of the heap object to p.
   138  func (p *GPUShaderModuleDescriptor) UpdateFrom(ref js.Ref) {
   139  	bindings.GPUShaderModuleDescriptorJSStore(
   140  		js.Pointer(p), ref,
   141  	)
   142  }
   143  
   144  // Update writes all fields of the p to the heap object referenced by ref.
   145  func (p *GPUShaderModuleDescriptor) Update(ref js.Ref) {
   146  	bindings.GPUShaderModuleDescriptorJSLoad(
   147  		js.Pointer(p), js.False, ref,
   148  	)
   149  }
   150  
   151  // FreeMembers frees fields with heap reference, if recursive is true
   152  // free all heap references reachable from p.
   153  func (p *GPUShaderModuleDescriptor) FreeMembers(recursive bool) {
   154  	js.Free(
   155  		p.Code.Ref(),
   156  		p.SourceMap.Ref(),
   157  		p.Hints.Ref(),
   158  		p.Label.Ref(),
   159  	)
   160  	p.Code = p.Code.FromRef(js.Undefined)
   161  	p.SourceMap = p.SourceMap.FromRef(js.Undefined)
   162  	p.Hints = p.Hints.FromRef(js.Undefined)
   163  	p.Label = p.Label.FromRef(js.Undefined)
   164  }
   165  
   166  type GPUComputePipeline struct {
   167  	ref js.Ref
   168  }
   169  
   170  func (this GPUComputePipeline) Once() GPUComputePipeline {
   171  	this.ref.Once()
   172  	return this
   173  }
   174  
   175  func (this GPUComputePipeline) Ref() js.Ref {
   176  	return this.ref
   177  }
   178  
   179  func (this GPUComputePipeline) FromRef(ref js.Ref) GPUComputePipeline {
   180  	this.ref = ref
   181  	return this
   182  }
   183  
   184  func (this GPUComputePipeline) Free() {
   185  	this.ref.Free()
   186  }
   187  
   188  // Label returns the value of property "GPUComputePipeline.label".
   189  //
   190  // It returns ok=false if there is no such property.
   191  func (this GPUComputePipeline) Label() (ret js.String, ok bool) {
   192  	ok = js.True == bindings.GetGPUComputePipelineLabel(
   193  		this.ref, js.Pointer(&ret),
   194  	)
   195  	return
   196  }
   197  
   198  // SetLabel sets the value of property "GPUComputePipeline.label" to val.
   199  //
   200  // It returns false if the property cannot be set.
   201  func (this GPUComputePipeline) SetLabel(val js.String) bool {
   202  	return js.True == bindings.SetGPUComputePipelineLabel(
   203  		this.ref,
   204  		val.Ref(),
   205  	)
   206  }
   207  
   208  // HasFuncGetBindGroupLayout returns true if the method "GPUComputePipeline.getBindGroupLayout" exists.
   209  func (this GPUComputePipeline) HasFuncGetBindGroupLayout() bool {
   210  	return js.True == bindings.HasFuncGPUComputePipelineGetBindGroupLayout(
   211  		this.ref,
   212  	)
   213  }
   214  
   215  // FuncGetBindGroupLayout returns the method "GPUComputePipeline.getBindGroupLayout".
   216  func (this GPUComputePipeline) FuncGetBindGroupLayout() (fn js.Func[func(index uint32) GPUBindGroupLayout]) {
   217  	bindings.FuncGPUComputePipelineGetBindGroupLayout(
   218  		this.ref, js.Pointer(&fn),
   219  	)
   220  	return
   221  }
   222  
   223  // GetBindGroupLayout calls the method "GPUComputePipeline.getBindGroupLayout".
   224  func (this GPUComputePipeline) GetBindGroupLayout(index uint32) (ret GPUBindGroupLayout) {
   225  	bindings.CallGPUComputePipelineGetBindGroupLayout(
   226  		this.ref, js.Pointer(&ret),
   227  		uint32(index),
   228  	)
   229  
   230  	return
   231  }
   232  
   233  // TryGetBindGroupLayout calls the method "GPUComputePipeline.getBindGroupLayout"
   234  // in a try/catch block and returns (_, err, ok = false) when it went through
   235  // the catch clause.
   236  func (this GPUComputePipeline) TryGetBindGroupLayout(index uint32) (ret GPUBindGroupLayout, exception js.Any, ok bool) {
   237  	ok = js.True == bindings.TryGPUComputePipelineGetBindGroupLayout(
   238  		this.ref, js.Pointer(&ret), js.Pointer(&exception),
   239  		uint32(index),
   240  	)
   241  
   242  	return
   243  }
   244  
   245  type GPUPipelineConstantValue float64
   246  
   247  type GPUProgrammableStage struct {
   248  	// Module is "GPUProgrammableStage.module"
   249  	//
   250  	// Required
   251  	Module GPUShaderModule
   252  	// EntryPoint is "GPUProgrammableStage.entryPoint"
   253  	//
   254  	// Required
   255  	EntryPoint js.String
   256  	// Constants is "GPUProgrammableStage.constants"
   257  	//
   258  	// Optional
   259  	Constants js.Record[GPUPipelineConstantValue]
   260  
   261  	FFI_USE bool
   262  }
   263  
   264  // FromRef calls UpdateFrom and returns a GPUProgrammableStage with all fields set.
   265  func (p GPUProgrammableStage) FromRef(ref js.Ref) GPUProgrammableStage {
   266  	p.UpdateFrom(ref)
   267  	return p
   268  }
   269  
   270  // New creates a new GPUProgrammableStage in the application heap.
   271  func (p GPUProgrammableStage) New() js.Ref {
   272  	return bindings.GPUProgrammableStageJSLoad(
   273  		js.Pointer(&p), js.True, 0,
   274  	)
   275  }
   276  
   277  // UpdateFrom copies value of all fields of the heap object to p.
   278  func (p *GPUProgrammableStage) UpdateFrom(ref js.Ref) {
   279  	bindings.GPUProgrammableStageJSStore(
   280  		js.Pointer(p), ref,
   281  	)
   282  }
   283  
   284  // Update writes all fields of the p to the heap object referenced by ref.
   285  func (p *GPUProgrammableStage) Update(ref js.Ref) {
   286  	bindings.GPUProgrammableStageJSLoad(
   287  		js.Pointer(p), js.False, ref,
   288  	)
   289  }
   290  
   291  // FreeMembers frees fields with heap reference, if recursive is true
   292  // free all heap references reachable from p.
   293  func (p *GPUProgrammableStage) FreeMembers(recursive bool) {
   294  	js.Free(
   295  		p.Module.Ref(),
   296  		p.EntryPoint.Ref(),
   297  		p.Constants.Ref(),
   298  	)
   299  	p.Module = p.Module.FromRef(js.Undefined)
   300  	p.EntryPoint = p.EntryPoint.FromRef(js.Undefined)
   301  	p.Constants = p.Constants.FromRef(js.Undefined)
   302  }
   303  
   304  type GPUComputePipelineDescriptor struct {
   305  	// Compute is "GPUComputePipelineDescriptor.compute"
   306  	//
   307  	// Required
   308  	//
   309  	// NOTE: Compute.FFI_USE MUST be set to true to get Compute used.
   310  	Compute GPUProgrammableStage
   311  	// Layout is "GPUComputePipelineDescriptor.layout"
   312  	//
   313  	// Required
   314  	Layout OneOf_GPUPipelineLayout_GPUAutoLayoutMode
   315  	// Label is "GPUComputePipelineDescriptor.label"
   316  	//
   317  	// Optional, defaults to "".
   318  	Label js.String
   319  
   320  	FFI_USE bool
   321  }
   322  
   323  // FromRef calls UpdateFrom and returns a GPUComputePipelineDescriptor with all fields set.
   324  func (p GPUComputePipelineDescriptor) FromRef(ref js.Ref) GPUComputePipelineDescriptor {
   325  	p.UpdateFrom(ref)
   326  	return p
   327  }
   328  
   329  // New creates a new GPUComputePipelineDescriptor in the application heap.
   330  func (p GPUComputePipelineDescriptor) New() js.Ref {
   331  	return bindings.GPUComputePipelineDescriptorJSLoad(
   332  		js.Pointer(&p), js.True, 0,
   333  	)
   334  }
   335  
   336  // UpdateFrom copies value of all fields of the heap object to p.
   337  func (p *GPUComputePipelineDescriptor) UpdateFrom(ref js.Ref) {
   338  	bindings.GPUComputePipelineDescriptorJSStore(
   339  		js.Pointer(p), ref,
   340  	)
   341  }
   342  
   343  // Update writes all fields of the p to the heap object referenced by ref.
   344  func (p *GPUComputePipelineDescriptor) Update(ref js.Ref) {
   345  	bindings.GPUComputePipelineDescriptorJSLoad(
   346  		js.Pointer(p), js.False, ref,
   347  	)
   348  }
   349  
   350  // FreeMembers frees fields with heap reference, if recursive is true
   351  // free all heap references reachable from p.
   352  func (p *GPUComputePipelineDescriptor) FreeMembers(recursive bool) {
   353  	js.Free(
   354  		p.Layout.Ref(),
   355  		p.Label.Ref(),
   356  	)
   357  	p.Layout = p.Layout.FromRef(js.Undefined)
   358  	p.Label = p.Label.FromRef(js.Undefined)
   359  	if recursive {
   360  		p.Compute.FreeMembers(true)
   361  	}
   362  }
   363  
   364  type GPURenderPipeline struct {
   365  	ref js.Ref
   366  }
   367  
   368  func (this GPURenderPipeline) Once() GPURenderPipeline {
   369  	this.ref.Once()
   370  	return this
   371  }
   372  
   373  func (this GPURenderPipeline) Ref() js.Ref {
   374  	return this.ref
   375  }
   376  
   377  func (this GPURenderPipeline) FromRef(ref js.Ref) GPURenderPipeline {
   378  	this.ref = ref
   379  	return this
   380  }
   381  
   382  func (this GPURenderPipeline) Free() {
   383  	this.ref.Free()
   384  }
   385  
   386  // Label returns the value of property "GPURenderPipeline.label".
   387  //
   388  // It returns ok=false if there is no such property.
   389  func (this GPURenderPipeline) Label() (ret js.String, ok bool) {
   390  	ok = js.True == bindings.GetGPURenderPipelineLabel(
   391  		this.ref, js.Pointer(&ret),
   392  	)
   393  	return
   394  }
   395  
   396  // SetLabel sets the value of property "GPURenderPipeline.label" to val.
   397  //
   398  // It returns false if the property cannot be set.
   399  func (this GPURenderPipeline) SetLabel(val js.String) bool {
   400  	return js.True == bindings.SetGPURenderPipelineLabel(
   401  		this.ref,
   402  		val.Ref(),
   403  	)
   404  }
   405  
   406  // HasFuncGetBindGroupLayout returns true if the method "GPURenderPipeline.getBindGroupLayout" exists.
   407  func (this GPURenderPipeline) HasFuncGetBindGroupLayout() bool {
   408  	return js.True == bindings.HasFuncGPURenderPipelineGetBindGroupLayout(
   409  		this.ref,
   410  	)
   411  }
   412  
   413  // FuncGetBindGroupLayout returns the method "GPURenderPipeline.getBindGroupLayout".
   414  func (this GPURenderPipeline) FuncGetBindGroupLayout() (fn js.Func[func(index uint32) GPUBindGroupLayout]) {
   415  	bindings.FuncGPURenderPipelineGetBindGroupLayout(
   416  		this.ref, js.Pointer(&fn),
   417  	)
   418  	return
   419  }
   420  
   421  // GetBindGroupLayout calls the method "GPURenderPipeline.getBindGroupLayout".
   422  func (this GPURenderPipeline) GetBindGroupLayout(index uint32) (ret GPUBindGroupLayout) {
   423  	bindings.CallGPURenderPipelineGetBindGroupLayout(
   424  		this.ref, js.Pointer(&ret),
   425  		uint32(index),
   426  	)
   427  
   428  	return
   429  }
   430  
   431  // TryGetBindGroupLayout calls the method "GPURenderPipeline.getBindGroupLayout"
   432  // in a try/catch block and returns (_, err, ok = false) when it went through
   433  // the catch clause.
   434  func (this GPURenderPipeline) TryGetBindGroupLayout(index uint32) (ret GPUBindGroupLayout, exception js.Any, ok bool) {
   435  	ok = js.True == bindings.TryGPURenderPipelineGetBindGroupLayout(
   436  		this.ref, js.Pointer(&ret), js.Pointer(&exception),
   437  		uint32(index),
   438  	)
   439  
   440  	return
   441  }
   442  
   443  type GPUVertexStepMode uint32
   444  
   445  const (
   446  	_ GPUVertexStepMode = iota
   447  
   448  	GPUVertexStepMode_VERTEX
   449  	GPUVertexStepMode_INSTANCE
   450  )
   451  
   452  func (GPUVertexStepMode) FromRef(str js.Ref) GPUVertexStepMode {
   453  	return GPUVertexStepMode(bindings.ConstOfGPUVertexStepMode(str))
   454  }
   455  
   456  func (x GPUVertexStepMode) String() (string, bool) {
   457  	switch x {
   458  	case GPUVertexStepMode_VERTEX:
   459  		return "vertex", true
   460  	case GPUVertexStepMode_INSTANCE:
   461  		return "instance", true
   462  	default:
   463  		return "", false
   464  	}
   465  }
   466  
   467  type GPUVertexFormat uint32
   468  
   469  const (
   470  	_ GPUVertexFormat = iota
   471  
   472  	GPUVertexFormat_UINT_8X2
   473  	GPUVertexFormat_UINT_8X4
   474  	GPUVertexFormat_SINT_8X2
   475  	GPUVertexFormat_SINT_8X4
   476  	GPUVertexFormat_UNORM_8X2
   477  	GPUVertexFormat_UNORM_8X4
   478  	GPUVertexFormat_SNORM_8X2
   479  	GPUVertexFormat_SNORM_8X4
   480  	GPUVertexFormat_UINT_16X2
   481  	GPUVertexFormat_UINT_16X4
   482  	GPUVertexFormat_SINT_16X2
   483  	GPUVertexFormat_SINT_16X4
   484  	GPUVertexFormat_UNORM_16X2
   485  	GPUVertexFormat_UNORM_16X4
   486  	GPUVertexFormat_SNORM_16X2
   487  	GPUVertexFormat_SNORM_16X4
   488  	GPUVertexFormat_FLOAT_16X2
   489  	GPUVertexFormat_FLOAT_16X4
   490  	GPUVertexFormat_FLOAT32
   491  	GPUVertexFormat_FLOAT_32X2
   492  	GPUVertexFormat_FLOAT_32X3
   493  	GPUVertexFormat_FLOAT_32X4
   494  	GPUVertexFormat_UINT32
   495  	GPUVertexFormat_UINT_32X2
   496  	GPUVertexFormat_UINT_32X3
   497  	GPUVertexFormat_UINT_32X4
   498  	GPUVertexFormat_SINT32
   499  	GPUVertexFormat_SINT_32X2
   500  	GPUVertexFormat_SINT_32X3
   501  	GPUVertexFormat_SINT_32X4
   502  )
   503  
   504  func (GPUVertexFormat) FromRef(str js.Ref) GPUVertexFormat {
   505  	return GPUVertexFormat(bindings.ConstOfGPUVertexFormat(str))
   506  }
   507  
   508  func (x GPUVertexFormat) String() (string, bool) {
   509  	switch x {
   510  	case GPUVertexFormat_UINT_8X2:
   511  		return "uint8x2", true
   512  	case GPUVertexFormat_UINT_8X4:
   513  		return "uint8x4", true
   514  	case GPUVertexFormat_SINT_8X2:
   515  		return "sint8x2", true
   516  	case GPUVertexFormat_SINT_8X4:
   517  		return "sint8x4", true
   518  	case GPUVertexFormat_UNORM_8X2:
   519  		return "unorm8x2", true
   520  	case GPUVertexFormat_UNORM_8X4:
   521  		return "unorm8x4", true
   522  	case GPUVertexFormat_SNORM_8X2:
   523  		return "snorm8x2", true
   524  	case GPUVertexFormat_SNORM_8X4:
   525  		return "snorm8x4", true
   526  	case GPUVertexFormat_UINT_16X2:
   527  		return "uint16x2", true
   528  	case GPUVertexFormat_UINT_16X4:
   529  		return "uint16x4", true
   530  	case GPUVertexFormat_SINT_16X2:
   531  		return "sint16x2", true
   532  	case GPUVertexFormat_SINT_16X4:
   533  		return "sint16x4", true
   534  	case GPUVertexFormat_UNORM_16X2:
   535  		return "unorm16x2", true
   536  	case GPUVertexFormat_UNORM_16X4:
   537  		return "unorm16x4", true
   538  	case GPUVertexFormat_SNORM_16X2:
   539  		return "snorm16x2", true
   540  	case GPUVertexFormat_SNORM_16X4:
   541  		return "snorm16x4", true
   542  	case GPUVertexFormat_FLOAT_16X2:
   543  		return "float16x2", true
   544  	case GPUVertexFormat_FLOAT_16X4:
   545  		return "float16x4", true
   546  	case GPUVertexFormat_FLOAT32:
   547  		return "float32", true
   548  	case GPUVertexFormat_FLOAT_32X2:
   549  		return "float32x2", true
   550  	case GPUVertexFormat_FLOAT_32X3:
   551  		return "float32x3", true
   552  	case GPUVertexFormat_FLOAT_32X4:
   553  		return "float32x4", true
   554  	case GPUVertexFormat_UINT32:
   555  		return "uint32", true
   556  	case GPUVertexFormat_UINT_32X2:
   557  		return "uint32x2", true
   558  	case GPUVertexFormat_UINT_32X3:
   559  		return "uint32x3", true
   560  	case GPUVertexFormat_UINT_32X4:
   561  		return "uint32x4", true
   562  	case GPUVertexFormat_SINT32:
   563  		return "sint32", true
   564  	case GPUVertexFormat_SINT_32X2:
   565  		return "sint32x2", true
   566  	case GPUVertexFormat_SINT_32X3:
   567  		return "sint32x3", true
   568  	case GPUVertexFormat_SINT_32X4:
   569  		return "sint32x4", true
   570  	default:
   571  		return "", false
   572  	}
   573  }
   574  
   575  type GPUVertexAttribute struct {
   576  	// Format is "GPUVertexAttribute.format"
   577  	//
   578  	// Required
   579  	Format GPUVertexFormat
   580  	// Offset is "GPUVertexAttribute.offset"
   581  	//
   582  	// Required
   583  	Offset GPUSize64
   584  	// ShaderLocation is "GPUVertexAttribute.shaderLocation"
   585  	//
   586  	// Required
   587  	ShaderLocation GPUIndex32
   588  
   589  	FFI_USE bool
   590  }
   591  
   592  // FromRef calls UpdateFrom and returns a GPUVertexAttribute with all fields set.
   593  func (p GPUVertexAttribute) FromRef(ref js.Ref) GPUVertexAttribute {
   594  	p.UpdateFrom(ref)
   595  	return p
   596  }
   597  
   598  // New creates a new GPUVertexAttribute in the application heap.
   599  func (p GPUVertexAttribute) New() js.Ref {
   600  	return bindings.GPUVertexAttributeJSLoad(
   601  		js.Pointer(&p), js.True, 0,
   602  	)
   603  }
   604  
   605  // UpdateFrom copies value of all fields of the heap object to p.
   606  func (p *GPUVertexAttribute) UpdateFrom(ref js.Ref) {
   607  	bindings.GPUVertexAttributeJSStore(
   608  		js.Pointer(p), ref,
   609  	)
   610  }
   611  
   612  // Update writes all fields of the p to the heap object referenced by ref.
   613  func (p *GPUVertexAttribute) Update(ref js.Ref) {
   614  	bindings.GPUVertexAttributeJSLoad(
   615  		js.Pointer(p), js.False, ref,
   616  	)
   617  }
   618  
   619  // FreeMembers frees fields with heap reference, if recursive is true
   620  // free all heap references reachable from p.
   621  func (p *GPUVertexAttribute) FreeMembers(recursive bool) {
   622  }
   623  
   624  type GPUVertexBufferLayout struct {
   625  	// ArrayStride is "GPUVertexBufferLayout.arrayStride"
   626  	//
   627  	// Required
   628  	ArrayStride GPUSize64
   629  	// StepMode is "GPUVertexBufferLayout.stepMode"
   630  	//
   631  	// Optional, defaults to "vertex".
   632  	StepMode GPUVertexStepMode
   633  	// Attributes is "GPUVertexBufferLayout.attributes"
   634  	//
   635  	// Required
   636  	Attributes js.Array[GPUVertexAttribute]
   637  
   638  	FFI_USE bool
   639  }
   640  
   641  // FromRef calls UpdateFrom and returns a GPUVertexBufferLayout with all fields set.
   642  func (p GPUVertexBufferLayout) FromRef(ref js.Ref) GPUVertexBufferLayout {
   643  	p.UpdateFrom(ref)
   644  	return p
   645  }
   646  
   647  // New creates a new GPUVertexBufferLayout in the application heap.
   648  func (p GPUVertexBufferLayout) New() js.Ref {
   649  	return bindings.GPUVertexBufferLayoutJSLoad(
   650  		js.Pointer(&p), js.True, 0,
   651  	)
   652  }
   653  
   654  // UpdateFrom copies value of all fields of the heap object to p.
   655  func (p *GPUVertexBufferLayout) UpdateFrom(ref js.Ref) {
   656  	bindings.GPUVertexBufferLayoutJSStore(
   657  		js.Pointer(p), ref,
   658  	)
   659  }
   660  
   661  // Update writes all fields of the p to the heap object referenced by ref.
   662  func (p *GPUVertexBufferLayout) Update(ref js.Ref) {
   663  	bindings.GPUVertexBufferLayoutJSLoad(
   664  		js.Pointer(p), js.False, ref,
   665  	)
   666  }
   667  
   668  // FreeMembers frees fields with heap reference, if recursive is true
   669  // free all heap references reachable from p.
   670  func (p *GPUVertexBufferLayout) FreeMembers(recursive bool) {
   671  	js.Free(
   672  		p.Attributes.Ref(),
   673  	)
   674  	p.Attributes = p.Attributes.FromRef(js.Undefined)
   675  }
   676  
   677  type GPUVertexState struct {
   678  	// Buffers is "GPUVertexState.buffers"
   679  	//
   680  	// Optional, defaults to [].
   681  	Buffers js.Array[GPUVertexBufferLayout]
   682  	// Module is "GPUVertexState.module"
   683  	//
   684  	// Required
   685  	Module GPUShaderModule
   686  	// EntryPoint is "GPUVertexState.entryPoint"
   687  	//
   688  	// Required
   689  	EntryPoint js.String
   690  	// Constants is "GPUVertexState.constants"
   691  	//
   692  	// Optional
   693  	Constants js.Record[GPUPipelineConstantValue]
   694  
   695  	FFI_USE bool
   696  }
   697  
   698  // FromRef calls UpdateFrom and returns a GPUVertexState with all fields set.
   699  func (p GPUVertexState) FromRef(ref js.Ref) GPUVertexState {
   700  	p.UpdateFrom(ref)
   701  	return p
   702  }
   703  
   704  // New creates a new GPUVertexState in the application heap.
   705  func (p GPUVertexState) New() js.Ref {
   706  	return bindings.GPUVertexStateJSLoad(
   707  		js.Pointer(&p), js.True, 0,
   708  	)
   709  }
   710  
   711  // UpdateFrom copies value of all fields of the heap object to p.
   712  func (p *GPUVertexState) UpdateFrom(ref js.Ref) {
   713  	bindings.GPUVertexStateJSStore(
   714  		js.Pointer(p), ref,
   715  	)
   716  }
   717  
   718  // Update writes all fields of the p to the heap object referenced by ref.
   719  func (p *GPUVertexState) Update(ref js.Ref) {
   720  	bindings.GPUVertexStateJSLoad(
   721  		js.Pointer(p), js.False, ref,
   722  	)
   723  }
   724  
   725  // FreeMembers frees fields with heap reference, if recursive is true
   726  // free all heap references reachable from p.
   727  func (p *GPUVertexState) FreeMembers(recursive bool) {
   728  	js.Free(
   729  		p.Buffers.Ref(),
   730  		p.Module.Ref(),
   731  		p.EntryPoint.Ref(),
   732  		p.Constants.Ref(),
   733  	)
   734  	p.Buffers = p.Buffers.FromRef(js.Undefined)
   735  	p.Module = p.Module.FromRef(js.Undefined)
   736  	p.EntryPoint = p.EntryPoint.FromRef(js.Undefined)
   737  	p.Constants = p.Constants.FromRef(js.Undefined)
   738  }
   739  
   740  type GPUPrimitiveTopology uint32
   741  
   742  const (
   743  	_ GPUPrimitiveTopology = iota
   744  
   745  	GPUPrimitiveTopology_POINT_LIST
   746  	GPUPrimitiveTopology_LINE_LIST
   747  	GPUPrimitiveTopology_LINE_STRIP
   748  	GPUPrimitiveTopology_TRIANGLE_LIST
   749  	GPUPrimitiveTopology_TRIANGLE_STRIP
   750  )
   751  
   752  func (GPUPrimitiveTopology) FromRef(str js.Ref) GPUPrimitiveTopology {
   753  	return GPUPrimitiveTopology(bindings.ConstOfGPUPrimitiveTopology(str))
   754  }
   755  
   756  func (x GPUPrimitiveTopology) String() (string, bool) {
   757  	switch x {
   758  	case GPUPrimitiveTopology_POINT_LIST:
   759  		return "point-list", true
   760  	case GPUPrimitiveTopology_LINE_LIST:
   761  		return "line-list", true
   762  	case GPUPrimitiveTopology_LINE_STRIP:
   763  		return "line-strip", true
   764  	case GPUPrimitiveTopology_TRIANGLE_LIST:
   765  		return "triangle-list", true
   766  	case GPUPrimitiveTopology_TRIANGLE_STRIP:
   767  		return "triangle-strip", true
   768  	default:
   769  		return "", false
   770  	}
   771  }
   772  
   773  type GPUIndexFormat uint32
   774  
   775  const (
   776  	_ GPUIndexFormat = iota
   777  
   778  	GPUIndexFormat_UINT16
   779  	GPUIndexFormat_UINT32
   780  )
   781  
   782  func (GPUIndexFormat) FromRef(str js.Ref) GPUIndexFormat {
   783  	return GPUIndexFormat(bindings.ConstOfGPUIndexFormat(str))
   784  }
   785  
   786  func (x GPUIndexFormat) String() (string, bool) {
   787  	switch x {
   788  	case GPUIndexFormat_UINT16:
   789  		return "uint16", true
   790  	case GPUIndexFormat_UINT32:
   791  		return "uint32", true
   792  	default:
   793  		return "", false
   794  	}
   795  }
   796  
   797  type GPUFrontFace uint32
   798  
   799  const (
   800  	_ GPUFrontFace = iota
   801  
   802  	GPUFrontFace_CCW
   803  	GPUFrontFace_CW
   804  )
   805  
   806  func (GPUFrontFace) FromRef(str js.Ref) GPUFrontFace {
   807  	return GPUFrontFace(bindings.ConstOfGPUFrontFace(str))
   808  }
   809  
   810  func (x GPUFrontFace) String() (string, bool) {
   811  	switch x {
   812  	case GPUFrontFace_CCW:
   813  		return "ccw", true
   814  	case GPUFrontFace_CW:
   815  		return "cw", true
   816  	default:
   817  		return "", false
   818  	}
   819  }
   820  
   821  type GPUCullMode uint32
   822  
   823  const (
   824  	_ GPUCullMode = iota
   825  
   826  	GPUCullMode_NONE
   827  	GPUCullMode_FRONT
   828  	GPUCullMode_BACK
   829  )
   830  
   831  func (GPUCullMode) FromRef(str js.Ref) GPUCullMode {
   832  	return GPUCullMode(bindings.ConstOfGPUCullMode(str))
   833  }
   834  
   835  func (x GPUCullMode) String() (string, bool) {
   836  	switch x {
   837  	case GPUCullMode_NONE:
   838  		return "none", true
   839  	case GPUCullMode_FRONT:
   840  		return "front", true
   841  	case GPUCullMode_BACK:
   842  		return "back", true
   843  	default:
   844  		return "", false
   845  	}
   846  }
   847  
   848  type GPUPrimitiveState struct {
   849  	// Topology is "GPUPrimitiveState.topology"
   850  	//
   851  	// Optional, defaults to "triangle-list".
   852  	Topology GPUPrimitiveTopology
   853  	// StripIndexFormat is "GPUPrimitiveState.stripIndexFormat"
   854  	//
   855  	// Optional
   856  	StripIndexFormat GPUIndexFormat
   857  	// FrontFace is "GPUPrimitiveState.frontFace"
   858  	//
   859  	// Optional, defaults to "ccw".
   860  	FrontFace GPUFrontFace
   861  	// CullMode is "GPUPrimitiveState.cullMode"
   862  	//
   863  	// Optional, defaults to "none".
   864  	CullMode GPUCullMode
   865  	// UnclippedDepth is "GPUPrimitiveState.unclippedDepth"
   866  	//
   867  	// Optional, defaults to false.
   868  	//
   869  	// NOTE: FFI_USE_UnclippedDepth MUST be set to true to make this field effective.
   870  	UnclippedDepth bool
   871  
   872  	FFI_USE_UnclippedDepth bool // for UnclippedDepth.
   873  
   874  	FFI_USE bool
   875  }
   876  
   877  // FromRef calls UpdateFrom and returns a GPUPrimitiveState with all fields set.
   878  func (p GPUPrimitiveState) FromRef(ref js.Ref) GPUPrimitiveState {
   879  	p.UpdateFrom(ref)
   880  	return p
   881  }
   882  
   883  // New creates a new GPUPrimitiveState in the application heap.
   884  func (p GPUPrimitiveState) New() js.Ref {
   885  	return bindings.GPUPrimitiveStateJSLoad(
   886  		js.Pointer(&p), js.True, 0,
   887  	)
   888  }
   889  
   890  // UpdateFrom copies value of all fields of the heap object to p.
   891  func (p *GPUPrimitiveState) UpdateFrom(ref js.Ref) {
   892  	bindings.GPUPrimitiveStateJSStore(
   893  		js.Pointer(p), ref,
   894  	)
   895  }
   896  
   897  // Update writes all fields of the p to the heap object referenced by ref.
   898  func (p *GPUPrimitiveState) Update(ref js.Ref) {
   899  	bindings.GPUPrimitiveStateJSLoad(
   900  		js.Pointer(p), js.False, ref,
   901  	)
   902  }
   903  
   904  // FreeMembers frees fields with heap reference, if recursive is true
   905  // free all heap references reachable from p.
   906  func (p *GPUPrimitiveState) FreeMembers(recursive bool) {
   907  }
   908  
   909  type GPUStencilOperation uint32
   910  
   911  const (
   912  	_ GPUStencilOperation = iota
   913  
   914  	GPUStencilOperation_KEEP
   915  	GPUStencilOperation_ZERO
   916  	GPUStencilOperation_REPLACE
   917  	GPUStencilOperation_INVERT
   918  	GPUStencilOperation_INCREMENT_CLAMP
   919  	GPUStencilOperation_DECREMENT_CLAMP
   920  	GPUStencilOperation_INCREMENT_WRAP
   921  	GPUStencilOperation_DECREMENT_WRAP
   922  )
   923  
   924  func (GPUStencilOperation) FromRef(str js.Ref) GPUStencilOperation {
   925  	return GPUStencilOperation(bindings.ConstOfGPUStencilOperation(str))
   926  }
   927  
   928  func (x GPUStencilOperation) String() (string, bool) {
   929  	switch x {
   930  	case GPUStencilOperation_KEEP:
   931  		return "keep", true
   932  	case GPUStencilOperation_ZERO:
   933  		return "zero", true
   934  	case GPUStencilOperation_REPLACE:
   935  		return "replace", true
   936  	case GPUStencilOperation_INVERT:
   937  		return "invert", true
   938  	case GPUStencilOperation_INCREMENT_CLAMP:
   939  		return "increment-clamp", true
   940  	case GPUStencilOperation_DECREMENT_CLAMP:
   941  		return "decrement-clamp", true
   942  	case GPUStencilOperation_INCREMENT_WRAP:
   943  		return "increment-wrap", true
   944  	case GPUStencilOperation_DECREMENT_WRAP:
   945  		return "decrement-wrap", true
   946  	default:
   947  		return "", false
   948  	}
   949  }
   950  
   951  type GPUStencilFaceState struct {
   952  	// Compare is "GPUStencilFaceState.compare"
   953  	//
   954  	// Optional, defaults to "always".
   955  	Compare GPUCompareFunction
   956  	// FailOp is "GPUStencilFaceState.failOp"
   957  	//
   958  	// Optional, defaults to "keep".
   959  	FailOp GPUStencilOperation
   960  	// DepthFailOp is "GPUStencilFaceState.depthFailOp"
   961  	//
   962  	// Optional, defaults to "keep".
   963  	DepthFailOp GPUStencilOperation
   964  	// PassOp is "GPUStencilFaceState.passOp"
   965  	//
   966  	// Optional, defaults to "keep".
   967  	PassOp GPUStencilOperation
   968  
   969  	FFI_USE bool
   970  }
   971  
   972  // FromRef calls UpdateFrom and returns a GPUStencilFaceState with all fields set.
   973  func (p GPUStencilFaceState) FromRef(ref js.Ref) GPUStencilFaceState {
   974  	p.UpdateFrom(ref)
   975  	return p
   976  }
   977  
   978  // New creates a new GPUStencilFaceState in the application heap.
   979  func (p GPUStencilFaceState) New() js.Ref {
   980  	return bindings.GPUStencilFaceStateJSLoad(
   981  		js.Pointer(&p), js.True, 0,
   982  	)
   983  }
   984  
   985  // UpdateFrom copies value of all fields of the heap object to p.
   986  func (p *GPUStencilFaceState) UpdateFrom(ref js.Ref) {
   987  	bindings.GPUStencilFaceStateJSStore(
   988  		js.Pointer(p), ref,
   989  	)
   990  }
   991  
   992  // Update writes all fields of the p to the heap object referenced by ref.
   993  func (p *GPUStencilFaceState) Update(ref js.Ref) {
   994  	bindings.GPUStencilFaceStateJSLoad(
   995  		js.Pointer(p), js.False, ref,
   996  	)
   997  }
   998  
   999  // FreeMembers frees fields with heap reference, if recursive is true
  1000  // free all heap references reachable from p.
  1001  func (p *GPUStencilFaceState) FreeMembers(recursive bool) {
  1002  }
  1003  
  1004  type GPUStencilValue uint32
  1005  
  1006  type GPUDepthBias int32
  1007  
  1008  type GPUDepthStencilState struct {
  1009  	// Format is "GPUDepthStencilState.format"
  1010  	//
  1011  	// Required
  1012  	Format GPUTextureFormat
  1013  	// DepthWriteEnabled is "GPUDepthStencilState.depthWriteEnabled"
  1014  	//
  1015  	// Required
  1016  	DepthWriteEnabled bool
  1017  	// DepthCompare is "GPUDepthStencilState.depthCompare"
  1018  	//
  1019  	// Required
  1020  	DepthCompare GPUCompareFunction
  1021  	// StencilFront is "GPUDepthStencilState.stencilFront"
  1022  	//
  1023  	// Optional, defaults to {}.
  1024  	//
  1025  	// NOTE: StencilFront.FFI_USE MUST be set to true to get StencilFront used.
  1026  	StencilFront GPUStencilFaceState
  1027  	// StencilBack is "GPUDepthStencilState.stencilBack"
  1028  	//
  1029  	// Optional, defaults to {}.
  1030  	//
  1031  	// NOTE: StencilBack.FFI_USE MUST be set to true to get StencilBack used.
  1032  	StencilBack GPUStencilFaceState
  1033  	// StencilReadMask is "GPUDepthStencilState.stencilReadMask"
  1034  	//
  1035  	// Optional, defaults to 0xFFFFFFFF.
  1036  	//
  1037  	// NOTE: FFI_USE_StencilReadMask MUST be set to true to make this field effective.
  1038  	StencilReadMask GPUStencilValue
  1039  	// StencilWriteMask is "GPUDepthStencilState.stencilWriteMask"
  1040  	//
  1041  	// Optional, defaults to 0xFFFFFFFF.
  1042  	//
  1043  	// NOTE: FFI_USE_StencilWriteMask MUST be set to true to make this field effective.
  1044  	StencilWriteMask GPUStencilValue
  1045  	// DepthBias is "GPUDepthStencilState.depthBias"
  1046  	//
  1047  	// Optional, defaults to 0.
  1048  	//
  1049  	// NOTE: FFI_USE_DepthBias MUST be set to true to make this field effective.
  1050  	DepthBias GPUDepthBias
  1051  	// DepthBiasSlopeScale is "GPUDepthStencilState.depthBiasSlopeScale"
  1052  	//
  1053  	// Optional, defaults to 0.
  1054  	//
  1055  	// NOTE: FFI_USE_DepthBiasSlopeScale MUST be set to true to make this field effective.
  1056  	DepthBiasSlopeScale float32
  1057  	// DepthBiasClamp is "GPUDepthStencilState.depthBiasClamp"
  1058  	//
  1059  	// Optional, defaults to 0.
  1060  	//
  1061  	// NOTE: FFI_USE_DepthBiasClamp MUST be set to true to make this field effective.
  1062  	DepthBiasClamp float32
  1063  
  1064  	FFI_USE_StencilReadMask     bool // for StencilReadMask.
  1065  	FFI_USE_StencilWriteMask    bool // for StencilWriteMask.
  1066  	FFI_USE_DepthBias           bool // for DepthBias.
  1067  	FFI_USE_DepthBiasSlopeScale bool // for DepthBiasSlopeScale.
  1068  	FFI_USE_DepthBiasClamp      bool // for DepthBiasClamp.
  1069  
  1070  	FFI_USE bool
  1071  }
  1072  
  1073  // FromRef calls UpdateFrom and returns a GPUDepthStencilState with all fields set.
  1074  func (p GPUDepthStencilState) FromRef(ref js.Ref) GPUDepthStencilState {
  1075  	p.UpdateFrom(ref)
  1076  	return p
  1077  }
  1078  
  1079  // New creates a new GPUDepthStencilState in the application heap.
  1080  func (p GPUDepthStencilState) New() js.Ref {
  1081  	return bindings.GPUDepthStencilStateJSLoad(
  1082  		js.Pointer(&p), js.True, 0,
  1083  	)
  1084  }
  1085  
  1086  // UpdateFrom copies value of all fields of the heap object to p.
  1087  func (p *GPUDepthStencilState) UpdateFrom(ref js.Ref) {
  1088  	bindings.GPUDepthStencilStateJSStore(
  1089  		js.Pointer(p), ref,
  1090  	)
  1091  }
  1092  
  1093  // Update writes all fields of the p to the heap object referenced by ref.
  1094  func (p *GPUDepthStencilState) Update(ref js.Ref) {
  1095  	bindings.GPUDepthStencilStateJSLoad(
  1096  		js.Pointer(p), js.False, ref,
  1097  	)
  1098  }
  1099  
  1100  // FreeMembers frees fields with heap reference, if recursive is true
  1101  // free all heap references reachable from p.
  1102  func (p *GPUDepthStencilState) FreeMembers(recursive bool) {
  1103  	if recursive {
  1104  		p.StencilFront.FreeMembers(true)
  1105  		p.StencilBack.FreeMembers(true)
  1106  	}
  1107  }
  1108  
  1109  type GPUSampleMask uint32
  1110  
  1111  type GPUMultisampleState struct {
  1112  	// Count is "GPUMultisampleState.count"
  1113  	//
  1114  	// Optional, defaults to 1.
  1115  	//
  1116  	// NOTE: FFI_USE_Count MUST be set to true to make this field effective.
  1117  	Count GPUSize32
  1118  	// Mask is "GPUMultisampleState.mask"
  1119  	//
  1120  	// Optional, defaults to 0xFFFFFFFF.
  1121  	//
  1122  	// NOTE: FFI_USE_Mask MUST be set to true to make this field effective.
  1123  	Mask GPUSampleMask
  1124  	// AlphaToCoverageEnabled is "GPUMultisampleState.alphaToCoverageEnabled"
  1125  	//
  1126  	// Optional, defaults to false.
  1127  	//
  1128  	// NOTE: FFI_USE_AlphaToCoverageEnabled MUST be set to true to make this field effective.
  1129  	AlphaToCoverageEnabled bool
  1130  
  1131  	FFI_USE_Count                  bool // for Count.
  1132  	FFI_USE_Mask                   bool // for Mask.
  1133  	FFI_USE_AlphaToCoverageEnabled bool // for AlphaToCoverageEnabled.
  1134  
  1135  	FFI_USE bool
  1136  }
  1137  
  1138  // FromRef calls UpdateFrom and returns a GPUMultisampleState with all fields set.
  1139  func (p GPUMultisampleState) FromRef(ref js.Ref) GPUMultisampleState {
  1140  	p.UpdateFrom(ref)
  1141  	return p
  1142  }
  1143  
  1144  // New creates a new GPUMultisampleState in the application heap.
  1145  func (p GPUMultisampleState) New() js.Ref {
  1146  	return bindings.GPUMultisampleStateJSLoad(
  1147  		js.Pointer(&p), js.True, 0,
  1148  	)
  1149  }
  1150  
  1151  // UpdateFrom copies value of all fields of the heap object to p.
  1152  func (p *GPUMultisampleState) UpdateFrom(ref js.Ref) {
  1153  	bindings.GPUMultisampleStateJSStore(
  1154  		js.Pointer(p), ref,
  1155  	)
  1156  }
  1157  
  1158  // Update writes all fields of the p to the heap object referenced by ref.
  1159  func (p *GPUMultisampleState) Update(ref js.Ref) {
  1160  	bindings.GPUMultisampleStateJSLoad(
  1161  		js.Pointer(p), js.False, ref,
  1162  	)
  1163  }
  1164  
  1165  // FreeMembers frees fields with heap reference, if recursive is true
  1166  // free all heap references reachable from p.
  1167  func (p *GPUMultisampleState) FreeMembers(recursive bool) {
  1168  }
  1169  
  1170  type GPUBlendOperation uint32
  1171  
  1172  const (
  1173  	_ GPUBlendOperation = iota
  1174  
  1175  	GPUBlendOperation_ADD
  1176  	GPUBlendOperation_SUBTRACT
  1177  	GPUBlendOperation_REVERSE_SUBTRACT
  1178  	GPUBlendOperation_MIN
  1179  	GPUBlendOperation_MAX
  1180  )
  1181  
  1182  func (GPUBlendOperation) FromRef(str js.Ref) GPUBlendOperation {
  1183  	return GPUBlendOperation(bindings.ConstOfGPUBlendOperation(str))
  1184  }
  1185  
  1186  func (x GPUBlendOperation) String() (string, bool) {
  1187  	switch x {
  1188  	case GPUBlendOperation_ADD:
  1189  		return "add", true
  1190  	case GPUBlendOperation_SUBTRACT:
  1191  		return "subtract", true
  1192  	case GPUBlendOperation_REVERSE_SUBTRACT:
  1193  		return "reverse-subtract", true
  1194  	case GPUBlendOperation_MIN:
  1195  		return "min", true
  1196  	case GPUBlendOperation_MAX:
  1197  		return "max", true
  1198  	default:
  1199  		return "", false
  1200  	}
  1201  }
  1202  
  1203  type GPUBlendFactor uint32
  1204  
  1205  const (
  1206  	_ GPUBlendFactor = iota
  1207  
  1208  	GPUBlendFactor_ZERO
  1209  	GPUBlendFactor_ONE
  1210  	GPUBlendFactor_SRC
  1211  	GPUBlendFactor_ONE_MINUS_SRC
  1212  	GPUBlendFactor_SRC_ALPHA
  1213  	GPUBlendFactor_ONE_MINUS_SRC_ALPHA
  1214  	GPUBlendFactor_DST
  1215  	GPUBlendFactor_ONE_MINUS_DST
  1216  	GPUBlendFactor_DST_ALPHA
  1217  	GPUBlendFactor_ONE_MINUS_DST_ALPHA
  1218  	GPUBlendFactor_SRC_ALPHA_SATURATED
  1219  	GPUBlendFactor_CONSTANT
  1220  	GPUBlendFactor_ONE_MINUS_CONSTANT
  1221  )
  1222  
  1223  func (GPUBlendFactor) FromRef(str js.Ref) GPUBlendFactor {
  1224  	return GPUBlendFactor(bindings.ConstOfGPUBlendFactor(str))
  1225  }
  1226  
  1227  func (x GPUBlendFactor) String() (string, bool) {
  1228  	switch x {
  1229  	case GPUBlendFactor_ZERO:
  1230  		return "zero", true
  1231  	case GPUBlendFactor_ONE:
  1232  		return "one", true
  1233  	case GPUBlendFactor_SRC:
  1234  		return "src", true
  1235  	case GPUBlendFactor_ONE_MINUS_SRC:
  1236  		return "one-minus-src", true
  1237  	case GPUBlendFactor_SRC_ALPHA:
  1238  		return "src-alpha", true
  1239  	case GPUBlendFactor_ONE_MINUS_SRC_ALPHA:
  1240  		return "one-minus-src-alpha", true
  1241  	case GPUBlendFactor_DST:
  1242  		return "dst", true
  1243  	case GPUBlendFactor_ONE_MINUS_DST:
  1244  		return "one-minus-dst", true
  1245  	case GPUBlendFactor_DST_ALPHA:
  1246  		return "dst-alpha", true
  1247  	case GPUBlendFactor_ONE_MINUS_DST_ALPHA:
  1248  		return "one-minus-dst-alpha", true
  1249  	case GPUBlendFactor_SRC_ALPHA_SATURATED:
  1250  		return "src-alpha-saturated", true
  1251  	case GPUBlendFactor_CONSTANT:
  1252  		return "constant", true
  1253  	case GPUBlendFactor_ONE_MINUS_CONSTANT:
  1254  		return "one-minus-constant", true
  1255  	default:
  1256  		return "", false
  1257  	}
  1258  }
  1259  
  1260  type GPUBlendComponent struct {
  1261  	// Operation is "GPUBlendComponent.operation"
  1262  	//
  1263  	// Optional, defaults to "add".
  1264  	Operation GPUBlendOperation
  1265  	// SrcFactor is "GPUBlendComponent.srcFactor"
  1266  	//
  1267  	// Optional, defaults to "one".
  1268  	SrcFactor GPUBlendFactor
  1269  	// DstFactor is "GPUBlendComponent.dstFactor"
  1270  	//
  1271  	// Optional, defaults to "zero".
  1272  	DstFactor GPUBlendFactor
  1273  
  1274  	FFI_USE bool
  1275  }
  1276  
  1277  // FromRef calls UpdateFrom and returns a GPUBlendComponent with all fields set.
  1278  func (p GPUBlendComponent) FromRef(ref js.Ref) GPUBlendComponent {
  1279  	p.UpdateFrom(ref)
  1280  	return p
  1281  }
  1282  
  1283  // New creates a new GPUBlendComponent in the application heap.
  1284  func (p GPUBlendComponent) New() js.Ref {
  1285  	return bindings.GPUBlendComponentJSLoad(
  1286  		js.Pointer(&p), js.True, 0,
  1287  	)
  1288  }
  1289  
  1290  // UpdateFrom copies value of all fields of the heap object to p.
  1291  func (p *GPUBlendComponent) UpdateFrom(ref js.Ref) {
  1292  	bindings.GPUBlendComponentJSStore(
  1293  		js.Pointer(p), ref,
  1294  	)
  1295  }
  1296  
  1297  // Update writes all fields of the p to the heap object referenced by ref.
  1298  func (p *GPUBlendComponent) Update(ref js.Ref) {
  1299  	bindings.GPUBlendComponentJSLoad(
  1300  		js.Pointer(p), js.False, ref,
  1301  	)
  1302  }
  1303  
  1304  // FreeMembers frees fields with heap reference, if recursive is true
  1305  // free all heap references reachable from p.
  1306  func (p *GPUBlendComponent) FreeMembers(recursive bool) {
  1307  }
  1308  
  1309  type GPUBlendState struct {
  1310  	// Color is "GPUBlendState.color"
  1311  	//
  1312  	// Required
  1313  	//
  1314  	// NOTE: Color.FFI_USE MUST be set to true to get Color used.
  1315  	Color GPUBlendComponent
  1316  	// Alpha is "GPUBlendState.alpha"
  1317  	//
  1318  	// Required
  1319  	//
  1320  	// NOTE: Alpha.FFI_USE MUST be set to true to get Alpha used.
  1321  	Alpha GPUBlendComponent
  1322  
  1323  	FFI_USE bool
  1324  }
  1325  
  1326  // FromRef calls UpdateFrom and returns a GPUBlendState with all fields set.
  1327  func (p GPUBlendState) FromRef(ref js.Ref) GPUBlendState {
  1328  	p.UpdateFrom(ref)
  1329  	return p
  1330  }
  1331  
  1332  // New creates a new GPUBlendState in the application heap.
  1333  func (p GPUBlendState) New() js.Ref {
  1334  	return bindings.GPUBlendStateJSLoad(
  1335  		js.Pointer(&p), js.True, 0,
  1336  	)
  1337  }
  1338  
  1339  // UpdateFrom copies value of all fields of the heap object to p.
  1340  func (p *GPUBlendState) UpdateFrom(ref js.Ref) {
  1341  	bindings.GPUBlendStateJSStore(
  1342  		js.Pointer(p), ref,
  1343  	)
  1344  }
  1345  
  1346  // Update writes all fields of the p to the heap object referenced by ref.
  1347  func (p *GPUBlendState) Update(ref js.Ref) {
  1348  	bindings.GPUBlendStateJSLoad(
  1349  		js.Pointer(p), js.False, ref,
  1350  	)
  1351  }
  1352  
  1353  // FreeMembers frees fields with heap reference, if recursive is true
  1354  // free all heap references reachable from p.
  1355  func (p *GPUBlendState) FreeMembers(recursive bool) {
  1356  	if recursive {
  1357  		p.Color.FreeMembers(true)
  1358  		p.Alpha.FreeMembers(true)
  1359  	}
  1360  }
  1361  
  1362  type GPUColorWriteFlags uint32
  1363  
  1364  type GPUColorTargetState struct {
  1365  	// Format is "GPUColorTargetState.format"
  1366  	//
  1367  	// Required
  1368  	Format GPUTextureFormat
  1369  	// Blend is "GPUColorTargetState.blend"
  1370  	//
  1371  	// Optional
  1372  	//
  1373  	// NOTE: Blend.FFI_USE MUST be set to true to get Blend used.
  1374  	Blend GPUBlendState
  1375  	// WriteMask is "GPUColorTargetState.writeMask"
  1376  	//
  1377  	// Optional, defaults to 0xF.
  1378  	//
  1379  	// NOTE: FFI_USE_WriteMask MUST be set to true to make this field effective.
  1380  	WriteMask GPUColorWriteFlags
  1381  
  1382  	FFI_USE_WriteMask bool // for WriteMask.
  1383  
  1384  	FFI_USE bool
  1385  }
  1386  
  1387  // FromRef calls UpdateFrom and returns a GPUColorTargetState with all fields set.
  1388  func (p GPUColorTargetState) FromRef(ref js.Ref) GPUColorTargetState {
  1389  	p.UpdateFrom(ref)
  1390  	return p
  1391  }
  1392  
  1393  // New creates a new GPUColorTargetState in the application heap.
  1394  func (p GPUColorTargetState) New() js.Ref {
  1395  	return bindings.GPUColorTargetStateJSLoad(
  1396  		js.Pointer(&p), js.True, 0,
  1397  	)
  1398  }
  1399  
  1400  // UpdateFrom copies value of all fields of the heap object to p.
  1401  func (p *GPUColorTargetState) UpdateFrom(ref js.Ref) {
  1402  	bindings.GPUColorTargetStateJSStore(
  1403  		js.Pointer(p), ref,
  1404  	)
  1405  }
  1406  
  1407  // Update writes all fields of the p to the heap object referenced by ref.
  1408  func (p *GPUColorTargetState) Update(ref js.Ref) {
  1409  	bindings.GPUColorTargetStateJSLoad(
  1410  		js.Pointer(p), js.False, ref,
  1411  	)
  1412  }
  1413  
  1414  // FreeMembers frees fields with heap reference, if recursive is true
  1415  // free all heap references reachable from p.
  1416  func (p *GPUColorTargetState) FreeMembers(recursive bool) {
  1417  	if recursive {
  1418  		p.Blend.FreeMembers(true)
  1419  	}
  1420  }
  1421  
  1422  type GPUFragmentState struct {
  1423  	// Targets is "GPUFragmentState.targets"
  1424  	//
  1425  	// Required
  1426  	Targets js.Array[GPUColorTargetState]
  1427  	// Module is "GPUFragmentState.module"
  1428  	//
  1429  	// Required
  1430  	Module GPUShaderModule
  1431  	// EntryPoint is "GPUFragmentState.entryPoint"
  1432  	//
  1433  	// Required
  1434  	EntryPoint js.String
  1435  	// Constants is "GPUFragmentState.constants"
  1436  	//
  1437  	// Optional
  1438  	Constants js.Record[GPUPipelineConstantValue]
  1439  
  1440  	FFI_USE bool
  1441  }
  1442  
  1443  // FromRef calls UpdateFrom and returns a GPUFragmentState with all fields set.
  1444  func (p GPUFragmentState) FromRef(ref js.Ref) GPUFragmentState {
  1445  	p.UpdateFrom(ref)
  1446  	return p
  1447  }
  1448  
  1449  // New creates a new GPUFragmentState in the application heap.
  1450  func (p GPUFragmentState) New() js.Ref {
  1451  	return bindings.GPUFragmentStateJSLoad(
  1452  		js.Pointer(&p), js.True, 0,
  1453  	)
  1454  }
  1455  
  1456  // UpdateFrom copies value of all fields of the heap object to p.
  1457  func (p *GPUFragmentState) UpdateFrom(ref js.Ref) {
  1458  	bindings.GPUFragmentStateJSStore(
  1459  		js.Pointer(p), ref,
  1460  	)
  1461  }
  1462  
  1463  // Update writes all fields of the p to the heap object referenced by ref.
  1464  func (p *GPUFragmentState) Update(ref js.Ref) {
  1465  	bindings.GPUFragmentStateJSLoad(
  1466  		js.Pointer(p), js.False, ref,
  1467  	)
  1468  }
  1469  
  1470  // FreeMembers frees fields with heap reference, if recursive is true
  1471  // free all heap references reachable from p.
  1472  func (p *GPUFragmentState) FreeMembers(recursive bool) {
  1473  	js.Free(
  1474  		p.Targets.Ref(),
  1475  		p.Module.Ref(),
  1476  		p.EntryPoint.Ref(),
  1477  		p.Constants.Ref(),
  1478  	)
  1479  	p.Targets = p.Targets.FromRef(js.Undefined)
  1480  	p.Module = p.Module.FromRef(js.Undefined)
  1481  	p.EntryPoint = p.EntryPoint.FromRef(js.Undefined)
  1482  	p.Constants = p.Constants.FromRef(js.Undefined)
  1483  }
  1484  
  1485  type GPURenderPipelineDescriptor struct {
  1486  	// Vertex is "GPURenderPipelineDescriptor.vertex"
  1487  	//
  1488  	// Required
  1489  	//
  1490  	// NOTE: Vertex.FFI_USE MUST be set to true to get Vertex used.
  1491  	Vertex GPUVertexState
  1492  	// Primitive is "GPURenderPipelineDescriptor.primitive"
  1493  	//
  1494  	// Optional, defaults to {}.
  1495  	//
  1496  	// NOTE: Primitive.FFI_USE MUST be set to true to get Primitive used.
  1497  	Primitive GPUPrimitiveState
  1498  	// DepthStencil is "GPURenderPipelineDescriptor.depthStencil"
  1499  	//
  1500  	// Optional
  1501  	//
  1502  	// NOTE: DepthStencil.FFI_USE MUST be set to true to get DepthStencil used.
  1503  	DepthStencil GPUDepthStencilState
  1504  	// Multisample is "GPURenderPipelineDescriptor.multisample"
  1505  	//
  1506  	// Optional, defaults to {}.
  1507  	//
  1508  	// NOTE: Multisample.FFI_USE MUST be set to true to get Multisample used.
  1509  	Multisample GPUMultisampleState
  1510  	// Fragment is "GPURenderPipelineDescriptor.fragment"
  1511  	//
  1512  	// Optional
  1513  	//
  1514  	// NOTE: Fragment.FFI_USE MUST be set to true to get Fragment used.
  1515  	Fragment GPUFragmentState
  1516  	// Layout is "GPURenderPipelineDescriptor.layout"
  1517  	//
  1518  	// Required
  1519  	Layout OneOf_GPUPipelineLayout_GPUAutoLayoutMode
  1520  	// Label is "GPURenderPipelineDescriptor.label"
  1521  	//
  1522  	// Optional, defaults to "".
  1523  	Label js.String
  1524  
  1525  	FFI_USE bool
  1526  }
  1527  
  1528  // FromRef calls UpdateFrom and returns a GPURenderPipelineDescriptor with all fields set.
  1529  func (p GPURenderPipelineDescriptor) FromRef(ref js.Ref) GPURenderPipelineDescriptor {
  1530  	p.UpdateFrom(ref)
  1531  	return p
  1532  }
  1533  
  1534  // New creates a new GPURenderPipelineDescriptor in the application heap.
  1535  func (p GPURenderPipelineDescriptor) New() js.Ref {
  1536  	return bindings.GPURenderPipelineDescriptorJSLoad(
  1537  		js.Pointer(&p), js.True, 0,
  1538  	)
  1539  }
  1540  
  1541  // UpdateFrom copies value of all fields of the heap object to p.
  1542  func (p *GPURenderPipelineDescriptor) UpdateFrom(ref js.Ref) {
  1543  	bindings.GPURenderPipelineDescriptorJSStore(
  1544  		js.Pointer(p), ref,
  1545  	)
  1546  }
  1547  
  1548  // Update writes all fields of the p to the heap object referenced by ref.
  1549  func (p *GPURenderPipelineDescriptor) Update(ref js.Ref) {
  1550  	bindings.GPURenderPipelineDescriptorJSLoad(
  1551  		js.Pointer(p), js.False, ref,
  1552  	)
  1553  }
  1554  
  1555  // FreeMembers frees fields with heap reference, if recursive is true
  1556  // free all heap references reachable from p.
  1557  func (p *GPURenderPipelineDescriptor) FreeMembers(recursive bool) {
  1558  	js.Free(
  1559  		p.Layout.Ref(),
  1560  		p.Label.Ref(),
  1561  	)
  1562  	p.Layout = p.Layout.FromRef(js.Undefined)
  1563  	p.Label = p.Label.FromRef(js.Undefined)
  1564  	if recursive {
  1565  		p.Vertex.FreeMembers(true)
  1566  		p.Primitive.FreeMembers(true)
  1567  		p.DepthStencil.FreeMembers(true)
  1568  		p.Multisample.FreeMembers(true)
  1569  		p.Fragment.FreeMembers(true)
  1570  	}
  1571  }
  1572  
  1573  type GPUColorDict struct {
  1574  	// R is "GPUColorDict.r"
  1575  	//
  1576  	// Required
  1577  	R float64
  1578  	// G is "GPUColorDict.g"
  1579  	//
  1580  	// Required
  1581  	G float64
  1582  	// B is "GPUColorDict.b"
  1583  	//
  1584  	// Required
  1585  	B float64
  1586  	// A is "GPUColorDict.a"
  1587  	//
  1588  	// Required
  1589  	A float64
  1590  
  1591  	FFI_USE bool
  1592  }
  1593  
  1594  // FromRef calls UpdateFrom and returns a GPUColorDict with all fields set.
  1595  func (p GPUColorDict) FromRef(ref js.Ref) GPUColorDict {
  1596  	p.UpdateFrom(ref)
  1597  	return p
  1598  }
  1599  
  1600  // New creates a new GPUColorDict in the application heap.
  1601  func (p GPUColorDict) New() js.Ref {
  1602  	return bindings.GPUColorDictJSLoad(
  1603  		js.Pointer(&p), js.True, 0,
  1604  	)
  1605  }
  1606  
  1607  // UpdateFrom copies value of all fields of the heap object to p.
  1608  func (p *GPUColorDict) UpdateFrom(ref js.Ref) {
  1609  	bindings.GPUColorDictJSStore(
  1610  		js.Pointer(p), ref,
  1611  	)
  1612  }
  1613  
  1614  // Update writes all fields of the p to the heap object referenced by ref.
  1615  func (p *GPUColorDict) Update(ref js.Ref) {
  1616  	bindings.GPUColorDictJSLoad(
  1617  		js.Pointer(p), js.False, ref,
  1618  	)
  1619  }
  1620  
  1621  // FreeMembers frees fields with heap reference, if recursive is true
  1622  // free all heap references reachable from p.
  1623  func (p *GPUColorDict) FreeMembers(recursive bool) {
  1624  }
  1625  
  1626  type OneOf_ArrayFloat64_GPUColorDict struct {
  1627  	ref js.Ref
  1628  }
  1629  
  1630  func (x OneOf_ArrayFloat64_GPUColorDict) Ref() js.Ref {
  1631  	return x.ref
  1632  }
  1633  
  1634  func (x OneOf_ArrayFloat64_GPUColorDict) Free() {
  1635  	x.ref.Free()
  1636  }
  1637  
  1638  func (x OneOf_ArrayFloat64_GPUColorDict) FromRef(ref js.Ref) OneOf_ArrayFloat64_GPUColorDict {
  1639  	return OneOf_ArrayFloat64_GPUColorDict{
  1640  		ref: ref,
  1641  	}
  1642  }
  1643  
  1644  func (x OneOf_ArrayFloat64_GPUColorDict) ArrayFloat64() js.Array[float64] {
  1645  	return js.Array[float64]{}.FromRef(x.ref)
  1646  }
  1647  
  1648  func (x OneOf_ArrayFloat64_GPUColorDict) GPUColorDict() GPUColorDict {
  1649  	var ret GPUColorDict
  1650  	ret.UpdateFrom(x.ref)
  1651  	return ret
  1652  }
  1653  
  1654  type GPUColor = OneOf_ArrayFloat64_GPUColorDict
  1655  
  1656  type GPURenderBundle struct {
  1657  	ref js.Ref
  1658  }
  1659  
  1660  func (this GPURenderBundle) Once() GPURenderBundle {
  1661  	this.ref.Once()
  1662  	return this
  1663  }
  1664  
  1665  func (this GPURenderBundle) Ref() js.Ref {
  1666  	return this.ref
  1667  }
  1668  
  1669  func (this GPURenderBundle) FromRef(ref js.Ref) GPURenderBundle {
  1670  	this.ref = ref
  1671  	return this
  1672  }
  1673  
  1674  func (this GPURenderBundle) Free() {
  1675  	this.ref.Free()
  1676  }
  1677  
  1678  // Label returns the value of property "GPURenderBundle.label".
  1679  //
  1680  // It returns ok=false if there is no such property.
  1681  func (this GPURenderBundle) Label() (ret js.String, ok bool) {
  1682  	ok = js.True == bindings.GetGPURenderBundleLabel(
  1683  		this.ref, js.Pointer(&ret),
  1684  	)
  1685  	return
  1686  }
  1687  
  1688  // SetLabel sets the value of property "GPURenderBundle.label" to val.
  1689  //
  1690  // It returns false if the property cannot be set.
  1691  func (this GPURenderBundle) SetLabel(val js.String) bool {
  1692  	return js.True == bindings.SetGPURenderBundleLabel(
  1693  		this.ref,
  1694  		val.Ref(),
  1695  	)
  1696  }
  1697  
  1698  type GPUSignedOffset32 int32
  1699  
  1700  type GPUBufferDynamicOffset uint32