github.com/primecitizens/pcz/std@v0.2.1/plat/js/web/apis15_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 GPUExtent3DDict struct { 12 // Width is "GPUExtent3DDict.width" 13 // 14 // Required 15 Width GPUIntegerCoordinate 16 // Height is "GPUExtent3DDict.height" 17 // 18 // Optional, defaults to 1. 19 // 20 // NOTE: FFI_USE_Height MUST be set to true to make this field effective. 21 Height GPUIntegerCoordinate 22 // DepthOrArrayLayers is "GPUExtent3DDict.depthOrArrayLayers" 23 // 24 // Optional, defaults to 1. 25 // 26 // NOTE: FFI_USE_DepthOrArrayLayers MUST be set to true to make this field effective. 27 DepthOrArrayLayers GPUIntegerCoordinate 28 29 FFI_USE_Height bool // for Height. 30 FFI_USE_DepthOrArrayLayers bool // for DepthOrArrayLayers. 31 32 FFI_USE bool 33 } 34 35 // FromRef calls UpdateFrom and returns a GPUExtent3DDict with all fields set. 36 func (p GPUExtent3DDict) FromRef(ref js.Ref) GPUExtent3DDict { 37 p.UpdateFrom(ref) 38 return p 39 } 40 41 // New creates a new GPUExtent3DDict in the application heap. 42 func (p GPUExtent3DDict) New() js.Ref { 43 return bindings.GPUExtent3DDictJSLoad( 44 js.Pointer(&p), js.True, 0, 45 ) 46 } 47 48 // UpdateFrom copies value of all fields of the heap object to p. 49 func (p *GPUExtent3DDict) UpdateFrom(ref js.Ref) { 50 bindings.GPUExtent3DDictJSStore( 51 js.Pointer(p), ref, 52 ) 53 } 54 55 // Update writes all fields of the p to the heap object referenced by ref. 56 func (p *GPUExtent3DDict) Update(ref js.Ref) { 57 bindings.GPUExtent3DDictJSLoad( 58 js.Pointer(p), js.False, ref, 59 ) 60 } 61 62 // FreeMembers frees fields with heap reference, if recursive is true 63 // free all heap references reachable from p. 64 func (p *GPUExtent3DDict) FreeMembers(recursive bool) { 65 } 66 67 type OneOf_ArrayGPUIntegerCoordinate_GPUExtent3DDict struct { 68 ref js.Ref 69 } 70 71 func (x OneOf_ArrayGPUIntegerCoordinate_GPUExtent3DDict) Ref() js.Ref { 72 return x.ref 73 } 74 75 func (x OneOf_ArrayGPUIntegerCoordinate_GPUExtent3DDict) Free() { 76 x.ref.Free() 77 } 78 79 func (x OneOf_ArrayGPUIntegerCoordinate_GPUExtent3DDict) FromRef(ref js.Ref) OneOf_ArrayGPUIntegerCoordinate_GPUExtent3DDict { 80 return OneOf_ArrayGPUIntegerCoordinate_GPUExtent3DDict{ 81 ref: ref, 82 } 83 } 84 85 func (x OneOf_ArrayGPUIntegerCoordinate_GPUExtent3DDict) ArrayGPUIntegerCoordinate() js.Array[GPUIntegerCoordinate] { 86 return js.Array[GPUIntegerCoordinate]{}.FromRef(x.ref) 87 } 88 89 func (x OneOf_ArrayGPUIntegerCoordinate_GPUExtent3DDict) GPUExtent3DDict() GPUExtent3DDict { 90 var ret GPUExtent3DDict 91 ret.UpdateFrom(x.ref) 92 return ret 93 } 94 95 type GPUExtent3D = OneOf_ArrayGPUIntegerCoordinate_GPUExtent3DDict 96 97 type GPUSize32 uint32 98 99 type GPUTextureUsageFlags uint32 100 101 type GPUTextureDescriptor struct { 102 // Size is "GPUTextureDescriptor.size" 103 // 104 // Required 105 Size GPUExtent3D 106 // MipLevelCount is "GPUTextureDescriptor.mipLevelCount" 107 // 108 // Optional, defaults to 1. 109 // 110 // NOTE: FFI_USE_MipLevelCount MUST be set to true to make this field effective. 111 MipLevelCount GPUIntegerCoordinate 112 // SampleCount is "GPUTextureDescriptor.sampleCount" 113 // 114 // Optional, defaults to 1. 115 // 116 // NOTE: FFI_USE_SampleCount MUST be set to true to make this field effective. 117 SampleCount GPUSize32 118 // Dimension is "GPUTextureDescriptor.dimension" 119 // 120 // Optional, defaults to "2d". 121 Dimension GPUTextureDimension 122 // Format is "GPUTextureDescriptor.format" 123 // 124 // Required 125 Format GPUTextureFormat 126 // Usage is "GPUTextureDescriptor.usage" 127 // 128 // Required 129 Usage GPUTextureUsageFlags 130 // ViewFormats is "GPUTextureDescriptor.viewFormats" 131 // 132 // Optional, defaults to []. 133 ViewFormats js.Array[GPUTextureFormat] 134 // Label is "GPUTextureDescriptor.label" 135 // 136 // Optional, defaults to "". 137 Label js.String 138 139 FFI_USE_MipLevelCount bool // for MipLevelCount. 140 FFI_USE_SampleCount bool // for SampleCount. 141 142 FFI_USE bool 143 } 144 145 // FromRef calls UpdateFrom and returns a GPUTextureDescriptor with all fields set. 146 func (p GPUTextureDescriptor) FromRef(ref js.Ref) GPUTextureDescriptor { 147 p.UpdateFrom(ref) 148 return p 149 } 150 151 // New creates a new GPUTextureDescriptor in the application heap. 152 func (p GPUTextureDescriptor) New() js.Ref { 153 return bindings.GPUTextureDescriptorJSLoad( 154 js.Pointer(&p), js.True, 0, 155 ) 156 } 157 158 // UpdateFrom copies value of all fields of the heap object to p. 159 func (p *GPUTextureDescriptor) UpdateFrom(ref js.Ref) { 160 bindings.GPUTextureDescriptorJSStore( 161 js.Pointer(p), ref, 162 ) 163 } 164 165 // Update writes all fields of the p to the heap object referenced by ref. 166 func (p *GPUTextureDescriptor) Update(ref js.Ref) { 167 bindings.GPUTextureDescriptorJSLoad( 168 js.Pointer(p), js.False, ref, 169 ) 170 } 171 172 // FreeMembers frees fields with heap reference, if recursive is true 173 // free all heap references reachable from p. 174 func (p *GPUTextureDescriptor) FreeMembers(recursive bool) { 175 js.Free( 176 p.Size.Ref(), 177 p.ViewFormats.Ref(), 178 p.Label.Ref(), 179 ) 180 p.Size = p.Size.FromRef(js.Undefined) 181 p.ViewFormats = p.ViewFormats.FromRef(js.Undefined) 182 p.Label = p.Label.FromRef(js.Undefined) 183 } 184 185 type GPUSampler struct { 186 ref js.Ref 187 } 188 189 func (this GPUSampler) Once() GPUSampler { 190 this.ref.Once() 191 return this 192 } 193 194 func (this GPUSampler) Ref() js.Ref { 195 return this.ref 196 } 197 198 func (this GPUSampler) FromRef(ref js.Ref) GPUSampler { 199 this.ref = ref 200 return this 201 } 202 203 func (this GPUSampler) Free() { 204 this.ref.Free() 205 } 206 207 // Label returns the value of property "GPUSampler.label". 208 // 209 // It returns ok=false if there is no such property. 210 func (this GPUSampler) Label() (ret js.String, ok bool) { 211 ok = js.True == bindings.GetGPUSamplerLabel( 212 this.ref, js.Pointer(&ret), 213 ) 214 return 215 } 216 217 // SetLabel sets the value of property "GPUSampler.label" to val. 218 // 219 // It returns false if the property cannot be set. 220 func (this GPUSampler) SetLabel(val js.String) bool { 221 return js.True == bindings.SetGPUSamplerLabel( 222 this.ref, 223 val.Ref(), 224 ) 225 } 226 227 type GPUAddressMode uint32 228 229 const ( 230 _ GPUAddressMode = iota 231 232 GPUAddressMode_CLAMP_TO_EDGE 233 GPUAddressMode_REPEAT 234 GPUAddressMode_MIRROR_REPEAT 235 ) 236 237 func (GPUAddressMode) FromRef(str js.Ref) GPUAddressMode { 238 return GPUAddressMode(bindings.ConstOfGPUAddressMode(str)) 239 } 240 241 func (x GPUAddressMode) String() (string, bool) { 242 switch x { 243 case GPUAddressMode_CLAMP_TO_EDGE: 244 return "clamp-to-edge", true 245 case GPUAddressMode_REPEAT: 246 return "repeat", true 247 case GPUAddressMode_MIRROR_REPEAT: 248 return "mirror-repeat", true 249 default: 250 return "", false 251 } 252 } 253 254 type GPUFilterMode uint32 255 256 const ( 257 _ GPUFilterMode = iota 258 259 GPUFilterMode_NEAREST 260 GPUFilterMode_LINEAR 261 ) 262 263 func (GPUFilterMode) FromRef(str js.Ref) GPUFilterMode { 264 return GPUFilterMode(bindings.ConstOfGPUFilterMode(str)) 265 } 266 267 func (x GPUFilterMode) String() (string, bool) { 268 switch x { 269 case GPUFilterMode_NEAREST: 270 return "nearest", true 271 case GPUFilterMode_LINEAR: 272 return "linear", true 273 default: 274 return "", false 275 } 276 } 277 278 type GPUMipmapFilterMode uint32 279 280 const ( 281 _ GPUMipmapFilterMode = iota 282 283 GPUMipmapFilterMode_NEAREST 284 GPUMipmapFilterMode_LINEAR 285 ) 286 287 func (GPUMipmapFilterMode) FromRef(str js.Ref) GPUMipmapFilterMode { 288 return GPUMipmapFilterMode(bindings.ConstOfGPUMipmapFilterMode(str)) 289 } 290 291 func (x GPUMipmapFilterMode) String() (string, bool) { 292 switch x { 293 case GPUMipmapFilterMode_NEAREST: 294 return "nearest", true 295 case GPUMipmapFilterMode_LINEAR: 296 return "linear", true 297 default: 298 return "", false 299 } 300 } 301 302 type GPUCompareFunction uint32 303 304 const ( 305 _ GPUCompareFunction = iota 306 307 GPUCompareFunction_NEVER 308 GPUCompareFunction_LESS 309 GPUCompareFunction_EQUAL 310 GPUCompareFunction_LESS_EQUAL 311 GPUCompareFunction_GREATER 312 GPUCompareFunction_NOT_EQUAL 313 GPUCompareFunction_GREATER_EQUAL 314 GPUCompareFunction_ALWAYS 315 ) 316 317 func (GPUCompareFunction) FromRef(str js.Ref) GPUCompareFunction { 318 return GPUCompareFunction(bindings.ConstOfGPUCompareFunction(str)) 319 } 320 321 func (x GPUCompareFunction) String() (string, bool) { 322 switch x { 323 case GPUCompareFunction_NEVER: 324 return "never", true 325 case GPUCompareFunction_LESS: 326 return "less", true 327 case GPUCompareFunction_EQUAL: 328 return "equal", true 329 case GPUCompareFunction_LESS_EQUAL: 330 return "less-equal", true 331 case GPUCompareFunction_GREATER: 332 return "greater", true 333 case GPUCompareFunction_NOT_EQUAL: 334 return "not-equal", true 335 case GPUCompareFunction_GREATER_EQUAL: 336 return "greater-equal", true 337 case GPUCompareFunction_ALWAYS: 338 return "always", true 339 default: 340 return "", false 341 } 342 } 343 344 type GPUSamplerDescriptor struct { 345 // AddressModeU is "GPUSamplerDescriptor.addressModeU" 346 // 347 // Optional, defaults to "clamp-to-edge". 348 AddressModeU GPUAddressMode 349 // AddressModeV is "GPUSamplerDescriptor.addressModeV" 350 // 351 // Optional, defaults to "clamp-to-edge". 352 AddressModeV GPUAddressMode 353 // AddressModeW is "GPUSamplerDescriptor.addressModeW" 354 // 355 // Optional, defaults to "clamp-to-edge". 356 AddressModeW GPUAddressMode 357 // MagFilter is "GPUSamplerDescriptor.magFilter" 358 // 359 // Optional, defaults to "nearest". 360 MagFilter GPUFilterMode 361 // MinFilter is "GPUSamplerDescriptor.minFilter" 362 // 363 // Optional, defaults to "nearest". 364 MinFilter GPUFilterMode 365 // MipmapFilter is "GPUSamplerDescriptor.mipmapFilter" 366 // 367 // Optional, defaults to "nearest". 368 MipmapFilter GPUMipmapFilterMode 369 // LodMinClamp is "GPUSamplerDescriptor.lodMinClamp" 370 // 371 // Optional, defaults to 0. 372 // 373 // NOTE: FFI_USE_LodMinClamp MUST be set to true to make this field effective. 374 LodMinClamp float32 375 // LodMaxClamp is "GPUSamplerDescriptor.lodMaxClamp" 376 // 377 // Optional, defaults to 32. 378 // 379 // NOTE: FFI_USE_LodMaxClamp MUST be set to true to make this field effective. 380 LodMaxClamp float32 381 // Compare is "GPUSamplerDescriptor.compare" 382 // 383 // Optional 384 Compare GPUCompareFunction 385 // MaxAnisotropy is "GPUSamplerDescriptor.maxAnisotropy" 386 // 387 // Optional, defaults to 1. 388 // 389 // NOTE: FFI_USE_MaxAnisotropy MUST be set to true to make this field effective. 390 MaxAnisotropy uint16 391 // Label is "GPUSamplerDescriptor.label" 392 // 393 // Optional, defaults to "". 394 Label js.String 395 396 FFI_USE_LodMinClamp bool // for LodMinClamp. 397 FFI_USE_LodMaxClamp bool // for LodMaxClamp. 398 FFI_USE_MaxAnisotropy bool // for MaxAnisotropy. 399 400 FFI_USE bool 401 } 402 403 // FromRef calls UpdateFrom and returns a GPUSamplerDescriptor with all fields set. 404 func (p GPUSamplerDescriptor) FromRef(ref js.Ref) GPUSamplerDescriptor { 405 p.UpdateFrom(ref) 406 return p 407 } 408 409 // New creates a new GPUSamplerDescriptor in the application heap. 410 func (p GPUSamplerDescriptor) New() js.Ref { 411 return bindings.GPUSamplerDescriptorJSLoad( 412 js.Pointer(&p), js.True, 0, 413 ) 414 } 415 416 // UpdateFrom copies value of all fields of the heap object to p. 417 func (p *GPUSamplerDescriptor) UpdateFrom(ref js.Ref) { 418 bindings.GPUSamplerDescriptorJSStore( 419 js.Pointer(p), ref, 420 ) 421 } 422 423 // Update writes all fields of the p to the heap object referenced by ref. 424 func (p *GPUSamplerDescriptor) Update(ref js.Ref) { 425 bindings.GPUSamplerDescriptorJSLoad( 426 js.Pointer(p), js.False, ref, 427 ) 428 } 429 430 // FreeMembers frees fields with heap reference, if recursive is true 431 // free all heap references reachable from p. 432 func (p *GPUSamplerDescriptor) FreeMembers(recursive bool) { 433 js.Free( 434 p.Label.Ref(), 435 ) 436 p.Label = p.Label.FromRef(js.Undefined) 437 } 438 439 type GPUExternalTexture struct { 440 ref js.Ref 441 } 442 443 func (this GPUExternalTexture) Once() GPUExternalTexture { 444 this.ref.Once() 445 return this 446 } 447 448 func (this GPUExternalTexture) Ref() js.Ref { 449 return this.ref 450 } 451 452 func (this GPUExternalTexture) FromRef(ref js.Ref) GPUExternalTexture { 453 this.ref = ref 454 return this 455 } 456 457 func (this GPUExternalTexture) Free() { 458 this.ref.Free() 459 } 460 461 // Label returns the value of property "GPUExternalTexture.label". 462 // 463 // It returns ok=false if there is no such property. 464 func (this GPUExternalTexture) Label() (ret js.String, ok bool) { 465 ok = js.True == bindings.GetGPUExternalTextureLabel( 466 this.ref, js.Pointer(&ret), 467 ) 468 return 469 } 470 471 // SetLabel sets the value of property "GPUExternalTexture.label" to val. 472 // 473 // It returns false if the property cannot be set. 474 func (this GPUExternalTexture) SetLabel(val js.String) bool { 475 return js.True == bindings.SetGPUExternalTextureLabel( 476 this.ref, 477 val.Ref(), 478 ) 479 } 480 481 type OneOf_HTMLVideoElement_VideoFrame struct { 482 ref js.Ref 483 } 484 485 func (x OneOf_HTMLVideoElement_VideoFrame) Ref() js.Ref { 486 return x.ref 487 } 488 489 func (x OneOf_HTMLVideoElement_VideoFrame) Free() { 490 x.ref.Free() 491 } 492 493 func (x OneOf_HTMLVideoElement_VideoFrame) FromRef(ref js.Ref) OneOf_HTMLVideoElement_VideoFrame { 494 return OneOf_HTMLVideoElement_VideoFrame{ 495 ref: ref, 496 } 497 } 498 499 func (x OneOf_HTMLVideoElement_VideoFrame) HTMLVideoElement() HTMLVideoElement { 500 return HTMLVideoElement{}.FromRef(x.ref) 501 } 502 503 func (x OneOf_HTMLVideoElement_VideoFrame) VideoFrame() VideoFrame { 504 return VideoFrame{}.FromRef(x.ref) 505 } 506 507 type GPUExternalTextureDescriptor struct { 508 // Source is "GPUExternalTextureDescriptor.source" 509 // 510 // Required 511 Source OneOf_HTMLVideoElement_VideoFrame 512 // ColorSpace is "GPUExternalTextureDescriptor.colorSpace" 513 // 514 // Optional, defaults to "srgb". 515 ColorSpace PredefinedColorSpace 516 // Label is "GPUExternalTextureDescriptor.label" 517 // 518 // Optional, defaults to "". 519 Label js.String 520 521 FFI_USE bool 522 } 523 524 // FromRef calls UpdateFrom and returns a GPUExternalTextureDescriptor with all fields set. 525 func (p GPUExternalTextureDescriptor) FromRef(ref js.Ref) GPUExternalTextureDescriptor { 526 p.UpdateFrom(ref) 527 return p 528 } 529 530 // New creates a new GPUExternalTextureDescriptor in the application heap. 531 func (p GPUExternalTextureDescriptor) New() js.Ref { 532 return bindings.GPUExternalTextureDescriptorJSLoad( 533 js.Pointer(&p), js.True, 0, 534 ) 535 } 536 537 // UpdateFrom copies value of all fields of the heap object to p. 538 func (p *GPUExternalTextureDescriptor) UpdateFrom(ref js.Ref) { 539 bindings.GPUExternalTextureDescriptorJSStore( 540 js.Pointer(p), ref, 541 ) 542 } 543 544 // Update writes all fields of the p to the heap object referenced by ref. 545 func (p *GPUExternalTextureDescriptor) Update(ref js.Ref) { 546 bindings.GPUExternalTextureDescriptorJSLoad( 547 js.Pointer(p), js.False, ref, 548 ) 549 } 550 551 // FreeMembers frees fields with heap reference, if recursive is true 552 // free all heap references reachable from p. 553 func (p *GPUExternalTextureDescriptor) FreeMembers(recursive bool) { 554 js.Free( 555 p.Source.Ref(), 556 p.Label.Ref(), 557 ) 558 p.Source = p.Source.FromRef(js.Undefined) 559 p.Label = p.Label.FromRef(js.Undefined) 560 } 561 562 type GPUBindGroupLayout struct { 563 ref js.Ref 564 } 565 566 func (this GPUBindGroupLayout) Once() GPUBindGroupLayout { 567 this.ref.Once() 568 return this 569 } 570 571 func (this GPUBindGroupLayout) Ref() js.Ref { 572 return this.ref 573 } 574 575 func (this GPUBindGroupLayout) FromRef(ref js.Ref) GPUBindGroupLayout { 576 this.ref = ref 577 return this 578 } 579 580 func (this GPUBindGroupLayout) Free() { 581 this.ref.Free() 582 } 583 584 // Label returns the value of property "GPUBindGroupLayout.label". 585 // 586 // It returns ok=false if there is no such property. 587 func (this GPUBindGroupLayout) Label() (ret js.String, ok bool) { 588 ok = js.True == bindings.GetGPUBindGroupLayoutLabel( 589 this.ref, js.Pointer(&ret), 590 ) 591 return 592 } 593 594 // SetLabel sets the value of property "GPUBindGroupLayout.label" to val. 595 // 596 // It returns false if the property cannot be set. 597 func (this GPUBindGroupLayout) SetLabel(val js.String) bool { 598 return js.True == bindings.SetGPUBindGroupLayoutLabel( 599 this.ref, 600 val.Ref(), 601 ) 602 } 603 604 type GPUIndex32 uint32 605 606 type GPUShaderStageFlags uint32 607 608 type GPUBufferBindingType uint32 609 610 const ( 611 _ GPUBufferBindingType = iota 612 613 GPUBufferBindingType_UNIFORM 614 GPUBufferBindingType_STORAGE 615 GPUBufferBindingType_READ_ONLY_STORAGE 616 ) 617 618 func (GPUBufferBindingType) FromRef(str js.Ref) GPUBufferBindingType { 619 return GPUBufferBindingType(bindings.ConstOfGPUBufferBindingType(str)) 620 } 621 622 func (x GPUBufferBindingType) String() (string, bool) { 623 switch x { 624 case GPUBufferBindingType_UNIFORM: 625 return "uniform", true 626 case GPUBufferBindingType_STORAGE: 627 return "storage", true 628 case GPUBufferBindingType_READ_ONLY_STORAGE: 629 return "read-only-storage", true 630 default: 631 return "", false 632 } 633 } 634 635 type GPUBufferBindingLayout struct { 636 // Type is "GPUBufferBindingLayout.type" 637 // 638 // Optional, defaults to "uniform". 639 Type GPUBufferBindingType 640 // HasDynamicOffset is "GPUBufferBindingLayout.hasDynamicOffset" 641 // 642 // Optional, defaults to false. 643 // 644 // NOTE: FFI_USE_HasDynamicOffset MUST be set to true to make this field effective. 645 HasDynamicOffset bool 646 // MinBindingSize is "GPUBufferBindingLayout.minBindingSize" 647 // 648 // Optional, defaults to 0. 649 // 650 // NOTE: FFI_USE_MinBindingSize MUST be set to true to make this field effective. 651 MinBindingSize GPUSize64 652 653 FFI_USE_HasDynamicOffset bool // for HasDynamicOffset. 654 FFI_USE_MinBindingSize bool // for MinBindingSize. 655 656 FFI_USE bool 657 } 658 659 // FromRef calls UpdateFrom and returns a GPUBufferBindingLayout with all fields set. 660 func (p GPUBufferBindingLayout) FromRef(ref js.Ref) GPUBufferBindingLayout { 661 p.UpdateFrom(ref) 662 return p 663 } 664 665 // New creates a new GPUBufferBindingLayout in the application heap. 666 func (p GPUBufferBindingLayout) New() js.Ref { 667 return bindings.GPUBufferBindingLayoutJSLoad( 668 js.Pointer(&p), js.True, 0, 669 ) 670 } 671 672 // UpdateFrom copies value of all fields of the heap object to p. 673 func (p *GPUBufferBindingLayout) UpdateFrom(ref js.Ref) { 674 bindings.GPUBufferBindingLayoutJSStore( 675 js.Pointer(p), ref, 676 ) 677 } 678 679 // Update writes all fields of the p to the heap object referenced by ref. 680 func (p *GPUBufferBindingLayout) Update(ref js.Ref) { 681 bindings.GPUBufferBindingLayoutJSLoad( 682 js.Pointer(p), js.False, ref, 683 ) 684 } 685 686 // FreeMembers frees fields with heap reference, if recursive is true 687 // free all heap references reachable from p. 688 func (p *GPUBufferBindingLayout) FreeMembers(recursive bool) { 689 } 690 691 type GPUSamplerBindingType uint32 692 693 const ( 694 _ GPUSamplerBindingType = iota 695 696 GPUSamplerBindingType_FILTERING 697 GPUSamplerBindingType_NON_FILTERING 698 GPUSamplerBindingType_COMPARISON 699 ) 700 701 func (GPUSamplerBindingType) FromRef(str js.Ref) GPUSamplerBindingType { 702 return GPUSamplerBindingType(bindings.ConstOfGPUSamplerBindingType(str)) 703 } 704 705 func (x GPUSamplerBindingType) String() (string, bool) { 706 switch x { 707 case GPUSamplerBindingType_FILTERING: 708 return "filtering", true 709 case GPUSamplerBindingType_NON_FILTERING: 710 return "non-filtering", true 711 case GPUSamplerBindingType_COMPARISON: 712 return "comparison", true 713 default: 714 return "", false 715 } 716 } 717 718 type GPUSamplerBindingLayout struct { 719 // Type is "GPUSamplerBindingLayout.type" 720 // 721 // Optional, defaults to "filtering". 722 Type GPUSamplerBindingType 723 724 FFI_USE bool 725 } 726 727 // FromRef calls UpdateFrom and returns a GPUSamplerBindingLayout with all fields set. 728 func (p GPUSamplerBindingLayout) FromRef(ref js.Ref) GPUSamplerBindingLayout { 729 p.UpdateFrom(ref) 730 return p 731 } 732 733 // New creates a new GPUSamplerBindingLayout in the application heap. 734 func (p GPUSamplerBindingLayout) New() js.Ref { 735 return bindings.GPUSamplerBindingLayoutJSLoad( 736 js.Pointer(&p), js.True, 0, 737 ) 738 } 739 740 // UpdateFrom copies value of all fields of the heap object to p. 741 func (p *GPUSamplerBindingLayout) UpdateFrom(ref js.Ref) { 742 bindings.GPUSamplerBindingLayoutJSStore( 743 js.Pointer(p), ref, 744 ) 745 } 746 747 // Update writes all fields of the p to the heap object referenced by ref. 748 func (p *GPUSamplerBindingLayout) Update(ref js.Ref) { 749 bindings.GPUSamplerBindingLayoutJSLoad( 750 js.Pointer(p), js.False, ref, 751 ) 752 } 753 754 // FreeMembers frees fields with heap reference, if recursive is true 755 // free all heap references reachable from p. 756 func (p *GPUSamplerBindingLayout) FreeMembers(recursive bool) { 757 } 758 759 type GPUTextureSampleType uint32 760 761 const ( 762 _ GPUTextureSampleType = iota 763 764 GPUTextureSampleType_FLOAT 765 GPUTextureSampleType_UNFILTERABLE_FLOAT 766 GPUTextureSampleType_DEPTH 767 GPUTextureSampleType_SINT 768 GPUTextureSampleType_UINT 769 ) 770 771 func (GPUTextureSampleType) FromRef(str js.Ref) GPUTextureSampleType { 772 return GPUTextureSampleType(bindings.ConstOfGPUTextureSampleType(str)) 773 } 774 775 func (x GPUTextureSampleType) String() (string, bool) { 776 switch x { 777 case GPUTextureSampleType_FLOAT: 778 return "float", true 779 case GPUTextureSampleType_UNFILTERABLE_FLOAT: 780 return "unfilterable-float", true 781 case GPUTextureSampleType_DEPTH: 782 return "depth", true 783 case GPUTextureSampleType_SINT: 784 return "sint", true 785 case GPUTextureSampleType_UINT: 786 return "uint", true 787 default: 788 return "", false 789 } 790 } 791 792 type GPUTextureBindingLayout struct { 793 // SampleType is "GPUTextureBindingLayout.sampleType" 794 // 795 // Optional, defaults to "float". 796 SampleType GPUTextureSampleType 797 // ViewDimension is "GPUTextureBindingLayout.viewDimension" 798 // 799 // Optional, defaults to "2d". 800 ViewDimension GPUTextureViewDimension 801 // Multisampled is "GPUTextureBindingLayout.multisampled" 802 // 803 // Optional, defaults to false. 804 // 805 // NOTE: FFI_USE_Multisampled MUST be set to true to make this field effective. 806 Multisampled bool 807 808 FFI_USE_Multisampled bool // for Multisampled. 809 810 FFI_USE bool 811 } 812 813 // FromRef calls UpdateFrom and returns a GPUTextureBindingLayout with all fields set. 814 func (p GPUTextureBindingLayout) FromRef(ref js.Ref) GPUTextureBindingLayout { 815 p.UpdateFrom(ref) 816 return p 817 } 818 819 // New creates a new GPUTextureBindingLayout in the application heap. 820 func (p GPUTextureBindingLayout) New() js.Ref { 821 return bindings.GPUTextureBindingLayoutJSLoad( 822 js.Pointer(&p), js.True, 0, 823 ) 824 } 825 826 // UpdateFrom copies value of all fields of the heap object to p. 827 func (p *GPUTextureBindingLayout) UpdateFrom(ref js.Ref) { 828 bindings.GPUTextureBindingLayoutJSStore( 829 js.Pointer(p), ref, 830 ) 831 } 832 833 // Update writes all fields of the p to the heap object referenced by ref. 834 func (p *GPUTextureBindingLayout) Update(ref js.Ref) { 835 bindings.GPUTextureBindingLayoutJSLoad( 836 js.Pointer(p), js.False, ref, 837 ) 838 } 839 840 // FreeMembers frees fields with heap reference, if recursive is true 841 // free all heap references reachable from p. 842 func (p *GPUTextureBindingLayout) FreeMembers(recursive bool) { 843 } 844 845 type GPUStorageTextureAccess uint32 846 847 const ( 848 _ GPUStorageTextureAccess = iota 849 850 GPUStorageTextureAccess_WRITE_ONLY 851 ) 852 853 func (GPUStorageTextureAccess) FromRef(str js.Ref) GPUStorageTextureAccess { 854 return GPUStorageTextureAccess(bindings.ConstOfGPUStorageTextureAccess(str)) 855 } 856 857 func (x GPUStorageTextureAccess) String() (string, bool) { 858 switch x { 859 case GPUStorageTextureAccess_WRITE_ONLY: 860 return "write-only", true 861 default: 862 return "", false 863 } 864 } 865 866 type GPUStorageTextureBindingLayout struct { 867 // Access is "GPUStorageTextureBindingLayout.access" 868 // 869 // Optional, defaults to "write-only". 870 Access GPUStorageTextureAccess 871 // Format is "GPUStorageTextureBindingLayout.format" 872 // 873 // Required 874 Format GPUTextureFormat 875 // ViewDimension is "GPUStorageTextureBindingLayout.viewDimension" 876 // 877 // Optional, defaults to "2d". 878 ViewDimension GPUTextureViewDimension 879 880 FFI_USE bool 881 } 882 883 // FromRef calls UpdateFrom and returns a GPUStorageTextureBindingLayout with all fields set. 884 func (p GPUStorageTextureBindingLayout) FromRef(ref js.Ref) GPUStorageTextureBindingLayout { 885 p.UpdateFrom(ref) 886 return p 887 } 888 889 // New creates a new GPUStorageTextureBindingLayout in the application heap. 890 func (p GPUStorageTextureBindingLayout) New() js.Ref { 891 return bindings.GPUStorageTextureBindingLayoutJSLoad( 892 js.Pointer(&p), js.True, 0, 893 ) 894 } 895 896 // UpdateFrom copies value of all fields of the heap object to p. 897 func (p *GPUStorageTextureBindingLayout) UpdateFrom(ref js.Ref) { 898 bindings.GPUStorageTextureBindingLayoutJSStore( 899 js.Pointer(p), ref, 900 ) 901 } 902 903 // Update writes all fields of the p to the heap object referenced by ref. 904 func (p *GPUStorageTextureBindingLayout) Update(ref js.Ref) { 905 bindings.GPUStorageTextureBindingLayoutJSLoad( 906 js.Pointer(p), js.False, ref, 907 ) 908 } 909 910 // FreeMembers frees fields with heap reference, if recursive is true 911 // free all heap references reachable from p. 912 func (p *GPUStorageTextureBindingLayout) FreeMembers(recursive bool) { 913 } 914 915 type GPUExternalTextureBindingLayout struct { 916 FFI_USE bool 917 } 918 919 // FromRef calls UpdateFrom and returns a GPUExternalTextureBindingLayout with all fields set. 920 func (p GPUExternalTextureBindingLayout) FromRef(ref js.Ref) GPUExternalTextureBindingLayout { 921 p.UpdateFrom(ref) 922 return p 923 } 924 925 // New creates a new GPUExternalTextureBindingLayout in the application heap. 926 func (p GPUExternalTextureBindingLayout) New() js.Ref { 927 return bindings.GPUExternalTextureBindingLayoutJSLoad( 928 js.Pointer(&p), js.True, 0, 929 ) 930 } 931 932 // UpdateFrom copies value of all fields of the heap object to p. 933 func (p *GPUExternalTextureBindingLayout) UpdateFrom(ref js.Ref) { 934 bindings.GPUExternalTextureBindingLayoutJSStore( 935 js.Pointer(p), ref, 936 ) 937 } 938 939 // Update writes all fields of the p to the heap object referenced by ref. 940 func (p *GPUExternalTextureBindingLayout) Update(ref js.Ref) { 941 bindings.GPUExternalTextureBindingLayoutJSLoad( 942 js.Pointer(p), js.False, ref, 943 ) 944 } 945 946 // FreeMembers frees fields with heap reference, if recursive is true 947 // free all heap references reachable from p. 948 func (p *GPUExternalTextureBindingLayout) FreeMembers(recursive bool) { 949 } 950 951 type GPUBindGroupLayoutEntry struct { 952 // Binding is "GPUBindGroupLayoutEntry.binding" 953 // 954 // Required 955 Binding GPUIndex32 956 // Visibility is "GPUBindGroupLayoutEntry.visibility" 957 // 958 // Required 959 Visibility GPUShaderStageFlags 960 // Buffer is "GPUBindGroupLayoutEntry.buffer" 961 // 962 // Optional 963 // 964 // NOTE: Buffer.FFI_USE MUST be set to true to get Buffer used. 965 Buffer GPUBufferBindingLayout 966 // Sampler is "GPUBindGroupLayoutEntry.sampler" 967 // 968 // Optional 969 // 970 // NOTE: Sampler.FFI_USE MUST be set to true to get Sampler used. 971 Sampler GPUSamplerBindingLayout 972 // Texture is "GPUBindGroupLayoutEntry.texture" 973 // 974 // Optional 975 // 976 // NOTE: Texture.FFI_USE MUST be set to true to get Texture used. 977 Texture GPUTextureBindingLayout 978 // StorageTexture is "GPUBindGroupLayoutEntry.storageTexture" 979 // 980 // Optional 981 // 982 // NOTE: StorageTexture.FFI_USE MUST be set to true to get StorageTexture used. 983 StorageTexture GPUStorageTextureBindingLayout 984 // ExternalTexture is "GPUBindGroupLayoutEntry.externalTexture" 985 // 986 // Optional 987 // 988 // NOTE: ExternalTexture.FFI_USE MUST be set to true to get ExternalTexture used. 989 ExternalTexture GPUExternalTextureBindingLayout 990 991 FFI_USE bool 992 } 993 994 // FromRef calls UpdateFrom and returns a GPUBindGroupLayoutEntry with all fields set. 995 func (p GPUBindGroupLayoutEntry) FromRef(ref js.Ref) GPUBindGroupLayoutEntry { 996 p.UpdateFrom(ref) 997 return p 998 } 999 1000 // New creates a new GPUBindGroupLayoutEntry in the application heap. 1001 func (p GPUBindGroupLayoutEntry) New() js.Ref { 1002 return bindings.GPUBindGroupLayoutEntryJSLoad( 1003 js.Pointer(&p), js.True, 0, 1004 ) 1005 } 1006 1007 // UpdateFrom copies value of all fields of the heap object to p. 1008 func (p *GPUBindGroupLayoutEntry) UpdateFrom(ref js.Ref) { 1009 bindings.GPUBindGroupLayoutEntryJSStore( 1010 js.Pointer(p), ref, 1011 ) 1012 } 1013 1014 // Update writes all fields of the p to the heap object referenced by ref. 1015 func (p *GPUBindGroupLayoutEntry) Update(ref js.Ref) { 1016 bindings.GPUBindGroupLayoutEntryJSLoad( 1017 js.Pointer(p), js.False, ref, 1018 ) 1019 } 1020 1021 // FreeMembers frees fields with heap reference, if recursive is true 1022 // free all heap references reachable from p. 1023 func (p *GPUBindGroupLayoutEntry) FreeMembers(recursive bool) { 1024 if recursive { 1025 p.Buffer.FreeMembers(true) 1026 p.Sampler.FreeMembers(true) 1027 p.Texture.FreeMembers(true) 1028 p.StorageTexture.FreeMembers(true) 1029 p.ExternalTexture.FreeMembers(true) 1030 } 1031 } 1032 1033 type GPUBindGroupLayoutDescriptor struct { 1034 // Entries is "GPUBindGroupLayoutDescriptor.entries" 1035 // 1036 // Required 1037 Entries js.Array[GPUBindGroupLayoutEntry] 1038 // Label is "GPUBindGroupLayoutDescriptor.label" 1039 // 1040 // Optional, defaults to "". 1041 Label js.String 1042 1043 FFI_USE bool 1044 } 1045 1046 // FromRef calls UpdateFrom and returns a GPUBindGroupLayoutDescriptor with all fields set. 1047 func (p GPUBindGroupLayoutDescriptor) FromRef(ref js.Ref) GPUBindGroupLayoutDescriptor { 1048 p.UpdateFrom(ref) 1049 return p 1050 } 1051 1052 // New creates a new GPUBindGroupLayoutDescriptor in the application heap. 1053 func (p GPUBindGroupLayoutDescriptor) New() js.Ref { 1054 return bindings.GPUBindGroupLayoutDescriptorJSLoad( 1055 js.Pointer(&p), js.True, 0, 1056 ) 1057 } 1058 1059 // UpdateFrom copies value of all fields of the heap object to p. 1060 func (p *GPUBindGroupLayoutDescriptor) UpdateFrom(ref js.Ref) { 1061 bindings.GPUBindGroupLayoutDescriptorJSStore( 1062 js.Pointer(p), ref, 1063 ) 1064 } 1065 1066 // Update writes all fields of the p to the heap object referenced by ref. 1067 func (p *GPUBindGroupLayoutDescriptor) Update(ref js.Ref) { 1068 bindings.GPUBindGroupLayoutDescriptorJSLoad( 1069 js.Pointer(p), js.False, ref, 1070 ) 1071 } 1072 1073 // FreeMembers frees fields with heap reference, if recursive is true 1074 // free all heap references reachable from p. 1075 func (p *GPUBindGroupLayoutDescriptor) FreeMembers(recursive bool) { 1076 js.Free( 1077 p.Entries.Ref(), 1078 p.Label.Ref(), 1079 ) 1080 p.Entries = p.Entries.FromRef(js.Undefined) 1081 p.Label = p.Label.FromRef(js.Undefined) 1082 } 1083 1084 type GPUPipelineLayout struct { 1085 ref js.Ref 1086 } 1087 1088 func (this GPUPipelineLayout) Once() GPUPipelineLayout { 1089 this.ref.Once() 1090 return this 1091 } 1092 1093 func (this GPUPipelineLayout) Ref() js.Ref { 1094 return this.ref 1095 } 1096 1097 func (this GPUPipelineLayout) FromRef(ref js.Ref) GPUPipelineLayout { 1098 this.ref = ref 1099 return this 1100 } 1101 1102 func (this GPUPipelineLayout) Free() { 1103 this.ref.Free() 1104 } 1105 1106 // Label returns the value of property "GPUPipelineLayout.label". 1107 // 1108 // It returns ok=false if there is no such property. 1109 func (this GPUPipelineLayout) Label() (ret js.String, ok bool) { 1110 ok = js.True == bindings.GetGPUPipelineLayoutLabel( 1111 this.ref, js.Pointer(&ret), 1112 ) 1113 return 1114 } 1115 1116 // SetLabel sets the value of property "GPUPipelineLayout.label" to val. 1117 // 1118 // It returns false if the property cannot be set. 1119 func (this GPUPipelineLayout) SetLabel(val js.String) bool { 1120 return js.True == bindings.SetGPUPipelineLayoutLabel( 1121 this.ref, 1122 val.Ref(), 1123 ) 1124 } 1125 1126 type GPUPipelineLayoutDescriptor struct { 1127 // BindGroupLayouts is "GPUPipelineLayoutDescriptor.bindGroupLayouts" 1128 // 1129 // Required 1130 BindGroupLayouts js.Array[GPUBindGroupLayout] 1131 // Label is "GPUPipelineLayoutDescriptor.label" 1132 // 1133 // Optional, defaults to "". 1134 Label js.String 1135 1136 FFI_USE bool 1137 } 1138 1139 // FromRef calls UpdateFrom and returns a GPUPipelineLayoutDescriptor with all fields set. 1140 func (p GPUPipelineLayoutDescriptor) FromRef(ref js.Ref) GPUPipelineLayoutDescriptor { 1141 p.UpdateFrom(ref) 1142 return p 1143 } 1144 1145 // New creates a new GPUPipelineLayoutDescriptor in the application heap. 1146 func (p GPUPipelineLayoutDescriptor) New() js.Ref { 1147 return bindings.GPUPipelineLayoutDescriptorJSLoad( 1148 js.Pointer(&p), js.True, 0, 1149 ) 1150 } 1151 1152 // UpdateFrom copies value of all fields of the heap object to p. 1153 func (p *GPUPipelineLayoutDescriptor) UpdateFrom(ref js.Ref) { 1154 bindings.GPUPipelineLayoutDescriptorJSStore( 1155 js.Pointer(p), ref, 1156 ) 1157 } 1158 1159 // Update writes all fields of the p to the heap object referenced by ref. 1160 func (p *GPUPipelineLayoutDescriptor) Update(ref js.Ref) { 1161 bindings.GPUPipelineLayoutDescriptorJSLoad( 1162 js.Pointer(p), js.False, ref, 1163 ) 1164 } 1165 1166 // FreeMembers frees fields with heap reference, if recursive is true 1167 // free all heap references reachable from p. 1168 func (p *GPUPipelineLayoutDescriptor) FreeMembers(recursive bool) { 1169 js.Free( 1170 p.BindGroupLayouts.Ref(), 1171 p.Label.Ref(), 1172 ) 1173 p.BindGroupLayouts = p.BindGroupLayouts.FromRef(js.Undefined) 1174 p.Label = p.Label.FromRef(js.Undefined) 1175 } 1176 1177 type GPUBindGroup struct { 1178 ref js.Ref 1179 } 1180 1181 func (this GPUBindGroup) Once() GPUBindGroup { 1182 this.ref.Once() 1183 return this 1184 } 1185 1186 func (this GPUBindGroup) Ref() js.Ref { 1187 return this.ref 1188 } 1189 1190 func (this GPUBindGroup) FromRef(ref js.Ref) GPUBindGroup { 1191 this.ref = ref 1192 return this 1193 } 1194 1195 func (this GPUBindGroup) Free() { 1196 this.ref.Free() 1197 } 1198 1199 // Label returns the value of property "GPUBindGroup.label". 1200 // 1201 // It returns ok=false if there is no such property. 1202 func (this GPUBindGroup) Label() (ret js.String, ok bool) { 1203 ok = js.True == bindings.GetGPUBindGroupLabel( 1204 this.ref, js.Pointer(&ret), 1205 ) 1206 return 1207 } 1208 1209 // SetLabel sets the value of property "GPUBindGroup.label" to val. 1210 // 1211 // It returns false if the property cannot be set. 1212 func (this GPUBindGroup) SetLabel(val js.String) bool { 1213 return js.True == bindings.SetGPUBindGroupLabel( 1214 this.ref, 1215 val.Ref(), 1216 ) 1217 } 1218 1219 type GPUBufferBinding struct { 1220 // Buffer is "GPUBufferBinding.buffer" 1221 // 1222 // Required 1223 Buffer GPUBuffer 1224 // Offset is "GPUBufferBinding.offset" 1225 // 1226 // Optional, defaults to 0. 1227 // 1228 // NOTE: FFI_USE_Offset MUST be set to true to make this field effective. 1229 Offset GPUSize64 1230 // Size is "GPUBufferBinding.size" 1231 // 1232 // Optional 1233 // 1234 // NOTE: FFI_USE_Size MUST be set to true to make this field effective. 1235 Size GPUSize64 1236 1237 FFI_USE_Offset bool // for Offset. 1238 FFI_USE_Size bool // for Size. 1239 1240 FFI_USE bool 1241 } 1242 1243 // FromRef calls UpdateFrom and returns a GPUBufferBinding with all fields set. 1244 func (p GPUBufferBinding) FromRef(ref js.Ref) GPUBufferBinding { 1245 p.UpdateFrom(ref) 1246 return p 1247 } 1248 1249 // New creates a new GPUBufferBinding in the application heap. 1250 func (p GPUBufferBinding) New() js.Ref { 1251 return bindings.GPUBufferBindingJSLoad( 1252 js.Pointer(&p), js.True, 0, 1253 ) 1254 } 1255 1256 // UpdateFrom copies value of all fields of the heap object to p. 1257 func (p *GPUBufferBinding) UpdateFrom(ref js.Ref) { 1258 bindings.GPUBufferBindingJSStore( 1259 js.Pointer(p), ref, 1260 ) 1261 } 1262 1263 // Update writes all fields of the p to the heap object referenced by ref. 1264 func (p *GPUBufferBinding) Update(ref js.Ref) { 1265 bindings.GPUBufferBindingJSLoad( 1266 js.Pointer(p), js.False, ref, 1267 ) 1268 } 1269 1270 // FreeMembers frees fields with heap reference, if recursive is true 1271 // free all heap references reachable from p. 1272 func (p *GPUBufferBinding) FreeMembers(recursive bool) { 1273 js.Free( 1274 p.Buffer.Ref(), 1275 ) 1276 p.Buffer = p.Buffer.FromRef(js.Undefined) 1277 } 1278 1279 type OneOf_GPUSampler_GPUTextureView_GPUBufferBinding_GPUExternalTexture struct { 1280 ref js.Ref 1281 } 1282 1283 func (x OneOf_GPUSampler_GPUTextureView_GPUBufferBinding_GPUExternalTexture) Ref() js.Ref { 1284 return x.ref 1285 } 1286 1287 func (x OneOf_GPUSampler_GPUTextureView_GPUBufferBinding_GPUExternalTexture) Free() { 1288 x.ref.Free() 1289 } 1290 1291 func (x OneOf_GPUSampler_GPUTextureView_GPUBufferBinding_GPUExternalTexture) FromRef(ref js.Ref) OneOf_GPUSampler_GPUTextureView_GPUBufferBinding_GPUExternalTexture { 1292 return OneOf_GPUSampler_GPUTextureView_GPUBufferBinding_GPUExternalTexture{ 1293 ref: ref, 1294 } 1295 } 1296 1297 func (x OneOf_GPUSampler_GPUTextureView_GPUBufferBinding_GPUExternalTexture) GPUSampler() GPUSampler { 1298 return GPUSampler{}.FromRef(x.ref) 1299 } 1300 1301 func (x OneOf_GPUSampler_GPUTextureView_GPUBufferBinding_GPUExternalTexture) GPUTextureView() GPUTextureView { 1302 return GPUTextureView{}.FromRef(x.ref) 1303 } 1304 1305 func (x OneOf_GPUSampler_GPUTextureView_GPUBufferBinding_GPUExternalTexture) GPUBufferBinding() GPUBufferBinding { 1306 var ret GPUBufferBinding 1307 ret.UpdateFrom(x.ref) 1308 return ret 1309 } 1310 1311 func (x OneOf_GPUSampler_GPUTextureView_GPUBufferBinding_GPUExternalTexture) GPUExternalTexture() GPUExternalTexture { 1312 return GPUExternalTexture{}.FromRef(x.ref) 1313 } 1314 1315 type GPUBindingResource = OneOf_GPUSampler_GPUTextureView_GPUBufferBinding_GPUExternalTexture 1316 1317 type GPUBindGroupEntry struct { 1318 // Binding is "GPUBindGroupEntry.binding" 1319 // 1320 // Required 1321 Binding GPUIndex32 1322 // Resource is "GPUBindGroupEntry.resource" 1323 // 1324 // Required 1325 Resource GPUBindingResource 1326 1327 FFI_USE bool 1328 } 1329 1330 // FromRef calls UpdateFrom and returns a GPUBindGroupEntry with all fields set. 1331 func (p GPUBindGroupEntry) FromRef(ref js.Ref) GPUBindGroupEntry { 1332 p.UpdateFrom(ref) 1333 return p 1334 } 1335 1336 // New creates a new GPUBindGroupEntry in the application heap. 1337 func (p GPUBindGroupEntry) New() js.Ref { 1338 return bindings.GPUBindGroupEntryJSLoad( 1339 js.Pointer(&p), js.True, 0, 1340 ) 1341 } 1342 1343 // UpdateFrom copies value of all fields of the heap object to p. 1344 func (p *GPUBindGroupEntry) UpdateFrom(ref js.Ref) { 1345 bindings.GPUBindGroupEntryJSStore( 1346 js.Pointer(p), ref, 1347 ) 1348 } 1349 1350 // Update writes all fields of the p to the heap object referenced by ref. 1351 func (p *GPUBindGroupEntry) Update(ref js.Ref) { 1352 bindings.GPUBindGroupEntryJSLoad( 1353 js.Pointer(p), js.False, ref, 1354 ) 1355 } 1356 1357 // FreeMembers frees fields with heap reference, if recursive is true 1358 // free all heap references reachable from p. 1359 func (p *GPUBindGroupEntry) FreeMembers(recursive bool) { 1360 js.Free( 1361 p.Resource.Ref(), 1362 ) 1363 p.Resource = p.Resource.FromRef(js.Undefined) 1364 } 1365 1366 type GPUBindGroupDescriptor struct { 1367 // Layout is "GPUBindGroupDescriptor.layout" 1368 // 1369 // Required 1370 Layout GPUBindGroupLayout 1371 // Entries is "GPUBindGroupDescriptor.entries" 1372 // 1373 // Required 1374 Entries js.Array[GPUBindGroupEntry] 1375 // Label is "GPUBindGroupDescriptor.label" 1376 // 1377 // Optional, defaults to "". 1378 Label js.String 1379 1380 FFI_USE bool 1381 } 1382 1383 // FromRef calls UpdateFrom and returns a GPUBindGroupDescriptor with all fields set. 1384 func (p GPUBindGroupDescriptor) FromRef(ref js.Ref) GPUBindGroupDescriptor { 1385 p.UpdateFrom(ref) 1386 return p 1387 } 1388 1389 // New creates a new GPUBindGroupDescriptor in the application heap. 1390 func (p GPUBindGroupDescriptor) New() js.Ref { 1391 return bindings.GPUBindGroupDescriptorJSLoad( 1392 js.Pointer(&p), js.True, 0, 1393 ) 1394 } 1395 1396 // UpdateFrom copies value of all fields of the heap object to p. 1397 func (p *GPUBindGroupDescriptor) UpdateFrom(ref js.Ref) { 1398 bindings.GPUBindGroupDescriptorJSStore( 1399 js.Pointer(p), ref, 1400 ) 1401 } 1402 1403 // Update writes all fields of the p to the heap object referenced by ref. 1404 func (p *GPUBindGroupDescriptor) Update(ref js.Ref) { 1405 bindings.GPUBindGroupDescriptorJSLoad( 1406 js.Pointer(p), js.False, ref, 1407 ) 1408 } 1409 1410 // FreeMembers frees fields with heap reference, if recursive is true 1411 // free all heap references reachable from p. 1412 func (p *GPUBindGroupDescriptor) FreeMembers(recursive bool) { 1413 js.Free( 1414 p.Layout.Ref(), 1415 p.Entries.Ref(), 1416 p.Label.Ref(), 1417 ) 1418 p.Layout = p.Layout.FromRef(js.Undefined) 1419 p.Entries = p.Entries.FromRef(js.Undefined) 1420 p.Label = p.Label.FromRef(js.Undefined) 1421 } 1422 1423 type GPUCompilationMessageType uint32 1424 1425 const ( 1426 _ GPUCompilationMessageType = iota 1427 1428 GPUCompilationMessageType_ERROR 1429 GPUCompilationMessageType_WARNING 1430 GPUCompilationMessageType_INFO 1431 ) 1432 1433 func (GPUCompilationMessageType) FromRef(str js.Ref) GPUCompilationMessageType { 1434 return GPUCompilationMessageType(bindings.ConstOfGPUCompilationMessageType(str)) 1435 } 1436 1437 func (x GPUCompilationMessageType) String() (string, bool) { 1438 switch x { 1439 case GPUCompilationMessageType_ERROR: 1440 return "error", true 1441 case GPUCompilationMessageType_WARNING: 1442 return "warning", true 1443 case GPUCompilationMessageType_INFO: 1444 return "info", true 1445 default: 1446 return "", false 1447 } 1448 } 1449 1450 type GPUCompilationMessage struct { 1451 ref js.Ref 1452 } 1453 1454 func (this GPUCompilationMessage) Once() GPUCompilationMessage { 1455 this.ref.Once() 1456 return this 1457 } 1458 1459 func (this GPUCompilationMessage) Ref() js.Ref { 1460 return this.ref 1461 } 1462 1463 func (this GPUCompilationMessage) FromRef(ref js.Ref) GPUCompilationMessage { 1464 this.ref = ref 1465 return this 1466 } 1467 1468 func (this GPUCompilationMessage) Free() { 1469 this.ref.Free() 1470 } 1471 1472 // Message returns the value of property "GPUCompilationMessage.message". 1473 // 1474 // It returns ok=false if there is no such property. 1475 func (this GPUCompilationMessage) Message() (ret js.String, ok bool) { 1476 ok = js.True == bindings.GetGPUCompilationMessageMessage( 1477 this.ref, js.Pointer(&ret), 1478 ) 1479 return 1480 } 1481 1482 // Type returns the value of property "GPUCompilationMessage.type". 1483 // 1484 // It returns ok=false if there is no such property. 1485 func (this GPUCompilationMessage) Type() (ret GPUCompilationMessageType, ok bool) { 1486 ok = js.True == bindings.GetGPUCompilationMessageType( 1487 this.ref, js.Pointer(&ret), 1488 ) 1489 return 1490 } 1491 1492 // LineNum returns the value of property "GPUCompilationMessage.lineNum". 1493 // 1494 // It returns ok=false if there is no such property. 1495 func (this GPUCompilationMessage) LineNum() (ret uint64, ok bool) { 1496 ok = js.True == bindings.GetGPUCompilationMessageLineNum( 1497 this.ref, js.Pointer(&ret), 1498 ) 1499 return 1500 } 1501 1502 // LinePos returns the value of property "GPUCompilationMessage.linePos". 1503 // 1504 // It returns ok=false if there is no such property. 1505 func (this GPUCompilationMessage) LinePos() (ret uint64, ok bool) { 1506 ok = js.True == bindings.GetGPUCompilationMessageLinePos( 1507 this.ref, js.Pointer(&ret), 1508 ) 1509 return 1510 } 1511 1512 // Offset returns the value of property "GPUCompilationMessage.offset". 1513 // 1514 // It returns ok=false if there is no such property. 1515 func (this GPUCompilationMessage) Offset() (ret uint64, ok bool) { 1516 ok = js.True == bindings.GetGPUCompilationMessageOffset( 1517 this.ref, js.Pointer(&ret), 1518 ) 1519 return 1520 } 1521 1522 // Length returns the value of property "GPUCompilationMessage.length". 1523 // 1524 // It returns ok=false if there is no such property. 1525 func (this GPUCompilationMessage) Length() (ret uint64, ok bool) { 1526 ok = js.True == bindings.GetGPUCompilationMessageLength( 1527 this.ref, js.Pointer(&ret), 1528 ) 1529 return 1530 } 1531 1532 type GPUCompilationInfo struct { 1533 ref js.Ref 1534 } 1535 1536 func (this GPUCompilationInfo) Once() GPUCompilationInfo { 1537 this.ref.Once() 1538 return this 1539 } 1540 1541 func (this GPUCompilationInfo) Ref() js.Ref { 1542 return this.ref 1543 } 1544 1545 func (this GPUCompilationInfo) FromRef(ref js.Ref) GPUCompilationInfo { 1546 this.ref = ref 1547 return this 1548 } 1549 1550 func (this GPUCompilationInfo) Free() { 1551 this.ref.Free() 1552 } 1553 1554 // Messages returns the value of property "GPUCompilationInfo.messages". 1555 // 1556 // It returns ok=false if there is no such property. 1557 func (this GPUCompilationInfo) Messages() (ret js.FrozenArray[GPUCompilationMessage], ok bool) { 1558 ok = js.True == bindings.GetGPUCompilationInfoMessages( 1559 this.ref, js.Pointer(&ret), 1560 ) 1561 return 1562 } 1563 1564 type GPUShaderModule struct { 1565 ref js.Ref 1566 } 1567 1568 func (this GPUShaderModule) Once() GPUShaderModule { 1569 this.ref.Once() 1570 return this 1571 } 1572 1573 func (this GPUShaderModule) Ref() js.Ref { 1574 return this.ref 1575 } 1576 1577 func (this GPUShaderModule) FromRef(ref js.Ref) GPUShaderModule { 1578 this.ref = ref 1579 return this 1580 } 1581 1582 func (this GPUShaderModule) Free() { 1583 this.ref.Free() 1584 } 1585 1586 // Label returns the value of property "GPUShaderModule.label". 1587 // 1588 // It returns ok=false if there is no such property. 1589 func (this GPUShaderModule) Label() (ret js.String, ok bool) { 1590 ok = js.True == bindings.GetGPUShaderModuleLabel( 1591 this.ref, js.Pointer(&ret), 1592 ) 1593 return 1594 } 1595 1596 // SetLabel sets the value of property "GPUShaderModule.label" to val. 1597 // 1598 // It returns false if the property cannot be set. 1599 func (this GPUShaderModule) SetLabel(val js.String) bool { 1600 return js.True == bindings.SetGPUShaderModuleLabel( 1601 this.ref, 1602 val.Ref(), 1603 ) 1604 } 1605 1606 // HasFuncGetCompilationInfo returns true if the method "GPUShaderModule.getCompilationInfo" exists. 1607 func (this GPUShaderModule) HasFuncGetCompilationInfo() bool { 1608 return js.True == bindings.HasFuncGPUShaderModuleGetCompilationInfo( 1609 this.ref, 1610 ) 1611 } 1612 1613 // FuncGetCompilationInfo returns the method "GPUShaderModule.getCompilationInfo". 1614 func (this GPUShaderModule) FuncGetCompilationInfo() (fn js.Func[func() js.Promise[GPUCompilationInfo]]) { 1615 bindings.FuncGPUShaderModuleGetCompilationInfo( 1616 this.ref, js.Pointer(&fn), 1617 ) 1618 return 1619 } 1620 1621 // GetCompilationInfo calls the method "GPUShaderModule.getCompilationInfo". 1622 func (this GPUShaderModule) GetCompilationInfo() (ret js.Promise[GPUCompilationInfo]) { 1623 bindings.CallGPUShaderModuleGetCompilationInfo( 1624 this.ref, js.Pointer(&ret), 1625 ) 1626 1627 return 1628 } 1629 1630 // TryGetCompilationInfo calls the method "GPUShaderModule.getCompilationInfo" 1631 // in a try/catch block and returns (_, err, ok = false) when it went through 1632 // the catch clause. 1633 func (this GPUShaderModule) TryGetCompilationInfo() (ret js.Promise[GPUCompilationInfo], exception js.Any, ok bool) { 1634 ok = js.True == bindings.TryGPUShaderModuleGetCompilationInfo( 1635 this.ref, js.Pointer(&ret), js.Pointer(&exception), 1636 ) 1637 1638 return 1639 }