@luma.gl/webgl 9.0.0-alpha.20 → 9.0.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/converters/device-parameters.js +1 -1
- package/dist/adapter/converters/device-parameters.js.map +1 -1
- package/dist/adapter/converters/renderbuffer-formats.d.ts +2 -2
- package/dist/adapter/converters/renderbuffer-formats.d.ts.map +1 -1
- package/dist/adapter/converters/renderbuffer-formats.js +1 -2
- package/dist/adapter/converters/renderbuffer-formats.js.map +1 -1
- package/dist/adapter/helpers/get-shader-layout.js +1 -1
- package/dist/adapter/helpers/get-shader-layout.js.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.d.ts +3 -3
- package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.js +2 -2
- package/dist/adapter/objects/webgl-renderbuffer.js.map +1 -1
- package/dist/adapter/objects/webgl-resource.d.ts +2 -2
- package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-resource.js +2 -2
- package/dist/adapter/objects/webgl-resource.js.map +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.d.ts +6 -6
- package/dist/adapter/objects/webgl-vertex-array-object.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.js +2 -2
- package/dist/adapter/objects/webgl-vertex-array-object.js.map +1 -1
- package/dist/adapter/resources/webgl-buffer.d.ts +2 -2
- package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-buffer.js +1 -1
- package/dist/adapter/resources/webgl-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.d.ts +2 -2
- package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.d.ts +3 -3
- package/dist/adapter/resources/webgl-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.js +2 -2
- package/dist/adapter/resources/webgl-command-encoder.js.map +1 -1
- package/dist/adapter/resources/webgl-external-texture.js.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.d.ts +16 -16
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +10 -10
- package/dist/adapter/resources/webgl-framebuffer.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.d.ts +2 -2
- package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.js +1 -1
- package/dist/adapter/resources/webgl-render-pass.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.d.ts +4 -4
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +4 -4
- package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
- package/dist/adapter/resources/webgl-sampler.d.ts +2 -2
- package/dist/adapter/resources/webgl-sampler.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-sampler.js +1 -1
- package/dist/adapter/resources/webgl-sampler.js.map +1 -1
- package/dist/adapter/resources/webgl-shader.d.ts +2 -2
- package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-shader.js +1 -1
- package/dist/adapter/resources/webgl-shader.js.map +1 -1
- package/dist/adapter/resources/webgl-texture.d.ts +3 -3
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +3 -3
- package/dist/adapter/resources/webgl-texture.js.map +1 -1
- package/dist/adapter/webgl-canvas-context.d.ts +3 -3
- package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgl-canvas-context.js +2 -2
- package/dist/adapter/webgl-canvas-context.js.map +1 -1
- package/dist/adapter/webgl-device.d.ts +9 -9
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +9 -9
- package/dist/adapter/webgl-device.js.map +1 -1
- package/dist/classic/accessor.d.ts +1 -1
- package/dist/classic/accessor.d.ts.map +1 -1
- package/dist/classic/accessor.js +1 -1
- package/dist/classic/accessor.js.map +1 -1
- package/dist/classic/buffer.d.ts +3 -3
- package/dist/classic/buffer.d.ts.map +1 -1
- package/dist/classic/buffer.js +4 -4
- package/dist/classic/buffer.js.map +1 -1
- package/dist/context/parameters/unified-parameter-api.js +1 -1
- package/dist/context/parameters/unified-parameter-api.js.map +1 -1
- package/dist/context/state-tracker/with-parameters.js +1 -1
- package/dist/context/state-tracker/with-parameters.js.map +1 -1
- package/dist/dist.dev.js +5 -6
- package/dist/index.cjs +3 -3
- package/dist/index.d.ts +15 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/dist.min.js +21 -21
- package/package.json +4 -4
- package/src/.DS_Store +0 -0
- package/src/adapter/.DS_Store +0 -0
- package/src/adapter/converters/device-parameters.ts +1 -1
- package/src/adapter/converters/renderbuffer-formats.ts +1 -3
- package/src/adapter/helpers/get-shader-layout.ts +1 -1
- package/src/adapter/objects/webgl-renderbuffer.ts +3 -3
- package/src/adapter/objects/webgl-resource.ts +2 -2
- package/src/adapter/objects/webgl-vertex-array-object.ts +6 -6
- package/src/adapter/resources/webgl-buffer.ts +2 -2
- package/src/adapter/resources/webgl-command-buffer.ts +3 -3
- package/src/adapter/resources/webgl-command-encoder.ts +3 -3
- package/src/adapter/resources/webgl-external-texture.ts +1 -1
- package/src/adapter/resources/webgl-framebuffer.ts +24 -24
- package/src/adapter/resources/webgl-render-pass.ts +2 -2
- package/src/adapter/resources/webgl-render-pipeline.ts +6 -6
- package/src/adapter/resources/webgl-sampler.ts +2 -2
- package/src/adapter/resources/webgl-shader.ts +2 -2
- package/src/adapter/resources/webgl-texture.ts +4 -4
- package/src/adapter/webgl-canvas-context.ts +3 -3
- package/src/adapter/webgl-device.ts +10 -10
- package/src/classic/accessor.ts +1 -1
- package/src/classic/buffer.ts +4 -4
- package/src/context/.DS_Store +0 -0
- package/src/context/parameters/unified-parameter-api.ts +1 -1
- package/src/context/state-tracker/with-parameters.ts +1 -1
- package/src/index.ts +18 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-vertex-array-object.js","names":["assert","GL","getBrowser","WebGLResource","ERR_ELEMENTS","WEBGLVertexArrayObject","Symbol","toStringTag","constructor","device","props","_createHandle","gl2","createVertexArray","_deleteHandle","deleteVertexArray","handle","elements","_bindHandle","bindVertexArray","setElementBuffer","elementBuffer","arguments","length","undefined","opts","target","ELEMENT_ARRAY_BUFFER","bind","gl","bindBuffer","setBuffer","location","buffer","accessor","size","type","stride","offset","normalized","integer","divisor","Number","ARRAY_BUFFER","assertWebGL2","vertexAttribIPointer","vertexAttribPointer","enableVertexAttribArray","vertexAttribDivisor","enable","canDisableAttributeZero","isWebGL2","canDisableAttribute","disableVertexAttribArray"],"sources":["../../../src/adapter/objects/webgl-vertex-array-object.ts"],"sourcesContent":["import {assert, ResourceProps} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport {getBrowser} from '@probe.gl/env';\n\nimport WebGLDevice from '../webgl-device';\nimport WebGLResource from './webgl-resource';\n\nimport
|
|
1
|
+
{"version":3,"file":"webgl-vertex-array-object.js","names":["assert","GL","getBrowser","WebGLResource","ERR_ELEMENTS","WEBGLVertexArrayObject","Symbol","toStringTag","constructor","device","props","_createHandle","gl2","createVertexArray","_deleteHandle","deleteVertexArray","handle","elements","_bindHandle","bindVertexArray","setElementBuffer","elementBuffer","arguments","length","undefined","opts","target","ELEMENT_ARRAY_BUFFER","bind","gl","bindBuffer","setBuffer","location","buffer","accessor","size","type","stride","offset","normalized","integer","divisor","Number","ARRAY_BUFFER","assertWebGL2","vertexAttribIPointer","vertexAttribPointer","enableVertexAttribArray","vertexAttribDivisor","enable","canDisableAttributeZero","isWebGL2","canDisableAttribute","disableVertexAttribArray"],"sources":["../../../src/adapter/objects/webgl-vertex-array-object.ts"],"sourcesContent":["import {assert, ResourceProps} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport {getBrowser} from '@probe.gl/env';\n\nimport {WebGLDevice} from '../webgl-device';\nimport {WebGLResource} from './webgl-resource';\n\nimport {WEBGLBuffer} from '../resources/webgl-buffer';\n\nconst ERR_ELEMENTS = 'elements must be GL.ELEMENT_ARRAY_BUFFER';\n\n/**\n * VertexArrayObject properties\n */\nexport type VertexArrayObjectProps = ResourceProps & {\n};\n\n/** VertexArrayObject wrapper */\nexport class WEBGLVertexArrayObject extends WebGLResource<VertexArrayObjectProps> {\n override get [Symbol.toStringTag](): string {\n return 'BaseVertexArrayObject';\n }\n\n constructor(device: WebGLDevice, props?: VertexArrayObjectProps) {\n // @ts-expect-error\n super(device, props, {});\n }\n\n override _createHandle() {\n return this.gl2.createVertexArray();\n }\n\n override _deleteHandle(): void {\n this.gl2.deleteVertexArray(this.handle);\n // @ts-expect-error\n return [this.elements];\n // return [this.elements, ...this.buffers];\n }\n\n override _bindHandle(handle: WEBGLVertexArrayObject): void {\n this.gl2.bindVertexArray(handle);\n }\n\n // Set (bind) an elements buffer, for indexed rendering.\n // Must be a Buffer bound to GL.ELEMENT_ARRAY_BUFFER. Constants not supported\n setElementBuffer(elementBuffer: WEBGLBuffer | null = null, opts = {}) {\n assert(!elementBuffer || elementBuffer.target === GL.ELEMENT_ARRAY_BUFFER, ERR_ELEMENTS);\n\n // The GL.ELEMENT_ARRAY_BUFFER_BINDING is stored on the VertexArrayObject...\n this.bind(() => {\n this.gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, elementBuffer ? elementBuffer.handle : null);\n });\n\n return this;\n }\n\n /** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */\n setBuffer(location: number, buffer: WEBGLBuffer, accessor: any): this {\n // Check target\n if (buffer.target === GL.ELEMENT_ARRAY_BUFFER) {\n return this.setElementBuffer(buffer, accessor);\n }\n\n const {size, type, stride, offset, normalized, integer, divisor} = accessor;\n\n const {gl, gl2} = this;\n location = Number(location);\n\n this.bind(() => {\n // A non-zero buffer object must be bound to the GL_ARRAY_BUFFER target\n gl.bindBuffer(gl.ARRAY_BUFFER, buffer.handle);\n\n // WebGL2 supports *integer* data formats, i.e. GPU will see integer values\n if (integer) {\n this.device.assertWebGL2();\n gl2.vertexAttribIPointer(location, size, type, stride, offset);\n } else {\n // Attaches ARRAY_BUFFER with specified buffer format to location\n gl.vertexAttribPointer(location, size, type, normalized, stride, offset);\n }\n gl.enableVertexAttribArray(location);\n gl2.vertexAttribDivisor(location, divisor || 0);\n\n // NOTE We don't unbind buffer here, typically another buffer will be bound just after\n });\n\n return this;\n }\n\n /**\n * Enabling an attribute location makes it reference the currently bound buffer\n * Disabling an attribute location makes it reference the global constant value\n * TODO - handle single values for size 1 attributes?\n * TODO - convert classic arrays based on known type?\n */\n enable(location: number, enable = true): this {\n // Attribute 0 cannot be disabled in most desktop OpenGL based browsers...\n const canDisableAttributeZero = this.device.isWebGL2 || getBrowser() === 'Chrome';\n const canDisableAttribute = canDisableAttributeZero || location !== 0;\n\n if (enable || canDisableAttribute) {\n location = Number(location);\n this.bind(() =>\n enable\n ? this.gl.enableVertexAttribArray(location)\n : this.gl.disableVertexAttribArray(location)\n );\n }\n return this;\n }\n}\n"],"mappings":"AAAA,SAAQA,MAAM,QAAsB,cAAc;AAClD,OAAOC,EAAE,MAAM,oBAAoB;AACnC,SAAQC,UAAU,QAAO,eAAe;AAAC,SAGjCC,aAAa;AAIrB,MAAMC,YAAY,GAAG,0CAA0C;AAS/D,OAAO,MAAMC,sBAAsB,SAASF,aAAa,CAAyB;EAChF,KAAcG,MAAM,CAACC,WAAW,IAAY;IAC1C,OAAO,uBAAuB;EAChC;EAEAC,WAAWA,CAACC,MAAmB,EAAEC,KAA8B,EAAE;IAE/D,KAAK,CAACD,MAAM,EAAEC,KAAK,EAAE,CAAC,CAA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,CAAC,CAC/C;IACH;IACA,OAAO,IAAI;EACb;AACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { BufferProps } from '@luma.gl/api';
|
|
2
2
|
import { Buffer } from '@luma.gl/api';
|
|
3
|
-
import WebGLDevice from '../webgl-device';
|
|
3
|
+
import { WebGLDevice } from '../webgl-device';
|
|
4
4
|
/** WebGL Buffer interface */
|
|
5
|
-
export
|
|
5
|
+
export declare class WEBGLBuffer extends Buffer {
|
|
6
6
|
readonly device: WebGLDevice;
|
|
7
7
|
readonly gl: WebGLRenderingContext;
|
|
8
8
|
readonly gl2: WebGL2RenderingContext | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-buffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,MAAM,EAAS,MAAM,cAAc,CAAC;AAE5C,OAAO,WAAW,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"webgl-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-buffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,MAAM,EAAS,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAI5C,6BAA6B;AAC7B,qBAAa,WAAY,SAAQ,MAAM;IACrC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,EAAE,EAAE,qBAAqB,CAAC;IACnC,QAAQ,CAAC,GAAG,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,WAAW,GAAG,IAAI,CAAQ;IAErC,UAAU,EAAE,MAAM,CAAC;gBAKP,MAAM,EAAE,WAAW,EAAE,KAAK,GAAE,WAAgB;IAoCxD,aAAa,CAAC,IAAI,KAAA,EAAE,UAAU,GAAE,MAAU,EAAE,UAAU,GAAE,MAAqC,GAAG,IAAI;IAmBpG,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAwBpC,OAAO,IAAI,IAAI;IAUf,KAAK,CAAC,IAAI,EAAE,eAAe,EAAE,UAAU,GAAE,MAAU,GAAG,IAAI;IAuBnE,gCAAgC;IACjB,SAAS,CACtB,UAAU,GAAE,MAAU,EACtB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,WAAW,CAAC;IAmBvB,oBAAoB;IAIpB,eAAe;IAKf,cAAc;CAIf"}
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
2
2
|
import { Buffer, assert } from '@luma.gl/api';
|
|
3
3
|
import GL from '@luma.gl/constants';
|
|
4
4
|
const DEBUG_DATA_LENGTH = 10;
|
|
5
|
-
export
|
|
5
|
+
export class WEBGLBuffer extends Buffer {
|
|
6
6
|
constructor(device) {
|
|
7
7
|
let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8
8
|
super(device, props);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-buffer.js","names":["Buffer","assert","GL","DEBUG_DATA_LENGTH","WEBGLBuffer","constructor","device","props","arguments","length","undefined","_defineProperty","gl","gl2","handle","createBuffer","setSpectorMetadata","data","target","getWebGLTarget","usage","webglUsage","getWebGLUsage","debugData","_initWithData","byteOffset","byteLength","_initWithByteLength","ArrayBuffer","isView","_getWriteTarget","bindBuffer","bufferData","bufferSubData","slice","bytesUsed","trackAllocatedMemory","Float32Array","destroy","destroyed","removeStats","trackDeallocatedMemory","deleteBuffer","write","srcOffset","isWebGL2","COPY_WRITE_BUFFER","assertWebGL2","readAsync","Uint8Array","dstOffset","COPY_READ_BUFFER","getBufferSubData","_invalidateDebugData","_getReadTarget","INDEX","ELEMENT_ARRAY_BUFFER","VERTEX","ARRAY_BUFFER","UNIFORM","UNIFORM_BUFFER","STATIC_DRAW","DYNAMIC_DRAW"],"sources":["../../../src/adapter/resources/webgl-buffer.ts"],"sourcesContent":["import type {BufferProps} from '@luma.gl/api';\nimport {Buffer, assert} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport WebGLDevice from '../webgl-device';\n\nconst DEBUG_DATA_LENGTH = 10;\n\n/** WebGL Buffer interface */\nexport default class WEBGLBuffer extends Buffer {\n readonly device: WebGLDevice;\n readonly gl: WebGLRenderingContext;\n readonly gl2: WebGL2RenderingContext | null;\n readonly handle: WebGLBuffer;\n readonly target: number;\n\n byteLength: number;\n bytesUsed: number;\n debugData: ArrayBuffer | null = null;\n\n webglUsage: number;\n\n // accessor: {};\n\n \n constructor(device: WebGLDevice, props: BufferProps = {}) {\n super(device, props);\n\n this.device = device;\n this.gl = this.device.gl;\n this.gl2 = this.device.gl2;\n\n const handle = typeof props === 'object' ? (props ).handle : undefined;\n this.handle = handle || this.gl.createBuffer();\n device.setSpectorMetadata(this.handle, {...this.props, data: typeof this.props.data});\n\n // In WebGL1, need to make sure we use GL.ELEMENT_ARRAY_BUFFER when initializing element buffers\n // otherwise buffer type will lock to generic (non-element) buffer\n // In WebGL2, we can use GL.COPY_READ_BUFFER which avoids locking the type here\n // @ts-expect-error Hack - Checking for subclass prop\n this.target = this.props.target || getWebGLTarget(this.props.usage);\n // @ts-expect-error Hack - Checking for subclass prop\n this.webglUsage = this.props.webglUsage || getWebGLUsage(this.props.usage);\n this.debugData = null;\n\n // Set data: (re)initializes the buffer\n if (props.data) {\n this._initWithData(props.data, props.byteOffset, props.byteLength);\n } else {\n this._initWithByteLength(props.byteLength || 0);\n }\n\n // Deprecated: Merge main props and accessor\n // this.accessor = {...props.accessor};\n\n // Object.seal(this);\n }\n\n // PRIVATE METHODS\n\n // Allocate a new buffer and initialize to contents of typed array\n _initWithData(data, byteOffset: number = 0, byteLength: number = data.byteLength + byteOffset): this {\n assert(ArrayBuffer.isView(data));\n\n const target = this._getWriteTarget();\n\n this.gl.bindBuffer(target, this.handle);\n this.gl.bufferData(target, byteLength, this.webglUsage);\n this.gl.bufferSubData(target, byteOffset, data);\n this.gl.bindBuffer(target, null);\n\n this.debugData = data.slice(0, DEBUG_DATA_LENGTH);\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n this.trackAllocatedMemory(byteLength);\n\n return this;\n }\n\n // Allocate a GPU buffer of specified size.\n _initWithByteLength(byteLength: number): this {\n assert(byteLength >= 0);\n\n // Workaround needed for Safari (#291):\n // gl.bufferData with size equal to 0 crashes. Instead create zero sized array.\n let data = byteLength;\n if (byteLength === 0) {\n // @ts-expect-error\n data = new Float32Array(0);\n }\n\n const target = this._getWriteTarget();\n\n this.gl.bindBuffer(target, this.handle);\n this.gl.bufferData(target, data, this.webglUsage);\n this.gl.bindBuffer(target, null);\n\n this.debugData = null;\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n\n return this;\n }\n\n override destroy(): void {\n if (!this.destroyed && this.handle) {\n this.removeStats();\n this.trackDeallocatedMemory();\n this.gl.deleteBuffer(this.handle);\n this.destroyed = true;\n // this.handle = null;\n }\n }\n\n override write(data: ArrayBufferView, byteOffset: number = 0): void {\n const srcOffset = 0;\n const byteLength = data.byteLength;\n\n // Create the buffer - binding it here for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n const target = this.device.isWebGL2 ? GL.COPY_WRITE_BUFFER : this.target;\n this.gl.bindBuffer(target, this.handle);\n // WebGL2: subData supports additional srcOffset and length parameters\n if (srcOffset !== 0 || byteLength !== undefined) {\n this.device.assertWebGL2();\n\n // @ts-expect-error\n this.gl.bufferSubData(this.target, byteOffset, data, srcOffset, byteLength);\n } else {\n this.gl.bufferSubData(target, byteOffset, data);\n }\n this.gl.bindBuffer(target, null);\n\n // TODO - update local `data` if offsets are right\n // this.debugData = data.slice(byteOffset, 40);\n }\n\n /** Read data from the buffer */\n override async readAsync(\n byteOffset: number = 0,\n byteLength?: number\n ): Promise<ArrayBuffer> {\n this.device.assertWebGL2();\n\n const data = new Uint8Array(byteLength);\n const dstOffset = 0;\n\n // Use GL.COPY_READ_BUFFER to avoid disturbing other targets and locking type\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, this.handle);\n this.gl2.getBufferSubData(GL.COPY_READ_BUFFER, byteOffset, data, dstOffset, byteLength);\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, null);\n\n // TODO - update local `data` if offsets are 0\n // this.debugData = null;\n\n return data;\n }\n\n // PROTECTED METHODS (INTENDED FOR USE BY OTHER FRAMEWORK CODE ONLY)\n\n _invalidateDebugData() {\n this.debugData = null;\n }\n\n _getWriteTarget() {\n return this.target;\n // return this.device.isWebGL2 ? GL.COPY_WRITE_BUFFER : this.target;\n }\n\n _getReadTarget() {\n return this.target;\n // return this.device.isWebGL2 ? GL.COPY_READ_BUFFER : this.target;\n }\n}\n\n// static MAP_READ = 0x01;\n// static MAP_WRITE = 0x02;\n// static COPY_SRC = 0x0004;\n// static COPY_DST = 0x0008;\n// static INDEX = 0x0010;\n// static VERTEX = 0x0020;\n// static UNIFORM = 0x0040;\n// static STORAGE = 0x0080;\n// static INDIRECT = 0x0100;\n// static QUERY_RESOLVE = 0x0200;\n\nfunction getWebGLTarget(usage: number): GL {\n if (usage & Buffer.INDEX) {\n return GL.ELEMENT_ARRAY_BUFFER;\n }\n if (usage & Buffer.VERTEX) {\n return GL.ARRAY_BUFFER;\n }\n if (usage & Buffer.UNIFORM) {\n return GL.UNIFORM_BUFFER;\n }\n\n // gl.COPY_READ_BUFFER: Buffer for copying from one buffer object to another.\n // gl.COPY_WRITE_BUFFER: Buffer for copying from one buffer object to another.\n // gl.TRANSFORM_FEEDBACK_BUFFER: Buffer for transform feedback operations.\n // gl.PIXEL_PACK_BUFFER: Buffer used for pixel transfer operations.\n // gl.PIXEL_UNPACK_BUFFER: Buffer used for pixel transfer operations.\n\n // Binding a buffer for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n return GL.ARRAY_BUFFER;\n}\n\nfunction getWebGLUsage(usage: number): GL {\n if (usage & Buffer.INDEX) {\n return GL.STATIC_DRAW;\n }\n if (usage & Buffer.VERTEX) {\n return GL.STATIC_DRAW;\n }\n if (usage & Buffer.UNIFORM) {\n return GL.DYNAMIC_DRAW;\n }\n return GL.DYNAMIC_DRAW;\n}\n"],"mappings":";AACA,SAAQA,MAAM,EAAEC,MAAM,QAAO,cAAc;AAC3C,OAAOC,EAAE,MAAM,oBAAoB;AAGnC,MAAMC,iBAAiB,GAAG,EAAE;AAG5B,eAAe,MAAMC,WAAW,SAASJ,MAAM,CAAC;EAgB9CK,WAAWA,CAACC,MAAmB,EAA2B;IAAA,IAAzBC,KAAkB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IACtD,KAAK,CAACF,MAAM,EAAEC,KAAK,CAAC;IAACI,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,oBARS,IAAI;IAAAA,eAAA;IAUlC,IAAI,CAACL,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACM,EAAE,GAAG,IAAI,CAACN,MAAM,CAACM,EAAE;IACxB,IAAI,CAACC,GAAG,GAAG,IAAI,CAACP,MAAM,CAACO,GAAG;IAE1B,MAAMC,MAAM,GAAG,OAAOP,KAAK,KAAK,QAAQ,GAAIA,KAAK,CAAGO,MAAM,GAAGJ,SAAS;IACtE,IAAI,CAACI,MAAM,GAAGA,MAAM,IAAI,IAAI,CAACF,EAAE,CAACG,YAAY,EAAE;IAC9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,CAAC4D,YAAY;EACxB;EACA,OAAO5D,EAAE,CAAC4D,YAAY;AACxB"}
|
|
1
|
+
{"version":3,"file":"webgl-buffer.js","names":["Buffer","assert","GL","DEBUG_DATA_LENGTH","WEBGLBuffer","constructor","device","props","arguments","length","undefined","_defineProperty","gl","gl2","handle","createBuffer","setSpectorMetadata","data","target","getWebGLTarget","usage","webglUsage","getWebGLUsage","debugData","_initWithData","byteOffset","byteLength","_initWithByteLength","ArrayBuffer","isView","_getWriteTarget","bindBuffer","bufferData","bufferSubData","slice","bytesUsed","trackAllocatedMemory","Float32Array","destroy","destroyed","removeStats","trackDeallocatedMemory","deleteBuffer","write","srcOffset","isWebGL2","COPY_WRITE_BUFFER","assertWebGL2","readAsync","Uint8Array","dstOffset","COPY_READ_BUFFER","getBufferSubData","_invalidateDebugData","_getReadTarget","INDEX","ELEMENT_ARRAY_BUFFER","VERTEX","ARRAY_BUFFER","UNIFORM","UNIFORM_BUFFER","STATIC_DRAW","DYNAMIC_DRAW"],"sources":["../../../src/adapter/resources/webgl-buffer.ts"],"sourcesContent":["import type {BufferProps} from '@luma.gl/api';\nimport {Buffer, assert} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport {WebGLDevice} from '../webgl-device';\n\nconst DEBUG_DATA_LENGTH = 10;\n\n/** WebGL Buffer interface */\nexport class WEBGLBuffer extends Buffer {\n readonly device: WebGLDevice;\n readonly gl: WebGLRenderingContext;\n readonly gl2: WebGL2RenderingContext | null;\n readonly handle: WebGLBuffer;\n readonly target: number;\n\n byteLength: number;\n bytesUsed: number;\n debugData: ArrayBuffer | null = null;\n\n webglUsage: number;\n\n // accessor: {};\n\n \n constructor(device: WebGLDevice, props: BufferProps = {}) {\n super(device, props);\n\n this.device = device;\n this.gl = this.device.gl;\n this.gl2 = this.device.gl2;\n\n const handle = typeof props === 'object' ? (props ).handle : undefined;\n this.handle = handle || this.gl.createBuffer();\n device.setSpectorMetadata(this.handle, {...this.props, data: typeof this.props.data});\n\n // In WebGL1, need to make sure we use GL.ELEMENT_ARRAY_BUFFER when initializing element buffers\n // otherwise buffer type will lock to generic (non-element) buffer\n // In WebGL2, we can use GL.COPY_READ_BUFFER which avoids locking the type here\n // @ts-expect-error Hack - Checking for subclass prop\n this.target = this.props.target || getWebGLTarget(this.props.usage);\n // @ts-expect-error Hack - Checking for subclass prop\n this.webglUsage = this.props.webglUsage || getWebGLUsage(this.props.usage);\n this.debugData = null;\n\n // Set data: (re)initializes the buffer\n if (props.data) {\n this._initWithData(props.data, props.byteOffset, props.byteLength);\n } else {\n this._initWithByteLength(props.byteLength || 0);\n }\n\n // Deprecated: Merge main props and accessor\n // this.accessor = {...props.accessor};\n\n // Object.seal(this);\n }\n\n // PRIVATE METHODS\n\n // Allocate a new buffer and initialize to contents of typed array\n _initWithData(data, byteOffset: number = 0, byteLength: number = data.byteLength + byteOffset): this {\n assert(ArrayBuffer.isView(data));\n\n const target = this._getWriteTarget();\n\n this.gl.bindBuffer(target, this.handle);\n this.gl.bufferData(target, byteLength, this.webglUsage);\n this.gl.bufferSubData(target, byteOffset, data);\n this.gl.bindBuffer(target, null);\n\n this.debugData = data.slice(0, DEBUG_DATA_LENGTH);\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n this.trackAllocatedMemory(byteLength);\n\n return this;\n }\n\n // Allocate a GPU buffer of specified size.\n _initWithByteLength(byteLength: number): this {\n assert(byteLength >= 0);\n\n // Workaround needed for Safari (#291):\n // gl.bufferData with size equal to 0 crashes. Instead create zero sized array.\n let data = byteLength;\n if (byteLength === 0) {\n // @ts-expect-error\n data = new Float32Array(0);\n }\n\n const target = this._getWriteTarget();\n\n this.gl.bindBuffer(target, this.handle);\n this.gl.bufferData(target, data, this.webglUsage);\n this.gl.bindBuffer(target, null);\n\n this.debugData = null;\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n\n return this;\n }\n\n override destroy(): void {\n if (!this.destroyed && this.handle) {\n this.removeStats();\n this.trackDeallocatedMemory();\n this.gl.deleteBuffer(this.handle);\n this.destroyed = true;\n // this.handle = null;\n }\n }\n\n override write(data: ArrayBufferView, byteOffset: number = 0): void {\n const srcOffset = 0;\n const byteLength = data.byteLength;\n\n // Create the buffer - binding it here for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n const target = this.device.isWebGL2 ? GL.COPY_WRITE_BUFFER : this.target;\n this.gl.bindBuffer(target, this.handle);\n // WebGL2: subData supports additional srcOffset and length parameters\n if (srcOffset !== 0 || byteLength !== undefined) {\n this.device.assertWebGL2();\n\n // @ts-expect-error\n this.gl.bufferSubData(this.target, byteOffset, data, srcOffset, byteLength);\n } else {\n this.gl.bufferSubData(target, byteOffset, data);\n }\n this.gl.bindBuffer(target, null);\n\n // TODO - update local `data` if offsets are right\n // this.debugData = data.slice(byteOffset, 40);\n }\n\n /** Read data from the buffer */\n override async readAsync(\n byteOffset: number = 0,\n byteLength?: number\n ): Promise<ArrayBuffer> {\n this.device.assertWebGL2();\n\n const data = new Uint8Array(byteLength);\n const dstOffset = 0;\n\n // Use GL.COPY_READ_BUFFER to avoid disturbing other targets and locking type\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, this.handle);\n this.gl2.getBufferSubData(GL.COPY_READ_BUFFER, byteOffset, data, dstOffset, byteLength);\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, null);\n\n // TODO - update local `data` if offsets are 0\n // this.debugData = null;\n\n return data;\n }\n\n // PROTECTED METHODS (INTENDED FOR USE BY OTHER FRAMEWORK CODE ONLY)\n\n _invalidateDebugData() {\n this.debugData = null;\n }\n\n _getWriteTarget() {\n return this.target;\n // return this.device.isWebGL2 ? GL.COPY_WRITE_BUFFER : this.target;\n }\n\n _getReadTarget() {\n return this.target;\n // return this.device.isWebGL2 ? GL.COPY_READ_BUFFER : this.target;\n }\n}\n\n// static MAP_READ = 0x01;\n// static MAP_WRITE = 0x02;\n// static COPY_SRC = 0x0004;\n// static COPY_DST = 0x0008;\n// static INDEX = 0x0010;\n// static VERTEX = 0x0020;\n// static UNIFORM = 0x0040;\n// static STORAGE = 0x0080;\n// static INDIRECT = 0x0100;\n// static QUERY_RESOLVE = 0x0200;\n\nfunction getWebGLTarget(usage: number): GL {\n if (usage & Buffer.INDEX) {\n return GL.ELEMENT_ARRAY_BUFFER;\n }\n if (usage & Buffer.VERTEX) {\n return GL.ARRAY_BUFFER;\n }\n if (usage & Buffer.UNIFORM) {\n return GL.UNIFORM_BUFFER;\n }\n\n // gl.COPY_READ_BUFFER: Buffer for copying from one buffer object to another.\n // gl.COPY_WRITE_BUFFER: Buffer for copying from one buffer object to another.\n // gl.TRANSFORM_FEEDBACK_BUFFER: Buffer for transform feedback operations.\n // gl.PIXEL_PACK_BUFFER: Buffer used for pixel transfer operations.\n // gl.PIXEL_UNPACK_BUFFER: Buffer used for pixel transfer operations.\n\n // Binding a buffer for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n return GL.ARRAY_BUFFER;\n}\n\nfunction getWebGLUsage(usage: number): GL {\n if (usage & Buffer.INDEX) {\n return GL.STATIC_DRAW;\n }\n if (usage & Buffer.VERTEX) {\n return GL.STATIC_DRAW;\n }\n if (usage & Buffer.UNIFORM) {\n return GL.DYNAMIC_DRAW;\n }\n return GL.DYNAMIC_DRAW;\n}\n"],"mappings":";AACA,SAAQA,MAAM,EAAEC,MAAM,QAAO,cAAc;AAC3C,OAAOC,EAAE,MAAM,oBAAoB;AAGnC,MAAMC,iBAAiB,GAAG,EAAE;AAG5B,OAAO,MAAMC,WAAW,SAASJ,MAAM,CAAC;EAgBtCK,WAAWA,CAACC,MAAmB,EAA2B;IAAA,IAAzBC,KAAkB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IACtD,KAAK,CAACF,MAAM,EAAEC,KAAK,CAAC;IAACI,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA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OAAO,EAAE;IAC1B,OAAOzD,EAAE,CAAC0D,cAAc;EAC1B;EAUA,OAAO1D,EAAE,CAACwD,YAAY;AACxB;AAEA,SAASpC,aAAaA,CAACF,KAAa,EAAM;EACxC,IAAIA,KAAK,GAAGpB,MAAM,CAACuD,KAAK,EAAE;IACxB,OAAOrD,EAAE,CAAC2D,WAAW;EACvB;EACA,IAAIzC,KAAK,GAAGpB,MAAM,CAACyD,MAAM,EAAE;IACzB,OAAOvD,EAAE,CAAC2D,WAAW;EACvB;EACA,IAAIzC,KAAK,GAAGpB,MAAM,CAAC2D,OAAO,EAAE;IAC1B,OAAOzD,EAAE,CAAC4D,YAAY;EACxB;EACA,OAAO5D,EAAE,CAAC4D,YAAY;AACxB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CopyBufferToBufferOptions, CopyBufferToTextureOptions, CopyTextureToBufferOptions, CopyTextureToTextureOptions } from '@luma.gl/api';
|
|
2
|
-
import WebGLDevice from '../webgl-device';
|
|
2
|
+
import { WebGLDevice } from '../webgl-device';
|
|
3
3
|
declare type CopyBufferToBufferCommand = {
|
|
4
4
|
name: 'copy-buffer-to-buffer';
|
|
5
5
|
options: CopyBufferToBufferOptions;
|
|
@@ -17,7 +17,7 @@ declare type CopyTextureToTextureCommand = {
|
|
|
17
17
|
options: CopyTextureToTextureOptions;
|
|
18
18
|
};
|
|
19
19
|
declare type Command = CopyBufferToBufferCommand | CopyBufferToTextureCommand | CopyTextureToBufferCommand | CopyTextureToTextureCommand;
|
|
20
|
-
export
|
|
20
|
+
export declare class CommandBuffer {
|
|
21
21
|
commands: Command[];
|
|
22
22
|
}
|
|
23
23
|
export declare function submitCommands(device: WebGLDevice, commands?: Command[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-command-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-command-buffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,cAAc,CAAC;AAEtB,OAAO,WAAW,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"webgl-command-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-command-buffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAO5C,aAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,uBAAuB,CAAC;IAC9B,OAAO,EAAE,yBAAyB,CAAC;CACpC,CAAC;AAEF,aAAK,0BAA0B,GAAG;IAChC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,0BAA0B,CAAC;CACrC,CAAC;AAEF,aAAK,0BAA0B,GAAG;IAChC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,0BAA0B,CAAC;CACrC,CAAC;AAEF,aAAK,2BAA2B,GAAG;IACjC,IAAI,EAAE,yBAAyB,CAAC;IAChC,OAAO,EAAE,2BAA2B,CAAC;CACtC,CAAC;AAEF,aAAK,OAAO,GACR,yBAAyB,GACzB,0BAA0B,GAC1B,0BAA0B,GAC1B,2BAA2B,CAAC;AAEhC,qBAAa,aAAa;IACxB,QAAQ,EAAE,OAAO,EAAE,CAAM;CAC1B;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,GAAE,OAAO,EAAO,QAiB3E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-command-buffer.js","names":["GL","cast","value","CommandBuffer","constructor","_defineProperty","submitCommands","device","commands","arguments","length","undefined","command","name","_copyBufferToBuffer","options","_copyBufferToTexture","_copyTextureToBuffer","_copyTextureToTexture","source","destination","gl2","_options$sourceOffset","_options$destinationO","bindBuffer","COPY_READ_BUFFER","handle","COPY_WRITE_BUFFER","copyBufferSubData","sourceOffset","destinationOffset","size","Error"],"sources":["../../../src/adapter/resources/webgl-command-buffer.ts"],"sourcesContent":["import type {\n CopyBufferToBufferOptions,\n CopyBufferToTextureOptions,\n CopyTextureToBufferOptions,\n CopyTextureToTextureOptions\n} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport WebGLDevice from '../webgl-device';\nimport WEBGLBuffer from './webgl-buffer';\n\nfunction cast<T>(value: unknown): T {\n return value as T;\n}\n\ntype CopyBufferToBufferCommand = {\n name: 'copy-buffer-to-buffer';\n options: CopyBufferToBufferOptions;\n};\n\ntype CopyBufferToTextureCommand = {\n name: 'copy-buffer-to-texture';\n options: CopyBufferToTextureOptions;\n};\n\ntype CopyTextureToBufferCommand = {\n name: 'copy-texture-to-buffer';\n options: CopyTextureToBufferOptions;\n};\n\ntype CopyTextureToTextureCommand = {\n name: 'copy-texture-to-texture';\n options: CopyTextureToTextureOptions;\n};\n\ntype Command =\n | CopyBufferToBufferCommand\n | CopyBufferToTextureCommand\n | CopyTextureToBufferCommand\n | CopyTextureToTextureCommand;\n\nexport
|
|
1
|
+
{"version":3,"file":"webgl-command-buffer.js","names":["GL","cast","value","CommandBuffer","constructor","_defineProperty","submitCommands","device","commands","arguments","length","undefined","command","name","_copyBufferToBuffer","options","_copyBufferToTexture","_copyTextureToBuffer","_copyTextureToTexture","source","destination","gl2","_options$sourceOffset","_options$destinationO","bindBuffer","COPY_READ_BUFFER","handle","COPY_WRITE_BUFFER","copyBufferSubData","sourceOffset","destinationOffset","size","Error"],"sources":["../../../src/adapter/resources/webgl-command-buffer.ts"],"sourcesContent":["import type {\n CopyBufferToBufferOptions,\n CopyBufferToTextureOptions,\n CopyTextureToBufferOptions,\n CopyTextureToTextureOptions\n} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport {WebGLDevice} from '../webgl-device';\nimport {WEBGLBuffer} from './webgl-buffer';\n\nfunction cast<T>(value: unknown): T {\n return value as T;\n}\n\ntype CopyBufferToBufferCommand = {\n name: 'copy-buffer-to-buffer';\n options: CopyBufferToBufferOptions;\n};\n\ntype CopyBufferToTextureCommand = {\n name: 'copy-buffer-to-texture';\n options: CopyBufferToTextureOptions;\n};\n\ntype CopyTextureToBufferCommand = {\n name: 'copy-texture-to-buffer';\n options: CopyTextureToBufferOptions;\n};\n\ntype CopyTextureToTextureCommand = {\n name: 'copy-texture-to-texture';\n options: CopyTextureToTextureOptions;\n};\n\ntype Command =\n | CopyBufferToBufferCommand\n | CopyBufferToTextureCommand\n | CopyTextureToBufferCommand\n | CopyTextureToTextureCommand;\n\nexport class CommandBuffer {\n commands: Command[] = [];\n}\n\nexport function submitCommands(device: WebGLDevice, commands: Command[] = []) {\n for (const command of commands) {\n switch (command.name) {\n case 'copy-buffer-to-buffer':\n _copyBufferToBuffer(device, command.options);\n break;\n case 'copy-buffer-to-texture':\n _copyBufferToTexture(device, command.options);\n break;\n case 'copy-texture-to-buffer':\n _copyTextureToBuffer(device, command.options);\n break;\n case 'copy-texture-to-texture':\n _copyTextureToTexture(device, command.options);\n break;\n }\n }\n}\n\nfunction _copyBufferToBuffer(device: WebGLDevice, options: CopyBufferToBufferOptions): void {\n const source = cast<WEBGLBuffer>(options.source);\n const destination = cast<WEBGLBuffer>(options.destination);\n\n const {gl2} = device;\n if (gl2) {\n // In WebGL2 we can perform the copy on the GPU\n // Use GL.COPY_READ_BUFFER+GL.COPY_WRITE_BUFFER avoid disturbing other targets and locking type\n gl2.bindBuffer(GL.COPY_READ_BUFFER, source.handle);\n gl2.bindBuffer(GL.COPY_WRITE_BUFFER, destination.handle);\n gl2.copyBufferSubData(\n GL.COPY_READ_BUFFER,\n GL.COPY_WRITE_BUFFER,\n options.sourceOffset ?? 0,\n options.destinationOffset ?? 0,\n options.size\n );\n gl2.bindBuffer(GL.COPY_READ_BUFFER, null);\n gl2.bindBuffer(GL.COPY_WRITE_BUFFER, null);\n } else {\n // TODO - in WebGL1 we would have to read back to CPU\n // read / write buffer from / to CPU\n throw new Error('copyBufferToBuffer not implemented in WebGL1');\n }\n}\n\nfunction _copyBufferToTexture(device: WebGLDevice, options: CopyBufferToTextureOptions): void {}\n\nfunction _copyTextureToBuffer(device: WebGLDevice, options: CopyTextureToBufferOptions): void {}\n\nfunction _copyTextureToTexture(device: WebGLDevice, options: CopyTextureToTextureOptions): void {}\n"],"mappings":";AAMA,OAAOA,EAAE,MAAM,oBAAoB;AAInC,SAASC,IAAIA,CAAIC,KAAc,EAAK;EAClC,OAAOA,KAAK;AACd;AA4BA,OAAO,MAAMC,aAAa,CAAC;EAAAC,YAAA;IAAAC,eAAA,mBACH,EAAE;EAAA;AAC1B;AAEA,OAAO,SAASC,cAAcA,CAACC,MAAmB,EAA4B;EAAA,IAA1BC,QAAmB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAC1E,KAAK,MAAMG,OAAO,IAAIJ,QAAQ,EAAE;IAC9B,QAAQI,OAAO,CAACC,IAAI;MAClB,KAAK,uBAAuB;QAC1BC,mBAAmB,CAACP,MAAM,EAAEK,OAAO,CAACG,OAAO,CAAC;QAC5C;MACF,KAAK,wBAAwB;QAC3BC,oBAAoB,CAACT,MAAM,EAAEK,OAAO,CAACG,OAAO,CAAC;QAC7C;MACF,KAAK,wBAAwB;QAC3BE,oBAAoB,CAACV,MAAM,EAAEK,OAAO,CAACG,OAAO,CAAC;QAC7C;MACF,KAAK,yBAAyB;QAC5BG,qBAAqB,CAACX,MAAM,EAAEK,OAAO,CAACG,OAAO,CAAC;QAC9C;IAAM;EAEZ;AACF;AAEA,SAASD,mBAAmBA,CAACP,MAAmB,EAAEQ,OAAkC,EAAQ;EAC1F,MAAMI,MAAM,GAAGlB,IAAI,CAAcc,OAAO,CAACI,MAAM,CAAC;EAChD,MAAMC,WAAW,GAAGnB,IAAI,CAAcc,OAAO,CAACK,WAAW,CAAC;EAE1D,MAAM;IAACC;EAAG,CAAC,GAAGd,MAAM;EACpB,IAAIc,GAAG,EAAE;IAAA,IAAAC,qBAAA,EAAAC,qBAAA;IAGPF,GAAG,CAACG,UAAU,CAACxB,EAAE,CAACyB,gBAAgB,EAAEN,MAAM,CAACO,MAAM,CAAC;IAClDL,GAAG,CAACG,UAAU,CAACxB,EAAE,CAAC2B,iBAAiB,EAAEP,WAAW,CAACM,MAAM,CAAC;IACxDL,GAAG,CAACO,iBAAiB,CACnB5B,EAAE,CAACyB,gBAAgB,EACnBzB,EAAE,CAAC2B,iBAAiB,GAAAL,qBAAA,GACpBP,OAAO,CAACc,YAAY,cAAAP,qBAAA,cAAAA,qBAAA,GAAI,CAAC,GAAAC,qBAAA,GACzBR,OAAO,CAACe,iBAAiB,cAAAP,qBAAA,cAAAA,qBAAA,GAAI,CAAC,EAC9BR,OAAO,CAACgB,IAAI,CACb;IACDV,GAAG,CAACG,UAAU,CAACxB,EAAE,CAACyB,gBAAgB,EAAE,IAAI,CAAC;IACzCJ,GAAG,CAACG,UAAU,CAACxB,EAAE,CAAC2B,iBAAiB,EAAE,IAAI,CAAC;EAC5C,CAAC,MAAM;IAGL,MAAM,IAAIK,KAAK,CAAC,8CAA8C,CAAC;EACjE;AACF;AAEA,SAAShB,oBAAoBA,CAACT,MAAmB,EAAEQ,OAAmC,EAAQ,CAAC;AAE/F,SAASE,oBAAoBA,CAACV,MAAmB,EAAEQ,OAAmC,EAAQ,CAAC;AAE/F,SAASG,qBAAqBA,CAACX,MAAmB,EAAEQ,OAAoC,EAAQ,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CommandEncoder, CommandEncoderProps } from '@luma.gl/api';
|
|
2
2
|
import type { CopyBufferToBufferOptions, CopyBufferToTextureOptions, CopyTextureToBufferOptions, CopyTextureToTextureOptions } from '@luma.gl/api';
|
|
3
|
-
import CommandBuffer from './webgl-command-buffer';
|
|
4
|
-
import WebGLDevice from '../webgl-device';
|
|
5
|
-
export
|
|
3
|
+
import { CommandBuffer } from './webgl-command-buffer';
|
|
4
|
+
import { WebGLDevice } from '../webgl-device';
|
|
5
|
+
export declare class WEBGLCommandEncoder extends CommandEncoder {
|
|
6
6
|
readonly device: WebGLDevice;
|
|
7
7
|
readonly commandBuffer: CommandBuffer;
|
|
8
8
|
constructor(device: WebGLDevice, props: CommandEncoderProps);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-command-encoder.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-command-encoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,cAAc,CAAC;AACjE,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,cAAc,CAAC;AAEtB,OAAO,aAAa,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"webgl-command-encoder.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-command-encoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,cAAc,CAAC;AACjE,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAE5C,qBAAa,mBAAoB,SAAQ,cAAc;IACrD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAE7B,QAAQ,CAAC,aAAa,gBAAuB;gBAEjC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,mBAAmB;IAKlD,OAAO,IAAI,IAAI;IAMxB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI;IAI5D,mBAAmB,CAAC,OAAO,EAAE,0BAA0B;IAIvD,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,IAAI;IAI9D,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,IAAI;IAIvD,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IACxC,aAAa;IAEb,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAWtD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import { CommandEncoder } from '@luma.gl/api';
|
|
3
|
-
import CommandBuffer from "./webgl-command-buffer.js";
|
|
4
|
-
export
|
|
3
|
+
import { CommandBuffer } from "./webgl-command-buffer.js";
|
|
4
|
+
export class WEBGLCommandEncoder extends CommandEncoder {
|
|
5
5
|
constructor(device, props) {
|
|
6
6
|
super(props);
|
|
7
7
|
_defineProperty(this, "device", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-command-encoder.js","names":["CommandEncoder","CommandBuffer","WEBGLCommandEncoder","constructor","device","props","_defineProperty","destroy","copyBufferToBuffer","options","commandBuffer","commands","push","name","copyBufferToTexture","copyTextureToBuffer","copyTextureToTexture","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"sources":["../../../src/adapter/resources/webgl-command-encoder.ts"],"sourcesContent":["import {CommandEncoder, CommandEncoderProps} from '@luma.gl/api';\nimport type {\n CopyBufferToBufferOptions,\n CopyBufferToTextureOptions,\n CopyTextureToBufferOptions,\n CopyTextureToTextureOptions\n} from '@luma.gl/api';\n\nimport CommandBuffer from './webgl-command-buffer';\nimport WebGLDevice from '../webgl-device';\n\nexport
|
|
1
|
+
{"version":3,"file":"webgl-command-encoder.js","names":["CommandEncoder","CommandBuffer","WEBGLCommandEncoder","constructor","device","props","_defineProperty","destroy","copyBufferToBuffer","options","commandBuffer","commands","push","name","copyBufferToTexture","copyTextureToBuffer","copyTextureToTexture","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"sources":["../../../src/adapter/resources/webgl-command-encoder.ts"],"sourcesContent":["import {CommandEncoder, CommandEncoderProps} from '@luma.gl/api';\nimport type {\n CopyBufferToBufferOptions,\n CopyBufferToTextureOptions,\n CopyTextureToBufferOptions,\n CopyTextureToTextureOptions\n} from '@luma.gl/api';\n\nimport {CommandBuffer} from './webgl-command-buffer';\nimport {WebGLDevice} from '../webgl-device';\n\nexport class WEBGLCommandEncoder extends CommandEncoder {\n readonly device: WebGLDevice;\n\n readonly commandBuffer = new CommandBuffer();\n\n constructor(device: WebGLDevice, props: CommandEncoderProps) {\n super(props);\n this.device = device;\n }\n\n override destroy(): void {}\n\n // beginRenderPass(GPURenderPassDescriptor descriptor): GPURenderPassEncoder;\n // beginComputePass(optional GPUComputePassDescriptor descriptor = {}): GPUComputePassEncoder;\n // finish(options?: {id?: string}): GPUCommandBuffer;\n\n copyBufferToBuffer(options: CopyBufferToBufferOptions): void {\n this.commandBuffer.commands.push({name: 'copy-buffer-to-buffer', options});\n }\n\n copyBufferToTexture(options: CopyBufferToTextureOptions) {\n this.commandBuffer.commands.push({name: 'copy-buffer-to-texture', options});\n }\n\n copyTextureToBuffer(options: CopyTextureToBufferOptions): void {\n this.commandBuffer.commands.push({name: 'copy-texture-to-buffer', options});\n }\n\n copyTextureToTexture(options: CopyTextureToTextureOptions): void {\n this.commandBuffer.commands.push({name: 'copy-texture-to-texture', options});\n }\n\n override pushDebugGroup(groupLabel: string): void {}\n override popDebugGroup() {}\n\n override insertDebugMarker(markerLabel: string): void {}\n\n // writeTimestamp(querySet: Query, queryIndex: number): void {}\n\n // resolveQuerySet(options: {\n // querySet: GPUQuerySet,\n // firstQuery: number,\n // queryCount: number,\n // destination: Buffer,\n // destinationOffset?: number;\n // }): void;\n}\n"],"mappings":";AAAA,SAAQA,cAAc,QAA4B,cAAc;AAAC,SAQzDC,aAAa;AAGrB,OAAO,MAAMC,mBAAmB,SAASF,cAAc,CAAC;EAKtDG,WAAWA,CAACC,MAAmB,EAAEC,KAA0B,EAAE;IAC3D,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA,wBAHU,IAAIL,aAAa,EAAE;IAI1C,IAAI,CAACG,MAAM,GAAGA,MAAM;EACtB;EAESG,OAAOA,CAAA,EAAS,CAAC;EAM1BC,kBAAkBA,CAACC,OAAkC,EAAQ;IAC3D,IAAI,CAACC,aAAa,CAACC,QAAQ,CAACC,IAAI,CAAC;MAACC,IAAI,EAAE,uBAAuB;MAAEJ;IAAO,CAAC,CAAC;EAC5E;EAEAK,mBAAmBA,CAACL,OAAmC,EAAE;IACvD,IAAI,CAACC,aAAa,CAACC,QAAQ,CAACC,IAAI,CAAC;MAACC,IAAI,EAAE,wBAAwB;MAAEJ;IAAO,CAAC,CAAC;EAC7E;EAEAM,mBAAmBA,CAACN,OAAmC,EAAQ;IAC7D,IAAI,CAACC,aAAa,CAACC,QAAQ,CAACC,IAAI,CAAC;MAACC,IAAI,EAAE,wBAAwB;MAAEJ;IAAO,CAAC,CAAC;EAC7E;EAEAO,oBAAoBA,CAACP,OAAoC,EAAQ;IAC/D,IAAI,CAACC,aAAa,CAACC,QAAQ,CAACC,IAAI,CAAC;MAACC,IAAI,EAAE,yBAAyB;MAAEJ;IAAO,CAAC,CAAC;EAC9E;EAESQ,cAAcA,CAACC,UAAkB,EAAQ,CAAC;EAC1CC,aAAaA,CAAA,EAAG,CAAC;EAEjBC,iBAAiBA,CAACC,WAAmB,EAAQ,CAAC;AAWzD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-external-texture.js","names":[],"sources":["../../../src/adapter/resources/webgl-external-texture.ts"],"sourcesContent":["/*\nexport
|
|
1
|
+
{"version":3,"file":"webgl-external-texture.js","names":[],"sources":["../../../src/adapter/resources/webgl-external-texture.ts"],"sourcesContent":["/*\nexport class WEBGLExternalTexture extends WEBGLTexture {\n readonly device: WebGLDevice;\n readonly gl: WebGLRenderingContext;\n readonly gl2: WebGL2RenderingContext | null;\n readonly handle: WebGLTexture;\n\n data;\n\n width: number = undefined;\n height: number = undefined;\n depth: number = undefined;\n\n format = undefined;\n type = undefined;\n dataFormat = undefined;\n border = undefined;\n mipmaps: boolean = undefined;\n\n textureUnit: number = undefined;\n\n sampler: WEBGLSampler;\n\n // Program.draw() checks the loaded flag of all textures to avoid\n // Textures that are still loading from promises\n // Set to true as soon as texture has been initialized with valid data\n loaded = false;\n _video;\n\n readonly target: GL;\n // target cannot be modified by bind:\n // textures are special because when you first bind them to a target,\n // they get special information. When you first bind a texture as a\n // GL_TEXTURE_2D, you are actually setting special state in the texture.\n // You are saying that this texture is a 2D texture.\n // And it will always be a 2D texture; this state cannot be changed ever.\n // If you have a texture that was first bound as a GL_TEXTURE_2D,\n // you must always bind it as a GL_TEXTURE_2D;\n // attempting to bind it as GL_TEXTURE_3D will give rise to an error\n // (while run-time).\n\n static isSupported(device: WebGLDevice, options?: TextureSupportOptions): boolean {\n const {format, linearFiltering} = options;\n let supported = true;\n if (format) {\n supported = supported && isFormatSupported(device.gl, format);\n supported = supported && (!linearFiltering || isTextureFormatFilterable(device.gl, format));\n }\n return supported;\n }\n\n // eslint-disable-next-line max-statements\n constructor(device: Device | WebGLRenderingContext, props: TextureProps) {\n super(WebGLDevice.attach(device), {id: uid('texture'), ...props});\n\n this.target = getWebGLTextureTarget(props);\n\n this.device = WebGLDevice.attach(device);\n this.gl = this.device.gl;\n this.gl2 = this.device.gl2;\n this.handle = this.props.handle || this.gl.createTexture();\n\n let data = props.data;\n\n const isVideo = typeof HTMLVideoElement !== 'undefined' && data instanceof HTMLVideoElement;\n // @ts-expect-error\n if (isVideo && data.readyState < HTMLVideoElement.HAVE_METADATA) {\n this._video = null; // Declare member before the object is sealed\n data.addEventListener('loadeddata', () => this.initialize(props));\n return this;\n }\n\n update(): this {\n if (this._video) {\n const {video, parameters, lastTime} = this._video;\n // @ts-expect-error\n if (lastTime === video.currentTime || video.readyState < HTMLVideoElement.HAVE_CURRENT_DATA) {\n return;\n }\n this.setSubImageData({\n data: video,\n parameters\n });\n if (this.mipmaps) {\n this.generateMipmap();\n }\n this._video.lastTime = video.currentTime;\n }\n }\n\n\n*/"],"mappings":""}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import type { FramebufferProps, ColorTextureFormat } from '@luma.gl/api';
|
|
2
2
|
import { Framebuffer, Texture } from '@luma.gl/api';
|
|
3
3
|
import GL from '@luma.gl/constants';
|
|
4
|
-
import WebGLDevice from '../webgl-device';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import { WebGLDevice } from '../webgl-device';
|
|
5
|
+
import { WEBGLTexture } from './webgl-texture';
|
|
6
|
+
import { WEBGLRenderbuffer } from '../objects/webgl-renderbuffer';
|
|
7
7
|
export declare type TextureAttachment = [Texture, number?, number?];
|
|
8
|
-
export declare type Attachment =
|
|
8
|
+
export declare type Attachment = WEBGLTexture | WEBGLRenderbuffer | TextureAttachment;
|
|
9
9
|
/** luma.gl Framebuffer, WebGL implementation */
|
|
10
|
-
export
|
|
10
|
+
export declare class WEBGLFramebuffer extends Framebuffer {
|
|
11
11
|
device: WebGLDevice;
|
|
12
12
|
gl: WebGLRenderingContext;
|
|
13
13
|
handle: WebGLFramebuffer;
|
|
14
|
-
get texture():
|
|
15
|
-
readonly colorAttachments:
|
|
16
|
-
readonly depthStencilAttachment:
|
|
17
|
-
protected _ownResources: (
|
|
14
|
+
get texture(): WEBGLTexture;
|
|
15
|
+
readonly colorAttachments: WEBGLTexture[];
|
|
16
|
+
readonly depthStencilAttachment: WEBGLTexture | null;
|
|
17
|
+
protected _ownResources: (WEBGLTexture | WEBGLRenderbuffer)[];
|
|
18
18
|
constructor(device: WebGLDevice, props: FramebufferProps);
|
|
19
19
|
destroy(): void;
|
|
20
20
|
/** Check the status */
|
|
21
21
|
protected _checkStatus(): void;
|
|
22
|
-
_createColorAttachments():
|
|
22
|
+
_createColorAttachments(): WEBGLTexture[];
|
|
23
23
|
/** Create a color attachment */
|
|
24
|
-
protected _createColorAttachment(format: ColorTextureFormat, width: number, height: number):
|
|
24
|
+
protected _createColorAttachment(format: ColorTextureFormat, width: number, height: number): WEBGLTexture;
|
|
25
25
|
/** Create a depth stencil attachment GL.DEPTH24_STENCIL8 */
|
|
26
|
-
protected _createDepthStencilAttachment():
|
|
26
|
+
protected _createDepthStencilAttachment(): WEBGLRenderbuffer | WEBGLTexture;
|
|
27
27
|
/** Attachment resize is expected to be a noop if size is same */
|
|
28
28
|
protected _resizeAttachments(width: number, height: number): this;
|
|
29
29
|
/** Attach one attachment */
|
|
30
|
-
protected _attachOne(attachmentPoint: GL, attachment: Attachment):
|
|
31
|
-
protected
|
|
30
|
+
protected _attachOne(attachmentPoint: GL, attachment: Attachment): WEBGLTexture | WEBGLRenderbuffer;
|
|
31
|
+
protected _attachWEBGLRenderbuffer(attachment: GL, renderbuffer: WEBGLRenderbuffer): void;
|
|
32
32
|
/**
|
|
33
33
|
* @param attachment
|
|
34
34
|
* @param texture
|
|
35
|
-
* @param layer = 0 - index into
|
|
35
|
+
* @param layer = 0 - index into WEBGLTextureArray and Texture3D or face for `TextureCubeMap`
|
|
36
36
|
* @param level = 0 - mipmapLevel (must be 0 in WebGL1)
|
|
37
37
|
*/
|
|
38
|
-
protected _attachTexture(attachment: GL, texture:
|
|
38
|
+
protected _attachTexture(attachment: GL, texture: WEBGLTexture, layer: number, level: number): void;
|
|
39
39
|
}
|
|
40
40
|
//# sourceMappingURL=webgl-framebuffer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-framebuffer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,gBAAgB,EAAE,kBAAkB,EAAC,MAAM,cAAc,CAAC;AACvE,OAAO,EAAC,WAAW,EAAE,OAAO,EAAc,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACpC,OAAO,WAA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EAAE,MAAM,EAAE,MAAM,GAAG,YAAY;IAgCzG,4DAA4D;IAC5D,SAAS,CAAC,6BAA6B,IAAI,iBAAiB,GAAG,YAAY;IAyB3E,iEAAiE;IACjE,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IA0BjE,4BAA4B;IAC5B,SAAS,CAAC,UAAU,CAAC,eAAe,EAAE,EAAE,EAAE,UAAU,EAAE,UAAU,GAAG,YAAY,GAAG,iBAAiB;IAenG,SAAS,CAAC,wBAAwB,CAAC,UAAU,EAAE,EAAE,EAAE,YAAY,EAAE,iBAAiB,GAAG,IAAI;IASzF;;;;;OAKG;IACH,SAAS,CAAC,cAAc,CAAC,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CA2BpG"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import { Framebuffer, Texture, log, assert } from '@luma.gl/api';
|
|
3
3
|
import GL from '@luma.gl/constants';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import { WEBGLTexture } from "./webgl-texture.js";
|
|
5
|
+
import { WEBGLRenderbuffer } from "../objects/webgl-renderbuffer.js";
|
|
6
6
|
import { getWebGLTextureFormat, getWebGLDepthStencilAttachment } from "../converters/texture-formats.js";
|
|
7
|
-
export
|
|
7
|
+
export class WEBGLFramebuffer extends Framebuffer {
|
|
8
8
|
get texture() {
|
|
9
9
|
return this.colorAttachments[0];
|
|
10
10
|
}
|
|
@@ -68,7 +68,7 @@ export default class WEBGLFramebuffer extends Framebuffer {
|
|
|
68
68
|
if (!colorAttachment) {
|
|
69
69
|
return undefined;
|
|
70
70
|
}
|
|
71
|
-
if (colorAttachment instanceof
|
|
71
|
+
if (colorAttachment instanceof WEBGLTexture) {
|
|
72
72
|
return colorAttachment;
|
|
73
73
|
}
|
|
74
74
|
return this._createColorAttachment(colorAttachment, this.width, this.height);
|
|
@@ -96,7 +96,7 @@ export default class WEBGLFramebuffer extends Framebuffer {
|
|
|
96
96
|
if (!this.props.depthStencilAttachment) {
|
|
97
97
|
return undefined;
|
|
98
98
|
}
|
|
99
|
-
if (this.props.depthStencilAttachment instanceof
|
|
99
|
+
if (this.props.depthStencilAttachment instanceof WEBGLRenderbuffer) {
|
|
100
100
|
return this.props.depthStencilAttachment;
|
|
101
101
|
}
|
|
102
102
|
if (this.props.depthStencilAttachment instanceof Texture) {
|
|
@@ -104,7 +104,7 @@ export default class WEBGLFramebuffer extends Framebuffer {
|
|
|
104
104
|
}
|
|
105
105
|
const format = this.props.depthStencilAttachment;
|
|
106
106
|
const webglFormat = getWebGLTextureFormat(this.gl, format);
|
|
107
|
-
const texture = new
|
|
107
|
+
const texture = new WEBGLRenderbuffer(this.device, {
|
|
108
108
|
id: "".concat(this.id, "-depth-stencil"),
|
|
109
109
|
format: webglFormat,
|
|
110
110
|
width: this.width,
|
|
@@ -142,20 +142,20 @@ export default class WEBGLFramebuffer extends Framebuffer {
|
|
|
142
142
|
return this;
|
|
143
143
|
}
|
|
144
144
|
_attachOne(attachmentPoint, attachment) {
|
|
145
|
-
if (attachment instanceof
|
|
146
|
-
this.
|
|
145
|
+
if (attachment instanceof WEBGLRenderbuffer) {
|
|
146
|
+
this._attachWEBGLRenderbuffer(attachmentPoint, attachment);
|
|
147
147
|
return attachment;
|
|
148
148
|
} else if (Array.isArray(attachment)) {
|
|
149
149
|
const [texture, layer = 0, level = 0] = attachment;
|
|
150
150
|
this._attachTexture(attachmentPoint, texture, layer, level);
|
|
151
151
|
return texture;
|
|
152
|
-
} else if (attachment instanceof
|
|
152
|
+
} else if (attachment instanceof WEBGLTexture) {
|
|
153
153
|
this._attachTexture(attachmentPoint, attachment, 0, 0);
|
|
154
154
|
return attachment;
|
|
155
155
|
}
|
|
156
156
|
throw new Error('attach');
|
|
157
157
|
}
|
|
158
|
-
|
|
158
|
+
_attachWEBGLRenderbuffer(attachment, renderbuffer) {
|
|
159
159
|
this.gl.framebufferRenderbuffer(GL.FRAMEBUFFER, attachment, GL.RENDERBUFFER, renderbuffer.handle);
|
|
160
160
|
}
|
|
161
161
|
_attachTexture(attachment, texture, layer, level) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-framebuffer.js","names":["Framebuffer","Texture","log","assert","GL","WebGLTexture","Renderbuffer","getWebGLTextureFormat","getWebGLDepthStencilAttachment","WEBGLFramebuffer","texture","colorAttachments","constructor","device","props","_defineProperty","gl","handle","undefined","createFramebuffer","setSpectorMetadata","id","_createColorAttachments","depthStencilAttachment","_createDepthStencilAttachment","prevHandle","bindFramebuffer","FRAMEBUFFER","i","length","attachment","attachmentPoint","COLOR_ATTACHMENT0","_attachOne","format","check","_checkStatus","destroy","resource","_ownResources","deleteFramebuffer","destroyed","status","checkFramebufferStatus","FRAMEBUFFER_COMPLETE","Error","concat","_getFrameBufferStatus","map","colorAttachment","_createColorAttachment","width","height","_createTexture","data","mipmaps","sampler","minFilter","magFilter","addressModeU","addressModeV","push","webglFormat","_resizeAttachments","_this$depthStencilAtt","drawingBufferWidth","drawingBufferHeight","resize","_attachRenderbuffer","Array","isArray","layer","level","_attachTexture","renderbuffer","framebufferRenderbuffer","RENDERBUFFER","gl2","bindTexture","target","TEXTURE_2D_ARRAY","TEXTURE_3D","assertWebGL2","framebufferTextureLayer","TEXTURE_CUBE_MAP","face","mapIndexToCubeMapFace","framebufferTexture2D","TEXTURE_2D","TEXTURE_CUBE_MAP_POSITIVE_X","FRAMEBUFFER_INCOMPLETE_ATTACHMENT","FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT","FRAMEBUFFER_INCOMPLETE_DIMENSIONS","FRAMEBUFFER_UNSUPPORTED","FRAMEBUFFER_INCOMPLETE_MULTISAMPLE"],"sources":["../../../src/adapter/resources/webgl-framebuffer.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport type {FramebufferProps, ColorTextureFormat} from '@luma.gl/api';\nimport {Framebuffer, Texture, log, assert} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport WebGLDevice from '../webgl-device';\nimport WebGLTexture from './webgl-texture';\nimport Renderbuffer from '../objects/webgl-renderbuffer';\nimport {getWebGLTextureFormat, getWebGLDepthStencilAttachment} from '../converters/texture-formats';\n\nexport type TextureAttachment = [Texture, number?, number?];\nexport type Attachment = WebGLTexture | Renderbuffer | TextureAttachment;\n\n/** luma.gl Framebuffer, WebGL implementation */\nexport default class WEBGLFramebuffer extends Framebuffer {\n device: WebGLDevice;\n gl: WebGLRenderingContext;\n handle: WebGLFramebuffer;\n\n get texture() { return this.colorAttachments[0]; }\n readonly colorAttachments: WebGLTexture[] = [];\n readonly depthStencilAttachment: WebGLTexture | null = null;\n protected _ownResources: (WebGLTexture | Renderbuffer)[] = [];\n\n constructor(device: WebGLDevice, props: FramebufferProps) {\n super(device, props);\n this.device = device;\n this.gl = device.gl;\n this.handle = this.props.handle !== undefined ? this.props.handle : this.gl.createFramebuffer();\n\n if (this.handle) { // default framebuffer is null...\n device.setSpectorMetadata(this.handle, {id: this.props.id, props: this.props});\n }\n\n this.colorAttachments = this._createColorAttachments();\n // @ts-expect-error\n this.depthStencilAttachment = this._createDepthStencilAttachment();\n\n /** Attach from a map of attachments */\n const prevHandle = this.gl.bindFramebuffer(GL.FRAMEBUFFER, this.handle);\n\n // Walk the attachments\n for (let i = 0; i < this.colorAttachments.length; ++i) {\n const attachment = this.colorAttachments[i];\n const attachmentPoint = GL.COLOR_ATTACHMENT0 + i;\n if (attachment) {\n this._attachOne(attachmentPoint, attachment);\n }\n }\n\n if (this.props.depthStencilAttachment) {\n this._attachOne(getWebGLDepthStencilAttachment(this.depthStencilAttachment.format), this.depthStencilAttachment);\n }\n\n // @ts-expect-error\n this.gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);\n\n // @ts-expect-error\n if (props.check !== false) {\n this._checkStatus();\n }\n }\n\n override destroy(): void {\n if (this.handle !== null) {\n for (const resource of this._ownResources) {\n resource.destroy();\n }\n this.gl.deleteFramebuffer(this.handle);\n // this.handle = null;\n this.destroyed = true;\n }\n }\n\n // PRIVATE\n\n /** Check the status */\n protected _checkStatus(): void {\n const {gl} = this;\n const prevHandle = gl.bindFramebuffer(GL.FRAMEBUFFER, this.handle);\n const status = gl.checkFramebufferStatus(GL.FRAMEBUFFER);\n // @ts-expect-error\n gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);\n if (status !== gl.FRAMEBUFFER_COMPLETE) {\n throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);\n }\n }\n\n _createColorAttachments(): WebGLTexture[] {\n return this.props.colorAttachments.map(colorAttachment => {\n if (!colorAttachment) {\n return undefined;\n }\n if (colorAttachment instanceof WebGLTexture) {\n return colorAttachment;\n }\n // if (typeof colorAttachment === 'default') {\n // return this._createColorAttachment('rgba8unorm', this.width, this.height);\n // }\n // @ts-expect-error\n return this._createColorAttachment(colorAttachment, this.width, this.height);\n });\n }\n\n /** Create a color attachment */\n protected _createColorAttachment(format: ColorTextureFormat, width: number, height: number): WebGLTexture {\n const texture = this.device._createTexture({\n id: `${this.id}-color`,\n data: null, // reserves texture memory, but texels are undefined\n format,\n // type: GL.UNSIGNED_BYTE,\n width,\n height,\n // Note: Mipmapping can be disabled by texture resource when we resize the texture\n // to a non-power-of-two dimenstion (NPOT texture) under WebGL1. To have consistant\n // behavior we always disable mipmaps.\n mipmaps: false,\n // Set MIN and MAG filtering parameters so mipmaps are not used in sampling.\n // Use LINEAR so subpixel algos like fxaa work.\n // Set WRAP modes that support NPOT textures too.\n sampler: {\n minFilter: 'linear',\n magFilter: 'linear',\n addressModeU: 'clamp-to-edge',\n addressModeV: 'clamp-to-edge'\n },\n // parameters: {\n // [GL.TEXTURE_MIN_FILTER]: GL.LINEAR,\n // [GL.TEXTURE_MAG_FILTER]: GL.LINEAR,\n // [GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,\n // [GL.TEXTURE_WRAP_T]: GL.CLAMP_TO_EDGE\n // }\n }) ;\n this._ownResources.push(texture);\n return texture;\n }\n\n /** Create a depth stencil attachment GL.DEPTH24_STENCIL8 */\n protected _createDepthStencilAttachment(): Renderbuffer | WebGLTexture {\n if (!this.props.depthStencilAttachment) {\n return undefined;\n }\n if (this.props.depthStencilAttachment instanceof Renderbuffer) {\n return this.props.depthStencilAttachment;\n }\n if (this.props.depthStencilAttachment instanceof Texture) {\n return this.props.depthStencilAttachment as unknown as WebGLTexture;\n }\n const format = this.props.depthStencilAttachment;\n const webglFormat = getWebGLTextureFormat(this.gl, format);\n\n const texture = new Renderbuffer(this.device, {\n id: `${this.id}-depth-stencil`, // TODO misleading if not depth and stencil?\n format: webglFormat,\n // dataFormat: GL.DEPTH_STENCIL,\n // type: GL.UNSIGNED_INT_24_8,\n width: this.width,\n height: this.height\n });\n this._ownResources.push(texture);\n return texture;\n }\n\n /** Attachment resize is expected to be a noop if size is same */\n protected _resizeAttachments(width: number, height: number): this {\n // for default framebuffer, just update the stored size\n if (this.handle === null) {\n // assert(width === undefined && height === undefined);\n this.width = this.gl.drawingBufferWidth;\n this.height = this.gl.drawingBufferHeight;\n return this;\n }\n if (width === undefined) {\n width = this.gl.drawingBufferWidth;\n }\n if (height === undefined) {\n height = this.gl.drawingBufferHeight;\n }\n\n if (width !== this.width && height !== this.height) {\n log.log(2, `Resizing framebuffer ${this.id} to ${width}x${height}`)();\n }\n\n for (const colorAttachment of this.colorAttachments) {\n colorAttachment.resize({width, height});\n }\n this.depthStencilAttachment?.resize({width, height});\n return this;\n }\n\n /** Attach one attachment */\n protected _attachOne(attachmentPoint: GL, attachment: Attachment): WebGLTexture | Renderbuffer {\n if (attachment instanceof Renderbuffer) {\n this._attachRenderbuffer(attachmentPoint, attachment);\n return attachment;\n } else if (Array.isArray(attachment)) {\n const [texture, layer = 0, level = 0] = attachment;\n this._attachTexture(attachmentPoint, texture as unknown as WebGLTexture, layer, level);\n return texture as unknown as WebGLTexture;\n } else if (attachment instanceof WebGLTexture) {\n this._attachTexture(attachmentPoint, attachment, 0, 0);\n return attachment;\n }\n throw new Error('attach');\n }\n\n protected _attachRenderbuffer(attachment: GL, renderbuffer: Renderbuffer): void {\n this.gl.framebufferRenderbuffer(\n GL.FRAMEBUFFER,\n attachment,\n GL.RENDERBUFFER,\n renderbuffer.handle\n );\n }\n\n /**\n * @param attachment\n * @param texture\n * @param layer = 0 - index into WebGLTextureArray and Texture3D or face for `TextureCubeMap`\n * @param level = 0 - mipmapLevel (must be 0 in WebGL1)\n */\n protected _attachTexture(attachment: GL, texture: WebGLTexture, layer: number, level: number): void {\n const {gl, gl2} = this.device;\n gl.bindTexture(texture.target, texture.handle);\n\n switch (texture.target) {\n case GL.TEXTURE_2D_ARRAY:\n case GL.TEXTURE_3D:\n this.device.assertWebGL2();\n gl2?.framebufferTextureLayer(GL.FRAMEBUFFER, attachment, texture.target, level, layer);\n break;\n\n case GL.TEXTURE_CUBE_MAP:\n // layer must be a cubemap face (or if index, converted to cube map face)\n const face = mapIndexToCubeMapFace(layer);\n gl.framebufferTexture2D(GL.FRAMEBUFFER, attachment, face, texture.handle, level);\n break;\n\n case GL.TEXTURE_2D:\n gl.framebufferTexture2D(GL.FRAMEBUFFER, attachment, GL.TEXTURE_2D, texture.handle, level);\n break;\n\n default:\n assert(false, 'Illegal texture type');\n }\n\n gl.bindTexture(texture.target, null);\n }\n}\n\n// Helper functions\n\n// Map an index to a cube map face constant\nfunction mapIndexToCubeMapFace(layer: number | GL): GL {\n // TEXTURE_CUBE_MAP_POSITIVE_X is a big value (0x8515)\n // if smaller assume layer is index, otherwise assume it is already a cube map face constant\n return layer < GL.TEXTURE_CUBE_MAP_POSITIVE_X ? layer + GL.TEXTURE_CUBE_MAP_POSITIVE_X : layer;\n}\n\n// Helper METHODS\n// Get a string describing the framebuffer error if installed\nfunction _getFrameBufferStatus(status: GL) {\n switch (status) {\n case GL.FRAMEBUFFER_COMPLETE:\n return 'success';\n case GL.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:\n return 'Mismatched attachments';\n case GL.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:\n return 'No attachments';\n case GL.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:\n return 'Height/width mismatch';\n case GL.FRAMEBUFFER_UNSUPPORTED:\n return 'Unsupported or split attachments';\n // WebGL2\n case GL.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:\n return 'Samples mismatch';\n // OVR_multiview2 extension\n // case GL.FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR: return 'baseViewIndex mismatch';\n default:\n return `${status}`;\n }\n}\n"],"mappings":";AAGA,SAAQA,WAAW,EAAEC,OAAO,EAAEC,GAAG,EAAEC,MAAM,QAAO,cAAc;AAC9D,OAAOC,EAAE,MAAM,oBAAoB;AAAC,OAE7BC,YAAY;AAAA,OACZC,YAAY;AAAA,SACXC,qBAAqB,EAAEC,8BAA8B;AAM7D,eAAe,MAAMC,gBAAgB,SAAST,WAAW,CAAC;EAKxD,IAAIU,OAAOA,CAAA,EAAG;IAAE,OAAO,IAAI,CAACC,gBAAgB,CAAC,CAAC,CAAC;EAAE;EAKjDC,WAAWA,CAACC,MAAmB,EAAEC,KAAuB,EAAE;IACxD,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,2BALqB,EAAE;IAAAA,eAAA,iCACS,IAAI;IAAAA,eAAA,wBACA,EAAE;IAI3D,IAAI,CAACF,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACG,EAAE,GAAGH,MAAM,CAACG,EAAE;IACnB,IAAI,CAACC,MAAM,GAAG,IAAI,CAACH,KAAK,CAACG,MAAM,KAAKC,SAAS,GAAG,IAAI,CAACJ,KAAK,CAACG,MAAM,GAAG,IAAI,CAACD,EAAE,CAACG,iBAAiB,EAAE;I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AU,EAAEuD,IAAI,EAAE3E,OAAO,CAACO,MAAM,EAAEuD,KAAK,CAAC;QAChF;MAEF,KAAKpE,EAAE,CAACoF,UAAU;QAChBxE,EAAE,CAACuE,oBAAoB,CAACnF,EAAE,CAACuB,WAAW,EAAEG,UAAU,EAAE1B,EAAE,CAACoF,UAAU,EAAE9E,OAAO,CAACO,MAAM,EAAEuD,KAAK,CAAC;QACzF;MAEF;QACErE,MAAM,CAAC,KAAK,EAAE,sBAAsB,CAAC;IAAC;IAG1Ca,EAAE,CAAC8D,WAAW,CAACpE,OAAO,CAACqE,MAAM,EAAE,IAAI,CAAC;EACtC;AACF;AAKA,SAASO,qBAAqBA,CAACf,KAAkB,EAAM;EAGrD,OAAOA,KAAK,GAAGnE,EAAE,CAACqF,2BAA2B,GAAGlB,KAAK,GAAGnE,EAAE,CAACqF,2BAA2B,GAAGlB,KAAK;AAChG;AAIA,SAASxB,qBAAqBA,CAACL,MAAU,EAAE;EACzC,QAAQA,MAAM;IACZ,KAAKtC,EAAE,CAACwC,oBAAoB;MAC1B,OAAO,SAAS;IAClB,KAAKxC,EAAE,CAACsF,iCAAiC;MACvC,OAAO,wBAAwB;IACjC,KAAKtF,EAAE,CAACuF,yCAAyC;MAC/C,OAAO,gBAAgB;IACzB,KAAKvF,EAAE,CAACwF,iCAAiC;MACvC,OAAO,uBAAuB;IAChC,KAAKxF,EAAE,CAACyF,uBAAuB;MAC7B,OAAO,kCAAkC;IAE3C,KAAKzF,EAAE,CAAC0F,kCAAkC;MACxC,OAAO,kBAAkB;IAG3B;MACE,UAAAhD,MAAA,CAAUJ,MAAM;EAAG;AAEzB"}
|
|
1
|
+
{"version":3,"file":"webgl-framebuffer.js","names":["Framebuffer","Texture","log","assert","GL","WEBGLTexture","WEBGLRenderbuffer","getWebGLTextureFormat","getWebGLDepthStencilAttachment","WEBGLFramebuffer","texture","colorAttachments","constructor","device","props","_defineProperty","gl","handle","undefined","createFramebuffer","setSpectorMetadata","id","_createColorAttachments","depthStencilAttachment","_createDepthStencilAttachment","prevHandle","bindFramebuffer","FRAMEBUFFER","i","length","attachment","attachmentPoint","COLOR_ATTACHMENT0","_attachOne","format","check","_checkStatus","destroy","resource","_ownResources","deleteFramebuffer","destroyed","status","checkFramebufferStatus","FRAMEBUFFER_COMPLETE","Error","concat","_getFrameBufferStatus","map","colorAttachment","_createColorAttachment","width","height","_createTexture","data","mipmaps","sampler","minFilter","magFilter","addressModeU","addressModeV","push","webglFormat","_resizeAttachments","_this$depthStencilAtt","drawingBufferWidth","drawingBufferHeight","resize","_attachWEBGLRenderbuffer","Array","isArray","layer","level","_attachTexture","renderbuffer","framebufferRenderbuffer","RENDERBUFFER","gl2","bindTexture","target","TEXTURE_2D_ARRAY","TEXTURE_3D","assertWebGL2","framebufferTextureLayer","TEXTURE_CUBE_MAP","face","mapIndexToCubeMapFace","framebufferTexture2D","TEXTURE_2D","TEXTURE_CUBE_MAP_POSITIVE_X","FRAMEBUFFER_INCOMPLETE_ATTACHMENT","FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT","FRAMEBUFFER_INCOMPLETE_DIMENSIONS","FRAMEBUFFER_UNSUPPORTED","FRAMEBUFFER_INCOMPLETE_MULTISAMPLE"],"sources":["../../../src/adapter/resources/webgl-framebuffer.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport type {FramebufferProps, ColorTextureFormat} from '@luma.gl/api';\nimport {Framebuffer, Texture, log, assert} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\nimport {WebGLDevice} from '../webgl-device';\nimport {WEBGLTexture} from './webgl-texture';\nimport {WEBGLRenderbuffer} from '../objects/webgl-renderbuffer';\nimport {getWebGLTextureFormat, getWebGLDepthStencilAttachment} from '../converters/texture-formats';\n\nexport type TextureAttachment = [Texture, number?, number?];\nexport type Attachment = WEBGLTexture | WEBGLRenderbuffer | TextureAttachment;\n\n/** luma.gl Framebuffer, WebGL implementation */\nexport class WEBGLFramebuffer extends Framebuffer {\n device: WebGLDevice;\n gl: WebGLRenderingContext;\n handle: WebGLFramebuffer;\n\n get texture() { return this.colorAttachments[0]; }\n readonly colorAttachments: WEBGLTexture[] = [];\n readonly depthStencilAttachment: WEBGLTexture | null = null;\n protected _ownResources: (WEBGLTexture | WEBGLRenderbuffer)[] = [];\n\n constructor(device: WebGLDevice, props: FramebufferProps) {\n super(device, props);\n this.device = device;\n this.gl = device.gl;\n this.handle = this.props.handle !== undefined ? this.props.handle : this.gl.createFramebuffer();\n\n if (this.handle) { // default framebuffer is null...\n device.setSpectorMetadata(this.handle, {id: this.props.id, props: this.props});\n }\n\n this.colorAttachments = this._createColorAttachments();\n // @ts-expect-error\n this.depthStencilAttachment = this._createDepthStencilAttachment();\n\n /** Attach from a map of attachments */\n const prevHandle = this.gl.bindFramebuffer(GL.FRAMEBUFFER, this.handle);\n\n // Walk the attachments\n for (let i = 0; i < this.colorAttachments.length; ++i) {\n const attachment = this.colorAttachments[i];\n const attachmentPoint = GL.COLOR_ATTACHMENT0 + i;\n if (attachment) {\n this._attachOne(attachmentPoint, attachment);\n }\n }\n\n if (this.props.depthStencilAttachment) {\n this._attachOne(getWebGLDepthStencilAttachment(this.depthStencilAttachment.format), this.depthStencilAttachment);\n }\n\n // @ts-expect-error\n this.gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);\n\n // @ts-expect-error\n if (props.check !== false) {\n this._checkStatus();\n }\n }\n\n override destroy(): void {\n if (this.handle !== null) {\n for (const resource of this._ownResources) {\n resource.destroy();\n }\n this.gl.deleteFramebuffer(this.handle);\n // this.handle = null;\n this.destroyed = true;\n }\n }\n\n // PRIVATE\n\n /** Check the status */\n protected _checkStatus(): void {\n const {gl} = this;\n const prevHandle = gl.bindFramebuffer(GL.FRAMEBUFFER, this.handle);\n const status = gl.checkFramebufferStatus(GL.FRAMEBUFFER);\n // @ts-expect-error\n gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);\n if (status !== gl.FRAMEBUFFER_COMPLETE) {\n throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);\n }\n }\n\n _createColorAttachments(): WEBGLTexture[] {\n return this.props.colorAttachments.map(colorAttachment => {\n if (!colorAttachment) {\n return undefined;\n }\n if (colorAttachment instanceof WEBGLTexture) {\n return colorAttachment;\n }\n // if (typeof colorAttachment === 'default') {\n // return this._createColorAttachment('rgba8unorm', this.width, this.height);\n // }\n // @ts-expect-error\n return this._createColorAttachment(colorAttachment, this.width, this.height);\n });\n }\n\n /** Create a color attachment */\n protected _createColorAttachment(format: ColorTextureFormat, width: number, height: number): WEBGLTexture {\n const texture = this.device._createTexture({\n id: `${this.id}-color`,\n data: null, // reserves texture memory, but texels are undefined\n format,\n // type: GL.UNSIGNED_BYTE,\n width,\n height,\n // Note: Mipmapping can be disabled by texture resource when we resize the texture\n // to a non-power-of-two dimenstion (NPOT texture) under WebGL1. To have consistant\n // behavior we always disable mipmaps.\n mipmaps: false,\n // Set MIN and MAG filtering parameters so mipmaps are not used in sampling.\n // Use LINEAR so subpixel algos like fxaa work.\n // Set WRAP modes that support NPOT textures too.\n sampler: {\n minFilter: 'linear',\n magFilter: 'linear',\n addressModeU: 'clamp-to-edge',\n addressModeV: 'clamp-to-edge'\n },\n // parameters: {\n // [GL.TEXTURE_MIN_FILTER]: GL.LINEAR,\n // [GL.TEXTURE_MAG_FILTER]: GL.LINEAR,\n // [GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,\n // [GL.TEXTURE_WRAP_T]: GL.CLAMP_TO_EDGE\n // }\n }) ;\n this._ownResources.push(texture);\n return texture;\n }\n\n /** Create a depth stencil attachment GL.DEPTH24_STENCIL8 */\n protected _createDepthStencilAttachment(): WEBGLRenderbuffer | WEBGLTexture {\n if (!this.props.depthStencilAttachment) {\n return undefined;\n }\n if (this.props.depthStencilAttachment instanceof WEBGLRenderbuffer) {\n return this.props.depthStencilAttachment;\n }\n if (this.props.depthStencilAttachment instanceof Texture) {\n return this.props.depthStencilAttachment as unknown as WEBGLTexture;\n }\n const format = this.props.depthStencilAttachment;\n const webglFormat = getWebGLTextureFormat(this.gl, format);\n\n const texture = new WEBGLRenderbuffer(this.device, {\n id: `${this.id}-depth-stencil`, // TODO misleading if not depth and stencil?\n format: webglFormat,\n // dataFormat: GL.DEPTH_STENCIL,\n // type: GL.UNSIGNED_INT_24_8,\n width: this.width,\n height: this.height\n });\n this._ownResources.push(texture);\n return texture;\n }\n\n /** Attachment resize is expected to be a noop if size is same */\n protected _resizeAttachments(width: number, height: number): this {\n // for default framebuffer, just update the stored size\n if (this.handle === null) {\n // assert(width === undefined && height === undefined);\n this.width = this.gl.drawingBufferWidth;\n this.height = this.gl.drawingBufferHeight;\n return this;\n }\n if (width === undefined) {\n width = this.gl.drawingBufferWidth;\n }\n if (height === undefined) {\n height = this.gl.drawingBufferHeight;\n }\n\n if (width !== this.width && height !== this.height) {\n log.log(2, `Resizing framebuffer ${this.id} to ${width}x${height}`)();\n }\n\n for (const colorAttachment of this.colorAttachments) {\n colorAttachment.resize({width, height});\n }\n this.depthStencilAttachment?.resize({width, height});\n return this;\n }\n\n /** Attach one attachment */\n protected _attachOne(attachmentPoint: GL, attachment: Attachment): WEBGLTexture | WEBGLRenderbuffer {\n if (attachment instanceof WEBGLRenderbuffer) {\n this._attachWEBGLRenderbuffer(attachmentPoint, attachment);\n return attachment;\n } else if (Array.isArray(attachment)) {\n const [texture, layer = 0, level = 0] = attachment;\n this._attachTexture(attachmentPoint, texture as unknown as WEBGLTexture, layer, level);\n return texture as unknown as WEBGLTexture;\n } else if (attachment instanceof WEBGLTexture) {\n this._attachTexture(attachmentPoint, attachment, 0, 0);\n return attachment;\n }\n throw new Error('attach');\n }\n\n protected _attachWEBGLRenderbuffer(attachment: GL, renderbuffer: WEBGLRenderbuffer): void {\n this.gl.framebufferRenderbuffer(\n GL.FRAMEBUFFER,\n attachment,\n GL.RENDERBUFFER,\n renderbuffer.handle\n );\n }\n\n /**\n * @param attachment\n * @param texture\n * @param layer = 0 - index into WEBGLTextureArray and Texture3D or face for `TextureCubeMap`\n * @param level = 0 - mipmapLevel (must be 0 in WebGL1)\n */\n protected _attachTexture(attachment: GL, texture: WEBGLTexture, layer: number, level: number): void {\n const {gl, gl2} = this.device;\n gl.bindTexture(texture.target, texture.handle);\n\n switch (texture.target) {\n case GL.TEXTURE_2D_ARRAY:\n case GL.TEXTURE_3D:\n this.device.assertWebGL2();\n gl2?.framebufferTextureLayer(GL.FRAMEBUFFER, attachment, texture.target, level, layer);\n break;\n\n case GL.TEXTURE_CUBE_MAP:\n // layer must be a cubemap face (or if index, converted to cube map face)\n const face = mapIndexToCubeMapFace(layer);\n gl.framebufferTexture2D(GL.FRAMEBUFFER, attachment, face, texture.handle, level);\n break;\n\n case GL.TEXTURE_2D:\n gl.framebufferTexture2D(GL.FRAMEBUFFER, attachment, GL.TEXTURE_2D, texture.handle, level);\n break;\n\n default:\n assert(false, 'Illegal texture type');\n }\n\n gl.bindTexture(texture.target, null);\n }\n}\n\n// Helper functions\n\n// Map an index to a cube map face constant\nfunction mapIndexToCubeMapFace(layer: number | GL): GL {\n // TEXTURE_CUBE_MAP_POSITIVE_X is a big value (0x8515)\n // if smaller assume layer is index, otherwise assume it is already a cube map face constant\n return layer < GL.TEXTURE_CUBE_MAP_POSITIVE_X ? layer + GL.TEXTURE_CUBE_MAP_POSITIVE_X : layer;\n}\n\n// Helper METHODS\n// Get a string describing the framebuffer error if installed\nfunction _getFrameBufferStatus(status: GL) {\n switch (status) {\n case GL.FRAMEBUFFER_COMPLETE:\n return 'success';\n case GL.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:\n return 'Mismatched attachments';\n case GL.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:\n return 'No attachments';\n case GL.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:\n return 'Height/width mismatch';\n case GL.FRAMEBUFFER_UNSUPPORTED:\n return 'Unsupported or split attachments';\n // WebGL2\n case GL.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:\n return 'Samples mismatch';\n // OVR_multiview2 extension\n // case GL.FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR: return 'baseViewIndex mismatch';\n default:\n return `${status}`;\n }\n}\n"],"mappings":";AAGA,SAAQA,WAAW,EAAEC,OAAO,EAAEC,GAAG,EAAEC,MAAM,QAAO,cAAc;AAC9D,OAAOC,EAAE,MAAM,oBAAoB;AAAC,SAE5BC,YAAY;AAAA,SACZC,iBAAiB;AAAA,SACjBC,qBAAqB,EAAEC,8BAA8B;AAM7D,OAAO,MAAMC,gBAAgB,SAAST,WAAW,CAAC;EAKhD,IAAIU,OAAOA,CAAA,EAAG;IAAE,OAAO,IAAI,CAACC,gBAAgB,CAAC,CAAC,CAAC;EAAE;EAKjDC,WAAWA,CAACC,MAAmB,EAAEC,KAAuB,EAAE;IACxD,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,2BALqB,EAAE;IAAAA,eAAA,iCACS,IAAI;IAAAA,eAAA,wBACK,EAAE;IAIhE,IAAI,CAACF,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACG,EAAE,GAAGH,MAAM,CAACG,EAAE;IACnB,IAAI,CAACC,MAAM,GAAG,IAAI,CAACH,KAAK,CAACG,MAAM,KAAKC,SAAS,GAAG,IAAI,CAACJ,KAAK,CAACG,MAAM,GAAG,IAAI,CAACD,EAAE,CAACG,iBAAiB,EAAE;IAE/F,IAAI,IAAI,CAACF,MAAM,EAAE;MACfJ,MAAM,CAACO,kBAAkB,CAAC,IAAI,CAACH,MAAM,EAAE;QAACI,EAAE,EAAE,IAAI,CAACP,KAAK,CAACO,EAAE;QAAEP,KAAK,EAAE,IAAI,CAACA;MAAK,CAAC,CAAC;IAChF;IAEA,IAAI,CAACH,gBAAgB,GAAG,IAAI,CAACW,uBAAuB,EAAE;IAEtD,IAAI,CAACC,sBAAsB,GAAG,IAAI,CAACC,6BAA6B,EAAE;IAGlE,MAAMC,UAAU,G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8D,WAAW,CAACpE,OAAO,CAACqE,MAAM,EAAE,IAAI,CAAC;EACtC;AACF;AAKA,SAASO,qBAAqBA,CAACf,KAAkB,EAAM;EAGrD,OAAOA,KAAK,GAAGnE,EAAE,CAACqF,2BAA2B,GAAGlB,KAAK,GAAGnE,EAAE,CAACqF,2BAA2B,GAAGlB,KAAK;AAChG;AAIA,SAASxB,qBAAqBA,CAACL,MAAU,EAAE;EACzC,QAAQA,MAAM;IACZ,KAAKtC,EAAE,CAACwC,oBAAoB;MAC1B,OAAO,SAAS;IAClB,KAAKxC,EAAE,CAACsF,iCAAiC;MACvC,OAAO,wBAAwB;IACjC,KAAKtF,EAAE,CAACuF,yCAAyC;MAC/C,OAAO,gBAAgB;IACzB,KAAKvF,EAAE,CAACwF,iCAAiC;MACvC,OAAO,uBAAuB;IAChC,KAAKxF,EAAE,CAACyF,uBAAuB;MAC7B,OAAO,kCAAkC;IAE3C,KAAKzF,EAAE,CAAC0F,kCAAkC;MACxC,OAAO,kBAAkB;IAG3B;MACE,UAAAhD,MAAA,CAAUJ,MAAM;EAAG;AAEzB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RenderPass, RenderPassProps } from '@luma.gl/api';
|
|
2
|
-
import WebGLDevice from '../webgl-device';
|
|
3
|
-
export
|
|
2
|
+
import { WebGLDevice } from '../webgl-device';
|
|
3
|
+
export declare class WEBGLRenderPass extends RenderPass {
|
|
4
4
|
readonly device: WebGLDevice;
|
|
5
5
|
constructor(device: WebGLDevice, props: RenderPassProps);
|
|
6
6
|
end(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-render-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-render-pass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,eAAe,EAAC,MAAM,cAAc,CAAC;AACzD,OAAO,WAAW,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"webgl-render-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-render-pass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,eAAe,EAAC,MAAM,cAAc,CAAC;AACzD,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAE5C,qBAAa,eAAgB,SAAQ,UAAU;IAC7C,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;gBAEjB,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,eAAe;IAKvD,GAAG,IAAI,IAAI;IAEX,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IACxC,aAAa,IAAI,IAAI;IACrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAQ7C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import { RenderPass } from '@luma.gl/api';
|
|
3
|
-
export
|
|
3
|
+
export class WEBGLRenderPass extends RenderPass {
|
|
4
4
|
constructor(device, props) {
|
|
5
5
|
super(device, props);
|
|
6
6
|
_defineProperty(this, "device", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-render-pass.js","names":["RenderPass","WEBGLRenderPass","constructor","device","props","_defineProperty","end","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"sources":["../../../src/adapter/resources/webgl-render-pass.ts"],"sourcesContent":["import {RenderPass, RenderPassProps} from '@luma.gl/api';\nimport WebGLDevice from '../webgl-device';\n\nexport
|
|
1
|
+
{"version":3,"file":"webgl-render-pass.js","names":["RenderPass","WEBGLRenderPass","constructor","device","props","_defineProperty","end","pushDebugGroup","groupLabel","popDebugGroup","insertDebugMarker","markerLabel"],"sources":["../../../src/adapter/resources/webgl-render-pass.ts"],"sourcesContent":["import {RenderPass, RenderPassProps} from '@luma.gl/api';\nimport {WebGLDevice} from '../webgl-device';\n\nexport class WEBGLRenderPass extends RenderPass {\n readonly device: WebGLDevice;\n\n constructor(device: WebGLDevice, props: RenderPassProps) {\n super(device, props);\n this.device = device;\n }\n\n end(): void {}\n\n pushDebugGroup(groupLabel: string): void {}\n popDebugGroup(): void {}\n insertDebugMarker(markerLabel: string): void {}\n\n // writeTimestamp(querySet: GPUQuerySet, queryIndex: number): void;\n\n // beginOcclusionQuery(queryIndex: number): void;\n // endOcclusionQuery(): void;\n\n // executeBundles(bundles: Iterable<GPURenderBundle>): void;\n}\n"],"mappings":";AAAA,SAAQA,UAAU,QAAwB,cAAc;AAGxD,OAAO,MAAMC,eAAe,SAASD,UAAU,CAAC;EAG9CE,WAAWA,CAACC,MAAmB,EAAEC,KAAsB,EAAE;IACvD,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IACrB,IAAI,CAACF,MAAM,GAAGA,MAAM;EACtB;EAEAG,GAAGA,CAAA,EAAS,CAAC;EAEbC,cAAcA,CAACC,UAAkB,EAAQ,CAAC;EAC1CC,aAAaA,CAAA,EAAS,CAAC;EACvBC,iBAAiBA,CAACC,WAAmB,EAAQ,CAAC;AAQhD"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { RenderPipelineProps, RenderPass, Buffer, Binding, ShaderLayout } from '@luma.gl/api';
|
|
2
2
|
import { RenderPipeline } from '@luma.gl/api';
|
|
3
|
-
import WebGLDevice from '../webgl-device';
|
|
4
|
-
import WEBGLShader from './webgl-shader';
|
|
5
|
-
import WEBGLVertexArrayObject from '../objects/webgl-vertex-array-object';
|
|
3
|
+
import { WebGLDevice } from '../webgl-device';
|
|
4
|
+
import { WEBGLShader } from './webgl-shader';
|
|
5
|
+
import { WEBGLVertexArrayObject } from '../objects/webgl-vertex-array-object';
|
|
6
6
|
/** Creates a new render pipeline */
|
|
7
|
-
export
|
|
7
|
+
export declare class WEBGLRenderPipeline extends RenderPipeline {
|
|
8
8
|
device: WebGLDevice;
|
|
9
9
|
handle: WebGLProgram;
|
|
10
10
|
vs: WEBGLShader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-render-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EACV,MAAM,EACN,OAAO,EACP,YAAY,EAIb,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,cAAc,EAAgC,MAAM,cAAc,CAAC;AAS3E,OAAO,WAAW,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"webgl-render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-render-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EACV,MAAM,EACN,OAAO,EACP,YAAY,EAIb,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,cAAc,EAAgC,MAAM,cAAc,CAAC;AAS3E,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAC,sBAAsB,EAAC,MAAM,sCAAsC,CAAC;AAI5E,oCAAoC;AACpC,qBAAa,mBAAoB,SAAQ,cAAc;IACrD,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,YAAY,CAAC;IACrB,EAAE,EAAE,WAAW,CAAC;IAChB,EAAE,EAAE,WAAW,CAAC;IAChB,MAAM,EAAE,YAAY,CAAC;IAIrB,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAQ;IACjC,iBAAiB,EAAE,sBAAsB,CAAC;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IACnC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IACnC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAC3C,oBAAoB,EAAE,MAAM,CAAK;IACjC,aAAa,EAAE,MAAM,CAAK;IAC1B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAM;gBAEnC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,mBAAmB;IA2BlD,OAAO,IAAI,IAAI;IAQxB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAMzC,sCAAsC;IACtC,aAAa,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAwBvD,sCAAsC;IACtC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAqCpD,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAKzC;;;OAGG;IACH,IAAI,CAAC,OAAO,EAAE;QACZ,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO;IA2EX,SAAS,CAAC,eAAe;IA0BzB;;;;OAIG;IACH,sBAAsB;IAkBtB,yBAAyB;IACzB,cAAc;IA6Dd,cAAc;CASf"}
|
|
@@ -5,11 +5,11 @@ import { getWebGLDataType } from "../converters/texture-formats.js";
|
|
|
5
5
|
import { getShaderLayout } from "../helpers/get-shader-layout.js";
|
|
6
6
|
import { withDeviceParameters, withGLParameters } from "../converters/device-parameters.js";
|
|
7
7
|
import { setUniform } from "../helpers/set-uniform.js";
|
|
8
|
-
import WEBGLBuffer from "./webgl-buffer.js";
|
|
9
|
-
import WEBGLTexture from "./webgl-texture.js";
|
|
10
|
-
import WEBGLVertexArrayObject from "../objects/webgl-vertex-array-object.js";
|
|
8
|
+
import { WEBGLBuffer } from "./webgl-buffer.js";
|
|
9
|
+
import { WEBGLTexture } from "./webgl-texture.js";
|
|
10
|
+
import { WEBGLVertexArrayObject } from "../objects/webgl-vertex-array-object.js";
|
|
11
11
|
const LOG_PROGRAM_PERF_PRIORITY = 4;
|
|
12
|
-
export
|
|
12
|
+
export class WEBGLRenderPipeline extends RenderPipeline {
|
|
13
13
|
constructor(device, props) {
|
|
14
14
|
super(device, props);
|
|
15
15
|
_defineProperty(this, "device", void 0);
|