@luma.gl/webgl 9.0.4 → 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 +5 -1
- 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/adapter/webgl-device.d.ts +1 -0
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +6 -2
- package/dist/dist.dev.js +41 -34
- package/dist/dist.min.js +2 -2
- package/dist/index.cjs +15 -5
- package/dist/index.cjs.map +2 -2
- package/package.json +3 -3
- package/src/adapter/resources/webgl-render-pass.ts +8 -1
- package/src/adapter/resources/webgl-render-pipeline.ts +33 -35
- package/src/adapter/resources/webgl-shader.ts +2 -2
- package/src/adapter/webgl-device.ts +11 -2
|
@@ -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 */
|
|
@@ -63,8 +64,8 @@ export class WEBGLRenderPass extends RenderPass {
|
|
|
63
64
|
glParameters.viewport = parameters.viewport;
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
|
-
glParameters.scissorTest = Boolean(parameters.scissorRect);
|
|
67
67
|
if (parameters.scissorRect) {
|
|
68
|
+
glParameters.scissorTest = true;
|
|
68
69
|
glParameters.scissor = parameters.scissorRect;
|
|
69
70
|
}
|
|
70
71
|
if (parameters.blendConstant) {
|
|
@@ -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,EAA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I,CAAC,OAAO,EAAE;QACZ,UAAU,EAAE,UAAU,CAAC;QACvB,UAAU,CAAC,EAAE,wBAAwB,CAAC;QACtC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;QAC7B,WAAW,EAAE,WAAW,CAAC;QACzB,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;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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-device.d.ts","sourceRoot":"","sources":["../../src/adapter/webgl-device.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,MAAM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rD"}
|
|
@@ -23,7 +23,7 @@ import { WEBGLVertexArray } from "./resources/webgl-vertex-array.js";
|
|
|
23
23
|
import { WEBGLTransformFeedback } from "./resources/webgl-transform-feedback.js";
|
|
24
24
|
import { WEBGLQuerySet } from "./resources/webgl-query-set.js";
|
|
25
25
|
import { readPixelsToArray, readPixelsToBuffer } from "../classic/copy-and-blit.js";
|
|
26
|
-
import { setGLParameters, getGLParameters } from "../context/parameters/unified-parameter-api.js";
|
|
26
|
+
import { setGLParameters, getGLParameters, resetGLParameters } from "../context/parameters/unified-parameter-api.js";
|
|
27
27
|
import { withGLParameters } from "../context/state-tracker/with-parameters.js";
|
|
28
28
|
import { clear } from "../classic/clear.js";
|
|
29
29
|
import { getWebGLExtension } from "../context/helpers/webgl-extensions.js";
|
|
@@ -266,11 +266,15 @@ ${device.info.vendor}, ${device.info.renderer} for canvas: ${device.canvasContex
|
|
|
266
266
|
return getGLParameters(this.gl, parameters);
|
|
267
267
|
}
|
|
268
268
|
withParametersWebGL(parameters, func) {
|
|
269
|
-
withGLParameters(this.gl, parameters, func);
|
|
269
|
+
return withGLParameters(this.gl, parameters, func);
|
|
270
270
|
}
|
|
271
271
|
clearWebGL(options) {
|
|
272
272
|
clear(this, options);
|
|
273
273
|
}
|
|
274
|
+
resetWebGL() {
|
|
275
|
+
log.warn('WebGLDevice.resetWebGL is deprecated, use only for debugging')();
|
|
276
|
+
resetGLParameters(this.gl);
|
|
277
|
+
}
|
|
274
278
|
//
|
|
275
279
|
// WebGL-only API (not part of `Device` API)
|
|
276
280
|
//
|
package/dist/dist.dev.js
CHANGED
|
@@ -3963,10 +3963,10 @@ ${source2}`;
|
|
|
3963
3963
|
}
|
|
3964
3964
|
if (!this.device.features.has("compilation-status-async-webgl")) {
|
|
3965
3965
|
this._getCompilationStatus();
|
|
3966
|
+
this.debugShader();
|
|
3966
3967
|
if (this.compilationStatus === "error") {
|
|
3967
3968
|
throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);
|
|
3968
3969
|
}
|
|
3969
|
-
this.debugShader();
|
|
3970
3970
|
return;
|
|
3971
3971
|
}
|
|
3972
3972
|
import_core14.log.once(1, "Shader compilation is asynchronous")();
|
|
@@ -4008,6 +4008,7 @@ ${source2}`;
|
|
|
4008
4008
|
var GL_STENCIL_BUFFER_BIT = 1024;
|
|
4009
4009
|
var GL_COLOR_BUFFER_BIT = 16384;
|
|
4010
4010
|
var GL_COLOR = 6144;
|
|
4011
|
+
var COLOR_CHANNELS = [1, 2, 4, 8];
|
|
4011
4012
|
var WEBGLRenderPass = class extends import_core15.RenderPass {
|
|
4012
4013
|
device;
|
|
4013
4014
|
/** Parameters that should be applied before each draw call */
|
|
@@ -4055,8 +4056,8 @@ ${source2}`;
|
|
|
4055
4056
|
glParameters.viewport = parameters.viewport;
|
|
4056
4057
|
}
|
|
4057
4058
|
}
|
|
4058
|
-
glParameters.scissorTest = Boolean(parameters.scissorRect);
|
|
4059
4059
|
if (parameters.scissorRect) {
|
|
4060
|
+
glParameters.scissorTest = true;
|
|
4060
4061
|
glParameters.scissor = parameters.scissorRect;
|
|
4061
4062
|
}
|
|
4062
4063
|
if (parameters.blendConstant) {
|
|
@@ -4066,6 +4067,11 @@ ${source2}`;
|
|
|
4066
4067
|
console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL");
|
|
4067
4068
|
parameters[2967 /* STENCIL_REF */] = parameters.stencilReference;
|
|
4068
4069
|
}
|
|
4070
|
+
if (parameters.colorMask) {
|
|
4071
|
+
glParameters.colorMask = COLOR_CHANNELS.map(
|
|
4072
|
+
(channel) => Boolean(channel & parameters.colorMask)
|
|
4073
|
+
);
|
|
4074
|
+
}
|
|
4069
4075
|
this.glParameters = glParameters;
|
|
4070
4076
|
setGLParameters(this.device.gl, glParameters);
|
|
4071
4077
|
}
|
|
@@ -4844,6 +4850,8 @@ ${source2}`;
|
|
|
4844
4850
|
draw(options) {
|
|
4845
4851
|
const {
|
|
4846
4852
|
renderPass,
|
|
4853
|
+
parameters = this.props.parameters,
|
|
4854
|
+
topology = this.props.topology,
|
|
4847
4855
|
vertexArray,
|
|
4848
4856
|
vertexCount,
|
|
4849
4857
|
// indexCount,
|
|
@@ -4854,7 +4862,7 @@ ${source2}`;
|
|
|
4854
4862
|
// baseVertex,
|
|
4855
4863
|
transformFeedback
|
|
4856
4864
|
} = options;
|
|
4857
|
-
const glDrawMode = getGLDrawMode(
|
|
4865
|
+
const glDrawMode = getGLDrawMode(topology);
|
|
4858
4866
|
const isIndexed = Boolean(vertexArray.indexBuffer);
|
|
4859
4867
|
const glIndexType = vertexArray.indexBuffer?.glIndexType;
|
|
4860
4868
|
const isInstanced = Number(instanceCount) > 0;
|
|
@@ -4878,37 +4886,32 @@ ${source2}`;
|
|
|
4878
4886
|
this._applyBindings();
|
|
4879
4887
|
this._applyUniforms();
|
|
4880
4888
|
const webglRenderPass = renderPass;
|
|
4881
|
-
withDeviceAndGLParameters(
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
instanceCount || 0
|
|
4903
|
-
);
|
|
4904
|
-
} else {
|
|
4905
|
-
this.device.gl.drawArrays(glDrawMode, firstVertex, vertexCount || 0);
|
|
4906
|
-
}
|
|
4907
|
-
if (transformFeedback) {
|
|
4908
|
-
transformFeedback.end();
|
|
4909
|
-
}
|
|
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);
|
|
4910
4910
|
}
|
|
4911
|
-
|
|
4911
|
+
if (transformFeedback) {
|
|
4912
|
+
transformFeedback.end();
|
|
4913
|
+
}
|
|
4914
|
+
});
|
|
4912
4915
|
vertexArray.unbindAfterRender(renderPass);
|
|
4913
4916
|
return true;
|
|
4914
4917
|
}
|
|
@@ -6225,11 +6228,15 @@ ${source2}`;
|
|
|
6225
6228
|
return getGLParameters(this.gl, parameters);
|
|
6226
6229
|
}
|
|
6227
6230
|
withParametersWebGL(parameters, func) {
|
|
6228
|
-
withGLParameters(this.gl, parameters, func);
|
|
6231
|
+
return withGLParameters(this.gl, parameters, func);
|
|
6229
6232
|
}
|
|
6230
6233
|
clearWebGL(options) {
|
|
6231
6234
|
clear(this, options);
|
|
6232
6235
|
}
|
|
6236
|
+
resetWebGL() {
|
|
6237
|
+
import_core27.log.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")();
|
|
6238
|
+
resetGLParameters(this.gl);
|
|
6239
|
+
}
|
|
6233
6240
|
//
|
|
6234
6241
|
// WebGL-only API (not part of `Device` API)
|
|
6235
6242
|
//
|