@luma.gl/webgl 9.0.5 → 9.0.6
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/resources/webgl-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.js +4 -0
- package/dist/adapter/resources/webgl-render-pipeline.d.ts +4 -3
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +3 -3
- package/dist/adapter/resources/webgl-shader.js +2 -2
- package/dist/dist.dev.js +52 -57
- package/dist/dist.min.js +2 -2
- package/dist/index.cjs +9 -3
- package/dist/index.cjs.map +2 -2
- package/dist.min.js +19 -0
- package/package.json +3 -3
- package/src/adapter/resources/webgl-render-pass.ts +7 -0
- package/src/adapter/resources/webgl-render-pipeline.ts +33 -35
- package/src/adapter/resources/webgl-shader.ts +2 -2
- package/src/.DS_Store +0 -0
- package/src/adapter/.DS_Store +0 -0
- package/src/context/.DS_Store +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-render-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-render-pass.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAC5C,OAAO,EAAK,YAAY,EAAC,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"webgl-render-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-render-pass.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAC5C,OAAO,EAAK,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAcpD,qBAAa,eAAgB,SAAQ,UAAU;IAC7C,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAE7B,8DAA8D;IAC9D,YAAY,EAAE,YAAY,CAAC;gBAEf,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,eAAe;IAYvD,GAAG,IAAI,IAAI;IAQX,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IACxC,aAAa,IAAI,IAAI;IACrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAO5C;;OAEG;IACH,aAAa,CAAC,UAAU,GAAE,oBAAyB,GAAG,IAAI;IAqD1D,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAKpC,iBAAiB,IAAI,IAAI;IAOlC;;OAEG;IACH,SAAS,CAAC,KAAK,IAAI,IAAI;IA+BvB;;OAEG;IACH,SAAS,CAAC,gBAAgB,CAAC,UAAU,GAAE,MAAU,EAAE,KAAK,GAAE,WAA0B;CAwCrF"}
|
|
@@ -11,6 +11,7 @@ const GL_DEPTH_BUFFER_BIT = 0x00000100;
|
|
|
11
11
|
const GL_STENCIL_BUFFER_BIT = 0x00000400;
|
|
12
12
|
const GL_COLOR_BUFFER_BIT = 0x00004000;
|
|
13
13
|
const GL_COLOR = 0x1800;
|
|
14
|
+
const COLOR_CHANNELS = [0x1, 0x2, 0x4, 0x8]; // GPUColorWrite RED, GREEN, BLUE, ALPHA
|
|
14
15
|
export class WEBGLRenderPass extends RenderPass {
|
|
15
16
|
device;
|
|
16
17
|
/** Parameters that should be applied before each draw call */
|
|
@@ -77,6 +78,9 @@ export class WEBGLRenderPass extends RenderPass {
|
|
|
77
78
|
// Does this work?
|
|
78
79
|
parameters[2967] = parameters.stencilReference;
|
|
79
80
|
}
|
|
81
|
+
if (parameters.colorMask) {
|
|
82
|
+
glParameters.colorMask = COLOR_CHANNELS.map(channel => Boolean(channel & parameters.colorMask));
|
|
83
|
+
}
|
|
80
84
|
this.glParameters = glParameters;
|
|
81
85
|
setGLParameters(this.device.gl, glParameters);
|
|
82
86
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ShaderLayout } from '@luma.gl/core';
|
|
1
|
+
import type { RenderPipelineProps, RenderPipelineParameters, PrimitiveTopology } from '@luma.gl/core';
|
|
2
|
+
import type { ShaderLayout, UniformValue, Binding } from '@luma.gl/core';
|
|
3
3
|
import type { RenderPass, VertexArray } from '@luma.gl/core';
|
|
4
4
|
import { RenderPipeline } from '@luma.gl/core';
|
|
5
5
|
import { WebGLDevice } from "../webgl-device.js";
|
|
@@ -40,7 +40,8 @@ export declare class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
40
40
|
*/
|
|
41
41
|
draw(options: {
|
|
42
42
|
renderPass: RenderPass;
|
|
43
|
-
|
|
43
|
+
parameters?: RenderPipelineParameters;
|
|
44
|
+
topology?: PrimitiveTopology;
|
|
44
45
|
vertexArray: VertexArray;
|
|
45
46
|
vertexCount?: number;
|
|
46
47
|
indexCount?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-render-pipeline.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"webgl-render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-render-pipeline.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,mBAAmB,EAAE,wBAAwB,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AACpG,OAAO,KAAK,EAAC,YAAY,EAAE,YAAY,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AACvE,OAAO,KAAK,EAAC,UAAU,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,cAAc,EAAsC,MAAM,eAAe,CAAC;AAUlF,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAE5C,OAAO,EAAC,WAAW,EAAC,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AAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;KAC5C,GAAG,OAAO;IA6FF,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC;cAkBhD,YAAY;IA2B5B,wFAAwF;IACxF,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,YAAY;IAmB9D;;;;OAIG;IACH,cAAc,IAAI,SAAS,GAAG,SAAS,GAAG,YAAY;IAmBtD,6DAA6D;IACvD,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB3C;;;;OAIG;IACH,sBAAsB;IAatB,iDAAiD;IACjD,cAAc;IAyFd;;;OAGG;IACH,cAAc;CASf"}
|
|
@@ -128,14 +128,14 @@ export class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
128
128
|
* This function unifies those ways into a single call using common parameters with sane defaults
|
|
129
129
|
*/
|
|
130
130
|
draw(options) {
|
|
131
|
-
const { renderPass, vertexArray, vertexCount,
|
|
131
|
+
const { renderPass, parameters = this.props.parameters, topology = this.props.topology, vertexArray, vertexCount,
|
|
132
132
|
// indexCount,
|
|
133
133
|
instanceCount, firstVertex = 0,
|
|
134
134
|
// firstIndex,
|
|
135
135
|
// firstInstance,
|
|
136
136
|
// baseVertex,
|
|
137
137
|
transformFeedback } = options;
|
|
138
|
-
const glDrawMode = getGLDrawMode(
|
|
138
|
+
const glDrawMode = getGLDrawMode(topology);
|
|
139
139
|
const isIndexed = Boolean(vertexArray.indexBuffer);
|
|
140
140
|
const glIndexType = vertexArray.indexBuffer?.glIndexType;
|
|
141
141
|
const isInstanced = Number(instanceCount) > 0;
|
|
@@ -167,7 +167,7 @@ export class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
167
167
|
this._applyBindings();
|
|
168
168
|
this._applyUniforms();
|
|
169
169
|
const webglRenderPass = renderPass;
|
|
170
|
-
withDeviceAndGLParameters(this.device,
|
|
170
|
+
withDeviceAndGLParameters(this.device, parameters, webglRenderPass.glParameters, () => {
|
|
171
171
|
if (isIndexed && isInstanced) {
|
|
172
172
|
this.device.gl.drawElementsInstanced(glDrawMode, vertexCount || 0, // indexCount?
|
|
173
173
|
glIndexType, firstVertex, instanceCount || 0);
|
|
@@ -62,11 +62,11 @@ export class WEBGLShader extends Shader {
|
|
|
62
62
|
// Sync case - slower, but advantage is that it throws in the constructor, making break on error more useful
|
|
63
63
|
if (!this.device.features.has('compilation-status-async-webgl')) {
|
|
64
64
|
this._getCompilationStatus();
|
|
65
|
+
// The `Shader` base class will determine if debug window should be opened based on this.compilationStatus
|
|
66
|
+
this.debugShader();
|
|
65
67
|
if (this.compilationStatus === 'error') {
|
|
66
68
|
throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);
|
|
67
69
|
}
|
|
68
|
-
// The `Shader` base class will determine if debug window should be opened based on this.compilationStatus
|
|
69
|
-
this.debugShader();
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
// async case
|
package/dist/dist.dev.js
CHANGED
|
@@ -3712,38 +3712,35 @@ var __exports__ = (() => {
|
|
|
3712
3712
|
// src/context/debug/webgl-developer-tools.ts
|
|
3713
3713
|
var import_core13 = __toESM(require_core(), 1);
|
|
3714
3714
|
|
|
3715
|
+
// ../../node_modules/@probe.gl/env/dist/lib/globals.js
|
|
3716
|
+
var document_ = globalThis.document || {};
|
|
3717
|
+
var process_ = globalThis.process || {};
|
|
3718
|
+
var console_ = globalThis.console;
|
|
3719
|
+
var navigator_ = globalThis.navigator || {};
|
|
3720
|
+
|
|
3715
3721
|
// ../../node_modules/@probe.gl/env/dist/lib/is-electron.js
|
|
3716
3722
|
function isElectron(mockUserAgent) {
|
|
3717
|
-
if (typeof window !== "undefined" &&
|
|
3723
|
+
if (typeof window !== "undefined" && window.process?.type === "renderer") {
|
|
3718
3724
|
return true;
|
|
3719
3725
|
}
|
|
3720
|
-
if (typeof process !== "undefined" &&
|
|
3726
|
+
if (typeof process !== "undefined" && Boolean(process.versions?.["electron"])) {
|
|
3721
3727
|
return true;
|
|
3722
3728
|
}
|
|
3723
|
-
const realUserAgent = typeof navigator
|
|
3729
|
+
const realUserAgent = typeof navigator !== "undefined" && navigator.userAgent;
|
|
3724
3730
|
const userAgent = mockUserAgent || realUserAgent;
|
|
3725
|
-
|
|
3726
|
-
return true;
|
|
3727
|
-
}
|
|
3728
|
-
return false;
|
|
3731
|
+
return Boolean(userAgent && userAgent.indexOf("Electron") >= 0);
|
|
3729
3732
|
}
|
|
3730
3733
|
|
|
3731
3734
|
// ../../node_modules/@probe.gl/env/dist/lib/is-browser.js
|
|
3732
3735
|
function isBrowser() {
|
|
3733
|
-
const isNode =
|
|
3736
|
+
const isNode = (
|
|
3737
|
+
// @ts-expect-error
|
|
3738
|
+
typeof process === "object" && String(process) === "[object process]" && !process?.browser
|
|
3739
|
+
);
|
|
3734
3740
|
return !isNode || isElectron();
|
|
3735
3741
|
}
|
|
3736
3742
|
|
|
3737
|
-
// ../../node_modules/@probe.gl/env/dist/lib/globals.js
|
|
3738
|
-
var self_ = globalThis.self || globalThis.window || globalThis.global;
|
|
3739
|
-
var window_ = globalThis.window || globalThis.self || globalThis.global;
|
|
3740
|
-
var document_ = globalThis.document || {};
|
|
3741
|
-
var process_ = globalThis.process || {};
|
|
3742
|
-
var console_ = globalThis.console;
|
|
3743
|
-
var navigator_ = globalThis.navigator || {};
|
|
3744
|
-
|
|
3745
3743
|
// ../../node_modules/@probe.gl/env/dist/lib/get-browser.js
|
|
3746
|
-
var window2 = globalThis;
|
|
3747
3744
|
function getBrowser(mockUserAgent) {
|
|
3748
3745
|
if (!mockUserAgent && !isBrowser()) {
|
|
3749
3746
|
return "Node";
|
|
@@ -3755,18 +3752,13 @@ var __exports__ = (() => {
|
|
|
3755
3752
|
if (userAgent.indexOf("Edge") > -1) {
|
|
3756
3753
|
return "Edge";
|
|
3757
3754
|
}
|
|
3758
|
-
|
|
3759
|
-
const isTrident = userAgent.indexOf("Trident/") !== -1;
|
|
3760
|
-
if (isMSIE || isTrident) {
|
|
3761
|
-
return "IE";
|
|
3762
|
-
}
|
|
3763
|
-
if (window2.chrome) {
|
|
3755
|
+
if (globalThis.chrome) {
|
|
3764
3756
|
return "Chrome";
|
|
3765
3757
|
}
|
|
3766
|
-
if (
|
|
3758
|
+
if (globalThis.safari) {
|
|
3767
3759
|
return "Safari";
|
|
3768
3760
|
}
|
|
3769
|
-
if (
|
|
3761
|
+
if (globalThis.mozInnerScreenX) {
|
|
3770
3762
|
return "Firefox";
|
|
3771
3763
|
}
|
|
3772
3764
|
return "Unknown";
|
|
@@ -3971,10 +3963,10 @@ ${source2}`;
|
|
|
3971
3963
|
}
|
|
3972
3964
|
if (!this.device.features.has("compilation-status-async-webgl")) {
|
|
3973
3965
|
this._getCompilationStatus();
|
|
3966
|
+
this.debugShader();
|
|
3974
3967
|
if (this.compilationStatus === "error") {
|
|
3975
3968
|
throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);
|
|
3976
3969
|
}
|
|
3977
|
-
this.debugShader();
|
|
3978
3970
|
return;
|
|
3979
3971
|
}
|
|
3980
3972
|
import_core14.log.once(1, "Shader compilation is asynchronous")();
|
|
@@ -4016,6 +4008,7 @@ ${source2}`;
|
|
|
4016
4008
|
var GL_STENCIL_BUFFER_BIT = 1024;
|
|
4017
4009
|
var GL_COLOR_BUFFER_BIT = 16384;
|
|
4018
4010
|
var GL_COLOR = 6144;
|
|
4011
|
+
var COLOR_CHANNELS = [1, 2, 4, 8];
|
|
4019
4012
|
var WEBGLRenderPass = class extends import_core15.RenderPass {
|
|
4020
4013
|
device;
|
|
4021
4014
|
/** Parameters that should be applied before each draw call */
|
|
@@ -4074,6 +4067,11 @@ ${source2}`;
|
|
|
4074
4067
|
console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL");
|
|
4075
4068
|
parameters[2967 /* STENCIL_REF */] = parameters.stencilReference;
|
|
4076
4069
|
}
|
|
4070
|
+
if (parameters.colorMask) {
|
|
4071
|
+
glParameters.colorMask = COLOR_CHANNELS.map(
|
|
4072
|
+
(channel) => Boolean(channel & parameters.colorMask)
|
|
4073
|
+
);
|
|
4074
|
+
}
|
|
4077
4075
|
this.glParameters = glParameters;
|
|
4078
4076
|
setGLParameters(this.device.gl, glParameters);
|
|
4079
4077
|
}
|
|
@@ -4852,6 +4850,8 @@ ${source2}`;
|
|
|
4852
4850
|
draw(options) {
|
|
4853
4851
|
const {
|
|
4854
4852
|
renderPass,
|
|
4853
|
+
parameters = this.props.parameters,
|
|
4854
|
+
topology = this.props.topology,
|
|
4855
4855
|
vertexArray,
|
|
4856
4856
|
vertexCount,
|
|
4857
4857
|
// indexCount,
|
|
@@ -4862,7 +4862,7 @@ ${source2}`;
|
|
|
4862
4862
|
// baseVertex,
|
|
4863
4863
|
transformFeedback
|
|
4864
4864
|
} = options;
|
|
4865
|
-
const glDrawMode = getGLDrawMode(
|
|
4865
|
+
const glDrawMode = getGLDrawMode(topology);
|
|
4866
4866
|
const isIndexed = Boolean(vertexArray.indexBuffer);
|
|
4867
4867
|
const glIndexType = vertexArray.indexBuffer?.glIndexType;
|
|
4868
4868
|
const isInstanced = Number(instanceCount) > 0;
|
|
@@ -4886,37 +4886,32 @@ ${source2}`;
|
|
|
4886
4886
|
this._applyBindings();
|
|
4887
4887
|
this._applyUniforms();
|
|
4888
4888
|
const webglRenderPass = renderPass;
|
|
4889
|
-
withDeviceAndGLParameters(
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
instanceCount || 0
|
|
4911
|
-
);
|
|
4912
|
-
} else {
|
|
4913
|
-
this.device.gl.drawArrays(glDrawMode, firstVertex, vertexCount || 0);
|
|
4914
|
-
}
|
|
4915
|
-
if (transformFeedback) {
|
|
4916
|
-
transformFeedback.end();
|
|
4917
|
-
}
|
|
4889
|
+
withDeviceAndGLParameters(this.device, parameters, webglRenderPass.glParameters, () => {
|
|
4890
|
+
if (isIndexed && isInstanced) {
|
|
4891
|
+
this.device.gl.drawElementsInstanced(
|
|
4892
|
+
glDrawMode,
|
|
4893
|
+
vertexCount || 0,
|
|
4894
|
+
// indexCount?
|
|
4895
|
+
glIndexType,
|
|
4896
|
+
firstVertex,
|
|
4897
|
+
instanceCount || 0
|
|
4898
|
+
);
|
|
4899
|
+
} else if (isIndexed) {
|
|
4900
|
+
this.device.gl.drawElements(glDrawMode, vertexCount || 0, glIndexType, firstVertex);
|
|
4901
|
+
} else if (isInstanced) {
|
|
4902
|
+
this.device.gl.drawArraysInstanced(
|
|
4903
|
+
glDrawMode,
|
|
4904
|
+
firstVertex,
|
|
4905
|
+
vertexCount || 0,
|
|
4906
|
+
instanceCount || 0
|
|
4907
|
+
);
|
|
4908
|
+
} else {
|
|
4909
|
+
this.device.gl.drawArrays(glDrawMode, firstVertex, vertexCount || 0);
|
|
4918
4910
|
}
|
|
4919
|
-
|
|
4911
|
+
if (transformFeedback) {
|
|
4912
|
+
transformFeedback.end();
|
|
4913
|
+
}
|
|
4914
|
+
});
|
|
4920
4915
|
vertexArray.unbindAfterRender(renderPass);
|
|
4921
4916
|
return true;
|
|
4922
4917
|
}
|