@luma.gl/webgpu 9.0.0-alpha.2 → 9.0.0-alpha.21
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.
- package/LICENSE +32 -0
- package/dist/adapter/helpers/accessor-to-format.js.map +1 -1
- package/dist/adapter/helpers/convert-texture-format.d.ts +1 -1
- package/dist/adapter/helpers/convert-texture-format.js +0 -1
- package/dist/adapter/helpers/convert-texture-format.js.map +1 -1
- package/dist/adapter/helpers/generate-mipmaps.d.ts +1 -1
- package/dist/adapter/helpers/generate-mipmaps.js +1 -8
- package/dist/adapter/helpers/generate-mipmaps.js.map +1 -1
- package/dist/adapter/helpers/get-bind-group.d.ts +1 -1
- package/dist/adapter/helpers/get-bind-group.d.ts.map +1 -1
- package/dist/adapter/helpers/get-bind-group.js +0 -9
- package/dist/adapter/helpers/get-bind-group.js.map +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.d.ts +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.js +3 -17
- package/dist/adapter/helpers/get-vertex-buffer-layout.js.map +1 -1
- package/dist/adapter/helpers/webgpu-parameters.d.ts +1 -1
- package/dist/adapter/helpers/webgpu-parameters.d.ts.map +1 -1
- package/dist/adapter/helpers/webgpu-parameters.js +50 -47
- package/dist/adapter/helpers/webgpu-parameters.js.map +1 -1
- package/dist/adapter/resources/webgpu-buffer.d.ts +3 -4
- package/dist/adapter/resources/webgpu-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-buffer.js +12 -26
- package/dist/adapter/resources/webgpu-buffer.js.map +1 -1
- package/dist/adapter/resources/webgpu-command-encoder.d.ts +3 -4
- package/dist/adapter/resources/webgpu-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-command-encoder.js +7 -24
- package/dist/adapter/resources/webgpu-command-encoder.js.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pass.d.ts +5 -5
- package/dist/adapter/resources/webgpu-compute-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pass.js +11 -23
- package/dist/adapter/resources/webgpu-compute-pass.js.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.d.ts +3 -3
- package/dist/adapter/resources/webgpu-compute-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-compute-pipeline.js +3 -7
- package/dist/adapter/resources/webgpu-compute-pipeline.js.map +1 -1
- package/dist/adapter/resources/webgpu-external-texture.d.ts +4 -4
- package/dist/adapter/resources/webgpu-external-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-external-texture.js +2 -9
- package/dist/adapter/resources/webgpu-external-texture.js.map +1 -1
- package/dist/adapter/resources/webgpu-framebuffer.d.ts +5 -5
- package/dist/adapter/resources/webgpu-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-framebuffer.js +12 -30
- package/dist/adapter/resources/webgpu-framebuffer.js.map +1 -1
- package/dist/adapter/resources/webgpu-query.js.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.d.ts +5 -5
- package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.js +17 -30
- package/dist/adapter/resources/webgpu-render-pass.js.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts +7 -4
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.js +25 -43
- package/dist/adapter/resources/webgpu-render-pipeline.js.map +1 -1
- package/dist/adapter/resources/webgpu-sampler.d.ts +3 -3
- package/dist/adapter/resources/webgpu-sampler.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-sampler.js +8 -7
- package/dist/adapter/resources/webgpu-sampler.js.map +1 -1
- package/dist/adapter/resources/webgpu-shader.d.ts +4 -4
- package/dist/adapter/resources/webgpu-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-shader.js +2 -16
- package/dist/adapter/resources/webgpu-shader.js.map +1 -1
- package/dist/adapter/resources/webgpu-texture.d.ts +4 -4
- package/dist/adapter/resources/webgpu-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-texture.js +4 -20
- package/dist/adapter/resources/webgpu-texture.js.map +1 -1
- package/dist/adapter/webgpu-canvas-context.d.ts +5 -7
- package/dist/adapter/webgpu-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgpu-canvas-context.js +10 -31
- package/dist/adapter/webgpu-canvas-context.js.map +1 -1
- package/dist/adapter/webgpu-device.d.ts +19 -19
- package/dist/adapter/webgpu-device.d.ts.map +1 -1
- package/dist/adapter/webgpu-device.js +42 -71
- package/dist/adapter/webgpu-device.js.map +1 -1
- package/dist/adapter/webgpu-types.js.map +1 -1
- package/dist/dist.dev.js +3060 -0
- package/dist/glsl/glsllang.js +0 -1
- package/dist/glsl/glsllang.js.map +1 -1
- package/dist/index.cjs +1442 -0
- package/dist/index.d.ts +5 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -7
- package/dist/index.js.map +1 -1
- package/dist.min.js +17 -0
- package/package.json +18 -9
- package/src/.DS_Store +0 -0
- package/src/adapter/.DS_Store +0 -0
- package/src/adapter/helpers/generate-mipmaps.ts +1 -1
- package/src/adapter/helpers/get-bind-group.ts +4 -4
- package/src/adapter/helpers/get-vertex-buffer-layout.ts +3 -3
- package/src/adapter/helpers/webgpu-parameters.ts +55 -46
- package/src/adapter/resources/webgpu-buffer.ts +6 -10
- package/src/adapter/resources/webgpu-command-encoder.ts +22 -20
- package/src/adapter/resources/webgpu-compute-pass.ts +12 -12
- package/src/adapter/resources/webgpu-compute-pipeline.ts +5 -4
- package/src/adapter/resources/webgpu-external-texture.ts +4 -4
- package/src/adapter/resources/webgpu-framebuffer.ts +18 -18
- package/src/adapter/resources/webgpu-query.ts +2 -2
- package/src/adapter/resources/webgpu-render-pass.ts +15 -12
- package/src/adapter/resources/webgpu-render-pipeline.ts +32 -15
- package/src/adapter/resources/webgpu-sampler.ts +11 -4
- package/src/adapter/resources/webgpu-shader.ts +7 -5
- package/src/adapter/resources/webgpu-texture.ts +7 -6
- package/src/adapter/webgpu-canvas-context.ts +16 -12
- package/src/adapter/webgpu-device.ts +63 -50
- package/src/index.ts +6 -9
- package/dist/bundle.d.ts +0 -2
- package/dist/bundle.d.ts.map +0 -1
- package/dist/bundle.js +0 -5
- package/dist/bundle.js.map +0 -1
- package/dist/init.d.ts +0 -2
- package/dist/init.d.ts.map +0 -1
- package/dist/init.js +0 -4
- package/dist/init.js.map +0 -1
- package/src/bundle.ts +0 -4
- 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","addColorState","targets","fragment","writeMask","blendColorOperation","blend","color","operation","DEFAULT_PIPELINE_DESCRIPTOR","topology","vertex","module","undefined","entryPoint","applyParametersToRenderPipelineDescriptor","pipelineDescriptor","parameters","Object","assign","setParameters","key","entries","setterFunction","Error","length","push"],"mappings":"AAEA,SAASA,eAAT,CAAyBC,UAAzB,EAAwE;AACtEA,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;AAMD;;AAOD,OAAO,MAAMC,eAAmD,GAAG;AAGjEC,EAAAA,QAAQ,EAAE,CAACC,SAAD,EAA8BC,KAA9B,EAA0CR,UAA1C,KAAs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EAELC,UAAsB,GAAG,EAFpB,EAGC;AAENC,EAAAA,MAAM,CAACC,MAAP,CAAcH,kBAAd,EAAkC,EAAC,GAAGP,2BAAJ;AAAiC,OAAGO;AAApC,GAAlC;AACAI,EAAAA,aAAa,CAACJ,kBAAD,EAAqBC,UAArB,CAAb;AACD;;AAGD,SAASG,aAAT,CACEJ,kBADF,EAEEC,UAFF,EAGQ;AACN,OAAK,MAAM,CAACI,GAAD,EAAM/C,KAAN,CAAX,IAA2B4C,MAAM,CAACI,OAAP,CAAeL,UAAf,CAA3B,EAAuD;AACrD,UAAMM,cAAc,GAAGpD,eAAe,CAACkD,GAAD,CAAtC;;AACA,QAAI,CAACE,cAAL,EAAqB;AACnB,YAAM,IAAIC,KAAJ,6BAA+BH,GAA/B,EAAN;AACD;;AACDE,IAAAA,cAAc,CAACF,GAAD,EAAM/C,KAAN,EAAa0C,kBAAb,CAAd;AACD;AACF;;AAED,SAASf,aAAT,CAAuBnC,UAAvB,EAAsE;AACpEA,EAAAA,UAAU,CAACqC,QAAX,CAAoBD,OAApB,GAA8BpC,UAAU,CAACqC,QAAX,CAAoBD,OAApB,IAA+B,EAA7D;;AAEA,MAAIpC,UAAU,CAACqC,QAAX,CAAoBD,OAApB,CAA4BuB,MAA5B,KAAuC,CAA3C,EAA8C;AAE5C3D,IAAAA,UAAU,CAACqC,QAAX,CAAoBD,OAApB,CAA4BwB,IAA5B,CAAiC,EAAjC;AACD;AACF","sourcesContent":["import {Parameters} from '@luma.gl/api';\n\nfunction addDepthStencil(descriptor: GPURenderPipelineDescriptor): void {\n descriptor.depthStencil = descriptor.depthStencil || {\n // required, set something\n format: 'depth24plus',\n stencilFront: {},\n stencilBack: {}\n };\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.cullMode = value;\n },\n\n frontFace: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n descriptor.primitive.frontFace = value;\n },\n\n // DEPTH\n\n depthWriteEnabled: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.depthWriteEnabled = value;\n },\n\n depthCompare: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.depthCompare = value;\n },\n\n depthFormat: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.format = value;\n },\n\n depthBias: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.depthBias = value;\n },\n\n depthBiasSlopeScale: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.depthBiasSlopeScale = value;\n },\n\n depthBiasClamp: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.depthBiasClamp = value;\n },\n\n // STENCIL\n\n stencilReadMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.stencilReadMask = value;\n },\n\n stencilWriteMask: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.stencilWriteMask = value;\n },\n\n stencilCompare: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.stencilFront.compare = value;\n descriptor.depthStencil.stencilBack.compare = value;\n },\n\n stencilPassOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.stencilFront.passOp = value;\n descriptor.depthStencil.stencilBack.passOp = value;\n },\n\n stencilFailOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.stencilFront.failOp = value;\n descriptor.depthStencil.stencilBack.failOp = value;\n },\n\n stencilDepthFailOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addDepthStencil(descriptor);\n descriptor.depthStencil.stencilFront.depthFailOp = value;\n descriptor.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 addColorState(descriptor);\n const targets = descriptor.fragment.targets as GPUColorTargetState[];\n targets[0].writeMask = value;\n },\n\n blendColorOperation: (parameter: keyof Parameters, value: any, descriptor: GPURenderPipelineDescriptor) => {\n addColorState(descriptor);\n const targets = descriptor.fragment.targets as GPUColorTargetState[];\n // @ts-expect-error\n targets[0].blend = targets[0].blend || {};\n targets[0].blend.color = targets[0].blend.color || {};\n targets[0].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): void {\n descriptor.fragment.targets = descriptor.fragment.targets || [];\n // @ts-expect-error\n if (descriptor.fragment.targets.length === 0) {\n // @ts-expect-error\n descriptor.fragment.targets.push({});\n }\n}\n"],"file":"webgpu-parameters.js"}
|
|
1
|
+
{"version":3,"file":"webgpu-parameters.js","names":["addDepthStencil","descriptor","depthStencil","format","stencilFront","stencilBack","depthWriteEnabled","undefined","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","entryPoint","fragment","layout","applyParametersToRenderPipelineDescriptor","pipelineDescriptor","parameters","arguments","length","Object","assign","setParameters","key","entries","setterFunction","Error","concat","_descriptor$fragment","_descriptor$fragment2","_descriptor$fragment3","_descriptor$fragment4","_descriptor$fragment5","Array","isArray","_descriptor$fragment$","push"],"sources":["../../../src/adapter/helpers/webgpu-parameters.ts"],"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 // TODO can this cause trouble? Should we set to WebGPU defaults? Are there defaults?\n depthWriteEnabled: undefined!,\n depthCompare: undefined!\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,UAAuC,EAAwB;EACtFA,UAAU,CAACC,YAAY,GAAGD,UAAU,CAACC,YAAY,IAAI;IAEnDC,MAAM,EAAE,aAAa;IACrBC,YAAY,EAAE,CAAC,CAAC;IAChBC,WAAW,EAAE,CAAC,CAAC;IAEfC,iBAAiB,EAAEC,SAAU;IAC7BC,YAAY,EAAED;EAChB,CAAC;EACD,OAAON,UAAU,CAACC,YAAY;AAChC;AAOA,OAAO,MAAMO,eAAmD,GAAG;EAGjEC,QAAQ,EAAEA,CAACC,SAA2B,EAAEC,KAAU,EAAEX,UAAuC,KAAK;IAC9FA,UAAU,CAACY,SAAS,GAAGZ,UAAU,CAACY,SAAS,IAAI,CAAC,CAAC;IACjDZ,UAAU,CAACY,SAAS,CAACH,QAAQ,GAAGE,KAAK;EACvC,CAAC;EAEDE,SAAS,EAAEA,CAACH,SAA2B,EAAEC,KAAU,EAAEX,UAAuC,KAAK;IAC/FA,UAAU,CAACY,SAAS,GAAGZ,UAAU,CAACY,SAAS,IAAI,CAAC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AAA,GAAnBD,qBAAA,CAAqB1B,OAAO,cAAA2B,qBAAA,uBAA5BA,qBAAA,CAA8BZ,MAAM,MAAK,CAAC,EAAE;IAAA,IAAAgB,qBAAA;IAC9C,CAAAA,qBAAA,GAAAnE,UAAU,CAAC6C,QAAQ,CAACT,OAAO,cAAA+B,qBAAA,uBAA3BA,qBAAA,CAA6BC,IAAI,CAAC,CAAC,CAAC,CAAC;EACvC;EACA,QAAAJ,qBAAA,GAAOhE,UAAU,CAAC6C,QAAQ,cAAAmB,qBAAA,uBAAnBA,qBAAA,CAAqB5B,OAAO;AACrC"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
/// <reference types="
|
|
1
|
+
/// <reference types="dist" />
|
|
2
2
|
import { Buffer, BufferProps } from '@luma.gl/api';
|
|
3
|
-
import type WebGPUDevice from '../webgpu-device';
|
|
4
|
-
export
|
|
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
|
-
protected createHandle(mapBuffer: boolean): GPUBuffer;
|
|
10
9
|
destroy(): void;
|
|
11
10
|
write(data: ArrayBufferView, byteOffset?: number): void;
|
|
12
11
|
readAsync(byteOffset?: number, byteLength?: number): Promise<ArrayBuffer>;
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"webgpu-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-buffer.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAMnD,qBAAa,YAAa,SAAQ,MAAM;IACtC,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;IAyB3C,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,WAAW,CAAC;IAmB5G,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI;IAQtD,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxE,cAAc,CAAC,MAAM,GAAE,MAAU,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW;IAI9D,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import { Buffer } from '@luma.gl/api';
|
|
3
|
-
|
|
4
3
|
function getByteLength(props) {
|
|
5
4
|
var _props$data;
|
|
6
|
-
|
|
7
5
|
return props.byteLength || ((_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.byteLength) || 0;
|
|
8
6
|
}
|
|
9
|
-
|
|
10
|
-
export default class WebGPUBuffer extends Buffer {
|
|
7
|
+
export class WebGPUBuffer extends Buffer {
|
|
11
8
|
constructor(device, props) {
|
|
12
9
|
super(device, props);
|
|
13
|
-
|
|
14
10
|
_defineProperty(this, "device", void 0);
|
|
15
|
-
|
|
16
11
|
_defineProperty(this, "handle", void 0);
|
|
17
|
-
|
|
18
12
|
_defineProperty(this, "byteLength", void 0);
|
|
19
|
-
|
|
20
13
|
this.device = device;
|
|
21
14
|
this.byteLength = getByteLength(props);
|
|
22
15
|
const mapBuffer = Boolean(props.data);
|
|
@@ -26,29 +19,23 @@ export default class WebGPUBuffer extends Buffer {
|
|
|
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
|
-
createHandle(mapBuffer) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
29
|
destroy() {
|
|
44
30
|
this.handle.destroy();
|
|
45
31
|
}
|
|
46
|
-
|
|
47
|
-
|
|
32
|
+
write(data) {
|
|
33
|
+
let byteOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
48
34
|
this.device.handle.queue.writeBuffer(this.handle, byteOffset, data.buffer, data.byteOffset, data.byteLength);
|
|
49
35
|
}
|
|
50
|
-
|
|
51
|
-
|
|
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;
|
|
52
39
|
const tempBuffer = new WebGPUBuffer(this.device, {
|
|
53
40
|
usage: Buffer.MAP_READ | Buffer.COPY_DST,
|
|
54
41
|
byteLength
|
|
@@ -62,23 +49,22 @@ export default class WebGPUBuffer extends Buffer {
|
|
|
62
49
|
tempBuffer.destroy();
|
|
63
50
|
return arrayBuffer;
|
|
64
51
|
}
|
|
65
|
-
|
|
66
52
|
_writeMapped(typedArray) {
|
|
67
53
|
const arrayBuffer = this.handle.getMappedRange();
|
|
68
54
|
new typedArray.constructor(arrayBuffer).set(typedArray);
|
|
69
55
|
}
|
|
70
|
-
|
|
71
|
-
|
|
56
|
+
mapAsync(mode) {
|
|
57
|
+
let offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
58
|
+
let size = arguments.length > 2 ? arguments[2] : undefined;
|
|
72
59
|
return this.handle.mapAsync(mode, offset, size);
|
|
73
60
|
}
|
|
74
|
-
|
|
75
|
-
|
|
61
|
+
getMappedRange() {
|
|
62
|
+
let offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
63
|
+
let size = arguments.length > 1 ? arguments[1] : undefined;
|
|
76
64
|
return this.handle.getMappedRange(offset, size);
|
|
77
65
|
}
|
|
78
|
-
|
|
79
66
|
unmap() {
|
|
80
67
|
this.handle.unmap();
|
|
81
68
|
}
|
|
82
|
-
|
|
83
69
|
}
|
|
84
70
|
//# sourceMappingURL=webgpu-buffer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"webgpu-buffer.js","names":["Buffer","getByteLength","props","_props$data","byteLength","data","WebGPUBuffer","constructor","device","_defineProperty","mapBuffer","Boolean","handle","createBuffer","size","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","typedArray","set","mode","offset"],"sources":["../../../src/adapter/resources/webgpu-buffer.ts"],"sourcesContent":["// WEBGPU Buffer implementation\nimport {Buffer, BufferProps} 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 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 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<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"],"mappings":";AACA,SAAQA,MAAM,QAAoB,cAAc;AAGhD,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;IAACO,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACrB,IAAI,CAACD,MAAM,GAAGA,MAAM;IAEpB,IAAI,CAACJ,UAAU,GAAGH,aAAa,CAACC,KAAK,CAAC;IACtC,MAAMQ,SAAS,GAAGC,OAAO,CAACT,KAAK,CAACG,IAAI,CAAC;IAErC,IAAI,CAACO,MAAM,GAAG,IAAI,CAACV,KAAK,CAACU,MAAM,IAAI,IAAI,CAACJ,MAAM,CAACI,MAAM,CAACC,YAAY,CAAC;MACjEC,IAAI,EAAE,IAAI,CAACV,UAAU;MAErBW,KAAK,EAAE,IAAI,CAACb,KAAK,CAACa,KAAK,IAAKC,cAAc,CAACC,MAAM,GAAGD,cAAc,CAACE,QAAS;MAC5EC,gBAAgB,EAAE,IAAI,CAACjB,KAAK,CAACiB,gBAAgB,IAAIT,SAAS;MAC1DU,KAAK,EAAE,IAAI,CAAClB,KAAK,CAACmB;IACpB,CAAC,CAAC;IAEF,IAAInB,KAAK,CAACG,IAAI,EAAE;MACd,IAAI,CAACiB,YAAY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-1,11 +1,10 @@
|
|
|
1
|
-
/// <reference types="
|
|
1
|
+
/// <reference types="dist" />
|
|
2
2
|
import { CommandEncoder, CommandEncoderProps, Buffer, Texture } from '@luma.gl/api';
|
|
3
|
-
import WebGPUDevice from '../webgpu-device';
|
|
4
|
-
export
|
|
3
|
+
import { WebGPUDevice } from '../webgpu-device';
|
|
4
|
+
export declare class WebGPUCommandEncoder extends CommandEncoder {
|
|
5
5
|
readonly device: WebGPUDevice;
|
|
6
6
|
readonly handle: GPUCommandEncoder;
|
|
7
7
|
constructor(device: WebGPUDevice, props: CommandEncoderProps);
|
|
8
|
-
protected createHandle(): GPUCommandEncoder;
|
|
9
8
|
destroy(): void;
|
|
10
9
|
finish(options?: {
|
|
11
10
|
id?: string;
|
|
@@ -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,
|
|
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,EAAE,MAAM,EAAE,OAAO,EAAO,MAAM,cAAc,CAAC;AACxF,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAI9C,qBAAa,oBAAqB,SAAQ,cAAc;IACtD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;gBAEvB,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,mBAAmB;IAUnD,OAAO,IAAI,IAAI;IAExB,MAAM,CAAC,OAAO,CAAC,EAAE;QAAC,EAAE,CAAC,EAAE,MAAM,CAAA;KAAC,GAAG,gBAAgB;IAOjD,kBAAkB,CAAC,OAAO,EAAE;QAC1B,MAAM,EAAE,MAAM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WebGPUCommandEncoder extends CommandEncoder {
|
|
4
4
|
constructor(device, props) {
|
|
5
5
|
super(props);
|
|
6
|
-
|
|
7
6
|
_defineProperty(this, "device", void 0);
|
|
8
|
-
|
|
9
7
|
_defineProperty(this, "handle", void 0);
|
|
10
|
-
|
|
11
8
|
this.device = device;
|
|
12
|
-
this.handle =
|
|
9
|
+
this.handle = props.handle || this.device.handle.createCommandEncoder({});
|
|
13
10
|
this.handle.label = this.props.id;
|
|
14
11
|
}
|
|
15
|
-
|
|
16
|
-
createHandle() {
|
|
17
|
-
return this.device.handle.createCommandEncoder({
|
|
18
|
-
measureExecutionTime: this.props.measureExecutionTime
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
12
|
destroy() {}
|
|
23
|
-
|
|
24
13
|
finish(options) {
|
|
25
14
|
return this.finish(options);
|
|
26
15
|
}
|
|
27
|
-
|
|
28
16
|
copyBufferToBuffer(options) {
|
|
29
17
|
var _options$sourceOffset, _options$destinationO, _options$size;
|
|
30
|
-
|
|
31
18
|
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);
|
|
32
19
|
}
|
|
33
|
-
|
|
34
20
|
copyBufferToTexture(options) {
|
|
35
21
|
var _options$offset, _options$mipLevel, _options$origin;
|
|
36
|
-
|
|
37
22
|
this.handle.copyBufferToTexture({
|
|
38
23
|
buffer: cast(options.source).handle,
|
|
39
24
|
offset: (_options$offset = options.offset) !== null && _options$offset !== void 0 ? _options$offset : 0,
|
|
@@ -43,24 +28,22 @@ export default class WebGPUCommandEncoder extends CommandEncoder {
|
|
|
43
28
|
texture: cast(options.destination).handle,
|
|
44
29
|
mipLevel: (_options$mipLevel = options.mipLevel) !== null && _options$mipLevel !== void 0 ? _options$mipLevel : 0,
|
|
45
30
|
origin: (_options$origin = options.origin) !== null && _options$origin !== void 0 ? _options$origin : {}
|
|
46
|
-
},
|
|
31
|
+
}, {
|
|
32
|
+
width: options.extent[0],
|
|
33
|
+
height: options.extent[1],
|
|
34
|
+
depthOrArrayLayers: options.extent[2]
|
|
35
|
+
});
|
|
47
36
|
}
|
|
48
|
-
|
|
49
37
|
copyTextureToBuffer(options) {}
|
|
50
|
-
|
|
51
38
|
copyTextureToTexture(options) {}
|
|
52
|
-
|
|
53
39
|
pushDebugGroup(groupLabel) {
|
|
54
40
|
this.handle.pushDebugGroup(groupLabel);
|
|
55
41
|
}
|
|
56
|
-
|
|
57
42
|
popDebugGroup() {
|
|
58
43
|
this.handle.popDebugGroup();
|
|
59
44
|
}
|
|
60
|
-
|
|
61
45
|
insertDebugMarker(markerLabel) {
|
|
62
46
|
this.handle.insertDebugMarker(markerLabel);
|
|
63
47
|
}
|
|
64
|
-
|
|
65
48
|
}
|
|
66
49
|
//# sourceMappingURL=webgpu-command-encoder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"webgpu-command-encoder.js","names":["CommandEncoder","cast","WebGPUCommandEncoder","constructor","device","props","_defineProperty","handle","createCommandEncoder","label","id","destroy","finish","options","copyBufferToBuffer","_options$sourceOffset","_options$destinationO","_options$size","source","sourceOffset","destination","destinationOffset","size","copyBufferToTexture","_options$offset","_options$mipLevel","_options$origin","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, cast} from '@luma.gl/api';\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(props);\n this.device = device;\n this.handle = props.handle || 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: {\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 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}"],"mappings":";AAAA,SAAQA,cAAc,EAAwCC,IAAI,QAAO,cAAc;AAKvF,OAAO,MAAMC,oBAAoB,SAASF,cAAc,CAAC;EAIvDG,WAAWA,CAACC,MAAoB,EAAEC,KAA0B,EAAE;IAC5D,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IACb,IAAI,CAACF,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACG,MAAM,GAAGF,KAAK,CAACE,MAAM,IAAI,IAAI,CAACH,MAAM,CAACG,MAAM,CAACC,oBAAoB,CAAC,CAGtE,CAAC,CAAC;IACF,IAAI,CAACD,MAAM,CAACE,KAAK,GAAG,IAAI,CAACJ,KAAK,CAACK,EAAE;EACnC;EAESC,OAAOA,CAAA,EAAS,CAAC;EAE1BC,MAAMA,CAACC,OAAuB,EAAoB;IAChD,OAAO,IAAI,CAACD,MAAM,CAACC,OAAO,CAAC;EAC7B;EAKAC,kBAAkBA,CAACD,OAMlB,EAAQ;IAAA,IAAAE,qBAAA,EAAAC,qBAAA,EAAAC,aAAA;IACP,IAAI,CAACV,MAAM,CAACO,kBAAkB,CAC5Bb,IAAI,CAAeY,OAAO,CAACK,MAAM,CAAC,CAACX,MAAM,GAAAQ,qBAAA,GACzCF,OAAO,CAACM,YAAY,cAAAJ,qBAAA,cAAAA,qBAAA,GAAI,CAAC,EACzBd,IAAI,CAAeY,OAAO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Ac,CAACC,UAAU,CAAC;EACxC;EAESC,aAAaA,CAAA,EAAS;IAC7B,IAAI,CAACnC,MAAM,CAACmC,aAAa,EAAE;EAC7B;EAESC,iBAAiBA,CAACC,WAAmB,EAAQ;IACpD,IAAI,CAACrC,MAAM,CAACoC,iBAAiB,CAACC,WAAW,CAAC;EAC5C;AAWF"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/// <reference types="
|
|
1
|
+
/// <reference types="dist" />
|
|
2
2
|
import { ComputePass, ComputePassProps, ComputePipeline, Buffer, Binding } from '@luma.gl/api';
|
|
3
|
-
import WebGPUDevice from '../webgpu-device';
|
|
4
|
-
export
|
|
3
|
+
import { WebGPUDevice } from '../webgpu-device';
|
|
4
|
+
export declare class WebGPUComputePass extends ComputePass {
|
|
5
5
|
readonly device: WebGPUDevice;
|
|
6
6
|
readonly handle: GPUComputePassEncoder;
|
|
7
|
-
_bindGroupLayout: GPUBindGroupLayout;
|
|
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
|
-
|
|
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,cAAc,CAAC;AACnG,OAAO,YAAY,MAAM,kBAAkB,CAAC;
|
|
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,cAAc,CAAC;AACnG,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAK9C,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,gBAAgB,EAAE,kBAAkB,GAAG,IAAI,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;IAI1E,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAGxC,aAAa,IAAI,IAAI;IAGrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAO7C"}
|
|
@@ -1,56 +1,44 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import { ComputePass, cast } from '@luma.gl/api';
|
|
3
|
-
export
|
|
3
|
+
export class WebGPUComputePass extends ComputePass {
|
|
4
4
|
constructor(device, props) {
|
|
5
|
+
var _device$commandEncode;
|
|
5
6
|
super(device, props);
|
|
6
|
-
|
|
7
7
|
_defineProperty(this, "device", void 0);
|
|
8
|
-
|
|
9
8
|
_defineProperty(this, "handle", void 0);
|
|
10
|
-
|
|
11
|
-
_defineProperty(this, "_bindGroupLayout", void 0);
|
|
12
|
-
|
|
9
|
+
_defineProperty(this, "_bindGroupLayout", null);
|
|
13
10
|
this.device = device;
|
|
14
|
-
this.handle = this.props.handle || device.commandEncoder.beginComputePass({
|
|
11
|
+
this.handle = this.props.handle || ((_device$commandEncode = device.commandEncoder) === null || _device$commandEncode === void 0 ? void 0 : _device$commandEncode.beginComputePass({
|
|
15
12
|
label: this.props.id
|
|
16
|
-
});
|
|
13
|
+
}));
|
|
17
14
|
}
|
|
18
|
-
|
|
19
15
|
destroy() {}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
this.handle.endPass();
|
|
16
|
+
end() {
|
|
17
|
+
this.handle.end();
|
|
23
18
|
}
|
|
24
|
-
|
|
25
19
|
setPipeline(pipeline) {
|
|
26
20
|
const wgpuPipeline = cast(pipeline);
|
|
27
21
|
this.handle.setPipeline(wgpuPipeline.handle);
|
|
28
22
|
this._bindGroupLayout = wgpuPipeline._getBindGroupLayout();
|
|
29
23
|
}
|
|
30
|
-
|
|
31
24
|
setBindings(bindings) {
|
|
32
25
|
throw new Error('fix me');
|
|
33
26
|
}
|
|
34
|
-
|
|
35
27
|
dispatch(x, y, z) {
|
|
36
|
-
this.handle.
|
|
28
|
+
this.handle.dispatchWorkgroups(x, y, z);
|
|
37
29
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
this.handle.
|
|
30
|
+
dispatchIndirect(indirectBuffer) {
|
|
31
|
+
let indirectOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
32
|
+
this.handle.dispatchWorkgroupsIndirect(cast(indirectBuffer).handle, indirectOffset);
|
|
41
33
|
}
|
|
42
|
-
|
|
43
34
|
pushDebugGroup(groupLabel) {
|
|
44
35
|
this.handle.pushDebugGroup(groupLabel);
|
|
45
36
|
}
|
|
46
|
-
|
|
47
37
|
popDebugGroup() {
|
|
48
38
|
this.handle.popDebugGroup();
|
|
49
39
|
}
|
|
50
|
-
|
|
51
40
|
insertDebugMarker(markerLabel) {
|
|
52
41
|
this.handle.insertDebugMarker(markerLabel);
|
|
53
42
|
}
|
|
54
|
-
|
|
55
43
|
}
|
|
56
44
|
//# sourceMappingURL=webgpu-compute-pass.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"webgpu-compute-pass.js","names":["ComputePass","cast","WebGPUComputePass","constructor","device","props","_device$commandEncode","_defineProperty","handle","commandEncoder","beginComputePass","label","id","destroy","end","setPipeline","pipeline","wgpuPipeline","_bindGroupLayout","_getBindGroupLayout","setBindings","bindings","Error","dispatch","x","y","z","dispatchWorkgroups","dispatchIndirect","indirectBuffer","indirectOffset","arguments","length","undefined","dispatchWorkgroupsIndirect","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"sources":["../../../src/adapter/resources/webgpu-compute-pass.ts"],"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 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 = 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.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 this.handle.dispatchWorkgroupsIndirect(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"],"mappings":";AAAA,SAAQA,WAAW,EAAsDC,IAAI,QAAO,cAAc;AAMlG,OAAO,MAAMC,iBAAiB,SAASF,WAAW,CAAC;EAKjDG,WAAWA,CAACC,MAAoB,EAAEC,KAAuB,EAAE;IAAA,IAAAC,qBAAA;IACzD,KAAK,CAACF,MAAM,EAAEC,KAAK,CAAC;IAACE,eAAA;IAAAA,eAAA;IAAAA,eAAA,2BAHuB,IAAI;IAIhD,IAAI,CAACH,MAAM,GAAGA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B;EACAC,iBAAiBA,CAACC,WAAmB,EAAQ;IAC3C,IAAI,CAAC/B,MAAM,CAAC8B,iBAAiB,CAACC,WAAW,CAAC;EAC5C;AAKF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/// <reference types="
|
|
1
|
+
/// <reference types="dist" />
|
|
2
2
|
import { ComputePipeline, ComputePipelineProps } from '@luma.gl/api';
|
|
3
|
-
import WebGPUDevice from '../webgpu-device';
|
|
3
|
+
import { WebGPUDevice } from '../webgpu-device';
|
|
4
4
|
/** Creates a new compute pipeline when parameters change */
|
|
5
|
-
export
|
|
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;
|
|
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,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,13 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import { ComputePipeline, cast } from '@luma.gl/api';
|
|
3
|
-
export
|
|
3
|
+
export class WebGPUComputePipeline extends ComputePipeline {
|
|
4
4
|
constructor(device, props) {
|
|
5
5
|
super(device, props);
|
|
6
|
-
|
|
7
6
|
_defineProperty(this, "device", void 0);
|
|
8
|
-
|
|
9
7
|
_defineProperty(this, "handle", void 0);
|
|
10
|
-
|
|
11
8
|
this.device = device;
|
|
12
9
|
const module = cast(this.props.cs).handle;
|
|
13
10
|
this.handle = this.props.handle || this.device.handle.createComputePipeline({
|
|
@@ -15,13 +12,12 @@ export default class WebGPUComputePipeline extends ComputePipeline {
|
|
|
15
12
|
compute: {
|
|
16
13
|
module,
|
|
17
14
|
entryPoint: this.props.csEntryPoint
|
|
18
|
-
}
|
|
15
|
+
},
|
|
16
|
+
layout: 'auto'
|
|
19
17
|
});
|
|
20
18
|
}
|
|
21
|
-
|
|
22
19
|
_getBindGroupLayout() {
|
|
23
20
|
return this.handle.getBindGroupLayout(0);
|
|
24
21
|
}
|
|
25
|
-
|
|
26
22
|
}
|
|
27
23
|
//# sourceMappingURL=webgpu-compute-pipeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"webgpu-compute-pipeline.js","names":["ComputePipeline","cast","WebGPUComputePipeline","constructor","device","props","_defineProperty","module","cs","handle","createComputePipeline","label","id","compute","entryPoint","csEntryPoint","layout","_getBindGroupLayout","getBindGroupLayout"],"sources":["../../../src/adapter/resources/webgpu-compute-pipeline.ts"],"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 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 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,EAAwBC,IAAI,QAAO,cAAc;AAQxE,OAAO,MAAMC,qBAAqB,SAASF,eAAe,CAAC;EAIzDG,WAAWA,CAACC,MAAoB,EAAEC,KAA2B,EAAE;IAC7D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IACrB,IAAI,CAACF,MAAM,GAAGA,MAAM;IAEpB,MAAMG,MAAM,GAAGN,IAAI,CAAe,IAAI,CAACI,KAAK,CAACG,EAAE,CAAC,CAACC,MAAM;IACvD,IAAI,CAACA,MAAM,GAAG,IAAI,CAACJ,KAAK,CAACI,MAAM,IAAI,IAAI,CAACL,MAAM,CAACK,MAAM,CAACC,qBAAqB,CAAC;MAC1EC,KAAK,EAAE,IAAI,CAACN,KAAK,CAACO,EAAE;MACpBC,OAAO,EAAE;QACPN,MAAM;QACNO,UAAU,EAAE,IAAI,CAACT,KAAK,CAACU;MAEzB,CAAC;MACDC,MAAM,EAAE;IACV,CAAC,CAAC;EACJ;EAGAC,mBAAmBA,CAAA,EAAG;IAEpB,OAAO,IAAI,CAACR,MAAM,CAACS,kBAAkB,CAAC,CAAC,CAAC;EAC1C;AACF"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/// <reference types="
|
|
1
|
+
/// <reference types="dist" />
|
|
2
2
|
import { ExternalTexture, ExternalTextureProps, Sampler, SamplerProps } from '@luma.gl/api';
|
|
3
|
-
import type WebGPUDevice from '../webgpu-device';
|
|
4
|
-
import WebGPUSampler from './webgpu-sampler';
|
|
3
|
+
import type { WebGPUDevice } from '../webgpu-device';
|
|
4
|
+
import { WebGPUSampler } from './webgpu-sampler';
|
|
5
5
|
/**
|
|
6
6
|
* Cheap, temporary texture view for videos
|
|
7
7
|
* Only valid within same callback, destroyed automatically as a microtask.
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export declare class WebGPUExternalTexture extends ExternalTexture {
|
|
10
10
|
readonly device: WebGPUDevice;
|
|
11
11
|
readonly handle: GPUExternalTexture;
|
|
12
12
|
sampler: WebGPUSampler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgpu-external-texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-external-texture.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAE,OAAO,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAC1F,OAAO,KAAK,YAAY,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"webgpu-external-texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgpu-external-texture.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAE,OAAO,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAC1F,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE/C;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,eAAe;IACxD,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,OAAO,EAAE,aAAa,CAAC;gBAEX,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,oBAAoB;IAUpD,OAAO,IAAI,IAAI;IAMxB,0BAA0B;IAC1B,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI;CAKlD"}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import { ExternalTexture } from '@luma.gl/api';
|
|
3
|
-
import WebGPUSampler from
|
|
4
|
-
export
|
|
3
|
+
import { WebGPUSampler } from "./webgpu-sampler.js";
|
|
4
|
+
export class WebGPUExternalTexture extends ExternalTexture {
|
|
5
5
|
constructor(device, props) {
|
|
6
6
|
super(device, props);
|
|
7
|
-
|
|
8
7
|
_defineProperty(this, "device", void 0);
|
|
9
|
-
|
|
10
8
|
_defineProperty(this, "handle", void 0);
|
|
11
|
-
|
|
12
9
|
_defineProperty(this, "sampler", void 0);
|
|
13
|
-
|
|
14
10
|
this.device = device;
|
|
15
11
|
this.handle = this.props.handle || this.device.handle.importExternalTexture({
|
|
16
12
|
source: props.source,
|
|
@@ -18,13 +14,10 @@ export default class WebGPUExternalTexture extends ExternalTexture {
|
|
|
18
14
|
});
|
|
19
15
|
this.sampler = null;
|
|
20
16
|
}
|
|
21
|
-
|
|
22
17
|
destroy() {}
|
|
23
|
-
|
|
24
18
|
setSampler(sampler) {
|
|
25
19
|
this.sampler = sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);
|
|
26
20
|
return this;
|
|
27
21
|
}
|
|
28
|
-
|
|
29
22
|
}
|
|
30
23
|
//# sourceMappingURL=webgpu-external-texture.js.map
|