@luma.gl/webgl 9.0.0-alpha.31 → 9.0.0-alpha.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/helpers/set-uniform.d.ts +3 -2
- package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
- package/dist/adapter/helpers/set-uniform.js +25 -25
- package/dist/adapter/helpers/set-uniform.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.d.ts +3 -2
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
- package/dist/classic/buffer-with-accessor.d.ts +0 -1
- package/dist/classic/buffer-with-accessor.d.ts.map +1 -1
- package/dist/classic/buffer-with-accessor.js +0 -1
- package/dist/classic/buffer-with-accessor.js.map +1 -1
- package/dist/dist.dev.js +36 -28
- package/dist/index.cjs +30 -28
- package/dist.min.js +20 -20
- package/package.json +5 -5
- package/src/adapter/helpers/set-uniform.ts +33 -33
- package/src/adapter/resources/webgl-render-pipeline.ts +12 -13
- package/src/classic/buffer-with-accessor.ts +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { UniformValue } from '@luma.gl/core';
|
|
2
|
+
import { GLCompositeType, GLSamplerType } from '@luma.gl/constants';
|
|
2
3
|
/** Set a raw uniform (without type conversion and caching) */
|
|
3
|
-
export declare function setUniform(gl: WebGLRenderingContext, location: WebGLUniformLocation, type:
|
|
4
|
+
export declare function setUniform(gl: WebGLRenderingContext, location: WebGLUniformLocation, type: GLCompositeType | GLSamplerType, value: UniformValue): void;
|
|
4
5
|
//# sourceMappingURL=set-uniform.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-uniform.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/set-uniform.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"set-uniform.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/set-uniform.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,EAAK,eAAe,EAAE,aAAa,EAAC,MAAM,oBAAoB,CAAC;AAEtE,8DAA8D;AAE9D,wBAAgB,UAAU,CACxB,EAAE,EAAE,qBAAqB,EACzB,QAAQ,EAAE,oBAAoB,EAC9B,IAAI,EAAE,eAAe,GAAG,aAAa,EACrC,KAAK,EAAE,YAAY,GAClB,IAAI,CA0EN"}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { GL } from '@luma.gl/constants';
|
|
2
2
|
export function setUniform(gl, location, type, value) {
|
|
3
3
|
const gl2 = gl;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
case GL.SAMPLER_CUBE:
|
|
8
|
-
case GL.SAMPLER_3D:
|
|
9
|
-
case GL.SAMPLER_2D_SHADOW:
|
|
10
|
-
case GL.SAMPLER_2D_ARRAY:
|
|
11
|
-
case GL.SAMPLER_2D_ARRAY_SHADOW:
|
|
12
|
-
case GL.SAMPLER_CUBE_SHADOW:
|
|
13
|
-
case GL.INT_SAMPLER_2D:
|
|
14
|
-
case GL.INT_SAMPLER_3D:
|
|
15
|
-
case GL.INT_SAMPLER_CUBE:
|
|
16
|
-
case GL.INT_SAMPLER_2D_ARRAY:
|
|
17
|
-
case GL.UNSIGNED_INT_SAMPLER_2D:
|
|
18
|
-
case GL.UNSIGNED_INT_SAMPLER_3D:
|
|
19
|
-
case GL.UNSIGNED_INT_SAMPLER_CUBE:
|
|
20
|
-
case GL.UNSIGNED_INT_SAMPLER_2D_ARRAY:
|
|
21
|
-
return gl.uniform1i(location, value);
|
|
22
|
-
}
|
|
4
|
+
let uniformValue = value;
|
|
5
|
+
if (uniformValue === true) {
|
|
6
|
+
uniformValue = 1;
|
|
23
7
|
}
|
|
24
|
-
if (
|
|
25
|
-
|
|
8
|
+
if (uniformValue === false) {
|
|
9
|
+
uniformValue = 0;
|
|
26
10
|
}
|
|
27
|
-
|
|
28
|
-
value = 0;
|
|
29
|
-
}
|
|
30
|
-
const arrayValue = typeof value === 'number' ? [value] : value;
|
|
11
|
+
const arrayValue = typeof uniformValue === 'number' ? [uniformValue] : uniformValue;
|
|
31
12
|
switch (type) {
|
|
13
|
+
case GL.SAMPLER_2D:
|
|
14
|
+
case GL.SAMPLER_CUBE:
|
|
15
|
+
case GL.SAMPLER_3D:
|
|
16
|
+
case GL.SAMPLER_2D_SHADOW:
|
|
17
|
+
case GL.SAMPLER_2D_ARRAY:
|
|
18
|
+
case GL.SAMPLER_2D_ARRAY_SHADOW:
|
|
19
|
+
case GL.SAMPLER_CUBE_SHADOW:
|
|
20
|
+
case GL.INT_SAMPLER_2D:
|
|
21
|
+
case GL.INT_SAMPLER_3D:
|
|
22
|
+
case GL.INT_SAMPLER_CUBE:
|
|
23
|
+
case GL.INT_SAMPLER_2D_ARRAY:
|
|
24
|
+
case GL.UNSIGNED_INT_SAMPLER_2D:
|
|
25
|
+
case GL.UNSIGNED_INT_SAMPLER_3D:
|
|
26
|
+
case GL.UNSIGNED_INT_SAMPLER_CUBE:
|
|
27
|
+
case GL.UNSIGNED_INT_SAMPLER_2D_ARRAY:
|
|
28
|
+
if (typeof value !== 'number') {
|
|
29
|
+
throw new Error('samplers must be set to integers');
|
|
30
|
+
}
|
|
31
|
+
return gl.uniform1i(location, value);
|
|
32
32
|
case GL.FLOAT:
|
|
33
33
|
return gl.uniform1fv(location, arrayValue);
|
|
34
34
|
case GL.FLOAT_VEC2:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-uniform.js","names":["GL","setUniform","gl","location","type","value","gl2","SAMPLER_2D","SAMPLER_CUBE","SAMPLER_3D","SAMPLER_2D_SHADOW","SAMPLER_2D_ARRAY","SAMPLER_2D_ARRAY_SHADOW","SAMPLER_CUBE_SHADOW","INT_SAMPLER_2D","INT_SAMPLER_3D","INT_SAMPLER_CUBE","INT_SAMPLER_2D_ARRAY","UNSIGNED_INT_SAMPLER_2D","UNSIGNED_INT_SAMPLER_3D","UNSIGNED_INT_SAMPLER_CUBE","UNSIGNED_INT_SAMPLER_2D_ARRAY","
|
|
1
|
+
{"version":3,"file":"set-uniform.js","names":["GL","setUniform","gl","location","type","value","gl2","uniformValue","arrayValue","SAMPLER_2D","SAMPLER_CUBE","SAMPLER_3D","SAMPLER_2D_SHADOW","SAMPLER_2D_ARRAY","SAMPLER_2D_ARRAY_SHADOW","SAMPLER_CUBE_SHADOW","INT_SAMPLER_2D","INT_SAMPLER_3D","INT_SAMPLER_CUBE","INT_SAMPLER_2D_ARRAY","UNSIGNED_INT_SAMPLER_2D","UNSIGNED_INT_SAMPLER_3D","UNSIGNED_INT_SAMPLER_CUBE","UNSIGNED_INT_SAMPLER_2D_ARRAY","Error","uniform1i","FLOAT","uniform1fv","FLOAT_VEC2","uniform2fv","FLOAT_VEC3","uniform3fv","FLOAT_VEC4","uniform4fv","INT","uniform1iv","INT_VEC2","uniform2iv","INT_VEC3","uniform3iv","INT_VEC4","uniform4iv","BOOL","BOOL_VEC2","BOOL_VEC3","BOOL_VEC4","UNSIGNED_INT","uniform1uiv","UNSIGNED_INT_VEC2","uniform2uiv","UNSIGNED_INT_VEC3","uniform3uiv","UNSIGNED_INT_VEC4","uniform4uiv","FLOAT_MAT2","uniformMatrix2fv","FLOAT_MAT3","uniformMatrix3fv","FLOAT_MAT4","uniformMatrix4fv","FLOAT_MAT2x3","uniformMatrix2x3fv","FLOAT_MAT2x4","uniformMatrix2x4fv","FLOAT_MAT3x2","uniformMatrix3x2fv","FLOAT_MAT3x4","uniformMatrix3x4fv","FLOAT_MAT4x2","uniformMatrix4x2fv","FLOAT_MAT4x3","uniformMatrix4x3fv"],"sources":["../../../src/adapter/helpers/set-uniform.ts"],"sourcesContent":["/* eslint-disable */\n\n// Uniforms\nimport type {UniformValue} from '@luma.gl/core';\nimport {GL, GLCompositeType, GLSamplerType} from '@luma.gl/constants';\n\n/** Set a raw uniform (without type conversion and caching) */\n/* eslint-disable max-len */\nexport function setUniform(\n gl: WebGLRenderingContext,\n location: WebGLUniformLocation,\n type: GLCompositeType | GLSamplerType,\n value: UniformValue\n): void {\n const gl2 = gl as WebGL2RenderingContext;\n\n // Prepare the value for WebGL setters\n let uniformValue = value;\n if (uniformValue === true) {\n uniformValue = 1;\n }\n if (uniformValue === false) {\n uniformValue = 0;\n }\n const arrayValue = typeof uniformValue === 'number' ? [uniformValue] : uniformValue;\n\n // prettier-ignore\n switch (type) {\n // WebGL1 samplers\n case GL.SAMPLER_2D:\n case GL.SAMPLER_CUBE:\n // WebGL2 samplers\n case GL.SAMPLER_3D:\n case GL.SAMPLER_2D_SHADOW:\n case GL.SAMPLER_2D_ARRAY:\n case GL.SAMPLER_2D_ARRAY_SHADOW:\n case GL.SAMPLER_CUBE_SHADOW:\n case GL.INT_SAMPLER_2D:\n case GL.INT_SAMPLER_3D:\n case GL.INT_SAMPLER_CUBE:\n case GL.INT_SAMPLER_2D_ARRAY:\n case GL.UNSIGNED_INT_SAMPLER_2D:\n case GL.UNSIGNED_INT_SAMPLER_3D:\n case GL.UNSIGNED_INT_SAMPLER_CUBE:\n case GL.UNSIGNED_INT_SAMPLER_2D_ARRAY:\n if (typeof value !== 'number') {\n throw new Error('samplers must be set to integers');\n }\n return gl.uniform1i(location, value);\n\n case GL.FLOAT: return gl.uniform1fv(location, arrayValue);\n case GL.FLOAT_VEC2: return gl.uniform2fv(location, arrayValue);\n case GL.FLOAT_VEC3: return gl.uniform3fv(location, arrayValue);\n case GL.FLOAT_VEC4: return gl.uniform4fv(location, arrayValue);\n\n case GL.INT: return gl.uniform1iv(location, arrayValue);\n case GL.INT_VEC2: return gl.uniform2iv(location, arrayValue);\n case GL.INT_VEC3: return gl.uniform3iv(location, arrayValue);\n case GL.INT_VEC4: return gl.uniform4iv(location, arrayValue);\n\n case GL.BOOL: return gl.uniform1iv(location, arrayValue);\n case GL.BOOL_VEC2: return gl.uniform2iv(location, arrayValue);\n case GL.BOOL_VEC3: return gl.uniform3iv(location, arrayValue);\n case GL.BOOL_VEC4: return gl.uniform4iv(location, arrayValue);\n\n // WEBGL2 - unsigned integers\n case GL.UNSIGNED_INT: return gl2.uniform1uiv(location, arrayValue, 1);\n case GL.UNSIGNED_INT_VEC2: return gl2.uniform2uiv(location, arrayValue, 2);\n case GL.UNSIGNED_INT_VEC3: return gl2.uniform3uiv(location, arrayValue, 3);\n case GL.UNSIGNED_INT_VEC4: return gl2.uniform4uiv(location, arrayValue, 4);\n\n // WebGL2 - quadratic matrices\n // false: don't transpose the matrix\n case GL.FLOAT_MAT2: return gl.uniformMatrix2fv(location, false, arrayValue);\n case GL.FLOAT_MAT3: return gl.uniformMatrix3fv(location, false, arrayValue);\n case GL.FLOAT_MAT4: return gl.uniformMatrix4fv(location, false, arrayValue);\n\n // WebGL2 - rectangular matrices\n case GL.FLOAT_MAT2x3: return gl2.uniformMatrix2x3fv(location, false, arrayValue);\n case GL.FLOAT_MAT2x4: return gl2.uniformMatrix2x4fv(location, false, arrayValue);\n case GL.FLOAT_MAT3x2: return gl2.uniformMatrix3x2fv(location, false, arrayValue);\n case GL.FLOAT_MAT3x4: return gl2.uniformMatrix3x4fv(location, false, arrayValue);\n case GL.FLOAT_MAT4x2: return gl2.uniformMatrix4x2fv(location, false, arrayValue);\n case GL.FLOAT_MAT4x3: return gl2.uniformMatrix4x3fv(location, false, arrayValue);\n }\n\n throw new Error('Illegal uniform');\n}\n"],"mappings":"AAIA,SAAQA,EAAE,QAAuC,oBAAoB;AAIrE,OAAO,SAASC,UAAUA,CACxBC,EAAyB,EACzBC,QAA8B,EAC9BC,IAAqC,EACrCC,KAAmB,EACb;EACN,MAAMC,GAAG,GAAGJ,EAA4B;EAGxC,IAAIK,YAAY,GAAGF,KAAK;EACxB,IAAIE,YAAY,KAAK,IAAI,EAAE;IACzBA,YAAY,GAAG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@@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TypedArray, UniformValue, RenderPipelineProps, Binding, ShaderLayout, BufferLayout } from '@luma.gl/core';
|
|
2
|
+
import type { RenderPass, Buffer } from '@luma.gl/core';
|
|
2
3
|
import { RenderPipeline } from '@luma.gl/core';
|
|
3
4
|
import { WebGLDevice } from '../webgl-device';
|
|
4
5
|
import { WEBGLBuffer } from './webgl-buffer';
|
|
@@ -53,7 +54,7 @@ export declare class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
53
54
|
* @todo needed for portable model
|
|
54
55
|
*/
|
|
55
56
|
setBindings(bindings: Record<string, Binding>): void;
|
|
56
|
-
setUniforms(uniforms: Record<string,
|
|
57
|
+
setUniforms(uniforms: Record<string, UniformValue>): void;
|
|
57
58
|
/** @todo needed for portable model
|
|
58
59
|
* @note The WebGL API is offers many ways to draw things
|
|
59
60
|
* This function unifies those ways into a single call using common parameters with sane defaults
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-render-pipeline.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgl-render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-render-pipeline.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,OAAO,EACP,YAAY,EACZ,YAAY,EAEb,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAC,UAAU,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AACtD,OAAO,EAAC,cAAc,EAAY,MAAM,eAAe,CAAC;AAUxD,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAC,sBAAsB,EAAC,MAAM,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C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,IAAI;IAenE;;;OAGG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAqCpD,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC;IAKlD;;;OAGG;IACH,IAAI,CAAC,OAAO,EAAE;QACZ,UAAU,EAAE,UAAU,CAAC;QACvB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO;IAmFX,SAAS,CAAC,eAAe;IA0BzB;;;;OAIG;IACH,sBAAsB;IAkBtB;;;;;OAKG;IACH,wBAAwB,IAAI,IAAI;IAchC,iDAAiD;IACjD,cAAc;IA6Dd;;;OAGG;IACH,cAAc;CASf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-render-pipeline.js","names":["RenderPipeline","cast","log","mergeShaderLayout","getAttributeInfosFromLayouts","GL","getGLFromVertexType","getShaderLayout","withDeviceParameters","withGLParameters","setUniform","WEBGLBuffer","WEBGLTexture","WEBGLVertexArrayObject","LOG_PROGRAM_PERF_PRIORITY","WEBGLRenderPipeline","constructor","device","props","_defineProperty","handle","gl","createProgram","setSpectorMetadata","id","vs","fs","varyings","bufferMode","SEPARATE_ATTRIBS","length","_this$device$gl","assertWebGL2","gl2","transformFeedbackVaryings","_compileAndLink","introspectedLayout","shaderLayout","bufferLayout","vertexArrayObject","destroy","deleteProgram","destroyed","setIndexBuffer","indexBuffer","webglBuffer","setElementBuffer","_indexBuffer","setAttributes","buffers","attributeInfos","bufferName","buffer","Object","entries","set","attributeInfo","values","glType","bufferDataType","setAttribute","name","toBuffer","size","bufferComponents","type","stride","byteStride","offset","byteOffset","normalized","integer","divisor","stepMode","setBuffer","location","warn","concat","setConstantAttributes","attributes","assign","constantAttributes","setBindings","bindings","value","binding","find","Error","setUniforms","uniforms","draw","options","_this$_indexBuffer","renderPass","vertexCount","instanceCount","firstVertex","drawMode","getGLDrawMode","topology","isIndexed","Boolean","indexType","glIndexType","isInstanced","Number","_areTexturesRenderable","useProgram","bind","primitiveMode","getGLPrimitive","transformFeedback","begin","_applyBindings","_applyUniforms","_applyConstantAttributes","webglRenderPass","parameters","glParameters","_this$device$gl2","drawElementsInstanced","drawElements","_this$device$gl3","drawArraysInstanced","drawArrays","end","attachShader","time","linkProgram","timeEnd","debug","level","linked","getProgramParameter","LINK_STATUS","getProgramInfoLog","validateProgram","validated","VALIDATE_STATUS","texturesRenderable","texture","_textureUniforms","update","loaded","undefined","setConstant","textureUnit","uniformBufferIndex","getUniformBlockIndex","INVALID_INDEX","uniformBlockBinding","bindBufferBase","UNIFORM_BUFFER","bindBufferRange","byteLength","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":["import type {\n RenderPipelineProps,\n RenderPass,\n Buffer,\n Binding,\n ShaderLayout,\n PrimitiveTopology,\n TypedArray,\n BufferLayout\n} from '@luma.gl/core';\nimport {RenderPipeline, cast, log} from '@luma.gl/core';\nimport {\n mergeShaderLayout,\n getAttributeInfosFromLayouts\n} from '@luma.gl/core';\nimport {GL} from '@luma.gl/constants';\n\nimport {getGLFromVertexType} from '../converters/vertex-formats';\nimport {getShaderLayout} from '../helpers/get-shader-layout';\nimport {withDeviceParameters, withGLParameters} 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 {WEBGLTexture} from './webgl-texture';\nimport {WEBGLVertexArrayObject} from '../objects/webgl-vertex-array-object';\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 /** The merged layout */\n shaderLayout: ShaderLayout;\n /** Buffer map describing buffer interleaving etc */\n bufferLayout: BufferLayout[];\n\n /** Uniforms set on this model */\n uniforms: Record<string, any> = {};\n /** Bindings set on this model */\n bindings: Record<string, any> = {};\n /** Any constant attributes */\n constantAttributes: Record<string, TypedArray> = {};\n /** Index buffer is stored separately */\n _indexBuffer?: WEBGLBuffer;\n /** WebGL varyings */\n varyings: string[] | null = null;\n\n /** Stores attribute bindings */\n vertexArrayObject: WEBGLVertexArrayObject;\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 this.vertexArrayObject = new WEBGLVertexArrayObject(this.device);\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 = webglBuffer;\n }\n\n\n /** @todo needed for portable model */\n setAttributes(buffers: Record<string, Buffer>): void {\n const attributeInfos = getAttributeInfosFromLayouts(this.shaderLayout, this.bufferLayout);\n\n for (const [bufferName, buffer] of Object.entries(buffers)) {\n let set = false;\n for (const attributeInfo of Object.values(attributeInfos)) {\n if (attributeInfo.bufferName !== bufferName) {\n continue; // eslint-disable-line no-continue\n }\n const webglBuffer = cast<WEBGLBuffer>(buffer);\n\n const glType = getGLFromVertexType(attributeInfo.bufferDataType);\n // TODO remove when we have more confidence\n log.log(1, {\n setAttribute: attributeInfo.name,\n toBuffer: bufferName,\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 this.vertexArrayObject.setBuffer(attributeInfo.location, webglBuffer, {\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 set = true;\n }\n if (!set) {\n log.warn(`setAttributes(): Ignoring (buffer \"${buffer.id}\" for unknown attribute \"${name}\" in pipeline \"${this.id}\"`)();\n }\n }\n }\n\n /**\n * Constant attributes are only supported in WebGL, not in WebGPU\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 * @param attributes\n */\n setConstantAttributes(attributes: Record<string, TypedArray>): void {\n // TODO - there should be no advantage to setting these here vs in _applyConstantAttributes\n // for (const [name, value] of Object.entries(attributes)) {\n // const attributeInfo = getAttributeInfosFromLayouts(this.shaderLayout, this.bufferLayout, 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 // this.vertexArrayObject.setConstant(attributeInfo.location, value);\n // }\n Object.assign(this.constantAttributes, attributes);\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)) {\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, any>) {\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 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 vertexCount,\n // indexCount,\n instanceCount,\n firstVertex = 0\n // firstIndex,\n // firstInstance,\n // baseVertex\n } = options;\n\n const drawMode = getGLDrawMode(this.props.topology);\n const isIndexed: boolean = Boolean(this._indexBuffer);\n const indexType = this._indexBuffer?.glIndexType;\n const isInstanced: boolean = Number(options.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() || options.vertexCount === 0) {\n // (isInstanced && instanceCount === 0)\n return false;\n }\n\n this.device.gl.useProgram(this.handle);\n\n this.vertexArrayObject.bind(() => {\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 this._applyConstantAttributes();\n\n const webglRenderPass = renderPass as WEBGLRenderPass;\n\n // TODO - double context push/pop\n withDeviceParameters(this.device, this.props.parameters, () => {\n withGLParameters(this.device, webglRenderPass.glParameters, () => {\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 if (transformFeedback) {\n transformFeedback.end();\n }\n });\n });\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 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\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 if (texture.loaded !== undefined) {\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(): void {\n const attributeInfos = getAttributeInfosFromLayouts(this.shaderLayout, this.bufferLayout);\n for (const [name, value] of Object.entries(this.constantAttributes)) {\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 this.vertexArrayObject.setConstant(attributeInfo.location, value);\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 value.buffer.handle,\n value.offset || 0,\n value.size || value.buffer.byteLength - value.offset\n );\n }\n uniformBufferIndex += 1;\n break;\n\n case 'texture':\n if (!(value instanceof WEBGLTexture)) {\n throw new Error('texture');\n }\n const texture: WEBGLTexture = value;\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-web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AC;EACpC;AACF"}
|
|
1
|
+
{"version":3,"file":"webgl-render-pipeline.js","names":["RenderPipeline","cast","log","mergeShaderLayout","getAttributeInfosFromLayouts","GL","getGLFromVertexType","getShaderLayout","withDeviceParameters","withGLParameters","setUniform","WEBGLBuffer","WEBGLTexture","WEBGLVertexArrayObject","LOG_PROGRAM_PERF_PRIORITY","WEBGLRenderPipeline","constructor","device","props","_defineProperty","handle","gl","createProgram","setSpectorMetadata","id","vs","fs","varyings","bufferMode","SEPARATE_ATTRIBS","length","_this$device$gl","assertWebGL2","gl2","transformFeedbackVaryings","_compileAndLink","introspectedLayout","shaderLayout","bufferLayout","vertexArrayObject","destroy","deleteProgram","destroyed","setIndexBuffer","indexBuffer","webglBuffer","setElementBuffer","_indexBuffer","setAttributes","buffers","attributeInfos","bufferName","buffer","Object","entries","set","attributeInfo","values","glType","bufferDataType","setAttribute","name","toBuffer","size","bufferComponents","type","stride","byteStride","offset","byteOffset","normalized","integer","divisor","stepMode","setBuffer","location","warn","concat","setConstantAttributes","attributes","assign","constantAttributes","setBindings","bindings","value","binding","find","Error","setUniforms","uniforms","draw","options","_this$_indexBuffer","renderPass","vertexCount","instanceCount","firstVertex","drawMode","getGLDrawMode","topology","isIndexed","Boolean","indexType","glIndexType","isInstanced","Number","_areTexturesRenderable","useProgram","bind","primitiveMode","getGLPrimitive","transformFeedback","begin","_applyBindings","_applyUniforms","_applyConstantAttributes","webglRenderPass","parameters","glParameters","_this$device$gl2","drawElementsInstanced","drawElements","_this$device$gl3","drawArraysInstanced","drawArrays","end","attachShader","time","linkProgram","timeEnd","debug","level","linked","getProgramParameter","LINK_STATUS","getProgramInfoLog","validateProgram","validated","VALIDATE_STATUS","texturesRenderable","texture","_textureUniforms","update","loaded","undefined","setConstant","textureUnit","uniformBufferIndex","getUniformBlockIndex","INVALID_INDEX","uniformBlockBinding","bindBufferBase","UNIFORM_BUFFER","bindBufferRange","byteLength","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\nimport type {\n TypedArray,\n UniformValue,\n RenderPipelineProps,\n Binding,\n ShaderLayout,\n BufferLayout,\n PrimitiveTopology\n} from '@luma.gl/core';\nimport type {RenderPass, Buffer} from '@luma.gl/core';\nimport {RenderPipeline, cast, log} from '@luma.gl/core';\nimport {mergeShaderLayout, getAttributeInfosFromLayouts} from '@luma.gl/core';\nimport {GL} from '@luma.gl/constants';\n\nimport {getGLFromVertexType} from '../converters/vertex-formats';\nimport {getShaderLayout} from '../helpers/get-shader-layout';\nimport {withDeviceParameters, withGLParameters} 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 {WEBGLTexture} from './webgl-texture';\nimport {WEBGLVertexArrayObject} from '../objects/webgl-vertex-array-object';\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 /** The merged layout */\n shaderLayout: ShaderLayout;\n /** Buffer map describing buffer interleaving etc */\n bufferLayout: BufferLayout[];\n\n /** Uniforms set on this model */\n uniforms: Record<string, any> = {};\n /** Bindings set on this model */\n bindings: Record<string, any> = {};\n /** Any constant attributes */\n constantAttributes: Record<string, TypedArray> = {};\n /** Index buffer is stored separately */\n _indexBuffer?: WEBGLBuffer;\n /** WebGL varyings */\n varyings: string[] | null = null;\n\n /** Stores attribute bindings */\n vertexArrayObject: WEBGLVertexArrayObject;\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 this.vertexArrayObject = new WEBGLVertexArrayObject(this.device);\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 = webglBuffer;\n }\n\n /** @todo needed for portable model */\n setAttributes(buffers: Record<string, Buffer>): void {\n const attributeInfos = getAttributeInfosFromLayouts(this.shaderLayout, this.bufferLayout);\n\n for (const [bufferName, buffer] of Object.entries(buffers)) {\n let set = false;\n for (const attributeInfo of Object.values(attributeInfos)) {\n if (attributeInfo.bufferName !== bufferName) {\n continue; // eslint-disable-line no-continue\n }\n const webglBuffer = cast<WEBGLBuffer>(buffer);\n\n const glType = getGLFromVertexType(attributeInfo.bufferDataType);\n // TODO remove when we have more confidence\n log.log(1, {\n setAttribute: attributeInfo.name,\n toBuffer: bufferName,\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 this.vertexArrayObject.setBuffer(attributeInfo.location, webglBuffer, {\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 set = true;\n }\n if (!set) {\n log.warn(\n `setAttributes(): Ignoring (buffer \"${buffer.id}\" for unknown attribute \"${name}\" in pipeline \"${this.id}\"`\n )();\n }\n }\n }\n\n /**\n * Constant attributes are only supported in WebGL, not in WebGPU\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 * @param attributes\n */\n setConstantAttributes(attributes: Record<string, TypedArray>): void {\n // TODO - there should be no advantage to setting these here vs in _applyConstantAttributes\n // for (const [name, value] of Object.entries(attributes)) {\n // const attributeInfo = getAttributeInfosFromLayouts(this.shaderLayout, this.bufferLayout, 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 // this.vertexArrayObject.setConstant(attributeInfo.location, value);\n // }\n Object.assign(this.constantAttributes, attributes);\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)) {\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 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 vertexCount,\n // indexCount,\n instanceCount,\n firstVertex = 0\n // firstIndex,\n // firstInstance,\n // baseVertex\n } = options;\n\n const drawMode = getGLDrawMode(this.props.topology);\n const isIndexed: boolean = Boolean(this._indexBuffer);\n const indexType = this._indexBuffer?.glIndexType;\n const isInstanced: boolean = Number(options.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() || options.vertexCount === 0) {\n // (isInstanced && instanceCount === 0)\n return false;\n }\n\n this.device.gl.useProgram(this.handle);\n\n this.vertexArrayObject.bind(() => {\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 this._applyConstantAttributes();\n\n const webglRenderPass = renderPass as WEBGLRenderPass;\n\n // TODO - double context push/pop\n withDeviceParameters(this.device, this.props.parameters, () => {\n withGLParameters(this.device, webglRenderPass.glParameters, () => {\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 if (transformFeedback) {\n transformFeedback.end();\n }\n });\n });\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 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\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 if (texture.loaded !== undefined) {\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(): void {\n const attributeInfos = getAttributeInfosFromLayouts(this.shaderLayout, this.bufferLayout);\n for (const [name, value] of Object.entries(this.constantAttributes)) {\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 this.vertexArrayObject.setConstant(attributeInfo.location, value);\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 value.buffer.handle,\n value.offset || 0,\n value.size || value.buffer.byteLength - value.offset\n );\n }\n uniformBufferIndex += 1;\n break;\n\n case 'texture':\n if (!(value instanceof WEBGLTexture)) {\n throw new Error('texture');\n }\n const texture: WEBGLTexture = value;\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":";AAWA,SAAQA,cAAc,EAAEC,IAAI,EAAEC,GAAG,QAAO,eAAe;AACvD,SAAQC,iBAAiB,EAAEC,4BAA4B,QAAO,eAAe;AAC7E,SAAQC,EAAE,QAAO,oBAAoB;AAAC,SAE9BC,mBAAmB;AAAA,SACnBC,eAAe;AAAA,SACfC,oBAAoB,EAAEC,gBAAgB;AAAA,SACtCC,UAAU;AAAA,SAIVC,WAAW;AAAA,SAEXC,YAAY;AAAA,SACZC,sBAAsB;AAG9B,MAAMC,yBAAyB,GAAG,CAAC;AAGnC,OAAO,MAAMC,mBAAmB,SAASf,cAAc,CAAC;EAmCtDgB,WAAWA,CAACC,MAAmB,EAAEC,KAA0B,EAAE;IAC3D,KAAK,CAACD,MAAM,EAAEC,KAAK,CAAC;IAACC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,mBAnBS,CAAC,CAAC;IAAAA,eAAA,mBAEF,CAAC,CAAC;IAAAA,e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S,MAAM,IAAIhF,KAAK,CAACY,QAAQ,CAAC;EACpC;AACF;AAGA,SAASW,cAAcA,CAACX,QAA2B,EAAuC;EAExF,QAAQA,QAAQ;IACd,KAAK,YAAY;MAAE,OAAO9F,EAAE,CAAC4J,MAAM;IACnC,KAAK,WAAW;MAAE,OAAO5J,EAAE,CAAC6J,KAAK;IACjC,KAAK,YAAY;MAAE,OAAO7J,EAAE,CAAC6J,KAAK;IAClC,KAAK,iBAAiB;MAAE,OAAO7J,EAAE,CAAC6J,KAAK;IACvC,KAAK,eAAe;MAAE,OAAO7J,EAAE,CAACgK,SAAS;IACzC,KAAK,gBAAgB;MAAE,OAAOhK,EAAE,CAACgK,SAAS;IAC1C,KAAK,oBAAoB;MAAE,OAAOhK,EAAE,CAACgK,SAAS;IAC9C;MAAS,MAAM,IAAI9E,KAAK,CAACY,QAAQ,CAAC;EACpC;AACF"}
|
|
@@ -10,7 +10,6 @@ export type BufferWithAccessorProps = BufferProps & {
|
|
|
10
10
|
};
|
|
11
11
|
/** WebGL Buffer interface */
|
|
12
12
|
export declare class BufferWithAccessor extends WEBGLBuffer {
|
|
13
|
-
usage: number;
|
|
14
13
|
accessor: Accessor;
|
|
15
14
|
constructor(device: Device | WebGLRenderingContext, props?: BufferWithAccessorProps);
|
|
16
15
|
constructor(device: Device | WebGLRenderingContext, data: ArrayBufferView | number[]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer-with-accessor.d.ts","sourceRoot":"","sources":["../../src/classic/buffer-with-accessor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAEnE,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AAEtC,OAAO,EAAC,cAAc,EAAC,MAAM,UAAU,CAAC;AACxC,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAIpC,OAAO,EAAC,WAAW,EAAC,MAAM,m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KAChB;IAQH,mBAAmB;IAOnB,QAAQ,CAAC,IAAI,KAAA,EAAE,MAAM,GAAE,MAAU,EAAE,UAAU,GAAE,MAAiC,GAAG,IAAI;IAwBvF,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IA6BxC,UAAU;IAKV,yBAAyB,CAAC,aAAa,EAAE,MAAM;IAQ/C,UAAU,CAAC,IAAI,KAAA;IAQf,YAAY,CAAC,KAAK,EAAE,EAAE,GAAG,GAAG;IAQ5B,2CAA2C;IAC3C,IAAI,IAAI,WAEP;CACF"}
|
|
@@ -48,7 +48,6 @@ export class BufferWithAccessor extends WEBGLBuffer {
|
|
|
48
48
|
constructor(device) {
|
|
49
49
|
let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
50
50
|
super(WebGLDevice.attach(device), getWEBGLBufferProps(props));
|
|
51
|
-
_defineProperty(this, "usage", void 0);
|
|
52
51
|
_defineProperty(this, "accessor", void 0);
|
|
53
52
|
this.setAccessor(Object.assign({}, props, props.accessor));
|
|
54
53
|
if (this.props.data) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer-with-accessor.js","names":["assert","checkProps","GL","assertWebGL2Context","Accessor","getGLTypeFromTypedArray","getTypedArrayFromGLType","WebGLDevice","WEBGLBuffer","DEBUG_DATA_LENGTH","DEPRECATED_PROPS","offset","stride","type","size","divisor","normalized","integer","instanced","isInstanced","PROP_CHECKS_INITIALIZE","removedProps","replacedProps","bytes","deprecatedProps","PROP_CHECKS_SET_PROPS","getWEBGLBufferProps","props","ArrayBuffer","isView","data","byteLength","bufferProps","BufferWithAccessor","constructor","device","arguments","length","undefined","attach","_defineProperty","setAccessor","Object","assign","accessor","seal","getElementCount","Math","round","getBytesPerElement","getVertexCount","getBytesPerVertex","initialize","Number","isFinite","glUsage","STATIC_DRAW","debugData","_setData","byteOffset","_setByteLength","setProps","buffer","reallocate","bytesUsed","setData","subData","options","srcOffset","glTarget","gl","webgl2","COPY_WRITE_BUFFER","bindBuffer","handle","bufferSubData","_inferType","copyData","sourceBuffer","readOffset","writeOffset","gl2","COPY_READ_BUFFER","copyBufferSubData","getData","_this$gl","dstData","srcByteOffset","dstOffset","ArrayType","FLOAT","clamped","sourceAvailableElementCount","_getAvailableElementCount","dstElementOffset","dstAvailableElementCount","dstElementCount","min","copyElementCount","getBufferSubData","bind","index","UNIFORM_BUFFER","TRANSFORM_FEEDBACK_BUFFER","_this$gl2","bindBufferRange","_this$gl3","bindBufferBase","unbind","isIndexedBuffer","_this$gl4","getDebugData","changed","invalidateDebugData","trackDeallocatedMemory","target","_getTarget","bufferData","slice","trackAllocatedMemory","Float32Array","sourceElementOffset","BYTES_PER_ELEMENT","getParameter","pname","value","getBufferParameter"],"sources":["../../src/classic/buffer-with-accessor.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport type {Device, BufferProps, TypedArray} from '@luma.gl/core';\nimport {assert, checkProps} from '@luma.gl/core';\nimport {GL} from '@luma.gl/constants';\nimport {assertWebGL2Context} from '../context/context/webgl-checks';\nimport {AccessorObject} from '../types';\nimport {Accessor} from './accessor';\nimport {getGLTypeFromTypedArray, getTypedArrayFromGLType} from './typed-array-utils';\n\nimport {WebGLDevice} from '../adapter/webgl-device';\nimport {WEBGLBuffer} from '../adapter/resources/webgl-buffer';\n\nconst DEBUG_DATA_LENGTH = 10;\n\n// Shared prop checks for constructor and setProps\nconst DEPRECATED_PROPS = {\n offset: 'accessor.offset',\n stride: 'accessor.stride',\n type: 'accessor.type',\n size: 'accessor.size',\n divisor: 'accessor.divisor',\n normalized: 'accessor.normalized',\n integer: 'accessor.integer',\n instanced: 'accessor.divisor',\n isInstanced: 'accessor.divisor'\n};\n\n// Prop checks for constructor\nconst PROP_CHECKS_INITIALIZE = {\n removedProps: {},\n replacedProps: {\n bytes: 'byteLength'\n },\n // new Buffer() with individual accessor props is still used in apps, emit warnings\n deprecatedProps: DEPRECATED_PROPS\n};\n\n// Prop checks for setProps\nconst PROP_CHECKS_SET_PROPS = {\n // Buffer.setProps() with individual accessor props is rare => emit errors\n removedProps: DEPRECATED_PROPS\n};\n\nfunction getWEBGLBufferProps(props: BufferWithAccessorProps | ArrayBufferView | number): BufferProps {\n // Signature `new Buffer(gl, new Float32Array(...)`\n if (ArrayBuffer.isView(props)) {\n return {data: props};\n }\n\n // Signature: `new Buffer(gl, 100)`\n else if (typeof props === 'number') {\n return {byteLength: props };\n }\n\n props = checkProps('Buffer', props, PROP_CHECKS_INITIALIZE);\n const bufferProps = {...props };\n // if (bufferProps.offset) {\n // bufferProps.byteOffset = bufferProps.offset;\n // }\n return bufferProps;\n}\n\n/** WebGL Buffer interface */\nexport type BufferWithAccessorProps = BufferProps & {\n handle?: WebGLBuffer;\n\n accessor?: AccessorObject;\n\n // target?: number;\n // glUsage?: number;\n // /** @deprecated */\n // index?: number;\n // /** @deprecated */\n // offset?: number;\n // /** @deprecated */\n // size?: number;\n // /** @deprecated */\n // type?: number\n}\n\n/** WebGL Buffer interface */\nexport class BufferWithAccessor extends WEBGLBuffer {\n usage: number;\n accessor: Accessor;\n\n constructor(device: Device | WebGLRenderingContext, props?: BufferWithAccessorProps);\n constructor(device: Device | WebGLRenderingContext, data: ArrayBufferView | number[]);\n constructor(device: Device | WebGLRenderingContext, byteLength: number);\n\n constructor(device: Device | WebGLRenderingContext, props = {}) {\n super(WebGLDevice.attach(device), getWEBGLBufferProps(props));\n\n // Base class initializes\n // this.initialize(props);\n\n // Deprecated: Merge main props and accessor\n this.setAccessor(Object.assign({}, props, (props as BufferWithAccessorProps).accessor));\n\n // infer GL type from supplied typed array\n if (this.props.data) {\n const type = getGLTypeFromTypedArray(this.props.data as TypedArray);\n assert(type);\n this.setAccessor(new Accessor(this.accessor, {type}));\n }\n\n Object.seal(this);\n }\n\n // override write(data: TypedArray, byteOffset: number = 0): void {\n // this.subData({data, offset: byteOffset});\n // }\n\n // returns number of elements in the buffer (assuming that the full buffer is used)\n getElementCount(accessor: AccessorObject = this.accessor): number {\n return Math.round(this.byteLength / Accessor.getBytesPerElement(accessor));\n }\n\n // returns number of vertices in the buffer (assuming that the full buffer is used)\n getVertexCount(accessor: AccessorObject = this.accessor): number {\n return Math.round(this.byteLength / Accessor.getBytesPerVertex(accessor));\n }\n\n // Creates and initializes the buffer object's data store.\n // Signature: `new Buffer(gl, {data: new Float32Array(...)})`\n // Signature: `new Buffer(gl, new Float32Array(...))`\n // Signature: `new Buffer(gl, 100)`\n initialize(props: BufferWithAccessorProps = {}): this {\n // Signature `new Buffer(gl, new Float32Array(...)`\n if (ArrayBuffer.isView(props)) {\n props = {data: props};\n }\n\n // Signature: `new Buffer(gl, 100)`\n if (Number.isFinite(props)) {\n // @ts-expect-error\n props = {byteLength: props};\n }\n\n props = checkProps('Buffer', props, PROP_CHECKS_INITIALIZE);\n\n // Initialize member fields\n // @ts-expect-error readonly field\n this.glUsage = props.glUsage || GL.STATIC_DRAW;\n this.debugData = null;\n\n // Deprecated: Merge main props and accessor\n this.setAccessor(Object.assign({}, props, props.accessor));\n\n // Set data: (re)initializes the buffer\n if (props.data) {\n this._setData(props.data, props.byteOffset, props.byteLength);\n } else {\n this._setByteLength(props.byteLength || 0);\n }\n\n return this;\n }\n\n setProps(props: BufferWithAccessorProps): this {\n props = checkProps('Buffer', props, PROP_CHECKS_SET_PROPS);\n\n if ('accessor' in props) {\n this.setAccessor(props.accessor);\n }\n\n return this;\n }\n\n // Optionally stores an accessor with the buffer, makes it easier to use it as an attribute later\n // {type, size = 1, offset = 0, stride = 0, normalized = false, integer = false, divisor = 0}\n setAccessor(accessor: AccessorObject | Accessor): this {\n // NOTE: From luma.gl v7.0, Accessors have an optional `buffer `field\n // (mainly to support \"interleaving\")\n // To avoid confusion, ensure `buffer.accessor` does not have a `buffer.accessor.buffer` field:\n accessor = Object.assign({}, accessor);\n // @ts-expect-error\n delete accessor.buffer;\n\n // This new statement ensures that an \"accessor object\" is re-packaged as an Accessor instance\n this.accessor = new Accessor(accessor);\n return this;\n }\n\n // Allocate a bigger GPU buffer (if the current buffer is not big enough).\n // If a reallocation is triggered it clears the buffer\n // Returns:\n // `true`: buffer was reallocated, data was cleared\n // `false`: buffer was big enough, data is intact\n reallocate(byteLength: number): boolean {\n if (byteLength > this.byteLength) {\n this._setByteLength(byteLength);\n return true;\n }\n this.bytesUsed = byteLength;\n return false;\n }\n\n // Update with new data. Reinitializes the buffer\n setData(props: BufferWithAccessorProps) {\n return this.initialize(props);\n }\n\n // Updates a subset of a buffer object's data store.\n // Data (Typed Array or ArrayBuffer), length is inferred unless provided\n // Offset into buffer\n // WebGL2 only: Offset into srcData\n // WebGL2 only: Number of bytes to be copied\n subData(options: TypedArray | {data: TypedArray, offset?: number; srcOffset?: number; byteLength?: number, length?: number}) {\n // Signature: buffer.subData(new Float32Array([...]))\n if (ArrayBuffer.isView(options)) {\n options = {data: options};\n }\n\n const {data, offset = 0, srcOffset = 0} = options;\n const byteLength = options.byteLength || options.length;\n\n assert(data);\n\n // Create the buffer - binding it here for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n // @ts-expect-error\n const glTarget = this.gl.webgl2 ? GL.COPY_WRITE_BUFFER : this.glTarget;\n this.gl.bindBuffer(glTarget, this.handle);\n // WebGL2: subData supports additional srcOffset and length parameters\n if (srcOffset !== 0 || byteLength !== undefined) {\n assertWebGL2Context(this.gl);\n // @ts-expect-error\n this.gl.bufferSubData(this.glTarget, offset, data, srcOffset, byteLength);\n } else {\n this.gl.bufferSubData(glTarget, offset, data);\n }\n this.gl.bindBuffer(glTarget, null);\n\n // TODO - update local `data` if offsets are right\n this.debugData = null;\n\n this._inferType(data);\n\n return this;\n }\n\n /**\n * Copies part of the data of another buffer into this buffer\n * @note WEBGL2 ONLY\n */\n copyData(options: {\n sourceBuffer: any;\n readOffset?: number;\n writeOffset?: number;\n size: any;\n }): this {\n const {sourceBuffer, readOffset = 0, writeOffset = 0, size} = options;\n const {gl, gl2} = this;\n assertWebGL2Context(gl);\n\n // Use GL.COPY_READ_BUFFER+GL.COPY_WRITE_BUFFER avoid disturbing other targets and locking type\n gl.bindBuffer(GL.COPY_READ_BUFFER, sourceBuffer.handle);\n gl.bindBuffer(GL.COPY_WRITE_BUFFER, this.handle);\n gl2?.copyBufferSubData(GL.COPY_READ_BUFFER, GL.COPY_WRITE_BUFFER, readOffset, writeOffset, size);\n gl.bindBuffer(GL.COPY_READ_BUFFER, null);\n gl.bindBuffer(GL.COPY_WRITE_BUFFER, null);\n\n // TODO - update local `data` if offsets are 0\n this.debugData = null;\n\n return this;\n }\n\n /**\n * Reads data from buffer into an ArrayBufferView or SharedArrayBuffer.\n * @note WEBGL2 ONLY\n */\n override getData(options?: {\n dstData?: any;\n srcByteOffset?: number;\n dstOffset?: number;\n length?: number;\n }): any {\n let {dstData = null, length = 0} = options || {};\n const {srcByteOffset = 0, dstOffset = 0} = options || {};\n assertWebGL2Context(this.gl);\n\n const ArrayType = getTypedArrayFromGLType(this.accessor.type || GL.FLOAT, {clamped: false});\n const sourceAvailableElementCount = this._getAvailableElementCount(srcByteOffset);\n\n const dstElementOffset = dstOffset;\n\n let dstAvailableElementCount;\n let dstElementCount;\n if (dstData) {\n dstElementCount = dstData.length;\n dstAvailableElementCount = dstElementCount - dstElementOffset;\n } else {\n // Allocate ArrayBufferView with enough size to copy all eligible data.\n dstAvailableElementCount = Math.min(\n sourceAvailableElementCount,\n length || sourceAvailableElementCount\n );\n dstElementCount = dstElementOffset + dstAvailableElementCount;\n }\n\n const copyElementCount = Math.min(sourceAvailableElementCount, dstAvailableElementCount);\n length = length || copyElementCount;\n assert(length <= copyElementCount);\n dstData = dstData || new ArrayType(dstElementCount);\n\n // Use GL.COPY_READ_BUFFER to avoid disturbing other targets and locking type\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, this.handle);\n this.gl2?.getBufferSubData(GL.COPY_READ_BUFFER, srcByteOffset, dstData, dstOffset, length);\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, null);\n\n // TODO - update local `data` if offsets are 0\n return dstData;\n }\n\n /**\n * Binds a buffer to a given binding point (target).\n * GL.TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER take an index, and optionally a range.\n * - GL.TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER need an index to affect state\n * - GL.UNIFORM_BUFFER: `offset` must be aligned to GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT.\n * - GL.UNIFORM_BUFFER: `size` must be a minimum of GL.UNIFORM_BLOCK_SIZE_DATA.\n */\n bind(options?: {glTarget?: number; index?: any; offset?: number; size?: any}): this {\n const {\n glTarget = this.glTarget, // target for the bind operation\n index = this.accessor && this.accessor.index, // index = index of target (indexed bind point)\n offset = 0,\n size\n } = options || {};\n // NOTE: While GL.TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER could\n // be used as direct binding points, they will not affect transform feedback or\n // uniform buffer state. Instead indexed bindings need to be made.\n if (glTarget === GL.UNIFORM_BUFFER || glTarget === GL.TRANSFORM_FEEDBACK_BUFFER) {\n if (size !== undefined) {\n this.gl2?.bindBufferRange(glTarget, index, this.handle, offset, size);\n } else {\n assert(offset === 0); // Make sure offset wasn't supplied\n this.gl2?.bindBufferBase(glTarget, index, this.handle);\n }\n } else {\n this.gl.bindBuffer(glTarget, this.handle);\n }\n\n return this;\n }\n\n unbind(options?: {glTarget?: any; index?: any}): this {\n const {glTarget = this.glTarget, index = this.accessor && this.accessor.index} = options || {};\n const isIndexedBuffer = glTarget === GL.UNIFORM_BUFFER || glTarget === GL.TRANSFORM_FEEDBACK_BUFFER;\n if (isIndexedBuffer) {\n this.gl2?.bindBufferBase(glTarget, index, null);\n } else {\n this.gl.bindBuffer(glTarget, null);\n }\n return this;\n }\n\n // PROTECTED METHODS (INTENDED FOR USE BY OTHER FRAMEWORK CODE ONLY)\n\n // Returns a short initial data array\n getDebugData(): {\n data: any;\n changed: boolean;\n } {\n if (!this.debugData) {\n this.debugData = this.getData({length: Math.min(DEBUG_DATA_LENGTH, this.byteLength)});\n return {data: this.debugData, changed: true};\n }\n return {data: this.debugData, changed: false};\n }\n\n invalidateDebugData() {\n this.debugData = null;\n }\n\n // PRIVATE METHODS\n\n // Allocate a new buffer and initialize to contents of typed array\n _setData(data, offset: number = 0, byteLength: number = data.byteLength + offset): this {\n assert(ArrayBuffer.isView(data));\n\n this.trackDeallocatedMemory();\n\n const target = this._getTarget();\n this.gl.bindBuffer(target, this.handle);\n this.gl.bufferData(target, byteLength, this.glUsage);\n this.gl.bufferSubData(target, offset, data);\n this.gl.bindBuffer(target, null);\n\n this.debugData = data.slice(0, DEBUG_DATA_LENGTH);\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n this.trackAllocatedMemory(byteLength);\n\n // infer GL type from supplied typed array\n const type = getGLTypeFromTypedArray(data);\n assert(type);\n this.setAccessor(new Accessor(this.accessor, {type}));\n return this;\n }\n\n // Allocate a GPU buffer of specified size.\n _setByteLength(byteLength: number): this {\n assert(byteLength >= 0);\n\n this.trackDeallocatedMemory();\n\n // Workaround needed for Safari (#291):\n // gl.bufferData with size equal to 0 crashes. Instead create zero sized array.\n let data = byteLength;\n if (byteLength === 0) {\n // @ts-expect-error\n data = new Float32Array(0);\n }\n\n const glTarget = this._getTarget();\n this.gl.bindBuffer(glTarget, this.handle);\n this.gl.bufferData(glTarget, data, this.glUsage);\n this.gl.bindBuffer(glTarget, null);\n\n this.debugData = null;\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n\n this.trackAllocatedMemory(byteLength);\n\n return this;\n }\n\n // Binding a buffer for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n _getTarget() {\n // @ts-expect-error\n return this.gl.webgl2 ? GL.COPY_WRITE_BUFFER : this.glTarget;\n }\n\n _getAvailableElementCount(srcByteOffset: number) {\n const ArrayType = getTypedArrayFromGLType(this.accessor.type || GL.FLOAT, {clamped: false});\n const sourceElementOffset = srcByteOffset / ArrayType.BYTES_PER_ELEMENT;\n return this.getElementCount() - sourceElementOffset;\n }\n\n // Automatically infers type from typed array passed to setData\n // Note: No longer that useful, since type is now autodeduced from the compiled shaders\n _inferType(data) {\n if (!this.accessor.type) {\n this.setAccessor(new Accessor(this.accessor, {type: getGLTypeFromTypedArray(data)}));\n }\n }\n\n // RESOURCE METHODS\n\n getParameter(pname: GL): any {\n this.gl.bindBuffer(this.glTarget, this.handle);\n const value = this.gl.getBufferParameter(this.glTarget, pname);\n this.gl.bindBuffer(this.glTarget, null);\n return value;\n }\n\n // DEPRECATIONS - v7.0\n /** @deprecated Use Buffer.accessor.type */\n get type() {\n return this.accessor.type;\n }\n}\n"],"mappings":";AAGA,SAAQA,MAAM,EAAEC,UAAU,QAAO,eAAe;AAChD,SAAQC,EAAE,QAAO,oBAAoB;AAAC,SAC9BC,mBAAmB;AAAA,SAEnBC,QAAQ;AAAA,SACRC,uBAAuB,EAAEC,uBAAuB;AAAA,SAEhDC,WAAW;AAAA,SACXC,WAAW;AAEnB,MAAMC,iBAAiB,GAAG,EAAE;AAG5B,MAAMC,gBAAgB,GAAG;EACvBC,MAAM,EAAE,iBAAiB;EACzBC,MAAM,EAAE,iBAAiB;EACzBC,IAAI,EAAE,eAAe;EACrBC,IAAI,EAAE,eAAe;EACrBC,OAAO,EAAE,kBAAkB;EAC3BC,UAAU,EAAE,qBAAqB;EACjCC,OAAO,EAAE,kBAAkB;EAC3BC,SAAS,EAAE,kBAAkB;EAC7BC,WAAW,EAAE;AACf,CAAC;AAGD,MAAMC,sBAAsB,GAAG;EAC7BC,YAAY,EAAE,CAAC,CAAC;EAChBC,aAAa,EAAE;IACbC,KAAK,EAAE;EACT,CAAC;EAEDC,eAAe,EAAEd;AACnB,CAAC;AAGD,MAAMe,qBAAqB,GAAG;EAE5BJ,YAAY,EAAEX;AAChB,CAAC;AAED,SAASgB,mBAAmBA,CAACC,KAAyD,EAAe;EAEnG,IAAIC,WAAW,CAACC,MAAM,CAACF,KAAK,CAAC,EAAE;IAC7B,OAAO;MAACG,IA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CAAC,CAAC,GAAG2E,mBAAmB;EACrD;EAIA7C,UAAUA,CAAC9C,IAAI,EAAE;IACf,IAAI,CAAC,IAAI,CAACc,QAAQ,CAAC/B,IAAI,EAAE;MACvB,IAAI,CAAC4B,WAAW,CAAC,IAAIrC,QAAQ,CAAC,IAAI,CAACwC,QAAQ,EAAE;QAAC/B,IAAI,EAAER,uBAAuB,CAACyB,IAAI;MAAC,CAAC,CAAC,CAAC;IACtF;EACF;EAIA6F,YAAYA,CAACC,KAAS,EAAO;IAC3B,IAAI,CAACtD,EAAE,CAACG,UAAU,CAAC,IAAI,CAACJ,QAAQ,EAAE,IAAI,CAACK,MAAM,CAAC;IAC9C,MAAMmD,KAAK,GAAG,IAAI,CAACvD,EAAE,CAACwD,kBAAkB,CAAC,IAAI,CAACzD,QAAQ,EAAEuD,KAAK,CAAC;IAC9D,IAAI,CAACtD,EAAE,CAACG,UAAU,CAAC,IAAI,CAACJ,QAAQ,EAAE,IAAI,CAAC;IACvC,OAAOwD,KAAK;EACd;EAIA,IAAIhH,IAAIA,CAAA,EAAG;IACT,OAAO,IAAI,CAAC+B,QAAQ,CAAC/B,IAAI;EAC3B;AACF"}
|
|
1
|
+
{"version":3,"file":"buffer-with-accessor.js","names":["assert","checkProps","GL","assertWebGL2Context","Accessor","getGLTypeFromTypedArray","getTypedArrayFromGLType","WebGLDevice","WEBGLBuffer","DEBUG_DATA_LENGTH","DEPRECATED_PROPS","offset","stride","type","size","divisor","normalized","integer","instanced","isInstanced","PROP_CHECKS_INITIALIZE","removedProps","replacedProps","bytes","deprecatedProps","PROP_CHECKS_SET_PROPS","getWEBGLBufferProps","props","ArrayBuffer","isView","data","byteLength","bufferProps","BufferWithAccessor","constructor","device","arguments","length","undefined","attach","_defineProperty","setAccessor","Object","assign","accessor","seal","getElementCount","Math","round","getBytesPerElement","getVertexCount","getBytesPerVertex","initialize","Number","isFinite","glUsage","STATIC_DRAW","debugData","_setData","byteOffset","_setByteLength","setProps","buffer","reallocate","bytesUsed","setData","subData","options","srcOffset","glTarget","gl","webgl2","COPY_WRITE_BUFFER","bindBuffer","handle","bufferSubData","_inferType","copyData","sourceBuffer","readOffset","writeOffset","gl2","COPY_READ_BUFFER","copyBufferSubData","getData","_this$gl","dstData","srcByteOffset","dstOffset","ArrayType","FLOAT","clamped","sourceAvailableElementCount","_getAvailableElementCount","dstElementOffset","dstAvailableElementCount","dstElementCount","min","copyElementCount","getBufferSubData","bind","index","UNIFORM_BUFFER","TRANSFORM_FEEDBACK_BUFFER","_this$gl2","bindBufferRange","_this$gl3","bindBufferBase","unbind","isIndexedBuffer","_this$gl4","getDebugData","changed","invalidateDebugData","trackDeallocatedMemory","target","_getTarget","bufferData","slice","trackAllocatedMemory","Float32Array","sourceElementOffset","BYTES_PER_ELEMENT","getParameter","pname","value","getBufferParameter"],"sources":["../../src/classic/buffer-with-accessor.ts"],"sourcesContent":["// luma.gl, MIT license\n\nimport type {Device, BufferProps, TypedArray} from '@luma.gl/core';\nimport {assert, checkProps} from '@luma.gl/core';\nimport {GL} from '@luma.gl/constants';\nimport {assertWebGL2Context} from '../context/context/webgl-checks';\nimport {AccessorObject} from '../types';\nimport {Accessor} from './accessor';\nimport {getGLTypeFromTypedArray, getTypedArrayFromGLType} from './typed-array-utils';\n\nimport {WebGLDevice} from '../adapter/webgl-device';\nimport {WEBGLBuffer} from '../adapter/resources/webgl-buffer';\n\nconst DEBUG_DATA_LENGTH = 10;\n\n// Shared prop checks for constructor and setProps\nconst DEPRECATED_PROPS = {\n offset: 'accessor.offset',\n stride: 'accessor.stride',\n type: 'accessor.type',\n size: 'accessor.size',\n divisor: 'accessor.divisor',\n normalized: 'accessor.normalized',\n integer: 'accessor.integer',\n instanced: 'accessor.divisor',\n isInstanced: 'accessor.divisor'\n};\n\n// Prop checks for constructor\nconst PROP_CHECKS_INITIALIZE = {\n removedProps: {},\n replacedProps: {\n bytes: 'byteLength'\n },\n // new Buffer() with individual accessor props is still used in apps, emit warnings\n deprecatedProps: DEPRECATED_PROPS\n};\n\n// Prop checks for setProps\nconst PROP_CHECKS_SET_PROPS = {\n // Buffer.setProps() with individual accessor props is rare => emit errors\n removedProps: DEPRECATED_PROPS\n};\n\nfunction getWEBGLBufferProps(props: BufferWithAccessorProps | ArrayBufferView | number): BufferProps {\n // Signature `new Buffer(gl, new Float32Array(...)`\n if (ArrayBuffer.isView(props)) {\n return {data: props};\n }\n\n // Signature: `new Buffer(gl, 100)`\n else if (typeof props === 'number') {\n return {byteLength: props };\n }\n\n props = checkProps('Buffer', props, PROP_CHECKS_INITIALIZE);\n const bufferProps = {...props };\n // if (bufferProps.offset) {\n // bufferProps.byteOffset = bufferProps.offset;\n // }\n return bufferProps;\n}\n\n/** WebGL Buffer interface */\nexport type BufferWithAccessorProps = BufferProps & {\n handle?: WebGLBuffer;\n\n accessor?: AccessorObject;\n\n // target?: number;\n // glUsage?: number;\n // /** @deprecated */\n // index?: number;\n // /** @deprecated */\n // offset?: number;\n // /** @deprecated */\n // size?: number;\n // /** @deprecated */\n // type?: number\n}\n\n/** WebGL Buffer interface */\nexport class BufferWithAccessor extends WEBGLBuffer {\n accessor: Accessor;\n\n constructor(device: Device | WebGLRenderingContext, props?: BufferWithAccessorProps);\n constructor(device: Device | WebGLRenderingContext, data: ArrayBufferView | number[]);\n constructor(device: Device | WebGLRenderingContext, byteLength: number);\n\n constructor(device: Device | WebGLRenderingContext, props = {}) {\n super(WebGLDevice.attach(device), getWEBGLBufferProps(props));\n\n // Base class initializes\n // this.initialize(props);\n\n // Deprecated: Merge main props and accessor\n this.setAccessor(Object.assign({}, props, (props as BufferWithAccessorProps).accessor));\n\n // infer GL type from supplied typed array\n if (this.props.data) {\n const type = getGLTypeFromTypedArray(this.props.data as TypedArray);\n assert(type);\n this.setAccessor(new Accessor(this.accessor, {type}));\n }\n\n Object.seal(this);\n }\n\n // override write(data: TypedArray, byteOffset: number = 0): void {\n // this.subData({data, offset: byteOffset});\n // }\n\n // returns number of elements in the buffer (assuming that the full buffer is used)\n getElementCount(accessor: AccessorObject = this.accessor): number {\n return Math.round(this.byteLength / Accessor.getBytesPerElement(accessor));\n }\n\n // returns number of vertices in the buffer (assuming that the full buffer is used)\n getVertexCount(accessor: AccessorObject = this.accessor): number {\n return Math.round(this.byteLength / Accessor.getBytesPerVertex(accessor));\n }\n\n // Creates and initializes the buffer object's data store.\n // Signature: `new Buffer(gl, {data: new Float32Array(...)})`\n // Signature: `new Buffer(gl, new Float32Array(...))`\n // Signature: `new Buffer(gl, 100)`\n initialize(props: BufferWithAccessorProps = {}): this {\n // Signature `new Buffer(gl, new Float32Array(...)`\n if (ArrayBuffer.isView(props)) {\n props = {data: props};\n }\n\n // Signature: `new Buffer(gl, 100)`\n if (Number.isFinite(props)) {\n // @ts-expect-error\n props = {byteLength: props};\n }\n\n props = checkProps('Buffer', props, PROP_CHECKS_INITIALIZE);\n\n // Initialize member fields\n // @ts-expect-error readonly field\n this.glUsage = props.glUsage || GL.STATIC_DRAW;\n this.debugData = null;\n\n // Deprecated: Merge main props and accessor\n this.setAccessor(Object.assign({}, props, props.accessor));\n\n // Set data: (re)initializes the buffer\n if (props.data) {\n this._setData(props.data, props.byteOffset, props.byteLength);\n } else {\n this._setByteLength(props.byteLength || 0);\n }\n\n return this;\n }\n\n setProps(props: BufferWithAccessorProps): this {\n props = checkProps('Buffer', props, PROP_CHECKS_SET_PROPS);\n\n if ('accessor' in props) {\n this.setAccessor(props.accessor);\n }\n\n return this;\n }\n\n // Optionally stores an accessor with the buffer, makes it easier to use it as an attribute later\n // {type, size = 1, offset = 0, stride = 0, normalized = false, integer = false, divisor = 0}\n setAccessor(accessor: AccessorObject | Accessor): this {\n // NOTE: From luma.gl v7.0, Accessors have an optional `buffer `field\n // (mainly to support \"interleaving\")\n // To avoid confusion, ensure `buffer.accessor` does not have a `buffer.accessor.buffer` field:\n accessor = Object.assign({}, accessor);\n // @ts-expect-error\n delete accessor.buffer;\n\n // This new statement ensures that an \"accessor object\" is re-packaged as an Accessor instance\n this.accessor = new Accessor(accessor);\n return this;\n }\n\n // Allocate a bigger GPU buffer (if the current buffer is not big enough).\n // If a reallocation is triggered it clears the buffer\n // Returns:\n // `true`: buffer was reallocated, data was cleared\n // `false`: buffer was big enough, data is intact\n reallocate(byteLength: number): boolean {\n if (byteLength > this.byteLength) {\n this._setByteLength(byteLength);\n return true;\n }\n this.bytesUsed = byteLength;\n return false;\n }\n\n // Update with new data. Reinitializes the buffer\n setData(props: BufferWithAccessorProps) {\n return this.initialize(props);\n }\n\n // Updates a subset of a buffer object's data store.\n // Data (Typed Array or ArrayBuffer), length is inferred unless provided\n // Offset into buffer\n // WebGL2 only: Offset into srcData\n // WebGL2 only: Number of bytes to be copied\n subData(options: TypedArray | {data: TypedArray, offset?: number; srcOffset?: number; byteLength?: number, length?: number}) {\n // Signature: buffer.subData(new Float32Array([...]))\n if (ArrayBuffer.isView(options)) {\n options = {data: options};\n }\n\n const {data, offset = 0, srcOffset = 0} = options;\n const byteLength = options.byteLength || options.length;\n\n assert(data);\n\n // Create the buffer - binding it here for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n // @ts-expect-error\n const glTarget = this.gl.webgl2 ? GL.COPY_WRITE_BUFFER : this.glTarget;\n this.gl.bindBuffer(glTarget, this.handle);\n // WebGL2: subData supports additional srcOffset and length parameters\n if (srcOffset !== 0 || byteLength !== undefined) {\n assertWebGL2Context(this.gl);\n // @ts-expect-error\n this.gl.bufferSubData(this.glTarget, offset, data, srcOffset, byteLength);\n } else {\n this.gl.bufferSubData(glTarget, offset, data);\n }\n this.gl.bindBuffer(glTarget, null);\n\n // TODO - update local `data` if offsets are right\n this.debugData = null;\n\n this._inferType(data);\n\n return this;\n }\n\n /**\n * Copies part of the data of another buffer into this buffer\n * @note WEBGL2 ONLY\n */\n copyData(options: {\n sourceBuffer: any;\n readOffset?: number;\n writeOffset?: number;\n size: any;\n }): this {\n const {sourceBuffer, readOffset = 0, writeOffset = 0, size} = options;\n const {gl, gl2} = this;\n assertWebGL2Context(gl);\n\n // Use GL.COPY_READ_BUFFER+GL.COPY_WRITE_BUFFER avoid disturbing other targets and locking type\n gl.bindBuffer(GL.COPY_READ_BUFFER, sourceBuffer.handle);\n gl.bindBuffer(GL.COPY_WRITE_BUFFER, this.handle);\n gl2?.copyBufferSubData(GL.COPY_READ_BUFFER, GL.COPY_WRITE_BUFFER, readOffset, writeOffset, size);\n gl.bindBuffer(GL.COPY_READ_BUFFER, null);\n gl.bindBuffer(GL.COPY_WRITE_BUFFER, null);\n\n // TODO - update local `data` if offsets are 0\n this.debugData = null;\n\n return this;\n }\n\n /**\n * Reads data from buffer into an ArrayBufferView or SharedArrayBuffer.\n * @note WEBGL2 ONLY\n */\n override getData(options?: {\n dstData?: any;\n srcByteOffset?: number;\n dstOffset?: number;\n length?: number;\n }): any {\n let {dstData = null, length = 0} = options || {};\n const {srcByteOffset = 0, dstOffset = 0} = options || {};\n assertWebGL2Context(this.gl);\n\n const ArrayType = getTypedArrayFromGLType(this.accessor.type || GL.FLOAT, {clamped: false});\n const sourceAvailableElementCount = this._getAvailableElementCount(srcByteOffset);\n\n const dstElementOffset = dstOffset;\n\n let dstAvailableElementCount;\n let dstElementCount;\n if (dstData) {\n dstElementCount = dstData.length;\n dstAvailableElementCount = dstElementCount - dstElementOffset;\n } else {\n // Allocate ArrayBufferView with enough size to copy all eligible data.\n dstAvailableElementCount = Math.min(\n sourceAvailableElementCount,\n length || sourceAvailableElementCount\n );\n dstElementCount = dstElementOffset + dstAvailableElementCount;\n }\n\n const copyElementCount = Math.min(sourceAvailableElementCount, dstAvailableElementCount);\n length = length || copyElementCount;\n assert(length <= copyElementCount);\n dstData = dstData || new ArrayType(dstElementCount);\n\n // Use GL.COPY_READ_BUFFER to avoid disturbing other targets and locking type\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, this.handle);\n this.gl2?.getBufferSubData(GL.COPY_READ_BUFFER, srcByteOffset, dstData, dstOffset, length);\n this.gl.bindBuffer(GL.COPY_READ_BUFFER, null);\n\n // TODO - update local `data` if offsets are 0\n return dstData;\n }\n\n /**\n * Binds a buffer to a given binding point (target).\n * GL.TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER take an index, and optionally a range.\n * - GL.TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER need an index to affect state\n * - GL.UNIFORM_BUFFER: `offset` must be aligned to GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT.\n * - GL.UNIFORM_BUFFER: `size` must be a minimum of GL.UNIFORM_BLOCK_SIZE_DATA.\n */\n bind(options?: {glTarget?: number; index?: any; offset?: number; size?: any}): this {\n const {\n glTarget = this.glTarget, // target for the bind operation\n index = this.accessor && this.accessor.index, // index = index of target (indexed bind point)\n offset = 0,\n size\n } = options || {};\n // NOTE: While GL.TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER could\n // be used as direct binding points, they will not affect transform feedback or\n // uniform buffer state. Instead indexed bindings need to be made.\n if (glTarget === GL.UNIFORM_BUFFER || glTarget === GL.TRANSFORM_FEEDBACK_BUFFER) {\n if (size !== undefined) {\n this.gl2?.bindBufferRange(glTarget, index, this.handle, offset, size);\n } else {\n assert(offset === 0); // Make sure offset wasn't supplied\n this.gl2?.bindBufferBase(glTarget, index, this.handle);\n }\n } else {\n this.gl.bindBuffer(glTarget, this.handle);\n }\n\n return this;\n }\n\n unbind(options?: {glTarget?: any; index?: any}): this {\n const {glTarget = this.glTarget, index = this.accessor && this.accessor.index} = options || {};\n const isIndexedBuffer = glTarget === GL.UNIFORM_BUFFER || glTarget === GL.TRANSFORM_FEEDBACK_BUFFER;\n if (isIndexedBuffer) {\n this.gl2?.bindBufferBase(glTarget, index, null);\n } else {\n this.gl.bindBuffer(glTarget, null);\n }\n return this;\n }\n\n // PROTECTED METHODS (INTENDED FOR USE BY OTHER FRAMEWORK CODE ONLY)\n\n // Returns a short initial data array\n getDebugData(): {\n data: any;\n changed: boolean;\n } {\n if (!this.debugData) {\n this.debugData = this.getData({length: Math.min(DEBUG_DATA_LENGTH, this.byteLength)});\n return {data: this.debugData, changed: true};\n }\n return {data: this.debugData, changed: false};\n }\n\n invalidateDebugData() {\n this.debugData = null;\n }\n\n // PRIVATE METHODS\n\n // Allocate a new buffer and initialize to contents of typed array\n _setData(data, offset: number = 0, byteLength: number = data.byteLength + offset): this {\n assert(ArrayBuffer.isView(data));\n\n this.trackDeallocatedMemory();\n\n const target = this._getTarget();\n this.gl.bindBuffer(target, this.handle);\n this.gl.bufferData(target, byteLength, this.glUsage);\n this.gl.bufferSubData(target, offset, data);\n this.gl.bindBuffer(target, null);\n\n this.debugData = data.slice(0, DEBUG_DATA_LENGTH);\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n this.trackAllocatedMemory(byteLength);\n\n // infer GL type from supplied typed array\n const type = getGLTypeFromTypedArray(data);\n assert(type);\n this.setAccessor(new Accessor(this.accessor, {type}));\n return this;\n }\n\n // Allocate a GPU buffer of specified size.\n _setByteLength(byteLength: number): this {\n assert(byteLength >= 0);\n\n this.trackDeallocatedMemory();\n\n // Workaround needed for Safari (#291):\n // gl.bufferData with size equal to 0 crashes. Instead create zero sized array.\n let data = byteLength;\n if (byteLength === 0) {\n // @ts-expect-error\n data = new Float32Array(0);\n }\n\n const glTarget = this._getTarget();\n this.gl.bindBuffer(glTarget, this.handle);\n this.gl.bufferData(glTarget, data, this.glUsage);\n this.gl.bindBuffer(glTarget, null);\n\n this.debugData = null;\n this.bytesUsed = byteLength;\n this.byteLength = byteLength;\n\n this.trackAllocatedMemory(byteLength);\n\n return this;\n }\n\n // Binding a buffer for the first time locks the type\n // In WebGL2, use GL.COPY_WRITE_BUFFER to avoid locking the type\n _getTarget() {\n // @ts-expect-error\n return this.gl.webgl2 ? GL.COPY_WRITE_BUFFER : this.glTarget;\n }\n\n _getAvailableElementCount(srcByteOffset: number) {\n const ArrayType = getTypedArrayFromGLType(this.accessor.type || GL.FLOAT, {clamped: false});\n const sourceElementOffset = srcByteOffset / ArrayType.BYTES_PER_ELEMENT;\n return this.getElementCount() - sourceElementOffset;\n }\n\n // Automatically infers type from typed array passed to setData\n // Note: No longer that useful, since type is now autodeduced from the compiled shaders\n _inferType(data) {\n if (!this.accessor.type) {\n this.setAccessor(new Accessor(this.accessor, {type: getGLTypeFromTypedArray(data)}));\n }\n }\n\n // RESOURCE METHODS\n\n getParameter(pname: GL): any {\n this.gl.bindBuffer(this.glTarget, this.handle);\n const value = this.gl.getBufferParameter(this.glTarget, pname);\n this.gl.bindBuffer(this.glTarget, null);\n return value;\n }\n\n // DEPRECATIONS - v7.0\n /** @deprecated Use Buffer.accessor.type */\n get type() {\n return this.accessor.type;\n }\n}\n"],"mappings":";AAGA,SAAQA,MAAM,EAAEC,UAAU,QAAO,eAAe;AAChD,SAAQC,EAAE,QAAO,oBAAoB;AAAC,SAC9BC,mBAAmB;AAAA,SAEnBC,QAAQ;AAAA,SACRC,uBAAuB,EAAEC,uBAAuB;AAAA,SAEhDC,WAAW;AAAA,SACXC,WAAW;AAEnB,MAAMC,iBAAiB,GAAG,EAAE;AAG5B,MAAMC,gBAAgB,GAAG;EACvBC,MAAM,EAAE,iBAAiB;EACzBC,MAAM,EAAE,iBAAiB;EACzBC,IAAI,EAAE,eAAe;EACrBC,IAAI,EAAE,eAAe;EACrBC,OAAO,EAAE,kBAAkB;EAC3BC,UAAU,EAAE,qBAAqB;EACjCC,OAAO,EAAE,kBAAkB;EAC3BC,SAAS,EAAE,kBAAkB;EAC7BC,WAAW,EAAE;AACf,CAAC;AAGD,MAAMC,sBAAsB,GAAG;EAC7BC,YAAY,EAAE,CAAC,CAAC;EAChBC,aAAa,EAAE;IACbC,KAAK,EAAE;EACT,CAAC;EAEDC,eAAe,EAAEd;AACnB,CAAC;AAGD,MAAMe,qBAAqB,GAAG;EAE5BJ,YAAY,EAAEX;AAChB,CAAC;AAED,SAASgB,mBAAmBA,CAACC,KAAyD,EAAe;EAEnG,IAAIC,WAAW,CAACC,MAAM,CAACF,KAAK,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IAAI,CAAC5E,eAAe,CAAC,CAAC,GAAG2E,mBAAmB;EACrD;EAIA7C,UAAUA,CAAC9C,IAAI,EAAE;IACf,IAAI,CAAC,IAAI,CAACc,QAAQ,CAAC/B,IAAI,EAAE;MACvB,IAAI,CAAC4B,WAAW,CAAC,IAAIrC,QAAQ,CAAC,IAAI,CAACwC,QAAQ,EAAE;QAAC/B,IAAI,EAAER,uBAAuB,CAACyB,IAAI;MAAC,CAAC,CAAC,CAAC;IACtF;EACF;EAIA6F,YAAYA,CAACC,KAAS,EAAO;IAC3B,IAAI,CAACtD,EAAE,CAACG,UAAU,CAAC,IAAI,CAACJ,QAAQ,EAAE,IAAI,CAACK,MAAM,CAAC;IAC9C,MAAMmD,KAAK,GAAG,IAAI,CAACvD,EAAE,CAACwD,kBAAkB,CAAC,IAAI,CAACzD,QAAQ,EAAEuD,KAAK,CAAC;IAC9D,IAAI,CAACtD,EAAE,CAACG,UAAU,CAAC,IAAI,CAACJ,QAAQ,EAAE,IAAI,CAAC;IACvC,OAAOwD,KAAK;EACd;EAIA,IAAIhH,IAAIA,CAAA,EAAG;IACT,OAAO,IAAI,CAAC+B,QAAQ,CAAC/B,IAAI;EAC3B;AACF"}
|
package/dist/dist.dev.js
CHANGED
|
@@ -1061,6 +1061,8 @@ var __exports__ = (() => {
|
|
|
1061
1061
|
get [Symbol.toStringTag]() {
|
|
1062
1062
|
return "Buffer";
|
|
1063
1063
|
}
|
|
1064
|
+
/** The usage with which this buffer was created */
|
|
1065
|
+
/** For index buffers, whether indices are 16 or 32 bit */
|
|
1064
1066
|
/** Length of buffer in bytes */
|
|
1065
1067
|
constructor(device, props) {
|
|
1066
1068
|
const deducedProps = {
|
|
@@ -1074,6 +1076,8 @@ var __exports__ = (() => {
|
|
|
1074
1076
|
}
|
|
1075
1077
|
}
|
|
1076
1078
|
super(device, deducedProps, _Buffer.defaultProps);
|
|
1079
|
+
this.usage = props.usage || 0;
|
|
1080
|
+
this.indexType = deducedProps.indexType;
|
|
1077
1081
|
}
|
|
1078
1082
|
write(data, byteOffset) {
|
|
1079
1083
|
throw new Error("not implemented");
|
|
@@ -1838,7 +1842,11 @@ var __exports__ = (() => {
|
|
|
1838
1842
|
/** Set attributes (stored on pipeline and set before each call) */
|
|
1839
1843
|
/** Set constant attributes (WebGL only) */
|
|
1840
1844
|
/** Set bindings (stored on pipeline and set before each call) */
|
|
1841
|
-
/** Uniforms
|
|
1845
|
+
/** Uniforms
|
|
1846
|
+
* @deprecated Only supported on WebGL devices.
|
|
1847
|
+
* @note textures, samplers and uniform buffers should be set via `setBindings()`, these are not considered uniforms.
|
|
1848
|
+
* @note In WebGL uniforms have a performance penalty, they are reset before each call to enable pipeline sharing.
|
|
1849
|
+
*/
|
|
1842
1850
|
/** Draw call */
|
|
1843
1851
|
};
|
|
1844
1852
|
var RenderPipeline = _RenderPipeline;
|
|
@@ -8735,34 +8743,34 @@ ${formattedLog}`)();
|
|
|
8735
8743
|
// src/adapter/helpers/set-uniform.ts
|
|
8736
8744
|
function setUniform(gl2, location, type, value) {
|
|
8737
8745
|
const gl22 = gl2;
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
case GL.SAMPLER_CUBE_SHADOW:
|
|
8747
|
-
case GL.INT_SAMPLER_2D:
|
|
8748
|
-
case GL.INT_SAMPLER_3D:
|
|
8749
|
-
case GL.INT_SAMPLER_CUBE:
|
|
8750
|
-
case GL.INT_SAMPLER_2D_ARRAY:
|
|
8751
|
-
case GL.UNSIGNED_INT_SAMPLER_2D:
|
|
8752
|
-
case GL.UNSIGNED_INT_SAMPLER_3D:
|
|
8753
|
-
case GL.UNSIGNED_INT_SAMPLER_CUBE:
|
|
8754
|
-
case GL.UNSIGNED_INT_SAMPLER_2D_ARRAY:
|
|
8755
|
-
return gl2.uniform1i(location, value);
|
|
8756
|
-
}
|
|
8757
|
-
}
|
|
8758
|
-
if (value === true) {
|
|
8759
|
-
value = 1;
|
|
8760
|
-
}
|
|
8761
|
-
if (value === false) {
|
|
8762
|
-
value = 0;
|
|
8763
|
-
}
|
|
8764
|
-
const arrayValue = typeof value === "number" ? [value] : value;
|
|
8746
|
+
let uniformValue = value;
|
|
8747
|
+
if (uniformValue === true) {
|
|
8748
|
+
uniformValue = 1;
|
|
8749
|
+
}
|
|
8750
|
+
if (uniformValue === false) {
|
|
8751
|
+
uniformValue = 0;
|
|
8752
|
+
}
|
|
8753
|
+
const arrayValue = typeof uniformValue === "number" ? [uniformValue] : uniformValue;
|
|
8765
8754
|
switch (type) {
|
|
8755
|
+
case GL.SAMPLER_2D:
|
|
8756
|
+
case GL.SAMPLER_CUBE:
|
|
8757
|
+
case GL.SAMPLER_3D:
|
|
8758
|
+
case GL.SAMPLER_2D_SHADOW:
|
|
8759
|
+
case GL.SAMPLER_2D_ARRAY:
|
|
8760
|
+
case GL.SAMPLER_2D_ARRAY_SHADOW:
|
|
8761
|
+
case GL.SAMPLER_CUBE_SHADOW:
|
|
8762
|
+
case GL.INT_SAMPLER_2D:
|
|
8763
|
+
case GL.INT_SAMPLER_3D:
|
|
8764
|
+
case GL.INT_SAMPLER_CUBE:
|
|
8765
|
+
case GL.INT_SAMPLER_2D_ARRAY:
|
|
8766
|
+
case GL.UNSIGNED_INT_SAMPLER_2D:
|
|
8767
|
+
case GL.UNSIGNED_INT_SAMPLER_3D:
|
|
8768
|
+
case GL.UNSIGNED_INT_SAMPLER_CUBE:
|
|
8769
|
+
case GL.UNSIGNED_INT_SAMPLER_2D_ARRAY:
|
|
8770
|
+
if (typeof value !== "number") {
|
|
8771
|
+
throw new Error("samplers must be set to integers");
|
|
8772
|
+
}
|
|
8773
|
+
return gl2.uniform1i(location, value);
|
|
8766
8774
|
case GL.FLOAT:
|
|
8767
8775
|
return gl2.uniform1fv(location, arrayValue);
|
|
8768
8776
|
case GL.FLOAT_VEC2:
|