@luma.gl/webgl 9.0.0-alpha.45 → 9.0.0-alpha.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/adapter/device-helpers/device-features.js +1 -0
  2. package/dist/adapter/device-helpers/device-features.js.map +1 -1
  3. package/dist/adapter/helpers/webgl-topology-utils.d.ts +6 -1
  4. package/dist/adapter/helpers/webgl-topology-utils.d.ts.map +1 -1
  5. package/dist/adapter/helpers/webgl-topology-utils.js +40 -0
  6. package/dist/adapter/helpers/webgl-topology-utils.js.map +1 -1
  7. package/dist/adapter/resources/webgl-buffer.d.ts +1 -1
  8. package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
  9. package/dist/adapter/resources/webgl-buffer.js +2 -0
  10. package/dist/adapter/resources/webgl-buffer.js.map +1 -1
  11. package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
  12. package/dist/adapter/resources/webgl-command-buffer.js +6 -4
  13. package/dist/adapter/resources/webgl-command-buffer.js.map +1 -1
  14. package/dist/adapter/resources/webgl-render-pipeline.d.ts +2 -0
  15. package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
  16. package/dist/adapter/resources/webgl-render-pipeline.js +4 -44
  17. package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
  18. package/dist/adapter/resources/webgl-transform-feedback.d.ts +47 -0
  19. package/dist/adapter/resources/webgl-transform-feedback.d.ts.map +1 -0
  20. package/dist/adapter/resources/webgl-transform-feedback.js +165 -0
  21. package/dist/adapter/resources/webgl-transform-feedback.js.map +1 -0
  22. package/dist/adapter/resources/webgl-vertex-array.d.ts.map +1 -1
  23. package/dist/adapter/resources/webgl-vertex-array.js +5 -3
  24. package/dist/adapter/resources/webgl-vertex-array.js.map +1 -1
  25. package/dist/adapter/webgl-device.d.ts +4 -2
  26. package/dist/adapter/webgl-device.d.ts.map +1 -1
  27. package/dist/adapter/webgl-device.js +7 -3
  28. package/dist/adapter/webgl-device.js.map +1 -1
  29. package/dist/classic/copy-and-blit.d.ts +3 -3
  30. package/dist/classic/copy-and-blit.d.ts.map +1 -1
  31. package/dist/classic/copy-and-blit.js +12 -20
  32. package/dist/classic/copy-and-blit.js.map +1 -1
  33. package/dist/classic/typed-array-utils.d.ts +2 -0
  34. package/dist/classic/typed-array-utils.d.ts.map +1 -1
  35. package/dist/classic/typed-array-utils.js.map +1 -1
  36. package/dist/dist.dev.js +2144 -2302
  37. package/dist/index.cjs +645 -802
  38. package/dist/index.d.ts +1 -2
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +1 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist.min.js +23 -22
  43. package/package.json +5 -5
  44. package/src/adapter/device-helpers/device-features.ts +1 -0
  45. package/src/adapter/helpers/webgl-topology-utils.ts +40 -0
  46. package/src/adapter/resources/webgl-buffer.ts +12 -8
  47. package/src/adapter/resources/webgl-command-buffer.ts +7 -13
  48. package/src/adapter/resources/webgl-render-pipeline.ts +11 -47
  49. package/src/adapter/resources/webgl-transform-feedback.ts +202 -0
  50. package/src/adapter/resources/webgl-vertex-array.ts +11 -8
  51. package/src/adapter/webgl-device.ts +10 -5
  52. package/src/classic/copy-and-blit.ts +16 -19
  53. package/src/classic/typed-array-utils.ts +2 -0
  54. package/src/index.ts +5 -4
  55. package/dist/classic/buffer-with-accessor.d.ts +0 -82
  56. package/dist/classic/buffer-with-accessor.d.ts.map +0 -1
  57. package/dist/classic/buffer-with-accessor.js +0 -314
  58. package/dist/classic/buffer-with-accessor.js.map +0 -1
  59. package/src/classic/buffer-with-accessor.ts +0 -466
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-render-pipeline.js","names":["RenderPipeline","cast","splitUniformsAndBindings","log","mergeShaderLayout","GL","getShaderLayout","withDeviceAndGLParameters","setUniform","WEBGLBuffer","WEBGLFramebuffer","WEBGLTexture","LOG_PROGRAM_PERF_PRIORITY","WEBGLRenderPipeline","constructor","device","props","handle","vs","fs","introspectedLayout","uniforms","bindings","varyings","_uniformCount","_uniformSetters","gl","createProgram","setSpectorMetadata","id","bufferMode","SEPARATE_ATTRIBS","length","_this$device$gl","assertWebGL2","gl2","transformFeedbackVaryings","_compileAndLink","shaderLayout","destroy","deleteProgram","destroyed","setBindings","name","value","Object","entries","binding","find","validBindings","map","join","warn","type","buffer","Error","setUniforms","keys","forEach","assign","draw","options","_vertexArray$indexBuf","renderPass","vertexArray","vertexCount","instanceCount","firstVertex","glDrawMode","getGLDrawMode","topology","isIndexed","Boolean","indexBuffer","glIndexType","isInstanced","Number","_areTexturesRenderable","useProgram","bindBeforeRender","primitiveMode","getGLPrimitive","transformFeedback","begin","_applyBindings","_applyUniforms","webglRenderPass","parameters","glParameters","_this$device$gl2","drawElementsInstanced","drawElements","_this$device$gl3","drawArraysInstanced","drawArrays","end","unbindAfterRender","attachShader","time","linkProgram","timeEnd","debug","level","linked","getProgramParameter","LINK_STATUS","getProgramInfoLog","validateProgram","validated","VALIDATE_STATUS","texturesRenderable","texture","update","loaded","textureUnit","uniformBufferIndex","replace","location","getUniformBlockIndex","INVALID_INDEX","uniformBlockBinding","bindBufferBase","UNIFORM_BUFFER","bindBufferRange","offset","size","byteLength","colorAttachments","activeTexture","TEXTURE0","bindTexture","target","uniformLayout","_this$uniforms$name","undefined","POINTS","LINES","LINE_STRIP","LINE_LOOP","TRIANGLES","TRIANGLE_STRIP","TRIANGLE_FAN"],"sources":["../../../src/adapter/resources/webgl-render-pipeline.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {UniformValue, RenderPipelineProps, Binding} from '@luma.gl/core';\nimport type {ShaderLayout, PrimitiveTopology} from '@luma.gl/core';\nimport type {RenderPass, VertexArray} from '@luma.gl/core';\nimport {RenderPipeline, cast, splitUniformsAndBindings, log} from '@luma.gl/core';\nimport {mergeShaderLayout} from '@luma.gl/core';\n// import {mergeShaderLayout, getAttributeInfosFromLayouts} from '@luma.gl/core';\nimport {GL} from '@luma.gl/constants';\n\nimport {getShaderLayout} from '../helpers/get-shader-layout';\nimport {withDeviceAndGLParameters} from '../converters/device-parameters';\nimport {setUniform} from '../helpers/set-uniform';\n// import {copyUniform, checkUniformValues} from '../../classes/uniforms';\n\nimport {WebGLDevice} from '../webgl-device';\nimport {WEBGLBuffer} from './webgl-buffer';\nimport {WEBGLShader} from './webgl-shader';\nimport {WEBGLFramebuffer} from './webgl-framebuffer';\nimport {WEBGLTexture} from './webgl-texture';\n// import {WEBGLVertexArray} from './webgl-vertex-array';\nimport {WEBGLRenderPass} from './webgl-render-pass';\n\nconst LOG_PROGRAM_PERF_PRIORITY = 4;\n\n/** Creates a new render pipeline */\nexport class WEBGLRenderPipeline extends RenderPipeline {\n /** The WebGL device that created this render pipeline */\n device: WebGLDevice;\n /** Handle to underlying WebGL program */\n handle: WebGLProgram;\n /** vertex shader */\n vs: WEBGLShader;\n /** fragment shader */\n fs: WEBGLShader;\n /** The layout extracted from shader by WebGL introspection APIs */\n introspectedLayout: ShaderLayout;\n\n /** Uniforms set on this model */\n uniforms: Record<string, UniformValue> = {};\n /** Bindings set on this model */\n bindings: Record<string, Binding> = {};\n /** WebGL varyings */\n varyings: string[] | null = null;\n\n _uniformCount: number = 0;\n _uniformSetters: Record<string, Function> = {}; // TODO are these used?\n\n constructor(device: WebGLDevice, props: RenderPipelineProps) {\n super(device, props);\n this.device = device;\n this.handle = this.props.handle || this.device.gl.createProgram();\n this.device.setSpectorMetadata(this.handle, {id: this.props.id});\n\n // Create shaders if needed\n this.vs = cast<WEBGLShader>(props.vs);\n this.fs = cast<WEBGLShader>(props.fs);\n // assert(this.vs.stage === 'vertex');\n // assert(this.fs.stage === 'fragment');\n\n // Setup varyings if supplied\n // @ts-expect-error WebGL only\n const {varyings, bufferMode = GL.SEPARATE_ATTRIBS} = props;\n if (varyings && varyings.length > 0) {\n this.device.assertWebGL2();\n this.varyings = varyings;\n this.device.gl2?.transformFeedbackVaryings(this.handle, varyings, bufferMode);\n }\n\n this._compileAndLink();\n\n this.introspectedLayout = getShaderLayout(this.device.gl, this.handle);\n // Merge provided layout with introspected layout\n this.shaderLayout = mergeShaderLayout(this.introspectedLayout, props.shaderLayout);\n // Merge layout with any buffer map overrides\n // this.bufferLayout = props.bufferLayout || [];\n // this.shaderLayout = mergeBufferMap(this.shaderLayout, this.bufferLayout);\n }\n\n override destroy(): void {\n if (this.handle) {\n this.device.gl.deleteProgram(this.handle);\n // this.handle = null;\n this.destroyed = true;\n }\n }\n\n // setIndexBuffer(indexBuffer: Buffer): void {\n // const webglBuffer = cast<WEBGLBuffer>(indexBuffer);\n // this.vertexArrayObject.setElementBuffer(webglBuffer);\n // this._indexBuffer = indexBuffer;\n // }\n\n // /** @todo needed for portable model */\n // setAttributes(attributes: Record<string, Buffer>): void {\n // for (const [name, buffer] of Object.entries(attributes)) {\n // const webglBuffer = cast<WEBGLBuffer>(buffer);\n // const attribute = getAttributeLayout(this.layout, name);\n // if (!attribute) {\n // log.warn(\n // `Ignoring buffer supplied for unknown attribute \"${name}\" in pipeline \"${this.id}\" (buffer \"${buffer.id}\")`\n // )();\n // continue;\n // }\n // const decoded = decodeVertexFormat(attribute.format);\n // const {type: typeString, components: size, byteLength: stride, normalized, integer} = decoded;\n // const divisor = attribute.stepMode === 'instance' ? 1 : 0;\n // const type = getWebGLDataType(typeString);\n // this.vertexArrayObject.setBuffer(attribute.location, webglBuffer, {\n // size,\n // type,\n // stride,\n // offset: 0,\n // normalized,\n // integer,\n // divisor\n // });\n // }\n // }\n\n /**\n * Bindings include: textures, samplers and uniform buffers\n * @todo needed for portable model\n */\n setBindings(bindings: Record<string, Binding>): void {\n // if (log.priority >= 2) {\n // checkUniformValues(uniforms, this.id, this._uniformSetters);\n // }\n\n for (const [name, value] of Object.entries(bindings)) {\n // Accept both `xyz` and `xyzUniforms` as valid names for `xyzUniforms` uniform block\n // This convention allows shaders to name uniform blocks as `uniform appUniforms {} app;`\n // and reference them as `app` from both GLSL and JS.\n // TODO - this is rather hacky - we could also remap the name directly in the shader layout.\n const binding = \n this.shaderLayout.bindings.find(binding => binding.name === name) ||\n this.shaderLayout.bindings.find(binding => binding.name === `${name}Uniforms`);\n\n if (!binding) {\n const validBindings = this.shaderLayout.bindings\n .map(binding => `\"${binding.name}\"`)\n .join(', ');\n log.warn(\n `Unknown binding \"${name}\" in render pipeline \"${this.id}\", expected one of ${validBindings}`\n )();\n continue; // eslint-disable-line no-continue\n }\n if (!value) {\n log.warn(`Unsetting binding \"${name}\" in render pipeline \"${this.id}\"`)();\n }\n switch (binding.type) {\n case 'uniform':\n // @ts-expect-error\n if (!(value instanceof WEBGLBuffer) && !(value.buffer instanceof WEBGLBuffer)) {\n throw new Error('buffer value');\n }\n break;\n case 'texture':\n if (!(value instanceof WEBGLTexture || value instanceof WEBGLFramebuffer)) {\n throw new Error('texture value');\n }\n break;\n case 'sampler':\n log.warn(`Ignoring sampler ${name}`)();\n break;\n default:\n throw new Error(binding.type);\n }\n\n this.bindings[name] = value;\n }\n }\n\n setUniforms(uniforms: Record<string, UniformValue>) {\n const {bindings} = splitUniformsAndBindings(uniforms);\n Object.keys(bindings).forEach(name => {\n log.warn(\n `Unsupported value \"${bindings[name]}\" used in setUniforms() for key ${name}. Use setBindings() instead?`\n )();\n });\n // TODO - check against layout\n Object.assign(this.uniforms, uniforms);\n }\n\n /** @todo needed for portable model\n * @note The WebGL API is offers many ways to draw things\n * This function unifies those ways into a single call using common parameters with sane defaults\n */\n draw(options: {\n renderPass: RenderPass;\n /** vertex attributes */\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 {\n renderPass,\n vertexArray,\n vertexCount,\n // indexCount,\n instanceCount,\n firstVertex = 0\n // firstIndex,\n // firstInstance,\n // baseVertex\n } = options;\n\n const glDrawMode = getGLDrawMode(this.props.topology);\n const isIndexed: boolean = Boolean(vertexArray.indexBuffer);\n const glIndexType = (vertexArray.indexBuffer as WEBGLBuffer)?.glIndexType;\n const isInstanced: boolean = Number(instanceCount) > 0;\n\n // Avoid WebGL draw call when not rendering any data or values are incomplete\n // Note: async textures set as uniforms might still be loading.\n // Now that all uniforms have been updated, check if any texture\n // in the uniforms is not yet initialized, then we don't draw\n if (!this._areTexturesRenderable() || vertexCount === 0) {\n // (isInstanced && instanceCount === 0)\n return false;\n }\n\n this.device.gl.useProgram(this.handle);\n\n // Note: Rebinds constant attributes before each draw call\n vertexArray.bindBeforeRender(renderPass);\n\n const primitiveMode = getGLPrimitive(this.props.topology);\n const transformFeedback: any = null;\n if (transformFeedback) {\n transformFeedback.begin(primitiveMode);\n }\n\n // We have to apply bindings before every draw call since other draw calls will overwrite\n this._applyBindings();\n this._applyUniforms();\n\n const webglRenderPass = renderPass as WEBGLRenderPass;\n // // TODO - Use polyfilled WebGL2RenderingContext instead of ANGLE extension\n // if (isIndexed && isInstanced) {\n // // ANGLE_instanced_arrays extension\n // this.device.gl2?.drawElementsInstanced(\n // drawMode,\n // vertexCount || 0, // indexCount?\n // indexType,\n // firstVertex,\n // instanceCount || 0\n // );\n // // } else if (isIndexed && this.device.isWebGL2 && !isNaN(start) && !isNaN(end)) {\n // // this.device.gl2.drawRangeElements(drawMode, start, end, vertexCount, indexType, offset);\n // } else if (isIndexed) {\n // this.device.gl.drawElements(drawMode, vertexCount || 0, indexType, firstVertex); // indexCount?\n // } else if (isInstanced) {\n // this.device.gl2?.drawArraysInstanced(\n // drawMode,\n // firstVertex,\n // vertexCount || 0,\n // instanceCount || 0\n // );\n // } else {\n // this.device.gl.drawArrays(drawMode, firstVertex, vertexCount || 0);\n // }\n // });\n\n withDeviceAndGLParameters(\n this.device,\n this.props.parameters,\n webglRenderPass.glParameters,\n () => {\n if (isIndexed && isInstanced) {\n // ANGLE_instanced_arrays extension\n this.device.gl2?.drawElementsInstanced(\n glDrawMode,\n vertexCount || 0, // indexCount?\n glIndexType,\n firstVertex,\n instanceCount || 0\n );\n // } else if (isIndexed && this.device.isWebGL2 && !isNaN(start) && !isNaN(end)) {\n // this.device.gl2.drawRangeElements(glDrawMode, start, end, vertexCount, glIndexType, offset);\n } else if (isIndexed) {\n this.device.gl.drawElements(glDrawMode, vertexCount || 0, glIndexType, firstVertex); // indexCount?\n } else if (isInstanced) {\n this.device.gl2?.drawArraysInstanced(\n glDrawMode,\n firstVertex,\n vertexCount || 0,\n instanceCount || 0\n );\n } else {\n this.device.gl.drawArrays(glDrawMode, firstVertex, vertexCount || 0);\n }\n\n if (transformFeedback) {\n transformFeedback.end();\n }\n }\n );\n\n vertexArray.unbindAfterRender(renderPass);\n\n return true;\n }\n\n // setAttributes(attributes: Record<string, Buffer>): void {}\n // setBindings(bindings: Record<string, Binding>): void {}\n\n protected _compileAndLink() {\n const {gl} = this.device;\n gl.attachShader(this.handle, this.vs.handle);\n gl.attachShader(this.handle, this.fs.handle);\n log.time(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();\n gl.linkProgram(this.handle);\n log.timeEnd(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();\n\n // Avoid checking program linking error in production\n // @ts-expect-error\n if (!gl.debug && log.level === 0) {\n // return;\n }\n\n const linked = gl.getProgramParameter(this.handle, gl.LINK_STATUS);\n if (!linked) {\n throw new Error(`Error linking: ${gl.getProgramInfoLog(this.handle)}`);\n }\n\n gl.validateProgram(this.handle);\n const validated = gl.getProgramParameter(this.handle, gl.VALIDATE_STATUS);\n if (!validated) {\n throw new Error(`Error validating: ${gl.getProgramInfoLog(this.handle)}`);\n }\n }\n\n // PRIVATE METHODS\n\n /**\n * Checks if all texture-values uniforms are renderable (i.e. loaded)\n * Update a texture if needed (e.g. from video)\n * Note: This is currently done before every draw call\n */\n _areTexturesRenderable() {\n let texturesRenderable = true;\n\n for (const [, texture] of Object.entries(this.bindings)) {\n if (texture instanceof WEBGLTexture) {\n texture.update();\n texturesRenderable = texturesRenderable && texture.loaded;\n }\n }\n\n return texturesRenderable;\n }\n\n /**\n * Constant attributes need to be reset before every draw call\n * Any attribute that is disabled in the current vertex array object\n * is read from the context's global constant value for that attribute location.\n * @note Constant attributes are only supported in WebGL, not in WebGPU\n *\n _applyConstantAttributes(vertexArray: WEBGLVertexArray): void {\n const attributeInfos = getAttributeInfosFromLayouts(this.shaderLayout, this.bufferLayout);\n for (const [name, value] of Object.entries(this.)) {\n const attributeInfo = attributeInfos[name];\n if (!attributeInfo) {\n log.warn(\n `Ignoring constant value supplied for unknown attribute \"${name}\" in pipeline \"${this.id}\"`\n )();\n continue; // eslint-disable-line no-continue\n }\n vertexArray.setConstant(attributeInfo.location, value);\n vertexArray.enable(attributeInfo.location, false);\n }\n }\n */\n\n /** Apply any bindings (before each draw call) */\n _applyBindings() {\n this.device.gl.useProgram(this.handle);\n\n const {gl2} = this.device;\n if (!gl2) {\n throw new Error('bindings');\n }\n\n let textureUnit = 0;\n let uniformBufferIndex = 0;\n for (const binding of this.shaderLayout.bindings) {\n // Accept both `xyz` and `xyzUniforms` as valid names for `xyzUniforms` uniform block\n const value = this.bindings[binding.name] || this.bindings[binding.name.replace(/Uniforms$/, '')];\n if (!value) {\n throw new Error(`No value for binding ${binding.name} in ${this.id}`);\n }\n switch (binding.type) {\n case 'uniform':\n // Set buffer\n const {name} = binding;\n const location = gl2.getUniformBlockIndex(this.handle, name);\n if (location === GL.INVALID_INDEX) {\n throw new Error(`Invalid uniform block name ${name}`);\n }\n gl2.uniformBlockBinding(this.handle, uniformBufferIndex, location);\n // console.debug(binding, location);\n if (value instanceof WEBGLBuffer) {\n gl2.bindBufferBase(GL.UNIFORM_BUFFER, uniformBufferIndex, value.handle);\n } else {\n gl2.bindBufferRange(\n GL.UNIFORM_BUFFER,\n uniformBufferIndex,\n // @ts-expect-error\n value.buffer.handle,\n // @ts-expect-error\n value.offset || 0,\n // @ts-expect-error\n value.size || value.buffer.byteLength - value.offset\n );\n }\n uniformBufferIndex += 1;\n break;\n\n case 'texture':\n if (!(value instanceof WEBGLTexture || value instanceof WEBGLFramebuffer)) {\n throw new Error('texture');\n }\n let texture: WEBGLTexture;\n if (value instanceof WEBGLTexture) {\n texture = value;\n } else if (\n value instanceof WEBGLFramebuffer &&\n value.colorAttachments[0] instanceof WEBGLTexture\n ) {\n log.warn(\n 'Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead'\n )();\n texture = value.colorAttachments[0];\n } else {\n throw new Error('No texture');\n }\n\n gl2.activeTexture(GL.TEXTURE0 + textureUnit);\n gl2.bindTexture(texture.target, texture.handle);\n // gl2.bindSampler(textureUnit, sampler.handle);\n textureUnit += 1;\n break;\n\n case 'sampler':\n // ignore\n break;\n\n case 'storage':\n case 'read-only-storage':\n throw new Error(`binding type '${binding.type}' not supported in WebGL`);\n }\n }\n }\n\n /**\n * Due to program sharing, uniforms need to be reset before every draw call\n * (though caching will avoid redundant WebGL calls)\n */\n _applyUniforms() {\n for (const uniformLayout of this.shaderLayout.uniforms || []) {\n const {name, location, type, textureUnit} = uniformLayout;\n const value = this.uniforms[name] ?? textureUnit;\n if (value !== undefined) {\n setUniform(this.device.gl, location, type, value);\n }\n }\n }\n}\n\n/** Get the primitive type for draw */\nfunction getGLDrawMode(\n topology: PrimitiveTopology\n):\n | GL.POINTS\n | GL.LINES\n | GL.LINE_STRIP\n | GL.LINE_LOOP\n | GL.TRIANGLES\n | GL.TRIANGLE_STRIP\n | GL.TRIANGLE_FAN {\n // prettier-ignore\n switch (topology) {\n case 'point-list': return GL.POINTS;\n case 'line-list': return GL.LINES;\n case 'line-strip': return GL.LINE_STRIP;\n case 'line-loop-webgl': return GL.LINE_LOOP;\n case 'triangle-list': return GL.TRIANGLES;\n case 'triangle-strip': return GL.TRIANGLE_STRIP;\n case 'triangle-fan-webgl': return GL.TRIANGLE_FAN;\n default: throw new Error(topology);\n }\n}\n\n/** Get the primitive type for transform feedback */\nfunction getGLPrimitive(topology: PrimitiveTopology): GL.POINTS | GL.LINES | GL.TRIANGLES {\n // prettier-ignore\n switch (topology) {\n case 'point-list': return GL.POINTS;\n case 'line-list': return GL.LINES;\n case 'line-strip': return GL.LINES;\n case 'line-loop-webgl': return GL.LINES;\n case 'triangle-list': return GL.TRIANGLES;\n case 'triangle-strip': return GL.TRIANGLES;\n case 'triangle-fan-webgl': return GL.TRIANGLES;\n default: throw new Error(topology);\n }\n}\n"],"mappings":"AAMA,SAAQA,cAAc,EAAEC,IAAI,EAAEC,wBAAwB,EAAEC,GAAG,QAAO,eAAe;AACjF,SAAQC,iBAAiB,QAAO,eAAe;AAE/C,SAAQC,EAAE,QAAO,oBAAoB;AAAC,SAE9BC,eAAe;AAAA,SACfC,yBAAyB;AAAA,SACzBC,UAAU;AAAA,SAIVC,WAAW;AAAA,SAEXC,gBAAgB;AAAA,SAChBC,YAAY;AAIpB,MAAMC,yBAAyB,GAAG,CAAC;AAGnC,OAAO,MAAMC,mBAAmB,SAASb,cAAc,CAAC;EAsBtDc,WAAWA,CAACC,MAAmB,EAAEC,KAA0B,EAAE;IAC3D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAAC,KArBvBD,MAAM;IAAA,KAENE,MAAM;IAAA,KAENC,EAAE;IAAA,KAEFC,EAAE;IAAA,KAEFC,kBAAkB;IAAA,KAGlBC,QAAQ,GAAiC,CAAC,CAAC;IAAA,KAE3CC,QAAQ,GAA4B,CAAC,CAAC;IAAA,KAEtCC,QAAQ,GAAoB,IAAI;IAAA,KAEhCC,aAAa,GAAW,CAAC;IAAA,KACzBC,eAAe,GAA6B,CAAC,CAAC;IAI5C,IAAI,CAACV,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACE,MAAM,GAAG,IAAI,CAACD,KAAK,CAACC,MAAM,IAAI,IAAI,CAACF,MAAM,CAACW,EAAE,CAACC,aAAa,CAAC,CAAC;IACjE,IAAI,CAACZ,MAAM,CAACa,kBAAkB,CAAC,IAAI,CAACX,MAAM,EAAE;MAACY,EAAE,EAAE,IAAI,CAACb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AAK,oBAAoB;MAAE,OAAOvI,EAAE,CAACwI,YAAY;IACjD;MAAS,MAAM,IAAItF,KAAK,CAACe,QAAQ,CAAC;EACpC;AACF;AAGA,SAASW,cAAcA,CAACX,QAA2B,EAAuC;EAExF,QAAQA,QAAQ;IACd,KAAK,YAAY;MAAE,OAAOjE,EAAE,CAACkI,MAAM;IACnC,KAAK,WAAW;MAAE,OAAOlI,EAAE,CAACmI,KAAK;IACjC,KAAK,YAAY;MAAE,OAAOnI,EAAE,CAACmI,KAAK;IAClC,KAAK,iBAAiB;MAAE,OAAOnI,EAAE,CAACmI,KAAK;IACvC,KAAK,eAAe;MAAE,OAAOnI,EAAE,CAACsI,SAAS;IACzC,KAAK,gBAAgB;MAAE,OAAOtI,EAAE,CAACsI,SAAS;IAC1C,KAAK,oBAAoB;MAAE,OAAOtI,EAAE,CAACsI,SAAS;IAC9C;MAAS,MAAM,IAAIpF,KAAK,CAACe,QAAQ,CAAC;EACpC;AACF"}
1
+ {"version":3,"file":"webgl-render-pipeline.js","names":["RenderPipeline","cast","splitUniformsAndBindings","log","mergeShaderLayout","GL","getShaderLayout","withDeviceAndGLParameters","setUniform","WEBGLBuffer","WEBGLFramebuffer","WEBGLTexture","getGLDrawMode","LOG_PROGRAM_PERF_PRIORITY","WEBGLRenderPipeline","constructor","device","props","handle","vs","fs","introspectedLayout","uniforms","bindings","varyings","_uniformCount","_uniformSetters","gl","createProgram","setSpectorMetadata","id","bufferMode","SEPARATE_ATTRIBS","length","_this$device$gl","assertWebGL2","gl2","transformFeedbackVaryings","_compileAndLink","shaderLayout","destroy","deleteProgram","destroyed","setBindings","name","value","Object","entries","binding","find","validBindings","map","join","warn","type","buffer","Error","setUniforms","keys","forEach","assign","draw","options","_vertexArray$indexBuf","renderPass","vertexArray","vertexCount","instanceCount","firstVertex","transformFeedback","glDrawMode","topology","isIndexed","Boolean","indexBuffer","glIndexType","isInstanced","Number","_areTexturesRenderable","useProgram","bindBeforeRender","begin","_applyBindings","_applyUniforms","webglRenderPass","parameters","glParameters","_this$device$gl2","drawElementsInstanced","drawElements","_this$device$gl3","drawArraysInstanced","drawArrays","end","unbindAfterRender","attachShader","time","linkProgram","timeEnd","debug","level","linked","getProgramParameter","LINK_STATUS","getProgramInfoLog","validateProgram","validated","VALIDATE_STATUS","texturesRenderable","texture","update","loaded","textureUnit","uniformBufferIndex","replace","location","getUniformBlockIndex","INVALID_INDEX","uniformBlockBinding","bindBufferBase","UNIFORM_BUFFER","bindBufferRange","offset","size","byteLength","colorAttachments","activeTexture","TEXTURE0","bindTexture","target","uniformLayout","_this$uniforms$name","undefined"],"sources":["../../../src/adapter/resources/webgl-render-pipeline.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {UniformValue, RenderPipelineProps, Binding} from '@luma.gl/core';\nimport type {ShaderLayout} from '@luma.gl/core';\nimport type {RenderPass, VertexArray} from '@luma.gl/core';\nimport {RenderPipeline, cast, splitUniformsAndBindings, log} from '@luma.gl/core';\nimport {mergeShaderLayout} from '@luma.gl/core';\n// import {mergeShaderLayout, getAttributeInfosFromLayouts} from '@luma.gl/core';\nimport {GL} from '@luma.gl/constants';\n\nimport {getShaderLayout} from '../helpers/get-shader-layout';\nimport {withDeviceAndGLParameters} from '../converters/device-parameters';\nimport {setUniform} from '../helpers/set-uniform';\n// import {copyUniform, checkUniformValues} from '../../classes/uniforms';\n\nimport {WebGLDevice} from '../webgl-device';\nimport {WEBGLBuffer} from './webgl-buffer';\nimport {WEBGLShader} from './webgl-shader';\nimport {WEBGLFramebuffer} from './webgl-framebuffer';\nimport {WEBGLTexture} from './webgl-texture';\n// import {WEBGLVertexArray} from './webgl-vertex-array';\nimport {WEBGLRenderPass} from './webgl-render-pass';\nimport {WEBGLTransformFeedback} from './webgl-transform-feedback';\nimport {getGLDrawMode} from '../helpers/webgl-topology-utils';\n\nconst LOG_PROGRAM_PERF_PRIORITY = 4;\n\n/** Creates a new render pipeline */\nexport class WEBGLRenderPipeline extends RenderPipeline {\n /** The WebGL device that created this render pipeline */\n device: WebGLDevice;\n /** Handle to underlying WebGL program */\n handle: WebGLProgram;\n /** vertex shader */\n vs: WEBGLShader;\n /** fragment shader */\n fs: WEBGLShader;\n /** The layout extracted from shader by WebGL introspection APIs */\n introspectedLayout: ShaderLayout;\n\n /** Uniforms set on this model */\n uniforms: Record<string, UniformValue> = {};\n /** Bindings set on this model */\n bindings: Record<string, Binding> = {};\n /** WebGL varyings */\n varyings: string[] | null = null;\n\n _uniformCount: number = 0;\n _uniformSetters: Record<string, Function> = {}; // TODO are these used?\n\n constructor(device: WebGLDevice, props: RenderPipelineProps) {\n super(device, props);\n this.device = device;\n this.handle = this.props.handle || this.device.gl.createProgram();\n this.device.setSpectorMetadata(this.handle, {id: this.props.id});\n\n // Create shaders if needed\n this.vs = cast<WEBGLShader>(props.vs);\n this.fs = cast<WEBGLShader>(props.fs);\n // assert(this.vs.stage === 'vertex');\n // assert(this.fs.stage === 'fragment');\n\n // Setup varyings if supplied\n // @ts-expect-error WebGL only\n const {varyings, bufferMode = GL.SEPARATE_ATTRIBS} = props;\n if (varyings && varyings.length > 0) {\n this.device.assertWebGL2();\n this.varyings = varyings;\n this.device.gl2?.transformFeedbackVaryings(this.handle, varyings, bufferMode);\n }\n\n this._compileAndLink();\n\n this.introspectedLayout = getShaderLayout(this.device.gl, this.handle);\n // Merge provided layout with introspected layout\n this.shaderLayout = mergeShaderLayout(this.introspectedLayout, props.shaderLayout);\n // Merge layout with any buffer map overrides\n // this.bufferLayout = props.bufferLayout || [];\n // this.shaderLayout = mergeBufferMap(this.shaderLayout, this.bufferLayout);\n }\n\n override destroy(): void {\n if (this.handle) {\n this.device.gl.deleteProgram(this.handle);\n // this.handle = null;\n this.destroyed = true;\n }\n }\n\n // setIndexBuffer(indexBuffer: Buffer): void {\n // const webglBuffer = cast<WEBGLBuffer>(indexBuffer);\n // this.vertexArrayObject.setElementBuffer(webglBuffer);\n // this._indexBuffer = indexBuffer;\n // }\n\n // /** @todo needed for portable model */\n // setAttributes(attributes: Record<string, Buffer>): void {\n // for (const [name, buffer] of Object.entries(attributes)) {\n // const webglBuffer = cast<WEBGLBuffer>(buffer);\n // const attribute = getAttributeLayout(this.layout, name);\n // if (!attribute) {\n // log.warn(\n // `Ignoring buffer supplied for unknown attribute \"${name}\" in pipeline \"${this.id}\" (buffer \"${buffer.id}\")`\n // )();\n // continue;\n // }\n // const decoded = decodeVertexFormat(attribute.format);\n // const {type: typeString, components: size, byteLength: stride, normalized, integer} = decoded;\n // const divisor = attribute.stepMode === 'instance' ? 1 : 0;\n // const type = getWebGLDataType(typeString);\n // this.vertexArrayObject.setBuffer(attribute.location, webglBuffer, {\n // size,\n // type,\n // stride,\n // offset: 0,\n // normalized,\n // integer,\n // divisor\n // });\n // }\n // }\n\n /**\n * Bindings include: textures, samplers and uniform buffers\n * @todo needed for portable model\n */\n setBindings(bindings: Record<string, Binding>): void {\n // if (log.priority >= 2) {\n // checkUniformValues(uniforms, this.id, this._uniformSetters);\n // }\n\n for (const [name, value] of Object.entries(bindings)) {\n // Accept both `xyz` and `xyzUniforms` as valid names for `xyzUniforms` uniform block\n // This convention allows shaders to name uniform blocks as `uniform appUniforms {} app;`\n // and reference them as `app` from both GLSL and JS.\n // TODO - this is rather hacky - we could also remap the name directly in the shader layout.\n const binding =\n this.shaderLayout.bindings.find(binding => binding.name === name) ||\n this.shaderLayout.bindings.find(binding => binding.name === `${name}Uniforms`);\n\n if (!binding) {\n const validBindings = this.shaderLayout.bindings\n .map(binding => `\"${binding.name}\"`)\n .join(', ');\n log.warn(\n `Unknown binding \"${name}\" in render pipeline \"${this.id}\", expected one of ${validBindings}`\n )();\n continue; // eslint-disable-line no-continue\n }\n if (!value) {\n log.warn(`Unsetting binding \"${name}\" in render pipeline \"${this.id}\"`)();\n }\n switch (binding.type) {\n case 'uniform':\n // @ts-expect-error\n if (!(value instanceof WEBGLBuffer) && !(value.buffer instanceof WEBGLBuffer)) {\n throw new Error('buffer value');\n }\n break;\n case 'texture':\n if (!(value instanceof WEBGLTexture || value instanceof WEBGLFramebuffer)) {\n throw new Error('texture value');\n }\n break;\n case 'sampler':\n log.warn(`Ignoring sampler ${name}`)();\n break;\n default:\n throw new Error(binding.type);\n }\n\n this.bindings[name] = value;\n }\n }\n\n setUniforms(uniforms: Record<string, UniformValue>) {\n const {bindings} = splitUniformsAndBindings(uniforms);\n Object.keys(bindings).forEach(name => {\n log.warn(\n `Unsupported value \"${bindings[name]}\" used in setUniforms() for key ${name}. Use setBindings() instead?`\n )();\n });\n // TODO - check against layout\n Object.assign(this.uniforms, uniforms);\n }\n\n /** @todo needed for portable model\n * @note The WebGL API is offers many ways to draw things\n * This function unifies those ways into a single call using common parameters with sane defaults\n */\n draw(options: {\n renderPass: RenderPass;\n /** vertex attributes */\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 transformFeedback?: WEBGLTransformFeedback;\n }): boolean {\n const {\n renderPass,\n vertexArray,\n vertexCount,\n // indexCount,\n instanceCount,\n firstVertex = 0,\n // firstIndex,\n // firstInstance,\n // baseVertex,\n transformFeedback\n } = options;\n\n const glDrawMode = getGLDrawMode(this.props.topology);\n const isIndexed: boolean = Boolean(vertexArray.indexBuffer);\n const glIndexType = (vertexArray.indexBuffer as WEBGLBuffer)?.glIndexType;\n const isInstanced: boolean = Number(instanceCount) > 0;\n\n // Avoid WebGL draw call when not rendering any data or values are incomplete\n // Note: async textures set as uniforms might still be loading.\n // Now that all uniforms have been updated, check if any texture\n // in the uniforms is not yet initialized, then we don't draw\n if (!this._areTexturesRenderable() || vertexCount === 0) {\n // (isInstanced && instanceCount === 0)\n return false;\n }\n\n this.device.gl.useProgram(this.handle);\n\n // Note: Rebinds constant attributes before each draw call\n vertexArray.bindBeforeRender(renderPass);\n\n if (transformFeedback) {\n transformFeedback.begin(this.props.topology);\n }\n\n // We have to apply bindings before every draw call since other draw calls will overwrite\n this._applyBindings();\n this._applyUniforms();\n\n const webglRenderPass = renderPass as WEBGLRenderPass;\n // // TODO - Use polyfilled WebGL2RenderingContext instead of ANGLE extension\n // if (isIndexed && isInstanced) {\n // // ANGLE_instanced_arrays extension\n // this.device.gl2?.drawElementsInstanced(\n // drawMode,\n // vertexCount || 0, // indexCount?\n // indexType,\n // firstVertex,\n // instanceCount || 0\n // );\n // // } else if (isIndexed && this.device.isWebGL2 && !isNaN(start) && !isNaN(end)) {\n // // this.device.gl2.drawRangeElements(drawMode, start, end, vertexCount, indexType, offset);\n // } else if (isIndexed) {\n // this.device.gl.drawElements(drawMode, vertexCount || 0, indexType, firstVertex); // indexCount?\n // } else if (isInstanced) {\n // this.device.gl2?.drawArraysInstanced(\n // drawMode,\n // firstVertex,\n // vertexCount || 0,\n // instanceCount || 0\n // );\n // } else {\n // this.device.gl.drawArrays(drawMode, firstVertex, vertexCount || 0);\n // }\n // });\n\n withDeviceAndGLParameters(\n this.device,\n this.props.parameters,\n webglRenderPass.glParameters,\n () => {\n if (isIndexed && isInstanced) {\n // ANGLE_instanced_arrays extension\n this.device.gl2?.drawElementsInstanced(\n glDrawMode,\n vertexCount || 0, // indexCount?\n glIndexType,\n firstVertex,\n instanceCount || 0\n );\n // } else if (isIndexed && this.device.isWebGL2 && !isNaN(start) && !isNaN(end)) {\n // this.device.gl2.drawRangeElements(glDrawMode, start, end, vertexCount, glIndexType, offset);\n } else if (isIndexed) {\n this.device.gl.drawElements(glDrawMode, vertexCount || 0, glIndexType, firstVertex); // indexCount?\n } else if (isInstanced) {\n this.device.gl2?.drawArraysInstanced(\n glDrawMode,\n firstVertex,\n vertexCount || 0,\n instanceCount || 0\n );\n } else {\n this.device.gl.drawArrays(glDrawMode, firstVertex, vertexCount || 0);\n }\n\n if (transformFeedback) {\n transformFeedback.end();\n }\n }\n );\n\n vertexArray.unbindAfterRender(renderPass);\n\n return true;\n }\n\n // setAttributes(attributes: Record<string, Buffer>): void {}\n // setBindings(bindings: Record<string, Binding>): void {}\n\n protected _compileAndLink() {\n const {gl} = this.device;\n gl.attachShader(this.handle, this.vs.handle);\n gl.attachShader(this.handle, this.fs.handle);\n log.time(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();\n gl.linkProgram(this.handle);\n log.timeEnd(LOG_PROGRAM_PERF_PRIORITY, `linkProgram for ${this.id}`)();\n\n // Avoid checking program linking error in production\n // @ts-expect-error\n if (!gl.debug && log.level === 0) {\n // return;\n }\n\n const linked = gl.getProgramParameter(this.handle, gl.LINK_STATUS);\n if (!linked) {\n throw new Error(`Error linking: ${gl.getProgramInfoLog(this.handle)}`);\n }\n\n gl.validateProgram(this.handle);\n const validated = gl.getProgramParameter(this.handle, gl.VALIDATE_STATUS);\n if (!validated) {\n throw new Error(`Error validating: ${gl.getProgramInfoLog(this.handle)}`);\n }\n }\n\n // PRIVATE METHODS\n\n /**\n * Checks if all texture-values uniforms are renderable (i.e. loaded)\n * Update a texture if needed (e.g. from video)\n * Note: This is currently done before every draw call\n */\n _areTexturesRenderable() {\n let texturesRenderable = true;\n\n for (const [, texture] of Object.entries(this.bindings)) {\n if (texture instanceof WEBGLTexture) {\n texture.update();\n texturesRenderable = texturesRenderable && texture.loaded;\n }\n }\n\n return texturesRenderable;\n }\n\n /**\n * Constant attributes need to be reset before every draw call\n * Any attribute that is disabled in the current vertex array object\n * is read from the context's global constant value for that attribute location.\n * @note Constant attributes are only supported in WebGL, not in WebGPU\n *\n _applyConstantAttributes(vertexArray: WEBGLVertexArray): void {\n const attributeInfos = getAttributeInfosFromLayouts(this.shaderLayout, this.bufferLayout);\n for (const [name, value] of Object.entries(this.)) {\n const attributeInfo = attributeInfos[name];\n if (!attributeInfo) {\n log.warn(\n `Ignoring constant value supplied for unknown attribute \"${name}\" in pipeline \"${this.id}\"`\n )();\n continue; // eslint-disable-line no-continue\n }\n vertexArray.setConstant(attributeInfo.location, value);\n vertexArray.enable(attributeInfo.location, false);\n }\n }\n */\n\n /** Apply any bindings (before each draw call) */\n _applyBindings() {\n this.device.gl.useProgram(this.handle);\n\n const {gl2} = this.device;\n if (!gl2) {\n throw new Error('bindings');\n }\n\n let textureUnit = 0;\n let uniformBufferIndex = 0;\n for (const binding of this.shaderLayout.bindings) {\n // Accept both `xyz` and `xyzUniforms` as valid names for `xyzUniforms` uniform block\n const value =\n this.bindings[binding.name] || this.bindings[binding.name.replace(/Uniforms$/, '')];\n if (!value) {\n throw new Error(`No value for binding ${binding.name} in ${this.id}`);\n }\n switch (binding.type) {\n case 'uniform':\n // Set buffer\n const {name} = binding;\n const location = gl2.getUniformBlockIndex(this.handle, name);\n if (location === GL.INVALID_INDEX) {\n throw new Error(`Invalid uniform block name ${name}`);\n }\n gl2.uniformBlockBinding(this.handle, uniformBufferIndex, location);\n // console.debug(binding, location);\n if (value instanceof WEBGLBuffer) {\n gl2.bindBufferBase(GL.UNIFORM_BUFFER, uniformBufferIndex, value.handle);\n } else {\n gl2.bindBufferRange(\n GL.UNIFORM_BUFFER,\n uniformBufferIndex,\n // @ts-expect-error\n value.buffer.handle,\n // @ts-expect-error\n value.offset || 0,\n // @ts-expect-error\n value.size || value.buffer.byteLength - value.offset\n );\n }\n uniformBufferIndex += 1;\n break;\n\n case 'texture':\n if (!(value instanceof WEBGLTexture || value instanceof WEBGLFramebuffer)) {\n throw new Error('texture');\n }\n let texture: WEBGLTexture;\n if (value instanceof WEBGLTexture) {\n texture = value;\n } else if (\n value instanceof WEBGLFramebuffer &&\n value.colorAttachments[0] instanceof WEBGLTexture\n ) {\n log.warn(\n 'Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead'\n )();\n texture = value.colorAttachments[0];\n } else {\n throw new Error('No texture');\n }\n\n gl2.activeTexture(GL.TEXTURE0 + textureUnit);\n gl2.bindTexture(texture.target, texture.handle);\n // gl2.bindSampler(textureUnit, sampler.handle);\n textureUnit += 1;\n break;\n\n case 'sampler':\n // ignore\n break;\n\n case 'storage':\n case 'read-only-storage':\n throw new Error(`binding type '${binding.type}' not supported in WebGL`);\n }\n }\n }\n\n /**\n * Due to program sharing, uniforms need to be reset before every draw call\n * (though caching will avoid redundant WebGL calls)\n */\n _applyUniforms() {\n for (const uniformLayout of this.shaderLayout.uniforms || []) {\n const {name, location, type, textureUnit} = uniformLayout;\n const value = this.uniforms[name] ?? textureUnit;\n if (value !== undefined) {\n setUniform(this.device.gl, location, type, value);\n }\n }\n }\n}\n"],"mappings":"AAMA,SAAQA,cAAc,EAAEC,IAAI,EAAEC,wBAAwB,EAAEC,GAAG,QAAO,eAAe;AACjF,SAAQC,iBAAiB,QAAO,eAAe;AAE/C,SAAQC,EAAE,QAAO,oBAAoB;AAAC,SAE9BC,eAAe;AAAA,SACfC,yBAAyB;AAAA,SACzBC,UAAU;AAAA,SAIVC,WAAW;AAAA,SAEXC,gBAAgB;AAAA,SAChBC,YAAY;AAAA,SAIZC,aAAa;AAErB,MAAMC,yBAAyB,GAAG,CAAC;AAGnC,OAAO,MAAMC,mBAAmB,SAASd,cAAc,CAAC;EAsBtDe,WAAWA,CAACC,MAAmB,EAAEC,KAA0B,EAAE;IAC3D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAAC,KArBvBD,MAAM;IAAA,KAENE,MAAM;IAAA,KAENC,EAAE;IAAA,KAEFC,EAAE;IAAA,KAEFC,kBAAkB;IAAA,KAGlBC,QAAQ,GAAiC,CAAC,CAAC;IAAA,KAE3CC,QAAQ,GAA4B,CAAC,CAAC;IAAA,KAEtCC,QAAQ,GAAoB,IAAI;IAAA,KAEhCC,aAAa,GAAW,CAAC;IAAA,KACzBC,eAAe,GAA6B,CAAC,CAAC;IAI5C,IAAI,CAACV,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACE,MAAM,GAAG,IAAI,CAACD,KAAK,CAACC,MAAM,IAAI,IAAI,CAACF,MAAM,CAACW,EAAE,CAACC,aAAa,CAAC,CAAC;IACjE,IAAI,CAACZ,MAAM,CAACa,kBAAkB,CAAC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a,CAACzH,EAAE,CAAC0H,QAAQ,GAAGf,WAAW,CAAC;UAC5C5E,GAAG,CAAC4F,WAAW,CAACnB,OAAO,CAACoB,MAAM,EAAEpB,OAAO,CAAC3F,MAAM,CAAC;UAE/C8F,WAAW,IAAI,CAAC;UAChB;QAEF,KAAK,SAAS;UAEZ;QAEF,KAAK,SAAS;QACd,KAAK,mBAAmB;UACtB,MAAM,IAAIxD,KAAK,CAAE,iBAAgBR,OAAO,CAACM,IAAK,0BAAyB,CAAC;MAC5E;IACF;EACF;EAMA6B,cAAcA,CAAA,EAAG;IACf,KAAK,MAAM+C,aAAa,IAAI,IAAI,CAAC3F,YAAY,CAACjB,QAAQ,IAAI,EAAE,EAAE;MAAA,IAAA6G,mBAAA;MAC5D,MAAM;QAACvF,IAAI;QAAEuE,QAAQ;QAAE7D,IAAI;QAAE0D;MAAW,CAAC,GAAGkB,aAAa;MACzD,MAAMrF,KAAK,IAAAsF,mBAAA,GAAG,IAAI,CAAC7G,QAAQ,CAACsB,IAAI,CAAC,cAAAuF,mBAAA,cAAAA,mBAAA,GAAInB,WAAW;MAChD,IAAInE,KAAK,KAAKuF,SAAS,EAAE;QACvB5H,UAAU,CAAC,IAAI,CAACQ,MAAM,CAACW,EAAE,EAAEwF,QAAQ,EAAE7D,IAAI,EAAET,KAAK,CAAC;MACnD;IACF;EACF;AACF"}
@@ -0,0 +1,47 @@
1
+ import type { PrimitiveTopology, ShaderLayout, TransformFeedbackProps } from '@luma.gl/core';
2
+ import { TransformFeedback, Buffer, BufferRange } from '@luma.gl/core';
3
+ import { WebGLDevice } from '../webgl-device';
4
+ export declare class WEBGLTransformFeedback extends TransformFeedback {
5
+ readonly device: WebGLDevice;
6
+ readonly gl2: WebGL2RenderingContext;
7
+ readonly handle: WebGLTransformFeedback;
8
+ /**
9
+ * NOTE: The Model already has this information while drawing, but
10
+ * TransformFeedback currently needs it internally, to look up
11
+ * varying information outside of a draw() call.
12
+ */
13
+ readonly layout: ShaderLayout;
14
+ buffers: Record<string, BufferRange>;
15
+ unusedBuffers: Record<string, Buffer>;
16
+ /**
17
+ * Allows us to avoid a Chrome bug where a buffer that is already bound to a
18
+ * different target cannot be bound to 'TRANSFORM_FEEDBACK_BUFFER' target.
19
+ * This a major workaround, see: https://github.com/KhronosGroup/WebGL/issues/2346
20
+ */
21
+ bindOnUse: boolean;
22
+ private _bound;
23
+ constructor(device: WebGLDevice, props: TransformFeedbackProps);
24
+ destroy(): void;
25
+ begin(topology?: PrimitiveTopology): void;
26
+ end(): void;
27
+ setBuffers(buffers: Record<string, Buffer | BufferRange>): void;
28
+ setBuffer(locationOrName: string | number, bufferOrRange: Buffer | BufferRange): void;
29
+ getBuffer(locationOrName: string | number): Buffer | BufferRange | null;
30
+ bind(funcOrHandle?: WebGLTransformFeedback): unknown;
31
+ unbind(): void;
32
+ /** Extract offsets for bindBufferRange */
33
+ protected _getBufferRange(bufferOrRange: Buffer | {
34
+ buffer: Buffer;
35
+ byteOffset?: number;
36
+ byteLength?: number;
37
+ }): Required<BufferRange>;
38
+ protected _getVaryingIndex(locationOrName: string | number): number;
39
+ /**
40
+ * Need to avoid chrome bug where buffer that is already bound to a different target
41
+ * cannot be bound to 'TRANSFORM_FEEDBACK_BUFFER' target.
42
+ */
43
+ protected _bindBuffers(): void;
44
+ protected _unbindBuffers(): void;
45
+ protected _bindBuffer(index: number, buffer: Buffer, byteOffset?: number, byteLength?: number): void;
46
+ }
47
+ //# sourceMappingURL=webgl-transform-feedback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgl-transform-feedback.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-transform-feedback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAE,YAAY,EAAE,sBAAsB,EAAC,MAAM,eAAe,CAAC;AAC3F,OAAO,EAAM,iBAAiB,EAAE,MAAM,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAE1E,OAAO,EAAC,WAAW,EAAC,MA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AAC,YAAY,IAAI,IAAI;IAO9B,SAAS,CAAC,cAAc,IAAI,IAAI;IAMhC,SAAS,CAAC,WAAW,CACnB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,UAAU,SAAI,EACd,UAAU,CAAC,EAAE,MAAM,GAClB,IAAI;CAQR"}
@@ -0,0 +1,165 @@
1
+ import { log, TransformFeedback } from '@luma.gl/core';
2
+ import { GL } from '@luma.gl/constants';
3
+ import { WEBGLBuffer } from "../../index.js";
4
+ import { getGLPrimitive } from "../helpers/webgl-topology-utils.js";
5
+ export class WEBGLTransformFeedback extends TransformFeedback {
6
+ constructor(device, props) {
7
+ super(device, props);
8
+ this.device = void 0;
9
+ this.gl2 = void 0;
10
+ this.handle = void 0;
11
+ this.layout = void 0;
12
+ this.buffers = {};
13
+ this.unusedBuffers = {};
14
+ this.bindOnUse = true;
15
+ this._bound = false;
16
+ device.assertWebGL2();
17
+ this.device = device;
18
+ this.gl2 = device.gl2;
19
+ this.handle = this.props.handle || this.gl2.createTransformFeedback();
20
+ this.layout = this.props.layout;
21
+ if (props.buffers) {
22
+ this.setBuffers(props.buffers);
23
+ }
24
+ Object.seal(this);
25
+ }
26
+ destroy() {
27
+ this.gl2.deleteTransformFeedback(this.handle);
28
+ super.destroy();
29
+ }
30
+ begin() {
31
+ let topology = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'point-list';
32
+ this.gl2.bindTransformFeedback(GL.TRANSFORM_FEEDBACK, this.handle);
33
+ if (this.bindOnUse) {
34
+ this._bindBuffers();
35
+ }
36
+ this.gl2.beginTransformFeedback(getGLPrimitive(topology));
37
+ }
38
+ end() {
39
+ this.gl2.endTransformFeedback();
40
+ if (!this.bindOnUse) {
41
+ this._unbindBuffers();
42
+ }
43
+ this.gl2.bindTransformFeedback(GL.TRANSFORM_FEEDBACK, null);
44
+ }
45
+ setBuffers(buffers) {
46
+ this.buffers = {};
47
+ this.unusedBuffers = {};
48
+ this.bind(() => {
49
+ for (const bufferName in buffers) {
50
+ this.setBuffer(bufferName, buffers[bufferName]);
51
+ }
52
+ });
53
+ }
54
+ setBuffer(locationOrName, bufferOrRange) {
55
+ const location = this._getVaryingIndex(locationOrName);
56
+ const {
57
+ buffer,
58
+ byteLength,
59
+ byteOffset
60
+ } = this._getBufferRange(bufferOrRange);
61
+ if (location < 0) {
62
+ this.unusedBuffers[locationOrName] = buffer;
63
+ log.warn(`${this.id} unusedBuffers varying buffer ${locationOrName}`)();
64
+ return;
65
+ }
66
+ this.buffers[location] = {
67
+ buffer,
68
+ byteLength,
69
+ byteOffset
70
+ };
71
+ if (!this.bindOnUse) {
72
+ this._bindBuffer(location, buffer, byteOffset, byteLength);
73
+ }
74
+ }
75
+ getBuffer(locationOrName) {
76
+ if (isIndex(locationOrName)) {
77
+ return this.buffers[locationOrName] || null;
78
+ }
79
+ const location = this._getVaryingIndex(locationOrName);
80
+ return location >= 0 ? this.buffers[location] : null;
81
+ }
82
+ bind() {
83
+ let funcOrHandle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.handle;
84
+ if (typeof funcOrHandle !== 'function') {
85
+ this.gl2.bindTransformFeedback(GL.TRANSFORM_FEEDBACK, funcOrHandle);
86
+ return this;
87
+ }
88
+ let value;
89
+ if (!this._bound) {
90
+ this.gl2.bindTransformFeedback(GL.TRANSFORM_FEEDBACK, this.handle);
91
+ this._bound = true;
92
+ value = funcOrHandle();
93
+ this._bound = false;
94
+ this.gl2.bindTransformFeedback(GL.TRANSFORM_FEEDBACK, null);
95
+ } else {
96
+ value = funcOrHandle();
97
+ }
98
+ return value;
99
+ }
100
+ unbind() {
101
+ this.bind(null);
102
+ }
103
+ _getBufferRange(bufferOrRange) {
104
+ if (bufferOrRange instanceof WEBGLBuffer) {
105
+ return {
106
+ buffer: bufferOrRange,
107
+ byteOffset: 0,
108
+ byteLength: bufferOrRange.byteLength
109
+ };
110
+ }
111
+ const {
112
+ buffer,
113
+ byteOffset = 0,
114
+ byteLength = bufferOrRange.buffer.byteLength
115
+ } = bufferOrRange;
116
+ return {
117
+ buffer,
118
+ byteOffset,
119
+ byteLength
120
+ };
121
+ }
122
+ _getVaryingIndex(locationOrName) {
123
+ if (isIndex(locationOrName)) {
124
+ return Number(locationOrName);
125
+ }
126
+ for (const varying of this.layout.varyings) {
127
+ if (locationOrName === varying.name) {
128
+ return varying.location;
129
+ }
130
+ }
131
+ return -1;
132
+ }
133
+ _bindBuffers() {
134
+ for (const bufferIndex in this.buffers) {
135
+ const {
136
+ buffer,
137
+ byteLength,
138
+ byteOffset
139
+ } = this._getBufferRange(this.buffers[bufferIndex]);
140
+ this._bindBuffer(Number(bufferIndex), buffer, byteOffset, byteLength);
141
+ }
142
+ }
143
+ _unbindBuffers() {
144
+ for (const bufferIndex in this.buffers) {
145
+ this.gl2.bindBufferBase(GL.TRANSFORM_FEEDBACK_BUFFER, Number(bufferIndex), null);
146
+ }
147
+ }
148
+ _bindBuffer(index, buffer) {
149
+ let byteOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
150
+ let byteLength = arguments.length > 3 ? arguments[3] : undefined;
151
+ const handle = buffer && buffer.handle;
152
+ if (!handle || byteLength === undefined) {
153
+ this.gl2.bindBufferBase(GL.TRANSFORM_FEEDBACK_BUFFER, index, handle);
154
+ } else {
155
+ this.gl2.bindBufferRange(GL.TRANSFORM_FEEDBACK_BUFFER, index, handle, byteOffset, byteLength);
156
+ }
157
+ }
158
+ }
159
+ function isIndex(value) {
160
+ if (typeof value === 'number') {
161
+ return Number.isInteger(value);
162
+ }
163
+ return /^\d+$/.test(value);
164
+ }
165
+ //# sourceMappingURL=webgl-transform-feedback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgl-transform-feedback.js","names":["log","TransformFeedback","GL","WEBGLBuffer","getGLPrimitive","WEBGLTransformFeedback","constructor","device","props","gl2","handle","layout","buffers","unusedBuffers","bindOnUse","_bound","assertWebGL2","createTransformFeedback","setBuffers","Object","seal","destroy","deleteTransformFeedback","begin","topology","arguments","length","undefined","bindTransformFeedback","TRANSFORM_FEEDBACK","_bindBuffers","beginTransformFeedback","end","endTransformFeedback","_unbindBuffers","bind","bufferName","setBuffer","locationOrName","bufferOrRange","location","_getVaryingIndex","buffer","byteLength","byteOffset","_getBufferRange","warn","id","_bindBuffer","getBuffer","isIndex","funcOrHandle","value","unbind","Number","varying","varyings","name","bufferIndex","bindBufferBase","TRANSFORM_FEEDBACK_BUFFER","index","bindBufferRange","isInteger","test"],"sources":["../../../src/adapter/resources/webgl-transform-feedback.ts"],"sourcesContent":["import type {PrimitiveTopology, ShaderLayout, TransformFeedbackProps} from '@luma.gl/core';\nimport {log, TransformFeedback, Buffer, BufferRange} from '@luma.gl/core';\nimport {GL} from '@luma.gl/constants';\nimport {WebGLDevice} from '../webgl-device';\nimport {WEBGLBuffer} from '../..';\nimport {getGLPrimitive} from '../helpers/webgl-topology-utils';\n\nexport class WEBGLTransformFeedback extends TransformFeedback {\n readonly device: WebGLDevice;\n readonly gl2: WebGL2RenderingContext;\n readonly handle: WebGLTransformFeedback;\n\n /**\n * NOTE: The Model already has this information while drawing, but\n * TransformFeedback currently needs it internally, to look up\n * varying information outside of a draw() call.\n */\n readonly layout: ShaderLayout;\n buffers: Record<string, BufferRange> = {};\n unusedBuffers: Record<string, Buffer> = {};\n /**\n * Allows us to avoid a Chrome bug where a buffer that is already bound to a\n * different target cannot be bound to 'TRANSFORM_FEEDBACK_BUFFER' target.\n * This a major workaround, see: https://github.com/KhronosGroup/WebGL/issues/2346\n */\n bindOnUse = true;\n private _bound: boolean = false;\n\n constructor(device: WebGLDevice, props: TransformFeedbackProps) {\n super(device, props);\n\n device.assertWebGL2();\n this.device = device;\n this.gl2 = device.gl2;\n this.handle = this.props.handle || this.gl2.createTransformFeedback();\n this.layout = this.props.layout;\n\n if (props.buffers) {\n this.setBuffers(props.buffers);\n }\n\n Object.seal(this);\n }\n\n override destroy(): void {\n this.gl2.deleteTransformFeedback(this.handle);\n super.destroy();\n }\n\n begin(topology: PrimitiveTopology = 'point-list'): void {\n this.gl2.bindTransformFeedback(GL.TRANSFORM_FEEDBACK, this.handle);\n if (this.bindOnUse) {\n this._bindBuffers();\n }\n this.gl2.beginTransformFeedback(getGLPrimitive(topology));\n }\n\n end(): void {\n this.gl2.endTransformFeedback();\n if (!this.bindOnUse) {\n this._unbindBuffers();\n }\n this.gl2.bindTransformFeedback(GL.TRANSFORM_FEEDBACK, null);\n }\n\n // SUBCLASS\n\n setBuffers(buffers: Record<string, Buffer | BufferRange>): void {\n this.buffers = {};\n this.unusedBuffers = {};\n\n this.bind(() => {\n for (const bufferName in buffers) {\n this.setBuffer(bufferName, buffers[bufferName]);\n }\n });\n }\n\n setBuffer(locationOrName: string | number, bufferOrRange: Buffer | BufferRange): void {\n const location = this._getVaryingIndex(locationOrName);\n const {buffer, byteLength, byteOffset} = this._getBufferRange(bufferOrRange);\n\n if (location < 0) {\n this.unusedBuffers[locationOrName] = buffer;\n log.warn(`${this.id} unusedBuffers varying buffer ${locationOrName}`)();\n return;\n }\n\n this.buffers[location] = {buffer, byteLength, byteOffset};\n\n // Need to avoid chrome bug where buffer that is already bound to a different target\n // cannot be bound to 'TRANSFORM_FEEDBACK_BUFFER' target.\n if (!this.bindOnUse) {\n this._bindBuffer(location, buffer, byteOffset, byteLength);\n }\n }\n\n getBuffer(locationOrName: string | number): Buffer | BufferRange | null {\n if (isIndex(locationOrName)) {\n return this.buffers[locationOrName] || null;\n }\n const location = this._getVaryingIndex(locationOrName);\n return location >= 0 ? this.buffers[location] : null;\n }\n\n bind(funcOrHandle = this.handle) {\n if (typeof funcOrHandle !== 'function') {\n this.gl2.bindTransformFeedback(GL.TRANSFORM_FEEDBACK, funcOrHandle);\n return this;\n }\n\n let value: unknown;\n\n if (!this._bound) {\n this.gl2.bindTransformFeedback(GL.TRANSFORM_FEEDBACK, this.handle);\n this._bound = true;\n value = funcOrHandle();\n this._bound = false;\n this.gl2.bindTransformFeedback(GL.TRANSFORM_FEEDBACK, null);\n } else {\n value = funcOrHandle();\n }\n\n return value;\n }\n\n unbind() {\n this.bind(null);\n }\n\n // PRIVATE METHODS\n\n /** Extract offsets for bindBufferRange */\n protected _getBufferRange(\n bufferOrRange: Buffer | {buffer: Buffer; byteOffset?: number; byteLength?: number}\n ): Required<BufferRange> {\n if (bufferOrRange instanceof WEBGLBuffer) {\n return {buffer: bufferOrRange, byteOffset: 0, byteLength: bufferOrRange.byteLength};\n }\n\n // To use bindBufferRange either offset or size must be specified.\n // @ts-expect-error Must be a BufferRange.\n const {buffer, byteOffset = 0, byteLength = bufferOrRange.buffer.byteLength} = bufferOrRange;\n return {buffer, byteOffset, byteLength};\n }\n\n protected _getVaryingIndex(locationOrName: string | number): number {\n if (isIndex(locationOrName)) {\n return Number(locationOrName);\n }\n\n for (const varying of this.layout.varyings) {\n if (locationOrName === varying.name) {\n return varying.location;\n }\n }\n\n return -1;\n }\n\n /**\n * Need to avoid chrome bug where buffer that is already bound to a different target\n * cannot be bound to 'TRANSFORM_FEEDBACK_BUFFER' target.\n */\n protected _bindBuffers(): void {\n for (const bufferIndex in this.buffers) {\n const {buffer, byteLength, byteOffset} = this._getBufferRange(this.buffers[bufferIndex]);\n this._bindBuffer(Number(bufferIndex), buffer, byteOffset, byteLength);\n }\n }\n\n protected _unbindBuffers(): void {\n for (const bufferIndex in this.buffers) {\n this.gl2.bindBufferBase(GL.TRANSFORM_FEEDBACK_BUFFER, Number(bufferIndex), null);\n }\n }\n\n protected _bindBuffer(\n index: number,\n buffer: Buffer,\n byteOffset = 0,\n byteLength?: number\n ): void {\n const handle = buffer && (buffer as WEBGLBuffer).handle;\n if (!handle || byteLength === undefined) {\n this.gl2.bindBufferBase(GL.TRANSFORM_FEEDBACK_BUFFER, index, handle);\n } else {\n this.gl2.bindBufferRange(GL.TRANSFORM_FEEDBACK_BUFFER, index, handle, byteOffset, byteLength);\n }\n }\n}\n\n/**\n * Returns true if the given value is an integer, or a string that\n * trivially converts to an integer (only numeric characters).\n */\nfunction isIndex(value: string | number): boolean {\n if (typeof value === 'number') {\n return Number.isInteger(value);\n }\n return /^\\d+$/.test(value);\n}\n"],"mappings":"AACA,SAAQA,GAAG,EAAEC,iBAAiB,QAA4B,eAAe;AACzE,SAAQC,EAAE,QAAO,oBAAoB;AAAC,SAE9BC,WAAW;AAAA,SACXC,cAAc;AAEtB,OAAO,MAAMC,sBAAsB,SAASJ,iBAAiB,CAAC;EAqB5DK,WAAWA,CAACC,MAAmB,EAAEC,KAA6B,EAAE;IAC9D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAAC,KArBdD,MAAM;IAAA,KACNE,GAAG;IAAA,KACHC,MAAM;IAAA,KAONC,MAAM;IAAA,KACfC,OAAO,GAAgC,CAAC,CAAC;IAAA,KACzCC,aAAa,GAA2B,CAAC,CAAC;IAAA,KAM1CC,SAAS,GAAG,IAAI;IAAA,KACRC,MAAM,GAAY,KAAK;IAK7BR,MAAM,CAACS,YAAY,CAAC,CAAC;IACrB,IAAI,CAACT,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACE,GAAG,GAAGF,MAAM,CAACE,GAAG;IACrB,IAAI,CAACC,MAAM,GAAG,IAAI,CAACF,KAAK,CAACE,MAAM,IAAI,IAAI,CAACD,GAAG,CAACQ,uBAAuB,CAAC,CAAC;IACrE,IAAI,CAACN,MAAM,GAAG,IAAI,CAACH,KAAK,CAACG,MAAM;IAE/B,IAAIH,KAAK,CAACI,OAAO,EAAE;MACjB,IAAI,CAACM,UAAU,CAACV,KAAK,CAACI,OAAO,CAAC;IAChC;IAEAO,MAAM,CAACC,IAAI,CAAC,IAAI,CAAC;EACnB;EAESC,OAAOA,CAAA,EAAS;IACvB,IAAI,CAACZ,GAAG,CAACa,uBAAuB,CAAC,IAAI,CAACZ,MAAM,CAAC;IAC7C,KAAK,CAACW,OAAO,CAAC,CAAC;EACjB;EAEAE,KAAKA,CAAA,EAAmD;IAAA,IAAlDC,QAA2B,GAAAC,SAAA,CAAAC,MAAA,QAAA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UAAU,EAAED,UAAU,CAAC;IACvE;EACF;EAEUT,cAAcA,CAAA,EAAS;IAC/B,KAAK,MAAMwB,WAAW,IAAI,IAAI,CAAC9C,OAAO,EAAE;MACtC,IAAI,CAACH,GAAG,CAACkD,cAAc,CAACzD,EAAE,CAAC0D,yBAAyB,EAAEN,MAAM,CAACI,WAAW,CAAC,EAAE,IAAI,CAAC;IAClF;EACF;EAEUV,WAAWA,CACnBa,KAAa,EACbnB,MAAc,EAGR;IAAA,IAFNE,UAAU,GAAAnB,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IAAA,IACdkB,UAAmB,GAAAlB,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;IAEnB,MAAMjB,MAAM,GAAGgC,MAAM,IAAKA,MAAM,CAAiBhC,MAAM;IACvD,IAAI,CAACA,MAAM,IAAIiC,UAAU,KAAKhB,SAAS,EAAE;MACvC,IAAI,CAAClB,GAAG,CAACkD,cAAc,CAACzD,EAAE,CAAC0D,yBAAyB,EAAEC,KAAK,EAAEnD,MAAM,CAAC;IACtE,CAAC,MAAM;MACL,IAAI,CAACD,GAAG,CAACqD,eAAe,CAAC5D,EAAE,CAAC0D,yBAAyB,EAAEC,KAAK,EAAEnD,MAAM,EAAEkC,UAAU,EAAED,UAAU,CAAC;IAC/F;EACF;AACF;AAMA,SAASO,OAAOA,CAACE,KAAsB,EAAW;EAChD,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOE,MAAM,CAACS,SAAS,CAACX,KAAK,CAAC;EAChC;EACA,OAAO,OAAO,CAACY,IAAI,CAACZ,KAAK,CAAC;AAC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-vertex-array.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-vertex-array.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,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AU1C;;;OAGG;IAeH,gCAAgC;IAChC,SAAS,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM;;;;;;;;;IAsBvC;;;;;OAKG;IACH,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,UAAO,GAAG,IAAI;IAiBxD;;;;;OAKG;IACH,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM;CA8BnE"}
@@ -34,7 +34,7 @@ export class WEBGLVertexArray extends VertexArray {
34
34
  }
35
35
  setIndexBuffer(indexBuffer) {
36
36
  const buffer = indexBuffer;
37
- if (buffer && buffer.glTarget !== GL.ELEMENT_ARRAY_BUFFER) {
37
+ if ((buffer === null || buffer === void 0 ? void 0 : buffer.glTarget) !== GL.ELEMENT_ARRAY_BUFFER) {
38
38
  throw new Error('Use .setBuffer()');
39
39
  }
40
40
  this.device.gl2.bindVertexArray(this.handle);
@@ -126,11 +126,13 @@ export class WEBGLVertexArray extends VertexArray {
126
126
  const constantValue = normalizeConstantArrayValue(value);
127
127
  const byteLength = constantValue.byteLength * elementCount;
128
128
  const length = constantValue.length * elementCount;
129
+ if (this.buffer && byteLength !== this.buffer.byteLength) {
130
+ throw new Error(`Buffer size is immutable, byte length ${byteLength} !== ${this.buffer.byteLength}.`);
131
+ }
129
132
  let updateNeeded = !this.buffer;
130
133
  this.buffer = this.buffer || this.device.createBuffer({
131
134
  byteLength
132
135
  });
133
- updateNeeded = updateNeeded || this.buffer.reallocate(byteLength);
134
136
  updateNeeded = updateNeeded || !compareConstantArrayValues(constantValue, this.bufferValue);
135
137
  if (updateNeeded) {
136
138
  const typedArray = getScratchArray(value.constructor, length);
@@ -140,7 +142,7 @@ export class WEBGLVertexArray extends VertexArray {
140
142
  start: 0,
141
143
  count: length
142
144
  });
143
- this.buffer.subData(typedArray);
145
+ this.buffer.write(typedArray);
144
146
  this.bufferValue = value;
145
147
  }
146
148
  return this.buffer;
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-vertex-array.js","names":["VertexArray","getScratchArray","fillArray","GL","getBrowser","getGLFromVertexType","_Symbol$toStringTag","Symbol","toStringTag","WEBGLVertexArray","isConstantAttributeZeroSupported","device","info","type","constructor","props","handle","buffer","bufferValue","init","gl2","createVertexArray","destroy","_this$buffer","deleteVertexArray","undefined","setIndexBuffer","indexBuffer","glTarget","ELEMENT_ARRAY_BUFFER","Error","bindVertexArray","bindBuffer","setBuffer","location","attributeBuffer","size","stride","offset","normalized","integer","divisor","_getAccessor","gl","ARRAY_BUFFER","assertWebGL2","vertexAttribIPointer","vertexAttribPointer","enableVertexAttribArray","vertexAttribDivisor","attributes","setConstant","value","_enable","bindBeforeRender","webglBuffer","_applyConstantAttributes","unbindAfterRender","maxVertexAttributes","constant","ArrayBuffer","isView","setConstantAttribute","attributeInfo","attributeInfos","glType","bufferDataType","bufferComponents","byteStride","byteOffset","stepMode","enable","arguments","length","canDisableAttributeZero","canDisableAttribute","Number","disableVertexAttribArray","getConstantBuffer","elementCount","constantValue","normalizeConstantArrayValue","byteLength","updateNeeded","createBuffer","reallocate","compareConstantArrayValues","typedArray","target","source","start","count","subData","arrayValue","Array","isArray","Float32Array","v1","v2","i"],"sources":["../../../src/adapter/resources/webgl-vertex-array.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {Device, Buffer, VertexArrayProps, TypedArray, NumberArray} from '@luma.gl/core';\nimport {VertexArray, getScratchArray, fillArray} from '@luma.gl/core';\nimport {GL} from '@luma.gl/constants';\nimport {getBrowser} from '@probe.gl/env';\n\nimport {WebGLDevice} from '../webgl-device';\nimport {WEBGLBuffer} from '../resources/webgl-buffer';\n\nimport {BufferWithAccessor} from '../../classic/buffer-with-accessor';\nimport {getGLFromVertexType} from '../converters/vertex-formats';\n// import {AccessorObject} from '../..';\n// import {getGLFromVertexType} from '../converters/vertex-formats';\n\n/** VertexArrayObject wrapper */\nexport class WEBGLVertexArray extends VertexArray {\n override get [Symbol.toStringTag](): string {\n return 'VertexArray';\n }\n\n readonly device: WebGLDevice;\n readonly handle: WebGLVertexArrayObject;\n\n /** Attribute 0 buffer constant */\n private buffer: BufferWithAccessor | null = null;\n private bufferValue = null;\n\n /** * Attribute 0 can not be disable on most desktop OpenGL based browsers */\n static isConstantAttributeZeroSupported(device: Device): boolean {\n return device.info.type === 'webgl2' || getBrowser() === 'Chrome';\n }\n\n // Create a VertexArray\n constructor(device: WebGLDevice, props?: VertexArrayProps) {\n super(device, props);\n this.device = device;\n this.handle = this.device.gl2.createVertexArray();\n }\n\n override destroy(): void {\n super.destroy();\n if (this.buffer) {\n this.buffer?.destroy();\n }\n if (this.handle) {\n this.device.gl2.deleteVertexArray(this.handle);\n // @ts-expect-error read-only/undefined\n this.handle = undefined!;\n }\n\n // Auto-delete elements?\n // return [this.elements];\n }\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 * \n * @param elementBuffer \n */\n setIndexBuffer(indexBuffer: Buffer | null): void {\n const buffer = indexBuffer as WEBGLBuffer;\n if (buffer && (buffer.glTarget !== GL.ELEMENT_ARRAY_BUFFER)) {\n throw new Error('Use .setBuffer()');\n }\n // In WebGL The GL.ELEMENT_ARRAY_BUFFER_BINDING is stored on the VertexArrayObject\n this.device.gl2.bindVertexArray(this.handle);\n // TODO - this initial binding does not seem to take effect? see bindBeforeRender()\n this.device.gl2.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, buffer ? buffer.handle : null);\n // log.log(1, 'VertexArray.setIndexBuffer', indexBuffer)();\n // log.log(1, `Binding vertex array ${this.id}`, buffer?.id)();\n\n this.indexBuffer = buffer;\n }\n\n /** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */\n setBuffer(location: number, attributeBuffer: Buffer): void {\n const buffer = attributeBuffer as WEBGLBuffer;\n // Sanity check target\n if (buffer.glTarget === GL.ELEMENT_ARRAY_BUFFER) {\n throw new Error('Use .setIndexBuffer()');\n }\n\n const {size, type, stride, offset, normalized, integer, divisor} = this._getAccessor(location);\n\n this.device.gl2.bindVertexArray(this.handle);\n // A non-zero buffer object must be bound to the GL_ARRAY_BUFFER target\n this.device.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 this.device.gl2.vertexAttribIPointer(location, size, type, stride, offset);\n } else {\n // Attaches ARRAY_BUFFER with specified buffer format to location\n this.device.gl.vertexAttribPointer(location, size, type, normalized, stride, offset);\n }\n\n // Mark as non-constant\n this.device.gl.enableVertexAttribArray(location);\n // Set the step mode 0=vertex, 1=instance\n this.device.gl2.vertexAttribDivisor(location, divisor || 0);\n\n this.attributes[location] = buffer;\n }\n\n /** Set a location in vertex attributes array to a constant value, disables the location */\n override setConstant(location: number, value: TypedArray): void {\n this._enable(location, false);\n this.attributes[location] = value;\n }\n\n init = false;\n\n override bindBeforeRender(): void {\n this.device.gl2.bindVertexArray(this.handle);\n // TODO - the initial bind does not seem to take effect. \n if (!this.init) {\n // log.log(1, `Binding vertex array ${this.id}`, this.indexBuffer?.id)();\n const webglBuffer = this.indexBuffer as WEBGLBuffer;\n this.device.gl2.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, webglBuffer?.handle || null);\n this.init = true;\n }\n this._applyConstantAttributes();\n }\n\n override unbindAfterRender(): void {\n // log.log(1, `Unbinding vertex array ${this.id}`)();\n // TODO technically this is not necessary, but we might be interfacing \n // with code that does not use vertex array objects\n this.device.gl2.bindVertexArray(null);\n // this.device.gl2.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, null);\n }\n\n // Internal methods\n\n /**\n * Constant attributes need to be reset before every draw call\n * Any attribute that is disabled in the current vertex array object\n * is read from the context's global constant value for that attribute location.\n * @note Constant attributes are only supported in WebGL, not in WebGPU\n */\n protected _applyConstantAttributes(): void {\n for (let location = 0; location < this.maxVertexAttributes; ++location) {\n const constant = this.attributes[location];\n // A typed array means this is a constant\n if (ArrayBuffer.isView(constant)) {\n this.device.setConstantAttribute(location, constant);\n }\n }\n }\n\n /**\n * Set a location in vertex attributes array to a buffer, enables the location, sets divisor\n * @note requires vertex array to be bound\n */\n // protected _setAttributeLayout(location: number): void {\n // const {size, type, stride, offset, normalized, integer, divisor} = this._getAccessor(location);\n\n // // WebGL2 supports *integer* data formats, i.e. GPU will see integer values\n // if (integer) {\n // this.device.assertWebGL2();\n // this.device.gl2.vertexAttribIPointer(location, size, type, stride, offset);\n // } else {\n // // Attaches ARRAY_BUFFER with specified buffer format to location\n // this.device.gl.vertexAttribPointer(location, size, type, normalized, stride, offset);\n // }\n // this.device.gl2.vertexAttribDivisor(location, divisor || 0);\n // }\n\n /** Get an accessor from the */\n protected _getAccessor(location: number) {\n const attributeInfo = this.attributeInfos[location];\n if (!attributeInfo) {\n throw new Error(`Unknown attribute location ${location}`);\n }\n const glType = getGLFromVertexType(attributeInfo.bufferDataType);\n return {\n size: attributeInfo.bufferComponents,\n type: glType,\n stride: attributeInfo.byteStride,\n offset: attributeInfo.byteOffset,\n normalized: attributeInfo.normalized,\n // it is the shader attribute declaration, not the vertex memory format,\n // that determines if the data in the buffer will be treated as integers.\n //\n // Also note that WebGL supports assigning non-normalized integer data to floating point attributes,\n // but as far as we can tell, WebGPU does not.\n integer: attributeInfo.integer,\n divisor: attributeInfo.stepMode === 'instance' ? 1 : 0\n };\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 protected _enable(location: number, enable = true): void {\n // Attribute 0 cannot be disabled in most desktop OpenGL based browsers...\n const canDisableAttributeZero = WEBGLVertexArray.isConstantAttributeZeroSupported(this.device);\n const canDisableAttribute = canDisableAttributeZero || location !== 0;\n\n if (enable || canDisableAttribute) {\n location = Number(location);\n this.device.gl2.bindVertexArray(this.handle);\n if (enable) {\n this.device.gl.enableVertexAttribArray(location);\n } else {\n this.device.gl.disableVertexAttribArray(location);\n }\n this.device.gl2.bindVertexArray(null);\n }\n }\n\n /**\n * Provide a means to create a buffer that is equivalent to a constant.\n * NOTE: Desktop OpenGL cannot disable attribute 0.\n * https://stackoverflow.com/questions/20305231/webgl-warning-attribute-0-is-disabled-\n * this-has-significant-performance-penalty\n */\n getConstantBuffer(elementCount: number, value: TypedArray): Buffer {\n // Create buffer only when needed, and reuse it (avoids inflating buffer creation statistics)\n\n const constantValue = normalizeConstantArrayValue(value);\n\n const byteLength = constantValue.byteLength * elementCount;\n const length = constantValue.length * elementCount;\n\n let updateNeeded = !this.buffer;\n\n this.buffer = this.buffer || (this.device.createBuffer({byteLength}) as BufferWithAccessor);\n updateNeeded = updateNeeded || this.buffer.reallocate(byteLength);\n\n // Reallocate and update contents if needed\n updateNeeded = updateNeeded || !compareConstantArrayValues(constantValue, this.bufferValue);\n\n if (updateNeeded) {\n // Create a typed array that is big enough, and fill it with the required data\n const typedArray = getScratchArray(value.constructor, length);\n fillArray({target: typedArray, source: constantValue, start: 0, count: length});\n this.buffer.subData(typedArray);\n this.bufferValue = value;\n }\n\n return this.buffer;\n }\n}\n\n// HELPER FUNCTIONS\n\n/**\n * TODO - convert Arrays based on known type? (read type from accessor, don't assume Float32Array)\n * TODO - handle single values for size 1 attributes?\n */\nfunction normalizeConstantArrayValue(arrayValue: NumberArray) {\n if (Array.isArray(arrayValue)) {\n return new Float32Array(arrayValue);\n }\n return arrayValue;\n}\n\n/**\n *\n */\nfunction compareConstantArrayValues(v1: NumberArray, v2: NumberArray): boolean {\n if (!v1 || !v2 || v1.length !== v2.length || v1.constructor !== v2.constructor) {\n return false;\n }\n for (let i = 0; i < v1.length; ++i) {\n if (v1[i] !== v2[i]) {\n return false;\n }\n }\n return true;\n}\n"],"mappings":";AAIA,SAAQA,WAAW,EAAEC,eAAe,EAAEC,SAAS,QAAO,eAAe;AACrE,SAAQC,EAAE,QAAO,oBAAoB;AACr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IAAIC,KAAK,CAACC,OAAO,CAACF,UAAU,CAAC,EAAE;IAC7B,OAAO,IAAIG,YAAY,CAACH,UAAU,CAAC;EACrC;EACA,OAAOA,UAAU;AACnB;AAKA,SAASP,0BAA0BA,CAACW,EAAe,EAAEC,EAAe,EAAW;EAC7E,IAAI,CAACD,EAAE,IAAI,CAACC,EAAE,IAAID,EAAE,CAACxB,MAAM,KAAKyB,EAAE,CAACzB,MAAM,IAAIwB,EAAE,CAACnF,WAAW,KAAKoF,EAAE,CAACpF,WAAW,EAAE;IAC9E,OAAO,KAAK;EACd;EACA,KAAK,IAAIqF,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,EAAE,CAACxB,MAAM,EAAE,EAAE0B,CAAC,EAAE;IAClC,IAAIF,EAAE,CAACE,CAAC,CAAC,KAAKD,EAAE,CAACC,CAAC,CAAC,EAAE;MACnB,OAAO,KAAK;IACd;EACF;EACA,OAAO,IAAI;AACb"}
1
+ {"version":3,"file":"webgl-vertex-array.js","names":["VertexArray","getScratchArray","fillArray","GL","getBrowser","getGLFromVertexType","_Symbol$toStringTag","Symbol","toStringTag","WEBGLVertexArray","isConstantAttributeZeroSupported","device","info","type","constructor","props","handle","buffer","bufferValue","init","gl2","createVertexArray","destroy","_this$buffer","deleteVertexArray","undefined","setIndexBuffer","indexBuffer","glTarget","ELEMENT_ARRAY_BUFFER","Error","bindVertexArray","bindBuffer","setBuffer","location","attributeBuffer","size","stride","offset","normalized","integer","divisor","_getAccessor","gl","ARRAY_BUFFER","assertWebGL2","vertexAttribIPointer","vertexAttribPointer","enableVertexAttribArray","vertexAttribDivisor","attributes","setConstant","value","_enable","bindBeforeRender","webglBuffer","_applyConstantAttributes","unbindAfterRender","maxVertexAttributes","constant","ArrayBuffer","isView","setConstantAttribute","attributeInfo","attributeInfos","glType","bufferDataType","bufferComponents","byteStride","byteOffset","stepMode","enable","arguments","length","canDisableAttributeZero","canDisableAttribute","Number","disableVertexAttribArray","getConstantBuffer","elementCount","constantValue","normalizeConstantArrayValue","byteLength","updateNeeded","createBuffer","compareConstantArrayValues","typedArray","target","source","start","count","write","arrayValue","Array","isArray","Float32Array","v1","v2","i"],"sources":["../../../src/adapter/resources/webgl-vertex-array.ts"],"sourcesContent":["// luma.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport type {Device, Buffer, VertexArrayProps, TypedArray, NumberArray} from '@luma.gl/core';\nimport {VertexArray, getScratchArray, fillArray} from '@luma.gl/core';\nimport {GL} from '@luma.gl/constants';\nimport {getBrowser} from '@probe.gl/env';\n\nimport {WebGLDevice} from '../webgl-device';\nimport {WEBGLBuffer} from '../resources/webgl-buffer';\n\nimport {getGLFromVertexType} from '../converters/vertex-formats';\n// import {AccessorObject} from '../..';\n// import {getGLFromVertexType} from '../converters/vertex-formats';\n\n/** VertexArrayObject wrapper */\nexport class WEBGLVertexArray extends VertexArray {\n override get [Symbol.toStringTag](): string {\n return 'VertexArray';\n }\n\n readonly device: WebGLDevice;\n readonly handle: WebGLVertexArrayObject;\n\n /** Attribute 0 buffer constant */\n private buffer: WEBGLBuffer | null = null;\n private bufferValue = null;\n\n /** * Attribute 0 can not be disable on most desktop OpenGL based browsers */\n static isConstantAttributeZeroSupported(device: Device): boolean {\n return device.info.type === 'webgl2' || getBrowser() === 'Chrome';\n }\n\n // Create a VertexArray\n constructor(device: WebGLDevice, props?: VertexArrayProps) {\n super(device, props);\n this.device = device;\n this.handle = this.device.gl2.createVertexArray();\n }\n\n override destroy(): void {\n super.destroy();\n if (this.buffer) {\n this.buffer?.destroy();\n }\n if (this.handle) {\n this.device.gl2.deleteVertexArray(this.handle);\n // @ts-expect-error read-only/undefined\n this.handle = undefined!;\n }\n\n // Auto-delete elements?\n // return [this.elements];\n }\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 * \n * @param elementBuffer \n */\n setIndexBuffer(indexBuffer: Buffer | null): void {\n const buffer = indexBuffer as WEBGLBuffer;\n if (buffer?.glTarget !== GL.ELEMENT_ARRAY_BUFFER) {\n throw new Error('Use .setBuffer()');\n }\n // In WebGL The GL.ELEMENT_ARRAY_BUFFER_BINDING is stored on the VertexArrayObject\n this.device.gl2.bindVertexArray(this.handle);\n // TODO - this initial binding does not seem to take effect? see bindBeforeRender()\n this.device.gl2.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, buffer ? buffer.handle : null);\n // log.log(1, 'VertexArray.setIndexBuffer', indexBuffer)();\n // log.log(1, `Binding vertex array ${this.id}`, buffer?.id)();\n\n this.indexBuffer = buffer;\n }\n\n /** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */\n setBuffer(location: number, attributeBuffer: Buffer): void {\n const buffer = attributeBuffer as WEBGLBuffer;\n // Sanity check target\n if (buffer.glTarget === GL.ELEMENT_ARRAY_BUFFER) {\n throw new Error('Use .setIndexBuffer()');\n }\n\n const {size, type, stride, offset, normalized, integer, divisor} = this._getAccessor(location);\n\n this.device.gl2.bindVertexArray(this.handle);\n // A non-zero buffer object must be bound to the GL_ARRAY_BUFFER target\n this.device.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 this.device.gl2.vertexAttribIPointer(location, size, type, stride, offset);\n } else {\n // Attaches ARRAY_BUFFER with specified buffer format to location\n this.device.gl.vertexAttribPointer(location, size, type, normalized, stride, offset);\n }\n\n // Mark as non-constant\n this.device.gl.enableVertexAttribArray(location);\n // Set the step mode 0=vertex, 1=instance\n this.device.gl2.vertexAttribDivisor(location, divisor || 0);\n\n this.attributes[location] = buffer;\n }\n\n /** Set a location in vertex attributes array to a constant value, disables the location */\n override setConstant(location: number, value: TypedArray): void {\n this._enable(location, false);\n this.attributes[location] = value;\n }\n\n init = false;\n\n override bindBeforeRender(): void {\n this.device.gl2.bindVertexArray(this.handle);\n // TODO - the initial bind does not seem to take effect.\n if (!this.init) {\n // log.log(1, `Binding vertex array ${this.id}`, this.indexBuffer?.id)();\n const webglBuffer = this.indexBuffer as WEBGLBuffer;\n this.device.gl2.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, webglBuffer?.handle || null);\n this.init = true;\n }\n this._applyConstantAttributes();\n }\n\n override unbindAfterRender(): void {\n // log.log(1, `Unbinding vertex array ${this.id}`)();\n // TODO technically this is not necessary, but we might be interfacing\n // with code that does not use vertex array objects\n this.device.gl2.bindVertexArray(null);\n // this.device.gl2.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, null);\n }\n\n // Internal methods\n\n /**\n * Constant attributes need to be reset before every draw call\n * Any attribute that is disabled in the current vertex array object\n * is read from the context's global constant value for that attribute location.\n * @note Constant attributes are only supported in WebGL, not in WebGPU\n */\n protected _applyConstantAttributes(): void {\n for (let location = 0; location < this.maxVertexAttributes; ++location) {\n const constant = this.attributes[location];\n // A typed array means this is a constant\n if (ArrayBuffer.isView(constant)) {\n this.device.setConstantAttribute(location, constant);\n }\n }\n }\n\n /**\n * Set a location in vertex attributes array to a buffer, enables the location, sets divisor\n * @note requires vertex array to be bound\n */\n // protected _setAttributeLayout(location: number): void {\n // const {size, type, stride, offset, normalized, integer, divisor} = this._getAccessor(location);\n\n // // WebGL2 supports *integer* data formats, i.e. GPU will see integer values\n // if (integer) {\n // this.device.assertWebGL2();\n // this.device.gl2.vertexAttribIPointer(location, size, type, stride, offset);\n // } else {\n // // Attaches ARRAY_BUFFER with specified buffer format to location\n // this.device.gl.vertexAttribPointer(location, size, type, normalized, stride, offset);\n // }\n // this.device.gl2.vertexAttribDivisor(location, divisor || 0);\n // }\n\n /** Get an accessor from the */\n protected _getAccessor(location: number) {\n const attributeInfo = this.attributeInfos[location];\n if (!attributeInfo) {\n throw new Error(`Unknown attribute location ${location}`);\n }\n const glType = getGLFromVertexType(attributeInfo.bufferDataType);\n return {\n size: attributeInfo.bufferComponents,\n type: glType,\n stride: attributeInfo.byteStride,\n offset: attributeInfo.byteOffset,\n normalized: attributeInfo.normalized,\n // it is the shader attribute declaration, not the vertex memory format,\n // that determines if the data in the buffer will be treated as integers.\n //\n // Also note that WebGL supports assigning non-normalized integer data to floating point attributes,\n // but as far as we can tell, WebGPU does not.\n integer: attributeInfo.integer,\n divisor: attributeInfo.stepMode === 'instance' ? 1 : 0\n };\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 protected _enable(location: number, enable = true): void {\n // Attribute 0 cannot be disabled in most desktop OpenGL based browsers...\n const canDisableAttributeZero = WEBGLVertexArray.isConstantAttributeZeroSupported(this.device);\n const canDisableAttribute = canDisableAttributeZero || location !== 0;\n\n if (enable || canDisableAttribute) {\n location = Number(location);\n this.device.gl2.bindVertexArray(this.handle);\n if (enable) {\n this.device.gl.enableVertexAttribArray(location);\n } else {\n this.device.gl.disableVertexAttribArray(location);\n }\n this.device.gl2.bindVertexArray(null);\n }\n }\n\n /**\n * Provide a means to create a buffer that is equivalent to a constant.\n * NOTE: Desktop OpenGL cannot disable attribute 0.\n * https://stackoverflow.com/questions/20305231/webgl-warning-attribute-0-is-disabled-\n * this-has-significant-performance-penalty\n */\n getConstantBuffer(elementCount: number, value: TypedArray): Buffer {\n // Create buffer only when needed, and reuse it (avoids inflating buffer creation statistics)\n\n const constantValue = normalizeConstantArrayValue(value);\n\n const byteLength = constantValue.byteLength * elementCount;\n const length = constantValue.length * elementCount;\n\n if (this.buffer && byteLength !== this.buffer.byteLength) {\n throw new Error(\n `Buffer size is immutable, byte length ${byteLength} !== ${this.buffer.byteLength}.`\n );\n }\n let updateNeeded = !this.buffer;\n\n this.buffer = this.buffer || this.device.createBuffer({byteLength});\n\n // Reallocate and update contents if needed\n updateNeeded = updateNeeded || !compareConstantArrayValues(constantValue, this.bufferValue);\n\n if (updateNeeded) {\n // Create a typed array that is big enough, and fill it with the required data\n const typedArray = getScratchArray(value.constructor, length);\n fillArray({target: typedArray, source: constantValue, start: 0, count: length});\n this.buffer.write(typedArray);\n this.bufferValue = value;\n }\n\n return this.buffer;\n }\n}\n\n// HELPER FUNCTIONS\n\n/**\n * TODO - convert Arrays based on known type? (read type from accessor, don't assume Float32Array)\n * TODO - handle single values for size 1 attributes?\n */\nfunction normalizeConstantArrayValue(arrayValue: NumberArray) {\n if (Array.isArray(arrayValue)) {\n return new Float32Array(arrayValue);\n }\n return arrayValue;\n}\n\n/**\n *\n */\nfunction compareConstantArrayValues(v1: NumberArray, v2: NumberArray): boolean {\n if (!v1 || !v2 || v1.length !== v2.length || v1.constructor !== v2.constructor) {\n return false;\n }\n for (let i = 0; i < v1.length; ++i) {\n if (v1[i] !== v2[i]) {\n return false;\n }\n }\n return true;\n}\n"],"mappings":";AAIA,SAAQA,WAAW,EAAEC,eAAe,EAAEC,SAAS,QAAO,eAAe;AACrE,SAAQC,EAAE,QAAO,oBAAoB;AACrC,SAAQC,UAAU,QAAO,eAAe;AAAC,SAKjCC,mBAAmB;AAAAC,mBAAA,GAMXC,MAAM,CAACC,WAAW;AADlC,OAAO,MAAMC,gBAAgB,SAAST,WAAW,CAAC;EAChD,KAAAM,mBAAA,IAA4C;IAC1C,OAAO,aAAa;EACtB;EAUA,OAAOI,gCAAgCA,CAACC,MAAc,EAAW;IAC/D,OAAOA,MAAM,CAACC,IAAI,CAACC,IAAI,KAAK,QAAQ,IAAIT,UAAU,CAAC,CAAC,KAAK,QAAQ;EACnE;EAGAU,WAAWA,CAACH,MAAmB,EAAEI,KAAwB,EAAE;IACzD,KAAK,CAACJ,MAAM,EAAEI,KAAK,CAAC;IAAC,KAddJ,MAAM;IAAA,KACNK,MAAM;IAAA,KAGPC,MAAM,GAAuB,IAAI;IAAA,KACjCC,WAAW,GAAG,IAAI;IAAA,KAuF1BC,IAAI,GAAG,KAAK;IA7EV,IAAI,CAACR,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACK,MAAM,GAAG,IAAI,CAACL,MAAM,CA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AAC,CAAC,EAAE;MACnB,OAAO,KAAK;IACd;EACF;EACA,OAAO,IAAI;AACb"}
@@ -2,7 +2,7 @@ import type { DeviceProps, DeviceInfo, DeviceLimits, DeviceFeature, CanvasContex
2
2
  import { Device, CanvasContext } from '@luma.gl/core';
3
3
  import { WebGLLimits } from './device-helpers/device-limits';
4
4
  import { WebGLCanvasContext } from './webgl-canvas-context';
5
- import type { BufferProps, ShaderProps, SamplerProps, TextureProps, ExternalTexture, ExternalTextureProps, FramebufferProps, RenderPipelineProps, ComputePipeline, ComputePipelineProps, RenderPassProps, ComputePass, ComputePassProps, CommandEncoderProps } from '@luma.gl/core';
5
+ import type { BufferProps, ShaderProps, SamplerProps, TextureProps, ExternalTexture, ExternalTextureProps, FramebufferProps, RenderPipelineProps, ComputePipeline, ComputePipelineProps, RenderPassProps, ComputePass, ComputePassProps, CommandEncoderProps, TransformFeedbackProps } from '@luma.gl/core';
6
6
  import { WEBGLBuffer } from './resources/webgl-buffer';
7
7
  import { WEBGLShader } from './resources/webgl-shader';
8
8
  import { WEBGLSampler } from './resources/webgl-sampler';
@@ -11,6 +11,7 @@ import { WEBGLFramebuffer } from './resources/webgl-framebuffer';
11
11
  import { WEBGLRenderPass } from './resources/webgl-render-pass';
12
12
  import { WEBGLRenderPipeline } from './resources/webgl-render-pipeline';
13
13
  import { WEBGLCommandEncoder } from './resources/webgl-command-encoder';
14
+ import { WEBGLTransformFeedback } from './resources/webgl-transform-feedback';
14
15
  /** WebGPU style Device API for a WebGL context */
15
16
  export declare class WebGLDevice extends Device {
16
17
  static type: string;
@@ -60,9 +61,10 @@ export declare class WebGLDevice extends Device {
60
61
  beginRenderPass(props: RenderPassProps): WEBGLRenderPass;
61
62
  createComputePipeline(props?: ComputePipelineProps): ComputePipeline;
62
63
  beginComputePass(props: ComputePassProps): ComputePass;
64
+ createTransformFeedback(props: TransformFeedbackProps): WEBGLTransformFeedback;
63
65
  private renderPass;
64
66
  getDefaultRenderPass(): WEBGLRenderPass;
65
- createCommandEncoder(props: CommandEncoderProps): WEBGLCommandEncoder;
67
+ createCommandEncoder(props?: CommandEncoderProps): WEBGLCommandEncoder;
66
68
  /**
67
69
  * Offscreen Canvas Support: Commit the frame
68
70
  * https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/commit
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-device.d.ts","sourceRoot":"","sources":["../../src/adapter/webgl-device.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,UAAU,EACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,MAAM,EAAE,aAAa,EAAmB,MAAM,eAAe,CAAC;AAetE,OAAO,EAAkC,WAAW,EAAC,MAAM,gCAAgC,CAAC;AAC5F,OAAO,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAU1D,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EAEX,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAEhB,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EAEpB,eAAe,EACf,WAAW,EACX,gBAAgB,EAEhB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAC,YAAY,EAAC,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAC,YAAY,EAAC,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAC,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAC,eAAe,EAAC,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAC,mBAAmB,EAAC,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAC,mBAAmB,EAAC,MAAM,mCAAmC,CAAC;A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