@luma.gl/webgl 9.0.0-alpha.23 → 9.0.0-alpha.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/converters/texture-formats.d.ts +2 -2
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/device-helpers/device-limits.d.ts +1 -1
- package/dist/adapter/device-helpers/device-limits.d.ts.map +1 -1
- package/dist/adapter/helpers/get-shader-info.d.ts +1 -1
- package/dist/adapter/helpers/get-shader-info.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.d.ts +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.d.ts +1 -1
- package/dist/adapter/objects/webgl-vertex-array-object.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.d.ts +5 -5
- package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.d.ts +2 -2
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +2 -1
- package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
- package/dist/adapter/resources/webgl-texture.d.ts +5 -5
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/classic/buffer.d.ts +1 -1
- package/dist/classic/buffer.d.ts.map +1 -1
- package/dist/classic/clear.d.ts +22 -0
- package/dist/classic/clear.d.ts.map +1 -0
- package/dist/classic/clear.js +88 -0
- package/dist/classic/clear.js.map +1 -0
- package/dist/classic/copy-and-blit.d.ts +45 -0
- package/dist/classic/copy-and-blit.d.ts.map +1 -0
- package/dist/classic/copy-and-blit.js +136 -0
- package/dist/classic/copy-and-blit.js.map +1 -0
- package/dist/classic/format-utils.d.ts +3 -0
- package/dist/classic/format-utils.d.ts.map +1 -0
- package/dist/classic/format-utils.js +38 -0
- package/dist/classic/format-utils.js.map +1 -0
- package/dist/context/context/create-browser-context.d.ts +17 -19
- package/dist/context/context/create-browser-context.d.ts.map +1 -1
- package/dist/context/context/create-browser-context.js +4 -4
- package/dist/context/context/create-browser-context.js.map +1 -1
- package/dist/context/context/create-headless-context.d.ts +1 -1
- package/dist/context/context/create-headless-context.d.ts.map +1 -1
- package/dist/context/debug/spector.d.ts +1 -3
- package/dist/context/debug/spector.d.ts.map +1 -1
- package/dist/context/debug/webgl-developer-tools.d.ts +1 -1
- package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.d.ts +1 -1
- package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
- package/dist/dist.dev.js +220 -5
- package/dist/index.cjs +191 -6
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist.min.js +22 -22
- package/package.json +5 -5
- package/src/adapter/resources/webgl-render-pipeline.ts +1 -1
- package/src/classic/clear.ts +110 -0
- package/src/classic/copy-and-blit.ts +189 -0
- package/src/classic/format-utils.ts +43 -0
- package/src/context/context/create-browser-context.ts +37 -30
- package/src/index.ts +6 -1
|
@@ -4,7 +4,7 @@ export declare function checkTextureFeature(gl: WebGLRenderingContext, feature:
|
|
|
4
4
|
/** Return a list of texture feature strings (for Device.features). Mainly compressed texture support */
|
|
5
5
|
export declare function getTextureFeatures(gl: WebGLRenderingContext): DeviceFeature[];
|
|
6
6
|
/** Map a format to webgl and constants */
|
|
7
|
-
|
|
7
|
+
type Format = {
|
|
8
8
|
gl?: GL;
|
|
9
9
|
/** If a different unsized format is needed in WebGL1 */
|
|
10
10
|
gl1?: GL;
|
|
@@ -74,7 +74,7 @@ export declare function getDepthStencilAttachmentWebGL(format: TextureFormat): G
|
|
|
74
74
|
* function to test if Float 32 bit format texture can be bound as color attachment
|
|
75
75
|
* @todo Generalize to check arbitrary formats?
|
|
76
76
|
*/
|
|
77
|
-
export declare function _checkFloat32ColorAttachment(gl: WebGLRenderingContext, internalFormat?:
|
|
77
|
+
export declare function _checkFloat32ColorAttachment(gl: WebGLRenderingContext, internalFormat?: 6408, srcFormat?: GL, srcType?: GL): boolean;
|
|
78
78
|
/** TODO - VERY roundabout legacy way of calculating bytes per pixel */
|
|
79
79
|
export declare function getTextureFormatBytesPerPixel(formatOrGL: TextureFormat | GL, isWebGL2: boolean): number;
|
|
80
80
|
export declare function getWebGLDataType(dataType: string): GL;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"texture-formats.d.ts","sourceRoot":"","sources":["../../../src/adapter/converters/texture-formats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAiEpC,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,qBAAqB,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAE9F;AAKD,wGAAwG;AACxG,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,qBAAqB,GAAG,aAAa,EAAE,CAG7E;AAID,0CAA0C;AAC1C,
|
|
1
|
+
{"version":3,"file":"texture-formats.d.ts","sourceRoot":"","sources":["../../../src/adapter/converters/texture-formats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAiEpC,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,qBAAqB,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAE9F;AAKD,wGAAwG;AACxG,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,qBAAqB,GAAG,aAAa,EAAE,CAG7E;AAID,0CAA0C;AAC1C,KAAK,MAAM,GAAG;IACZ,EAAE,CAAC,EAAE,EAAE,CAAC;IACR,w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ants';
|
|
|
3
3
|
/** Populate a WebGPU style device limits */
|
|
4
4
|
export declare function getDeviceLimits(gl: WebGLRenderingContext): DeviceLimits;
|
|
5
5
|
/** WebGL context limits */
|
|
6
|
-
export
|
|
6
|
+
export type WebGLLimits = {
|
|
7
7
|
[GL.ALIASED_LINE_WIDTH_RANGE]: [number, number];
|
|
8
8
|
[GL.ALIASED_POINT_SIZE_RANGE]: [number, number];
|
|
9
9
|
[GL.MAX_TEXTURE_SIZE]: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device-limits.d.ts","sourceRoot":"","sources":["../../../src/adapter/device-helpers/device-limits.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGpC,4CAA4C;AAC5C,wBAAgB,eAAe,CAAC,EAAE,EAAE,qBAAqB,GAAG,YAAY,CA8BvE;AAED,2BAA2B;AAC3B,
|
|
1
|
+
{"version":3,"file":"device-limits.d.ts","sourceRoot":"","sources":["../../../src/adapter/device-helpers/device-limits.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGpC,4CAA4C;AAC5C,wBAAgB,eAAe,CAAC,EAAE,EAAE,qBAAqB,GAAG,YAAY,CA8BvE;AAED,2BAA2B;AAC3B,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,EAAE,CAAC,wBAAwB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC,EAAE,CAAC,wBAAwB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC,EAAE,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC9B,CAAC,EAAE,CAAC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACvC,CAAC,EAAE,CAAC,uB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-shader-info.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/get-shader-info.ts"],"names":[],"mappings":"AAKA,oDAAoD;AACpD,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,mDAAmD;AACnD,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,CAM9E"}
|
|
@@ -2,7 +2,7 @@ import { ResourceProps, TextureFormat } from '@luma.gl/api';
|
|
|
2
2
|
import GL from '@luma.gl/constants';
|
|
3
3
|
import { WebGLDevice } from '../webgl-device';
|
|
4
4
|
import { WebGLResource } from './webgl-resource';
|
|
5
|
-
export
|
|
5
|
+
export type RenderbufferProps = ResourceProps & {
|
|
6
6
|
format: TextureFormat;
|
|
7
7
|
width?: number;
|
|
8
8
|
height?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-renderbuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/objects/webgl-renderbuffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,aAAa,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACpC,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAI/C,
|
|
1
|
+
{"version":3,"file":"webgl-renderbuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/objects/webgl-renderbuffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,aAAa,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACpC,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAC,aAAa,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export type VertexArrayObjectProps = ResourceProps & {};
|
|
9
9
|
/** VertexArrayObject wrapper */
|
|
10
10
|
export declare class WEBGLVertexArrayObject extends WebGLResource<VertexArrayObjectProps> {
|
|
11
11
|
get [Symbol.toStringTag](): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-vertex-array-object.d.ts","sourceRoot":"","sources":["../../../src/adapter/objects/webgl-vertex-array-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,aAAa,EAAC,MAAM,cAAc,CAAC;AAInD,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAC;AAItD;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"webgl-vertex-array-object.d.ts","sourceRoot":"","sources":["../../../src/adapter/objects/webgl-vertex-array-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,aAAa,EAAC,MAAM,cAAc,CAAC;AAInD,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAC;AAItD;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,aAAa,GAAG,EACpD,CAAC;AAEF,gCAAgC;AAChC,qBAAa,sBAAuB,SAAQ,aAAa,CAAC,sBAAsB,CAAC;IAC/E,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;gBAEW,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE,sBAAsB;IAKtD,aAAa;IAIb,aAAa,IAAI,IAAI;IAOrB,WAAW,CAAC,MAAM,EAAE,sBAAsB,GAAG,IAAI;IAM1D,gBAAgB,CAAC,aAAa,GAAE,WAAW,GAAG,IAAW,EAAE,IAAI,KAAK;IAWpE,gGAAgG;IAChG,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,GAAG,IAAI;IAgCrE;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,UAAO,GAAG,IAAI;CAe9C"}
|
|
@@ -2,23 +2,23 @@ import type { CopyBufferToBufferOptions, CopyBufferToTextureOptions, CopyTexture
|
|
|
2
2
|
import { CommandBuffer } from '@luma.gl/api';
|
|
3
3
|
import GL from '@luma.gl/constants';
|
|
4
4
|
import { WebGLDevice } from '../webgl-device';
|
|
5
|
-
|
|
5
|
+
type CopyBufferToBufferCommand = {
|
|
6
6
|
name: 'copy-buffer-to-buffer';
|
|
7
7
|
options: CopyBufferToBufferOptions;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
type CopyBufferToTextureCommand = {
|
|
10
10
|
name: 'copy-buffer-to-texture';
|
|
11
11
|
options: CopyBufferToTextureOptions;
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
type CopyTextureToBufferCommand = {
|
|
14
14
|
name: 'copy-texture-to-buffer';
|
|
15
15
|
options: CopyTextureToBufferOptions;
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
type CopyTextureToTextureCommand = {
|
|
18
18
|
name: 'copy-texture-to-texture';
|
|
19
19
|
options: CopyTextureToTextureOptions;
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
type Command = CopyBufferToBufferCommand | CopyBufferToTextureCommand | CopyTextureToBufferCommand | CopyTextureToTextureCommand;
|
|
22
22
|
export declare class WEBGLCommandBuffer extends CommandBuffer {
|
|
23
23
|
device: WebGLDevice;
|
|
24
24
|
commands: Command[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-command-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-command-buffer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,yBAAyB,EACzB,0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D;AAyQD,wBAAgB,oBAAoB,CAAC,MAAM,KAAA,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAmB1D;AAGD,wBAAgB,aAAa,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAcjD"}
|
|
@@ -4,8 +4,8 @@ import GL from '@luma.gl/constants';
|
|
|
4
4
|
import { WebGLDevice } from '../webgl-device';
|
|
5
5
|
import { WEBGLTexture } from './webgl-texture';
|
|
6
6
|
import { WEBGLRenderbuffer } from '../objects/webgl-renderbuffer';
|
|
7
|
-
export
|
|
8
|
-
export
|
|
7
|
+
export type TextureAttachment = [Texture, number?, number?];
|
|
8
|
+
export type Attachment = WEBGLTexture | WEBGLRenderbuffer | TextureAttachment;
|
|
9
9
|
/** luma.gl Framebuffer, WebGL implementation */
|
|
10
10
|
export declare class WEBGLFramebuffer extends Framebuffer {
|
|
11
11
|
device: WebGLDevice;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-framebuffer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAClE,OAAO,EAAC,WAAW,EAAE,OAAO,EAAS,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACpC,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AAGhE,
|
|
1
|
+
{"version":3,"file":"webgl-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-framebuffer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAClE,OAA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IAAI;CA2BR"}
|
|
@@ -251,13 +251,14 @@ export class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
251
251
|
}
|
|
252
252
|
_applyUniforms() {
|
|
253
253
|
for (const uniformLayout of this.layout.uniforms || []) {
|
|
254
|
+
var _this$uniforms$name;
|
|
254
255
|
const {
|
|
255
256
|
name,
|
|
256
257
|
location,
|
|
257
258
|
type,
|
|
258
259
|
textureUnit
|
|
259
260
|
} = uniformLayout;
|
|
260
|
-
const value = this.uniforms[name]
|
|
261
|
+
const value = (_this$uniforms$name = this.uniforms[name]) !== null && _this$uniforms$name !== void 0 ? _this$uniforms$name : textureUnit;
|
|
261
262
|
if (value !== undefined) {
|
|
262
263
|
setUniform(this.device.gl, location, type, value);
|
|
263
264
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-render-pipeline.js","names":["RenderPipeline","cast","log","decodeVertexFormat","GL","getWebGLDataType","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","layout","vertexArrayObject","destroy","deleteProgram","destroyed","setIndexBuffer","indexBuffer","webglBuffer","setElementBuffer","_indexBuffer","setAttributes","attributes","name","buffer","Object","entries","attribute","getAttributeLayout","warn","concat","decoded","format","type","typeString","components","size","byteLength","stride","normalized","integer","divisor","stepMode","setBuffer","location","offset","setBindings","bindings","value","binding","find","Error","setUniforms","uniforms","assign","draw","options","_this$_indexBuffer","renderPass","vertexCount","instanceCount","firstVertex","drawMode","getDrawMode","topology","isIndexed","Boolean","indexType","UNSIGNED_SHORT","UNSIGNED_INT","isInstanced","Number","_areTexturesRenderable","useProgram","bind","primitiveMode","getGLPrimitive","transformFeedback","begin","_applyBindings","_applyUniforms","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","textureUnit","uniformBufferIndex","getUniformBlockIndex","INVALID_INDEX","uniformBlockBinding","bindBufferBase","UNIFORM_BUFFER","bindBufferRange","activeTexture","TEXTURE0","bindTexture","target","uniformLayout","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 // BindingLayout,\n AttributeLayout\n} from '@luma.gl/api';\nimport {RenderPipeline, cast, log, decodeVertexFormat} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\n\nimport {getWebGLDataType} from '../converters/texture-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 device: WebGLDevice;\n handle: WebGLProgram;\n vs: WEBGLShader;\n fs: WEBGLShader;\n layout: ShaderLayout;\n\n // configuration: ProgramConfiguration;\n // Experimental flag to avoid deleting Program object while it is cached\n varyings: string[] | null = null;\n vertexArrayObject: WEBGLVertexArrayObject;\n _indexBuffer?: Buffer;\n uniforms: Record<string, any> = {};\n bindings: Record<string, any> = {};\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.layout = props.layout || getShaderLayout(this.device.gl, this.handle);\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 = indexBuffer;\n }\n\n /** @todo needed for portable model */\n setAttributes(attributes: Record<string, Buffer>): void {\n for (const [name, buffer] of Object.entries(attributes)) {\n const webglBuffer = cast<WEBGLBuffer>(buffer);\n const attribute = getAttributeLayout(this.layout, name);\n if (!attribute) {\n log.warn(`Ignoring buffer supplied for unknown attribute \"${name}\" in pipeline \"${this.id}\" (buffer \"${buffer.id}\")`)();\n continue; // eslint-disable-line no-continue\n }\n const decoded = decodeVertexFormat(attribute.format);\n const {type: typeString, components: size, byteLength: stride, normalized, integer} = decoded;\n const divisor = attribute.stepMode === 'instance' ? 1 : 0;\n const type = getWebGLDataType(typeString);\n this.vertexArrayObject.setBuffer(attribute.location, webglBuffer, {\n size,\n type,\n stride,\n offset: 0,\n normalized,\n integer,\n divisor\n });\n }\n }\n\n /** @todo needed for portable model */\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.layout.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 = getDrawMode(this.props.topology);\n const isIndexed: boolean = Boolean(this._indexBuffer);\n const indexType = this._indexBuffer?.props.indexType === 'uint16' ? GL.UNSIGNED_SHORT : GL.UNSIGNED_INT;\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\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(drawMode, firstVertex, vertexCount || 0, instanceCount || 0);\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 /** Apply any bindings */\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.layout.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 _applyUniforms() {\n for (const uniformLayout of this.layout.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 transform feedback */\nfunction getDrawMode(\n topology: PrimitiveTopology\n): GL.POINTS | GL.LINES | GL.LINE_STRIP | GL.LINE_LOOP | GL.TRIANGLES | GL.TRIANGLE_STRIP | 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': return GL.LINE_LOOP;\n case 'triangle-list': return GL.TRIANGLES;\n case 'triangle-strip': return GL.TRIANGLE_STRIP;\n case 'triangle-fan': 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': return GL.LINES;\n case 'triangle-list': return GL.TRIANGLES;\n case 'triangle-strip': return GL.TRIANGLES;\n case 'triangle-fan': return GL.TRIANGLES;\n default: throw new Error(topology);\n }\n}\n\n// function getAttributesByLocation(\n// attributes: Record<string, Buffer>,\n// layout: ShaderLayout\n// ): Record<number, Buffer> {\n// const byLocation: Record<number, Buffer> = {};\n// for (const [name, buffer] of Object.entries(attributes)) {\n// const attribute = getAttributeLayout(layout, name);\n// if (attribute) {\n// byLocation[attribute.location] = buffer;\n// }\n// }\n// return byLocation;\n// }\n\nfunction getAttributeLayout(layout: ShaderLayout, name: string): AttributeLayout | null {\n return layout.attributes.find((binding) => binding.name === name) || null;\n}\n\n/* TODO\nfunction getBindingLayout(layout: ShaderLayout, name: string): BindingLayout {\n const binding = layout.bindings.find((binding) => binding.name === name);\n if (!binding) {\n throw new Error(`Unknown binding ${name}`);\n }\n return binding;\n}\n*/\n"],"mappings":";AAUA,SAAQA,cAAc,EAAEC,IAAI,EAAEC,GAAG,EAAEC,kBAAkB,QAAO,cAAc;AAC1E,OAAOC,EAAE,MAAM,oBAAoB;AAAC,SAE5BC,gBAAgB;AAAA,SAChBC,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,SAASd,cAAc,CAAC;EAmBtDe,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,mBAXK,IAAI;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,mBAGA,CAAC,CAAC;IAAAA,eAAA,mBACF,CAAC,CAAC;IAAAA,eAAA,2BACM,CAAC,CAAC;IAAAA,eAAA,+BACX,CAAC;IAAAA,eAAA,wBACR,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IACxC;MAAS,MAAM,IAAI5E,KAAK,CAACa,QAAQ,CAAC;EAAC;AAEvC;AAgBA,SAASpC,kBAAkBA,CAACjB,MAAoB,EAAEY,IAAY,EAA0B;EACtF,OAAOZ,MAAM,CAACW,UAAU,CAAC4B,IAAI,CAAED,OAAO,IAAKA,OAAO,CAAC1B,IAAI,KAAKA,IAAI,CAAC,IAAI,IAAI;AAC3E"}
|
|
1
|
+
{"version":3,"file":"webgl-render-pipeline.js","names":["RenderPipeline","cast","log","decodeVertexFormat","GL","getWebGLDataType","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","layout","vertexArrayObject","destroy","deleteProgram","destroyed","setIndexBuffer","indexBuffer","webglBuffer","setElementBuffer","_indexBuffer","setAttributes","attributes","name","buffer","Object","entries","attribute","getAttributeLayout","warn","concat","decoded","format","type","typeString","components","size","byteLength","stride","normalized","integer","divisor","stepMode","setBuffer","location","offset","setBindings","bindings","value","binding","find","Error","setUniforms","uniforms","assign","draw","options","_this$_indexBuffer","renderPass","vertexCount","instanceCount","firstVertex","drawMode","getDrawMode","topology","isIndexed","Boolean","indexType","UNSIGNED_SHORT","UNSIGNED_INT","isInstanced","Number","_areTexturesRenderable","useProgram","bind","primitiveMode","getGLPrimitive","transformFeedback","begin","_applyBindings","_applyUniforms","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","textureUnit","uniformBufferIndex","getUniformBlockIndex","INVALID_INDEX","uniformBlockBinding","bindBufferBase","UNIFORM_BUFFER","bindBufferRange","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 // BindingLayout,\n AttributeLayout\n} from '@luma.gl/api';\nimport {RenderPipeline, cast, log, decodeVertexFormat} from '@luma.gl/api';\nimport GL from '@luma.gl/constants';\n\nimport {getWebGLDataType} from '../converters/texture-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 device: WebGLDevice;\n handle: WebGLProgram;\n vs: WEBGLShader;\n fs: WEBGLShader;\n layout: ShaderLayout;\n\n // configuration: ProgramConfiguration;\n // Experimental flag to avoid deleting Program object while it is cached\n varyings: string[] | null = null;\n vertexArrayObject: WEBGLVertexArrayObject;\n _indexBuffer?: Buffer;\n uniforms: Record<string, any> = {};\n bindings: Record<string, any> = {};\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.layout = props.layout || getShaderLayout(this.device.gl, this.handle);\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 = indexBuffer;\n }\n\n /** @todo needed for portable model */\n setAttributes(attributes: Record<string, Buffer>): void {\n for (const [name, buffer] of Object.entries(attributes)) {\n const webglBuffer = cast<WEBGLBuffer>(buffer);\n const attribute = getAttributeLayout(this.layout, name);\n if (!attribute) {\n log.warn(`Ignoring buffer supplied for unknown attribute \"${name}\" in pipeline \"${this.id}\" (buffer \"${buffer.id}\")`)();\n continue; // eslint-disable-line no-continue\n }\n const decoded = decodeVertexFormat(attribute.format);\n const {type: typeString, components: size, byteLength: stride, normalized, integer} = decoded;\n const divisor = attribute.stepMode === 'instance' ? 1 : 0;\n const type = getWebGLDataType(typeString);\n this.vertexArrayObject.setBuffer(attribute.location, webglBuffer, {\n size,\n type,\n stride,\n offset: 0,\n normalized,\n integer,\n divisor\n });\n }\n }\n\n /** @todo needed for portable model */\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.layout.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 = getDrawMode(this.props.topology);\n const isIndexed: boolean = Boolean(this._indexBuffer);\n const indexType = this._indexBuffer?.props.indexType === 'uint16' ? GL.UNSIGNED_SHORT : GL.UNSIGNED_INT;\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\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(drawMode, firstVertex, vertexCount || 0, instanceCount || 0);\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 /** Apply any bindings */\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.layout.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 _applyUniforms() {\n for (const uniformLayout of this.layout.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 transform feedback */\nfunction getDrawMode(\n topology: PrimitiveTopology\n): GL.POINTS | GL.LINES | GL.LINE_STRIP | GL.LINE_LOOP | GL.TRIANGLES | GL.TRIANGLE_STRIP | 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': return GL.LINE_LOOP;\n case 'triangle-list': return GL.TRIANGLES;\n case 'triangle-strip': return GL.TRIANGLE_STRIP;\n case 'triangle-fan': 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': return GL.LINES;\n case 'triangle-list': return GL.TRIANGLES;\n case 'triangle-strip': return GL.TRIANGLES;\n case 'triangle-fan': return GL.TRIANGLES;\n default: throw new Error(topology);\n }\n}\n\n// function getAttributesByLocation(\n// attributes: Record<string, Buffer>,\n// layout: ShaderLayout\n// ): Record<number, Buffer> {\n// const byLocation: Record<number, Buffer> = {};\n// for (const [name, buffer] of Object.entries(attributes)) {\n// const attribute = getAttributeLayout(layout, name);\n// if (attribute) {\n// byLocation[attribute.location] = buffer;\n// }\n// }\n// return byLocation;\n// }\n\nfunction getAttributeLayout(layout: ShaderLayout, name: string): AttributeLayout | null {\n return layout.attributes.find((binding) => binding.name === name) || null;\n}\n\n/* TODO\nfunction getBindingLayout(layout: ShaderLayout, name: string): BindingLayout {\n const binding = layout.bindings.find((binding) => binding.name === name);\n if (!binding) {\n throw new Error(`Unknown binding ${name}`);\n }\n return binding;\n}\n*/\n"],"mappings":";AAUA,SAAQA,cAAc,EAAEC,IAAI,EAAEC,GAAG,EAAEC,kBAAkB,QAAO,cAAc;AAC1E,OAAOC,EAAE,MAAM,oBAAoB;AAAC,SAE5BC,gBAAgB;AAAA,SAChBC,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,SAASd,cAAc,CAAC;EAmBtDe,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,mBAXK,IAAI;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,mBAGA,CAAC,CAAC;IAAAA,eAAA,mBACF,CAAC,CAAC;IAAAA,eAAA,2BACM,CAAC,CAAC;IAAAA,eAAA,+BACX,CAAC;IAAAA,eAAA,wBACR,CAAC;IAAAA,eAAA,0BACmB,CAAC,CAAC;IAI5C,IAAI,CAACF,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACG,MAAM,GAAG,IAAI,CAACF,KAAK,CAACE,MAAM,IAAI,IAAI,CAACH,MAAM,CAACI,EAAE,CAACC,aAAa,EAAE;IACjE,IAAI,CAACL,MAAM,CAACM,kBAAkB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C4B,IAAI,CAAED,OAAO,IAAKA,OAAO,CAAC1B,IAAI,KAAKA,IAAI,CAAC,IAAI,IAAI;AAC3E"}
|
|
@@ -3,7 +3,7 @@ import { Texture } from '@luma.gl/api';
|
|
|
3
3
|
import { GL, GLSamplerParameters } from '@luma.gl/constants';
|
|
4
4
|
import { WebGLDevice } from '../webgl-device';
|
|
5
5
|
import { WEBGLSampler } from './webgl-sampler';
|
|
6
|
-
export
|
|
6
|
+
export type WEBGLTextureProps = TextureProps & {
|
|
7
7
|
/** @deprecated use props.sampler */
|
|
8
8
|
parameters?: Record<number, number>;
|
|
9
9
|
/** @deprecated use props.data */
|
|
@@ -28,8 +28,8 @@ export declare const DEFAULT_WEBGL_TEXTURE_PROPS: {
|
|
|
28
28
|
textureUnit: any;
|
|
29
29
|
target: any;
|
|
30
30
|
};
|
|
31
|
-
export
|
|
32
|
-
|
|
31
|
+
export type TextureSourceData = TypedArray | ImageData | HTMLImageElement | HTMLCanvasElement | ImageBitmap | HTMLVideoElement;
|
|
32
|
+
type SetImageDataOptions = {
|
|
33
33
|
target?: number;
|
|
34
34
|
level?: number;
|
|
35
35
|
dataFormat?: any;
|
|
@@ -67,7 +67,7 @@ declare type SetImageDataOptions = {
|
|
|
67
67
|
* @param {Number} offset - (WEBGL2) offset from start of buffer
|
|
68
68
|
* @parameters - temporary settings to be applied, can be used to supply pixel store settings.
|
|
69
69
|
*/
|
|
70
|
-
|
|
70
|
+
type SetSubImageDataOptions = {
|
|
71
71
|
target?: number;
|
|
72
72
|
level?: number;
|
|
73
73
|
dataFormat?: any;
|
|
@@ -85,7 +85,7 @@ declare type SetSubImageDataOptions = {
|
|
|
85
85
|
/** @deprecated */
|
|
86
86
|
pixels?: any;
|
|
87
87
|
};
|
|
88
|
-
|
|
88
|
+
type SetImageData3DOptions = {
|
|
89
89
|
level?: number;
|
|
90
90
|
dataFormat?: any;
|
|
91
91
|
width?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-texture.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,MAAM,EACN,YAAY,EACZ,OAAO,EACP,YAAY,EAEZ,UAAU,EAEX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,OAAO,EAA6C,MAAM,cAAc,CAAC;AACjF,OAAO,EAAC,EAAE,EAAE,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AAW3D,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAE7C,
|
|
1
|
+
{"version":3,"file":"webgl-texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-texture.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,MAAM,EACN,YAAY,EACZ,OAAO,EACP,YAAY,EAEZ,UAAU,EAEX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,OAAO,EAA6C,MAAM,cAAc,CAAC;AACjF,OAAO,EAAC,EAAE,EAAE,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AAW3D,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAE7C,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG;IAC7C,oCAAoC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,iCAAiC;IACjC,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,mCAAmC;IACnC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mCAAmC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,M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,MAAM,EAAE,MAAM,CAAA;KAAC;IAmChE,mBAAmB,CAAC,OAAO,EAAE;QACjC,KAAK,EAAE,GAAG,CAAC;QACX,MAAM,EAAE,GAAG,CAAC;QACZ,MAAM,EAAE,GAAG,CAAC;QACZ,IAAI,EAAE,GAAG,CAAC;QACV,MAAM,CAAC,EAAE,GAAG,CAAC;QACb,IAAI,CAAC,EAAE,GAAG,CAAC;KACZ,GAAG,OAAO,CAAC,IAAI,CAAC;IA+CjB,8CAA8C;IAC9C,mBAAmB,CAAC,OAAO,KAAA;IAoC3B,sDAAsD;IACtD,cAAc,CAAC,OAAO,EAAE,qBAAqB;IAqE7C;;;OAGG;IACH,qBAAqB,CAAC,UAAU,EAAE,mBAAmB,GAAG,IAAI;IAmC5D,6CAA6C;IAC7C,SAAS,CAAC,+BAA+B,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;CAqBhF"}
|
package/dist/classic/buffer.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { AccessorObject } from '../types';
|
|
|
4
4
|
import { Accessor } from './accessor';
|
|
5
5
|
import { WEBGLBuffer } from '../adapter/resources/webgl-buffer';
|
|
6
6
|
/** WebGL Buffer interface */
|
|
7
|
-
export
|
|
7
|
+
export type ClassicBufferProps = BufferProps & {
|
|
8
8
|
handle?: WebGLBuffer;
|
|
9
9
|
target?: number;
|
|
10
10
|
webglUsage?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["../../src/classic/buffer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AAElE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEpC,OAAO,EAAC,cAAc,EAAC,MAAM,UAAU,CAAC;AACxC,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAIpC,OAAO,EAAC,WAAW,EAAC,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C,GAAG,IAAI;IAcnD,YAAY,IAAI;QACd,IAAI,EAAE,GAAG,CAAC;QACV,OAAO,EAAE,OAAO,CAAC;KAChB;IAQH,mBAAmB;IAOnB,QAAQ,CAAC,IAAI,KAAA,EAAE,MAAM,GAAE,MAAU,EAAE,UAAU,GAAE,MAAiC,GAAG,IAAI;IAwBvF,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,SAAkB,GAAG,IAAI;IA8BtE,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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Device, Framebuffer } from '@luma.gl/api';
|
|
2
|
+
/**
|
|
3
|
+
* Optionally clears depth, color and stencil buffers
|
|
4
|
+
* @deprecated Set clear color when creating a RenderPass.
|
|
5
|
+
*/
|
|
6
|
+
export declare function clear(gl: Device | WebGLRenderingContext, options?: {
|
|
7
|
+
framebuffer?: Framebuffer;
|
|
8
|
+
color?: any;
|
|
9
|
+
depth?: any;
|
|
10
|
+
stencil?: any;
|
|
11
|
+
}): void;
|
|
12
|
+
/**
|
|
13
|
+
* WebGL2 - clear a specific drawing buffer
|
|
14
|
+
* @deprecated Set clear color when creating a RenderPass
|
|
15
|
+
*/
|
|
16
|
+
export declare function clearBuffer(gl: Device | WebGLRenderingContext, options?: {
|
|
17
|
+
framebuffer?: Framebuffer;
|
|
18
|
+
buffer?: any;
|
|
19
|
+
drawBuffer?: any;
|
|
20
|
+
value?: any;
|
|
21
|
+
}): void;
|
|
22
|
+
//# sourceMappingURL=clear.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clear.d.ts","sourceRoot":"","sources":["../../src/classic/clear.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,WAAW,EAAS,MAAM,cAAc,CAAC;AAiBzD;;;GAGG;AACH,wBAAgB,KAAK,CACnB,EAAE,EAAE,MAAM,GAAG,qBAAqB,EAClC,OAAO,CAAC,EAAE;IAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,GAAG,CAAC;IAAC,OAAO,CAAC,EAAE,GAAG,CAAA;CAAC,GAC7E,IAAI,CAsCN;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,EAAE,EAAE,MAAM,GAAG,qBAAqB,EAClC,OAAO,CAAC,EAAE;IAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IAAC,MAAM,CAAC,EAAE,GAAG,CAAC;IAAC,UAAU,CAAC,EAAE,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,GAAG,CAAA;CAAC,QAuCnF"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { assert } from '@luma.gl/api';
|
|
2
|
+
import { WebGLDevice } from "../adapter/webgl-device.js";
|
|
3
|
+
import { withParameters } from "../context/state-tracker/with-parameters.js";
|
|
4
|
+
const GL_DEPTH_BUFFER_BIT = 0x00000100;
|
|
5
|
+
const GL_STENCIL_BUFFER_BIT = 0x00000400;
|
|
6
|
+
const GL_COLOR_BUFFER_BIT = 0x00004000;
|
|
7
|
+
const GL_COLOR = 0x1800;
|
|
8
|
+
const GL_DEPTH = 0x1801;
|
|
9
|
+
const GL_STENCIL = 0x1802;
|
|
10
|
+
const GL_DEPTH_STENCIL = 0x84f9;
|
|
11
|
+
const ERR_ARGUMENTS = 'clear: bad arguments';
|
|
12
|
+
export function clear(gl, options) {
|
|
13
|
+
const device = WebGLDevice.attach(gl);
|
|
14
|
+
const {
|
|
15
|
+
framebuffer = null,
|
|
16
|
+
color = null,
|
|
17
|
+
depth = null,
|
|
18
|
+
stencil = null
|
|
19
|
+
} = options || {};
|
|
20
|
+
const parameters = {};
|
|
21
|
+
if (framebuffer) {
|
|
22
|
+
parameters.framebuffer = framebuffer;
|
|
23
|
+
}
|
|
24
|
+
let clearFlags = 0;
|
|
25
|
+
if (color) {
|
|
26
|
+
clearFlags |= GL_COLOR_BUFFER_BIT;
|
|
27
|
+
if (color !== true) {
|
|
28
|
+
parameters.clearColor = color;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (depth) {
|
|
32
|
+
clearFlags |= GL_DEPTH_BUFFER_BIT;
|
|
33
|
+
if (depth !== true) {
|
|
34
|
+
parameters.clearDepth = depth;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (stencil) {
|
|
38
|
+
clearFlags |= GL_STENCIL_BUFFER_BIT;
|
|
39
|
+
if (depth !== true) {
|
|
40
|
+
parameters.clearStencil = depth;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
assert(clearFlags !== 0, ERR_ARGUMENTS);
|
|
44
|
+
withParameters(device.gl, parameters, () => {
|
|
45
|
+
device.gl.clear(clearFlags);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
export function clearBuffer(gl, options) {
|
|
49
|
+
const device = WebGLDevice.attach(gl);
|
|
50
|
+
const {
|
|
51
|
+
framebuffer = null,
|
|
52
|
+
buffer = GL_COLOR,
|
|
53
|
+
drawBuffer = 0,
|
|
54
|
+
value = [0, 0, 0, 0]
|
|
55
|
+
} = options || {};
|
|
56
|
+
withParameters(device.gl2, {
|
|
57
|
+
framebuffer
|
|
58
|
+
}, () => {
|
|
59
|
+
switch (buffer) {
|
|
60
|
+
case GL_COLOR:
|
|
61
|
+
switch (value.constructor) {
|
|
62
|
+
case Int32Array:
|
|
63
|
+
device.gl2.clearBufferiv(buffer, drawBuffer, value);
|
|
64
|
+
break;
|
|
65
|
+
case Uint32Array:
|
|
66
|
+
device.gl2.clearBufferuiv(buffer, drawBuffer, value);
|
|
67
|
+
break;
|
|
68
|
+
case Float32Array:
|
|
69
|
+
default:
|
|
70
|
+
device.gl2.clearBufferfv(buffer, drawBuffer, value);
|
|
71
|
+
}
|
|
72
|
+
break;
|
|
73
|
+
case GL_DEPTH:
|
|
74
|
+
device.gl2.clearBufferfv(GL_DEPTH, 0, [value]);
|
|
75
|
+
break;
|
|
76
|
+
case GL_STENCIL:
|
|
77
|
+
device.gl2.clearBufferiv(GL_STENCIL, 0, [value]);
|
|
78
|
+
break;
|
|
79
|
+
case GL_DEPTH_STENCIL:
|
|
80
|
+
const [depth, stencil] = value;
|
|
81
|
+
device.gl2.clearBufferfi(GL_DEPTH_STENCIL, 0, depth, stencil);
|
|
82
|
+
break;
|
|
83
|
+
default:
|
|
84
|
+
assert(false, ERR_ARGUMENTS);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=clear.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clear.js","names":["assert","WebGLDevice","withParameters","GL_DEPTH_BUFFER_BIT","GL_STENCIL_BUFFER_BIT","GL_COLOR_BUFFER_BIT","GL_COLOR","GL_DEPTH","GL_STENCIL","GL_DEPTH_STENCIL","ERR_ARGUMENTS","clear","gl","options","device","attach","framebuffer","color","depth","stencil","parameters","clearFlags","clearColor","clearDepth","clearStencil","clearBuffer","buffer","drawBuffer","value","gl2","constructor","Int32Array","clearBufferiv","Uint32Array","clearBufferuiv","Float32Array","clearBufferfv","clearBufferfi"],"sources":["../../src/classic/clear.ts"],"sourcesContent":["import {Device, Framebuffer, assert} from '@luma.gl/api';\nimport {WebGLDevice} from '../adapter/webgl-device';\nimport {withParameters} from '../context/state-tracker/with-parameters';\n\n// Should collapse during minification\nconst GL_DEPTH_BUFFER_BIT = 0x00000100;\nconst GL_STENCIL_BUFFER_BIT = 0x00000400;\nconst GL_COLOR_BUFFER_BIT = 0x00004000;\n\nconst GL_COLOR = 0x1800;\nconst GL_DEPTH = 0x1801;\nconst GL_STENCIL = 0x1802;\nconst GL_DEPTH_STENCIL = 0x84f9;\n\n// Should disappear if asserts are removed\nconst ERR_ARGUMENTS = 'clear: bad arguments';\n\n/** \n * Optionally clears depth, color and stencil buffers \n * @deprecated Set clear color when creating a RenderPass.\n */\nexport function clear(\n gl: Device | WebGLRenderingContext,\n options?: {framebuffer?: Framebuffer; color?: any; depth?: any; stencil?: any}\n): void {\n const device = WebGLDevice.attach(gl);\n const {framebuffer = null, color = null, depth = null, stencil = null} = options || {};\n const parameters: any = {};\n\n if (framebuffer) {\n parameters.framebuffer = framebuffer;\n }\n\n let clearFlags = 0;\n\n if (color) {\n clearFlags |= GL_COLOR_BUFFER_BIT;\n if (color !== true) {\n parameters.clearColor = color;\n }\n }\n\n if (depth) {\n clearFlags |= GL_DEPTH_BUFFER_BIT;\n if (depth !== true) {\n parameters.clearDepth = depth;\n }\n }\n\n if (stencil) {\n clearFlags |= GL_STENCIL_BUFFER_BIT;\n if (depth !== true) {\n parameters.clearStencil = depth;\n }\n }\n\n assert(clearFlags !== 0, ERR_ARGUMENTS);\n\n // Temporarily set any clear \"colors\" and call clear\n withParameters(device.gl, parameters, () => {\n device.gl.clear(clearFlags);\n });\n}\n\n/** \n * WebGL2 - clear a specific drawing buffer \n * @deprecated Set clear color when creating a RenderPass\n */\nexport function clearBuffer(\n gl: Device | WebGLRenderingContext,\n options?: {framebuffer?: Framebuffer; buffer?: any; drawBuffer?: any; value?: any}\n) {\n const device = WebGLDevice.attach(gl);\n\n const {framebuffer = null, buffer = GL_COLOR, drawBuffer = 0, value = [0, 0, 0, 0]} = options || {};\n withParameters(device.gl2, {framebuffer}, () => {\n // Method selection per OpenGL ES 3 docs\n switch (buffer) {\n case GL_COLOR:\n switch (value.constructor) {\n case Int32Array:\n device.gl2.clearBufferiv(buffer, drawBuffer, value);\n break;\n case Uint32Array:\n device.gl2.clearBufferuiv(buffer, drawBuffer, value);\n break;\n case Float32Array:\n default:\n device.gl2.clearBufferfv(buffer, drawBuffer, value);\n }\n break;\n\n case GL_DEPTH:\n device.gl2.clearBufferfv(GL_DEPTH, 0, [value]);\n break;\n\n case GL_STENCIL:\n device.gl2.clearBufferiv(GL_STENCIL, 0, [value]);\n break;\n\n case GL_DEPTH_STENCIL:\n const [depth, stencil] = value;\n device.gl2.clearBufferfi(GL_DEPTH_STENCIL, 0, depth, stencil);\n break;\n\n default:\n assert(false, ERR_ARGUMENTS);\n }\n });\n}\n"],"mappings":"AAAA,SAA6BA,MAAM,QAAO,cAAc;AAAC,SACjDC,WAAW;AAAA,SACXC,cAAc;AAGtB,MAAMC,mBAAmB,GAAG,UAAU;AACtC,MAAMC,qBAAqB,GAAG,UAAU;AACxC,MAAMC,mBAAmB,GAAG,UAAU;AAEtC,MAAMC,QAAQ,GAAG,MAAM;AACvB,MAAMC,QAAQ,GAAG,MAAM;AACvB,MAAMC,UAAU,GAAG,MAAM;AACzB,MAAMC,gBAAgB,GAAG,MAAM;AAG/B,MAAMC,aAAa,GAAG,sBAAsB;AAM5C,OAAO,SAASC,KAAKA,CACnBC,EAAkC,EAClCC,OAA8E,EACxE;EACN,MAAMC,MAAM,GAAGb,WAAW,CAACc,MAAM,CAACH,EAAE,CAAC;EACrC,MAAM;IAACI,WAAW,GAAG,IAAI;IAAEC,KAAK,GAAG,IAAI;IAAEC,KAAK,GAAG,IAAI;IAAEC,OAAO,GAAG;EAAI,CAAC,GAAGN,OAAO,IAAI,CAAC,CAAC;EACtF,MAAMO,UAAe,GAAG,CAAC,CAAC;EAE1B,IAAIJ,WAAW,EAAE;IACfI,UAAU,CAACJ,WAAW,GAAGA,WAAW;EACtC;EAEA,IAAIK,UAAU,GAAG,CAAC;EAElB,IAAIJ,KAAK,EAAE;IACTI,UAAU,IAAIhB,mBAAmB;IACjC,IAAIY,KAAK,KAAK,IAAI,EAAE;MAClBG,UAAU,CAACE,UAAU,GAAGL,KAAK;IAC/B;EACF;EAEA,IAAIC,KAAK,EAAE;IACTG,UAAU,IAAIlB,mBAAmB;IACjC,IAAIe,KAAK,KAAK,IAAI,EAAE;MAClBE,UAAU,CAACG,UAAU,GAAGL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QAAQ,EAAE,CAAC,EAAE,CAACqB,KAAK,CAAC,CAAC;QAC9C;MAEF,KAAKpB,UAAU;QACbM,MAAM,CAACe,GAAG,CAACG,aAAa,CAACxB,UAAU,EAAE,CAAC,EAAE,CAACoB,KAAK,CAAC,CAAC;QAChD;MAEF,KAAKnB,gBAAgB;QACnB,MAAM,CAACS,KAAK,EAAEC,OAAO,CAAC,GAAGS,KAAK;QAC9Bd,MAAM,CAACe,GAAG,CAACQ,aAAa,CAAC5B,gBAAgB,EAAE,CAAC,EAAES,KAAK,EAAEC,OAAO,CAAC;QAC7D;MAEF;QACEnB,MAAM,CAAC,KAAK,EAAEU,aAAa,CAAC;IAAC;EAEnC,CAAC,CAAC;AACJ"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Texture, Framebuffer, FramebufferProps } from '@luma.gl/api';
|
|
2
|
+
import { ClassicBuffer as Buffer } from './buffer';
|
|
3
|
+
/**
|
|
4
|
+
* Copies data from a type or a Texture object into ArrayBuffer object.
|
|
5
|
+
* App can provide targetPixelArray or have it auto allocated by this method
|
|
6
|
+
* newly allocated by this method unless provided by app.
|
|
7
|
+
* @deprecated Use CommandEncoder.copyTextureToBuffer and Buffer.read
|
|
8
|
+
* @note Slow requires roundtrip to GPU
|
|
9
|
+
*
|
|
10
|
+
* @param source
|
|
11
|
+
* @param options
|
|
12
|
+
* @returns pixel array,
|
|
13
|
+
*/
|
|
14
|
+
export declare function readPixelsToArray(source: Framebuffer | Texture, options?: {
|
|
15
|
+
sourceX?: number;
|
|
16
|
+
sourceY?: number;
|
|
17
|
+
sourceFormat?: number;
|
|
18
|
+
sourceAttachment?: number;
|
|
19
|
+
target?: Uint8Array | Uint16Array | Float32Array;
|
|
20
|
+
sourceWidth?: number;
|
|
21
|
+
sourceHeight?: number;
|
|
22
|
+
sourceType?: number;
|
|
23
|
+
}): Uint8Array | Uint16Array | Float32Array;
|
|
24
|
+
/**
|
|
25
|
+
* Copies data from a Framebuffer or a Texture object into a Buffer object.
|
|
26
|
+
* NOTE: doesn't wait for copy to be complete, it programs GPU to perform a DMA transffer.
|
|
27
|
+
* @param source
|
|
28
|
+
* @param options
|
|
29
|
+
*/
|
|
30
|
+
export declare function readPixelsToBuffer(source: Framebuffer | Texture, options?: {
|
|
31
|
+
sourceX?: number;
|
|
32
|
+
sourceY?: number;
|
|
33
|
+
sourceFormat?: number;
|
|
34
|
+
target?: Buffer;
|
|
35
|
+
targetByteOffset?: number;
|
|
36
|
+
sourceWidth?: number;
|
|
37
|
+
sourceHeight?: number;
|
|
38
|
+
sourceType?: number;
|
|
39
|
+
}): Buffer;
|
|
40
|
+
/**
|
|
41
|
+
* Wraps a given texture into a framebuffer object, that can be further used
|
|
42
|
+
* to read data from the texture object.
|
|
43
|
+
*/
|
|
44
|
+
export declare function toFramebuffer(texture: Texture, props?: FramebufferProps): Framebuffer;
|
|
45
|
+
//# sourceMappingURL=copy-and-blit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-and-blit.d.ts","sourceRoot":"","sources":["../../src/classic/copy-and-blit.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAG5E,OAAO,EAAC,aAAa,IAAI,MAAM,EAAC,MAAM,UAAU,CAAC;AAOjD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,WAAW,GAAG,OAAO,EAC7B,OAAO,CAAC,EAAE;IACR,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,YAAY,CAAC;IAEjD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,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