@luma.gl/webgpu 9.1.2 → 9.1.4
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/dist/adapter/helpers/get-vertex-buffer-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-vertex-buffer-layout.js +3 -2
- package/dist/adapter/helpers/get-vertex-buffer-layout.js.map +1 -1
- package/dist/adapter/helpers/webgpu-parameters.d.ts.map +1 -1
- package/dist/adapter/helpers/webgpu-parameters.js +7 -3
- package/dist/adapter/helpers/webgpu-parameters.js.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pass.js +4 -1
- package/dist/adapter/resources/webgpu-render-pass.js.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgpu-render-pipeline.js +7 -0
- package/dist/adapter/resources/webgpu-render-pipeline.js.map +1 -1
- package/dist/dist.dev.js +70 -55
- package/dist/dist.min.js +4 -4
- package/dist/index.cjs +68 -55
- package/dist/index.cjs.map +3 -3
- package/package.json +2 -2
- package/src/adapter/helpers/get-vertex-buffer-layout.ts +3 -2
- package/src/adapter/helpers/webgpu-parameters.ts +7 -4
- package/src/adapter/resources/webgpu-render-pass.ts +8 -2
- package/src/adapter/resources/webgpu-render-pipeline.ts +8 -0
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/adapter/webgpu-adapter.ts", "../src/adapter/webgpu-device.ts", "../src/adapter/resources/webgpu-buffer.ts", "../src/adapter/resources/webgpu-texture.ts", "../src/adapter/helpers/convert-texture-format.ts", "../src/adapter/resources/webgpu-sampler.ts", "../src/adapter/resources/webgpu-texture-view.ts", "../src/adapter/resources/webgpu-external-texture.ts", "../src/adapter/resources/webgpu-shader.ts", "../src/adapter/resources/webgpu-render-pipeline.ts", "../src/adapter/helpers/webgpu-parameters.ts", "../src/adapter/helpers/get-bind-group.ts", "../src/adapter/helpers/get-vertex-buffer-layout.ts", "../src/adapter/resources/webgpu-framebuffer.ts", "../src/adapter/resources/webgpu-compute-pipeline.ts", "../src/adapter/resources/webgpu-render-pass.ts", "../src/adapter/resources/webgpu-compute-pass.ts", "../src/adapter/resources/webgpu-vertex-array.ts", "../src/adapter/webgpu-canvas-context.ts", "../src/adapter/resources/webgpu-query-set.ts"],
|
|
4
|
-
"sourcesContent": ["// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// WEBGPU ADAPTER\nexport type {WebGPUAdapter} from './adapter/webgpu-adapter';\nexport {webgpuAdapter} from './adapter/webgpu-adapter';\n\n// WEBGPU CLASSES (typically not accessed directly)\nexport {WebGPUDevice} from './adapter/webgpu-device';\nexport {WebGPUBuffer} from './adapter/resources/webgpu-buffer';\nexport {WebGPUTexture} from './adapter/resources/webgpu-texture';\nexport {WebGPUSampler} from './adapter/resources/webgpu-sampler';\nexport {WebGPUShader} from './adapter/resources/webgpu-shader';\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {Adapter, DeviceProps, log} from '@luma.gl/core';\nimport {WebGPUDevice} from './webgpu-device';\n\n// / <reference types=\"@webgpu/types\" />\n\nexport class WebGPUAdapter extends Adapter {\n /** type of device's created by this adapter */\n readonly type: WebGPUDevice['type'] = 'webgpu';\n\n constructor() {\n super();\n // @ts-ignore For backwards compatibility luma.registerDevices\n WebGPUDevice.adapter = this;\n }\n\n /** Check if WebGPU is available */\n isSupported(): boolean {\n return Boolean(typeof navigator !== 'undefined' && navigator.gpu);\n }\n\n async create(props: DeviceProps): Promise<WebGPUDevice> {\n if (!navigator.gpu) {\n throw new Error(\n 'WebGPU not available. Open in Chrome Canary and turn on chrome://flags/#enable-unsafe-webgpu'\n );\n }\n log.groupCollapsed(1, 'WebGPUDevice created')();\n const adapter = await navigator.gpu.requestAdapter({\n powerPreference: 'high-performance'\n // forceSoftware: false\n });\n\n if (!adapter) {\n throw new Error('Failed to request WebGPU adapter');\n }\n\n const adapterInfo =\n adapter.info ||\n // @ts-ignore Chrome has removed this function\n (await adapter.requestAdapterInfo?.());\n log.probe(2, 'Adapter available', adapterInfo)();\n\n const requiredFeatures: GPUFeatureName[] = [];\n const requiredLimits: Record<string, number> = {};\n\n if (props._requestMaxLimits) {\n // Require all features\n requiredFeatures.push(...(Array.from(adapter.features) as GPUFeatureName[]));\n\n // Require all limits\n // Filter out chrome specific keys (avoid crash)\n const limits = Object.keys(adapter.limits).filter(\n key => !['minSubgroupSize', 'maxSubgroupSize'].includes(key)\n );\n for (const key of limits) {\n const limit = key as keyof GPUSupportedLimits;\n const value = adapter.limits[limit];\n if (typeof value === 'number') {\n requiredLimits[limit] = value;\n }\n }\n }\n\n const gpuDevice = await adapter.requestDevice({\n requiredFeatures,\n requiredLimits\n });\n\n log.probe(1, 'GPUDevice available')();\n\n const device = new WebGPUDevice(props, gpuDevice, adapter, adapterInfo);\n\n log.probe(\n 1,\n 'Device created. For more info, set chrome://flags/#enable-webgpu-developer-features'\n )();\n log.table(1, device.info)();\n log.groupEnd(1)();\n return device;\n }\n\n async attach(handle: GPUDevice): Promise<WebGPUDevice> {\n throw new Error('WebGPUAdapter.attach() not implemented');\n }\n}\n\nexport const webgpuAdapter = new WebGPUAdapter();\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// prettier-ignore\n// / <reference types=\"@webgpu/types\" />\n\nimport type {\n DeviceInfo,\n DeviceLimits,\n DeviceFeature,\n DeviceTextureFormatCapabilities,\n CanvasContextProps,\n BufferProps,\n SamplerProps,\n ShaderProps,\n Texture,\n TextureProps,\n ExternalTextureProps,\n FramebufferProps,\n RenderPipelineProps,\n ComputePipelineProps,\n RenderPassProps,\n ComputePassProps,\n // CommandEncoderProps,\n VertexArrayProps,\n TransformFeedback,\n TransformFeedbackProps,\n QuerySet,\n QuerySetProps,\n DeviceProps\n} from '@luma.gl/core';\nimport {Device, DeviceFeatures} from '@luma.gl/core';\nimport {WebGPUBuffer} from './resources/webgpu-buffer';\nimport {WebGPUTexture} from './resources/webgpu-texture';\nimport {WebGPUExternalTexture} from './resources/webgpu-external-texture';\nimport {WebGPUSampler} from './resources/webgpu-sampler';\nimport {WebGPUShader} from './resources/webgpu-shader';\nimport {WebGPURenderPipeline} from './resources/webgpu-render-pipeline';\nimport {WebGPUFramebuffer} from './resources/webgpu-framebuffer';\nimport {WebGPUComputePipeline} from './resources/webgpu-compute-pipeline';\nimport {WebGPURenderPass} from './resources/webgpu-render-pass';\nimport {WebGPUComputePass} from './resources/webgpu-compute-pass';\n// import {WebGPUCommandEncoder} from './resources/webgpu-command-encoder';\nimport {WebGPUVertexArray} from './resources/webgpu-vertex-array';\n\nimport {WebGPUCanvasContext} from './webgpu-canvas-context';\nimport {WebGPUQuerySet} from './resources/webgpu-query-set';\n\n/** WebGPU Device implementation */\nexport class WebGPUDevice extends Device {\n /** type of this device */\n readonly type = 'webgpu';\n\n /** The underlying WebGPU device */\n readonly handle: GPUDevice;\n /* The underlying WebGPU adapter */\n readonly adapter: GPUAdapter;\n /* The underlying WebGPU adapter's info */\n readonly adapterInfo: GPUAdapterInfo;\n\n readonly features: DeviceFeatures;\n readonly info: DeviceInfo;\n readonly limits: DeviceLimits;\n\n readonly lost: Promise<{reason: 'destroyed'; message: string}>;\n canvasContext: WebGPUCanvasContext | null = null;\n\n private _isLost: boolean = false;\n commandEncoder: GPUCommandEncoder | null = null;\n renderPass: WebGPURenderPass | null = null;\n\n constructor(\n props: DeviceProps,\n device: GPUDevice,\n adapter: GPUAdapter,\n adapterInfo: GPUAdapterInfo\n ) {\n super({...props, id: props.id || 'webgpu-device'});\n this.handle = device;\n this.adapter = adapter;\n this.adapterInfo = adapterInfo;\n\n this.info = this._getInfo();\n this.features = this._getFeatures();\n this.limits = this.handle.limits;\n\n // Listen for uncaptured WebGPU errors\n device.addEventListener('uncapturederror', (event: Event) => {\n // TODO is this the right way to make sure the error is an Error instance?\n const errorMessage =\n event instanceof GPUUncapturedErrorEvent ? event.error.message : 'Unknown WebGPU error';\n this.reportError(new Error(errorMessage));\n if (this.props.debug) {\n // eslint-disable-next-line no-debugger\n debugger;\n }\n event.preventDefault();\n });\n\n // \"Context\" loss handling\n this.lost = new Promise<{reason: 'destroyed'; message: string}>(async resolve => {\n const lostInfo = await this.handle.lost;\n this._isLost = true;\n resolve({reason: 'destroyed', message: lostInfo.message});\n });\n\n // Note: WebGPU devices can be created without a canvas, for compute shader purposes\n const canvasContextProps = Device._getCanvasContextProps(props);\n if (canvasContextProps) {\n this.canvasContext = new WebGPUCanvasContext(this, this.adapter, canvasContextProps);\n }\n }\n\n // TODO\n // Load the glslang module now so that it is available synchronously when compiling shaders\n // const {glsl = true} = props;\n // this.glslang = glsl && await loadGlslangModule();\n\n destroy(): void {\n this.handle.destroy();\n }\n\n get isLost(): boolean {\n return this._isLost;\n }\n\n createBuffer(props: BufferProps | ArrayBuffer | ArrayBufferView): WebGPUBuffer {\n const newProps = this._normalizeBufferProps(props);\n return new WebGPUBuffer(this, newProps);\n }\n\n createTexture(props: TextureProps): WebGPUTexture {\n return new WebGPUTexture(this, props);\n }\n\n createExternalTexture(props: ExternalTextureProps): WebGPUExternalTexture {\n return new WebGPUExternalTexture(this, props);\n }\n\n createShader(props: ShaderProps): WebGPUShader {\n return new WebGPUShader(this, props);\n }\n\n createSampler(props: SamplerProps): WebGPUSampler {\n return new WebGPUSampler(this, props);\n }\n\n createRenderPipeline(props: RenderPipelineProps): WebGPURenderPipeline {\n return new WebGPURenderPipeline(this, props);\n }\n\n createFramebuffer(props: FramebufferProps): WebGPUFramebuffer {\n return new WebGPUFramebuffer(this, props);\n }\n\n createComputePipeline(props: ComputePipelineProps): WebGPUComputePipeline {\n return new WebGPUComputePipeline(this, props);\n }\n\n createVertexArray(props: VertexArrayProps): WebGPUVertexArray {\n return new WebGPUVertexArray(this, props);\n }\n\n // WebGPU specifics\n\n /**\n * Allows a render pass to begin against a canvas context\n * @todo need to support a \"Framebuffer\" equivalent (aka preconfigured RenderPassDescriptors?).\n */\n beginRenderPass(props: RenderPassProps): WebGPURenderPass {\n this.commandEncoder = this.commandEncoder || this.handle.createCommandEncoder();\n return new WebGPURenderPass(this, props);\n }\n\n beginComputePass(props: ComputePassProps): WebGPUComputePass {\n this.commandEncoder = this.commandEncoder || this.handle.createCommandEncoder();\n return new WebGPUComputePass(this, props);\n }\n\n // createCommandEncoder(props: CommandEncoderProps): WebGPUCommandEncoder {\n // return new WebGPUCommandEncoder(this, props);\n // }\n\n createTransformFeedback(props: TransformFeedbackProps): TransformFeedback {\n throw new Error('Transform feedback not supported in WebGPU');\n }\n\n override createQuerySet(props: QuerySetProps): QuerySet {\n return new WebGPUQuerySet(this, props);\n }\n\n createCanvasContext(props: CanvasContextProps): WebGPUCanvasContext {\n return new WebGPUCanvasContext(this, this.adapter, props);\n }\n\n submit(): void {\n const commandBuffer = this.commandEncoder?.finish();\n if (commandBuffer) {\n this.handle.pushErrorScope('validation');\n this.handle.queue.submit([commandBuffer]);\n this.handle.popErrorScope().then((error: GPUError | null) => {\n if (error) {\n this.reportError(new Error(`WebGPU command submission failed: ${error.message}`));\n }\n });\n }\n this.commandEncoder = null;\n }\n\n // PRIVATE METHODS\n\n protected _getInfo(): DeviceInfo {\n const [driver, driverVersion] = ((this.adapterInfo as any).driver || '').split(' Version ');\n\n // See https://developer.chrome.com/blog/new-in-webgpu-120#adapter_information_updates\n const vendor = this.adapterInfo.vendor || this.adapter.__brand || 'unknown';\n const renderer = driver || '';\n const version = driverVersion || '';\n\n const gpu = vendor === 'apple' ? 'apple' : 'unknown'; // 'nvidia' | 'amd' | 'intel' | 'apple' | 'unknown',\n const gpuArchitecture = this.adapterInfo.architecture || 'unknown';\n const gpuBackend = (this.adapterInfo as any).backend || 'unknown';\n const gpuType = ((this.adapterInfo as any).type || '').split(' ')[0].toLowerCase() || 'unknown';\n\n return {\n type: 'webgpu',\n vendor,\n renderer,\n version,\n gpu,\n gpuType,\n gpuBackend,\n gpuArchitecture,\n shadingLanguage: 'wgsl',\n shadingLanguageVersion: 100\n };\n }\n\n protected _getFeatures(): DeviceFeatures {\n // Initialize with actual WebGPU Features (note that unknown features may not be in DeviceFeature type)\n const features = new Set<DeviceFeature>(this.handle.features as Set<DeviceFeature>);\n // Fixups for pre-standard names: https://github.com/webgpu-native/webgpu-headers/issues/133\n // @ts-expect-error Chrome Canary v99\n if (features.has('depth-clamping')) {\n // @ts-expect-error Chrome Canary v99\n features.delete('depth-clamping');\n features.add('depth-clip-control');\n }\n\n // Some subsets of WebGPU extensions correspond to WebGL extensions\n if (features.has('texture-compression-bc')) {\n features.add('texture-compression-bc5-webgl');\n }\n\n const WEBGPU_ALWAYS_FEATURES: DeviceFeature[] = [\n 'timer-query-webgl',\n 'compilation-status-async-webgl',\n 'float32-renderable-webgl',\n 'float16-renderable-webgl',\n 'norm16-renderable-webgl',\n 'texture-filterable-anisotropic-webgl',\n 'shader-noperspective-interpolation-webgl'\n ];\n\n for (const feature of WEBGPU_ALWAYS_FEATURES) {\n features.add(feature);\n }\n\n return new DeviceFeatures(Array.from(features), this.props._disabledFeatures);\n }\n\n override _getDeviceSpecificTextureFormatCapabilities(\n capabilities: DeviceTextureFormatCapabilities\n ): DeviceTextureFormatCapabilities {\n const {format} = capabilities;\n if (format.includes('webgl')) {\n return {format, create: false, render: false, filter: false, blend: false, store: false};\n }\n return capabilities;\n }\n\n // DEPRECATED METHODS\n\n // @deprecated\n copyExternalImageToTexture(options: {\n texture: Texture;\n mipLevel?: number;\n aspect?: 'all' | 'stencil-only' | 'depth-only';\n colorSpace?: 'display-p3' | 'srgb';\n premultipliedAlpha?: boolean;\n\n source: ImageBitmap | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas;\n sourceX?: number;\n sourceY?: number;\n\n width?: number;\n height?: number;\n depth?: number;\n }): void {\n const {\n source,\n sourceX = 0,\n sourceY = 0,\n\n texture,\n mipLevel = 0,\n aspect = 'all',\n colorSpace = 'display-p3',\n premultipliedAlpha = false,\n // destinationX,\n // destinationY,\n // desitnationZ,\n\n width = texture.width,\n height = texture.height,\n depth = 1\n } = options;\n\n const webGpuTexture = texture as WebGPUTexture;\n\n this.handle?.queue.copyExternalImageToTexture(\n // source: GPUImageCopyExternalImage\n {\n source,\n origin: [sourceX, sourceY]\n },\n // destination: GPUImageCopyTextureTagged\n {\n texture: webGpuTexture.handle,\n origin: [0, 0, 0], // [x, y, z],\n mipLevel,\n aspect,\n colorSpace,\n premultipliedAlpha\n },\n // copySize: GPUExtent3D\n [width, height, depth]\n );\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\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 =\n this.props.handle ||\n 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 // @ts-expect-error readonly\n this.handle = null;\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(\n byteOffset: number = 0,\n byteLength: number = this.byteLength\n ): 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, {\n usage: Buffer.MAP_READ | Buffer.COPY_DST,\n byteLength\n });\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", "// luma.gl, MIT license\nimport type {\n // Device,\n TextureProps,\n TextureViewProps,\n Sampler,\n SamplerProps,\n // TextureFormat,\n // TextureCubeFace,\n // ExternalImage,\n // TextureLevelData,\n Texture1DData,\n Texture2DData,\n Texture3DData,\n TextureCubeData,\n TextureArrayData,\n TextureCubeArrayData,\n ExternalImage\n} from '@luma.gl/core';\nimport {Texture} from '@luma.gl/core';\n\nimport {getWebGPUTextureFormat} from '../helpers/convert-texture-format';\nimport type {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUSampler} from './webgpu-sampler';\nimport {WebGPUTextureView} from './webgpu-texture-view';\n\nconst BASE_DIMENSIONS: Record<string, '1d' | '2d' | '3d'> = {\n '1d': '1d',\n '2d': '2d',\n '2d-array': '2d',\n cube: '2d',\n 'cube-array': '2d',\n '3d': '3d'\n};\n\nexport class WebGPUTexture extends Texture {\n readonly device: WebGPUDevice;\n readonly handle: GPUTexture;\n\n sampler: WebGPUSampler;\n view: WebGPUTextureView;\n\n constructor(device: WebGPUDevice, props: TextureProps) {\n super(device, props);\n this.device = device;\n\n // Texture base class strips out the data prop, so we need to add it back in\n const propsWithData = {...this.props};\n if (props.data) {\n propsWithData.data = props.data;\n }\n\n this.initialize(propsWithData);\n }\n\n override destroy(): void {\n this.handle?.destroy();\n // @ts-expect-error readonly\n this.handle = null;\n }\n\n createView(props: TextureViewProps): WebGPUTextureView {\n return new WebGPUTextureView(this.device, {...props, texture: this});\n }\n\n protected initialize(props: TextureProps): void {\n // @ts-expect-error\n this.handle = this.props.handle || this.createHandle();\n this.handle.label ||= this.id;\n\n if (this.props.data) {\n if (Texture.isExternalImage(this.props.data)) {\n this.copyExternalImage({image: this.props.data});\n } else {\n this.setData({data: this.props.data});\n }\n }\n\n this.width = this.handle.width;\n this.height = this.handle.height;\n // Why not just read all properties directly from the texture\n // this.depthOrArrayLayers = this.handle.depthOrArrayLayers;\n // this.mipLevelCount = this.handle.mipLevelCount;\n // this.sampleCount = this.handle.sampleCount;\n // this.dimension = this.handle.dimension;\n // this.format = this.handle.format;\n // this.usage = this.handle.usage;\n\n // Create a default sampler. This mimics the WebGL1 API where sampler props are stored on the texture\n // this.setSampler(props.sampler);\n this.sampler =\n props.sampler instanceof WebGPUSampler\n ? props.sampler\n : new WebGPUSampler(this.device, props.sampler || {});\n\n // TODO - To support texture arrays we need to create custom views...\n // But we are not ready to expose TextureViews to the public API.\n // @ts-expect-error\n\n this.view = new WebGPUTextureView(this.device, {...this.props, texture: this});\n // format: this.props.format,\n // dimension: this.props.dimension,\n // aspect = \"all\";\n // baseMipLevel: 0;\n // mipLevelCount;\n // baseArrayLayer = 0;\n // arrayLayerCount;\n }\n\n protected createHandle(): GPUTexture {\n // Deduce size from data - TODO this is a hack\n // @ts-expect-error\n const width = this.props.width || this.props.data?.width || 1;\n // @ts-expect-error\n const height = this.props.height || this.props.data?.height || 1;\n\n return this.device.handle.createTexture({\n label: this.id,\n size: {\n width,\n height,\n depthOrArrayLayers: this.depth\n },\n usage: this.props.usage || Texture.TEXTURE | Texture.COPY_DST,\n dimension: BASE_DIMENSIONS[this.dimension],\n format: getWebGPUTextureFormat(this.format),\n mipLevelCount: this.mipLevels,\n sampleCount: this.props.samples\n });\n }\n\n /** @deprecated - intention is to use the createView public API */\n createGPUTextureView(): GPUTextureView {\n return this.handle.createView({label: this.id});\n }\n\n /**\n * Set default sampler\n * Accept a sampler instance or set of props;\n */\n setSampler(sampler: Sampler | SamplerProps): this {\n this.sampler =\n sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);\n return this;\n }\n\n setTexture1DData(data: Texture1DData): void {\n throw new Error('not implemented');\n }\n\n setTexture2DData(lodData: Texture2DData, depth?: number, target?: number): void {\n throw new Error('not implemented');\n }\n\n setTexture3DData(lodData: Texture3DData, depth?: number, target?: number): void {\n throw new Error('not implemented');\n }\n\n setTextureCubeData(data: TextureCubeData, depth?: number): void {\n throw new Error('not implemented');\n }\n\n setTextureArrayData(data: TextureArrayData): void {\n throw new Error('not implemented');\n }\n\n setTextureCubeArrayData(data: TextureCubeArrayData): void {\n throw new Error('not implemented');\n }\n\n setData(options: {data: any}): {width: number; height: number} {\n if (ArrayBuffer.isView(options.data)) {\n const clampedArray = new Uint8ClampedArray(options.data.buffer);\n // TODO - pass through src data color space as ImageData Options?\n const image = new ImageData(clampedArray, this.width, this.height);\n return this.copyExternalImage({image});\n }\n\n throw new Error('Texture.setData: Use CommandEncoder to upload data to texture in WebGPU');\n }\n\n copyExternalImage(options: {\n image: ExternalImage;\n width?: number;\n height?: number;\n depth?: number;\n sourceX?: number;\n sourceY?: number;\n mipLevel?: number;\n x?: number;\n y?: number;\n z?: number;\n aspect?: 'all' | 'stencil-only' | 'depth-only';\n colorSpace?: 'srgb';\n premultipliedAlpha?: boolean;\n }): {width: number; height: number} {\n const size = Texture.getExternalImageSize(options.image);\n const opts = {...Texture.defaultCopyExternalImageOptions, ...size, ...options};\n const {\n image,\n sourceX,\n sourceY,\n width,\n height,\n depth,\n mipLevel,\n x,\n y,\n z,\n aspect,\n colorSpace,\n premultipliedAlpha,\n flipY\n } = opts;\n\n // TODO - max out width\n\n this.device.handle.queue.copyExternalImageToTexture(\n // source: GPUImageCopyExternalImage\n {\n source: image,\n origin: [sourceX, sourceY],\n flipY\n },\n // destination: GPUImageCopyTextureTagged\n {\n texture: this.handle,\n origin: [x, y, z],\n mipLevel,\n aspect,\n colorSpace,\n premultipliedAlpha\n },\n // copySize: GPUExtent3D\n [width, height, depth]\n );\n return {width, height};\n }\n\n // WebGPU specific\n\n /*\n async readPixels() {\n const readbackBuffer = device.createBuffer({\n usage: Buffer.COPY_DST | Buffer.MAP_READ,\n size: 4 * textureWidth * textureHeight,\n });\n\n // Copy data from the texture to the buffer.\n const encoder = device.createCommandEncoder();\n encoder.copyTextureToBuffer(\n { texture },\n { buffer, rowPitch: textureWidth * 4 },\n [textureWidth, textureHeight],\n );\n device.submit([encoder.finish()]);\n\n // Get the data on the CPU.\n await buffer.mapAsync(GPUMapMode.READ);\n saveScreenshot(buffer.getMappedRange());\n buffer.unmap();\n }\n\n setImageData(imageData, usage): this {\n let data = null;\n\n const bytesPerRow = Math.ceil((img.width * 4) / 256) * 256;\n if (bytesPerRow == img.width * 4) {\n data = imageData.data;\n } else {\n data = new Uint8Array(bytesPerRow * img.height);\n let imagePixelIndex = 0;\n for (let y = 0; y < img.height; ++y) {\n for (let x = 0; x < img.width; ++x) {\n const i = x * 4 + y * bytesPerRow;\n data[i] = imageData.data[imagePixelIndex];\n data[i + 1] = imageData.data[imagePixelIndex + 1];\n data[i + 2] = imageData.data[imagePixelIndex + 2];\n data[i + 3] = imageData.data[imagePixelIndex + 3];\n imagePixelIndex += 4;\n }\n }\n }\n return this;\n }\n\n setBuffer(textureDataBuffer, {bytesPerRow}): this {\n const commandEncoder = this.device.handle.createCommandEncoder();\n commandEncoder.copyBufferToTexture(\n {\n buffer: textureDataBuffer,\n bytesPerRow\n },\n {\n texture: this.handle\n },\n {\n width,\n height,\n depth\n }\n );\n\n this.device.handle.defaultQueue.submit([commandEncoder.finish()]);\n return this;\n }\n */\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {TextureFormat} from '@luma.gl/core';\n\n/** Ensure a texture format is WebGPU compatible */\nexport function getWebGPUTextureFormat(format: TextureFormat): GPUTextureFormat {\n if (format.includes('webgl')) {\n throw new Error('webgl-only format');\n }\n return format as GPUTextureFormat;\n}\n", "// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {Sampler, SamplerProps} from '@luma.gl/core';\nimport type {WebGPUDevice} from '../webgpu-device';\n\nexport type WebGPUSamplerProps = SamplerProps & {\n handle?: GPUSampler;\n};\n\n/**\n * A WebGPU sampler object\n */\nexport class WebGPUSampler extends Sampler {\n readonly device: WebGPUDevice;\n readonly handle: GPUSampler;\n\n constructor(device: WebGPUDevice, props: WebGPUSamplerProps) {\n super(device, props);\n this.device = device;\n\n // Prepare sampler props. Mostly identical\n const samplerDescriptor: Partial<GPUSamplerDescriptor> = {\n ...this.props,\n mipmapFilter: undefined\n };\n\n // props.compare automatically turns this into a comparison sampler\n if (props.type !== 'comparison-sampler') {\n delete samplerDescriptor.compare;\n }\n\n // disable mipmapFilter if not set\n if (props.mipmapFilter && props.mipmapFilter !== 'none') {\n samplerDescriptor.mipmapFilter = props.mipmapFilter;\n }\n\n this.handle = this.handle || this.device.handle.createSampler(samplerDescriptor);\n this.handle.label = this.props.id;\n }\n\n override destroy(): void {\n // GPUSampler does not have a destroy method\n // this.handle.destroy();\n // @ts-expect-error readonly\n this.handle = null;\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {TextureView, TextureViewProps} from '@luma.gl/core';\nimport type {WebGPUDevice} from '../webgpu-device';\nimport type {WebGPUTexture} from './webgpu-texture';\n\n/*\n // type = sampler\n samplerType?: 'filtering' | 'non-filtering' | 'comparison';\n\n // type = texture\n viewDimension?: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';\n sampleType?: 'float' | 'unfilterable-float' | 'depth' | 'sint' | 'uint';\n multisampled?: boolean;\n\n // type = storage\n viewDimension?: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';\n access: 'read-only' | 'write-only';\n format: string;\n*/\n\nexport type WebGPUTextureViewProps = TextureViewProps & {\n handle?: GPUTextureView;\n};\n\n/**\n *\n */\nexport class WebGPUTextureView extends TextureView {\n readonly device: WebGPUDevice;\n readonly handle: GPUTextureView;\n readonly texture: WebGPUTexture;\n\n constructor(device: WebGPUDevice, props: WebGPUTextureViewProps & {texture: WebGPUTexture}) {\n super(device, props);\n this.device = device;\n this.texture = props.texture;\n\n this.handle =\n this.handle ||\n this.texture.handle.createView({\n format: (props.format || this.texture.format) as GPUTextureFormat,\n dimension: props.dimension || this.texture.dimension,\n aspect: props.aspect,\n baseMipLevel: props.baseMipLevel,\n mipLevelCount: props.mipLevelCount, // GPUIntegerCoordinate;\n baseArrayLayer: props.baseArrayLayer, // GPUIntegerCoordinate;\n arrayLayerCount: props.arrayLayerCount // GPUIntegerCoordinate;\n });\n this.handle.label = this.props.id;\n }\n\n override destroy(): void {\n // GPUTextureView does not have a destroy method\n // this.handle.destroy();\n // @ts-expect-error readonly\n this.handle = null;\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {ExternalTexture, ExternalTextureProps, Sampler, SamplerProps} from '@luma.gl/core';\nimport type {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUSampler} from './webgpu-sampler';\n\n/**\n * Cheap, temporary texture view for videos\n * Only valid within same callback, destroyed automatically as a microtask.\n */\nexport class WebGPUExternalTexture extends ExternalTexture {\n readonly device: WebGPUDevice;\n readonly handle: GPUExternalTexture;\n sampler: WebGPUSampler;\n\n constructor(device: WebGPUDevice, props: ExternalTextureProps) {\n super(device, props);\n this.device = device;\n this.handle =\n this.props.handle ||\n this.device.handle.importExternalTexture({\n source: props.source,\n colorSpace: props.colorSpace\n });\n // @ts-expect-error\n this.sampler = null;\n }\n\n override destroy(): void {\n // External textures are destroyed automatically,\n // as a microtask, instead of manually or upon garbage collection like other resources.\n // this.handle.destroy();\n // @ts-expect-error readonly\n this.handle = null;\n }\n\n /** Set default sampler */\n setSampler(sampler: Sampler | SamplerProps): this {\n // We can accept a sampler instance or set of props;\n this.sampler =\n sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);\n return this;\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderProps, CompilerMessage} from '@luma.gl/core';\nimport {Shader, log} from '@luma.gl/core';\nimport type {WebGPUDevice} from '../webgpu-device';\n\n/**\n * Immutable shader\n */\nexport class WebGPUShader extends Shader {\n readonly device: WebGPUDevice;\n readonly handle: GPUShaderModule;\n\n constructor(device: WebGPUDevice, props: ShaderProps) {\n super(device, props);\n this.device = device;\n\n const isGLSL = props.source.includes('#version');\n if (this.props.language === 'glsl' || isGLSL) {\n throw new Error('GLSL shaders are not supported in WebGPU');\n }\n\n this.device.handle.pushErrorScope('validation');\n this.handle = this.props.handle || this.device.handle.createShaderModule({code: props.source});\n this.device.handle.popErrorScope().then((error: GPUError | null) => {\n if (error) {\n log.error(`${this} creation failed:\\n\"${error.message}\"`, this, this.props.source)();\n }\n });\n\n this.handle.label = this.props.id;\n this._checkCompilationError();\n }\n\n get asyncCompilationStatus(): Promise<any> {\n return this.getCompilationInfo().then(() => this.compilationStatus);\n }\n\n async _checkCompilationError(): Promise<void> {\n const shaderLog = await this.getCompilationInfo();\n const hasErrors = Boolean(shaderLog.find(msg => msg.type === 'error'));\n this.compilationStatus = hasErrors ? 'error' : 'success';\n this.debugShader();\n\n if (this.compilationStatus === 'error') {\n log.error(`Shader compilation error`, shaderLog)();\n // Note: Even though this error is asynchronous and thrown after the constructor completes,\n // it will result in a useful stack trace leading back to the constructor\n // throw new Error(`Shader compilation error`);\n }\n }\n\n override destroy(): void {\n // Note: WebGPU does not offer a method to destroy shaders\n // this.handle.destroy();\n // @ts-expect-error readonly\n this.handle = null;\n }\n\n /** Returns compilation info for this shader */\n async getCompilationInfo(): Promise<readonly CompilerMessage[]> {\n const compilationInfo = await this.handle.getCompilationInfo();\n return compilationInfo.messages;\n }\n}\n", "// luma.gl MIT license\n\nimport type {Binding, RenderPass, VertexArray} from '@luma.gl/core';\nimport {RenderPipeline, RenderPipelineProps, log} from '@luma.gl/core';\nimport {applyParametersToRenderPipelineDescriptor} from '../helpers/webgpu-parameters';\nimport {getWebGPUTextureFormat} from '../helpers/convert-texture-format';\nimport {getBindGroup} from '../helpers/get-bind-group';\nimport {getVertexBufferLayout} from '../helpers/get-vertex-buffer-layout';\n// import {convertAttributesVertexBufferToLayout} from '../helpers/get-vertex-buffer-layout';\n// import {mapAccessorToWebGPUFormat} from './helpers/accessor-to-format';\n// import type {BufferAccessors} from './webgpu-pipeline';\n\nimport type {WebGPUDevice} from '../webgpu-device';\n// import type {WebGPUBuffer} from './webgpu-buffer';\nimport type {WebGPUShader} from './webgpu-shader';\nimport type {WebGPURenderPass} from './webgpu-render-pass';\n\n// RENDER PIPELINE\n\n/** Creates a new render pipeline when parameters change */\nexport class WebGPURenderPipeline extends RenderPipeline {\n device: WebGPUDevice;\n handle: GPURenderPipeline;\n\n vs: WebGPUShader;\n fs: WebGPUShader | null = null;\n\n /** For internal use to create BindGroups */\n private _bindings: Record<string, Binding>;\n private _bindGroupLayout: GPUBindGroupLayout | null = null;\n private _bindGroup: GPUBindGroup | null = null;\n\n constructor(device: WebGPUDevice, props: RenderPipelineProps) {\n super(device, props);\n this.device = device;\n this.handle = this.props.handle as GPURenderPipeline;\n if (!this.handle) {\n const descriptor = this._getRenderPipelineDescriptor();\n log.groupCollapsed(1, `new WebGPURenderPipeline(${this.id})`)();\n log.probe(1, JSON.stringify(descriptor, null, 2))();\n log.groupEnd(1)();\n\n this.device.handle.pushErrorScope('validation');\n this.handle = this.device.handle.createRenderPipeline(descriptor);\n this.device.handle.popErrorScope().then((error: GPUError | null) => {\n if (error) {\n log.error(`${this} creation failed:\\n\"${error.message}\"`, this, this.props.vs?.source)();\n }\n });\n }\n this.handle.label = this.props.id;\n\n // Note: Often the same shader in WebGPU\n this.vs = props.vs as WebGPUShader;\n this.fs = props.fs as WebGPUShader;\n\n this._bindings = {...this.props.bindings};\n }\n\n override destroy(): void {\n // WebGPURenderPipeline has no destroy method.\n // @ts-expect-error\n this.handle = null;\n }\n\n /**\n * @todo Use renderpass.setBindings() ?\n * @todo Do we want to expose BindGroups in the API and remove this?\n */\n setBindings(bindings: Record<string, Binding>): void {\n Object.assign(this._bindings, bindings);\n }\n\n /** @todo - should this be moved to renderpass? */\n draw(options: {\n renderPass: RenderPass;\n vertexArray: VertexArray;\n vertexCount?: number;\n indexCount?: number;\n instanceCount?: number;\n firstVertex?: number;\n firstIndex?: number;\n firstInstance?: number;\n baseVertex?: number;\n }): boolean {\n const webgpuRenderPass = options.renderPass as WebGPURenderPass;\n\n // Set pipeline\n this.device.handle.pushErrorScope('validation');\n webgpuRenderPass.handle.setPipeline(this.handle);\n this.device.handle.popErrorScope().then((error: GPUError | null) => {\n if (error) {\n log.error(`${this} setPipeline failed:\\n\"${error.message}\"`, this)();\n }\n });\n\n // Set bindings (uniform buffers, textures etc)\n const bindGroup = this._getBindGroup();\n if (bindGroup) {\n webgpuRenderPass.handle.setBindGroup(0, bindGroup);\n }\n\n // Set attributes\n // Note: Rebinds constant attributes before each draw call\n options.vertexArray.bindBeforeRender(options.renderPass);\n\n // Draw\n if (options.indexCount) {\n webgpuRenderPass.handle.drawIndexed(\n options.indexCount,\n options.instanceCount,\n options.firstIndex,\n options.baseVertex,\n options.firstInstance\n );\n } else {\n webgpuRenderPass.handle.draw(\n options.vertexCount || 0,\n options.instanceCount || 1, // If 0, nothing will be drawn\n options.firstInstance\n );\n }\n\n // Note: Rebinds constant attributes before each draw call\n options.vertexArray.unbindAfterRender(options.renderPass);\n\n return true;\n }\n\n /** Return a bind group created by setBindings */\n _getBindGroup() {\n if (this.shaderLayout.bindings.length === 0) {\n return null;\n }\n\n // Get hold of the bind group layout. We don't want to do this unless we know there is at least one bind group\n this._bindGroupLayout = this._bindGroupLayout || this.handle.getBindGroupLayout(0);\n\n // Set up the bindings\n // TODO what if bindings change? We need to rebuild the bind group!\n this._bindGroup =\n this._bindGroup ||\n getBindGroup(this.device.handle, this._bindGroupLayout, this.shaderLayout, this._bindings);\n\n return this._bindGroup;\n }\n\n /**\n * Populate the complex WebGPU GPURenderPipelineDescriptor\n */\n protected _getRenderPipelineDescriptor() {\n // Set up the vertex stage\n const vertex: GPUVertexState = {\n module: (this.props.vs as WebGPUShader).handle,\n entryPoint: this.props.vertexEntryPoint || 'main',\n buffers: getVertexBufferLayout(this.shaderLayout, this.props.bufferLayout)\n };\n\n // Set up the fragment stage\n const fragment: GPUFragmentState = {\n module: (this.props.fs as WebGPUShader).handle,\n entryPoint: this.props.fragmentEntryPoint || 'main',\n targets: [\n {\n // TODO exclamation mark hack!\n format: getWebGPUTextureFormat(this.device.getCanvasContext().format)\n }\n ]\n };\n\n // Create a partially populated descriptor\n const descriptor: GPURenderPipelineDescriptor = {\n vertex,\n fragment,\n primitive: {\n topology: this.props.topology\n },\n layout: 'auto'\n };\n\n // Set parameters on the descriptor\n applyParametersToRenderPipelineDescriptor(descriptor, this.props.parameters);\n\n return descriptor;\n }\n}\n/**\n_setAttributeBuffers(webgpuRenderPass: WebGPURenderPass) {\n if (this._indexBuffer) {\n webgpuRenderPass.handle.setIndexBuffer(this._indexBuffer.handle, this._indexBuffer.props.indexType);\n }\n\n const buffers = this._getBuffers();\n for (let i = 0; i < buffers.length; ++i) {\n const buffer = cast<WebGPUBuffer>(buffers[i]);\n if (!buffer) {\n const attribute = this.shaderLayout.attributes.find(\n (attribute) => attribute.location === i\n );\n throw new Error(\n `No buffer provided for attribute '${attribute?.name || ''}' in Model '${this.props.id}'`\n );\n }\n webgpuRenderPass.handle.setVertexBuffer(i, buffer.handle);\n }\n\n // TODO - HANDLE buffer maps\n /*\n for (const [bufferName, attributeMapping] of Object.entries(this.props.bufferLayout)) {\n const buffer = cast<WebGPUBuffer>(this.props.attributes[bufferName]);\n if (!buffer) {\n log.warn(`Missing buffer for buffer map ${bufferName}`)();\n continue;\n }\n\n if ('location' in attributeMapping) {\n // @ts-expect-error TODO model must not depend on webgpu\n renderPass.handle.setVertexBuffer(layout.location, buffer.handle);\n } else {\n for (const [bufferName, mapping] of Object.entries(attributeMapping)) {\n // @ts-expect-error TODO model must not depend on webgpu\n renderPass.handle.setVertexBuffer(field.location, buffer.handle);\n }\n }\n }\n *\n}\n*/\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {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\nfunction addDepthStencilFront(descriptor: GPURenderPipelineDescriptor): GPUStencilFaceState {\n const depthStencil = addDepthStencil(descriptor);\n // @ts-ignore\n return depthStencil.stencilFront;\n}\n\nfunction addDepthStencilBack(descriptor: GPURenderPipelineDescriptor): GPUStencilFaceState {\n const depthStencil = addDepthStencil(descriptor);\n // @ts-ignore\n return depthStencil.stencilBack;\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: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthWriteEnabled = value;\n },\n\n depthCompare: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthCompare = value;\n },\n\n depthFormat: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\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: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthBiasSlopeScale = value;\n },\n\n depthBiasClamp: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthBiasClamp = value;\n },\n\n // STENCIL\n\n stencilReadMask: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilReadMask = value;\n },\n\n stencilWriteMask: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilWriteMask = value;\n },\n\n stencilCompare: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n const stencilFront = addDepthStencilFront(descriptor);\n const stencilBack = addDepthStencilBack(descriptor);\n stencilFront.compare = value;\n stencilBack.compare = value;\n },\n\n stencilPassOperation: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n const stencilFront = addDepthStencilFront(descriptor);\n const stencilBack = addDepthStencilBack(descriptor);\n stencilFront.passOp = value;\n stencilBack.passOp = value;\n },\n\n stencilFailOperation: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n const stencilFront = addDepthStencilFront(descriptor);\n const stencilBack = addDepthStencilBack(descriptor);\n stencilFront.failOp = value;\n stencilBack.failOp = value;\n },\n\n stencilDepthFailOperation: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n const stencilFront = addDepthStencilFront(descriptor);\n const stencilBack = addDepthStencilBack(descriptor);\n stencilFront.depthFailOp = value;\n stencilBack.depthFailOp = value;\n },\n\n // MULTISAMPLE\n\n sampleCount: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n descriptor.multisample = descriptor.multisample || {};\n descriptor.multisample.count = value;\n },\n\n sampleMask: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n descriptor.multisample = descriptor.multisample || {};\n descriptor.multisample.mask = value;\n },\n\n sampleAlphaToCoverageEnabled: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\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: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\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 // @ts-ignore\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", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ComputeShaderLayout, BindingDeclaration, Binding} from '@luma.gl/core';\nimport {Buffer, Sampler, Texture, log} from '@luma.gl/core';\nimport type {WebGPUBuffer} from '../resources/webgpu-buffer';\nimport type {WebGPUSampler} from '../resources/webgpu-sampler';\nimport type {WebGPUTexture} from '../resources/webgpu-texture';\n\n/**\n * Create a WebGPU \"bind group layout\" from an array of luma.gl bindings\n * @note bind groups can be automatically generated by WebGPU.\n */\nexport function makeBindGroupLayout(\n device: GPUDevice,\n layout: GPUBindGroupLayout,\n bindings: Binding[]\n): GPUBindGroupLayout {\n throw new Error('not implemented');\n // return device.createBindGroupLayout({\n // layout,\n // entries: getBindGroupEntries(bindings)\n // })\n}\n\n/**\n * Create a WebGPU \"bind group\" from an array of luma.gl bindings\n */\nexport function getBindGroup(\n device: GPUDevice,\n bindGroupLayout: GPUBindGroupLayout,\n shaderLayout: ComputeShaderLayout,\n bindings: Record<string, Binding>\n): GPUBindGroup {\n const entries = getBindGroupEntries(bindings, shaderLayout);\n return device.createBindGroup({\n layout: bindGroupLayout,\n entries\n });\n}\n\nexport function getShaderLayoutBinding(\n shaderLayout: ComputeShaderLayout,\n bindingName: string\n): BindingDeclaration | null {\n const bindingLayout = shaderLayout.bindings.find(\n binding =>\n binding.name === bindingName || `${binding.name}uniforms` === bindingName.toLocaleLowerCase()\n );\n if (!bindingLayout) {\n log.warn(`Binding ${bindingName} not set: Not found in shader layout.`)();\n }\n return bindingLayout || null;\n}\n\n/**\n * @param bindings\n * @returns\n */\nfunction getBindGroupEntries(\n bindings: Record<string, Binding>,\n shaderLayout: ComputeShaderLayout\n): GPUBindGroupEntry[] {\n const entries: GPUBindGroupEntry[] = [];\n\n for (const [bindingName, value] of Object.entries(bindings)) {\n let bindingLayout = getShaderLayoutBinding(shaderLayout, bindingName);\n if (bindingLayout) {\n entries.push(getBindGroupEntry(value, bindingLayout.location));\n }\n\n // TODO - hack to automatically bind samplers to supplied texture default samplers\n bindingLayout = getShaderLayoutBinding(shaderLayout, `${bindingName}Sampler`);\n if (bindingLayout) {\n entries.push(getBindGroupEntry(value, bindingLayout.location, {sampler: true}));\n }\n }\n\n return entries;\n}\n\nfunction getBindGroupEntry(\n binding: Binding,\n index: number,\n options?: {sampler?: boolean}\n): GPUBindGroupEntry {\n if (binding instanceof Buffer) {\n return {\n binding: index,\n resource: {\n buffer: (binding as WebGPUBuffer).handle\n }\n };\n }\n if (binding instanceof Sampler) {\n return {\n binding: index,\n resource: (binding as WebGPUSampler).handle\n };\n } else if (binding instanceof Texture) {\n if (options?.sampler) {\n return {\n binding: index,\n resource: (binding as WebGPUTexture).sampler.handle\n };\n }\n return {\n binding: index,\n resource: (binding as WebGPUTexture).handle.createView({label: 'bind-group-auto-created'})\n };\n }\n throw new Error('invalid binding');\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderLayout, BufferLayout, AttributeDeclaration, VertexFormat} from '@luma.gl/core';\nimport {log, decodeVertexFormat} from '@luma.gl/core';\n// import {getAttributeInfosFromLayouts} from '@luma.gl/core';\n\n/** Throw error on any WebGL-only vertex formats */\nfunction getWebGPUVertexFormat(format: VertexFormat): GPUVertexFormat {\n if (format.endsWith('-webgl')) {\n throw new Error(`WebGPU does not support vertex format ${format}`);\n }\n return format as GPUVertexFormat;\n}\n\n/**\n * Build a WebGPU vertex buffer layout intended for use in a GPURenderPassDescriptor.\n * Converts luma.gl attribute definitions to a WebGPU GPUVertexBufferLayout[] array\n * @param layout\n * @param bufferLayout The buffer map is optional\n * @returns WebGPU layout intended for a GPURenderPassDescriptor.\n */\nexport function getVertexBufferLayout(\n shaderLayout: ShaderLayout,\n bufferLayout: BufferLayout[]\n): GPUVertexBufferLayout[] {\n const vertexBufferLayouts: GPUVertexBufferLayout[] = [];\n const usedAttributes = new Set<string>();\n\n // First handle any buffers mentioned in `bufferLayout`\n for (const mapping of bufferLayout) {\n // Build vertex attributes for one buffer\n const vertexAttributes: GPUVertexAttribute[] = [];\n\n // TODO verify that all stepModes for one buffer are the same\n let stepMode: 'vertex' | 'instance' = 'vertex';\n let byteStride = 0;\n // @ts-ignore\n const format: VertexFormat = mapping.format;\n\n // interleaved mapping {..., attributes: [{...}, ...]}\n if (mapping.attributes) {\n // const arrayStride = mapping.byteStride; TODO\n for (const attributeMapping of mapping.attributes) {\n const attributeName = attributeMapping.attribute;\n const attributeLayout = findAttributeLayout(shaderLayout, attributeName, usedAttributes);\n\n // @ts-ignore\n const location: number = attributeLayout?.location;\n\n stepMode =\n attributeLayout?.stepMode ||\n (attributeLayout?.name.startsWith('instance') ? 'instance' : 'vertex');\n vertexAttributes.push({\n format: getWebGPUVertexFormat(attributeMapping.format || mapping.format),\n offset: attributeMapping.byteOffset,\n shaderLocation: location\n });\n\n byteStride += decodeVertexFormat(format).byteLength;\n }\n // non-interleaved mapping (just set offset and stride)\n } else {\n const attributeLayout = findAttributeLayout(shaderLayout, mapping.name, usedAttributes);\n if (!attributeLayout) {\n continue; // eslint-disable-line no-continue\n }\n byteStride = decodeVertexFormat(format).byteLength;\n\n stepMode =\n attributeLayout.stepMode ||\n (attributeLayout.name.startsWith('instance') ? 'instance' : 'vertex');\n vertexAttributes.push({\n format: getWebGPUVertexFormat(format),\n // We only support 0 offset for non-interleaved buffer layouts\n offset: 0,\n shaderLocation: attributeLayout.location\n });\n }\n\n // Store all the attribute bindings for one buffer\n vertexBufferLayouts.push({\n arrayStride: mapping.byteStride || byteStride,\n stepMode,\n attributes: vertexAttributes\n });\n }\n\n // Add any non-mapped attributes - TODO - avoid hardcoded types\n for (const attribute of shaderLayout.attributes) {\n if (!usedAttributes.has(attribute.name)) {\n vertexBufferLayouts.push({\n arrayStride: decodeVertexFormat('float32x3').byteLength,\n stepMode:\n attribute.stepMode || (attribute.name.startsWith('instance') ? 'instance' : 'vertex'),\n attributes: [\n {\n format: getWebGPUVertexFormat('float32x3'),\n offset: 0,\n shaderLocation: attribute.location\n }\n ]\n });\n }\n }\n\n return vertexBufferLayouts;\n}\n\nexport function getBufferSlots(\n shaderLayout: ShaderLayout,\n bufferLayout: BufferLayout[]\n): Record<string, number> {\n const usedAttributes = new Set<string>();\n let bufferSlot = 0;\n const bufferSlots: Record<string, number> = {};\n\n // First handle any buffers mentioned in `bufferLayout`\n for (const mapping of bufferLayout) {\n // interleaved mapping {..., attributes: [{...}, ...]}\n if ('attributes' in mapping) {\n for (const interleaved of mapping.attributes || []) {\n usedAttributes.add(interleaved.attribute);\n }\n // non-interleaved mapping (just set offset and stride)\n } else {\n usedAttributes.add(mapping.name);\n }\n bufferSlots[mapping.name] = bufferSlot++;\n }\n\n // Add any non-mapped attributes\n for (const attribute of shaderLayout.attributes) {\n if (!usedAttributes.has(attribute.name)) {\n bufferSlots[attribute.name] = bufferSlot++;\n }\n }\n\n return bufferSlots;\n}\n\n/**\n * Looks up an attribute in the ShaderLayout.\n * @throws if name is not in ShaderLayout\n * @throws if name has already been referenced\n */\nfunction findAttributeLayout(\n shaderLayout: ShaderLayout,\n name: string,\n attributeNames: Set<string>\n): AttributeDeclaration | null {\n const attribute = shaderLayout.attributes.find(attribute_ => attribute_.name === name);\n if (!attribute) {\n log.warn(`Unknown attribute ${name}`)();\n return null;\n }\n if (attributeNames.has(name)) {\n throw new Error(`Duplicate attribute ${name}`);\n }\n attributeNames.add(name);\n return attribute;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {FramebufferProps} from '@luma.gl/core';\nimport {Framebuffer} from '@luma.gl/core';\nimport {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUTextureView} from '../resources/webgpu-texture-view';\n\n/**\n * Create new textures with correct size for all attachments.\n * @note resize() destroys existing textures (if size has changed).\n */\nexport class WebGPUFramebuffer extends Framebuffer {\n readonly device: WebGPUDevice;\n\n colorAttachments: WebGPUTextureView[] = [];\n depthStencilAttachment: WebGPUTextureView | null = null;\n\n constructor(device: WebGPUDevice, props: FramebufferProps) {\n super(device, props);\n this.device = device;\n\n // Auto create textures for attachments if needed\n this.autoCreateAttachmentTextures();\n }\n\n protected updateAttachments(): void {\n // WebGPU framebuffers are JS only objects, nothing to update\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {ComputePipeline, ComputePipelineProps, Binding} from '@luma.gl/core';\nimport {getBindGroup} from '../helpers/get-bind-group';\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 /** For internal use to create BindGroups */\n private _bindGroupLayout: GPUBindGroupLayout | null = null;\n private _bindGroup: GPUBindGroup | null = null;\n /** For internal use to create BindGroups */\n private _bindings: Record<string, Binding> = {};\n\n constructor(device: WebGPUDevice, props: ComputePipelineProps) {\n super(device, props);\n this.device = device;\n\n const webgpuShader = this.props.shader as WebGPUShader;\n\n this.handle =\n this.props.handle ||\n this.device.handle.createComputePipeline({\n label: this.props.id,\n compute: {\n module: webgpuShader.handle,\n entryPoint: this.props.entryPoint,\n constants: this.props.constants\n },\n layout: 'auto'\n });\n }\n\n /**\n * @todo Use renderpass.setBindings() ?\n * @todo Do we want to expose BindGroups in the API and remove this?\n */\n setBindings(bindings: Record<string, Binding>): void {\n Object.assign(this._bindings, bindings);\n }\n\n /** Return a bind group created by setBindings */\n _getBindGroup() {\n // Get hold of the bind group layout. We don't want to do this unless we know there is at least one bind group\n this._bindGroupLayout = this._bindGroupLayout || this.handle.getBindGroupLayout(0);\n\n // Set up the bindings\n this._bindGroup =\n this._bindGroup ||\n getBindGroup(this.device.handle, this._bindGroupLayout, this.shaderLayout, this._bindings);\n\n return this._bindGroup;\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {RenderPassProps, RenderPassParameters, Binding} from '@luma.gl/core';\nimport {Buffer, RenderPass, RenderPipeline, log} from '@luma.gl/core';\nimport {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUBuffer} from './webgpu-buffer';\n// import {WebGPUCommandEncoder} from './webgpu-command-encoder';\nimport {WebGPURenderPipeline} from './webgpu-render-pipeline';\nimport {WebGPUQuerySet} from './webgpu-query-set';\nimport {WebGPUFramebuffer} from './webgpu-framebuffer';\n\nexport class WebGPURenderPass extends RenderPass {\n readonly device: WebGPUDevice;\n readonly handle: GPURenderPassEncoder;\n\n /** Active pipeline */\n pipeline: WebGPURenderPipeline | null = null;\n\n constructor(device: WebGPUDevice, props: RenderPassProps = {}) {\n super(device, props);\n this.device = device;\n const framebuffer =\n (props.framebuffer as WebGPUFramebuffer) || device.getCanvasContext().getCurrentFramebuffer();\n\n const renderPassDescriptor = this.getRenderPassDescriptor(framebuffer);\n\n const webgpuQuerySet = props.timestampQuerySet as WebGPUQuerySet;\n if (webgpuQuerySet) {\n renderPassDescriptor.occlusionQuerySet = webgpuQuerySet.handle;\n }\n\n if (device.features.has('timestamp-query')) {\n const webgpuTSQuerySet = props.timestampQuerySet as WebGPUQuerySet;\n renderPassDescriptor.timestampWrites = webgpuTSQuerySet\n ? ({\n querySet: webgpuTSQuerySet.handle,\n beginningOfPassWriteIndex: props.beginTimestampIndex,\n endOfPassWriteIndex: props.endTimestampIndex\n } as GPUComputePassTimestampWrites)\n : undefined;\n }\n\n if (!device.commandEncoder) {\n throw new Error('commandEncoder not available');\n }\n\n this.device.handle.pushErrorScope('validation');\n this.handle = this.props.handle || device.commandEncoder.beginRenderPass(renderPassDescriptor);\n this.device.handle.popErrorScope().then((error: GPUError | null) => {\n if (error) {\n log.error(`${this} creation failed:\\n\"${error.message}\"`, this)();\n }\n });\n this.handle.label = this.props.id;\n log.groupCollapsed(3, `new WebGPURenderPass(${this.id})`)();\n log.probe(3, JSON.stringify(renderPassDescriptor, null, 2))();\n log.groupEnd(3)();\n }\n\n override destroy(): void {}\n\n end(): void {\n this.handle.end();\n }\n\n setPipeline(pipeline: RenderPipeline): void {\n this.pipeline = pipeline as WebGPURenderPipeline;\n this.handle.setPipeline(this.pipeline.handle);\n }\n\n /** Sets an array of bindings (uniform buffers, samplers, textures, ...) */\n setBindings(bindings: Record<string, Binding>): void {\n this.pipeline?.setBindings(bindings);\n const bindGroup = this.pipeline?._getBindGroup();\n if (bindGroup) {\n this.handle.setBindGroup(0, bindGroup);\n }\n }\n\n setIndexBuffer(\n buffer: Buffer,\n indexFormat: GPUIndexFormat,\n offset: number = 0,\n size?: number\n ): void {\n this.handle.setIndexBuffer((buffer as WebGPUBuffer).handle, indexFormat, offset, size);\n }\n\n setVertexBuffer(slot: number, buffer: Buffer, offset: number = 0): void {\n this.handle.setVertexBuffer(slot, (buffer as WebGPUBuffer).handle, offset);\n }\n\n draw(options: {\n vertexCount?: number;\n indexCount?: number;\n instanceCount?: number;\n firstVertex?: number;\n firstIndex?: number;\n firstInstance?: number;\n baseVertex?: number;\n }): void {\n if (options.indexCount) {\n this.handle.drawIndexed(\n options.indexCount,\n options.instanceCount,\n options.firstIndex,\n options.baseVertex,\n options.firstInstance\n );\n } else {\n this.handle.draw(\n options.vertexCount || 0,\n options.instanceCount || 1,\n options.firstIndex,\n options.firstInstance\n );\n }\n }\n\n drawIndirect(): void {\n // drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): void;\n // drawIndexedIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): void;\n }\n\n setParameters(parameters: RenderPassParameters): void {\n const {blendConstant, stencilReference, scissorRect, viewport} = parameters;\n if (blendConstant) {\n this.handle.setBlendConstant(blendConstant);\n }\n if (stencilReference) {\n this.handle.setStencilReference(stencilReference);\n }\n if (scissorRect) {\n this.handle.setScissorRect(scissorRect[0], scissorRect[1], scissorRect[2], scissorRect[3]);\n }\n // TODO - explain how 3 dimensions vs 2 in WebGL works.\n if (viewport) {\n this.handle.setViewport(\n viewport[0],\n viewport[1],\n viewport[2],\n viewport[3],\n viewport[4] as any,\n viewport[5] as any\n );\n }\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 beginOcclusionQuery(queryIndex: number): void {\n this.handle.beginOcclusionQuery(queryIndex);\n }\n endOcclusionQuery(): void {\n this.handle.endOcclusionQuery();\n }\n\n // executeBundles(bundles: Iterable<GPURenderBundle>): void;\n\n // INTERNAL\n\n /**\n * Partial render pass descriptor. Used by WebGPURenderPass.\n * @returns attachments fields of a renderpass descriptor.\n */\n protected getRenderPassDescriptor(framebuffer: WebGPUFramebuffer): GPURenderPassDescriptor {\n const renderPassDescriptor: GPURenderPassDescriptor = {\n colorAttachments: []\n };\n\n renderPassDescriptor.colorAttachments = framebuffer.colorAttachments.map(\n (colorAttachment, index) => ({\n // clear values\n loadOp: this.props.clearColor !== false ? 'clear' : 'load',\n colorClearValue:\n this.props.clearColors?.[index] || this.props.clearColor || RenderPass.defaultClearColor,\n storeOp: this.props.discard ? 'discard' : 'store',\n // ...colorAttachment,\n view: colorAttachment.handle\n })\n );\n\n if (framebuffer.depthStencilAttachment) {\n renderPassDescriptor.depthStencilAttachment = {\n view: framebuffer.depthStencilAttachment.handle\n };\n const {depthStencilAttachment} = renderPassDescriptor;\n\n // DEPTH\n if (this.props.depthReadOnly) {\n depthStencilAttachment.depthReadOnly = true;\n }\n if (this.props.clearDepth !== false) {\n depthStencilAttachment.depthClearValue = this.props.clearDepth;\n }\n // STENCIL\n // if (this.props.clearStencil !== false) {\n // depthStencilAttachment.stencilClearValue = this.props.clearStencil;\n // }\n\n // WebGPU only wants us to set these parameters if the texture format actually has a depth aspect\n const hasDepthAspect = true;\n if (hasDepthAspect) {\n depthStencilAttachment.depthLoadOp = this.props.clearDepth !== false ? 'clear' : 'load';\n depthStencilAttachment.depthStoreOp = 'store'; // TODO - support 'discard'?\n }\n\n // WebGPU only wants us to set these parameters if the texture format actually has a stencil aspect\n const hasStencilAspect = false;\n if (hasStencilAspect) {\n depthStencilAttachment.stencilLoadOp = this.props.clearStencil !== false ? 'clear' : 'load';\n depthStencilAttachment.stencilStoreOp = 'store'; // TODO - support 'discard'?\n }\n }\n\n return renderPassDescriptor;\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {ComputePass, ComputePassProps, ComputePipeline, Buffer, Binding} from '@luma.gl/core';\nimport {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUBuffer} from './webgpu-buffer';\nimport {WebGPUComputePipeline} from './webgpu-compute-pipeline';\nimport {WebGPUQuerySet} from './webgpu-query-set';\n\nexport class WebGPUComputePass extends ComputePass {\n readonly device: WebGPUDevice;\n readonly handle: GPUComputePassEncoder;\n\n _webgpuPipeline: WebGPUComputePipeline | null = null;\n\n constructor(device: WebGPUDevice, props: ComputePassProps) {\n super(device, props);\n this.device = device;\n\n // Set up queries\n let timestampWrites: GPUComputePassTimestampWrites | undefined;\n if (device.features.has('timestamp-query')) {\n const webgpuQuerySet = props.timestampQuerySet as WebGPUQuerySet;\n if (webgpuQuerySet) {\n timestampWrites = {\n querySet: webgpuQuerySet.handle,\n beginningOfPassWriteIndex: props.beginTimestampIndex,\n endOfPassWriteIndex: props.endTimestampIndex\n };\n }\n }\n\n this.handle =\n this.props.handle ||\n device.commandEncoder?.beginComputePass({\n label: this.props.id,\n timestampWrites\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._webgpuPipeline = wgpuPipeline;\n this.setBindings([]);\n }\n\n /**\n * Sets an array of bindings (uniform buffers, samplers, textures, ...)\n * TODO - still some API confusion - does this method go here or on the pipeline?\n */\n setBindings(bindings: Binding[]): void {\n // @ts-expect-error\n const bindGroup = this._webgpuPipeline._getBindGroup();\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 work groups to dispatch.\n * @param y Y dimension of the grid of work groups to dispatch.\n * @param z Z dimension of the grid of work groups 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 *\n * 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 indirectBuffer\n * @param indirectOffset offset in buffer to the beginning of the dispatch data.\n */\n dispatchIndirect(indirectBuffer: Buffer, indirectByteOffset: number = 0): void {\n const webgpuBuffer = indirectBuffer as WebGPUBuffer;\n this.handle.dispatchWorkgroupsIndirect(webgpuBuffer.handle, indirectByteOffset);\n }\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", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Device, Buffer, VertexArrayProps, RenderPass} from '@luma.gl/core';\nimport {VertexArray, log} from '@luma.gl/core';\nimport {getBrowser} from '@probe.gl/env';\n\nimport {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUBuffer} from '../resources/webgpu-buffer';\n\nimport {WebGPURenderPass} from './webgpu-render-pass';\n\n/** VertexArrayObject wrapper */\nexport class WebGPUVertexArray extends VertexArray {\n override get [Symbol.toStringTag](): string {\n return 'WebGPUVertexArray';\n }\n\n readonly device: WebGPUDevice;\n /** Vertex Array is a helper class under WebGPU */\n readonly handle: never;\n\n // Create a VertexArray\n constructor(device: WebGPUDevice, props: VertexArrayProps) {\n super(device, props);\n this.device = device;\n }\n\n override destroy(): void {}\n\n /**\n * Set an elements buffer, for indexed rendering.\n * Must be a Buffer bound to buffer with usage bit Buffer.INDEX set.\n */\n setIndexBuffer(buffer: Buffer | null): void {\n // assert(!elementBuffer || elementBuffer.glTarget === GL.ELEMENT_ARRAY_BUFFER, ERR_ELEMENTS);\n this.indexBuffer = buffer;\n }\n\n /** Set a bufferSlot in vertex attributes array to a buffer, enables the bufferSlot, sets divisor */\n setBuffer(bufferSlot: number, buffer: Buffer): void {\n // Sanity check target\n // if (buffer.glUsage === GL.ELEMENT_ARRAY_BUFFER) {\n // throw new Error('Use setIndexBuffer');\n // }\n\n this.attributes[bufferSlot] = buffer;\n }\n\n override bindBeforeRender(\n renderPass: RenderPass,\n firstIndex?: number,\n indexCount?: number\n ): void {\n const webgpuRenderPass = renderPass as WebGPURenderPass;\n const webgpuIndexBuffer = this.indexBuffer as WebGPUBuffer;\n if (webgpuIndexBuffer?.handle) {\n // Note we can't unset an index buffer\n log.info(\n 3,\n 'setting index buffer',\n webgpuIndexBuffer?.handle,\n webgpuIndexBuffer?.indexType\n )();\n webgpuRenderPass.handle.setIndexBuffer(\n webgpuIndexBuffer?.handle,\n // @ts-expect-error TODO - we must enforce type\n webgpuIndexBuffer?.indexType\n );\n }\n for (let location = 0; location < this.maxVertexAttributes; location++) {\n const webgpuBuffer = this.attributes[location] as WebGPUBuffer;\n if (webgpuBuffer?.handle) {\n log.info(3, `setting vertex buffer ${location}`, webgpuBuffer?.handle)();\n webgpuRenderPass.handle.setVertexBuffer(location, webgpuBuffer?.handle);\n }\n }\n // TODO - emit warnings/errors/throw if constants have been set on this vertex array\n }\n\n override unbindAfterRender(renderPass: RenderPass): void {\n // On WebGPU we don't need to unbind.\n // In fact we can't easily do it. setIndexBuffer/setVertexBuffer don't accept null.\n // Unbinding presumably happens automatically when the render pass is ended.\n }\n\n // DEPRECATED METHODS\n\n /**\n * @deprecated is this even an issue for WebGPU?\n * Attribute 0 can not be disable on most desktop OpenGL based browsers\n */\n static isConstantAttributeZeroSupported(device: Device): boolean {\n return getBrowser() === 'Chrome';\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// / <reference types=\"@webgpu/types\" />\n\nimport type {Texture, TextureFormat, CanvasContextProps} from '@luma.gl/core';\nimport {CanvasContext, log} from '@luma.gl/core';\nimport {getWebGPUTextureFormat} from './helpers/convert-texture-format';\nimport {WebGPUDevice} from './webgpu-device';\nimport {WebGPUFramebuffer} from './resources/webgpu-framebuffer';\nimport {WebGPUTexture} from './resources/webgpu-texture';\n\n/**\n * Holds a WebGPU Canvas Context\n * The primary job of the CanvasContext is to generate textures for rendering into the current canvas\n * It also manages canvas sizing calculations and resizing.\n */\nexport class WebGPUCanvasContext extends CanvasContext {\n readonly device: WebGPUDevice;\n readonly gpuCanvasContext: GPUCanvasContext;\n /** Format of returned textures: \"bgra8unorm\", \"rgba8unorm\", \"rgba16float\". */\n readonly format: TextureFormat = navigator.gpu.getPreferredCanvasFormat() as TextureFormat;\n /** Default stencil format for depth textures */\n readonly depthStencilFormat: TextureFormat = 'depth24plus';\n\n private depthStencilAttachment: Texture | null = null;\n\n get [Symbol.toStringTag](): string {\n return 'WebGPUCanvasContext';\n }\n\n constructor(device: WebGPUDevice, adapter: GPUAdapter, props: CanvasContextProps) {\n super(props);\n this.device = device;\n // TODO - ugly hack to trigger first resize\n this.width = -1;\n this.height = -1;\n\n this._setAutoCreatedCanvasId(`${this.device.id}-canvas`);\n // @ts-ignore TODO - we don't handle OffscreenRenderingContext.\n this.gpuCanvasContext = this.canvas.getContext('webgpu');\n // TODO this has been replaced\n // this.format = this.gpuCanvasContext.getPreferredFormat(adapter);\n this.format = 'bgra8unorm';\n }\n\n /** Destroy any textures produced while configured and remove the context configuration. */\n destroy(): void {\n this.gpuCanvasContext.unconfigure();\n }\n\n /** Update framebuffer with properly resized \"swap chain\" texture views */\n getCurrentFramebuffer(): WebGPUFramebuffer {\n // Ensure the canvas context size is updated\n this.update();\n\n // Wrap the current canvas context texture in a luma.gl texture\n // const currentColorAttachment = this.device.createTexture({\n // id: 'default-render-target',\n // handle: this.gpuCanvasContext.getCurrentTexture(),\n // format: this.format,\n // width: this.width,\n // height: this.height\n // });\n\n // Wrap the current canvas context texture in a luma.gl texture\n const currentColorAttachment = this.getCurrentTexture();\n this.width = currentColorAttachment.width;\n this.height = currentColorAttachment.height;\n\n // Resize the depth stencil attachment\n this._createDepthStencilAttachment();\n\n return new WebGPUFramebuffer(this.device, {\n colorAttachments: [currentColorAttachment],\n depthStencilAttachment: this.depthStencilAttachment\n });\n }\n\n /** Resizes and updates render targets if necessary */\n update() {\n const oldWidth = this.width;\n const oldHeight = this.height;\n const [newWidth, newHeight] = this.getPixelSize();\n\n const sizeChanged = newWidth !== oldWidth || newHeight !== oldHeight;\n\n if (sizeChanged) {\n this.width = newWidth;\n this.height = newHeight;\n\n if (this.depthStencilAttachment) {\n this.depthStencilAttachment.destroy();\n this.depthStencilAttachment = null;\n }\n\n // Reconfigure the canvas size.\n // https://www.w3.org/TR/webgpu/#canvas-configuration\n this.gpuCanvasContext.configure({\n device: this.device.handle,\n format: getWebGPUTextureFormat(this.format),\n // Can be used to define e.g. -srgb views\n // viewFormats: [...]\n colorSpace: this.props.colorSpace,\n alphaMode: this.props.alphaMode\n });\n\n log.log(1, `${this} Resized ${oldWidth}x${oldHeight} => ${newWidth}x${newHeight}px`)();\n }\n }\n\n resize(options?: {width?: number; height?: number; useDevicePixels?: boolean | number}): void {\n this.update();\n\n if (!this.device.handle) return;\n\n // Resize browser context .\n if (this.canvas) {\n const devicePixelRatio = this.getDevicePixelRatio(options?.useDevicePixels);\n this.setDevicePixelRatio(devicePixelRatio, options);\n return;\n }\n }\n\n /** Wrap the current canvas context texture in a luma.gl texture */\n getCurrentTexture(): WebGPUTexture {\n return this.device.createTexture({\n id: `${this.id}#color-texture`,\n handle: this.gpuCanvasContext.getCurrentTexture(),\n format: this.format\n });\n }\n\n /** We build render targets on demand (i.e. not when size changes but when about to render) */\n _createDepthStencilAttachment() {\n if (!this.depthStencilAttachment) {\n this.depthStencilAttachment = this.device.createTexture({\n id: `${this.id}#depth-stencil-texture`,\n format: this.depthStencilFormat,\n width: this.width,\n height: this.height,\n usage: GPUTextureUsage.RENDER_ATTACHMENT\n });\n }\n return this.depthStencilAttachment;\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {QuerySet, QuerySetProps} from '@luma.gl/core';\nimport {WebGPUDevice} from '../webgpu-device';\n\nexport type QuerySetProps2 = {\n type: 'occlusion' | 'timestamp';\n count: number;\n};\n\n/**\n * Immutable\n */\nexport class WebGPUQuerySet extends QuerySet {\n readonly device: WebGPUDevice;\n readonly handle: GPUQuerySet;\n\n constructor(device: WebGPUDevice, props: QuerySetProps) {\n super(device, props);\n this.device = device;\n this.handle =\n this.props.handle ||\n this.device.handle.createQuerySet({\n type: this.props.type,\n count: this.props.count\n });\n this.handle.label = this.props.id;\n }\n\n override destroy(): void {\n this.handle?.destroy();\n // @ts-expect-error readonly\n this.handle = null;\n }\n}\n"],
|
|
5
|
-
"mappings":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M,OAAO,QAAiB;AAC5B,UAAM,IAAI,MAAM,wCAAwC;EAC1D;;AAGK,IAAM,gBAAgB,IAAI,cAAa;",
|
|
6
|
-
"names": ["import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core"]
|
|
4
|
+
"sourcesContent": ["// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// WEBGPU ADAPTER\nexport type {WebGPUAdapter} from './adapter/webgpu-adapter';\nexport {webgpuAdapter} from './adapter/webgpu-adapter';\n\n// WEBGPU CLASSES (typically not accessed directly)\nexport {WebGPUDevice} from './adapter/webgpu-device';\nexport {WebGPUBuffer} from './adapter/resources/webgpu-buffer';\nexport {WebGPUTexture} from './adapter/resources/webgpu-texture';\nexport {WebGPUSampler} from './adapter/resources/webgpu-sampler';\nexport {WebGPUShader} from './adapter/resources/webgpu-shader';\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {Adapter, DeviceProps, log} from '@luma.gl/core';\nimport {WebGPUDevice} from './webgpu-device';\n\n// / <reference types=\"@webgpu/types\" />\n\nexport class WebGPUAdapter extends Adapter {\n /** type of device's created by this adapter */\n readonly type: WebGPUDevice['type'] = 'webgpu';\n\n constructor() {\n super();\n // @ts-ignore For backwards compatibility luma.registerDevices\n WebGPUDevice.adapter = this;\n }\n\n /** Check if WebGPU is available */\n isSupported(): boolean {\n return Boolean(typeof navigator !== 'undefined' && navigator.gpu);\n }\n\n async create(props: DeviceProps): Promise<WebGPUDevice> {\n if (!navigator.gpu) {\n throw new Error(\n 'WebGPU not available. Open in Chrome Canary and turn on chrome://flags/#enable-unsafe-webgpu'\n );\n }\n log.groupCollapsed(1, 'WebGPUDevice created')();\n const adapter = await navigator.gpu.requestAdapter({\n powerPreference: 'high-performance'\n // forceSoftware: false\n });\n\n if (!adapter) {\n throw new Error('Failed to request WebGPU adapter');\n }\n\n const adapterInfo =\n adapter.info ||\n // @ts-ignore Chrome has removed this function\n (await adapter.requestAdapterInfo?.());\n log.probe(2, 'Adapter available', adapterInfo)();\n\n const requiredFeatures: GPUFeatureName[] = [];\n const requiredLimits: Record<string, number> = {};\n\n if (props._requestMaxLimits) {\n // Require all features\n requiredFeatures.push(...(Array.from(adapter.features) as GPUFeatureName[]));\n\n // Require all limits\n // Filter out chrome specific keys (avoid crash)\n const limits = Object.keys(adapter.limits).filter(\n key => !['minSubgroupSize', 'maxSubgroupSize'].includes(key)\n );\n for (const key of limits) {\n const limit = key as keyof GPUSupportedLimits;\n const value = adapter.limits[limit];\n if (typeof value === 'number') {\n requiredLimits[limit] = value;\n }\n }\n }\n\n const gpuDevice = await adapter.requestDevice({\n requiredFeatures,\n requiredLimits\n });\n\n log.probe(1, 'GPUDevice available')();\n\n const device = new WebGPUDevice(props, gpuDevice, adapter, adapterInfo);\n\n log.probe(\n 1,\n 'Device created. For more info, set chrome://flags/#enable-webgpu-developer-features'\n )();\n log.table(1, device.info)();\n log.groupEnd(1)();\n return device;\n }\n\n async attach(handle: GPUDevice): Promise<WebGPUDevice> {\n throw new Error('WebGPUAdapter.attach() not implemented');\n }\n}\n\nexport const webgpuAdapter = new WebGPUAdapter();\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// prettier-ignore\n// / <reference types=\"@webgpu/types\" />\n\nimport type {\n DeviceInfo,\n DeviceLimits,\n DeviceFeature,\n DeviceTextureFormatCapabilities,\n CanvasContextProps,\n BufferProps,\n SamplerProps,\n ShaderProps,\n Texture,\n TextureProps,\n ExternalTextureProps,\n FramebufferProps,\n RenderPipelineProps,\n ComputePipelineProps,\n RenderPassProps,\n ComputePassProps,\n // CommandEncoderProps,\n VertexArrayProps,\n TransformFeedback,\n TransformFeedbackProps,\n QuerySet,\n QuerySetProps,\n DeviceProps\n} from '@luma.gl/core';\nimport {Device, DeviceFeatures} from '@luma.gl/core';\nimport {WebGPUBuffer} from './resources/webgpu-buffer';\nimport {WebGPUTexture} from './resources/webgpu-texture';\nimport {WebGPUExternalTexture} from './resources/webgpu-external-texture';\nimport {WebGPUSampler} from './resources/webgpu-sampler';\nimport {WebGPUShader} from './resources/webgpu-shader';\nimport {WebGPURenderPipeline} from './resources/webgpu-render-pipeline';\nimport {WebGPUFramebuffer} from './resources/webgpu-framebuffer';\nimport {WebGPUComputePipeline} from './resources/webgpu-compute-pipeline';\nimport {WebGPURenderPass} from './resources/webgpu-render-pass';\nimport {WebGPUComputePass} from './resources/webgpu-compute-pass';\n// import {WebGPUCommandEncoder} from './resources/webgpu-command-encoder';\nimport {WebGPUVertexArray} from './resources/webgpu-vertex-array';\n\nimport {WebGPUCanvasContext} from './webgpu-canvas-context';\nimport {WebGPUQuerySet} from './resources/webgpu-query-set';\n\n/** WebGPU Device implementation */\nexport class WebGPUDevice extends Device {\n /** type of this device */\n readonly type = 'webgpu';\n\n /** The underlying WebGPU device */\n readonly handle: GPUDevice;\n /* The underlying WebGPU adapter */\n readonly adapter: GPUAdapter;\n /* The underlying WebGPU adapter's info */\n readonly adapterInfo: GPUAdapterInfo;\n\n readonly features: DeviceFeatures;\n readonly info: DeviceInfo;\n readonly limits: DeviceLimits;\n\n readonly lost: Promise<{reason: 'destroyed'; message: string}>;\n canvasContext: WebGPUCanvasContext | null = null;\n\n private _isLost: boolean = false;\n commandEncoder: GPUCommandEncoder | null = null;\n renderPass: WebGPURenderPass | null = null;\n\n constructor(\n props: DeviceProps,\n device: GPUDevice,\n adapter: GPUAdapter,\n adapterInfo: GPUAdapterInfo\n ) {\n super({...props, id: props.id || 'webgpu-device'});\n this.handle = device;\n this.adapter = adapter;\n this.adapterInfo = adapterInfo;\n\n this.info = this._getInfo();\n this.features = this._getFeatures();\n this.limits = this.handle.limits;\n\n // Listen for uncaptured WebGPU errors\n device.addEventListener('uncapturederror', (event: Event) => {\n // TODO is this the right way to make sure the error is an Error instance?\n const errorMessage =\n event instanceof GPUUncapturedErrorEvent ? event.error.message : 'Unknown WebGPU error';\n this.reportError(new Error(errorMessage));\n if (this.props.debug) {\n // eslint-disable-next-line no-debugger\n debugger;\n }\n event.preventDefault();\n });\n\n // \"Context\" loss handling\n this.lost = new Promise<{reason: 'destroyed'; message: string}>(async resolve => {\n const lostInfo = await this.handle.lost;\n this._isLost = true;\n resolve({reason: 'destroyed', message: lostInfo.message});\n });\n\n // Note: WebGPU devices can be created without a canvas, for compute shader purposes\n const canvasContextProps = Device._getCanvasContextProps(props);\n if (canvasContextProps) {\n this.canvasContext = new WebGPUCanvasContext(this, this.adapter, canvasContextProps);\n }\n }\n\n // TODO\n // Load the glslang module now so that it is available synchronously when compiling shaders\n // const {glsl = true} = props;\n // this.glslang = glsl && await loadGlslangModule();\n\n destroy(): void {\n this.handle.destroy();\n }\n\n get isLost(): boolean {\n return this._isLost;\n }\n\n createBuffer(props: BufferProps | ArrayBuffer | ArrayBufferView): WebGPUBuffer {\n const newProps = this._normalizeBufferProps(props);\n return new WebGPUBuffer(this, newProps);\n }\n\n createTexture(props: TextureProps): WebGPUTexture {\n return new WebGPUTexture(this, props);\n }\n\n createExternalTexture(props: ExternalTextureProps): WebGPUExternalTexture {\n return new WebGPUExternalTexture(this, props);\n }\n\n createShader(props: ShaderProps): WebGPUShader {\n return new WebGPUShader(this, props);\n }\n\n createSampler(props: SamplerProps): WebGPUSampler {\n return new WebGPUSampler(this, props);\n }\n\n createRenderPipeline(props: RenderPipelineProps): WebGPURenderPipeline {\n return new WebGPURenderPipeline(this, props);\n }\n\n createFramebuffer(props: FramebufferProps): WebGPUFramebuffer {\n return new WebGPUFramebuffer(this, props);\n }\n\n createComputePipeline(props: ComputePipelineProps): WebGPUComputePipeline {\n return new WebGPUComputePipeline(this, props);\n }\n\n createVertexArray(props: VertexArrayProps): WebGPUVertexArray {\n return new WebGPUVertexArray(this, props);\n }\n\n // WebGPU specifics\n\n /**\n * Allows a render pass to begin against a canvas context\n * @todo need to support a \"Framebuffer\" equivalent (aka preconfigured RenderPassDescriptors?).\n */\n beginRenderPass(props: RenderPassProps): WebGPURenderPass {\n this.commandEncoder = this.commandEncoder || this.handle.createCommandEncoder();\n return new WebGPURenderPass(this, props);\n }\n\n beginComputePass(props: ComputePassProps): WebGPUComputePass {\n this.commandEncoder = this.commandEncoder || this.handle.createCommandEncoder();\n return new WebGPUComputePass(this, props);\n }\n\n // createCommandEncoder(props: CommandEncoderProps): WebGPUCommandEncoder {\n // return new WebGPUCommandEncoder(this, props);\n // }\n\n createTransformFeedback(props: TransformFeedbackProps): TransformFeedback {\n throw new Error('Transform feedback not supported in WebGPU');\n }\n\n override createQuerySet(props: QuerySetProps): QuerySet {\n return new WebGPUQuerySet(this, props);\n }\n\n createCanvasContext(props: CanvasContextProps): WebGPUCanvasContext {\n return new WebGPUCanvasContext(this, this.adapter, props);\n }\n\n submit(): void {\n const commandBuffer = this.commandEncoder?.finish();\n if (commandBuffer) {\n this.handle.pushErrorScope('validation');\n this.handle.queue.submit([commandBuffer]);\n this.handle.popErrorScope().then((error: GPUError | null) => {\n if (error) {\n this.reportError(new Error(`WebGPU command submission failed: ${error.message}`));\n }\n });\n }\n this.commandEncoder = null;\n }\n\n // PRIVATE METHODS\n\n protected _getInfo(): DeviceInfo {\n const [driver, driverVersion] = ((this.adapterInfo as any).driver || '').split(' Version ');\n\n // See https://developer.chrome.com/blog/new-in-webgpu-120#adapter_information_updates\n const vendor = this.adapterInfo.vendor || this.adapter.__brand || 'unknown';\n const renderer = driver || '';\n const version = driverVersion || '';\n\n const gpu = vendor === 'apple' ? 'apple' : 'unknown'; // 'nvidia' | 'amd' | 'intel' | 'apple' | 'unknown',\n const gpuArchitecture = this.adapterInfo.architecture || 'unknown';\n const gpuBackend = (this.adapterInfo as any).backend || 'unknown';\n const gpuType = ((this.adapterInfo as any).type || '').split(' ')[0].toLowerCase() || 'unknown';\n\n return {\n type: 'webgpu',\n vendor,\n renderer,\n version,\n gpu,\n gpuType,\n gpuBackend,\n gpuArchitecture,\n shadingLanguage: 'wgsl',\n shadingLanguageVersion: 100\n };\n }\n\n protected _getFeatures(): DeviceFeatures {\n // Initialize with actual WebGPU Features (note that unknown features may not be in DeviceFeature type)\n const features = new Set<DeviceFeature>(this.handle.features as Set<DeviceFeature>);\n // Fixups for pre-standard names: https://github.com/webgpu-native/webgpu-headers/issues/133\n // @ts-expect-error Chrome Canary v99\n if (features.has('depth-clamping')) {\n // @ts-expect-error Chrome Canary v99\n features.delete('depth-clamping');\n features.add('depth-clip-control');\n }\n\n // Some subsets of WebGPU extensions correspond to WebGL extensions\n if (features.has('texture-compression-bc')) {\n features.add('texture-compression-bc5-webgl');\n }\n\n const WEBGPU_ALWAYS_FEATURES: DeviceFeature[] = [\n 'timer-query-webgl',\n 'compilation-status-async-webgl',\n 'float32-renderable-webgl',\n 'float16-renderable-webgl',\n 'norm16-renderable-webgl',\n 'texture-filterable-anisotropic-webgl',\n 'shader-noperspective-interpolation-webgl'\n ];\n\n for (const feature of WEBGPU_ALWAYS_FEATURES) {\n features.add(feature);\n }\n\n return new DeviceFeatures(Array.from(features), this.props._disabledFeatures);\n }\n\n override _getDeviceSpecificTextureFormatCapabilities(\n capabilities: DeviceTextureFormatCapabilities\n ): DeviceTextureFormatCapabilities {\n const {format} = capabilities;\n if (format.includes('webgl')) {\n return {format, create: false, render: false, filter: false, blend: false, store: false};\n }\n return capabilities;\n }\n\n // DEPRECATED METHODS\n\n // @deprecated\n copyExternalImageToTexture(options: {\n texture: Texture;\n mipLevel?: number;\n aspect?: 'all' | 'stencil-only' | 'depth-only';\n colorSpace?: 'display-p3' | 'srgb';\n premultipliedAlpha?: boolean;\n\n source: ImageBitmap | HTMLVideoElement | HTMLCanvasElement | OffscreenCanvas;\n sourceX?: number;\n sourceY?: number;\n\n width?: number;\n height?: number;\n depth?: number;\n }): void {\n const {\n source,\n sourceX = 0,\n sourceY = 0,\n\n texture,\n mipLevel = 0,\n aspect = 'all',\n colorSpace = 'display-p3',\n premultipliedAlpha = false,\n // destinationX,\n // destinationY,\n // desitnationZ,\n\n width = texture.width,\n height = texture.height,\n depth = 1\n } = options;\n\n const webGpuTexture = texture as WebGPUTexture;\n\n this.handle?.queue.copyExternalImageToTexture(\n // source: GPUImageCopyExternalImage\n {\n source,\n origin: [sourceX, sourceY]\n },\n // destination: GPUImageCopyTextureTagged\n {\n texture: webGpuTexture.handle,\n origin: [0, 0, 0], // [x, y, z],\n mipLevel,\n aspect,\n colorSpace,\n premultipliedAlpha\n },\n // copySize: GPUExtent3D\n [width, height, depth]\n );\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\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 =\n this.props.handle ||\n 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 // @ts-expect-error readonly\n this.handle = null;\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(\n byteOffset: number = 0,\n byteLength: number = this.byteLength\n ): 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, {\n usage: Buffer.MAP_READ | Buffer.COPY_DST,\n byteLength\n });\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", "// luma.gl, MIT license\nimport type {\n // Device,\n TextureProps,\n TextureViewProps,\n Sampler,\n SamplerProps,\n // TextureFormat,\n // TextureCubeFace,\n // ExternalImage,\n // TextureLevelData,\n Texture1DData,\n Texture2DData,\n Texture3DData,\n TextureCubeData,\n TextureArrayData,\n TextureCubeArrayData,\n ExternalImage\n} from '@luma.gl/core';\nimport {Texture} from '@luma.gl/core';\n\nimport {getWebGPUTextureFormat} from '../helpers/convert-texture-format';\nimport type {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUSampler} from './webgpu-sampler';\nimport {WebGPUTextureView} from './webgpu-texture-view';\n\nconst BASE_DIMENSIONS: Record<string, '1d' | '2d' | '3d'> = {\n '1d': '1d',\n '2d': '2d',\n '2d-array': '2d',\n cube: '2d',\n 'cube-array': '2d',\n '3d': '3d'\n};\n\nexport class WebGPUTexture extends Texture {\n readonly device: WebGPUDevice;\n readonly handle: GPUTexture;\n\n sampler: WebGPUSampler;\n view: WebGPUTextureView;\n\n constructor(device: WebGPUDevice, props: TextureProps) {\n super(device, props);\n this.device = device;\n\n // Texture base class strips out the data prop, so we need to add it back in\n const propsWithData = {...this.props};\n if (props.data) {\n propsWithData.data = props.data;\n }\n\n this.initialize(propsWithData);\n }\n\n override destroy(): void {\n this.handle?.destroy();\n // @ts-expect-error readonly\n this.handle = null;\n }\n\n createView(props: TextureViewProps): WebGPUTextureView {\n return new WebGPUTextureView(this.device, {...props, texture: this});\n }\n\n protected initialize(props: TextureProps): void {\n // @ts-expect-error\n this.handle = this.props.handle || this.createHandle();\n this.handle.label ||= this.id;\n\n if (this.props.data) {\n if (Texture.isExternalImage(this.props.data)) {\n this.copyExternalImage({image: this.props.data});\n } else {\n this.setData({data: this.props.data});\n }\n }\n\n this.width = this.handle.width;\n this.height = this.handle.height;\n // Why not just read all properties directly from the texture\n // this.depthOrArrayLayers = this.handle.depthOrArrayLayers;\n // this.mipLevelCount = this.handle.mipLevelCount;\n // this.sampleCount = this.handle.sampleCount;\n // this.dimension = this.handle.dimension;\n // this.format = this.handle.format;\n // this.usage = this.handle.usage;\n\n // Create a default sampler. This mimics the WebGL1 API where sampler props are stored on the texture\n // this.setSampler(props.sampler);\n this.sampler =\n props.sampler instanceof WebGPUSampler\n ? props.sampler\n : new WebGPUSampler(this.device, props.sampler || {});\n\n // TODO - To support texture arrays we need to create custom views...\n // But we are not ready to expose TextureViews to the public API.\n // @ts-expect-error\n\n this.view = new WebGPUTextureView(this.device, {...this.props, texture: this});\n // format: this.props.format,\n // dimension: this.props.dimension,\n // aspect = \"all\";\n // baseMipLevel: 0;\n // mipLevelCount;\n // baseArrayLayer = 0;\n // arrayLayerCount;\n }\n\n protected createHandle(): GPUTexture {\n // Deduce size from data - TODO this is a hack\n // @ts-expect-error\n const width = this.props.width || this.props.data?.width || 1;\n // @ts-expect-error\n const height = this.props.height || this.props.data?.height || 1;\n\n return this.device.handle.createTexture({\n label: this.id,\n size: {\n width,\n height,\n depthOrArrayLayers: this.depth\n },\n usage: this.props.usage || Texture.TEXTURE | Texture.COPY_DST,\n dimension: BASE_DIMENSIONS[this.dimension],\n format: getWebGPUTextureFormat(this.format),\n mipLevelCount: this.mipLevels,\n sampleCount: this.props.samples\n });\n }\n\n /** @deprecated - intention is to use the createView public API */\n createGPUTextureView(): GPUTextureView {\n return this.handle.createView({label: this.id});\n }\n\n /**\n * Set default sampler\n * Accept a sampler instance or set of props;\n */\n setSampler(sampler: Sampler | SamplerProps): this {\n this.sampler =\n sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);\n return this;\n }\n\n setTexture1DData(data: Texture1DData): void {\n throw new Error('not implemented');\n }\n\n setTexture2DData(lodData: Texture2DData, depth?: number, target?: number): void {\n throw new Error('not implemented');\n }\n\n setTexture3DData(lodData: Texture3DData, depth?: number, target?: number): void {\n throw new Error('not implemented');\n }\n\n setTextureCubeData(data: TextureCubeData, depth?: number): void {\n throw new Error('not implemented');\n }\n\n setTextureArrayData(data: TextureArrayData): void {\n throw new Error('not implemented');\n }\n\n setTextureCubeArrayData(data: TextureCubeArrayData): void {\n throw new Error('not implemented');\n }\n\n setData(options: {data: any}): {width: number; height: number} {\n if (ArrayBuffer.isView(options.data)) {\n const clampedArray = new Uint8ClampedArray(options.data.buffer);\n // TODO - pass through src data color space as ImageData Options?\n const image = new ImageData(clampedArray, this.width, this.height);\n return this.copyExternalImage({image});\n }\n\n throw new Error('Texture.setData: Use CommandEncoder to upload data to texture in WebGPU');\n }\n\n copyExternalImage(options: {\n image: ExternalImage;\n width?: number;\n height?: number;\n depth?: number;\n sourceX?: number;\n sourceY?: number;\n mipLevel?: number;\n x?: number;\n y?: number;\n z?: number;\n aspect?: 'all' | 'stencil-only' | 'depth-only';\n colorSpace?: 'srgb';\n premultipliedAlpha?: boolean;\n }): {width: number; height: number} {\n const size = Texture.getExternalImageSize(options.image);\n const opts = {...Texture.defaultCopyExternalImageOptions, ...size, ...options};\n const {\n image,\n sourceX,\n sourceY,\n width,\n height,\n depth,\n mipLevel,\n x,\n y,\n z,\n aspect,\n colorSpace,\n premultipliedAlpha,\n flipY\n } = opts;\n\n // TODO - max out width\n\n this.device.handle.queue.copyExternalImageToTexture(\n // source: GPUImageCopyExternalImage\n {\n source: image,\n origin: [sourceX, sourceY],\n flipY\n },\n // destination: GPUImageCopyTextureTagged\n {\n texture: this.handle,\n origin: [x, y, z],\n mipLevel,\n aspect,\n colorSpace,\n premultipliedAlpha\n },\n // copySize: GPUExtent3D\n [width, height, depth]\n );\n return {width, height};\n }\n\n // WebGPU specific\n\n /*\n async readPixels() {\n const readbackBuffer = device.createBuffer({\n usage: Buffer.COPY_DST | Buffer.MAP_READ,\n size: 4 * textureWidth * textureHeight,\n });\n\n // Copy data from the texture to the buffer.\n const encoder = device.createCommandEncoder();\n encoder.copyTextureToBuffer(\n { texture },\n { buffer, rowPitch: textureWidth * 4 },\n [textureWidth, textureHeight],\n );\n device.submit([encoder.finish()]);\n\n // Get the data on the CPU.\n await buffer.mapAsync(GPUMapMode.READ);\n saveScreenshot(buffer.getMappedRange());\n buffer.unmap();\n }\n\n setImageData(imageData, usage): this {\n let data = null;\n\n const bytesPerRow = Math.ceil((img.width * 4) / 256) * 256;\n if (bytesPerRow == img.width * 4) {\n data = imageData.data;\n } else {\n data = new Uint8Array(bytesPerRow * img.height);\n let imagePixelIndex = 0;\n for (let y = 0; y < img.height; ++y) {\n for (let x = 0; x < img.width; ++x) {\n const i = x * 4 + y * bytesPerRow;\n data[i] = imageData.data[imagePixelIndex];\n data[i + 1] = imageData.data[imagePixelIndex + 1];\n data[i + 2] = imageData.data[imagePixelIndex + 2];\n data[i + 3] = imageData.data[imagePixelIndex + 3];\n imagePixelIndex += 4;\n }\n }\n }\n return this;\n }\n\n setBuffer(textureDataBuffer, {bytesPerRow}): this {\n const commandEncoder = this.device.handle.createCommandEncoder();\n commandEncoder.copyBufferToTexture(\n {\n buffer: textureDataBuffer,\n bytesPerRow\n },\n {\n texture: this.handle\n },\n {\n width,\n height,\n depth\n }\n );\n\n this.device.handle.defaultQueue.submit([commandEncoder.finish()]);\n return this;\n }\n */\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {TextureFormat} from '@luma.gl/core';\n\n/** Ensure a texture format is WebGPU compatible */\nexport function getWebGPUTextureFormat(format: TextureFormat): GPUTextureFormat {\n if (format.includes('webgl')) {\n throw new Error('webgl-only format');\n }\n return format as GPUTextureFormat;\n}\n", "// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {Sampler, SamplerProps} from '@luma.gl/core';\nimport type {WebGPUDevice} from '../webgpu-device';\n\nexport type WebGPUSamplerProps = SamplerProps & {\n handle?: GPUSampler;\n};\n\n/**\n * A WebGPU sampler object\n */\nexport class WebGPUSampler extends Sampler {\n readonly device: WebGPUDevice;\n readonly handle: GPUSampler;\n\n constructor(device: WebGPUDevice, props: WebGPUSamplerProps) {\n super(device, props);\n this.device = device;\n\n // Prepare sampler props. Mostly identical\n const samplerDescriptor: Partial<GPUSamplerDescriptor> = {\n ...this.props,\n mipmapFilter: undefined\n };\n\n // props.compare automatically turns this into a comparison sampler\n if (props.type !== 'comparison-sampler') {\n delete samplerDescriptor.compare;\n }\n\n // disable mipmapFilter if not set\n if (props.mipmapFilter && props.mipmapFilter !== 'none') {\n samplerDescriptor.mipmapFilter = props.mipmapFilter;\n }\n\n this.handle = this.handle || this.device.handle.createSampler(samplerDescriptor);\n this.handle.label = this.props.id;\n }\n\n override destroy(): void {\n // GPUSampler does not have a destroy method\n // this.handle.destroy();\n // @ts-expect-error readonly\n this.handle = null;\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {TextureView, TextureViewProps} from '@luma.gl/core';\nimport type {WebGPUDevice} from '../webgpu-device';\nimport type {WebGPUTexture} from './webgpu-texture';\n\n/*\n // type = sampler\n samplerType?: 'filtering' | 'non-filtering' | 'comparison';\n\n // type = texture\n viewDimension?: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';\n sampleType?: 'float' | 'unfilterable-float' | 'depth' | 'sint' | 'uint';\n multisampled?: boolean;\n\n // type = storage\n viewDimension?: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d';\n access: 'read-only' | 'write-only';\n format: string;\n*/\n\nexport type WebGPUTextureViewProps = TextureViewProps & {\n handle?: GPUTextureView;\n};\n\n/**\n *\n */\nexport class WebGPUTextureView extends TextureView {\n readonly device: WebGPUDevice;\n readonly handle: GPUTextureView;\n readonly texture: WebGPUTexture;\n\n constructor(device: WebGPUDevice, props: WebGPUTextureViewProps & {texture: WebGPUTexture}) {\n super(device, props);\n this.device = device;\n this.texture = props.texture;\n\n this.handle =\n this.handle ||\n this.texture.handle.createView({\n format: (props.format || this.texture.format) as GPUTextureFormat,\n dimension: props.dimension || this.texture.dimension,\n aspect: props.aspect,\n baseMipLevel: props.baseMipLevel,\n mipLevelCount: props.mipLevelCount, // GPUIntegerCoordinate;\n baseArrayLayer: props.baseArrayLayer, // GPUIntegerCoordinate;\n arrayLayerCount: props.arrayLayerCount // GPUIntegerCoordinate;\n });\n this.handle.label = this.props.id;\n }\n\n override destroy(): void {\n // GPUTextureView does not have a destroy method\n // this.handle.destroy();\n // @ts-expect-error readonly\n this.handle = null;\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {ExternalTexture, ExternalTextureProps, Sampler, SamplerProps} from '@luma.gl/core';\nimport type {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUSampler} from './webgpu-sampler';\n\n/**\n * Cheap, temporary texture view for videos\n * Only valid within same callback, destroyed automatically as a microtask.\n */\nexport class WebGPUExternalTexture extends ExternalTexture {\n readonly device: WebGPUDevice;\n readonly handle: GPUExternalTexture;\n sampler: WebGPUSampler;\n\n constructor(device: WebGPUDevice, props: ExternalTextureProps) {\n super(device, props);\n this.device = device;\n this.handle =\n this.props.handle ||\n this.device.handle.importExternalTexture({\n source: props.source,\n colorSpace: props.colorSpace\n });\n // @ts-expect-error\n this.sampler = null;\n }\n\n override destroy(): void {\n // External textures are destroyed automatically,\n // as a microtask, instead of manually or upon garbage collection like other resources.\n // this.handle.destroy();\n // @ts-expect-error readonly\n this.handle = null;\n }\n\n /** Set default sampler */\n setSampler(sampler: Sampler | SamplerProps): this {\n // We can accept a sampler instance or set of props;\n this.sampler =\n sampler instanceof WebGPUSampler ? sampler : new WebGPUSampler(this.device, sampler);\n return this;\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderProps, CompilerMessage} from '@luma.gl/core';\nimport {Shader, log} from '@luma.gl/core';\nimport type {WebGPUDevice} from '../webgpu-device';\n\n/**\n * Immutable shader\n */\nexport class WebGPUShader extends Shader {\n readonly device: WebGPUDevice;\n readonly handle: GPUShaderModule;\n\n constructor(device: WebGPUDevice, props: ShaderProps) {\n super(device, props);\n this.device = device;\n\n const isGLSL = props.source.includes('#version');\n if (this.props.language === 'glsl' || isGLSL) {\n throw new Error('GLSL shaders are not supported in WebGPU');\n }\n\n this.device.handle.pushErrorScope('validation');\n this.handle = this.props.handle || this.device.handle.createShaderModule({code: props.source});\n this.device.handle.popErrorScope().then((error: GPUError | null) => {\n if (error) {\n log.error(`${this} creation failed:\\n\"${error.message}\"`, this, this.props.source)();\n }\n });\n\n this.handle.label = this.props.id;\n this._checkCompilationError();\n }\n\n get asyncCompilationStatus(): Promise<any> {\n return this.getCompilationInfo().then(() => this.compilationStatus);\n }\n\n async _checkCompilationError(): Promise<void> {\n const shaderLog = await this.getCompilationInfo();\n const hasErrors = Boolean(shaderLog.find(msg => msg.type === 'error'));\n this.compilationStatus = hasErrors ? 'error' : 'success';\n this.debugShader();\n\n if (this.compilationStatus === 'error') {\n log.error(`Shader compilation error`, shaderLog)();\n // Note: Even though this error is asynchronous and thrown after the constructor completes,\n // it will result in a useful stack trace leading back to the constructor\n // throw new Error(`Shader compilation error`);\n }\n }\n\n override destroy(): void {\n // Note: WebGPU does not offer a method to destroy shaders\n // this.handle.destroy();\n // @ts-expect-error readonly\n this.handle = null;\n }\n\n /** Returns compilation info for this shader */\n async getCompilationInfo(): Promise<readonly CompilerMessage[]> {\n const compilationInfo = await this.handle.getCompilationInfo();\n return compilationInfo.messages;\n }\n}\n", "// luma.gl MIT license\n\nimport type {Binding, RenderPass, VertexArray} from '@luma.gl/core';\nimport {RenderPipeline, RenderPipelineProps, log} from '@luma.gl/core';\nimport {applyParametersToRenderPipelineDescriptor} from '../helpers/webgpu-parameters';\nimport {getWebGPUTextureFormat} from '../helpers/convert-texture-format';\nimport {getBindGroup} from '../helpers/get-bind-group';\nimport {getVertexBufferLayout} from '../helpers/get-vertex-buffer-layout';\n// import {convertAttributesVertexBufferToLayout} from '../helpers/get-vertex-buffer-layout';\n// import {mapAccessorToWebGPUFormat} from './helpers/accessor-to-format';\n// import type {BufferAccessors} from './webgpu-pipeline';\n\nimport type {WebGPUDevice} from '../webgpu-device';\n// import type {WebGPUBuffer} from './webgpu-buffer';\nimport type {WebGPUShader} from './webgpu-shader';\nimport type {WebGPURenderPass} from './webgpu-render-pass';\n\n// RENDER PIPELINE\n\n/** Creates a new render pipeline when parameters change */\nexport class WebGPURenderPipeline extends RenderPipeline {\n device: WebGPUDevice;\n handle: GPURenderPipeline;\n\n vs: WebGPUShader;\n fs: WebGPUShader | null = null;\n\n /** For internal use to create BindGroups */\n private _bindings: Record<string, Binding>;\n private _bindGroupLayout: GPUBindGroupLayout | null = null;\n private _bindGroup: GPUBindGroup | null = null;\n\n constructor(device: WebGPUDevice, props: RenderPipelineProps) {\n super(device, props);\n this.device = device;\n this.handle = this.props.handle as GPURenderPipeline;\n if (!this.handle) {\n const descriptor = this._getRenderPipelineDescriptor();\n log.groupCollapsed(1, `new WebGPURenderPipeline(${this.id})`)();\n log.probe(1, JSON.stringify(descriptor, null, 2))();\n log.groupEnd(1)();\n\n this.device.handle.pushErrorScope('validation');\n this.handle = this.device.handle.createRenderPipeline(descriptor);\n this.device.handle.popErrorScope().then((error: GPUError | null) => {\n if (error) {\n log.error(`${this} creation failed:\\n\"${error.message}\"`, this, this.props.vs?.source)();\n }\n });\n }\n this.handle.label = this.props.id;\n\n // Note: Often the same shader in WebGPU\n this.vs = props.vs as WebGPUShader;\n this.fs = props.fs as WebGPUShader;\n\n this._bindings = {...this.props.bindings};\n }\n\n override destroy(): void {\n // WebGPURenderPipeline has no destroy method.\n // @ts-expect-error\n this.handle = null;\n }\n\n /**\n * @todo Use renderpass.setBindings() ?\n * @todo Do we want to expose BindGroups in the API and remove this?\n */\n setBindings(bindings: Record<string, Binding>): void {\n Object.assign(this._bindings, bindings);\n }\n\n /** @todo - should this be moved to renderpass? */\n draw(options: {\n renderPass: RenderPass;\n vertexArray: VertexArray;\n vertexCount?: number;\n indexCount?: number;\n instanceCount?: number;\n firstVertex?: number;\n firstIndex?: number;\n firstInstance?: number;\n baseVertex?: number;\n }): boolean {\n const webgpuRenderPass = options.renderPass as WebGPURenderPass;\n\n // Set pipeline\n this.device.handle.pushErrorScope('validation');\n webgpuRenderPass.handle.setPipeline(this.handle);\n this.device.handle.popErrorScope().then((error: GPUError | null) => {\n if (error) {\n log.error(`${this} setPipeline failed:\\n\"${error.message}\"`, this)();\n }\n });\n\n // Set bindings (uniform buffers, textures etc)\n const bindGroup = this._getBindGroup();\n if (bindGroup) {\n webgpuRenderPass.handle.setBindGroup(0, bindGroup);\n }\n\n // Set attributes\n // Note: Rebinds constant attributes before each draw call\n options.vertexArray.bindBeforeRender(options.renderPass);\n\n // Draw\n if (options.indexCount) {\n webgpuRenderPass.handle.drawIndexed(\n options.indexCount,\n options.instanceCount,\n options.firstIndex,\n options.baseVertex,\n options.firstInstance\n );\n } else {\n webgpuRenderPass.handle.draw(\n options.vertexCount || 0,\n options.instanceCount || 1, // If 0, nothing will be drawn\n options.firstInstance\n );\n }\n\n // Note: Rebinds constant attributes before each draw call\n options.vertexArray.unbindAfterRender(options.renderPass);\n\n return true;\n }\n\n /** Return a bind group created by setBindings */\n _getBindGroup() {\n if (this.shaderLayout.bindings.length === 0) {\n return null;\n }\n\n // Get hold of the bind group layout. We don't want to do this unless we know there is at least one bind group\n this._bindGroupLayout = this._bindGroupLayout || this.handle.getBindGroupLayout(0);\n\n // Set up the bindings\n // TODO what if bindings change? We need to rebuild the bind group!\n this._bindGroup =\n this._bindGroup ||\n getBindGroup(this.device.handle, this._bindGroupLayout, this.shaderLayout, this._bindings);\n\n return this._bindGroup;\n }\n\n /**\n * Populate the complex WebGPU GPURenderPipelineDescriptor\n */\n protected _getRenderPipelineDescriptor() {\n // Set up the vertex stage\n const vertex: GPUVertexState = {\n module: (this.props.vs as WebGPUShader).handle,\n entryPoint: this.props.vertexEntryPoint || 'main',\n buffers: getVertexBufferLayout(this.shaderLayout, this.props.bufferLayout)\n };\n\n // Set up the fragment stage\n const fragment: GPUFragmentState = {\n module: (this.props.fs as WebGPUShader).handle,\n entryPoint: this.props.fragmentEntryPoint || 'main',\n targets: [\n {\n // TODO exclamation mark hack!\n format: getWebGPUTextureFormat(this.device.getCanvasContext().format)\n }\n ]\n };\n\n // Create a partially populated descriptor\n const descriptor: GPURenderPipelineDescriptor = {\n vertex,\n fragment,\n primitive: {\n topology: this.props.topology\n },\n layout: 'auto'\n };\n\n if (this.props.parameters.depthWriteEnabled && this.props.parameters.depthCompare) {\n descriptor.depthStencil = {\n format: 'depth24plus',\n depthWriteEnabled: this.props.parameters.depthWriteEnabled,\n depthCompare: this.props.parameters.depthCompare\n };\n }\n\n // Set parameters on the descriptor\n applyParametersToRenderPipelineDescriptor(descriptor, this.props.parameters);\n\n return descriptor;\n }\n}\n/**\n_setAttributeBuffers(webgpuRenderPass: WebGPURenderPass) {\n if (this._indexBuffer) {\n webgpuRenderPass.handle.setIndexBuffer(this._indexBuffer.handle, this._indexBuffer.props.indexType);\n }\n\n const buffers = this._getBuffers();\n for (let i = 0; i < buffers.length; ++i) {\n const buffer = cast<WebGPUBuffer>(buffers[i]);\n if (!buffer) {\n const attribute = this.shaderLayout.attributes.find(\n (attribute) => attribute.location === i\n );\n throw new Error(\n `No buffer provided for attribute '${attribute?.name || ''}' in Model '${this.props.id}'`\n );\n }\n webgpuRenderPass.handle.setVertexBuffer(i, buffer.handle);\n }\n\n // TODO - HANDLE buffer maps\n /*\n for (const [bufferName, attributeMapping] of Object.entries(this.props.bufferLayout)) {\n const buffer = cast<WebGPUBuffer>(this.props.attributes[bufferName]);\n if (!buffer) {\n log.warn(`Missing buffer for buffer map ${bufferName}`)();\n continue;\n }\n\n if ('location' in attributeMapping) {\n // @ts-expect-error TODO model must not depend on webgpu\n renderPass.handle.setVertexBuffer(layout.location, buffer.handle);\n } else {\n for (const [bufferName, mapping] of Object.entries(attributeMapping)) {\n // @ts-expect-error TODO model must not depend on webgpu\n renderPass.handle.setVertexBuffer(field.location, buffer.handle);\n }\n }\n }\n *\n}\n*/\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {Parameters, log} 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\nfunction addDepthStencilFront(descriptor: GPURenderPipelineDescriptor): GPUStencilFaceState {\n const depthStencil = addDepthStencil(descriptor);\n // @ts-ignore\n return depthStencil.stencilFront;\n}\n\nfunction addDepthStencilBack(descriptor: GPURenderPipelineDescriptor): GPUStencilFaceState {\n const depthStencil = addDepthStencil(descriptor);\n // @ts-ignore\n return depthStencil.stencilBack;\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: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthWriteEnabled = value;\n },\n\n depthCompare: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthCompare = value;\n },\n\n depthFormat: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\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: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthBiasSlopeScale = value;\n },\n\n depthBiasClamp: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.depthBiasClamp = value;\n },\n\n // STENCIL\n\n stencilReadMask: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilReadMask = value;\n },\n\n stencilWriteMask: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n const depthStencil = addDepthStencil(descriptor);\n depthStencil.stencilWriteMask = value;\n },\n\n stencilCompare: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n const stencilFront = addDepthStencilFront(descriptor);\n const stencilBack = addDepthStencilBack(descriptor);\n stencilFront.compare = value;\n stencilBack.compare = value;\n },\n\n stencilPassOperation: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n const stencilFront = addDepthStencilFront(descriptor);\n const stencilBack = addDepthStencilBack(descriptor);\n stencilFront.passOp = value;\n stencilBack.passOp = value;\n },\n\n stencilFailOperation: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n const stencilFront = addDepthStencilFront(descriptor);\n const stencilBack = addDepthStencilBack(descriptor);\n stencilFront.failOp = value;\n stencilBack.failOp = value;\n },\n\n stencilDepthFailOperation: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n const stencilFront = addDepthStencilFront(descriptor);\n const stencilBack = addDepthStencilBack(descriptor);\n stencilFront.depthFailOp = value;\n stencilBack.depthFailOp = value;\n },\n\n // MULTISAMPLE\n\n sampleCount: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n descriptor.multisample = descriptor.multisample || {};\n descriptor.multisample.count = value;\n },\n\n sampleMask: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\n descriptor.multisample = descriptor.multisample || {};\n descriptor.multisample.mask = value;\n },\n\n sampleAlphaToCoverageEnabled: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\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: (\n parameter: keyof Parameters,\n value: any,\n descriptor: GPURenderPipelineDescriptor\n ) => {\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 log.warn(`Illegal parameter ${key}`)();\n continue;\n }\n setterFunction(key, value, pipelineDescriptor);\n }\n}\n\nfunction addColorState(descriptor: GPURenderPipelineDescriptor): GPUColorTargetState[] {\n // @ts-ignore GPU types as iterator\n descriptor.fragment.targets = descriptor.fragment?.targets || [];\n if (!Array.isArray(descriptor.fragment?.targets)) {\n log.warn('parameters: no targets array')();\n }\n // @ts-expect-error GPU types as iterator\n if (descriptor.fragment?.targets?.length === 0) {\n // @ts-expect-error GPU types as iterator\n descriptor.fragment.targets?.push({});\n }\n return descriptor.fragment?.targets as GPUColorTargetState[];\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ComputeShaderLayout, BindingDeclaration, Binding} from '@luma.gl/core';\nimport {Buffer, Sampler, Texture, log} from '@luma.gl/core';\nimport type {WebGPUBuffer} from '../resources/webgpu-buffer';\nimport type {WebGPUSampler} from '../resources/webgpu-sampler';\nimport type {WebGPUTexture} from '../resources/webgpu-texture';\n\n/**\n * Create a WebGPU \"bind group layout\" from an array of luma.gl bindings\n * @note bind groups can be automatically generated by WebGPU.\n */\nexport function makeBindGroupLayout(\n device: GPUDevice,\n layout: GPUBindGroupLayout,\n bindings: Binding[]\n): GPUBindGroupLayout {\n throw new Error('not implemented');\n // return device.createBindGroupLayout({\n // layout,\n // entries: getBindGroupEntries(bindings)\n // })\n}\n\n/**\n * Create a WebGPU \"bind group\" from an array of luma.gl bindings\n */\nexport function getBindGroup(\n device: GPUDevice,\n bindGroupLayout: GPUBindGroupLayout,\n shaderLayout: ComputeShaderLayout,\n bindings: Record<string, Binding>\n): GPUBindGroup {\n const entries = getBindGroupEntries(bindings, shaderLayout);\n return device.createBindGroup({\n layout: bindGroupLayout,\n entries\n });\n}\n\nexport function getShaderLayoutBinding(\n shaderLayout: ComputeShaderLayout,\n bindingName: string\n): BindingDeclaration | null {\n const bindingLayout = shaderLayout.bindings.find(\n binding =>\n binding.name === bindingName || `${binding.name}uniforms` === bindingName.toLocaleLowerCase()\n );\n if (!bindingLayout) {\n log.warn(`Binding ${bindingName} not set: Not found in shader layout.`)();\n }\n return bindingLayout || null;\n}\n\n/**\n * @param bindings\n * @returns\n */\nfunction getBindGroupEntries(\n bindings: Record<string, Binding>,\n shaderLayout: ComputeShaderLayout\n): GPUBindGroupEntry[] {\n const entries: GPUBindGroupEntry[] = [];\n\n for (const [bindingName, value] of Object.entries(bindings)) {\n let bindingLayout = getShaderLayoutBinding(shaderLayout, bindingName);\n if (bindingLayout) {\n entries.push(getBindGroupEntry(value, bindingLayout.location));\n }\n\n // TODO - hack to automatically bind samplers to supplied texture default samplers\n bindingLayout = getShaderLayoutBinding(shaderLayout, `${bindingName}Sampler`);\n if (bindingLayout) {\n entries.push(getBindGroupEntry(value, bindingLayout.location, {sampler: true}));\n }\n }\n\n return entries;\n}\n\nfunction getBindGroupEntry(\n binding: Binding,\n index: number,\n options?: {sampler?: boolean}\n): GPUBindGroupEntry {\n if (binding instanceof Buffer) {\n return {\n binding: index,\n resource: {\n buffer: (binding as WebGPUBuffer).handle\n }\n };\n }\n if (binding instanceof Sampler) {\n return {\n binding: index,\n resource: (binding as WebGPUSampler).handle\n };\n } else if (binding instanceof Texture) {\n if (options?.sampler) {\n return {\n binding: index,\n resource: (binding as WebGPUTexture).sampler.handle\n };\n }\n return {\n binding: index,\n resource: (binding as WebGPUTexture).handle.createView({label: 'bind-group-auto-created'})\n };\n }\n throw new Error('invalid binding');\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {ShaderLayout, BufferLayout, AttributeDeclaration, VertexFormat} from '@luma.gl/core';\nimport {log, decodeVertexFormat} from '@luma.gl/core';\n// import {getAttributeInfosFromLayouts} from '@luma.gl/core';\n\n/** Throw error on any WebGL-only vertex formats */\nfunction getWebGPUVertexFormat(format: VertexFormat): GPUVertexFormat {\n if (format.endsWith('-webgl')) {\n throw new Error(`WebGPU does not support vertex format ${format}`);\n }\n return format as GPUVertexFormat;\n}\n\n/**\n * Build a WebGPU vertex buffer layout intended for use in a GPURenderPassDescriptor.\n * Converts luma.gl attribute definitions to a WebGPU GPUVertexBufferLayout[] array\n * @param layout\n * @param bufferLayout The buffer map is optional\n * @returns WebGPU layout intended for a GPURenderPassDescriptor.\n */\nexport function getVertexBufferLayout(\n shaderLayout: ShaderLayout,\n bufferLayout: BufferLayout[]\n): GPUVertexBufferLayout[] {\n const vertexBufferLayouts: GPUVertexBufferLayout[] = [];\n const usedAttributes = new Set<string>();\n\n // First handle any buffers mentioned in `bufferLayout`\n for (const mapping of bufferLayout) {\n // Build vertex attributes for one buffer\n const vertexAttributes: GPUVertexAttribute[] = [];\n\n // TODO verify that all stepModes for one buffer are the same\n let stepMode: 'vertex' | 'instance' = 'vertex';\n let byteStride = 0;\n // @ts-ignore\n let format: VertexFormat = mapping.format;\n\n // interleaved mapping {..., attributes: [{...}, ...]}\n if (mapping.attributes) {\n // const arrayStride = mapping.byteStride; TODO\n for (const attributeMapping of mapping.attributes) {\n const attributeName = attributeMapping.attribute;\n const attributeLayout = findAttributeLayout(shaderLayout, attributeName, usedAttributes);\n\n // @ts-ignore\n const location: number = attributeLayout?.location;\n format = attributeMapping.format || mapping.format;\n\n stepMode =\n attributeLayout?.stepMode ||\n (attributeLayout?.name.startsWith('instance') ? 'instance' : 'vertex');\n vertexAttributes.push({\n format: getWebGPUVertexFormat(format),\n offset: attributeMapping.byteOffset,\n shaderLocation: location\n });\n\n byteStride += decodeVertexFormat(format).byteLength;\n }\n // non-interleaved mapping (just set offset and stride)\n } else {\n const attributeLayout = findAttributeLayout(shaderLayout, mapping.name, usedAttributes);\n if (!attributeLayout) {\n continue; // eslint-disable-line no-continue\n }\n byteStride = decodeVertexFormat(format).byteLength;\n\n stepMode =\n attributeLayout.stepMode ||\n (attributeLayout.name.startsWith('instance') ? 'instance' : 'vertex');\n vertexAttributes.push({\n format: getWebGPUVertexFormat(format),\n // We only support 0 offset for non-interleaved buffer layouts\n offset: 0,\n shaderLocation: attributeLayout.location\n });\n }\n\n // Store all the attribute bindings for one buffer\n vertexBufferLayouts.push({\n arrayStride: mapping.byteStride || byteStride,\n stepMode,\n attributes: vertexAttributes\n });\n }\n\n // Add any non-mapped attributes - TODO - avoid hardcoded types\n for (const attribute of shaderLayout.attributes) {\n if (!usedAttributes.has(attribute.name)) {\n vertexBufferLayouts.push({\n arrayStride: decodeVertexFormat('float32x3').byteLength,\n stepMode:\n attribute.stepMode || (attribute.name.startsWith('instance') ? 'instance' : 'vertex'),\n attributes: [\n {\n format: getWebGPUVertexFormat('float32x3'),\n offset: 0,\n shaderLocation: attribute.location\n }\n ]\n });\n }\n }\n\n return vertexBufferLayouts;\n}\n\nexport function getBufferSlots(\n shaderLayout: ShaderLayout,\n bufferLayout: BufferLayout[]\n): Record<string, number> {\n const usedAttributes = new Set<string>();\n let bufferSlot = 0;\n const bufferSlots: Record<string, number> = {};\n\n // First handle any buffers mentioned in `bufferLayout`\n for (const mapping of bufferLayout) {\n // interleaved mapping {..., attributes: [{...}, ...]}\n if ('attributes' in mapping) {\n for (const interleaved of mapping.attributes || []) {\n usedAttributes.add(interleaved.attribute);\n }\n // non-interleaved mapping (just set offset and stride)\n } else {\n usedAttributes.add(mapping.name);\n }\n bufferSlots[mapping.name] = bufferSlot++;\n }\n\n // Add any non-mapped attributes\n for (const attribute of shaderLayout.attributes) {\n if (!usedAttributes.has(attribute.name)) {\n bufferSlots[attribute.name] = bufferSlot++;\n }\n }\n\n return bufferSlots;\n}\n\n/**\n * Looks up an attribute in the ShaderLayout.\n * @throws if name is not in ShaderLayout\n * @throws if name has already been referenced\n */\nfunction findAttributeLayout(\n shaderLayout: ShaderLayout,\n name: string,\n attributeNames: Set<string>\n): AttributeDeclaration | null {\n const attribute = shaderLayout.attributes.find(attribute_ => attribute_.name === name);\n if (!attribute) {\n log.warn(`Unknown attribute ${name}`)();\n return null;\n }\n if (attributeNames.has(name)) {\n throw new Error(`Duplicate attribute ${name}`);\n }\n attributeNames.add(name);\n return attribute;\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {FramebufferProps} from '@luma.gl/core';\nimport {Framebuffer} from '@luma.gl/core';\nimport {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUTextureView} from '../resources/webgpu-texture-view';\n\n/**\n * Create new textures with correct size for all attachments.\n * @note resize() destroys existing textures (if size has changed).\n */\nexport class WebGPUFramebuffer extends Framebuffer {\n readonly device: WebGPUDevice;\n\n colorAttachments: WebGPUTextureView[] = [];\n depthStencilAttachment: WebGPUTextureView | null = null;\n\n constructor(device: WebGPUDevice, props: FramebufferProps) {\n super(device, props);\n this.device = device;\n\n // Auto create textures for attachments if needed\n this.autoCreateAttachmentTextures();\n }\n\n protected updateAttachments(): void {\n // WebGPU framebuffers are JS only objects, nothing to update\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {ComputePipeline, ComputePipelineProps, Binding} from '@luma.gl/core';\nimport {getBindGroup} from '../helpers/get-bind-group';\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 /** For internal use to create BindGroups */\n private _bindGroupLayout: GPUBindGroupLayout | null = null;\n private _bindGroup: GPUBindGroup | null = null;\n /** For internal use to create BindGroups */\n private _bindings: Record<string, Binding> = {};\n\n constructor(device: WebGPUDevice, props: ComputePipelineProps) {\n super(device, props);\n this.device = device;\n\n const webgpuShader = this.props.shader as WebGPUShader;\n\n this.handle =\n this.props.handle ||\n this.device.handle.createComputePipeline({\n label: this.props.id,\n compute: {\n module: webgpuShader.handle,\n entryPoint: this.props.entryPoint,\n constants: this.props.constants\n },\n layout: 'auto'\n });\n }\n\n /**\n * @todo Use renderpass.setBindings() ?\n * @todo Do we want to expose BindGroups in the API and remove this?\n */\n setBindings(bindings: Record<string, Binding>): void {\n Object.assign(this._bindings, bindings);\n }\n\n /** Return a bind group created by setBindings */\n _getBindGroup() {\n // Get hold of the bind group layout. We don't want to do this unless we know there is at least one bind group\n this._bindGroupLayout = this._bindGroupLayout || this.handle.getBindGroupLayout(0);\n\n // Set up the bindings\n this._bindGroup =\n this._bindGroup ||\n getBindGroup(this.device.handle, this._bindGroupLayout, this.shaderLayout, this._bindings);\n\n return this._bindGroup;\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {TypedArray, NumberArray4} from '@math.gl/types';\nimport type {RenderPassProps, RenderPassParameters, Binding} from '@luma.gl/core';\nimport {Buffer, RenderPass, RenderPipeline, log} from '@luma.gl/core';\nimport {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUBuffer} from './webgpu-buffer';\n// import {WebGPUCommandEncoder} from './webgpu-command-encoder';\nimport {WebGPURenderPipeline} from './webgpu-render-pipeline';\nimport {WebGPUQuerySet} from './webgpu-query-set';\nimport {WebGPUFramebuffer} from './webgpu-framebuffer';\n\nexport class WebGPURenderPass extends RenderPass {\n readonly device: WebGPUDevice;\n readonly handle: GPURenderPassEncoder;\n\n /** Active pipeline */\n pipeline: WebGPURenderPipeline | null = null;\n\n constructor(device: WebGPUDevice, props: RenderPassProps = {}) {\n super(device, props);\n this.device = device;\n const framebuffer =\n (props.framebuffer as WebGPUFramebuffer) || device.getCanvasContext().getCurrentFramebuffer();\n\n const renderPassDescriptor = this.getRenderPassDescriptor(framebuffer);\n\n const webgpuQuerySet = props.timestampQuerySet as WebGPUQuerySet;\n if (webgpuQuerySet) {\n renderPassDescriptor.occlusionQuerySet = webgpuQuerySet.handle;\n }\n\n if (device.features.has('timestamp-query')) {\n const webgpuTSQuerySet = props.timestampQuerySet as WebGPUQuerySet;\n renderPassDescriptor.timestampWrites = webgpuTSQuerySet\n ? ({\n querySet: webgpuTSQuerySet.handle,\n beginningOfPassWriteIndex: props.beginTimestampIndex,\n endOfPassWriteIndex: props.endTimestampIndex\n } as GPUComputePassTimestampWrites)\n : undefined;\n }\n\n if (!device.commandEncoder) {\n throw new Error('commandEncoder not available');\n }\n\n this.device.handle.pushErrorScope('validation');\n this.handle = this.props.handle || device.commandEncoder.beginRenderPass(renderPassDescriptor);\n this.device.handle.popErrorScope().then((error: GPUError | null) => {\n if (error) {\n log.error(`${this} creation failed:\\n\"${error.message}\"`, this)();\n }\n });\n this.handle.label = this.props.id;\n log.groupCollapsed(3, `new WebGPURenderPass(${this.id})`)();\n log.probe(3, JSON.stringify(renderPassDescriptor, null, 2))();\n log.groupEnd(3)();\n }\n\n override destroy(): void {}\n\n end(): void {\n this.handle.end();\n }\n\n setPipeline(pipeline: RenderPipeline): void {\n this.pipeline = pipeline as WebGPURenderPipeline;\n this.handle.setPipeline(this.pipeline.handle);\n }\n\n /** Sets an array of bindings (uniform buffers, samplers, textures, ...) */\n setBindings(bindings: Record<string, Binding>): void {\n this.pipeline?.setBindings(bindings);\n const bindGroup = this.pipeline?._getBindGroup();\n if (bindGroup) {\n this.handle.setBindGroup(0, bindGroup);\n }\n }\n\n setIndexBuffer(\n buffer: Buffer,\n indexFormat: GPUIndexFormat,\n offset: number = 0,\n size?: number\n ): void {\n this.handle.setIndexBuffer((buffer as WebGPUBuffer).handle, indexFormat, offset, size);\n }\n\n setVertexBuffer(slot: number, buffer: Buffer, offset: number = 0): void {\n this.handle.setVertexBuffer(slot, (buffer as WebGPUBuffer).handle, offset);\n }\n\n draw(options: {\n vertexCount?: number;\n indexCount?: number;\n instanceCount?: number;\n firstVertex?: number;\n firstIndex?: number;\n firstInstance?: number;\n baseVertex?: number;\n }): void {\n if (options.indexCount) {\n this.handle.drawIndexed(\n options.indexCount,\n options.instanceCount,\n options.firstIndex,\n options.baseVertex,\n options.firstInstance\n );\n } else {\n this.handle.draw(\n options.vertexCount || 0,\n options.instanceCount || 1,\n options.firstIndex,\n options.firstInstance\n );\n }\n }\n\n drawIndirect(): void {\n // drawIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): void;\n // drawIndexedIndirect(indirectBuffer: GPUBuffer, indirectOffset: number): void;\n }\n\n setParameters(parameters: RenderPassParameters): void {\n const {blendConstant, stencilReference, scissorRect, viewport} = parameters;\n if (blendConstant) {\n this.handle.setBlendConstant(blendConstant);\n }\n if (stencilReference) {\n this.handle.setStencilReference(stencilReference);\n }\n if (scissorRect) {\n this.handle.setScissorRect(scissorRect[0], scissorRect[1], scissorRect[2], scissorRect[3]);\n }\n // TODO - explain how 3 dimensions vs 2 in WebGL works.\n if (viewport) {\n this.handle.setViewport(\n viewport[0],\n viewport[1],\n viewport[2],\n viewport[3],\n viewport[4] as any,\n viewport[5] as any\n );\n }\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 beginOcclusionQuery(queryIndex: number): void {\n this.handle.beginOcclusionQuery(queryIndex);\n }\n endOcclusionQuery(): void {\n this.handle.endOcclusionQuery();\n }\n\n // executeBundles(bundles: Iterable<GPURenderBundle>): void;\n\n // INTERNAL\n\n /**\n * Partial render pass descriptor. Used by WebGPURenderPass.\n * @returns attachments fields of a renderpass descriptor.\n */\n protected getRenderPassDescriptor(framebuffer: WebGPUFramebuffer): GPURenderPassDescriptor {\n const renderPassDescriptor: GPURenderPassDescriptor = {\n colorAttachments: []\n };\n\n renderPassDescriptor.colorAttachments = framebuffer.colorAttachments.map(\n (colorAttachment, index) => ({\n // clear values\n loadOp: this.props.clearColor !== false ? 'clear' : 'load',\n clearValue: convertColor(\n this.props.clearColors?.[index] || this.props.clearColor || RenderPass.defaultClearColor\n ),\n storeOp: this.props.discard ? 'discard' : 'store',\n // ...colorAttachment,\n view: colorAttachment.handle\n })\n );\n\n if (framebuffer.depthStencilAttachment) {\n renderPassDescriptor.depthStencilAttachment = {\n view: framebuffer.depthStencilAttachment.handle\n };\n const {depthStencilAttachment} = renderPassDescriptor;\n\n // DEPTH\n if (this.props.depthReadOnly) {\n depthStencilAttachment.depthReadOnly = true;\n }\n if (this.props.clearDepth !== false) {\n depthStencilAttachment.depthClearValue = this.props.clearDepth;\n }\n // STENCIL\n // if (this.props.clearStencil !== false) {\n // depthStencilAttachment.stencilClearValue = this.props.clearStencil;\n // }\n\n // WebGPU only wants us to set these parameters if the texture format actually has a depth aspect\n const hasDepthAspect = true;\n if (hasDepthAspect) {\n depthStencilAttachment.depthLoadOp = this.props.clearDepth !== false ? 'clear' : 'load';\n depthStencilAttachment.depthStoreOp = 'store'; // TODO - support 'discard'?\n }\n\n // WebGPU only wants us to set these parameters if the texture format actually has a stencil aspect\n const hasStencilAspect = false;\n if (hasStencilAspect) {\n depthStencilAttachment.stencilLoadOp = this.props.clearStencil !== false ? 'clear' : 'load';\n depthStencilAttachment.stencilStoreOp = 'store'; // TODO - support 'discard'?\n }\n }\n\n return renderPassDescriptor;\n }\n}\n\nfunction convertColor(color: TypedArray | NumberArray4): GPUColor {\n return {r: color[0], g: color[1], b: color[2], a: color[3]};\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {ComputePass, ComputePassProps, ComputePipeline, Buffer, Binding} from '@luma.gl/core';\nimport {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUBuffer} from './webgpu-buffer';\nimport {WebGPUComputePipeline} from './webgpu-compute-pipeline';\nimport {WebGPUQuerySet} from './webgpu-query-set';\n\nexport class WebGPUComputePass extends ComputePass {\n readonly device: WebGPUDevice;\n readonly handle: GPUComputePassEncoder;\n\n _webgpuPipeline: WebGPUComputePipeline | null = null;\n\n constructor(device: WebGPUDevice, props: ComputePassProps) {\n super(device, props);\n this.device = device;\n\n // Set up queries\n let timestampWrites: GPUComputePassTimestampWrites | undefined;\n if (device.features.has('timestamp-query')) {\n const webgpuQuerySet = props.timestampQuerySet as WebGPUQuerySet;\n if (webgpuQuerySet) {\n timestampWrites = {\n querySet: webgpuQuerySet.handle,\n beginningOfPassWriteIndex: props.beginTimestampIndex,\n endOfPassWriteIndex: props.endTimestampIndex\n };\n }\n }\n\n this.handle =\n this.props.handle ||\n device.commandEncoder?.beginComputePass({\n label: this.props.id,\n timestampWrites\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._webgpuPipeline = wgpuPipeline;\n this.setBindings([]);\n }\n\n /**\n * Sets an array of bindings (uniform buffers, samplers, textures, ...)\n * TODO - still some API confusion - does this method go here or on the pipeline?\n */\n setBindings(bindings: Binding[]): void {\n // @ts-expect-error\n const bindGroup = this._webgpuPipeline._getBindGroup();\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 work groups to dispatch.\n * @param y Y dimension of the grid of work groups to dispatch.\n * @param z Z dimension of the grid of work groups 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 *\n * 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 indirectBuffer\n * @param indirectOffset offset in buffer to the beginning of the dispatch data.\n */\n dispatchIndirect(indirectBuffer: Buffer, indirectByteOffset: number = 0): void {\n const webgpuBuffer = indirectBuffer as WebGPUBuffer;\n this.handle.dispatchWorkgroupsIndirect(webgpuBuffer.handle, indirectByteOffset);\n }\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", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {Device, Buffer, VertexArrayProps, RenderPass} from '@luma.gl/core';\nimport {VertexArray, log} from '@luma.gl/core';\nimport {getBrowser} from '@probe.gl/env';\n\nimport {WebGPUDevice} from '../webgpu-device';\nimport {WebGPUBuffer} from '../resources/webgpu-buffer';\n\nimport {WebGPURenderPass} from './webgpu-render-pass';\n\n/** VertexArrayObject wrapper */\nexport class WebGPUVertexArray extends VertexArray {\n override get [Symbol.toStringTag](): string {\n return 'WebGPUVertexArray';\n }\n\n readonly device: WebGPUDevice;\n /** Vertex Array is a helper class under WebGPU */\n readonly handle: never;\n\n // Create a VertexArray\n constructor(device: WebGPUDevice, props: VertexArrayProps) {\n super(device, props);\n this.device = device;\n }\n\n override destroy(): void {}\n\n /**\n * Set an elements buffer, for indexed rendering.\n * Must be a Buffer bound to buffer with usage bit Buffer.INDEX set.\n */\n setIndexBuffer(buffer: Buffer | null): void {\n // assert(!elementBuffer || elementBuffer.glTarget === GL.ELEMENT_ARRAY_BUFFER, ERR_ELEMENTS);\n this.indexBuffer = buffer;\n }\n\n /** Set a bufferSlot in vertex attributes array to a buffer, enables the bufferSlot, sets divisor */\n setBuffer(bufferSlot: number, buffer: Buffer): void {\n // Sanity check target\n // if (buffer.glUsage === GL.ELEMENT_ARRAY_BUFFER) {\n // throw new Error('Use setIndexBuffer');\n // }\n\n this.attributes[bufferSlot] = buffer;\n }\n\n override bindBeforeRender(\n renderPass: RenderPass,\n firstIndex?: number,\n indexCount?: number\n ): void {\n const webgpuRenderPass = renderPass as WebGPURenderPass;\n const webgpuIndexBuffer = this.indexBuffer as WebGPUBuffer;\n if (webgpuIndexBuffer?.handle) {\n // Note we can't unset an index buffer\n log.info(\n 3,\n 'setting index buffer',\n webgpuIndexBuffer?.handle,\n webgpuIndexBuffer?.indexType\n )();\n webgpuRenderPass.handle.setIndexBuffer(\n webgpuIndexBuffer?.handle,\n // @ts-expect-error TODO - we must enforce type\n webgpuIndexBuffer?.indexType\n );\n }\n for (let location = 0; location < this.maxVertexAttributes; location++) {\n const webgpuBuffer = this.attributes[location] as WebGPUBuffer;\n if (webgpuBuffer?.handle) {\n log.info(3, `setting vertex buffer ${location}`, webgpuBuffer?.handle)();\n webgpuRenderPass.handle.setVertexBuffer(location, webgpuBuffer?.handle);\n }\n }\n // TODO - emit warnings/errors/throw if constants have been set on this vertex array\n }\n\n override unbindAfterRender(renderPass: RenderPass): void {\n // On WebGPU we don't need to unbind.\n // In fact we can't easily do it. setIndexBuffer/setVertexBuffer don't accept null.\n // Unbinding presumably happens automatically when the render pass is ended.\n }\n\n // DEPRECATED METHODS\n\n /**\n * @deprecated is this even an issue for WebGPU?\n * Attribute 0 can not be disable on most desktop OpenGL based browsers\n */\n static isConstantAttributeZeroSupported(device: Device): boolean {\n return getBrowser() === 'Chrome';\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\n// / <reference types=\"@webgpu/types\" />\n\nimport type {Texture, TextureFormat, CanvasContextProps} from '@luma.gl/core';\nimport {CanvasContext, log} from '@luma.gl/core';\nimport {getWebGPUTextureFormat} from './helpers/convert-texture-format';\nimport {WebGPUDevice} from './webgpu-device';\nimport {WebGPUFramebuffer} from './resources/webgpu-framebuffer';\nimport {WebGPUTexture} from './resources/webgpu-texture';\n\n/**\n * Holds a WebGPU Canvas Context\n * The primary job of the CanvasContext is to generate textures for rendering into the current canvas\n * It also manages canvas sizing calculations and resizing.\n */\nexport class WebGPUCanvasContext extends CanvasContext {\n readonly device: WebGPUDevice;\n readonly gpuCanvasContext: GPUCanvasContext;\n /** Format of returned textures: \"bgra8unorm\", \"rgba8unorm\", \"rgba16float\". */\n readonly format: TextureFormat = navigator.gpu.getPreferredCanvasFormat() as TextureFormat;\n /** Default stencil format for depth textures */\n readonly depthStencilFormat: TextureFormat = 'depth24plus';\n\n private depthStencilAttachment: Texture | null = null;\n\n get [Symbol.toStringTag](): string {\n return 'WebGPUCanvasContext';\n }\n\n constructor(device: WebGPUDevice, adapter: GPUAdapter, props: CanvasContextProps) {\n super(props);\n this.device = device;\n // TODO - ugly hack to trigger first resize\n this.width = -1;\n this.height = -1;\n\n this._setAutoCreatedCanvasId(`${this.device.id}-canvas`);\n // @ts-ignore TODO - we don't handle OffscreenRenderingContext.\n this.gpuCanvasContext = this.canvas.getContext('webgpu');\n // TODO this has been replaced\n // this.format = this.gpuCanvasContext.getPreferredFormat(adapter);\n this.format = 'bgra8unorm';\n }\n\n /** Destroy any textures produced while configured and remove the context configuration. */\n destroy(): void {\n this.gpuCanvasContext.unconfigure();\n }\n\n /** Update framebuffer with properly resized \"swap chain\" texture views */\n getCurrentFramebuffer(): WebGPUFramebuffer {\n // Ensure the canvas context size is updated\n this.update();\n\n // Wrap the current canvas context texture in a luma.gl texture\n // const currentColorAttachment = this.device.createTexture({\n // id: 'default-render-target',\n // handle: this.gpuCanvasContext.getCurrentTexture(),\n // format: this.format,\n // width: this.width,\n // height: this.height\n // });\n\n // Wrap the current canvas context texture in a luma.gl texture\n const currentColorAttachment = this.getCurrentTexture();\n this.width = currentColorAttachment.width;\n this.height = currentColorAttachment.height;\n\n // Resize the depth stencil attachment\n this._createDepthStencilAttachment();\n\n return new WebGPUFramebuffer(this.device, {\n colorAttachments: [currentColorAttachment],\n depthStencilAttachment: this.depthStencilAttachment\n });\n }\n\n /** Resizes and updates render targets if necessary */\n update() {\n const oldWidth = this.width;\n const oldHeight = this.height;\n const [newWidth, newHeight] = this.getPixelSize();\n\n const sizeChanged = newWidth !== oldWidth || newHeight !== oldHeight;\n\n if (sizeChanged) {\n this.width = newWidth;\n this.height = newHeight;\n\n if (this.depthStencilAttachment) {\n this.depthStencilAttachment.destroy();\n this.depthStencilAttachment = null;\n }\n\n // Reconfigure the canvas size.\n // https://www.w3.org/TR/webgpu/#canvas-configuration\n this.gpuCanvasContext.configure({\n device: this.device.handle,\n format: getWebGPUTextureFormat(this.format),\n // Can be used to define e.g. -srgb views\n // viewFormats: [...]\n colorSpace: this.props.colorSpace,\n alphaMode: this.props.alphaMode\n });\n\n log.log(1, `${this} Resized ${oldWidth}x${oldHeight} => ${newWidth}x${newHeight}px`)();\n }\n }\n\n resize(options?: {width?: number; height?: number; useDevicePixels?: boolean | number}): void {\n this.update();\n\n if (!this.device.handle) return;\n\n // Resize browser context .\n if (this.canvas) {\n const devicePixelRatio = this.getDevicePixelRatio(options?.useDevicePixels);\n this.setDevicePixelRatio(devicePixelRatio, options);\n return;\n }\n }\n\n /** Wrap the current canvas context texture in a luma.gl texture */\n getCurrentTexture(): WebGPUTexture {\n return this.device.createTexture({\n id: `${this.id}#color-texture`,\n handle: this.gpuCanvasContext.getCurrentTexture(),\n format: this.format\n });\n }\n\n /** We build render targets on demand (i.e. not when size changes but when about to render) */\n _createDepthStencilAttachment() {\n if (!this.depthStencilAttachment) {\n this.depthStencilAttachment = this.device.createTexture({\n id: `${this.id}#depth-stencil-texture`,\n format: this.depthStencilFormat,\n width: this.width,\n height: this.height,\n usage: GPUTextureUsage.RENDER_ATTACHMENT\n });\n }\n return this.depthStencilAttachment;\n }\n}\n", "// luma.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {QuerySet, QuerySetProps} from '@luma.gl/core';\nimport {WebGPUDevice} from '../webgpu-device';\n\nexport type QuerySetProps2 = {\n type: 'occlusion' | 'timestamp';\n count: number;\n};\n\n/**\n * Immutable\n */\nexport class WebGPUQuerySet extends QuerySet {\n readonly device: WebGPUDevice;\n readonly handle: GPUQuerySet;\n\n constructor(device: WebGPUDevice, props: QuerySetProps) {\n super(device, props);\n this.device = device;\n this.handle =\n this.props.handle ||\n this.device.handle.createQuerySet({\n type: this.props.type,\n count: this.props.count\n });\n this.handle.label = this.props.id;\n }\n\n override destroy(): void {\n this.handle?.destroy();\n // @ts-expect-error readonly\n this.handle = null;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;ACIA,IAAAA,gBAAwC;;;AC4BxC,IAAAC,gBAAqC;;;AC5BrC,kBAAkC;AAGlC,SAAS,cAAc,OAAkB;AAPzC;AAQE,SAAO,MAAM,gBAAc,WAAM,SAAN,mBAAY,eAAc;AACvD;AAEM,IAAO,eAAP,cAA4B,mBAAM;EAC7B;EACA;EACA;EAET,YAAY,QAAsB,OAAkB;AAClD,UAAM,QAAQ,KAAK;AACnB,SAAK,SAAS;AAEd,SAAK,aAAa,cAAc,KAAK;AACrC,UAAM,YAAY,QAAQ,MAAM,IAAI;AAGpC,UAAM,OAAO,KAAK,KAAK,KAAK,aAAa,CAAC,IAAI;AAE9C,SAAK,SACH,KAAK,MAAM,UACX,KAAK,OAAO,OAAO,aAAa;MAC9B;;MAEA,OAAO,KAAK,MAAM,SAAS,eAAe,SAAS,eAAe;MAClE,kBAAkB,KAAK,MAAM,oBAAoB;MACjD,OAAO,KAAK,MAAM;KACnB;AAEH,QAAI,MAAM,MAAM;AACd,WAAK,aAAa,MAAM,IAAI;IAE9B;AAEA,QAAI,aAAa,CAAC,MAAM,kBAAkB;AACxC,WAAK,OAAO,MAAK;IACnB;EACF;EAES,UAAO;AA9ClB;AA+CI,eAAK,WAAL,mBAAa;AAEb,SAAK,SAAS;EAChB;;EAGS,MAAM,MAAuB,aAAa,GAAC;AAClD,SAAK,OAAO,OAAO,MAAM,YACvB,KAAK,QACL,YACA,KAAK,QACL,KAAK,YACL,KAAK,UAAU;EAEnB;EAES,MAAM,UACb,aAAqB,GACrB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mBAAmB;AAE3B,uBAAiB,KAAK,GAAI,MAAM,KAAK,QAAQ,QAAQ,CAAsB;AAI3E,YAAM,SAAS,OAAO,KAAK,QAAQ,MAAM,EAAE,OACzC,SAAO,CAAC,CAAC,mBAAmB,iBAAiB,EAAE,SAAS,GAAG,CAAC;AAE9D,iBAAW,OAAO,QAAQ;AACxB,cAAM,QAAQ;AACd,cAAM,QAAQ,QAAQ,OAAO,KAAK;AAClC,YAAI,OAAO,UAAU,UAAU;AAC7B,yBAAe,KAAK,IAAI;QAC1B;MACF;IACF;AAEA,UAAM,YAAY,MAAM,QAAQ,cAAc;MAC5C;MACA;KACD;AAED,sBAAI,MAAM,GAAG,qBAAqB,EAAC;AAEnC,UAAM,SAAS,IAAI,aAAa,OAAO,WAAW,SAAS,WAAW;AAEtE,sBAAI,MACF,GACA,qFAAqF,EACtF;AACD,sBAAI,MAAM,GAAG,OAAO,IAAI,EAAC;AACzB,sBAAI,SAAS,CAAC,EAAC;AACf,WAAO;EACT;EAEA,MAAM,OAAO,QAAiB;AAC5B,UAAM,IAAI,MAAM,wCAAwC;EAC1D;;AAGK,IAAM,gBAAgB,IAAI,cAAa;",
|
|
6
|
+
"names": ["import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core", "import_core"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luma.gl/webgpu",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.4",
|
|
4
4
|
"description": "WebGPU adapter for the luma.gl core API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"@probe.gl/env": "^4.0.8",
|
|
44
44
|
"@webgpu/types": "^0.1.34"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "553efa111ddb2709b2278d1e3f6c83cb66a36052"
|
|
47
47
|
}
|