@luma.gl/webgl 9.0.5 → 9.0.7
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/device-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/device-parameters.js +19 -17
- 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 +4 -4
- package/dist/adapter/resources/webgl-shader.js +2 -2
- package/dist/dist.dev.js +55 -50
- package/dist/dist.min.js +2 -2
- package/dist/index.cjs +29 -21
- package/dist/index.cjs.map +2 -2
- package/package.json +3 -3
- package/src/adapter/converters/device-parameters.ts +20 -19
- package/src/adapter/resources/webgl-render-pass.ts +7 -0
- package/src/adapter/resources/webgl-render-pipeline.ts +34 -36
- package/src/adapter/resources/webgl-shader.ts +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1604,10 +1604,10 @@ function setDeviceParameters(device, parameters) {
|
|
|
1604
1604
|
if (parameters.depthBias !== void 0) {
|
|
1605
1605
|
gl.polygonOffset(parameters.depthBias, parameters.depthBiasSlopeScale || 0);
|
|
1606
1606
|
}
|
|
1607
|
-
if (
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1607
|
+
if (parameters.provokingVertex) {
|
|
1608
|
+
if (device.features.has("provoking-vertex-webgl")) {
|
|
1609
|
+
const extensions = webglDevice.getExtension("WEBGL_provoking_vertex");
|
|
1610
|
+
const ext = extensions.WEBGL_provoking_vertex;
|
|
1611
1611
|
const vertex = map("provokingVertex", parameters.provokingVertex, {
|
|
1612
1612
|
first: 36429,
|
|
1613
1613
|
last: 36430
|
|
@@ -1615,19 +1615,21 @@ function setDeviceParameters(device, parameters) {
|
|
|
1615
1615
|
ext == null ? void 0 : ext.provokingVertexWEBGL(vertex);
|
|
1616
1616
|
}
|
|
1617
1617
|
}
|
|
1618
|
-
if (
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1618
|
+
if (parameters.polygonMode || parameters.polygonOffsetLine) {
|
|
1619
|
+
if (device.features.has("polygon-mode-webgl")) {
|
|
1620
|
+
if (parameters.polygonMode) {
|
|
1621
|
+
const extensions = webglDevice.getExtension("WEBGL_polygon_mode");
|
|
1622
|
+
const ext = extensions.WEBGL_polygon_mode;
|
|
1623
|
+
const mode = map("polygonMode", parameters.polygonMode, {
|
|
1624
|
+
fill: 6914,
|
|
1625
|
+
line: 6913
|
|
1626
|
+
});
|
|
1627
|
+
ext == null ? void 0 : ext.polygonModeWEBGL(1028, mode);
|
|
1628
|
+
ext == null ? void 0 : ext.polygonModeWEBGL(1029, mode);
|
|
1629
|
+
}
|
|
1630
|
+
if (parameters.polygonOffsetLine) {
|
|
1631
|
+
gl.enable(10754);
|
|
1632
|
+
}
|
|
1631
1633
|
}
|
|
1632
1634
|
}
|
|
1633
1635
|
if (device.features.has("shader-clip-cull-distance-webgl")) {
|
|
@@ -3065,10 +3067,10 @@ ${source2}`;
|
|
|
3065
3067
|
}
|
|
3066
3068
|
if (!this.device.features.has("compilation-status-async-webgl")) {
|
|
3067
3069
|
this._getCompilationStatus();
|
|
3070
|
+
this.debugShader();
|
|
3068
3071
|
if (this.compilationStatus === "error") {
|
|
3069
3072
|
throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);
|
|
3070
3073
|
}
|
|
3071
|
-
this.debugShader();
|
|
3072
3074
|
return;
|
|
3073
3075
|
}
|
|
3074
3076
|
import_core14.log.once(1, "Shader compilation is asynchronous")();
|
|
@@ -3111,6 +3113,7 @@ var GL_DEPTH_BUFFER_BIT = 256;
|
|
|
3111
3113
|
var GL_STENCIL_BUFFER_BIT = 1024;
|
|
3112
3114
|
var GL_COLOR_BUFFER_BIT = 16384;
|
|
3113
3115
|
var GL_COLOR = 6144;
|
|
3116
|
+
var COLOR_CHANNELS = [1, 2, 4, 8];
|
|
3114
3117
|
var WEBGLRenderPass = class extends import_core15.RenderPass {
|
|
3115
3118
|
device;
|
|
3116
3119
|
/** Parameters that should be applied before each draw call */
|
|
@@ -3169,6 +3172,9 @@ var WEBGLRenderPass = class extends import_core15.RenderPass {
|
|
|
3169
3172
|
console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL");
|
|
3170
3173
|
parameters[2967] = parameters.stencilReference;
|
|
3171
3174
|
}
|
|
3175
|
+
if (parameters.colorMask) {
|
|
3176
|
+
glParameters.colorMask = COLOR_CHANNELS.map((channel) => Boolean(channel & parameters.colorMask));
|
|
3177
|
+
}
|
|
3172
3178
|
this.glParameters = glParameters;
|
|
3173
3179
|
setGLParameters(this.device.gl, glParameters);
|
|
3174
3180
|
}
|
|
@@ -3899,7 +3905,7 @@ var WEBGLRenderPipeline = class extends import_core17.RenderPipeline {
|
|
|
3899
3905
|
const binding = this.shaderLayout.bindings.find((binding2) => binding2.name === name) || this.shaderLayout.bindings.find((binding2) => binding2.name === `${name}Uniforms`);
|
|
3900
3906
|
if (!binding) {
|
|
3901
3907
|
const validBindings = this.shaderLayout.bindings.map((binding2) => `"${binding2.name}"`).join(", ");
|
|
3902
|
-
if (options == null ? void 0 : options.disableWarnings) {
|
|
3908
|
+
if (!(options == null ? void 0 : options.disableWarnings)) {
|
|
3903
3909
|
import_core17.log.warn(`Unknown binding "${name}" in render pipeline "${this.id}", expected one of ${validBindings}`)();
|
|
3904
3910
|
}
|
|
3905
3911
|
continue;
|
|
@@ -3935,6 +3941,8 @@ var WEBGLRenderPipeline = class extends import_core17.RenderPipeline {
|
|
|
3935
3941
|
var _a;
|
|
3936
3942
|
const {
|
|
3937
3943
|
renderPass,
|
|
3944
|
+
parameters = this.props.parameters,
|
|
3945
|
+
topology = this.props.topology,
|
|
3938
3946
|
vertexArray,
|
|
3939
3947
|
vertexCount,
|
|
3940
3948
|
// indexCount,
|
|
@@ -3945,7 +3953,7 @@ var WEBGLRenderPipeline = class extends import_core17.RenderPipeline {
|
|
|
3945
3953
|
// baseVertex,
|
|
3946
3954
|
transformFeedback
|
|
3947
3955
|
} = options;
|
|
3948
|
-
const glDrawMode = getGLDrawMode(
|
|
3956
|
+
const glDrawMode = getGLDrawMode(topology);
|
|
3949
3957
|
const isIndexed = Boolean(vertexArray.indexBuffer);
|
|
3950
3958
|
const glIndexType = (_a = vertexArray.indexBuffer) == null ? void 0 : _a.glIndexType;
|
|
3951
3959
|
const isInstanced = Number(instanceCount) > 0;
|
|
@@ -3969,7 +3977,7 @@ var WEBGLRenderPipeline = class extends import_core17.RenderPipeline {
|
|
|
3969
3977
|
this._applyBindings();
|
|
3970
3978
|
this._applyUniforms();
|
|
3971
3979
|
const webglRenderPass = renderPass;
|
|
3972
|
-
withDeviceAndGLParameters(this.device,
|
|
3980
|
+
withDeviceAndGLParameters(this.device, parameters, webglRenderPass.glParameters, () => {
|
|
3973
3981
|
if (isIndexed && isInstanced) {
|
|
3974
3982
|
this.device.gl.drawElementsInstanced(
|
|
3975
3983
|
glDrawMode,
|