@luma.gl/webgpu 9.0.0-alpha.9 → 9.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/LICENSE +3 -1
  2. package/dist/adapter/helpers/accessor-to-format.js.map +1 -1
  3. package/dist/adapter/helpers/convert-texture-format.d.ts +2 -2
  4. package/dist/adapter/helpers/convert-texture-format.d.ts.map +1 -1
  5. package/dist/adapter/helpers/convert-texture-format.js +0 -1
  6. package/dist/adapter/helpers/convert-texture-format.js.map +1 -1
  7. package/dist/adapter/helpers/generate-mipmaps.d.ts +1 -1
  8. package/dist/adapter/helpers/generate-mipmaps.js +20 -15
  9. package/dist/adapter/helpers/generate-mipmaps.js.map +1 -1
  10. package/dist/adapter/helpers/get-bind-group.d.ts +4 -4
  11. package/dist/adapter/helpers/get-bind-group.d.ts.map +1 -1
  12. package/dist/adapter/helpers/get-bind-group.js +11 -18
  13. package/dist/adapter/helpers/get-bind-group.js.map +1 -1
  14. package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts +5 -5
  15. package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts.map +1 -1
  16. package/dist/adapter/helpers/get-vertex-buffer-layout.js +39 -43
  17. package/dist/adapter/helpers/get-vertex-buffer-layout.js.map +1 -1
  18. package/dist/adapter/helpers/webgpu-parameters.d.ts +2 -2
  19. package/dist/adapter/helpers/webgpu-parameters.d.ts.map +1 -1
  20. package/dist/adapter/helpers/webgpu-parameters.js +14 -20
  21. package/dist/adapter/helpers/webgpu-parameters.js.map +1 -1
  22. package/dist/adapter/resources/webgpu-buffer.d.ts +14 -5
  23. package/dist/adapter/resources/webgpu-buffer.d.ts.map +1 -1
  24. package/dist/adapter/resources/webgpu-buffer.js +19 -29
  25. package/dist/adapter/resources/webgpu-buffer.js.map +1 -1
  26. package/dist/adapter/resources/webgpu-command-encoder.d.ts +7 -14
  27. package/dist/adapter/resources/webgpu-command-encoder.d.ts.map +1 -1
  28. package/dist/adapter/resources/webgpu-command-encoder.js +13 -27
  29. package/dist/adapter/resources/webgpu-command-encoder.js.map +1 -1
  30. package/dist/adapter/resources/webgpu-compute-pass.d.ts +5 -5
  31. package/dist/adapter/resources/webgpu-compute-pass.d.ts.map +1 -1
  32. package/dist/adapter/resources/webgpu-compute-pass.js +13 -27
  33. package/dist/adapter/resources/webgpu-compute-pass.js.map +1 -1
  34. package/dist/adapter/resources/webgpu-compute-pipeline.d.ts +4 -4
  35. package/dist/adapter/resources/webgpu-compute-pipeline.d.ts.map +1 -1
  36. package/dist/adapter/resources/webgpu-compute-pipeline.js +8 -13
  37. package/dist/adapter/resources/webgpu-compute-pipeline.js.map +1 -1
  38. package/dist/adapter/resources/webgpu-external-texture.d.ts +5 -5
  39. package/dist/adapter/resources/webgpu-external-texture.d.ts.map +1 -1
  40. package/dist/adapter/resources/webgpu-external-texture.js +6 -14
  41. package/dist/adapter/resources/webgpu-external-texture.js.map +1 -1
  42. package/dist/adapter/resources/webgpu-framebuffer.d.ts +4 -21
  43. package/dist/adapter/resources/webgpu-framebuffer.d.ts.map +1 -1
  44. package/dist/adapter/resources/webgpu-framebuffer.js +4 -105
  45. package/dist/adapter/resources/webgpu-framebuffer.js.map +1 -1
  46. package/dist/adapter/resources/webgpu-query.js.map +1 -1
  47. package/dist/adapter/resources/webgpu-render-pass.d.ts +12 -7
  48. package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
  49. package/dist/adapter/resources/webgpu-render-pass.js +53 -36
  50. package/dist/adapter/resources/webgpu-render-pass.js.map +1 -1
  51. package/dist/adapter/resources/webgpu-render-pipeline.d.ts +15 -22
  52. package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
  53. package/dist/adapter/resources/webgpu-render-pipeline.js +46 -118
  54. package/dist/adapter/resources/webgpu-render-pipeline.js.map +1 -1
  55. package/dist/adapter/resources/webgpu-sampler.d.ts +5 -5
  56. package/dist/adapter/resources/webgpu-sampler.d.ts.map +1 -1
  57. package/dist/adapter/resources/webgpu-sampler.js +8 -14
  58. package/dist/adapter/resources/webgpu-sampler.js.map +1 -1
  59. package/dist/adapter/resources/webgpu-shader.d.ts +9 -9
  60. package/dist/adapter/resources/webgpu-shader.d.ts.map +1 -1
  61. package/dist/adapter/resources/webgpu-shader.js +16 -29
  62. package/dist/adapter/resources/webgpu-shader.js.map +1 -1
  63. package/dist/adapter/resources/webgpu-texture.d.ts +18 -8
  64. package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
  65. package/dist/adapter/resources/webgpu-texture.js +38 -33
  66. package/dist/adapter/resources/webgpu-texture.js.map +1 -1
  67. package/dist/adapter/resources/webgpu-vertex-array.d.ts +26 -0
  68. package/dist/adapter/resources/webgpu-vertex-array.d.ts.map +1 -0
  69. package/dist/adapter/resources/webgpu-vertex-array.js +45 -0
  70. package/dist/adapter/resources/webgpu-vertex-array.js.map +1 -0
  71. package/dist/adapter/webgpu-canvas-context.d.ts +17 -12
  72. package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
  73. package/dist/adapter/webgpu-canvas-context.js +26 -47
  74. package/dist/adapter/webgpu-canvas-context.js.map +1 -1
  75. package/dist/adapter/webgpu-device.d.ts +34 -17
  76. package/dist/adapter/webgpu-device.d.ts.map +1 -1
  77. package/dist/adapter/webgpu-device.js +94 -103
  78. package/dist/adapter/webgpu-device.js.map +1 -1
  79. package/dist/adapter/webgpu-types.js.map +1 -1
  80. package/dist/dist.dev.js +3142 -0
  81. package/dist/glsl/glsllang.js +0 -1
  82. package/dist/glsl/glsllang.js.map +1 -1
  83. package/dist/index.cjs +1550 -0
  84. package/dist/index.d.ts +5 -7
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/index.js +5 -7
  87. package/dist/index.js.map +1 -1
  88. package/dist.min.js +30 -0
  89. package/package.json +18 -9
  90. package/src/adapter/helpers/accessor-to-format.ts +1 -2
  91. package/src/adapter/helpers/convert-texture-format.ts +1 -1
  92. package/src/adapter/helpers/generate-mipmaps.ts +2 -2
  93. package/src/adapter/helpers/get-bind-group.ts +23 -13
  94. package/src/adapter/helpers/get-vertex-buffer-layout.ts +65 -39
  95. package/src/adapter/helpers/webgpu-parameters.ts +20 -14
  96. package/src/adapter/resources/webgpu-buffer.ts +63 -8
  97. package/src/adapter/resources/webgpu-command-encoder.ts +68 -48
  98. package/src/adapter/resources/webgpu-compute-pass.ts +13 -12
  99. package/src/adapter/resources/webgpu-compute-pipeline.ts +8 -7
  100. package/src/adapter/resources/webgpu-external-texture.ts +5 -5
  101. package/src/adapter/resources/webgpu-framebuffer.ts +8 -109
  102. package/src/adapter/resources/webgpu-query.ts +3 -3
  103. package/src/adapter/resources/webgpu-render-pass.ts +68 -15
  104. package/src/adapter/resources/webgpu-render-pipeline.ts +117 -97
  105. package/src/adapter/resources/webgpu-sampler.ts +6 -6
  106. package/src/adapter/resources/webgpu-shader.ts +25 -16
  107. package/src/adapter/resources/webgpu-texture.ts +54 -25
  108. package/src/adapter/resources/webgpu-vertex-array.ts +83 -0
  109. package/src/adapter/webgpu-canvas-context.ts +51 -26
  110. package/src/adapter/webgpu-device.ts +144 -48
  111. package/src/index.ts +7 -9
  112. package/dist/bundle.d.ts +0 -2
  113. package/dist/bundle.d.ts.map +0 -1
  114. package/dist/bundle.js +0 -5
  115. package/dist/bundle.js.map +0 -1
  116. package/dist/init.d.ts +0 -2
  117. package/dist/init.d.ts.map +0 -1
  118. package/dist/init.js +0 -4
  119. package/dist/init.js.map +0 -1
  120. package/src/bundle.ts +0 -4
  121. package/src/init.ts +0 -4
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapter/helpers/webgpu-parameters.ts"],"names":["addDepthStencil","descriptor","depthStencil","format","stencilFront","stencilBack","PARAMETER_TABLE","cullMode","parameter","value","primitive","frontFace","depthWriteEnabled","depthCompare","depthFormat","depthBias","depthBiasSlopeScale","depthBiasClamp","stencilReadMask","stencilWriteMask","stencilCompare","compare","stencilPassOperation","passOp","stencilFailOperation","failOp","stencilDepthFailOperation","depthFailOp","sampleCount","multisample","count","sampleMask","mask","sampleAlphaToCoverageEnabled","alphaToCoverageEnabled","colorMask","targets","addColorState","writeMask","blendColorOperation","target","DEFAULT_PIPELINE_DESCRIPTOR","topology","vertex","module","undefined","entryPoint","fragment","applyParametersToRenderPipelineDescriptor","pipelineDescriptor","parameters","Object","assign","setParameters","key","entries","setterFunction","Error","Array","isArray","length","push"],"mappings":"AAEA,SAASA,eAAT,CAAyBC,UAAzB,EAAwF;AACtFA,EAAAA,UAAU,CAACC,YAAX,GAA0BD,UAAU,CAACC,YAAX,IAA2B;AAEnDC,IAAAA,MAAM,EAAE,aAF2C;AAGnDC,IAAAA,YAAY,EAAE,EAHqC;AAInDC,IAAAA,WAAW,EAAE;AAJsC,GAArD;AAMA,SAAOJ,UAAU,CAACC,YAAlB;AACD;;AAOD,OAAO,MAAMI,eAAmD,GAAG;AAGjEC,EAAAA,QAAQ,EAAE,CAACC,SAAD,EAA8BC,KAA9B,EAA0CR,UAA1C,KAAsF;AAC9FA,IAAAA,UAAU,CAACS,SAAX,GAAuBT,UAAU,CAACS,SAAX,IAAwB,EAA/C;AACAT,IAAAA,UAAU,CAACS,SAAX,CAAqBH,QAArB,GAAgCE,KAAhC;AACD,GANgE;AAQjEE,EAAAA,SAAS,EAAE,CAACH,SAAD,EAA8BC,KAA9B,EAA0CR,UAA1C,KAAsF;AAC/FA,IAAAA,UAAU,CAACS,SAAX,GAAuBT,UAAU,CAACS,SAAX,IAAwB,EAA/C;AACAT,IAAAA,UAAU,CAACS,SAAX,CAAqBC,SAArB,GAAiCF,KAAjC;AACD,GAXgE;AAejEG,EAAAA,iBAAiB,EAAE,CAACJ,SAAD,EAA8BC,KAA9B,EAA0CR,UAA1C,KAAsF;AACvG,UAAMC,YAAY,GAAGF,eAAe,CAACC,UAAD,CAApC;AACAC,IAAAA,YAAY,CAACU,iBAAb,GAAiCH,KAAjC;AACD,GAlBgE;AAoBjEI,EAAAA,YAAY,EAAE,C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FAA8BwB,MAA9B,MAAyC,CAA7C,EAAgD;AAAA;;AAC9C,6BAAA3D,UAAU,CAAC8C,QAAX,CAAoBX,OAApB,gFAA6ByB,IAA7B,CAAkC,EAAlC;AACD;;AACD,kCAAO5D,UAAU,CAAC8C,QAAlB,0DAAO,sBAAqBX,OAA5B;AACD","sourcesContent":["import {Parameters} from '@luma.gl/api';\n\nfunction addDepthStencil(descriptor: GPURenderPipelineDescriptor): GPUDepthStencilState {\n descriptor.depthStencil = descriptor.depthStencil || {\n // required, set something\n format: 'depth24plus',\n stencilFront: {},\n stencilBack: {}\n };\n return descriptor.depthStencil;\n}\n\n/**\n * Supports for luma.gl's flat parameter space\n * Populates the corresponding sub-objects in a GPURenderPipelineDescriptor\n */\n// @ts-expect-error\nexport const PARAMETER_TABLE: Record<keyof Parameters, Function> = {\n // RASTERIZATION PARAMETERS\n\n cullMode: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.primitive = descriptor.primitive || {};\n descriptor.primitive.cullMode = value;\n },\n\n frontFace: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.primitive = descriptor.primitive || {};\n descriptor.primitive.frontFace = value;\n },\n\n // DEPTH\n\n depthWriteEnabled: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthWriteEnabled = value;\n },\n\n depthCompare: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthCompare = value;\n },\n\n depthFormat: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.format = value;\n },\n\n depthBias: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthBias = value;\n },\n\n depthBiasSlopeScale: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthBiasSlopeScale = value;\n },\n\n depthBiasClamp: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthBiasClamp = value;\n },\n\n // STENCIL\n\n stencilReadMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilReadMask = value;\n },\n\n stencilWriteMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilWriteMask = value;\n },\n\n stencilCompare: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilFront!.compare = value;\n depthStencil.stencilBack!.compare = value;\n },\n\n stencilPassOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilFront!.passOp = value;\n depthStencil.stencilBack!.passOp = value;\n },\n\n stencilFailOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilFront!.failOp = value;\n depthStencil.stencilBack!.failOp = value;\n },\n\n stencilDepthFailOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilFront!.depthFailOp = value;\n depthStencil.stencilBack!.depthFailOp = value;\n },\n\n // MULTISAMPLE\n\n sampleCount: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.multisample = descriptor.multisample || {};\n descriptor.multisample.count = value;\n },\n\n sampleMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.multisample = descriptor.multisample || {};\n descriptor.multisample.mask = value;\n },\n\n sampleAlphaToCoverageEnabled: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.multisample = descriptor.multisample || {};\n descriptor.multisample.alphaToCoverageEnabled = value;\n },\n\n // COLOR\n\n colorMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const targets = addColorState(descriptor);\n targets[0].writeMask = value;\n },\n\n blendColorOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const targets = addColorState(descriptor);\n const target = targets[0];\n // const blend: GPUBlendState = target.blend || {color: {alpha: 0}};\n // blend.color = blend.color || {};\n // target.blend.color.operation = value;\n }\n\n /*\n blendColorSrcTarget: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.color = targets[0].blend.color || {};\n targets[0].blend.color.srcTarget = value;\n },\n\n blendColorDstTarget: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.color = targets[0].blend.color || {};\n targets[0].blend.color.dstTarget = value;\n },\n\n blendAlphaOperation: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.alpha = targets[0].blend.alpha || {};\n targets[0].blend.alpha.operation = value;\n },\n\n blendAlphaSrcTarget: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.alpha = targets[0].blend.alpha || {};\n targets[0].blend.alpha.srcTarget = value;\n },\n\n blendAlphaDstTarget: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.alpha = targets[0].blend.alpha || {};\n targets[0].blend.alpha.dstTarget = value;\n },\n */\n};\n\nconst DEFAULT_PIPELINE_DESCRIPTOR: GPURenderPipelineDescriptor = {\n // depthStencil: {\n // stencilFront: {},\n // stencilBack: {},\n // // depthWriteEnabled: true,\n // // depthCompare: 'less',\n // // format: 'depth24plus-stencil8',\n // },\n\n primitive: {\n cullMode: 'back',\n topology: 'triangle-list'\n },\n\n vertex: {\n module: undefined!,\n entryPoint: 'main'\n },\n\n fragment: {\n module: undefined!,\n entryPoint: 'main',\n targets: [\n // { format: props.color0Format || 'bgra8unorm' }\n ]\n }\n};\n\nexport function applyParametersToRenderPipelineDescriptor(\n pipelineDescriptor: GPURenderPipelineDescriptor,\n parameters: Parameters = {}\n): void {\n // Apply defaults\n Object.assign(pipelineDescriptor, {...DEFAULT_PIPELINE_DESCRIPTOR, ...pipelineDescriptor});\n setParameters(pipelineDescriptor, parameters);\n}\n\n// Apply any supplied parameters\nfunction setParameters(\n pipelineDescriptor: GPURenderPipelineDescriptor,\n parameters: Parameters\n): void {\n for (const [key, value] of Object.entries(parameters)) {\n const setterFunction = PARAMETER_TABLE[key as keyof Parameters];\n if (!setterFunction) {\n throw new Error(`Illegal parameter ${key}`);\n }\n setterFunction(key, value, pipelineDescriptor);\n }\n}\n\nfunction addColorState(descriptor: GPURenderPipelineDescriptor): GPUColorTargetState[] {\n descriptor.fragment!.targets = descriptor.fragment?.targets || [];\n if (!Array.isArray(descriptor.fragment?.targets)) {\n throw new Error('colorstate');\n }\n if (descriptor.fragment?.targets?.length === 0) {\n descriptor.fragment.targets?.push({});\n }\n return descriptor.fragment?.targets as GPUColorTargetState[];\n}\n"],"file":"webgpu-parameters.js"}
1
+ {"version":3,"file":"webgpu-parameters.js","names":["addDepthStencil","descriptor","depthStencil","format","stencilFront","stencilBack","depthWriteEnabled","depthCompare","PARAMETER_TABLE","cullMode","parameter","value","primitive","frontFace","depthFormat","depthBias","depthBiasSlopeScale","depthBiasClamp","stencilReadMask","stencilWriteMask","stencilCompare","compare","stencilPassOperation","passOp","stencilFailOperation","failOp","stencilDepthFailOperation","depthFailOp","sampleCount","multisample","count","sampleMask","mask","sampleAlphaToCoverageEnabled","alphaToCoverageEnabled","colorMask","targets","addColorState","writeMask","blendColorOperation","DEFAULT_PIPELINE_DESCRIPTOR","topology","vertex","module","undefined","entryPoint","fragment","layout","applyParametersToRenderPipelineDescriptor","pipelineDescriptor","parameters","arguments","length","Object","assign","setParameters","key","entries","setterFunction","Error","_descriptor$fragment","_descriptor$fragment2","_descriptor$fragment3","_descriptor$fragment4","Array","isArray","_descriptor$fragment$","push"],"sources":["../../../src/adapter/helpers/webgpu-parameters.ts"],"sourcesContent":["import {Parameters} from '@luma.gl/core';\n\nfunction addDepthStencil(descriptor: GPURenderPipelineDescriptor): GPUDepthStencilState {\n descriptor.depthStencil = descriptor.depthStencil || {\n // required, set something\n format: 'depth24plus',\n stencilFront: {},\n stencilBack: {},\n // TODO can this cause trouble? Should we set to WebGPU defaults? Are there defaults?\n depthWriteEnabled: false,\n depthCompare: 'less-equal'\n };\n return descriptor.depthStencil;\n}\n\n/**\n * Supports for luma.gl's flat parameter space\n * Populates the corresponding sub-objects in a GPURenderPipelineDescriptor\n */\n// @ts-expect-error\nexport const PARAMETER_TABLE: Record<keyof Parameters, Function> = {\n // RASTERIZATION PARAMETERS\n\n cullMode: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.primitive = descriptor.primitive || {};\n descriptor.primitive.cullMode = value;\n },\n\n frontFace: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.primitive = descriptor.primitive || {};\n descriptor.primitive.frontFace = value;\n },\n\n // DEPTH\n\n depthWriteEnabled: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthWriteEnabled = value;\n },\n\n depthCompare: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthCompare = value;\n },\n\n depthFormat: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.format = value;\n },\n\n depthBias: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthBias = value;\n },\n\n depthBiasSlopeScale: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthBiasSlopeScale = value;\n },\n\n depthBiasClamp: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthBiasClamp = value;\n },\n\n // STENCIL\n\n stencilReadMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilReadMask = value;\n },\n\n stencilWriteMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilWriteMask = value;\n },\n\n stencilCompare: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilFront.compare = value;\n depthStencil.stencilBack.compare = value;\n },\n\n stencilPassOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilFront.passOp = value;\n depthStencil.stencilBack.passOp = value;\n },\n\n stencilFailOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilFront.failOp = value;\n depthStencil.stencilBack.failOp = value;\n },\n\n stencilDepthFailOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilFront.depthFailOp = value;\n depthStencil.stencilBack.depthFailOp = value;\n },\n\n // MULTISAMPLE\n\n sampleCount: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.multisample = descriptor.multisample || {};\n descriptor.multisample.count = value;\n },\n\n sampleMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.multisample = descriptor.multisample || {};\n descriptor.multisample.mask = value;\n },\n\n sampleAlphaToCoverageEnabled: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.multisample = descriptor.multisample || {};\n descriptor.multisample.alphaToCoverageEnabled = value;\n },\n\n // COLOR\n\n colorMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n const targets = addColorState(descriptor);\n targets[0].writeMask = value;\n },\n\n blendColorOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n // const targets = addColorState(descriptor);\n // const target = targets[0];\n // const blend: GPUBlendState = target.blend || {color: {alpha: 0}};\n // blend.color = blend.color || {};\n // target.blend.color.operation = value;\n }\n\n /*\n blendColorSrcTarget: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.color = targets[0].blend.color || {};\n targets[0].blend.color.srcTarget = value;\n },\n\n blendColorDstTarget: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.color = targets[0].blend.color || {};\n targets[0].blend.color.dstTarget = value;\n },\n\n blendAlphaOperation: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.alpha = targets[0].blend.alpha || {};\n targets[0].blend.alpha.operation = value;\n },\n\n blendAlphaSrcTarget: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.alpha = targets[0].blend.alpha || {};\n targets[0].blend.alpha.srcTarget = value;\n },\n\n blendAlphaDstTarget: (parameter, value, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.alpha = targets[0].blend.alpha || {};\n targets[0].blend.alpha.dstTarget = value;\n },\n */\n};\n\nconst DEFAULT_PIPELINE_DESCRIPTOR: GPURenderPipelineDescriptor = {\n // depthStencil: {\n // stencilFront: {},\n // stencilBack: {},\n // // depthWriteEnabled: true,\n // // depthCompare: 'less',\n // // format: 'depth24plus-stencil8',\n // },\n\n primitive: {\n cullMode: 'back',\n topology: 'triangle-list'\n },\n\n vertex: {\n module: undefined!,\n entryPoint: 'main'\n },\n\n fragment: {\n module: undefined!,\n entryPoint: 'main',\n targets: [\n // { format: props.color0Format || 'bgra8unorm' }\n ]\n },\n\n layout: 'auto'\n};\n\nexport function applyParametersToRenderPipelineDescriptor(\n pipelineDescriptor: GPURenderPipelineDescriptor,\n parameters: Parameters = {}\n): void {\n // Apply defaults\n Object.assign(pipelineDescriptor, {...DEFAULT_PIPELINE_DESCRIPTOR, ...pipelineDescriptor});\n setParameters(pipelineDescriptor, parameters);\n}\n\n// Apply any supplied parameters\nfunction setParameters(\n pipelineDescriptor: GPURenderPipelineDescriptor,\n parameters: Parameters\n): void {\n for (const [key, value] of Object.entries(parameters)) {\n const setterFunction = PARAMETER_TABLE[key as keyof Parameters];\n if (!setterFunction) {\n throw new Error(`Illegal parameter ${key}`);\n }\n setterFunction(key, value, pipelineDescriptor);\n }\n}\n\nfunction addColorState(descriptor: GPURenderPipelineDescriptor): GPUColorTargetState[] {\n descriptor.fragment.targets = descriptor.fragment?.targets || [];\n if (!Array.isArray(descriptor.fragment?.targets)) {\n throw new Error('colorstate');\n }\n if (descriptor.fragment?.targets?.length === 0) {\n descriptor.fragment.targets?.push({});\n }\n return descriptor.fragment?.targets as GPUColorTargetState[];\n}\n"],"mappings":"AAEA,SAASA,eAAeA,CAACC,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AACF,GAAG,EAAE7C,KAAK,EAAEsC,kBAAkB,CAAC;EAChD;AACF;AAEA,SAASZ,aAAaA,CAACpC,UAAuC,EAAyB;EAAA,IAAA2D,oBAAA,EAAAC,qBAAA,EAAAC,qBAAA,EAAAC,qBAAA;EACrF9D,UAAU,CAAC6C,QAAQ,CAACV,OAAO,GAAG,EAAAwB,oBAAA,GAAA3D,UAAU,CAAC6C,QAAQ,cAAAc,oBAAA,uBAAnBA,oBAAA,CAAqBxB,OAAO,KAAI,EAAE;EAChE,IAAI,CAAC4B,KAAK,CAACC,OAAO,EAAAJ,qBAAA,GAAC5D,UAAU,CAAC6C,QAAQ,cAAAe,qBAAA,uBAAnBA,qBAAA,CAAqBzB,OAAO,CAAC,EAAE;IAChD,MAAM,IAAIuB,KAAK,CAAC,YAAY,CAAC;EAC/B;EACA,IAAI,EAAAG,qBAAA,GAAA7D,UAAU,CAAC6C,QAAQ,cAAAgB,qBAAA,gBAAAA,qBAAA,GAAnBA,qBAAA,CAAqB1B,OAAO,cAAA0B,qBAAA,uBAA5BA,qBAAA,CAA8BV,MAAM,MAAK,CAAC,EAAE;IAAA,IAAAc,qBAAA;IAC9C,CAAAA,qBAAA,GAAAjE,UAAU,CAAC6C,QAAQ,CAACV,OAAO,cAAA8B,qBAAA,uBAA3BA,qBAAA,CAA6BC,IAAI,CAAC,CAAC,CAAC,CAAC;EACvC;EACA,QAAAJ,qBAAA,GAAO9D,UAAU,CAAC6C,QAAQ,cAAAiB,qBAAA,uBAAnBA,qBAAA,CAAqB3B,OAAO;AACrC"}
@@ -1,17 +1,26 @@
1
- /// <reference types="@webgpu/types" />
2
- import { Buffer, BufferProps } from '@luma.gl/api';
3
- import type WebGPUDevice from '../webgpu-device';
4
- export default class WebGPUBuffer extends Buffer {
1
+ /// <reference types="dist" />
2
+ import { Buffer, BufferProps } from '@luma.gl/core';
3
+ import type { WebGPUDevice } from '../webgpu-device';
4
+ export declare class WebGPUBuffer extends Buffer {
5
5
  readonly device: WebGPUDevice;
6
6
  readonly handle: GPUBuffer;
7
7
  readonly byteLength: number;
8
8
  constructor(device: WebGPUDevice, props: BufferProps);
9
9
  destroy(): void;
10
10
  write(data: ArrayBufferView, byteOffset?: number): void;
11
- readAsync(byteOffset?: number, byteLength?: number): Promise<ArrayBuffer>;
11
+ readAsync(byteOffset?: number, byteLength?: number): Promise<Uint8Array>;
12
12
  _writeMapped<TypedArray>(typedArray: TypedArray): void;
13
13
  mapAsync(mode: number, offset?: number, size?: number): Promise<void>;
14
14
  getMappedRange(offset?: number, size?: number): ArrayBuffer;
15
15
  unmap(): void;
16
16
  }
17
+ /** Maps the memory so that it can be read *
18
+ // abstract mapAsync(mode, byteOffset, byteLength): Promise<void>
19
+
20
+ /** Get the mapped range of data for reading or writing *
21
+ // abstract getMappedRange(byteOffset, byteLength): ArrayBuffer;
22
+
23
+ /** unmap makes the contents of the buffer available to the GPU again *
24
+ // abstract unmap(): void;
25
+ */
17
26
  //# sourceMappingURL=webgpu-buffer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-buffer.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,MAAM,EAAE,WAAW,EAAS,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;AAMjD,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,MAAM;IAC9C,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW;IAyBpD,OAAO,IAAI,IAAI;IAKf,KAAK,CAAC,IAAI,EAAE,eAAe,EAAE,UAAU,SAAI;IAUrC,SAAS,CAAC,UAAU,GAAE,MAAU,EAAE,UAAU,GAAE,MAAwB,GAAG,OAAO,CAAC,WAA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50 +1,41 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { Buffer } from '@luma.gl/api';
3
-
1
+ import { Buffer } from '@luma.gl/core';
4
2
  function getByteLength(props) {
5
3
  var _props$data;
6
-
7
4
  return props.byteLength || ((_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.byteLength) || 0;
8
5
  }
9
-
10
- export default class WebGPUBuffer extends Buffer {
6
+ export class WebGPUBuffer extends Buffer {
11
7
  constructor(device, props) {
12
8
  super(device, props);
13
-
14
- _defineProperty(this, "device", void 0);
15
-
16
- _defineProperty(this, "handle", void 0);
17
-
18
- _defineProperty(this, "byteLength", void 0);
19
-
9
+ this.device = void 0;
10
+ this.handle = void 0;
11
+ this.byteLength = void 0;
20
12
  this.device = device;
21
13
  this.byteLength = getByteLength(props);
22
14
  const mapBuffer = Boolean(props.data);
15
+ const size = Math.ceil(this.byteLength / 4) * 4;
23
16
  this.handle = this.props.handle || this.device.handle.createBuffer({
24
- size: this.byteLength,
17
+ size,
25
18
  usage: this.props.usage || GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST,
26
19
  mappedAtCreation: this.props.mappedAtCreation || mapBuffer,
27
20
  label: this.props.id
28
21
  });
29
-
30
22
  if (props.data) {
31
23
  this._writeMapped(props.data);
32
24
  }
33
-
34
25
  if (mapBuffer && !props.mappedAtCreation) {
35
26
  this.handle.unmap();
36
27
  }
37
28
  }
38
-
39
29
  destroy() {
40
30
  this.handle.destroy();
41
31
  }
42
-
43
- write(data, byteOffset = 0) {
32
+ write(data) {
33
+ let byteOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
44
34
  this.device.handle.queue.writeBuffer(this.handle, byteOffset, data.buffer, data.byteOffset, data.byteLength);
45
35
  }
46
-
47
- async readAsync(byteOffset = 0, byteLength = this.byteLength) {
36
+ async readAsync() {
37
+ let byteOffset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
38
+ let byteLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.byteLength;
48
39
  const tempBuffer = new WebGPUBuffer(this.device, {
49
40
  usage: Buffer.MAP_READ | Buffer.COPY_DST,
50
41
  byteLength
@@ -56,25 +47,24 @@ export default class WebGPUBuffer extends Buffer {
56
47
  const arrayBuffer = tempBuffer.handle.getMappedRange().slice(0);
57
48
  tempBuffer.handle.unmap();
58
49
  tempBuffer.destroy();
59
- return arrayBuffer;
50
+ return new Uint8Array(arrayBuffer);
60
51
  }
61
-
62
52
  _writeMapped(typedArray) {
63
53
  const arrayBuffer = this.handle.getMappedRange();
64
54
  new typedArray.constructor(arrayBuffer).set(typedArray);
65
55
  }
66
-
67
- mapAsync(mode, offset = 0, size) {
56
+ mapAsync(mode) {
57
+ let offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
58
+ let size = arguments.length > 2 ? arguments[2] : undefined;
68
59
  return this.handle.mapAsync(mode, offset, size);
69
60
  }
70
-
71
- getMappedRange(offset = 0, size) {
61
+ getMappedRange() {
62
+ let offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
63
+ let size = arguments.length > 1 ? arguments[1] : undefined;
72
64
  return this.handle.getMappedRange(offset, size);
73
65
  }
74
-
75
66
  unmap() {
76
67
  this.handle.unmap();
77
68
  }
78
-
79
69
  }
80
70
  //# sourceMappingURL=webgpu-buffer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapter/resources/webgpu-buffer.ts"],"names":["Buffer","getByteLength","props","byteLength","data","WebGPUBuffer","constructor","device","mapBuffer","Boolean","handle","createBuffer","size","usage","GPUBufferUsage","VERTEX","COPY_DST","mappedAtCreation","label","id","_writeMapped","unmap","destroy","write","byteOffset","queue","writeBuffer","buffer","readAsync","tempBuffer","MAP_READ","commandEncoder","createCommandEncoder","copyBufferToBuffer","submit","finish","mapAsync","GPUMapMode","READ","arrayBuffer","getMappedRange","slice","typedArray","set","mode","offset"],"mappings":";AACA,SAAQA,MAAR,QAA0C,cAA1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,GAAxC,CAA4CD,UAA5C;AACD;;AAIDN,EAAAA,QAAQ,CAACQ,IAAD,EAAeC,MAAc,GAAG,CAAhC,EAAmCjC,IAAnC,EAAiE;AACvE,WAAO,KAAKF,MAAL,CAAY0B,QAAZ,CAAqBQ,IAArB,EAA2BC,MAA3B,EAAmCjC,IAAnC,CAAP;AACD;;AAED4B,EAAAA,cAAc,CAACK,MAAc,GAAG,CAAlB,EAAqBjC,IAArB,EAAiD;AAC7D,WAAO,KAAKF,MAAL,CAAY8B,cAAZ,CAA2BK,MAA3B,EAAmCjC,IAAnC,CAAP;AACD;;AAEDS,EAAAA,KAAK,GAAS;AACZ,SAAKX,MAAL,CAAYW,KAAZ;AACD;;AAlF8C","sourcesContent":["// WEBGPU Buffer implementation\nimport {Buffer, BufferProps, assert} from '@luma.gl/api';\nimport type WebGPUDevice from '../webgpu-device';\n\nfunction getByteLength(props: BufferProps): number {\n return props.byteLength || props.data?.byteLength || 0;\n}\n\nexport default class WebGPUBuffer extends Buffer {\n readonly device: WebGPUDevice;\n readonly handle: GPUBuffer;\n readonly byteLength: number;\n\n constructor(device: WebGPUDevice, props: BufferProps) {\n super(device, props);\n this.device = device;\n\n this.byteLength = getByteLength(props);\n const mapBuffer = Boolean(props.data);\n\n this.handle = this.props.handle || this.device.handle.createBuffer({\n size: this.byteLength,\n // usage defaults to vertex\n usage: this.props.usage || (GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST),\n mappedAtCreation: this.props.mappedAtCreation || mapBuffer,\n label: this.props.id\n });\n\n if (props.data) {\n this._writeMapped(props.data);\n // this.handle.writeAsync({data: props.data, map: false, unmap: false});\n }\n\n if (mapBuffer && !props.mappedAtCreation) {\n this.handle.unmap();\n }\n }\n\n destroy(): void {\n this.handle.destroy();\n }\n\n // WebGPU provides multiple ways to write a buffer...\n write(data: ArrayBufferView, byteOffset = 0) {\n this.device.handle.queue.writeBuffer(\n this.handle,\n byteOffset,\n data.buffer,\n data.byteOffset,\n data.byteLength\n );\n }\n\n async readAsync(byteOffset: number = 0, byteLength: number = this.byteLength): Promise<ArrayBuffer> {\n // We need MAP_READ flag, but only COPY_DST buffers can have MAP_READ flag, so we need to create a temp buffer\n const tempBuffer = new WebGPUBuffer(this.device, {usage: Buffer.MAP_READ | Buffer.COPY_DST, byteLength});\n\n // Now do a GPU-side copy into the temp buffer we can actually read.\n // TODO - we are spinning up an independent command queue here, what does this mean\n const commandEncoder = this.device.handle.createCommandEncoder();\n commandEncoder.copyBufferToBuffer(this.handle, byteOffset, tempBuffer.handle, 0, byteLength);\n this.device.handle.queue.submit([commandEncoder.finish()]);\n\n // Map the temp buffer and read the data.\n await tempBuffer.handle.mapAsync(GPUMapMode.READ, byteOffset, byteLength);\n const arrayBuffer = tempBuffer.handle.getMappedRange().slice(0);\n tempBuffer.handle.unmap();\n tempBuffer.destroy();\n\n return arrayBuffer;\n }\n\n _writeMapped<TypedArray>(typedArray: TypedArray): void {\n const arrayBuffer = this.handle.getMappedRange();\n // @ts-expect-error\n new typedArray.constructor(arrayBuffer).set(typedArray);\n }\n\n // WEBGPU API\n\n mapAsync(mode: number, offset: number = 0, size?: number): Promise<void> {\n return this.handle.mapAsync(mode, offset, size);\n }\n\n getMappedRange(offset: number = 0, size?: number): ArrayBuffer {\n return this.handle.getMappedRange(offset, size);\n }\n\n unmap(): void {\n this.handle.unmap();\n }\n}\n"],"file":"webgpu-buffer.js"}
1
+ {"version":3,"file":"webgpu-buffer.js","names":["Buffer","getByteLength","props","_props$data","byteLength","data","WebGPUBuffer","constructor","device","handle","mapBuffer","Boolean","size","Math","ceil","createBuffer","usage","GPUBufferUsage","VERTEX","COPY_DST","mappedAtCreation","label","id","_writeMapped","unmap","destroy","write","byteOffset","arguments","length","undefined","queue","writeBuffer","buffer","readAsync","tempBuffer","MAP_READ","commandEncoder","createCommandEncoder","copyBufferToBuffer","submit","finish","mapAsync","GPUMapMode","READ","arrayBuffer","getMappedRange","slice","Uint8Array","typedArray","set","mode","offset"],"sources":["../../../src/adapter/resources/webgpu-buffer.ts"],"sourcesContent":["// WEBGPU Buffer implementation\nimport {Buffer, BufferProps} from '@luma.gl/core';\nimport type {WebGPUDevice} from '../webgpu-device';\n\nfunction getByteLength(props: BufferProps): number {\n return props.byteLength || props.data?.byteLength || 0;\n}\n\nexport class WebGPUBuffer extends Buffer {\n readonly device: WebGPUDevice;\n readonly handle: GPUBuffer;\n readonly byteLength: number;\n\n constructor(device: WebGPUDevice, props: BufferProps) {\n super(device, props);\n this.device = device;\n\n this.byteLength = getByteLength(props);\n const mapBuffer = Boolean(props.data);\n\n // WebGPU buffers must be aligned to 4 bytes\n const size = Math.ceil(this.byteLength / 4) * 4;\n\n this.handle = this.props.handle || this.device.handle.createBuffer({\n size,\n // usage defaults to vertex\n usage: this.props.usage || (GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST),\n mappedAtCreation: this.props.mappedAtCreation || mapBuffer,\n label: this.props.id\n });\n\n if (props.data) {\n this._writeMapped(props.data);\n // this.handle.writeAsync({data: props.data, map: false, unmap: false});\n }\n\n if (mapBuffer && !props.mappedAtCreation) {\n this.handle.unmap();\n }\n }\n\n override destroy(): void {\n this.handle.destroy();\n }\n\n // WebGPU provides multiple ways to write a buffer...\n override write(data: ArrayBufferView, byteOffset = 0) {\n this.device.handle.queue.writeBuffer(\n this.handle,\n byteOffset,\n data.buffer,\n data.byteOffset,\n data.byteLength\n );\n }\n\n override async readAsync(byteOffset: number = 0, byteLength: number = this.byteLength): Promise<Uint8Array> {\n // We need MAP_READ flag, but only COPY_DST buffers can have MAP_READ flag, so we need to create a temp buffer\n const tempBuffer = new WebGPUBuffer(this.device, {usage: Buffer.MAP_READ | Buffer.COPY_DST, byteLength});\n\n // Now do a GPU-side copy into the temp buffer we can actually read.\n // TODO - we are spinning up an independent command queue here, what does this mean\n const commandEncoder = this.device.handle.createCommandEncoder();\n commandEncoder.copyBufferToBuffer(this.handle, byteOffset, tempBuffer.handle, 0, byteLength);\n this.device.handle.queue.submit([commandEncoder.finish()]);\n\n // Map the temp buffer and read the data.\n await tempBuffer.handle.mapAsync(GPUMapMode.READ, byteOffset, byteLength);\n const arrayBuffer = tempBuffer.handle.getMappedRange().slice(0);\n tempBuffer.handle.unmap();\n tempBuffer.destroy();\n\n return new Uint8Array(arrayBuffer);\n }\n\n _writeMapped<TypedArray>(typedArray: TypedArray): void {\n const arrayBuffer = this.handle.getMappedRange();\n // @ts-expect-error\n new typedArray.constructor(arrayBuffer).set(typedArray);\n }\n\n // WEBGPU API\n\n mapAsync(mode: number, offset: number = 0, size?: number): Promise<void> {\n return this.handle.mapAsync(mode, offset, size);\n }\n\n getMappedRange(offset: number = 0, size?: number): ArrayBuffer {\n return this.handle.getMappedRange(offset, size);\n }\n\n unmap(): void {\n this.handle.unmap();\n }\n}\n\n/*\n// Convenience API\n /** Read data from the buffer *\n async readAsync(options: {\n byteOffset?: number,\n byteLength?: number,\n map?: boolean,\n unmap?: boolean\n }): Promise<ArrayBuffer> {\n if (options.map ?? true) {\n await this.mapAsync(Buffer.MAP_READ, options.byteOffset, options.byteLength);\n }\n const arrayBuffer = this.getMappedRange(options.byteOffset, options.byteLength);\n if (options.unmap ?? true) {\n this.unmap();\n }\n return arrayBuffer;\n }\n\n /** Write data to the buffer *\n async writeAsync(options: {\n data: ArrayBuffer,\n byteOffset?: number,\n byteLength?: number,\n map?: boolean,\n unmap?: boolean\n }): Promise<void> {\n if (options.map ?? true) {\n await this.mapAsync(Buffer.MAP_WRITE, options.byteOffset, options.byteLength);\n }\n const arrayBuffer = this.getMappedRange(options.byteOffset, options.byteLength);\n const destArray = new Uint8Array(arrayBuffer);\n const srcArray = new Uint8Array(options.data);\n destArray.set(srcArray);\n if (options.unmap ?? true) {\n this.unmap();\n }\n }\n */\n\n// Mapped API (WebGPU)\n\n/** Maps the memory so that it can be read *\n // abstract mapAsync(mode, byteOffset, byteLength): Promise<void>\n\n /** Get the mapped range of data for reading or writing *\n // abstract getMappedRange(byteOffset, byteLength): ArrayBuffer;\n\n /** unmap makes the contents of the buffer available to the GPU again *\n // abstract unmap(): void;\n*/\n"],"mappings":"AACA,SAAQA,MAAM,QAAoB,eAAe;AAGjD,SAASC,aAAaA,CAACC,KAAkB,EAAU;EAAA,IAAAC,WAAA;EACjD,OAAOD,KAAK,CAACE,UAAU,MAAAD,WAAA,GAAID,KAAK,CAACG,IAAI,cAAAF,WAAA,uBAAVA,WAAA,CAAYC,UAAU,KAAI,CAAC;AACxD;AAEA,OAAO,MAAME,YAAY,SAASN,MAAM,CAAC;EAKvCO,WAAWA,CAACC,MAAoB,EAAEN,KAAkB,EAAE;IACpD,KAAK,CAACM,MAAM,EAAEN,KAAK,CAAC;IAAC,KALdM,MAAM;IAAA,KACNC,MAAM;IAAA,KACNL,UAAU;IAIjB,IAAI,CAACI,MAAM,GAAGA,MAAM;IAEpB,IAAI,CAACJ,UAAU,GAAGH,aAAa,CAACC,KAAK,CAAC;IACtC,MAAMQ,SAAS,GAAGC,OAAO,CAACT,KAAK,CAACG,IAAI,CAAC;IAGrC,MAAMO,IAAI,GAAGC,IAAI,CAACC,IAAI,CAAC,IAAI,CAACV,UAAU,GAAG,CAAC,CAAC,GAAG,CAAC;IAE/C,IAAI,CAACK,MAAM,GAAG,IAAI,CAACP,KAAK,CAACO,MAAM,IAAI,IAAI,CAACD,MAAM,CAACC,MAAM,CAACM,YAAY,CAAC;MACjEH,IAAI;MAEJI,KAAK,EAAE,IAAI,CAACd,KAAK,CAACc,KAAK,IAAKC,cAAc,CAACC,MAAM,GAAGD,cAAc,CAACE,QAAS;MAC5EC,gBAAgB,EAAE,IAAI,CAAClB,KAAK,CAACkB,gBAAgB,IAAIV,SAAS;MAC1DW,KAAK,EAAE,IAAI,CAACnB,KAAK,CAACoB;IACpB,CAAC,CAAC;IAEF,IAAIpB,KAAK,CAACG,IAAI,EAAE;MACd,IAAI,CAACkB,YAAY,CAACrB,KAAK,CAACG,IAAI,CAAC;IAE/B;IAEA,IAAIK,SAAS,IAAI,CAACR,KAAK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ACF"}
@@ -1,7 +1,8 @@
1
- /// <reference types="@webgpu/types" />
2
- import { CommandEncoder, CommandEncoderProps, Buffer, Texture } from '@luma.gl/api';
3
- import WebGPUDevice from '../webgpu-device';
4
- export default class WebGPUCommandEncoder extends CommandEncoder {
1
+ /// <reference types="dist" />
2
+ import { CommandEncoder, CommandEncoderProps, Buffer, Texture } from '@luma.gl/core';
3
+ import type { CopyTextureToTextureOptions, CopyTextureToBufferOptions } from '@luma.gl/core';
4
+ import { WebGPUDevice } from '../webgpu-device';
5
+ export declare class WebGPUCommandEncoder extends CommandEncoder {
5
6
  readonly device: WebGPUDevice;
6
7
  readonly handle: GPUCommandEncoder;
7
8
  constructor(device: WebGPUDevice, props: CommandEncoderProps);
@@ -27,16 +28,8 @@ export default class WebGPUCommandEncoder extends CommandEncoder {
27
28
  origin?: number[] | [number, number, number];
28
29
  extent?: number[] | [number, number, number];
29
30
  }): void;
30
- copyTextureToBuffer(options: {
31
- source: GPUImageCopyTexture;
32
- destination: GPUImageCopyBuffer;
33
- copySize: GPUExtent3D;
34
- }): void;
35
- copyTextureToTexture(options: {
36
- source: GPUImageCopyTexture;
37
- destination: GPUImageCopyTexture;
38
- copySize: GPUExtent3D;
39
- }): void;
31
+ copyTextureToBuffer(options: CopyTextureToBufferOptions): void;
32
+ copyTextureToTexture(options: CopyTextureToTextureOptions): void;
40
33
  pushDebugGroup(groupLabel: string): void;
41
34
  popDebugGroup(): void;
42
35
  insertDebugMarker(markerLabel: string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-command-encoder.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-command-encoder.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAkB,MAAM,EAAE,OAAO,EAAO,MAAM,cAAc,CAAC;AACxG,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAI5C,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,cAAc;IAC9D,QAAQ,CAAC,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,GAAG,YAAY,CAAC;QAE/C,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC7C,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;KAC9C,GAAG,IAAI;IAyBR,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,IAAI;IAW9D,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,IAAI;IAWvD,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAIxC,aAAa,IAAI,IAAI;IAIrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAatD"}
@@ -1,42 +1,34 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { CommandEncoder, cast } from '@luma.gl/api';
3
- export default class WebGPUCommandEncoder extends CommandEncoder {
1
+ import { CommandEncoder } from '@luma.gl/core';
2
+ export class WebGPUCommandEncoder extends CommandEncoder {
4
3
  constructor(device, props) {
5
- super(props);
6
-
7
- _defineProperty(this, "device", void 0);
8
-
9
- _defineProperty(this, "handle", void 0);
10
-
4
+ super(device, props);
5
+ this.device = void 0;
6
+ this.handle = void 0;
11
7
  this.device = device;
12
- this.handle = props.handle || this.device.handle.createCommandEncoder({
13
- measureExecutionTime: this.props.measureExecutionTime
14
- });
8
+ this.handle = props.handle || this.device.handle.createCommandEncoder({});
15
9
  this.handle.label = this.props.id;
16
10
  }
17
-
18
11
  destroy() {}
19
-
20
12
  finish(options) {
21
13
  return this.finish(options);
22
14
  }
23
-
24
15
  copyBufferToBuffer(options) {
25
16
  var _options$sourceOffset, _options$destinationO, _options$size;
26
-
27
- this.handle.copyBufferToBuffer(cast(options.source).handle, (_options$sourceOffset = options.sourceOffset) !== null && _options$sourceOffset !== void 0 ? _options$sourceOffset : 0, cast(options.destination).handle, (_options$destinationO = options.destinationOffset) !== null && _options$destinationO !== void 0 ? _options$destinationO : 0, (_options$size = options.size) !== null && _options$size !== void 0 ? _options$size : 0);
17
+ const webgpuSourceBuffer = options.source;
18
+ const WebGPUDestinationBuffer = options.destination;
19
+ this.handle.copyBufferToBuffer(webgpuSourceBuffer.handle, (_options$sourceOffset = options.sourceOffset) !== null && _options$sourceOffset !== void 0 ? _options$sourceOffset : 0, WebGPUDestinationBuffer.handle, (_options$destinationO = options.destinationOffset) !== null && _options$destinationO !== void 0 ? _options$destinationO : 0, (_options$size = options.size) !== null && _options$size !== void 0 ? _options$size : 0);
28
20
  }
29
-
30
21
  copyBufferToTexture(options) {
31
22
  var _options$offset, _options$mipLevel, _options$origin;
32
-
23
+ const webgpuSourceBuffer = options.source;
24
+ const WebGPUDestinationTexture = options.destination;
33
25
  this.handle.copyBufferToTexture({
34
- buffer: cast(options.source).handle,
26
+ buffer: webgpuSourceBuffer.handle,
35
27
  offset: (_options$offset = options.offset) !== null && _options$offset !== void 0 ? _options$offset : 0,
36
28
  bytesPerRow: options.bytesPerRow,
37
29
  rowsPerImage: options.rowsPerImage
38
30
  }, {
39
- texture: cast(options.destination).handle,
31
+ texture: WebGPUDestinationTexture.handle,
40
32
  mipLevel: (_options$mipLevel = options.mipLevel) !== null && _options$mipLevel !== void 0 ? _options$mipLevel : 0,
41
33
  origin: (_options$origin = options.origin) !== null && _options$origin !== void 0 ? _options$origin : {}
42
34
  }, {
@@ -45,22 +37,16 @@ export default class WebGPUCommandEncoder extends CommandEncoder {
45
37
  depthOrArrayLayers: options.extent[2]
46
38
  });
47
39
  }
48
-
49
40
  copyTextureToBuffer(options) {}
50
-
51
41
  copyTextureToTexture(options) {}
52
-
53
42
  pushDebugGroup(groupLabel) {
54
43
  this.handle.pushDebugGroup(groupLabel);
55
44
  }
56
-
57
45
  popDebugGroup() {
58
46
  this.handle.popDebugGroup();
59
47
  }
60
-
61
48
  insertDebugMarker(markerLabel) {
62
49
  this.handle.insertDebugMarker(markerLabel);
63
50
  }
64
-
65
51
  }
66
52
  //# sourceMappingURL=webgpu-command-encoder.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapter/resources/webgpu-command-encoder.ts"],"names":["CommandEncoder","cast","WebGPUCommandEncoder","constructor","device","props","handle","createCommandEncoder","measureExecutionTime","label","id","destroy","finish","options","copyBufferToBuffer","source","sourceOffset","destination","destinationOffset","size","copyBufferToTexture","buffer","offset","bytesPerRow","rowsPerImage","texture","mipLevel","origin","width","extent","height","depthOrArrayLayers","copyTextureToBuffer","copyTextureToTexture","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"mappings":";AAAA,SAAQA,cAAR,EAA8EC,IAA9E,QAAyF,cAAzF;AAKA,eAAe,MAAMC,oBAAN,SAAmCF,cAAnC,CAAkD;AAI/DG,EAAAA,WAAW,CAACC,MAAD,EAAuBC,KAAvB,EAAmD;AAC5D,UAAMA,KAAN;;AAD4D;;AAAA;;AAE5D,SAAKD,MAAL,GAAcA,MAAd;AACA,SAAKE,MAAL,GAAcD,KAAK,CAACC,MAAN,IAAgB,KAAKF,MAAL,CAAYE,MAAZ,CAAmBC,oBAAnB,CAAwC;AACpEC,MAAAA,oBAAoB,EAAE,KAAKH,KAAL,CAAWG;AADmC,KAAxC,CAA9B;AAGA,SAAKF,MAAL,CAAYG,KAAZ,GAAoB,KAAKJ,KAAL,CAAWK,EAA/B;AACD;;AAEDC,EAAAA,OAAO,GAAG,CAAE;;AAEZC,EAAAA,MAAM,CAACC,OAAD,EAA4C;AAChD,WAAO,KAAKD,MAAL,CAAYC,OAAZ,CAAP;AACD;;AAKDC,EAAAA,kBAAkB,CAACD,OAAD,EAMT;AAAA;;AACP,SAAKP,MAAL,CAAYQ,kBAAZ,CACEb,IAAI,CAAeY,OAAO,CAACE,MAAvB,CAAJ,CAAmCT,MADrC,2BAEEO,OAAO,CAACG,YAFV,yEAE0B,CAF1B,EAGEf,IAAI,CAAeY,OAAO,CAACI,WAAvB,CAAJ,CAAwCX,MAH1C,2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;AACD;;AA/F8D","sourcesContent":["import {CommandEncoder, CommandEncoderProps, RenderPipeline, Buffer, Texture, cast} from '@luma.gl/api';\nimport WebGPUDevice from '../webgpu-device';\nimport WEBGPUBuffer from './webgpu-buffer';\nimport WebGPUTexture from './webgpu-texture';\n\nexport default class WebGPUCommandEncoder extends CommandEncoder {\n readonly device: WebGPUDevice;\n readonly handle: GPUCommandEncoder;\n\n constructor(device: WebGPUDevice, props: CommandEncoderProps) {\n super(props);\n this.device = device;\n this.handle = props.handle || this.device.handle.createCommandEncoder({\n measureExecutionTime: this.props.measureExecutionTime\n });\n this.handle.label = this.props.id;\n }\n\n destroy() {}\n\n finish(options?: {id?: string}): GPUCommandBuffer {\n return this.finish(options);\n }\n\n // beginRenderPass(GPURenderPassDescriptor descriptor): GPURenderPassEncoder;\n // beginComputePass(optional GPUComputePassDescriptor descriptor = {}): GPUComputePassEncoder;\n\n copyBufferToBuffer(options: {\n source: Buffer,\n sourceOffset?: number,\n destination: Buffer,\n destinationOffset?: number,\n size?: number\n }): void {\n this.handle.copyBufferToBuffer(\n cast<WEBGPUBuffer>(options.source).handle,\n options.sourceOffset ?? 0,\n cast<WEBGPUBuffer>(options.destination).handle,\n options.destinationOffset ?? 0,\n options.size ?? 0\n );\n }\n\n copyBufferToTexture(options: {\n source: Buffer,\n offset?: number,\n bytesPerRow: number,\n rowsPerImage: number,\n\n destination: Texture,\n mipLevel?: number;\n aspect?: 'all' | 'stencil-only' | 'depth-only',\n\n origin?: number[] | [number, number, number],\n extent?: number[] | [number, number, number]\n }): void {\n this.handle.copyBufferToTexture(\n {\n buffer: cast<WEBGPUBuffer>(options.source).handle,\n offset: options.offset ?? 0,\n bytesPerRow: options.bytesPerRow,\n rowsPerImage: options.rowsPerImage,\n },\n {\n texture: cast<WebGPUTexture>(options.destination).handle,\n mipLevel: options.mipLevel ?? 0,\n origin: options.origin ?? {},\n // aspect: options.aspect\n },\n {\n // TODO exclamation mark hack\n width: options.extent![0],\n height: options.extent![1],\n depthOrArrayLayers: options.extent![2]\n }\n );\n }\n\n copyTextureToBuffer(options: {\n source: GPUImageCopyTexture,\n destination: GPUImageCopyBuffer,\n copySize: GPUExtent3D\n }): void {}\n\n copyTextureToTexture(options: {\n source: GPUImageCopyTexture ,\n destination: GPUImageCopyTexture,\n copySize: GPUExtent3D\n }): void {}\n\n pushDebugGroup(groupLabel: string): void {\n this.handle.pushDebugGroup(groupLabel);\n }\n\n popDebugGroup(): void {\n this.handle.popDebugGroup();\n }\n\n insertDebugMarker(markerLabel: string): void {\n this.handle.insertDebugMarker(markerLabel);\n }\n\n // writeTimestamp(querySet: Query, queryIndex: number): void {}\n\n // resolveQuerySet(options: {\n // querySet: GPUQuerySet,\n // firstQuery: number,\n // queryCount: number,\n // destination: Buffer,\n // destinationOffset?: number;\n // }): void;\n}"],"file":"webgpu-command-encoder.js"}
1
+ {"version":3,"file":"webgpu-command-encoder.js","names":["CommandEncoder","WebGPUCommandEncoder","constructor","device","props","handle","createCommandEncoder","label","id","destroy","finish","options","copyBufferToBuffer","_options$sourceOffset","_options$destinationO","_options$size","webgpuSourceBuffer","source","WebGPUDestinationBuffer","destination","sourceOffset","destinationOffset","size","copyBufferToTexture","_options$offset","_options$mipLevel","_options$origin","WebGPUDestinationTexture","buffer","offset","bytesPerRow","rowsPerImage","texture","mipLevel","origin","width","extent","height","depthOrArrayLayers","copyTextureToBuffer","copyTextureToTexture","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"sources":["../../../src/adapter/resources/webgpu-command-encoder.ts"],"sourcesContent":["import {CommandEncoder, CommandEncoderProps, Buffer, Texture} from '@luma.gl/core';\nimport type {CopyTextureToTextureOptions, CopyTextureToBufferOptions} from '@luma.gl/core';\nimport {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUBuffer} from './webgpu-buffer';\nimport {WebGPUTexture} from './webgpu-texture';\n\nexport class WebGPUCommandEncoder extends CommandEncoder {\n readonly device: WebGPUDevice;\n readonly handle: GPUCommandEncoder;\n\n constructor(device: WebGPUDevice, props: CommandEncoderProps) {\n super(device, props);\n this.device = device;\n this.handle =\n props.handle ||\n this.device.handle.createCommandEncoder({\n // TODO was this removed in standard?\n // measureExecutionTime: this.props.measureExecutionTime\n });\n this.handle.label = this.props.id;\n }\n\n override destroy(): void {}\n\n finish(options?: {id?: string}): GPUCommandBuffer {\n return this.finish(options);\n }\n\n // beginRenderPass(GPURenderPassDescriptor descriptor): GPURenderPassEncoder;\n // beginComputePass(optional GPUComputePassDescriptor descriptor = {}): GPUComputePassEncoder;\n\n copyBufferToBuffer(options: // CopyBufferToBufferOptions\n {\n source: Buffer;\n sourceOffset?: number;\n destination: Buffer;\n destinationOffset?: number;\n size?: number;\n }): void {\n const webgpuSourceBuffer = options.source as WebGPUBuffer;\n const WebGPUDestinationBuffer = options.destination as WebGPUBuffer;\n this.handle.copyBufferToBuffer(\n webgpuSourceBuffer.handle,\n options.sourceOffset ?? 0,\n WebGPUDestinationBuffer.handle,\n options.destinationOffset ?? 0,\n options.size ?? 0\n );\n }\n\n copyBufferToTexture(options: // CopyBufferToTextureOptions\n {\n source: Buffer;\n offset?: number;\n bytesPerRow: number;\n rowsPerImage: number;\n\n destination: Texture;\n mipLevel?: number;\n aspect?: 'all' | 'stencil-only' | 'depth-only';\n\n origin?: number[] | [number, number, number];\n extent?: number[] | [number, number, number];\n }): void {\n const webgpuSourceBuffer = options.source as WebGPUBuffer;\n const WebGPUDestinationTexture = options.destination as WebGPUTexture;\n this.handle.copyBufferToTexture(\n {\n buffer: webgpuSourceBuffer.handle,\n offset: options.offset ?? 0,\n bytesPerRow: options.bytesPerRow,\n rowsPerImage: options.rowsPerImage\n },\n {\n texture: WebGPUDestinationTexture.handle,\n mipLevel: options.mipLevel ?? 0,\n origin: options.origin ?? {}\n // aspect: options.aspect\n },\n {\n // TODO exclamation mark hack\n width: options.extent[0],\n height: options.extent[1],\n depthOrArrayLayers: options.extent[2]\n }\n );\n }\n\n copyTextureToBuffer(options: CopyTextureToBufferOptions): void {\n // this.handle.copyTextureToBuffer(\n // // source\n // {},\n // // destination\n // {},\n // // copySize\n // {}\n // );\n }\n\n copyTextureToTexture(options: CopyTextureToTextureOptions): void {\n // this.handle.copyTextureToTexture(\n // // source\n // {},\n // // destination\n // {},\n // // copySize\n // {}\n // );\n }\n\n override pushDebugGroup(groupLabel: string): void {\n this.handle.pushDebugGroup(groupLabel);\n }\n\n override popDebugGroup(): void {\n this.handle.popDebugGroup();\n }\n\n override insertDebugMarker(markerLabel: string): void {\n this.handle.insertDebugMarker(markerLabel);\n }\n\n // writeTimestamp(querySet: Query, queryIndex: number): void {}\n\n // resolveQuerySet(options: {\n // querySet: GPUQuerySet,\n // firstQuery: number,\n // queryCount: number,\n // destination: Buffer,\n // destinationOffset?: number;\n // }): void;\n}\n"],"mappings":"AAAA,SAAQA,cAAc,QAA6C,eAAe;AAMlF,OAAO,MAAMC,oBAAoB,SAASD,cAAc,CAAC;EAIvDE,WAAWA,CAACC,MAAoB,EAAEC,KAA0B,EAAE;IAC5D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAAC,KAJdD,MAAM;IAAA,KACNE,MAAM;IAIb,IAAI,CAACF,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACE,MAAM,GACTD,KAAK,CAACC,MAAM,IACZ,IAAI,CAACF,MAAM,CAACE,MAAM,CAACC,oBAAoB,CAAC,CAGxC,CAAC,CAAC;IACJ,IAAI,CAACD,MAAM,CAACE,KAAK,GAAG,IAAI,CAACH,KAAK,CAACI,EAAE;EACnC;EAESC,OAAOA,CAAA,EAAS,CAAC;EAE1BC,MAAMA,CAACC,OAAuB,EAAoB;IAChD,OAAO,IAAI,CAACD,MAAM,CAACC,OAAO,CAAC;EAC7B;EAKAC,kBAAkBA,CAACD,OAOlB,EAAQ;IAAA,IAAAE,qBAAA,EAAAC,qBAAA,EAAAC,aAAA;IACP,MAAMC,kBAAkB,GAAGL,OAAO,CAACM,MAAsB;IACzD,MAAMC,uBAAuB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,CAACyB,MAAM,CAAC,CAAC;IACtC,CACF,CAAC;EACH;EAEAG,mBAAmBA,CAAC5B,OAAmC,EAAQ,CAS/D;EAEA6B,oBAAoBA,CAAC7B,OAAoC,EAAQ,CASjE;EAES8B,cAAcA,CAACC,UAAkB,EAAQ;IAChD,IAAI,CAACrC,MAAM,CAACoC,cAAc,CAACC,UAAU,CAAC;EACxC;EAESC,aAAaA,CAAA,EAAS;IAC7B,IAAI,CAACtC,MAAM,CAACsC,aAAa,CAAC,CAAC;EAC7B;EAESC,iBAAiBA,CAACC,WAAmB,EAAQ;IACpD,IAAI,CAACxC,MAAM,CAACuC,iBAAiB,CAACC,WAAW,CAAC;EAC5C;AAWF"}
@@ -1,14 +1,14 @@
1
- /// <reference types="@webgpu/types" />
2
- import { ComputePass, ComputePassProps, ComputePipeline, Buffer, Binding } from '@luma.gl/api';
3
- import WebGPUDevice from '../webgpu-device';
4
- export default class WebGPUComputePass extends ComputePass {
1
+ /// <reference types="dist" />
2
+ import { ComputePass, ComputePassProps, ComputePipeline, Buffer, Binding } from '@luma.gl/core';
3
+ import { WebGPUDevice } from '../webgpu-device';
4
+ export declare class WebGPUComputePass extends ComputePass {
5
5
  readonly device: WebGPUDevice;
6
6
  readonly handle: GPUComputePassEncoder;
7
7
  _bindGroupLayout: GPUBindGroupLayout | null;
8
8
  constructor(device: WebGPUDevice, props: ComputePassProps);
9
9
  /** @note no WebGPU destroy method, just gc */
10
10
  destroy(): void;
11
- endPass(): void;
11
+ end(): void;
12
12
  setPipeline(pipeline: ComputePipeline): void;
13
13
  /** Sets an array of bindings (uniform buffers, samplers, textures, ...) */
14
14
  setBindings(bindings: Binding[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-compute-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pass.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAO,MAAM,c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AI,CAAQ;gBAEvC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB;IAUzD,8CAA8C;IACrC,OAAO,IAAI,IAAI;IAExB,GAAG,IAAI,IAAI;IAIX,WAAW,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAM5C,2EAA2E;IAC3E,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI;IAMtC;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAIjD;;;;OAIG;IACH,gBAAgB,CAAC,cAAc,EAAE,MAAM,EAAE,cAAc,GAAE,MAAU,GAAG,IAAI;IAK1E,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAGxC,aAAa,IAAI,IAAI;IAGrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAO7C"}
@@ -1,58 +1,44 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { ComputePass, cast } from '@luma.gl/api';
3
- export default class WebGPUComputePass extends ComputePass {
1
+ import { ComputePass } from '@luma.gl/core';
2
+ export class WebGPUComputePass extends ComputePass {
4
3
  constructor(device, props) {
5
4
  var _device$commandEncode;
6
-
7
5
  super(device, props);
8
-
9
- _defineProperty(this, "device", void 0);
10
-
11
- _defineProperty(this, "handle", void 0);
12
-
13
- _defineProperty(this, "_bindGroupLayout", null);
14
-
6
+ this.device = void 0;
7
+ this.handle = void 0;
8
+ this._bindGroupLayout = null;
15
9
  this.device = device;
16
10
  this.handle = this.props.handle || ((_device$commandEncode = device.commandEncoder) === null || _device$commandEncode === void 0 ? void 0 : _device$commandEncode.beginComputePass({
17
11
  label: this.props.id
18
12
  }));
19
13
  }
20
-
21
14
  destroy() {}
22
-
23
- endPass() {
24
- this.handle.endPass();
15
+ end() {
16
+ this.handle.end();
25
17
  }
26
-
27
18
  setPipeline(pipeline) {
28
- const wgpuPipeline = cast(pipeline);
19
+ const wgpuPipeline = pipeline;
29
20
  this.handle.setPipeline(wgpuPipeline.handle);
30
21
  this._bindGroupLayout = wgpuPipeline._getBindGroupLayout();
31
22
  }
32
-
33
23
  setBindings(bindings) {
34
24
  throw new Error('fix me');
35
25
  }
36
-
37
26
  dispatch(x, y, z) {
38
- this.handle.dispatch(x, y, z);
27
+ this.handle.dispatchWorkgroups(x, y, z);
39
28
  }
40
-
41
- dispatchIndirect(indirectBuffer, indirectOffset = 0) {
42
- this.handle.dispatchIndirect(cast(indirectBuffer).handle, indirectOffset);
29
+ dispatchIndirect(indirectBuffer) {
30
+ let indirectOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
31
+ const webgpuBuffer = indirectBuffer;
32
+ this.handle.dispatchWorkgroupsIndirect(webgpuBuffer.handle, indirectOffset);
43
33
  }
44
-
45
34
  pushDebugGroup(groupLabel) {
46
35
  this.handle.pushDebugGroup(groupLabel);
47
36
  }
48
-
49
37
  popDebugGroup() {
50
38
  this.handle.popDebugGroup();
51
39
  }
52
-
53
40
  insertDebugMarker(markerLabel) {
54
41
  this.handle.insertDebugMarker(markerLabel);
55
42
  }
56
-
57
43
  }
58
44
  //# sourceMappingURL=webgpu-compute-pass.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapter/resources/webgpu-compute-pass.ts"],"names":["ComputePass","cast","WebGPUComputePass","constructor","device","props","handle","commandEncoder","beginComputePass","label","id","destroy","endPass","setPipeline","pipeline","wgpuPipeline","_bindGroupLayout","_getBindGroupLayout","setBindings","bindings","Error","dispatch","x","y","z","dispatchIndirect","indirectBuffer","indirectOffset","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"mappings":";AAAA,SAAQA,WAAR,EAAyEC,IAAzE,QAAoF,cAApF;AAMA,eAAe,MAAMC,iBAAN,SAAgCF,WAAhC,CAA4C;AAKzDG,EAAAA,WAAW,CAACC,MAAD,EAAuB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AACDC,EAAAA,iBAAiB,CAACC,WAAD,EAA4B;AAC3C,SAAK1B,MAAL,CAAYyB,iBAAZ,CAA8BC,WAA9B;AACD;;AA9DwD","sourcesContent":["import {ComputePass, ComputePassProps, ComputePipeline, Buffer, Binding, cast} from '@luma.gl/api';\nimport WebGPUDevice from '../webgpu-device';\nimport WebGPUBuffer from './webgpu-buffer';\n// import WebGPUCommandEncoder from './webgpu-command-encoder';\nimport WebGPUComputePipeline from './webgpu-compute-pipeline';\n\nexport default class WebGPUComputePass extends ComputePass {\n readonly device: WebGPUDevice;\n readonly handle: GPUComputePassEncoder;\n _bindGroupLayout: GPUBindGroupLayout | null = null;\n\n constructor(device: WebGPUDevice, props: ComputePassProps) {\n super(device, props);\n this.device = device;\n\n this.handle = this.props.handle || device.commandEncoder?.beginComputePass({\n label: this.props.id,\n // timestampWrites?: GPUComputePassTimestampWrites;\n });\n }\n\n /** @note no WebGPU destroy method, just gc */\n destroy() {}\n\n endPass(): void {\n this.handle.endPass();\n }\n\n setPipeline(pipeline: ComputePipeline): void {\n const wgpuPipeline = cast<WebGPUComputePipeline>(pipeline);\n this.handle.setPipeline(wgpuPipeline.handle);\n this._bindGroupLayout = wgpuPipeline._getBindGroupLayout();\n }\n\n /** Sets an array of bindings (uniform buffers, samplers, textures, ...) */\n setBindings(bindings: Binding[]): void {\n throw new Error('fix me');\n // const bindGroup = getBindGroup(this.device.handle, this._bindGroupLayout, this.props.bindings);\n // this.handle.setBindGroup(0, bindGroup);\n }\n\n /**\n * Dispatch work to be performed with the current ComputePipeline.\n * @param x X dimension of the grid of workgroups to dispatch.\n * @param y Y dimension of the grid of workgroups to dispatch.\n * @param z Z dimension of the grid of workgroups to dispatch.\n */\n dispatch(x: number, y?: number, z?: number): void {\n this.handle.dispatch(x, y, z);\n }\n\n /**\n * Dispatch work to be performed with the current ComputePipeline.\n * @param indirectBuffer buffer must be a tightly packed block of three 32-bit unsigned integer values (12 bytes total), given in the same order as the arguments for dispatch()\n * @param indirectOffset\n */\n dispatchIndirect(indirectBuffer: Buffer, indirectOffset: number = 0): void {\n this.handle.dispatchIndirect(cast<WebGPUBuffer>(indirectBuffer).handle, indirectOffset);\n }\n\n pushDebugGroup(groupLabel: string): void {\n this.handle.pushDebugGroup(groupLabel);\n }\n popDebugGroup(): void {\n this.handle.popDebugGroup();\n }\n insertDebugMarker(markerLabel: string): void {\n this.handle.insertDebugMarker(markerLabel);\n }\n\n // writeTimestamp(querySet: GPUQuerySet, queryIndex: number): void;\n // beginPipelineStatisticsQuery(querySet: GPUQuerySet, queryIndex: number): void;\n // endPipelineStatisticsQuery(querySet: GPUQuerySet, queryIndex: number): void;\n}\n"],"file":"webgpu-compute-pass.js"}
1
+ {"version":3,"file":"webgpu-compute-pass.js","names":["ComputePass","WebGPUComputePass","constructor","device","props","_device$commandEncode","handle","_bindGroupLayout","commandEncoder","beginComputePass","label","id","destroy","end","setPipeline","pipeline","wgpuPipeline","_getBindGroupLayout","setBindings","bindings","Error","dispatch","x","y","z","dispatchWorkgroups","dispatchIndirect","indirectBuffer","indirectOffset","arguments","length","undefined","webgpuBuffer","dispatchWorkgroupsIndirect","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"sources":["../../../src/adapter/resources/webgpu-compute-pass.ts"],"sourcesContent":["import {ComputePass, ComputePassProps, ComputePipeline, Buffer, Binding} from '@luma.gl/core';\nimport {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUBuffer} from './webgpu-buffer';\n// import {WebGPUCommandEncoder} from './webgpu-command-encoder';\nimport {WebGPUComputePipeline} from './webgpu-compute-pipeline';\n\nexport class WebGPUComputePass extends ComputePass {\n readonly device: WebGPUDevice;\n readonly handle: GPUComputePassEncoder;\n _bindGroupLayout: GPUBindGroupLayout | null = null;\n\n constructor(device: WebGPUDevice, props: ComputePassProps) {\n super(device, props);\n this.device = device;\n\n this.handle = this.props.handle || device.commandEncoder?.beginComputePass({\n label: this.props.id,\n // timestampWrites?: GPUComputePassTimestampWrites;\n });\n }\n\n /** @note no WebGPU destroy method, just gc */\n override destroy(): void {}\n\n end(): void {\n this.handle.end();\n }\n\n setPipeline(pipeline: ComputePipeline): void {\n const wgpuPipeline = pipeline as WebGPUComputePipeline;\n this.handle.setPipeline(wgpuPipeline.handle);\n this._bindGroupLayout = wgpuPipeline._getBindGroupLayout();\n }\n\n /** Sets an array of bindings (uniform buffers, samplers, textures, ...) */\n setBindings(bindings: Binding[]): void {\n throw new Error('fix me');\n // const bindGroup = getBindGroup(this.device.handle, this._bindGroupLayout, this.props.bindings);\n // this.handle.setBindGroup(0, bindGroup);\n }\n\n /**\n * Dispatch work to be performed with the current ComputePipeline.\n * @param x X dimension of the grid of workgroups to dispatch.\n * @param y Y dimension of the grid of workgroups to dispatch.\n * @param z Z dimension of the grid of workgroups to dispatch.\n */\n dispatch(x: number, y?: number, z?: number): void {\n this.handle.dispatchWorkgroups(x, y, z);\n }\n\n /**\n * Dispatch work to be performed with the current ComputePipeline.\n * @param indirectBuffer buffer must be a tightly packed block of three 32-bit unsigned integer values (12 bytes total), given in the same order as the arguments for dispatch()\n * @param indirectOffset\n */\n dispatchIndirect(indirectBuffer: Buffer, indirectOffset: number = 0): void {\n const webgpuBuffer = indirectBuffer as WebGPUBuffer;\n this.handle.dispatchWorkgroupsIndirect(webgpuBuffer.handle, indirectOffset);\n }\n\n pushDebugGroup(groupLabel: string): void {\n this.handle.pushDebugGroup(groupLabel);\n }\n popDebugGroup(): void {\n this.handle.popDebugGroup();\n }\n insertDebugMarker(markerLabel: string): void {\n this.handle.insertDebugMarker(markerLabel);\n }\n\n // writeTimestamp(querySet: GPUQuerySet, queryIndex: number): void;\n // beginPipelineStatisticsQuery(querySet: GPUQuerySet, queryIndex: number): void;\n // endPipelineStatisticsQuery(querySet: GPUQuerySet, queryIndex: number): void;\n}\n"],"mappings":"AAAA,SAAQA,WAAW,QAA2D,eAAe;AAM7F,OAAO,MAAMC,iBAAiB,SAASD,WAAW,CAAC;EAKjDE,WAAWA,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EAAEsB,cAAc,CAAC;EAC7E;EAEAM,cAAcA,CAACC,UAAkB,EAAQ;IACvC,IAAI,CAAC7B,MAAM,CAAC4B,cAAc,CAACC,UAAU,CAAC;EACxC;EACAC,aAAaA,CAAA,EAAS;IACpB,IAAI,CAAC9B,MAAM,CAAC8B,aAAa,CAAC,CAAC;EAC7B;EACAC,iBAAiBA,CAACC,WAAmB,EAAQ;IAC3C,IAAI,CAAChC,MAAM,CAAC+B,iBAAiB,CAACC,WAAW,CAAC;EAC5C;AAKF"}
@@ -1,8 +1,8 @@
1
- /// <reference types="@webgpu/types" />
2
- import { ComputePipeline, ComputePipelineProps } from '@luma.gl/api';
3
- import WebGPUDevice from '../webgpu-device';
1
+ /// <reference types="dist" />
2
+ import { ComputePipeline, ComputePipelineProps } from '@luma.gl/core';
3
+ import { WebGPUDevice } from '../webgpu-device';
4
4
  /** Creates a new compute pipeline when parameters change */
5
- export default class WebGPUComputePipeline extends ComputePipeline {
5
+ export declare class WebGPUComputePipeline extends ComputePipeline {
6
6
  device: WebGPUDevice;
7
7
  handle: GPUComputePipeline;
8
8
  constructor(device: WebGPUDevice, props: ComputePipelineProps);
@@ -1 +1 @@
1
- {"version":3,"file":"webgpu-compute-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAO,MAAM,cAAc,CAAC;AAEzE,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAK5C,4DAA4D;AAC5D,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,eAAe;IAChE,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,kBAAkB,CAAC;gBAEf,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,oBAAoB;IAe7D,wCAAwC;IACxC,mBAAmB;CAIpB"}
1
+ {"version":3,"file":"webgpu-compute-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAEpE,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAK9C,4DAA4D;AAC5D,qBAAa,qBAAsB,SAAQ,eAAe;IACxD,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,kBAAkB,CAAC;gBAEf,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,oBAAoB;IAgB7D,wCAAwC;IACxC,mBAAmB;CAIpB"}
@@ -1,27 +1,22 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { ComputePipeline, cast } from '@luma.gl/api';
3
- export default class WebGPUComputePipeline extends ComputePipeline {
1
+ import { ComputePipeline } from '@luma.gl/core';
2
+ export class WebGPUComputePipeline extends ComputePipeline {
4
3
  constructor(device, props) {
5
4
  super(device, props);
6
-
7
- _defineProperty(this, "device", void 0);
8
-
9
- _defineProperty(this, "handle", void 0);
10
-
5
+ this.device = void 0;
6
+ this.handle = void 0;
11
7
  this.device = device;
12
- const module = cast(this.props.cs).handle;
8
+ const webgpuShader = this.props.cs;
13
9
  this.handle = this.props.handle || this.device.handle.createComputePipeline({
14
10
  label: this.props.id,
15
11
  compute: {
16
- module,
12
+ module: webgpuShader.handle,
17
13
  entryPoint: this.props.csEntryPoint
18
- }
14
+ },
15
+ layout: 'auto'
19
16
  });
20
17
  }
21
-
22
18
  _getBindGroupLayout() {
23
19
  return this.handle.getBindGroupLayout(0);
24
20
  }
25
-
26
21
  }
27
22
  //# sourceMappingURL=webgpu-compute-pipeline.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"names":["ComputePipeline","cast","WebGPUComputePipeline","constructor","device","props","module","cs","handle","createComputePipeline","label","id","compute","entryPoint","csEntryPoint","_getBindGroupLayout","getBindGroupLayout"],"mappings":";AACA,SAAQA,eAAR,EAA+CC,IAA/C,QAA0D,cAA1D;AAQA,eAAe,MAAMC,qBAAN,SAAoCF,eAApC,CAAoD;AAIjEG,EAAAA,WAAW,CAACC,MAAD,EAAuBC,KAAvB,EAAoD;AAC7D,UAAMD,MAAN,EAAcC,KAAd;;AAD6D;;AAAA;;AAE7D,SAAKD,MAAL,GAAcA,MAAd;AAEA,UAAME,MAAM,GAAGL,IAAI,CAAe,KAAKI,KAAL,CAAWE,EAA1B,CAAJ,CAAkCC,MAAjD;AACA,SAAKA,MAAL,GAAc,KAAKH,KAAL,CAAWG,MAAX,IAAqB,KAAKJ,MAAL,CAAYI,MAAZ,CAAmBC,qBAAnB,CAAyC;AAC1EC,MAAAA,KAAK,EAAE,KAAKL,KAAL,CAAWM,EADwD;AAE1EC,MAAAA,OAAO,EAAE;AACPN,QAAAA,MADO;AAEPO,QAAAA,UAAU,EAAE,KAAKR,KAAL,CAAWS;AAFhB;AAFiE,KAAzC,CAAnC;AAQD;;AAGDC,EAAAA,mBAAmB,GAAG;AAEpB,WAAO,KAAKP,MAAL,CAAYQ,kBAAZ,CAA+B,CAA/B,CAAP;AACD;;AAvBgE","sourcesContent":["// prettier-ignore\nimport {ComputePipeline, ComputePipelineProps, cast} from '@luma.gl/api';\n\nimport WebGPUDevice from '../webgpu-device';\nimport WebGPUShader from './webgpu-shader';\n\n// COMPUTE PIPELINE\n\n/** Creates a new compute pipeline when parameters change */\nexport default class WebGPUComputePipeline extends ComputePipeline {\n device: WebGPUDevice;\n handle: GPUComputePipeline;\n\n constructor(device: WebGPUDevice, props: ComputePipelineProps) {\n super(device, props);\n this.device = device;\n\n const module = cast<WebGPUShader>(this.props.cs).handle;\n this.handle = this.props.handle || this.device.handle.createComputePipeline({\n label: this.props.id,\n compute: {\n module,\n entryPoint: this.props.csEntryPoint,\n // constants: this.props.csConstants\n }\n });\n }\n\n /** For internal use in render passes */\n _getBindGroupLayout() {\n // TODO: Cache?\n return this.handle.getBindGroupLayout(0);\n }\n}\n"],"file":"webgpu-compute-pipeline.js"}
1
+ {"version":3,"file":"webgpu-compute-pipeline.js","names":["ComputePipeline","WebGPUComputePipeline","constructor","device","props","handle","webgpuShader","cs","createComputePipeline","label","id","compute","module","entryPoint","csEntryPoint","layout","_getBindGroupLayout","getBindGroupLayout"],"sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"sourcesContent":["// prettier-ignore\nimport {ComputePipeline, ComputePipelineProps} from '@luma.gl/core';\n\nimport {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUShader} from './webgpu-shader';\n\n// COMPUTE PIPELINE\n\n/** Creates a new compute pipeline when parameters change */\nexport class WebGPUComputePipeline extends ComputePipeline {\n device: WebGPUDevice;\n handle: GPUComputePipeline;\n\n constructor(device: WebGPUDevice, props: ComputePipelineProps) {\n super(device, props);\n this.device = device;\n\n const webgpuShader = this.props.cs as WebGPUShader;\n this.handle = this.props.handle || this.device.handle.createComputePipeline({\n label: this.props.id,\n compute: {\n module: webgpuShader.handle,\n entryPoint: this.props.csEntryPoint,\n // constants: this.props.csConstants\n },\n layout: 'auto'\n });\n }\n\n /** For internal use in render passes */\n _getBindGroupLayout() {\n // TODO: Cache?\n return this.handle.getBindGroupLayout(0);\n }\n}\n"],"mappings":"AACA,SAAQA,eAAe,QAA6B,eAAe;AAQnE,OAAO,MAAMC,qBAAqB,SAASD,eAAe,CAAC;EAIzDE,WAAWA,CAACC,MAAoB,EAAEC,KAA2B,EAAE;IAC7D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAAC,KAJvBD,MAAM;IAAA,KACNE,MAAM;IAIJ,IAAI,CAACF,MAAM,GAAGA,MAAM;IAEpB,MAAMG,YAAY,GAAG,IAAI,CAACF,KAAK,CAACG,EAAkB;IAClD,IAAI,CAACF,MAAM,GAAG,IAAI,CAACD,KAAK,CAACC,MAAM,IAAI,IAAI,CAACF,MAAM,CAACE,MAAM,CAACG,qBAAqB,CAAC;MAC1EC,KAAK,EAAE,IAAI,CAACL,KAAK,CAACM,EAAE;MACpBC,OAAO,EAAE;QACPC,MAAM,EAAEN,YAAY,CAACD,MAAM;QAC3BQ,UAAU,EAAE,IAAI,CAACT,KAAK,CAACU;MAEzB,CAAC;MACDC,MAAM,EAAE;IACV,CAAC,CAAC;EACJ;EAGAC,mBAAmBA,CAAA,EAAG;IAEpB,OAAO,IAAI,CAACX,MAAM,CAACY,kBAAkB,CAAC,CAAC,CAAC;EAC1C;AACF"}