@luma.gl/webgl 9.0.0-alpha.40 → 9.0.0-alpha.42

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.
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-render-pipeline.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,YAAY,EAAE,mBAAmB,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAC9E,OAAO,KAAK,EAAC,YAAY,EAAoB,MAAM,eAAe,CAAC;AACnE,OAAO,KAAK,EAAC,UAAU,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,cAAc,EAAY,MAAM,eAAe,CAAC;AAUxD,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAQ3C,oCAAoC;AACpC,qBAAa,mBAAoB,SAAQ,cAAc;IACrD,yDAAyD;IACzD,MAAM,EAAE,WAAW,CAAC;IACpB,yCAAyC;IACzC,MAAM,EAAE,YAAY,CAAC;IACrB,oBAAoB;IACpB,EAAE,EAAE,WAAW,CAAC;IAChB,sBAAsB;IACtB,EAAE,EAAE,WAAW,CAAC;IAChB,mEAAmE;IACnE,kBAAkB,EAAE,YAAY,CAAC;IAEjC,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAM;IAC5C,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;IACvC,qBAAqB;IACrB,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAQ;IAEjC,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAC3C,oBAAoB,EAAE,MAAM,CAAK;IACjC,aAAa,EAAE,MAAM,CAAK;IAC1B,eAAe,E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C,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO;IAgHX,SAAS,CAAC,eAAe;IA4BzB;;;;OAIG;IACH,sBAAsB;IAoBtB;;;;;;;;;;;;;;;;;;;;MAoBE;IAEF,iDAAiD;IACjD,cAAc;IA8Ed;;;OAGG;IACH,cAAc;CASf"}
@@ -54,11 +54,12 @@ export class WEBGLRenderPipeline extends RenderPipeline {
54
54
  for (const [name, value] of Object.entries(bindings)) {
55
55
  const binding = this.shaderLayout.bindings.find(binding => binding.name === name);
56
56
  if (!binding) {
57
- log.warn(`Unknown binding ${name} in render pipeline ${this.id}`)();
57
+ const validBindings = this.shaderLayout.bindings.map(binding => `"${binding.name}"`).join(', ');
58
+ log.warn(`Unknown binding "${name}" in render pipeline "${this.id}", expected one of ${validBindings}`)();
58
59
  continue;
59
60
  }
60
61
  if (!value) {
61
- log.warn(`Unsetting binding ${name} in render pipeline ${this.id}`)();
62
+ log.warn(`Unsetting binding "${name}" in render pipeline "${this.id}"`)();
62
63
  }
63
64
  switch (binding.type) {
64
65
  case 'uniform':
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-render-pipeline.js","names":["RenderPipeline","cast","log","mergeShaderLayout","GL","getShaderLayout","withDeviceAndGLParameters","setUniform","WEBGLBuffer","WEBGLFramebuffer","WEBGLTexture","LOG_PROGRAM_PERF_PRIORITY","WEBGLRenderPipeline","constructor","device","props","handle","vs","fs","introspectedLayout","uniforms","bindings","varyings","_textureUniforms","_textureIndexCounter","_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","warn","type","buffer","Error","setUniforms","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","undefined","textureUnit","uniformBufferIndex","location","getUniformBlockIndex","INVALID_INDEX","uniformBlockBinding","bindBufferBase","UNIFORM_BUFFER","bindBufferRange","offset","size","byteLength","colorAttachments","activeTexture","TEXTURE0","bindTexture","target","uniformLayout","_this$uniforms$name","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, 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 _textureUniforms: Record<string, any> = {};\n _textureIndexCounter: number = 0;\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 const binding = this.shaderLayout.bindings.find(binding => binding.name === name);\n if (!binding) {\n log.warn(`Unknown binding ${name} in render pipeline ${this.id}`)();\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 // 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(this.device, this.props.parameters, webglRenderPass.glParameters, () => {\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 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._textureUniforms)) {\n texture.update();\n texturesRenderable = texturesRenderable && texture.loaded;\n }\n\n for (const [, texture] of Object.entries(this.bindings)) {\n // texture.update();\n // @ts-expect-error\n if (texture.loaded !== undefined) {\n // @ts-expect-error\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 const value = this.bindings[binding.name];\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 (value instanceof WEBGLFramebuffer && value.colorAttachments[0] instanceof WEBGLTexture) {\n log.warn('Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead')();\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,GAAG,QAAO,eAAe;AACvD,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,SAASZ,cAAc,CAAC;EAwBtDa,WAAWA,CAACC,MAAmB,EAAEC,KAA0B,EAAE;IAC3D,KAAK,CAACD,MAAM,EAAEC,KAAK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C,KAAK,iBAAiB;MAAE,OAAOhI,EAAE,CAACiI,SAAS;IAC3C,KAAK,eAAe;MAAE,OAAOjI,EAAE,CAACkI,SAAS;IACzC,KAAK,gBAAgB;MAAE,OAAOlI,EAAE,CAACmI,cAAc;IAC/C,KAAK,oBAAoB;MAAE,OAAOnI,EAAE,CAACoI,YAAY;IACjD;MAAS,MAAM,IAAInF,KAAK,CAACa,QAAQ,CAAC;EACpC;AACF;AAGA,SAASW,cAAcA,CAACX,QAA2B,EAAuC;EAExF,QAAQA,QAAQ;IACd,KAAK,YAAY;MAAE,OAAO9D,EAAE,CAAC8H,MAAM;IACnC,KAAK,WAAW;MAAE,OAAO9H,EAAE,CAAC+H,KAAK;IACjC,KAAK,YAAY;MAAE,OAAO/H,EAAE,CAAC+H,KAAK;IAClC,KAAK,iBAAiB;MAAE,OAAO/H,EAAE,CAAC+H,KAAK;IACvC,KAAK,eAAe;MAAE,OAAO/H,EAAE,CAACkI,SAAS;IACzC,KAAK,gBAAgB;MAAE,OAAOlI,EAAE,CAACkI,SAAS;IAC1C,KAAK,oBAAoB;MAAE,OAAOlI,EAAE,CAACkI,SAAS;IAC9C;MAAS,MAAM,IAAIjF,KAAK,CAACa,QAAQ,CAAC;EACpC;AACF"}
1
+ {"version":3,"file":"webgl-render-pipeline.js","names":["RenderPipeline","cast","log","mergeShaderLayout","GL","getShaderLayout","withDeviceAndGLParameters","setUniform","WEBGLBuffer","WEBGLFramebuffer","WEBGLTexture","LOG_PROGRAM_PERF_PRIORITY","WEBGLRenderPipeline","constructor","device","props","handle","vs","fs","introspectedLayout","uniforms","bindings","varyings","_textureUniforms","_textureIndexCounter","_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","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","undefined","textureUnit","uniformBufferIndex","location","getUniformBlockIndex","INVALID_INDEX","uniformBlockBinding","bindBufferBase","UNIFORM_BUFFER","bindBufferRange","offset","size","byteLength","colorAttachments","activeTexture","TEXTURE0","bindTexture","target","uniformLayout","_this$uniforms$name","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, 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 _textureUniforms: Record<string, any> = {};\n _textureIndexCounter: number = 0;\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 const binding = this.shaderLayout.bindings.find(binding => binding.name === name);\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 // 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._textureUniforms)) {\n texture.update();\n texturesRenderable = texturesRenderable && texture.loaded;\n }\n\n for (const [, texture] of Object.entries(this.bindings)) {\n // texture.update();\n // @ts-expect-error\n if (texture.loaded !== undefined) {\n // @ts-expect-error\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 const value = this.bindings[binding.name];\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,GAAG,QAAO,eAAe;AACvD,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;AAGn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yF,QAAQ,EAAE9D,IAAI,EAAET,KAAK,CAAC;MACnD;IACF;EACF;AACF;AAGA,SAASuB,aAAaA,CACpBC,QAA2B,EAQT;EAElB,QAAQA,QAAQ;IACd,KAAK,YAAY;MAAE,OAAOjE,EAAE,CAACiI,MAAM;IACnC,KAAK,WAAW;MAAE,OAAOjI,EAAE,CAACkI,KAAK;IACjC,KAAK,YAAY;MAAE,OAAOlI,EAAE,CAACmI,UAAU;IACvC,KAAK,iBAAiB;MAAE,OAAOnI,EAAE,CAACoI,SAAS;IAC3C,KAAK,eAAe;MAAE,OAAOpI,EAAE,CAACqI,SAAS;IACzC,KAAK,gBAAgB;MAAE,OAAOrI,EAAE,CAACsI,cAAc;IAC/C,KAAK,oBAAoB;MAAE,OAAOtI,EAAE,CAACuI,YAAY;IACjD;MAAS,MAAM,IAAInF,KAAK,CAACa,QAAQ,CAAC;EACpC;AACF;AAGA,SAASW,cAAcA,CAACX,QAA2B,EAAuC;EAExF,QAAQA,QAAQ;IACd,KAAK,YAAY;MAAE,OAAOjE,EAAE,CAACiI,MAAM;IACnC,KAAK,WAAW;MAAE,OAAOjI,EAAE,CAACkI,KAAK;IACjC,KAAK,YAAY;MAAE,OAAOlI,EAAE,CAACkI,KAAK;IAClC,KAAK,iBAAiB;MAAE,OAAOlI,EAAE,CAACkI,KAAK;IACvC,KAAK,eAAe;MAAE,OAAOlI,EAAE,CAACqI,SAAS;IACzC,KAAK,gBAAgB;MAAE,OAAOrI,EAAE,CAACqI,SAAS;IAC1C,KAAK,oBAAoB;MAAE,OAAOrI,EAAE,CAACqI,SAAS;IAC9C;MAAS,MAAM,IAAIjF,KAAK,CAACa,QAAQ,CAAC;EACpC;AACF"}
package/dist/dist.dev.js CHANGED
@@ -8985,11 +8985,12 @@ ${formattedLog}`)();
8985
8985
  for (const [name2, value] of Object.entries(bindings)) {
8986
8986
  const binding = this.shaderLayout.bindings.find((binding2) => binding2.name === name2);
8987
8987
  if (!binding) {
8988
- log.warn(`Unknown binding ${name2} in render pipeline ${this.id}`)();
8988
+ const validBindings = this.shaderLayout.bindings.map((binding2) => `"${binding2.name}"`).join(", ");
8989
+ log.warn(`Unknown binding "${name2}" in render pipeline "${this.id}", expected one of ${validBindings}`)();
8989
8990
  continue;
8990
8991
  }
8991
8992
  if (!value) {
8992
- log.warn(`Unsetting binding ${name2} in render pipeline ${this.id}`)();
8993
+ log.warn(`Unsetting binding "${name2}" in render pipeline "${this.id}"`)();
8993
8994
  }
8994
8995
  switch (binding.type) {
8995
8996
  case "uniform":
package/dist/index.cjs CHANGED
@@ -5282,11 +5282,14 @@ var WEBGLRenderPipeline = class extends import_core22.RenderPipeline {
5282
5282
  for (const [name, value] of Object.entries(bindings)) {
5283
5283
  const binding = this.shaderLayout.bindings.find((binding2) => binding2.name === name);
5284
5284
  if (!binding) {
5285
- import_core22.log.warn(`Unknown binding ${name} in render pipeline ${this.id}`)();
5285
+ const validBindings = this.shaderLayout.bindings.map((binding2) => `"${binding2.name}"`).join(", ");
5286
+ import_core22.log.warn(
5287
+ `Unknown binding "${name}" in render pipeline "${this.id}", expected one of ${validBindings}`
5288
+ )();
5286
5289
  continue;
5287
5290
  }
5288
5291
  if (!value) {
5289
- import_core22.log.warn(`Unsetting binding ${name} in render pipeline ${this.id}`)();
5292
+ import_core22.log.warn(`Unsetting binding "${name}" in render pipeline "${this.id}"`)();
5290
5293
  }
5291
5294
  switch (binding.type) {
5292
5295
  case "uniform":
@@ -5345,33 +5348,38 @@ var WEBGLRenderPipeline = class extends import_core22.RenderPipeline {
5345
5348
  this._applyBindings();
5346
5349
  this._applyUniforms();
5347
5350
  const webglRenderPass = renderPass;
5348
- withDeviceAndGLParameters(this.device, this.props.parameters, webglRenderPass.glParameters, () => {
5349
- var _a2, _b;
5350
- if (isIndexed && isInstanced) {
5351
- (_a2 = this.device.gl2) == null ? void 0 : _a2.drawElementsInstanced(
5352
- glDrawMode,
5353
- vertexCount || 0,
5354
- // indexCount?
5355
- glIndexType,
5356
- firstVertex,
5357
- instanceCount || 0
5358
- );
5359
- } else if (isIndexed) {
5360
- this.device.gl.drawElements(glDrawMode, vertexCount || 0, glIndexType, firstVertex);
5361
- } else if (isInstanced) {
5362
- (_b = this.device.gl2) == null ? void 0 : _b.drawArraysInstanced(
5363
- glDrawMode,
5364
- firstVertex,
5365
- vertexCount || 0,
5366
- instanceCount || 0
5367
- );
5368
- } else {
5369
- this.device.gl.drawArrays(glDrawMode, firstVertex, vertexCount || 0);
5370
- }
5371
- if (transformFeedback) {
5372
- transformFeedback.end();
5351
+ withDeviceAndGLParameters(
5352
+ this.device,
5353
+ this.props.parameters,
5354
+ webglRenderPass.glParameters,
5355
+ () => {
5356
+ var _a2, _b;
5357
+ if (isIndexed && isInstanced) {
5358
+ (_a2 = this.device.gl2) == null ? void 0 : _a2.drawElementsInstanced(
5359
+ glDrawMode,
5360
+ vertexCount || 0,
5361
+ // indexCount?
5362
+ glIndexType,
5363
+ firstVertex,
5364
+ instanceCount || 0
5365
+ );
5366
+ } else if (isIndexed) {
5367
+ this.device.gl.drawElements(glDrawMode, vertexCount || 0, glIndexType, firstVertex);
5368
+ } else if (isInstanced) {
5369
+ (_b = this.device.gl2) == null ? void 0 : _b.drawArraysInstanced(
5370
+ glDrawMode,
5371
+ firstVertex,
5372
+ vertexCount || 0,
5373
+ instanceCount || 0
5374
+ );
5375
+ } else {
5376
+ this.device.gl.drawArrays(glDrawMode, firstVertex, vertexCount || 0);
5377
+ }
5378
+ if (transformFeedback) {
5379
+ transformFeedback.end();
5380
+ }
5373
5381
  }
5374
- });
5382
+ );
5375
5383
  vertexArray.unbindAfterRender(renderPass);
5376
5384
  return true;
5377
5385
  }
@@ -5482,7 +5490,9 @@ var WEBGLRenderPipeline = class extends import_core22.RenderPipeline {
5482
5490
  if (value instanceof WEBGLTexture) {
5483
5491
  texture = value;
5484
5492
  } else if (value instanceof WEBGLFramebuffer && value.colorAttachments[0] instanceof WEBGLTexture) {
5485
- import_core22.log.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")();
5493
+ import_core22.log.warn(
5494
+ "Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead"
5495
+ )();
5486
5496
  texture = value.colorAttachments[0];
5487
5497
  } else {
5488
5498
  throw new Error("No texture");