@luma.gl/webgl 9.0.0-beta.9 → 9.0.3
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/device-helpers/webgl-device-features.d.ts +1 -0
- package/dist/adapter/device-helpers/webgl-device-features.d.ts.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-features.js +10 -10
- package/dist/adapter/resources/webgl-render-pipeline.d.ts +3 -1
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +8 -6
- package/dist/adapter/resources/webgl-vertex-array.d.ts +0 -1
- package/dist/adapter/resources/webgl-vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-vertex-array.js +5 -15
- package/dist/dist.dev.js +36 -50
- package/dist/dist.min.js +2 -2
- package/dist/index.cjs +18 -19
- package/dist/index.cjs.map +2 -2
- package/package.json +4 -4
- package/src/adapter/device-helpers/webgl-device-features.ts +11 -10
- package/src/adapter/resources/webgl-render-pipeline.ts +10 -8
- package/src/adapter/resources/webgl-vertex-array.ts +9 -18
|
@@ -14,6 +14,7 @@ export declare class WebGLDeviceFeatures extends DeviceFeatures {
|
|
|
14
14
|
[Symbol.iterator](): IterableIterator<DeviceFeature>;
|
|
15
15
|
has(feature: DeviceFeature): boolean;
|
|
16
16
|
initializeFeatures(): void;
|
|
17
|
+
getFeatures(): DeviceFeature[];
|
|
17
18
|
/** Extract all WebGL features */
|
|
18
19
|
protected getWebGLFeature(feature: DeviceFeature): boolean;
|
|
19
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-device-features.d.ts","sourceRoot":"","sources":["../../../src/adapter/device-helpers/webgl-device-features.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,aAAa,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AA8BhD;;;;;GAKG;AACH,qBAAa,mBAAoB,SAAQ,cAAc;IACrD,SAAS,CAAC,EAAE,EAAE,sBAAsB,CAAC;IACrC,SAAS,CAAC,UAAU,EAAE,YAAY,CAAC;IACnC,SAAS,CAAC,cAAc,qBAA4B;gBAGlD,EAAE,EAAE,sBAAsB,EAC1B,UAAU,EAAE,YAAY,EACxB,gBAAgB,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAU1D,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"webgl-device-features.d.ts","sourceRoot":"","sources":["../../../src/adapter/device-helpers/webgl-device-features.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,aAAa,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AA8BhD;;;;;GAKG;AACH,qBAAa,mBAAoB,SAAQ,cAAc;IACrD,SAAS,CAAC,EAAE,EAAE,sBAAsB,CAAC;IACrC,SAAS,CAAC,UAAU,EAAE,YAAY,CAAC;IACnC,SAAS,CAAC,cAAc,qBAA4B;gBAGlD,EAAE,EAAE,sBAAsB,EAC1B,UAAU,EAAE,YAAY,EACxB,gBAAgB,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAU1D,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,aAAa,CAAC;IAU5C,GAAG,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO;IAuB7C,kBAAkB;IAWlB,WAAW;IAIX,iCAAiC;IACjC,SAAS,CAAC,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO;CAU3D"}
|
|
@@ -48,12 +48,8 @@ export class WebGLDeviceFeatures extends DeviceFeatures {
|
|
|
48
48
|
getWebGLExtension(gl, 'EXT_color_buffer_float', extensions);
|
|
49
49
|
}
|
|
50
50
|
*[Symbol.iterator]() {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
yield feature;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
for (const feature of Object.keys(TEXTURE_FEATURES)) {
|
|
51
|
+
const features = this.getFeatures();
|
|
52
|
+
for (const feature of features) {
|
|
57
53
|
if (this.has(feature)) {
|
|
58
54
|
yield feature;
|
|
59
55
|
}
|
|
@@ -79,13 +75,17 @@ export class WebGLDeviceFeatures extends DeviceFeatures {
|
|
|
79
75
|
}
|
|
80
76
|
// FOR DEVICE
|
|
81
77
|
initializeFeatures() {
|
|
82
|
-
//
|
|
83
|
-
//
|
|
84
|
-
|
|
85
|
-
|
|
78
|
+
// Initialize all features by checking them.
|
|
79
|
+
// Except WEBGL_polygon_mode since Chrome logs ugly console warnings
|
|
80
|
+
const features = this.getFeatures().filter(feature => feature !== 'polygon-mode-webgl');
|
|
81
|
+
for (const feature of features) {
|
|
82
|
+
this.has(feature);
|
|
86
83
|
}
|
|
87
84
|
}
|
|
88
85
|
// IMPLEMENTATION
|
|
86
|
+
getFeatures() {
|
|
87
|
+
return [...Object.keys(WEBGL_FEATURES), ...Object.keys(TEXTURE_FEATURES)];
|
|
88
|
+
}
|
|
89
89
|
/** Extract all WebGL features */
|
|
90
90
|
getWebGLFeature(feature) {
|
|
91
91
|
const featureInfo = WEBGL_FEATURES[feature];
|
|
@@ -31,7 +31,9 @@ export declare class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
31
31
|
* Bindings include: textures, samplers and uniform buffers
|
|
32
32
|
* @todo needed for portable model
|
|
33
33
|
*/
|
|
34
|
-
setBindings(bindings: Record<string, Binding
|
|
34
|
+
setBindings(bindings: Record<string, Binding>, options?: {
|
|
35
|
+
disableWarnings?: boolean;
|
|
36
|
+
}): void;
|
|
35
37
|
/** @todo needed for portable model
|
|
36
38
|
* @note The WebGL API is offers many ways to draw things
|
|
37
39
|
* This function unifies those ways into a single call using common parameters with sane defaults
|
|
@@ -1 +1 @@
|
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AC,EAAE,OAAO,CAAC,EAAE;QAAC,eAAe,CAAC,EAAE,OAAO,CAAA;KAAC,GAAG,IAAI;IAyD3F;;;OAGG;IACH,IAAI,CAAC,OAAO,EAAE;QACZ,UAAU,EAAE,UAAU,CAAC;QACvB,wBAAwB;QACxB,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;IAgGF,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"}
|
|
@@ -52,9 +52,9 @@ export class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
52
52
|
this.device.gl.transformFeedbackVaryings(this.handle, varyings, bufferMode);
|
|
53
53
|
}
|
|
54
54
|
this._linkShaders();
|
|
55
|
-
log.time(
|
|
55
|
+
log.time(1, `RenderPipeline ${this.id} - shaderLayout introspection`)();
|
|
56
56
|
this.introspectedLayout = getShaderLayout(this.device.gl, this.handle);
|
|
57
|
-
log.timeEnd(
|
|
57
|
+
log.timeEnd(1, `RenderPipeline ${this.id} - shaderLayout introspection`)();
|
|
58
58
|
// Merge provided layout with introspected layout
|
|
59
59
|
this.shaderLayout = mergeShaderLayout(this.introspectedLayout, props.shaderLayout);
|
|
60
60
|
// WebGPU has more restrictive topology support than WebGL
|
|
@@ -77,7 +77,7 @@ export class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
77
77
|
* Bindings include: textures, samplers and uniform buffers
|
|
78
78
|
* @todo needed for portable model
|
|
79
79
|
*/
|
|
80
|
-
setBindings(bindings) {
|
|
80
|
+
setBindings(bindings, options) {
|
|
81
81
|
// if (log.priority >= 2) {
|
|
82
82
|
// checkUniformValues(uniforms, this.id, this._uniformSetters);
|
|
83
83
|
// }
|
|
@@ -92,7 +92,9 @@ export class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
92
92
|
const validBindings = this.shaderLayout.bindings
|
|
93
93
|
.map(binding => `"${binding.name}"`)
|
|
94
94
|
.join(', ');
|
|
95
|
-
|
|
95
|
+
if (options?.disableWarnings) {
|
|
96
|
+
log.warn(`Unknown binding "${name}" in render pipeline "${this.id}", expected one of ${validBindings}`)();
|
|
97
|
+
}
|
|
96
98
|
continue; // eslint-disable-line no-continue
|
|
97
99
|
}
|
|
98
100
|
if (!value) {
|
|
@@ -349,9 +351,9 @@ export class WEBGLRenderPipeline extends RenderPipeline {
|
|
|
349
351
|
texture = value;
|
|
350
352
|
}
|
|
351
353
|
else if (value instanceof WEBGLFramebuffer &&
|
|
352
|
-
value.colorAttachments[0] instanceof
|
|
354
|
+
value.colorAttachments[0] instanceof WEBGLTextureView) {
|
|
353
355
|
log.warn('Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead')();
|
|
354
|
-
texture = value.colorAttachments[0];
|
|
356
|
+
texture = value.colorAttachments[0].texture;
|
|
355
357
|
}
|
|
356
358
|
else {
|
|
357
359
|
throw new Error('No texture');
|
|
@@ -25,7 +25,6 @@ export declare class WEBGLVertexArray extends VertexArray {
|
|
|
25
25
|
setBuffer(location: number, attributeBuffer: Buffer): void;
|
|
26
26
|
/** Set a location in vertex attributes array to a constant value, disables the location */
|
|
27
27
|
setConstantWebGL(location: number, value: TypedArray): void;
|
|
28
|
-
init: boolean;
|
|
29
28
|
bindBeforeRender(): void;
|
|
30
29
|
unbindAfterRender(): void;
|
|
31
30
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-vertex-array.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-vertex-array.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAc,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAC,WAAW,EAA6B,MAAM,eAAe,CAAC;AACtE,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AAGtC,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAO5C,gCAAgC;AAChC,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;IAED,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAC;IAExC,kCAAkC;IAClC,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,WAAW,CAAQ;IAE3B,6EAA6E;IAC7E,MAAM,CAAC,gCAAgC,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;gBAKpD,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE,gBAAgB;IAMhD,OAAO,IAAI,IAAI;IAexB;;;;;OAKG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAgBhD,gGAAgG;IAChG,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"webgl-vertex-array.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-vert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MAAM,UAAO,GAAG,IAAI;IAiBxD;;;;;OAKG;IACH,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM;CA8BnE"}
|
|
@@ -54,11 +54,10 @@ export class WEBGLVertexArray extends VertexArray {
|
|
|
54
54
|
}
|
|
55
55
|
// In WebGL The GL.ELEMENT_ARRAY_BUFFER_BINDING is stored on the VertexArrayObject
|
|
56
56
|
this.device.gl.bindVertexArray(this.handle);
|
|
57
|
-
// TODO - this initial binding does not seem to take effect? see bindBeforeRender()
|
|
58
57
|
this.device.gl.bindBuffer(34963, buffer ? buffer.handle : null);
|
|
59
|
-
// log.log(1, 'VertexArray.setIndexBuffer', indexBuffer)();
|
|
60
|
-
// log.log(1, `Binding vertex array ${this.id}`, buffer?.id)();
|
|
61
58
|
this.indexBuffer = buffer;
|
|
59
|
+
// Unbind to prevent unintended changes to the VAO.
|
|
60
|
+
this.device.gl.bindVertexArray(null);
|
|
62
61
|
}
|
|
63
62
|
/** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */
|
|
64
63
|
setBuffer(location, attributeBuffer) {
|
|
@@ -84,30 +83,21 @@ export class WEBGLVertexArray extends VertexArray {
|
|
|
84
83
|
// Set the step mode 0=vertex, 1=instance
|
|
85
84
|
this.device.gl.vertexAttribDivisor(location, divisor || 0);
|
|
86
85
|
this.attributes[location] = buffer;
|
|
86
|
+
// Unbind to prevent unintended changes to the VAO.
|
|
87
|
+
this.device.gl.bindVertexArray(null);
|
|
87
88
|
}
|
|
88
89
|
/** Set a location in vertex attributes array to a constant value, disables the location */
|
|
89
90
|
setConstantWebGL(location, value) {
|
|
90
91
|
this._enable(location, false);
|
|
91
92
|
this.attributes[location] = value;
|
|
92
93
|
}
|
|
93
|
-
init = false;
|
|
94
94
|
bindBeforeRender() {
|
|
95
95
|
this.device.gl.bindVertexArray(this.handle);
|
|
96
|
-
// TODO - the initial bind does not seem to take effect.
|
|
97
|
-
if (!this.init) {
|
|
98
|
-
// log.log(1, `Binding vertex array ${this.id}`, this.indexBuffer?.id)();
|
|
99
|
-
const webglBuffer = this.indexBuffer;
|
|
100
|
-
this.device.gl.bindBuffer(34963, webglBuffer?.handle || null);
|
|
101
|
-
this.init = true;
|
|
102
|
-
}
|
|
103
96
|
this._applyConstantAttributes();
|
|
104
97
|
}
|
|
105
98
|
unbindAfterRender() {
|
|
106
|
-
//
|
|
107
|
-
// TODO technically this is not necessary, but we might be interfacing
|
|
108
|
-
// with code that does not use vertex array objects
|
|
99
|
+
// Unbind to prevent unintended changes to the VAO.
|
|
109
100
|
this.device.gl.bindVertexArray(null);
|
|
110
|
-
// this.device.gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, null);
|
|
111
101
|
}
|
|
112
102
|
// Internal methods
|
|
113
103
|
/**
|
package/dist/dist.dev.js
CHANGED
|
@@ -2060,12 +2060,8 @@ var __exports__ = (() => {
|
|
|
2060
2060
|
getWebGLExtension(gl, "EXT_color_buffer_float", extensions);
|
|
2061
2061
|
}
|
|
2062
2062
|
*[Symbol.iterator]() {
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
yield feature;
|
|
2066
|
-
}
|
|
2067
|
-
}
|
|
2068
|
-
for (const feature of Object.keys(TEXTURE_FEATURES)) {
|
|
2063
|
+
const features = this.getFeatures();
|
|
2064
|
+
for (const feature of features) {
|
|
2069
2065
|
if (this.has(feature)) {
|
|
2070
2066
|
yield feature;
|
|
2071
2067
|
}
|
|
@@ -2089,10 +2085,15 @@ var __exports__ = (() => {
|
|
|
2089
2085
|
}
|
|
2090
2086
|
// FOR DEVICE
|
|
2091
2087
|
initializeFeatures() {
|
|
2092
|
-
|
|
2088
|
+
const features = this.getFeatures().filter((feature) => feature !== "polygon-mode-webgl");
|
|
2089
|
+
for (const feature of features) {
|
|
2090
|
+
this.has(feature);
|
|
2093
2091
|
}
|
|
2094
2092
|
}
|
|
2095
2093
|
// IMPLEMENTATION
|
|
2094
|
+
getFeatures() {
|
|
2095
|
+
return [...Object.keys(WEBGL_FEATURES), ...Object.keys(TEXTURE_FEATURES)];
|
|
2096
|
+
}
|
|
2096
2097
|
/** Extract all WebGL features */
|
|
2097
2098
|
getWebGLFeature(feature) {
|
|
2098
2099
|
const featureInfo = WEBGL_FEATURES[feature];
|
|
@@ -3699,43 +3700,35 @@ var __exports__ = (() => {
|
|
|
3699
3700
|
// src/context/debug/webgl-developer-tools.ts
|
|
3700
3701
|
var import_core13 = __toESM(require_core(), 1);
|
|
3701
3702
|
|
|
3703
|
+
// ../../node_modules/@probe.gl/env/dist/lib/globals.js
|
|
3704
|
+
var document_ = globalThis.document || {};
|
|
3705
|
+
var process_ = globalThis.process || {};
|
|
3706
|
+
var console_ = globalThis.console;
|
|
3707
|
+
var navigator_ = globalThis.navigator || {};
|
|
3708
|
+
|
|
3702
3709
|
// ../../node_modules/@probe.gl/env/dist/lib/is-electron.js
|
|
3703
3710
|
function isElectron(mockUserAgent) {
|
|
3704
|
-
if (typeof window !== "undefined" &&
|
|
3705
|
-
window.process.type === "renderer") {
|
|
3711
|
+
if (typeof window !== "undefined" && window.process?.type === "renderer") {
|
|
3706
3712
|
return true;
|
|
3707
3713
|
}
|
|
3708
|
-
if (typeof process !== "undefined" &&
|
|
3709
|
-
Boolean(process.versions["electron"])) {
|
|
3714
|
+
if (typeof process !== "undefined" && Boolean(process.versions?.["electron"])) {
|
|
3710
3715
|
return true;
|
|
3711
3716
|
}
|
|
3712
|
-
const realUserAgent = typeof navigator
|
|
3717
|
+
const realUserAgent = typeof navigator !== "undefined" && navigator.userAgent;
|
|
3713
3718
|
const userAgent = mockUserAgent || realUserAgent;
|
|
3714
|
-
|
|
3715
|
-
return true;
|
|
3716
|
-
}
|
|
3717
|
-
return false;
|
|
3719
|
+
return Boolean(userAgent && userAgent.indexOf("Electron") >= 0);
|
|
3718
3720
|
}
|
|
3719
3721
|
|
|
3720
3722
|
// ../../node_modules/@probe.gl/env/dist/lib/is-browser.js
|
|
3721
3723
|
function isBrowser() {
|
|
3722
3724
|
const isNode = (
|
|
3723
3725
|
// @ts-expect-error
|
|
3724
|
-
typeof process === "object" && String(process) === "[object process]" && !process
|
|
3726
|
+
typeof process === "object" && String(process) === "[object process]" && !process?.browser
|
|
3725
3727
|
);
|
|
3726
3728
|
return !isNode || isElectron();
|
|
3727
3729
|
}
|
|
3728
3730
|
|
|
3729
|
-
// ../../node_modules/@probe.gl/env/dist/lib/globals.js
|
|
3730
|
-
var self_ = globalThis.self || globalThis.window || globalThis.global;
|
|
3731
|
-
var window_ = globalThis.window || globalThis.self || globalThis.global;
|
|
3732
|
-
var document_ = globalThis.document || {};
|
|
3733
|
-
var process_ = globalThis.process || {};
|
|
3734
|
-
var console_ = globalThis.console;
|
|
3735
|
-
var navigator_ = globalThis.navigator || {};
|
|
3736
|
-
|
|
3737
3731
|
// ../../node_modules/@probe.gl/env/dist/lib/get-browser.js
|
|
3738
|
-
var window2 = globalThis;
|
|
3739
3732
|
function getBrowser(mockUserAgent) {
|
|
3740
3733
|
if (!mockUserAgent && !isBrowser()) {
|
|
3741
3734
|
return "Node";
|
|
@@ -3747,18 +3740,13 @@ var __exports__ = (() => {
|
|
|
3747
3740
|
if (userAgent.indexOf("Edge") > -1) {
|
|
3748
3741
|
return "Edge";
|
|
3749
3742
|
}
|
|
3750
|
-
|
|
3751
|
-
const isTrident = userAgent.indexOf("Trident/") !== -1;
|
|
3752
|
-
if (isMSIE || isTrident) {
|
|
3753
|
-
return "IE";
|
|
3754
|
-
}
|
|
3755
|
-
if (window2.chrome) {
|
|
3743
|
+
if (globalThis.chrome) {
|
|
3756
3744
|
return "Chrome";
|
|
3757
3745
|
}
|
|
3758
|
-
if (
|
|
3746
|
+
if (globalThis.safari) {
|
|
3759
3747
|
return "Safari";
|
|
3760
3748
|
}
|
|
3761
|
-
if (
|
|
3749
|
+
if (globalThis.mozInnerScreenX) {
|
|
3762
3750
|
return "Firefox";
|
|
3763
3751
|
}
|
|
3764
3752
|
return "Unknown";
|
|
@@ -4778,9 +4766,9 @@ ${source2}`;
|
|
|
4778
4766
|
this.device.gl.transformFeedbackVaryings(this.handle, varyings, bufferMode);
|
|
4779
4767
|
}
|
|
4780
4768
|
this._linkShaders();
|
|
4781
|
-
import_core17.log.time(
|
|
4769
|
+
import_core17.log.time(1, `RenderPipeline ${this.id} - shaderLayout introspection`)();
|
|
4782
4770
|
this.introspectedLayout = getShaderLayout(this.device.gl, this.handle);
|
|
4783
|
-
import_core17.log.timeEnd(
|
|
4771
|
+
import_core17.log.timeEnd(1, `RenderPipeline ${this.id} - shaderLayout introspection`)();
|
|
4784
4772
|
this.shaderLayout = (0, import_core18.mergeShaderLayout)(this.introspectedLayout, props.shaderLayout);
|
|
4785
4773
|
switch (this.props.topology) {
|
|
4786
4774
|
case "triangle-fan-webgl":
|
|
@@ -4802,14 +4790,16 @@ ${source2}`;
|
|
|
4802
4790
|
* Bindings include: textures, samplers and uniform buffers
|
|
4803
4791
|
* @todo needed for portable model
|
|
4804
4792
|
*/
|
|
4805
|
-
setBindings(bindings) {
|
|
4793
|
+
setBindings(bindings, options) {
|
|
4806
4794
|
for (const [name, value] of Object.entries(bindings)) {
|
|
4807
4795
|
const binding = this.shaderLayout.bindings.find((binding2) => binding2.name === name) || this.shaderLayout.bindings.find((binding2) => binding2.name === `${name}Uniforms`);
|
|
4808
4796
|
if (!binding) {
|
|
4809
4797
|
const validBindings = this.shaderLayout.bindings.map((binding2) => `"${binding2.name}"`).join(", ");
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4798
|
+
if (options?.disableWarnings) {
|
|
4799
|
+
import_core17.log.warn(
|
|
4800
|
+
`Unknown binding "${name}" in render pipeline "${this.id}", expected one of ${validBindings}`
|
|
4801
|
+
)();
|
|
4802
|
+
}
|
|
4813
4803
|
continue;
|
|
4814
4804
|
}
|
|
4815
4805
|
if (!value) {
|
|
@@ -5062,11 +5052,11 @@ ${source2}`;
|
|
|
5062
5052
|
texture = value.texture;
|
|
5063
5053
|
} else if (value instanceof WEBGLTexture) {
|
|
5064
5054
|
texture = value;
|
|
5065
|
-
} else if (value instanceof WEBGLFramebuffer && value.colorAttachments[0] instanceof
|
|
5055
|
+
} else if (value instanceof WEBGLFramebuffer && value.colorAttachments[0] instanceof WEBGLTextureView) {
|
|
5066
5056
|
import_core17.log.warn(
|
|
5067
5057
|
"Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead"
|
|
5068
5058
|
)();
|
|
5069
|
-
texture = value.colorAttachments[0];
|
|
5059
|
+
texture = value.colorAttachments[0].texture;
|
|
5070
5060
|
} else {
|
|
5071
5061
|
throw new Error("No texture");
|
|
5072
5062
|
}
|
|
@@ -5363,8 +5353,8 @@ ${source2}`;
|
|
|
5363
5353
|
/**
|
|
5364
5354
|
// Set (bind/unbind) an elements buffer, for indexed rendering.
|
|
5365
5355
|
// Must be a Buffer bound to GL.ELEMENT_ARRAY_BUFFER or null. Constants not supported
|
|
5366
|
-
*
|
|
5367
|
-
* @param elementBuffer
|
|
5356
|
+
*
|
|
5357
|
+
* @param elementBuffer
|
|
5368
5358
|
*/
|
|
5369
5359
|
setIndexBuffer(indexBuffer) {
|
|
5370
5360
|
const buffer = indexBuffer;
|
|
@@ -5374,6 +5364,7 @@ ${source2}`;
|
|
|
5374
5364
|
this.device.gl.bindVertexArray(this.handle);
|
|
5375
5365
|
this.device.gl.bindBuffer(34963 /* ELEMENT_ARRAY_BUFFER */, buffer ? buffer.handle : null);
|
|
5376
5366
|
this.indexBuffer = buffer;
|
|
5367
|
+
this.device.gl.bindVertexArray(null);
|
|
5377
5368
|
}
|
|
5378
5369
|
/** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */
|
|
5379
5370
|
setBuffer(location, attributeBuffer) {
|
|
@@ -5392,20 +5383,15 @@ ${source2}`;
|
|
|
5392
5383
|
this.device.gl.enableVertexAttribArray(location);
|
|
5393
5384
|
this.device.gl.vertexAttribDivisor(location, divisor || 0);
|
|
5394
5385
|
this.attributes[location] = buffer;
|
|
5386
|
+
this.device.gl.bindVertexArray(null);
|
|
5395
5387
|
}
|
|
5396
5388
|
/** Set a location in vertex attributes array to a constant value, disables the location */
|
|
5397
5389
|
setConstantWebGL(location, value) {
|
|
5398
5390
|
this._enable(location, false);
|
|
5399
5391
|
this.attributes[location] = value;
|
|
5400
5392
|
}
|
|
5401
|
-
init = false;
|
|
5402
5393
|
bindBeforeRender() {
|
|
5403
5394
|
this.device.gl.bindVertexArray(this.handle);
|
|
5404
|
-
if (!this.init) {
|
|
5405
|
-
const webglBuffer = this.indexBuffer;
|
|
5406
|
-
this.device.gl.bindBuffer(34963 /* ELEMENT_ARRAY_BUFFER */, webglBuffer?.handle || null);
|
|
5407
|
-
this.init = true;
|
|
5408
|
-
}
|
|
5409
5395
|
this._applyConstantAttributes();
|
|
5410
5396
|
}
|
|
5411
5397
|
unbindAfterRender() {
|