1 module libwasm.bindings.WebGPU; 2 3 import libwasm.types; 4 5 import memutils.ct: tuple; 6 import libwasm.bindings.WebGPUExtras; 7 8 @safe: 9 nothrow: 10 11 struct WebGPU { 12 nothrow: 13 JsHandle handle; 14 alias handle this; 15 this(Handle h) { 16 this.handle = JsHandle(h); 17 } 18 auto getAdapter()(scope ref WebGPUAdapterDescriptor desc) { 19 return WebGPUAdapter(Object_Call_Handle__Handle(this.handle, "getAdapter", desc.handle)); 20 } 21 auto getAdapter()() { 22 return WebGPUAdapter(Object_Getter__Handle(this.handle, "getAdapter")); 23 } 24 } 25 struct WebGPUAdapter { 26 nothrow: 27 JsHandle handle; 28 alias handle this; 29 this(Handle h) { 30 this.handle = JsHandle(h); 31 } 32 string name()() { 33 return Object_Getter__string(this.handle, "name"); 34 } 35 auto extensions()() { 36 return WebGPUExtensions(Object_Getter__Handle(this.handle, "extensions")); 37 } 38 auto createDevice()(scope ref WebGPUDeviceDescriptor descriptor) { 39 return WebGPUDevice(Object_Call_Handle__Handle(this.handle, "createDevice", descriptor.handle)); 40 } 41 auto createDevice()() { 42 return WebGPUDevice(Object_Getter__Handle(this.handle, "createDevice")); 43 } 44 } 45 struct WebGPUAdapterDescriptor { 46 nothrow: 47 JsHandle handle; 48 alias handle this; 49 this(Handle h) { 50 this.handle = JsHandle(h); 51 } 52 static auto create() { 53 return WebGPUAdapterDescriptor(libwasm_add__object()); 54 } 55 void powerPreference()(WebGPUPowerPreference powerPreference) { 56 Object_Call_int__void(this.handle, "powerPreference", powerPreference); 57 } 58 WebGPUPowerPreference powerPreference()() { 59 return Object_Getter__int(this.handle, "powerPreference"); 60 } 61 } 62 struct WebGPUAttachmentState { 63 nothrow: 64 JsHandle handle; 65 alias handle this; 66 this(Handle h) { 67 this.handle = JsHandle(h); 68 } 69 } 70 struct WebGPUAttachmentStateDescriptor { 71 nothrow: 72 JsHandle handle; 73 alias handle this; 74 this(Handle h) { 75 this.handle = JsHandle(h); 76 } 77 static auto create() { 78 return WebGPUAttachmentStateDescriptor(libwasm_add__object()); 79 } 80 void formats()(scope ref Sequence!(u32) formats) { 81 Object_Call_Handle__void(this.handle, "formats", formats.handle); 82 } 83 auto formats()() { 84 return Sequence!(u32)(Object_Getter__Handle(this.handle, "formats")); 85 } 86 } 87 struct WebGPUBindGroup { 88 nothrow: 89 JsHandle handle; 90 alias handle this; 91 this(Handle h) { 92 this.handle = JsHandle(h); 93 } 94 } 95 struct WebGPUBindGroupBinding { 96 nothrow: 97 JsHandle handle; 98 alias handle this; 99 this(Handle h) { 100 this.handle = JsHandle(h); 101 } 102 static auto create() { 103 return WebGPUBindGroupBinding(libwasm_add__object()); 104 } 105 void visibility()(u32 visibility) { 106 Object_Call_uint__void(this.handle, "visibility", visibility); 107 } 108 u32 visibility()() { 109 return Object_Getter__uint(this.handle, "visibility"); 110 } 111 void type()(u32 type) { 112 Object_Call_uint__void(this.handle, "type", type); 113 } 114 u32 type()() { 115 return Object_Getter__uint(this.handle, "type"); 116 } 117 void start()(u32 start) { 118 Object_Call_uint__void(this.handle, "start", start); 119 } 120 u32 start()() { 121 return Object_Getter__uint(this.handle, "start"); 122 } 123 void count()(u32 count) { 124 Object_Call_uint__void(this.handle, "count", count); 125 } 126 u32 count()() { 127 return Object_Getter__uint(this.handle, "count"); 128 } 129 } 130 struct WebGPUBindGroupDescriptor { 131 nothrow: 132 JsHandle handle; 133 alias handle this; 134 this(Handle h) { 135 this.handle = JsHandle(h); 136 } 137 static auto create() { 138 return WebGPUBindGroupDescriptor(libwasm_add__object()); 139 } 140 void layout()(scope ref WebGPUBindGroupLayout layout) { 141 Object_Call_Handle__void(this.handle, "layout", layout.handle); 142 } 143 auto layout()() { 144 return WebGPUBindGroupLayout(Object_Getter__Handle(this.handle, "layout")); 145 } 146 void bindings()(scope ref Sequence!(WebGPUBinding) bindings) { 147 Object_Call_Handle__void(this.handle, "bindings", bindings.handle); 148 } 149 auto bindings()() { 150 return Sequence!(WebGPUBinding)(Object_Getter__Handle(this.handle, "bindings")); 151 } 152 } 153 struct WebGPUBindGroupLayout { 154 nothrow: 155 JsHandle handle; 156 alias handle this; 157 this(Handle h) { 158 this.handle = JsHandle(h); 159 } 160 } 161 struct WebGPUBindGroupLayoutDescriptor { 162 nothrow: 163 JsHandle handle; 164 alias handle this; 165 this(Handle h) { 166 this.handle = JsHandle(h); 167 } 168 static auto create() { 169 return WebGPUBindGroupLayoutDescriptor(libwasm_add__object()); 170 } 171 void bindingTypes()(scope ref Sequence!(WebGPUBindGroupBinding) bindingTypes) { 172 Object_Call_Handle__void(this.handle, "bindingTypes", bindingTypes.handle); 173 } 174 auto bindingTypes()() { 175 return Sequence!(WebGPUBindGroupBinding)(Object_Getter__Handle(this.handle, "bindingTypes")); 176 } 177 } 178 struct WebGPUBinding { 179 nothrow: 180 JsHandle handle; 181 alias handle this; 182 this(Handle h) { 183 this.handle = JsHandle(h); 184 } 185 static auto create() { 186 return WebGPUBinding(libwasm_add__object()); 187 } 188 void resources()(scope ref Sequence!(WebGPUBindingResource) resources) { 189 Object_Call_Handle__void(this.handle, "resources", resources.handle); 190 } 191 auto resources()() { 192 return Sequence!(WebGPUBindingResource)(Object_Getter__Handle(this.handle, "resources")); 193 } 194 void start()(u32 start) { 195 Object_Call_uint__void(this.handle, "start", start); 196 } 197 u32 start()() { 198 return Object_Getter__uint(this.handle, "start"); 199 } 200 void count()(u32 count) { 201 Object_Call_uint__void(this.handle, "count", count); 202 } 203 u32 count()() { 204 return Object_Getter__uint(this.handle, "count"); 205 } 206 } 207 alias WebGPUBindingResource = SumType!(WebGPUSampler, WebGPUTextureView, WebGPUBufferBinding); 208 struct WebGPUBindingType { 209 nothrow: 210 JsHandle handle; 211 alias handle this; 212 this(Handle h) { 213 this.handle = JsHandle(h); 214 } 215 enum u32 UNIFORM_BUFFER = 0; 216 enum u32 SAMPLER = 1; 217 enum u32 SAMPLED_TEXTURE = 2; 218 enum u32 STORAGE_BUFFER = 3; 219 } 220 alias WebGPUBindingTypeEnum = u32; 221 struct WebGPUBlendDescriptor { 222 nothrow: 223 JsHandle handle; 224 alias handle this; 225 this(Handle h) { 226 this.handle = JsHandle(h); 227 } 228 static auto create() { 229 return WebGPUBlendDescriptor(libwasm_add__object()); 230 } 231 void srcFactor()(u32 srcFactor) { 232 Object_Call_uint__void(this.handle, "srcFactor", srcFactor); 233 } 234 u32 srcFactor()() { 235 return Object_Getter__uint(this.handle, "srcFactor"); 236 } 237 void dstFactor()(u32 dstFactor) { 238 Object_Call_uint__void(this.handle, "dstFactor", dstFactor); 239 } 240 u32 dstFactor()() { 241 return Object_Getter__uint(this.handle, "dstFactor"); 242 } 243 void operation()(u32 operation) { 244 Object_Call_uint__void(this.handle, "operation", operation); 245 } 246 u32 operation()() { 247 return Object_Getter__uint(this.handle, "operation"); 248 } 249 } 250 struct WebGPUBlendFactor { 251 nothrow: 252 JsHandle handle; 253 alias handle this; 254 this(Handle h) { 255 this.handle = JsHandle(h); 256 } 257 enum u32 ZERO = 0; 258 enum u32 ONE = 1; 259 enum u32 SRC_COLOR = 2; 260 enum u32 ONE_MINUS_SRC_COLOR = 3; 261 enum u32 SRC_ALPHA = 4; 262 enum u32 ONE_MINUS_SRC_ALPHA = 5; 263 enum u32 DST_COLOR = 6; 264 enum u32 ONE_MINUS_DST_COLOR = 7; 265 enum u32 DST_ALPHA = 8; 266 enum u32 ONE_MINUS_DST_ALPHA = 9; 267 enum u32 SRC_ALPHA_SATURATED = 10; 268 enum u32 BLEND_COLOR = 11; 269 enum u32 ONE_MINUS_BLEND_COLOR = 12; 270 } 271 alias WebGPUBlendFactorEnum = u32; 272 struct WebGPUBlendOperation { 273 nothrow: 274 JsHandle handle; 275 alias handle this; 276 this(Handle h) { 277 this.handle = JsHandle(h); 278 } 279 enum u32 ADD = 0; 280 enum u32 SUBTRACT = 1; 281 enum u32 REVERSE_SUBTRACT = 2; 282 enum u32 MIN = 3; 283 enum u32 MAX = 4; 284 } 285 alias WebGPUBlendOperationEnum = u32; 286 struct WebGPUBlendState { 287 nothrow: 288 JsHandle handle; 289 alias handle this; 290 this(Handle h) { 291 this.handle = JsHandle(h); 292 } 293 } 294 struct WebGPUBlendStateDescriptor { 295 nothrow: 296 JsHandle handle; 297 alias handle this; 298 this(Handle h) { 299 this.handle = JsHandle(h); 300 } 301 static auto create() { 302 return WebGPUBlendStateDescriptor(libwasm_add__object()); 303 } 304 void blendEnabled()(bool blendEnabled) { 305 Object_Call_bool__void(this.handle, "blendEnabled", blendEnabled); 306 } 307 bool blendEnabled()() { 308 return Object_Getter__bool(this.handle, "blendEnabled"); 309 } 310 void alpha()(scope ref WebGPUBlendDescriptor alpha) { 311 Object_Call_Handle__void(this.handle, "alpha", alpha.handle); 312 } 313 auto alpha()() { 314 return WebGPUBlendDescriptor(Object_Getter__Handle(this.handle, "alpha")); 315 } 316 void color()(scope ref WebGPUBlendDescriptor color) { 317 Object_Call_Handle__void(this.handle, "color", color.handle); 318 } 319 auto color()() { 320 return WebGPUBlendDescriptor(Object_Getter__Handle(this.handle, "color")); 321 } 322 void writeMask()(u32 writeMask) { 323 Object_Call_uint__void(this.handle, "writeMask", writeMask); 324 } 325 u32 writeMask()() { 326 return Object_Getter__uint(this.handle, "writeMask"); 327 } 328 } 329 struct WebGPUBuffer { 330 nothrow: 331 JsHandle handle; 332 alias handle this; 333 this(Handle h) { 334 this.handle = JsHandle(h); 335 } 336 auto mapping()() { 337 return recastOpt!(ArrayBuffer)(Object_Getter__OptionalHandle(this.handle, "mapping")); 338 } 339 void unmap()() { 340 Object_Call__void(this.handle, "unmap"); 341 } 342 } 343 struct WebGPUBufferDescriptor { 344 nothrow: 345 JsHandle handle; 346 alias handle this; 347 this(Handle h) { 348 this.handle = JsHandle(h); 349 } 350 static auto create() { 351 return WebGPUBufferDescriptor(libwasm_add__object()); 352 } 353 void size()(u32 size) { 354 Object_Call_uint__void(this.handle, "size", size); 355 } 356 u32 size()() { 357 return Object_Getter__uint(this.handle, "size"); 358 } 359 void usage()(u32 usage) { 360 Object_Call_uint__void(this.handle, "usage", usage); 361 } 362 u32 usage()() { 363 return Object_Getter__uint(this.handle, "usage"); 364 } 365 } 366 struct WebGPUBufferUsage { 367 nothrow: 368 JsHandle handle; 369 alias handle this; 370 this(Handle h) { 371 this.handle = JsHandle(h); 372 } 373 enum u32 NONE = 0; 374 enum u32 MAP_READ = 1; 375 enum u32 MAP_WRITE = 2; 376 enum u32 TRANSFER_SRC = 4; 377 enum u32 TRANSFER_DST = 8; 378 enum u32 INDEX = 16; 379 enum u32 VERTEX = 32; 380 enum u32 UNIFORM = 64; 381 enum u32 STORAGE = 128; 382 } 383 alias WebGPUBufferUsageFlags = u32; 384 struct WebGPUColorWriteBits { 385 nothrow: 386 JsHandle handle; 387 alias handle this; 388 this(Handle h) { 389 this.handle = JsHandle(h); 390 } 391 enum u32 NONE = 0; 392 enum u32 RED = 1; 393 enum u32 GREEN = 2; 394 enum u32 BLUE = 4; 395 enum u32 ALPHA = 8; 396 enum u32 ALL = 15; 397 } 398 alias WebGPUColorWriteFlags = u32; 399 struct WebGPUCommandBuffer { 400 nothrow: 401 JsHandle handle; 402 alias handle this; 403 this(Handle h) { 404 this.handle = JsHandle(h); 405 } 406 } 407 struct WebGPUCommandEncoder { 408 nothrow: 409 JsHandle handle; 410 alias handle this; 411 this(Handle h) { 412 this.handle = JsHandle(h); 413 } 414 auto finishEncoding()() { 415 return WebGPUCommandBuffer(Object_Getter__Handle(this.handle, "finishEncoding")); 416 } 417 void copyBufferToBuffer()(scope ref WebGPUBuffer src, u32 srcOffset, scope ref WebGPUBuffer dst, u32 dstOffset, u32 size) { 418 Serialize_Object_VarArgCall!void(this.handle, "copyBufferToBuffer", "Handle;u32;Handle;u32;u32", tuple(cast(Handle)src.handle, srcOffset, cast(Handle)dst.handle, dstOffset, size)); 419 } 420 void copyBufferToTexture()() { 421 Object_Call__void(this.handle, "copyBufferToTexture"); 422 } 423 void copyTextureToBuffer()() { 424 Object_Call__void(this.handle, "copyTextureToBuffer"); 425 } 426 void copyTextureToTexture()() { 427 Object_Call__void(this.handle, "copyTextureToTexture"); 428 } 429 void blit()() { 430 Object_Call__void(this.handle, "blit"); 431 } 432 void transitionBuffer()(scope ref WebGPUBuffer b, u32 f) { 433 Serialize_Object_VarArgCall!void(this.handle, "transitionBuffer", "Handle;u32", tuple(cast(Handle)b.handle, f)); 434 } 435 void setPushConstants()(u32 stage, u32 offset, u32 count, scope ref ArrayBuffer data) { 436 Serialize_Object_VarArgCall!void(this.handle, "setPushConstants", "u32;u32;u32;Handle", tuple(stage, offset, count, cast(Handle)data.handle)); 437 } 438 void setBindGroup()(u32 index, scope ref WebGPUBindGroup bindGroup) { 439 Serialize_Object_VarArgCall!void(this.handle, "setBindGroup", "u32;Handle", tuple(index, cast(Handle)bindGroup.handle)); 440 } 441 void setPipeline()(scope ref SumType!(WebGPUComputePipeline, WebGPURenderPipeline) pipeline) { 442 Serialize_Object_VarArgCall!void(this.handle, "setPipeline", "SumType!(Handle,Handle)", tuple(libwasm.sumtype.match!(((ref pipeline.Types[0] v) => 0),((ref pipeline.Types[1] v) => 1))(pipeline),tuple(libwasm.sumtype.match!(((ref pipeline.Types[0] v) => cast(Handle)v.handle),((ref pipeline.Types[1] v) => Handle.init))(pipeline),libwasm.sumtype.match!(((ref pipeline.Types[0] v) => Handle.init),((ref pipeline.Types[1] v) => cast(Handle)v.handle))(pipeline)))); 443 } 444 void beginComputePass()() { 445 Object_Call__void(this.handle, "beginComputePass"); 446 } 447 void endComputePass()() { 448 Object_Call__void(this.handle, "endComputePass"); 449 } 450 void dispatch()(u32 x, u32 y, u32 z) { 451 Serialize_Object_VarArgCall!void(this.handle, "dispatch", "u32;u32;u32", tuple(x, y, z)); 452 } 453 void beginRenderPass()(scope ref WebGPURenderPassDescriptor descriptor) { 454 Object_Call_Handle__void(this.handle, "beginRenderPass", descriptor.handle); 455 } 456 void beginRenderPass()() { 457 Object_Call__void(this.handle, "beginRenderPass"); 458 } 459 void endRenderPass()() { 460 Object_Call__void(this.handle, "endRenderPass"); 461 } 462 void setBlendColor()(float r, float g, float b, float a) { 463 Serialize_Object_VarArgCall!void(this.handle, "setBlendColor", "float;float;float;float", tuple(r, g, b, a)); 464 } 465 void setIndexBuffer()(scope ref WebGPUBuffer buffer, u32 offset) { 466 Serialize_Object_VarArgCall!void(this.handle, "setIndexBuffer", "Handle;u32", tuple(cast(Handle)buffer.handle, offset)); 467 } 468 void setVertexBuffers()(u32 startSlot, scope ref Sequence!(WebGPUBuffer) buffers, scope ref Sequence!(u32) offsets) { 469 Serialize_Object_VarArgCall!void(this.handle, "setVertexBuffers", "u32;Handle;Handle", tuple(startSlot, cast(Handle)buffers.handle, cast(Handle)offsets.handle)); 470 } 471 void draw()(u32 vertexCount, u32 instanceCount, u32 firstVertex, u32 firstInstance) { 472 Serialize_Object_VarArgCall!void(this.handle, "draw", "u32;u32;u32;u32", tuple(vertexCount, instanceCount, firstVertex, firstInstance)); 473 } 474 void drawIndexed()(u32 indexCount, u32 instanceCount, u32 firstIndex, u32 firstInstance, u32 firstVertex) { 475 Serialize_Object_VarArgCall!void(this.handle, "drawIndexed", "u32;u32;u32;u32;u32", tuple(indexCount, instanceCount, firstIndex, firstInstance, firstVertex)); 476 } 477 } 478 struct WebGPUCommandEncoderDescriptor { 479 nothrow: 480 JsHandle handle; 481 alias handle this; 482 this(Handle h) { 483 this.handle = JsHandle(h); 484 } 485 static auto create() { 486 return WebGPUCommandEncoderDescriptor(libwasm_add__object()); 487 } 488 } 489 struct WebGPUCompareFunction { 490 nothrow: 491 JsHandle handle; 492 alias handle this; 493 this(Handle h) { 494 this.handle = JsHandle(h); 495 } 496 enum u32 NEVER = 0; 497 enum u32 LESS = 1; 498 enum u32 LESS_EQUAL = 2; 499 enum u32 GREATER = 3; 500 enum u32 GREATER_EQUAL = 4; 501 enum u32 EQUAL = 5; 502 enum u32 NOT_EQUAL = 6; 503 enum u32 ALWAYS = 7; 504 } 505 alias WebGPUCompareFunctionEnum = u32; 506 struct WebGPUComputePipeline { 507 nothrow: 508 JsHandle handle; 509 alias handle this; 510 this(Handle h) { 511 this.handle = JsHandle(h); 512 } 513 } 514 struct WebGPUComputePipelineDescriptor { 515 nothrow: 516 libwasm.bindings.WebGPU.WebGPUPipelineDescriptorBase _parent; 517 alias _parent this; 518 this(Handle h) { 519 _parent = .WebGPUPipelineDescriptorBase(h); 520 } 521 static auto create() { 522 return WebGPUComputePipelineDescriptor(libwasm_add__object()); 523 } 524 } 525 struct WebGPUDepthStencilState { 526 nothrow: 527 JsHandle handle; 528 alias handle this; 529 this(Handle h) { 530 this.handle = JsHandle(h); 531 } 532 } 533 struct WebGPUDepthStencilStateDescriptor { 534 nothrow: 535 JsHandle handle; 536 alias handle this; 537 this(Handle h) { 538 this.handle = JsHandle(h); 539 } 540 static auto create() { 541 return WebGPUDepthStencilStateDescriptor(libwasm_add__object()); 542 } 543 void depthWriteEnabled()(bool depthWriteEnabled) { 544 Object_Call_bool__void(this.handle, "depthWriteEnabled", depthWriteEnabled); 545 } 546 bool depthWriteEnabled()() { 547 return Object_Getter__bool(this.handle, "depthWriteEnabled"); 548 } 549 void depthCompare()(u32 depthCompare) { 550 Object_Call_uint__void(this.handle, "depthCompare", depthCompare); 551 } 552 u32 depthCompare()() { 553 return Object_Getter__uint(this.handle, "depthCompare"); 554 } 555 void front()(scope ref WebGPUStencilStateFaceDescriptor front) { 556 Object_Call_Handle__void(this.handle, "front", front.handle); 557 } 558 auto front()() { 559 return WebGPUStencilStateFaceDescriptor(Object_Getter__Handle(this.handle, "front")); 560 } 561 void back()(scope ref WebGPUStencilStateFaceDescriptor back) { 562 Object_Call_Handle__void(this.handle, "back", back.handle); 563 } 564 auto back()() { 565 return WebGPUStencilStateFaceDescriptor(Object_Getter__Handle(this.handle, "back")); 566 } 567 void stencilReadMask()(u32 stencilReadMask) { 568 Object_Call_uint__void(this.handle, "stencilReadMask", stencilReadMask); 569 } 570 u32 stencilReadMask()() { 571 return Object_Getter__uint(this.handle, "stencilReadMask"); 572 } 573 void stencilWriteMask()(u32 stencilWriteMask) { 574 Object_Call_uint__void(this.handle, "stencilWriteMask", stencilWriteMask); 575 } 576 u32 stencilWriteMask()() { 577 return Object_Getter__uint(this.handle, "stencilWriteMask"); 578 } 579 } 580 struct WebGPUDevice { 581 nothrow: 582 JsHandle handle; 583 alias handle this; 584 this(Handle h) { 585 this.handle = JsHandle(h); 586 } 587 auto adapter()() { 588 return WebGPUAdapter(Object_Getter__Handle(this.handle, "adapter")); 589 } 590 auto extensions()() { 591 return WebGPUExtensions(Object_Getter__Handle(this.handle, "extensions")); 592 } 593 auto limits()() { 594 return WebGPULimits(Object_Getter__Handle(this.handle, "limits")); 595 } 596 auto createBuffer()(scope ref WebGPUBufferDescriptor descriptor) { 597 return WebGPUBuffer(Object_Call_Handle__Handle(this.handle, "createBuffer", descriptor.handle)); 598 } 599 auto createBuffer()() { 600 return WebGPUBuffer(Object_Getter__Handle(this.handle, "createBuffer")); 601 } 602 auto createTexture()(scope ref WebGPUTextureDescriptor descriptor) { 603 return WebGPUTexture(Object_Call_Handle__Handle(this.handle, "createTexture", descriptor.handle)); 604 } 605 auto createTexture()() { 606 return WebGPUTexture(Object_Getter__Handle(this.handle, "createTexture")); 607 } 608 auto createSampler()(scope ref WebGPUSamplerDescriptor descriptor) { 609 return WebGPUSampler(Object_Call_Handle__Handle(this.handle, "createSampler", descriptor.handle)); 610 } 611 auto createSampler()() { 612 return WebGPUSampler(Object_Getter__Handle(this.handle, "createSampler")); 613 } 614 auto createBindGroupLayout()(scope ref WebGPUBindGroupLayoutDescriptor descriptor) { 615 return WebGPUBindGroupLayout(Object_Call_Handle__Handle(this.handle, "createBindGroupLayout", descriptor.handle)); 616 } 617 auto createBindGroupLayout()() { 618 return WebGPUBindGroupLayout(Object_Getter__Handle(this.handle, "createBindGroupLayout")); 619 } 620 auto createPipelineLayout()(scope ref WebGPUPipelineLayoutDescriptor descriptor) { 621 return WebGPUPipelineLayout(Object_Call_Handle__Handle(this.handle, "createPipelineLayout", descriptor.handle)); 622 } 623 auto createPipelineLayout()() { 624 return WebGPUPipelineLayout(Object_Getter__Handle(this.handle, "createPipelineLayout")); 625 } 626 auto createBindGroup()(scope ref WebGPUBindGroupDescriptor descriptor) { 627 return WebGPUBindGroup(Object_Call_Handle__Handle(this.handle, "createBindGroup", descriptor.handle)); 628 } 629 auto createBindGroup()() { 630 return WebGPUBindGroup(Object_Getter__Handle(this.handle, "createBindGroup")); 631 } 632 auto createBlendState()(scope ref WebGPUBlendStateDescriptor descriptor) { 633 return WebGPUBlendState(Object_Call_Handle__Handle(this.handle, "createBlendState", descriptor.handle)); 634 } 635 auto createBlendState()() { 636 return WebGPUBlendState(Object_Getter__Handle(this.handle, "createBlendState")); 637 } 638 auto createDepthStencilState()(scope ref WebGPUDepthStencilStateDescriptor descriptor) { 639 return WebGPUDepthStencilState(Object_Call_Handle__Handle(this.handle, "createDepthStencilState", descriptor.handle)); 640 } 641 auto createDepthStencilState()() { 642 return WebGPUDepthStencilState(Object_Getter__Handle(this.handle, "createDepthStencilState")); 643 } 644 auto createInputState()(scope ref WebGPUInputStateDescriptor descriptor) { 645 return WebGPUInputState(Object_Call_Handle__Handle(this.handle, "createInputState", descriptor.handle)); 646 } 647 auto createInputState()() { 648 return WebGPUInputState(Object_Getter__Handle(this.handle, "createInputState")); 649 } 650 auto createShaderModule()(scope ref WebGPUShaderModuleDescriptor descriptor) { 651 return WebGPUShaderModule(Object_Call_Handle__Handle(this.handle, "createShaderModule", descriptor.handle)); 652 } 653 auto createAttachmentState()(scope ref WebGPUAttachmentStateDescriptor descriptor) { 654 return WebGPUAttachmentState(Object_Call_Handle__Handle(this.handle, "createAttachmentState", descriptor.handle)); 655 } 656 auto createAttachmentState()() { 657 return WebGPUAttachmentState(Object_Getter__Handle(this.handle, "createAttachmentState")); 658 } 659 auto createComputePipeline()(scope ref WebGPUComputePipelineDescriptor descriptor) { 660 return WebGPUComputePipeline(Object_Call_Handle__Handle(this.handle, "createComputePipeline", descriptor._parent)); 661 } 662 auto createRenderPipeline()(scope ref WebGPURenderPipelineDescriptor descriptor) { 663 return WebGPURenderPipeline(Object_Call_Handle__Handle(this.handle, "createRenderPipeline", descriptor._parent)); 664 } 665 auto createCommandEncoder()(scope ref WebGPUCommandEncoderDescriptor descriptor) { 666 return WebGPUCommandEncoder(Object_Call_Handle__Handle(this.handle, "createCommandEncoder", descriptor.handle)); 667 } 668 auto createCommandEncoder()() { 669 return WebGPUCommandEncoder(Object_Getter__Handle(this.handle, "createCommandEncoder")); 670 } 671 auto getQueue()() { 672 return WebGPUQueue(Object_Getter__Handle(this.handle, "getQueue")); 673 } 674 void onLog()(WebGPULogCallback onLog) { 675 WebGPUDevice_onLog_Set(this.handle, onLog); 676 } 677 WebGPULogCallback onLog()() { 678 return WebGPUDevice_onLog_Get(this.handle); 679 } 680 auto getObjectStatus()(scope ref WebGPUStatusable obj) { 681 return JsPromise!(WebGPUObjectStatus)(Serialize_Object_VarArgCall!Handle(this.handle, "getObjectStatus", "SumType!(Handle,Handle)", tuple(libwasm.sumtype.match!(((ref obj.Types[0] v) => 0),((ref obj.Types[1] v) => 1))(obj),tuple(libwasm.sumtype.match!(((ref obj.Types[0] v) => cast(Handle)v.handle),((ref obj.Types[1] v) => Handle.init))(obj),libwasm.sumtype.match!(((ref obj.Types[0] v) => Handle.init),((ref obj.Types[1] v) => cast(Handle)v.handle))(obj))))); 682 } 683 } 684 struct WebGPUDeviceDescriptor { 685 nothrow: 686 JsHandle handle; 687 alias handle this; 688 this(Handle h) { 689 this.handle = JsHandle(h); 690 } 691 static auto create() { 692 return WebGPUDeviceDescriptor(libwasm_add__object()); 693 } 694 void extensions()(scope ref WebGPUExtensions extensions) { 695 Object_Call_Handle__void(this.handle, "extensions", extensions.handle); 696 } 697 auto extensions()() { 698 return WebGPUExtensions(Object_Getter__Handle(this.handle, "extensions")); 699 } 700 } 701 struct WebGPUExtensions { 702 nothrow: 703 JsHandle handle; 704 alias handle this; 705 this(Handle h) { 706 this.handle = JsHandle(h); 707 } 708 static auto create() { 709 return WebGPUExtensions(libwasm_add__object()); 710 } 711 void anisotropicFiltering()(bool anisotropicFiltering) { 712 Object_Call_bool__void(this.handle, "anisotropicFiltering", anisotropicFiltering); 713 } 714 bool anisotropicFiltering()() { 715 return Object_Getter__bool(this.handle, "anisotropicFiltering"); 716 } 717 void logicOp()(bool logicOp) { 718 Object_Call_bool__void(this.handle, "logicOp", logicOp); 719 } 720 bool logicOp()() { 721 return Object_Getter__bool(this.handle, "logicOp"); 722 } 723 } 724 struct WebGPUFence { 725 nothrow: 726 JsHandle handle; 727 alias handle this; 728 this(Handle h) { 729 this.handle = JsHandle(h); 730 } 731 bool wait()(double milliseconds) { 732 return Serialize_Object_VarArgCall!bool(this.handle, "wait", "double", tuple(milliseconds)); 733 } 734 auto promise()() { 735 return JsPromise!(void)(Object_Getter__Handle(this.handle, "promise")); 736 } 737 } 738 struct WebGPUFilterMode { 739 nothrow: 740 JsHandle handle; 741 alias handle this; 742 this(Handle h) { 743 this.handle = JsHandle(h); 744 } 745 enum u32 NEAREST = 0; 746 enum u32 LINEAR = 1; 747 } 748 alias WebGPUFilterModeEnum = u32; 749 struct WebGPUIndexFormat { 750 nothrow: 751 JsHandle handle; 752 alias handle this; 753 this(Handle h) { 754 this.handle = JsHandle(h); 755 } 756 enum u32 UINT16 = 0; 757 enum u32 UINT32 = 1; 758 } 759 alias WebGPUIndexFormatEnum = u32; 760 struct WebGPUInputState { 761 nothrow: 762 JsHandle handle; 763 alias handle this; 764 this(Handle h) { 765 this.handle = JsHandle(h); 766 } 767 } 768 struct WebGPUInputStateDescriptor { 769 nothrow: 770 JsHandle handle; 771 alias handle this; 772 this(Handle h) { 773 this.handle = JsHandle(h); 774 } 775 static auto create() { 776 return WebGPUInputStateDescriptor(libwasm_add__object()); 777 } 778 void indexFormat()(u32 indexFormat) { 779 Object_Call_uint__void(this.handle, "indexFormat", indexFormat); 780 } 781 u32 indexFormat()() { 782 return Object_Getter__uint(this.handle, "indexFormat"); 783 } 784 void attributes()(scope ref Sequence!(WebGPUVertexAttributeDescriptor) attributes) { 785 Object_Call_Handle__void(this.handle, "attributes", attributes.handle); 786 } 787 auto attributes()() { 788 return Sequence!(WebGPUVertexAttributeDescriptor)(Object_Getter__Handle(this.handle, "attributes")); 789 } 790 void inputs()(scope ref Sequence!(WebGPUVertexInputDescriptor) inputs) { 791 Object_Call_Handle__void(this.handle, "inputs", inputs.handle); 792 } 793 auto inputs()() { 794 return Sequence!(WebGPUVertexInputDescriptor)(Object_Getter__Handle(this.handle, "inputs")); 795 } 796 } 797 struct WebGPUInputStepMode { 798 nothrow: 799 JsHandle handle; 800 alias handle this; 801 this(Handle h) { 802 this.handle = JsHandle(h); 803 } 804 enum u32 VERTEX = 0; 805 enum u32 INSTANCE = 1; 806 } 807 alias WebGPUInputStepModeEnum = u32; 808 struct WebGPULimits { 809 nothrow: 810 JsHandle handle; 811 alias handle this; 812 this(Handle h) { 813 this.handle = JsHandle(h); 814 } 815 static auto create() { 816 return WebGPULimits(libwasm_add__object()); 817 } 818 void maxBindGroups()(u32 maxBindGroups) { 819 Object_Call_uint__void(this.handle, "maxBindGroups", maxBindGroups); 820 } 821 u32 maxBindGroups()() { 822 return Object_Getter__uint(this.handle, "maxBindGroups"); 823 } 824 } 825 struct WebGPULoadOp { 826 nothrow: 827 JsHandle handle; 828 alias handle this; 829 this(Handle h) { 830 this.handle = JsHandle(h); 831 } 832 enum u32 CLEAR = 0; 833 enum u32 LOAD = 1; 834 } 835 alias WebGPULoadOpEnum = u32; 836 alias WebGPULogCallback = void delegate(WebGPULogEntry); 837 struct WebGPULogEntry { 838 nothrow: 839 JsHandle handle; 840 alias handle this; 841 this(Handle h) { 842 this.handle = JsHandle(h); 843 } 844 WebGPULogEntryType type()() { 845 return Object_Getter__int(this.handle, "type"); 846 } 847 auto obj()() { 848 return Any(Object_Getter__Handle(this.handle, "obj")); 849 } 850 Optional!(string) reason()() { 851 return Object_Getter__OptionalString(this.handle, "reason"); 852 } 853 } 854 enum WebGPULogEntryType { 855 device_lost, 856 validation_error, 857 recoverable_out_of_memory 858 } 859 enum WebGPUObjectStatus { 860 valid, 861 out_of_memory, 862 invalid 863 } 864 struct WebGPUPipelineDescriptorBase { 865 nothrow: 866 JsHandle handle; 867 alias handle this; 868 this(Handle h) { 869 this.handle = JsHandle(h); 870 } 871 static auto create() { 872 return WebGPUPipelineDescriptorBase(libwasm_add__object()); 873 } 874 void layout()(scope ref WebGPUPipelineLayout layout) { 875 Object_Call_Handle__void(this.handle, "layout", layout.handle); 876 } 877 auto layout()() { 878 return WebGPUPipelineLayout(Object_Getter__Handle(this.handle, "layout")); 879 } 880 void stages()(scope ref Sequence!(WebGPUPipelineStageDescriptor) stages) { 881 Object_Call_Handle__void(this.handle, "stages", stages.handle); 882 } 883 auto stages()() { 884 return Sequence!(WebGPUPipelineStageDescriptor)(Object_Getter__Handle(this.handle, "stages")); 885 } 886 } 887 struct WebGPUPipelineLayout { 888 nothrow: 889 JsHandle handle; 890 alias handle this; 891 this(Handle h) { 892 this.handle = JsHandle(h); 893 } 894 } 895 struct WebGPUPipelineLayoutDescriptor { 896 nothrow: 897 JsHandle handle; 898 alias handle this; 899 this(Handle h) { 900 this.handle = JsHandle(h); 901 } 902 static auto create() { 903 return WebGPUPipelineLayoutDescriptor(libwasm_add__object()); 904 } 905 void bindGroupLayouts()(scope ref Sequence!(WebGPUBindGroupLayout) bindGroupLayouts) { 906 Object_Call_Handle__void(this.handle, "bindGroupLayouts", bindGroupLayouts.handle); 907 } 908 auto bindGroupLayouts()() { 909 return Sequence!(WebGPUBindGroupLayout)(Object_Getter__Handle(this.handle, "bindGroupLayouts")); 910 } 911 } 912 struct WebGPUPipelineStageDescriptor { 913 nothrow: 914 JsHandle handle; 915 alias handle this; 916 this(Handle h) { 917 this.handle = JsHandle(h); 918 } 919 static auto create() { 920 return WebGPUPipelineStageDescriptor(libwasm_add__object()); 921 } 922 void shaderModule()(scope ref WebGPUShaderModule shaderModule) { 923 Object_Call_Handle__void(this.handle, "shaderModule", shaderModule.handle); 924 } 925 auto shaderModule()() { 926 return WebGPUShaderModule(Object_Getter__Handle(this.handle, "shaderModule")); 927 } 928 void stage()(u32 stage) { 929 Object_Call_uint__void(this.handle, "stage", stage); 930 } 931 u32 stage()() { 932 return Object_Getter__uint(this.handle, "stage"); 933 } 934 void entryPoint()(string entryPoint) { 935 Object_Call_string__void(this.handle, "entryPoint", entryPoint); 936 } 937 string entryPoint()() { 938 return Object_Getter__string(this.handle, "entryPoint"); 939 } 940 } 941 enum WebGPUPowerPreference { 942 default_, 943 low_power, 944 high_performance 945 } 946 struct WebGPUPrimitiveTopology { 947 nothrow: 948 JsHandle handle; 949 alias handle this; 950 this(Handle h) { 951 this.handle = JsHandle(h); 952 } 953 enum u32 POINT_LIST = 0; 954 enum u32 LINE_LIST = 1; 955 enum u32 LINE_STRIP = 2; 956 enum u32 TRIANGLE_LIST = 3; 957 enum u32 TRIANGLE_STRIP = 4; 958 } 959 alias WebGPUPrimitiveTopologyEnum = u32; 960 struct WebGPUProvider { 961 nothrow: 962 JsHandle handle; 963 alias handle this; 964 this(Handle h) { 965 this.handle = JsHandle(h); 966 } 967 auto webgpu()() { 968 return WebGPU(Object_Getter__Handle(this.handle, "webgpu")); 969 } 970 } 971 struct WebGPUQueue { 972 nothrow: 973 JsHandle handle; 974 alias handle this; 975 this(Handle h) { 976 this.handle = JsHandle(h); 977 } 978 void submit()(scope ref Sequence!(WebGPUCommandBuffer) buffers) { 979 Object_Call_Handle__void(this.handle, "submit", buffers.handle); 980 } 981 auto insertFence()() { 982 return WebGPUFence(Object_Getter__Handle(this.handle, "insertFence")); 983 } 984 } 985 struct WebGPURenderPassAttachmentDescriptor { 986 nothrow: 987 JsHandle handle; 988 alias handle this; 989 this(Handle h) { 990 this.handle = JsHandle(h); 991 } 992 static auto create() { 993 return WebGPURenderPassAttachmentDescriptor(libwasm_add__object()); 994 } 995 void attachment()(scope ref WebGPUTextureView attachment) { 996 Object_Call_Handle__void(this.handle, "attachment", attachment.handle); 997 } 998 auto attachment()() { 999 return WebGPUTextureView(Object_Getter__Handle(this.handle, "attachment")); 1000 } 1001 void loadOp()(u32 loadOp) { 1002 Object_Call_uint__void(this.handle, "loadOp", loadOp); 1003 } 1004 u32 loadOp()() { 1005 return Object_Getter__uint(this.handle, "loadOp"); 1006 } 1007 void storeOp()(u32 storeOp) { 1008 Object_Call_uint__void(this.handle, "storeOp", storeOp); 1009 } 1010 u32 storeOp()() { 1011 return Object_Getter__uint(this.handle, "storeOp"); 1012 } 1013 } 1014 struct WebGPURenderPassDescriptor { 1015 nothrow: 1016 JsHandle handle; 1017 alias handle this; 1018 this(Handle h) { 1019 this.handle = JsHandle(h); 1020 } 1021 static auto create() { 1022 return WebGPURenderPassDescriptor(libwasm_add__object()); 1023 } 1024 void colorAttachments()(scope ref Sequence!(WebGPURenderPassAttachmentDescriptor) colorAttachments) { 1025 Object_Call_Handle__void(this.handle, "colorAttachments", colorAttachments.handle); 1026 } 1027 auto colorAttachments()() { 1028 return Sequence!(WebGPURenderPassAttachmentDescriptor)(Object_Getter__Handle(this.handle, "colorAttachments")); 1029 } 1030 void depthStencilAttachment()(scope ref WebGPURenderPassAttachmentDescriptor depthStencilAttachment) { 1031 Object_Call_Handle__void(this.handle, "depthStencilAttachment", depthStencilAttachment.handle); 1032 } 1033 auto depthStencilAttachment()() { 1034 return WebGPURenderPassAttachmentDescriptor(Object_Getter__Handle(this.handle, "depthStencilAttachment")); 1035 } 1036 } 1037 struct WebGPURenderPipeline { 1038 nothrow: 1039 JsHandle handle; 1040 alias handle this; 1041 this(Handle h) { 1042 this.handle = JsHandle(h); 1043 } 1044 } 1045 struct WebGPURenderPipelineDescriptor { 1046 nothrow: 1047 libwasm.bindings.WebGPU.WebGPUPipelineDescriptorBase _parent; 1048 alias _parent this; 1049 this(Handle h) { 1050 _parent = .WebGPUPipelineDescriptorBase(h); 1051 } 1052 static auto create() { 1053 return WebGPURenderPipelineDescriptor(libwasm_add__object()); 1054 } 1055 void primitiveTopology()(u32 primitiveTopology) { 1056 Object_Call_uint__void(this._parent, "primitiveTopology", primitiveTopology); 1057 } 1058 u32 primitiveTopology()() { 1059 return Object_Getter__uint(this._parent, "primitiveTopology"); 1060 } 1061 void blendState()(scope ref Sequence!(WebGPUBlendState) blendState) { 1062 Object_Call_Handle__void(this._parent, "blendState", blendState.handle); 1063 } 1064 auto blendState()() { 1065 return Sequence!(WebGPUBlendState)(Object_Getter__Handle(this._parent, "blendState")); 1066 } 1067 void depthStencilState()(scope ref WebGPUDepthStencilState depthStencilState) { 1068 Object_Call_Handle__void(this._parent, "depthStencilState", depthStencilState.handle); 1069 } 1070 auto depthStencilState()() { 1071 return WebGPUDepthStencilState(Object_Getter__Handle(this._parent, "depthStencilState")); 1072 } 1073 void inputState()(scope ref WebGPUInputState inputState) { 1074 Object_Call_Handle__void(this._parent, "inputState", inputState.handle); 1075 } 1076 auto inputState()() { 1077 return WebGPUInputState(Object_Getter__Handle(this._parent, "inputState")); 1078 } 1079 void attachmentState()(scope ref WebGPUAttachmentState attachmentState) { 1080 Object_Call_Handle__void(this._parent, "attachmentState", attachmentState.handle); 1081 } 1082 auto attachmentState()() { 1083 return WebGPUAttachmentState(Object_Getter__Handle(this._parent, "attachmentState")); 1084 } 1085 } 1086 struct WebGPUSampler { 1087 nothrow: 1088 JsHandle handle; 1089 alias handle this; 1090 this(Handle h) { 1091 this.handle = JsHandle(h); 1092 } 1093 } 1094 struct WebGPUSamplerDescriptor { 1095 nothrow: 1096 JsHandle handle; 1097 alias handle this; 1098 this(Handle h) { 1099 this.handle = JsHandle(h); 1100 } 1101 static auto create() { 1102 return WebGPUSamplerDescriptor(libwasm_add__object()); 1103 } 1104 void magFilter()(u32 magFilter) { 1105 Object_Call_uint__void(this.handle, "magFilter", magFilter); 1106 } 1107 u32 magFilter()() { 1108 return Object_Getter__uint(this.handle, "magFilter"); 1109 } 1110 void minFilter()(u32 minFilter) { 1111 Object_Call_uint__void(this.handle, "minFilter", minFilter); 1112 } 1113 u32 minFilter()() { 1114 return Object_Getter__uint(this.handle, "minFilter"); 1115 } 1116 void mipmapFilter()(u32 mipmapFilter) { 1117 Object_Call_uint__void(this.handle, "mipmapFilter", mipmapFilter); 1118 } 1119 u32 mipmapFilter()() { 1120 return Object_Getter__uint(this.handle, "mipmapFilter"); 1121 } 1122 } 1123 struct WebGPUShaderModule { 1124 nothrow: 1125 JsHandle handle; 1126 alias handle this; 1127 this(Handle h) { 1128 this.handle = JsHandle(h); 1129 } 1130 } 1131 struct WebGPUShaderModuleDescriptor { 1132 nothrow: 1133 JsHandle handle; 1134 alias handle this; 1135 this(Handle h) { 1136 this.handle = JsHandle(h); 1137 } 1138 static auto create() { 1139 return WebGPUShaderModuleDescriptor(libwasm_add__object()); 1140 } 1141 void code()(scope ref ArrayBuffer code) { 1142 Object_Call_Handle__void(this.handle, "code", code.handle); 1143 } 1144 auto code()() { 1145 return ArrayBuffer(Object_Getter__Handle(this.handle, "code")); 1146 } 1147 } 1148 struct WebGPUShaderStage { 1149 nothrow: 1150 JsHandle handle; 1151 alias handle this; 1152 this(Handle h) { 1153 this.handle = JsHandle(h); 1154 } 1155 enum u32 VERTEX = 0; 1156 enum u32 FRAGMENT = 1; 1157 enum u32 COMPUTE = 2; 1158 } 1159 struct WebGPUShaderStageBit { 1160 nothrow: 1161 JsHandle handle; 1162 alias handle this; 1163 this(Handle h) { 1164 this.handle = JsHandle(h); 1165 } 1166 enum u32 NONE = 0; 1167 enum u32 VERTEX = 1; 1168 enum u32 FRAGMENT = 2; 1169 enum u32 COMPUTE = 4; 1170 } 1171 alias WebGPUShaderStageEnum = u32; 1172 alias WebGPUShaderStageFlags = u32; 1173 alias WebGPUStatusable = SumType!(WebGPUBuffer, WebGPUTexture); 1174 struct WebGPUStencilOperation { 1175 nothrow: 1176 JsHandle handle; 1177 alias handle this; 1178 this(Handle h) { 1179 this.handle = JsHandle(h); 1180 } 1181 enum u32 KEEP = 0; 1182 enum u32 ZERO = 1; 1183 enum u32 REPLACE = 2; 1184 enum u32 INVERT = 3; 1185 enum u32 INCREMENT_CLAMP = 4; 1186 enum u32 DECREMENT_CLAMP = 5; 1187 enum u32 INCREMENT_WRAP = 6; 1188 enum u32 DECREMENT_WRAP = 7; 1189 } 1190 alias WebGPUStencilOperationEnum = u32; 1191 struct WebGPUStencilStateFaceDescriptor { 1192 nothrow: 1193 JsHandle handle; 1194 alias handle this; 1195 this(Handle h) { 1196 this.handle = JsHandle(h); 1197 } 1198 static auto create() { 1199 return WebGPUStencilStateFaceDescriptor(libwasm_add__object()); 1200 } 1201 void compare()(u32 compare) { 1202 Object_Call_uint__void(this.handle, "compare", compare); 1203 } 1204 u32 compare()() { 1205 return Object_Getter__uint(this.handle, "compare"); 1206 } 1207 void stencilFailOp()(u32 stencilFailOp) { 1208 Object_Call_uint__void(this.handle, "stencilFailOp", stencilFailOp); 1209 } 1210 u32 stencilFailOp()() { 1211 return Object_Getter__uint(this.handle, "stencilFailOp"); 1212 } 1213 void depthFailOp()(u32 depthFailOp) { 1214 Object_Call_uint__void(this.handle, "depthFailOp", depthFailOp); 1215 } 1216 u32 depthFailOp()() { 1217 return Object_Getter__uint(this.handle, "depthFailOp"); 1218 } 1219 void passOp()(u32 passOp) { 1220 Object_Call_uint__void(this.handle, "passOp", passOp); 1221 } 1222 u32 passOp()() { 1223 return Object_Getter__uint(this.handle, "passOp"); 1224 } 1225 } 1226 struct WebGPUStoreOp { 1227 nothrow: 1228 JsHandle handle; 1229 alias handle this; 1230 this(Handle h) { 1231 this.handle = JsHandle(h); 1232 } 1233 enum u32 STORE = 0; 1234 } 1235 alias WebGPUStoreOpEnum = u32; 1236 struct WebGPUSwapChain { 1237 nothrow: 1238 JsHandle handle; 1239 alias handle this; 1240 this(Handle h) { 1241 this.handle = JsHandle(h); 1242 } 1243 void configure()(scope ref WebGPUSwapChainDescriptor descriptor) { 1244 Object_Call_Handle__void(this.handle, "configure", descriptor.handle); 1245 } 1246 void configure()() { 1247 Object_Call__void(this.handle, "configure"); 1248 } 1249 auto getNextTexture()() { 1250 return WebGPUTexture(Object_Getter__Handle(this.handle, "getNextTexture")); 1251 } 1252 void present()() { 1253 Object_Call__void(this.handle, "present"); 1254 } 1255 } 1256 struct WebGPUSwapChainDescriptor { 1257 nothrow: 1258 JsHandle handle; 1259 alias handle this; 1260 this(Handle h) { 1261 this.handle = JsHandle(h); 1262 } 1263 static auto create() { 1264 return WebGPUSwapChainDescriptor(libwasm_add__object()); 1265 } 1266 void usage()(u32 usage) { 1267 Object_Call_uint__void(this.handle, "usage", usage); 1268 } 1269 u32 usage()() { 1270 return Object_Getter__uint(this.handle, "usage"); 1271 } 1272 void format()(u32 format) { 1273 Object_Call_uint__void(this.handle, "format", format); 1274 } 1275 u32 format()() { 1276 return Object_Getter__uint(this.handle, "format"); 1277 } 1278 void width()(u32 width) { 1279 Object_Call_uint__void(this.handle, "width", width); 1280 } 1281 u32 width()() { 1282 return Object_Getter__uint(this.handle, "width"); 1283 } 1284 void height()(u32 height) { 1285 Object_Call_uint__void(this.handle, "height", height); 1286 } 1287 u32 height()() { 1288 return Object_Getter__uint(this.handle, "height"); 1289 } 1290 } 1291 struct WebGPUTexture { 1292 nothrow: 1293 JsHandle handle; 1294 alias handle this; 1295 this(Handle h) { 1296 this.handle = JsHandle(h); 1297 } 1298 auto createTextureView()(scope ref WebGPUTextureViewDescriptor desc) { 1299 return WebGPUTextureView(Object_Call_Handle__Handle(this.handle, "createTextureView", desc.handle)); 1300 } 1301 auto createTextureView()() { 1302 return WebGPUTextureView(Object_Getter__Handle(this.handle, "createTextureView")); 1303 } 1304 } 1305 struct WebGPUTextureDescriptor { 1306 nothrow: 1307 JsHandle handle; 1308 alias handle this; 1309 this(Handle h) { 1310 this.handle = JsHandle(h); 1311 } 1312 static auto create() { 1313 return WebGPUTextureDescriptor(libwasm_add__object()); 1314 } 1315 void width()(u32 width) { 1316 Object_Call_uint__void(this.handle, "width", width); 1317 } 1318 u32 width()() { 1319 return Object_Getter__uint(this.handle, "width"); 1320 } 1321 void height()(u32 height) { 1322 Object_Call_uint__void(this.handle, "height", height); 1323 } 1324 u32 height()() { 1325 return Object_Getter__uint(this.handle, "height"); 1326 } 1327 void depth()(u32 depth) { 1328 Object_Call_uint__void(this.handle, "depth", depth); 1329 } 1330 u32 depth()() { 1331 return Object_Getter__uint(this.handle, "depth"); 1332 } 1333 void arraySize()(u32 arraySize) { 1334 Object_Call_uint__void(this.handle, "arraySize", arraySize); 1335 } 1336 u32 arraySize()() { 1337 return Object_Getter__uint(this.handle, "arraySize"); 1338 } 1339 void dimension()(u32 dimension) { 1340 Object_Call_uint__void(this.handle, "dimension", dimension); 1341 } 1342 u32 dimension()() { 1343 return Object_Getter__uint(this.handle, "dimension"); 1344 } 1345 void format()(u32 format) { 1346 Object_Call_uint__void(this.handle, "format", format); 1347 } 1348 u32 format()() { 1349 return Object_Getter__uint(this.handle, "format"); 1350 } 1351 void usage()(u32 usage) { 1352 Object_Call_uint__void(this.handle, "usage", usage); 1353 } 1354 u32 usage()() { 1355 return Object_Getter__uint(this.handle, "usage"); 1356 } 1357 } 1358 struct WebGPUTextureDimension { 1359 nothrow: 1360 JsHandle handle; 1361 alias handle this; 1362 this(Handle h) { 1363 this.handle = JsHandle(h); 1364 } 1365 enum u32 e1D = 0; 1366 enum u32 e2D = 1; 1367 enum u32 e3D = 2; 1368 } 1369 alias WebGPUTextureDimensionEnum = u32; 1370 struct WebGPUTextureFormat { 1371 nothrow: 1372 JsHandle handle; 1373 alias handle this; 1374 this(Handle h) { 1375 this.handle = JsHandle(h); 1376 } 1377 enum u32 R8_G8_B8_A8_UNORM = 0; 1378 enum u32 R8_G8_B8_A8_UINT = 1; 1379 enum u32 B8_G8_R8_A8_UNORM = 2; 1380 enum u32 D32_FLOAT_S8_UINT = 3; 1381 } 1382 alias WebGPUTextureFormatEnum = u32; 1383 struct WebGPUTextureUsage { 1384 nothrow: 1385 JsHandle handle; 1386 alias handle this; 1387 this(Handle h) { 1388 this.handle = JsHandle(h); 1389 } 1390 enum u32 NONE = 0; 1391 enum u32 TRANSFER_SRC = 1; 1392 enum u32 TRANSFER_DST = 2; 1393 enum u32 SAMPLED = 4; 1394 enum u32 STORAGE = 8; 1395 enum u32 OUTPUT_ATTACHMENT = 16; 1396 enum u32 PRESENT = 32; 1397 } 1398 alias WebGPUTextureUsageFlags = u32; 1399 struct WebGPUTextureView { 1400 nothrow: 1401 JsHandle handle; 1402 alias handle this; 1403 this(Handle h) { 1404 this.handle = JsHandle(h); 1405 } 1406 } 1407 struct WebGPUTextureViewDescriptor { 1408 nothrow: 1409 JsHandle handle; 1410 alias handle this; 1411 this(Handle h) { 1412 this.handle = JsHandle(h); 1413 } 1414 static auto create() { 1415 return WebGPUTextureViewDescriptor(libwasm_add__object()); 1416 } 1417 } 1418 struct WebGPUVertexAttributeDescriptor { 1419 nothrow: 1420 JsHandle handle; 1421 alias handle this; 1422 this(Handle h) { 1423 this.handle = JsHandle(h); 1424 } 1425 static auto create() { 1426 return WebGPUVertexAttributeDescriptor(libwasm_add__object()); 1427 } 1428 void shaderLocation()(u32 shaderLocation) { 1429 Object_Call_uint__void(this.handle, "shaderLocation", shaderLocation); 1430 } 1431 u32 shaderLocation()() { 1432 return Object_Getter__uint(this.handle, "shaderLocation"); 1433 } 1434 void inputSlot()(u32 inputSlot) { 1435 Object_Call_uint__void(this.handle, "inputSlot", inputSlot); 1436 } 1437 u32 inputSlot()() { 1438 return Object_Getter__uint(this.handle, "inputSlot"); 1439 } 1440 void offset()(u32 offset) { 1441 Object_Call_uint__void(this.handle, "offset", offset); 1442 } 1443 u32 offset()() { 1444 return Object_Getter__uint(this.handle, "offset"); 1445 } 1446 void format()(u32 format) { 1447 Object_Call_uint__void(this.handle, "format", format); 1448 } 1449 u32 format()() { 1450 return Object_Getter__uint(this.handle, "format"); 1451 } 1452 } 1453 struct WebGPUVertexFormat { 1454 nothrow: 1455 JsHandle handle; 1456 alias handle this; 1457 this(Handle h) { 1458 this.handle = JsHandle(h); 1459 } 1460 enum u32 FLOAT_R32_G32_B32_A32 = 0; 1461 enum u32 FLOAT_R32_G32_B32 = 1; 1462 enum u32 FLOAT_R32_G32 = 2; 1463 enum u32 FLOAT_R32 = 3; 1464 } 1465 alias WebGPUVertexFormatEnum = u32; 1466 struct WebGPUVertexInputDescriptor { 1467 nothrow: 1468 JsHandle handle; 1469 alias handle this; 1470 this(Handle h) { 1471 this.handle = JsHandle(h); 1472 } 1473 static auto create() { 1474 return WebGPUVertexInputDescriptor(libwasm_add__object()); 1475 } 1476 void inputSlot()(u32 inputSlot) { 1477 Object_Call_uint__void(this.handle, "inputSlot", inputSlot); 1478 } 1479 u32 inputSlot()() { 1480 return Object_Getter__uint(this.handle, "inputSlot"); 1481 } 1482 void stride()(u32 stride) { 1483 Object_Call_uint__void(this.handle, "stride", stride); 1484 } 1485 u32 stride()() { 1486 return Object_Getter__uint(this.handle, "stride"); 1487 } 1488 void stepMode()(u32 stepMode) { 1489 Object_Call_uint__void(this.handle, "stepMode", stepMode); 1490 } 1491 u32 stepMode()() { 1492 return Object_Getter__uint(this.handle, "stepMode"); 1493 } 1494 } 1495 alias u32 = uint; 1496 alias u64 = uint; 1497 1498 1499 extern (C) void WebGPUDevice_onLog_Set(Handle, WebGPULogCallback); 1500 extern (C) WebGPULogCallback WebGPUDevice_onLog_Get(Handle);