@luma.gl/webgl 9.1.0-beta.1 → 9.1.0-beta.11
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/webgl-texture-table.js +1 -1
- package/dist/adapter/converters/webgl-texture-table.js.map +1 -1
- package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-buffer.js +1 -3
- package/dist/adapter/resources/webgl-buffer.js.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +2 -2
- package/dist/adapter/resources/webgl-framebuffer.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.js +2 -4
- package/dist/adapter/resources/webgl-render-pass.js.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.d.ts +0 -1
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +4 -11
- package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -1
- package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-shader.js +1 -5
- package/dist/adapter/resources/webgl-shader.js.map +1 -1
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +1 -6
- package/dist/adapter/resources/webgl-texture.js.map +1 -1
- package/dist/adapter/webgl-canvas-context.d.ts +6 -3
- package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgl-canvas-context.js +17 -9
- package/dist/adapter/webgl-canvas-context.js.map +1 -1
- package/dist/adapter/webgl-device.d.ts +6 -10
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +12 -15
- package/dist/adapter/webgl-device.js.map +1 -1
- package/dist/dist.dev.js +34 -44
- package/dist/dist.min.js +2 -2
- package/dist/index.cjs +34 -44
- package/dist/index.cjs.map +2 -2
- package/package.json +4 -4
- package/src/adapter/converters/webgl-texture-table.ts +2 -2
- package/src/adapter/resources/webgl-buffer.ts +1 -3
- package/src/adapter/resources/webgl-framebuffer.ts +2 -2
- package/src/adapter/resources/webgl-render-pass.ts +2 -5
- package/src/adapter/resources/webgl-render-pipeline.ts +5 -12
- package/src/adapter/resources/webgl-shader.ts +1 -7
- package/src/adapter/resources/webgl-texture.ts +1 -6
- package/src/adapter/webgl-canvas-context.ts +19 -12
- package/src/adapter/webgl-device.ts +16 -25
package/dist/index.cjs
CHANGED
|
@@ -963,7 +963,7 @@ var WEBGL_TEXTURE_FORMATS = {
|
|
|
963
963
|
// , filter: true},
|
|
964
964
|
"rg11b10ufloat": { gl: 35898, rb: true },
|
|
965
965
|
"rgb10a2unorm": { gl: 32857, rb: true },
|
|
966
|
-
"rgb10a2uint": { gl: 36975, rb: true },
|
|
966
|
+
"rgb10a2uint-webgl": { gl: 36975, rb: true },
|
|
967
967
|
// 48-bit formats
|
|
968
968
|
"rgb16unorm-webgl": { gl: 32852 },
|
|
969
969
|
// rgb not renderable
|
|
@@ -1345,7 +1345,7 @@ var WEBGLFramebuffer = class extends import_core4.Framebuffer {
|
|
|
1345
1345
|
this.gl = device.gl;
|
|
1346
1346
|
this.handle = this.props.handle || isDefaultFramebuffer ? this.props.handle : this.gl.createFramebuffer();
|
|
1347
1347
|
if (!isDefaultFramebuffer) {
|
|
1348
|
-
device.
|
|
1348
|
+
device.setSpectorMetadata(this.handle, { id: this.props.id, props: this.props });
|
|
1349
1349
|
this.autoCreateAttachmentTextures();
|
|
1350
1350
|
this.updateAttachments();
|
|
1351
1351
|
}
|
|
@@ -1445,7 +1445,9 @@ function _getFrameBufferStatus(status) {
|
|
|
1445
1445
|
// dist/adapter/webgl-canvas-context.js
|
|
1446
1446
|
var WebGLCanvasContext = class extends import_core5.CanvasContext {
|
|
1447
1447
|
device;
|
|
1448
|
-
|
|
1448
|
+
format = "rgba8unorm";
|
|
1449
|
+
depthStencilFormat = "depth24plus";
|
|
1450
|
+
presentationSize;
|
|
1449
1451
|
_framebuffer = null;
|
|
1450
1452
|
get [Symbol.toStringTag]() {
|
|
1451
1453
|
return "WebGLCanvasContext";
|
|
@@ -1453,14 +1455,23 @@ var WebGLCanvasContext = class extends import_core5.CanvasContext {
|
|
|
1453
1455
|
constructor(device, props) {
|
|
1454
1456
|
super(props);
|
|
1455
1457
|
this.device = device;
|
|
1458
|
+
this.presentationSize = [-1, -1];
|
|
1456
1459
|
this._setAutoCreatedCanvasId(`${this.device.id}-canvas`);
|
|
1457
|
-
this.
|
|
1460
|
+
this.update();
|
|
1458
1461
|
}
|
|
1459
1462
|
getCurrentFramebuffer() {
|
|
1463
|
+
this.update();
|
|
1460
1464
|
this._framebuffer = this._framebuffer || new WEBGLFramebuffer(this.device, { handle: null });
|
|
1461
1465
|
return this._framebuffer;
|
|
1462
1466
|
}
|
|
1463
|
-
|
|
1467
|
+
/** Resizes and updates render targets if necessary */
|
|
1468
|
+
update() {
|
|
1469
|
+
const size = this.getPixelSize();
|
|
1470
|
+
const sizeChanged = size[0] !== this.presentationSize[0] || size[1] !== this.presentationSize[1];
|
|
1471
|
+
if (sizeChanged) {
|
|
1472
|
+
this.presentationSize = size;
|
|
1473
|
+
this.resize();
|
|
1474
|
+
}
|
|
1464
1475
|
}
|
|
1465
1476
|
/**
|
|
1466
1477
|
* Resize the canvas' drawing buffer.
|
|
@@ -1477,12 +1488,9 @@ var WebGLCanvasContext = class extends import_core5.CanvasContext {
|
|
|
1477
1488
|
resize(options) {
|
|
1478
1489
|
if (!this.device.gl)
|
|
1479
1490
|
return;
|
|
1480
|
-
if (this.props.autoResize) {
|
|
1481
|
-
return;
|
|
1482
|
-
}
|
|
1483
1491
|
if (this.canvas) {
|
|
1484
1492
|
const devicePixelRatio = this.getDevicePixelRatio(options == null ? void 0 : options.useDevicePixels);
|
|
1485
|
-
this.
|
|
1493
|
+
this.setDevicePixelRatio(devicePixelRatio, options);
|
|
1486
1494
|
return;
|
|
1487
1495
|
}
|
|
1488
1496
|
}
|
|
@@ -1684,9 +1692,7 @@ var WEBGLBuffer = class extends import_core8.Buffer {
|
|
|
1684
1692
|
this.gl = this.device.gl;
|
|
1685
1693
|
const handle = typeof props === "object" ? props.handle : void 0;
|
|
1686
1694
|
this.handle = handle || this.gl.createBuffer();
|
|
1687
|
-
device.
|
|
1688
|
-
spector: { ...this.props, data: typeof this.props.data }
|
|
1689
|
-
});
|
|
1695
|
+
device.setSpectorMetadata(this.handle, { ...this.props, data: typeof this.props.data });
|
|
1690
1696
|
this.glTarget = getWebGLTarget(this.props.usage);
|
|
1691
1697
|
this.glUsage = getWebGLUsage(this.props.usage);
|
|
1692
1698
|
this.glIndexType = this.props.indexType === "uint32" ? 5125 : 5123;
|
|
@@ -1853,7 +1859,6 @@ var WEBGLShader = class extends import_core9.Shader {
|
|
|
1853
1859
|
default:
|
|
1854
1860
|
throw new Error(this.props.stage);
|
|
1855
1861
|
}
|
|
1856
|
-
device._setWebGLDebugMetadata(this.handle, this, { spector: this.props });
|
|
1857
1862
|
this._compile(this.source);
|
|
1858
1863
|
}
|
|
1859
1864
|
destroy() {
|
|
@@ -1861,7 +1866,6 @@ var WEBGLShader = class extends import_core9.Shader {
|
|
|
1861
1866
|
this.removeStats();
|
|
1862
1867
|
this.device.gl.deleteShader(this.handle);
|
|
1863
1868
|
this.destroyed = true;
|
|
1864
|
-
this.handle.destroyed = true;
|
|
1865
1869
|
}
|
|
1866
1870
|
}
|
|
1867
1871
|
get asyncCompilationStatus() {
|
|
@@ -2667,12 +2671,7 @@ var WEBGLTexture = class extends import_core14.Texture {
|
|
|
2667
2671
|
// eslint-disable-next-line max-statements
|
|
2668
2672
|
_initialize(propsWithData) {
|
|
2669
2673
|
this.handle = this.props.handle || this.gl.createTexture();
|
|
2670
|
-
this.device.
|
|
2671
|
-
spector: {
|
|
2672
|
-
...this.props,
|
|
2673
|
-
data: propsWithData.data
|
|
2674
|
-
}
|
|
2675
|
-
});
|
|
2674
|
+
this.device.setSpectorMetadata(this.handle, { ...this.props, data: propsWithData.data });
|
|
2676
2675
|
let { width, height } = propsWithData;
|
|
2677
2676
|
if (!width || !height) {
|
|
2678
2677
|
const textureSize = import_core14.Texture.getTextureDataSize(propsWithData.data);
|
|
@@ -2998,14 +2997,13 @@ var WEBGLRenderPass = class extends import_core15.RenderPass {
|
|
|
2998
2997
|
const { width, height } = props.framebuffer;
|
|
2999
2998
|
viewport = [0, 0, width, height];
|
|
3000
2999
|
} else {
|
|
3001
|
-
const [width, height] = device.
|
|
3000
|
+
const [width, height] = device.getCanvasContext().getDrawingBufferSize();
|
|
3002
3001
|
viewport = [0, 0, width, height];
|
|
3003
3002
|
}
|
|
3004
3003
|
}
|
|
3005
3004
|
this.device.pushState();
|
|
3006
3005
|
this.setParameters({ viewport, ...this.props.parameters });
|
|
3007
|
-
|
|
3008
|
-
if (webglFramebuffer == null ? void 0 : webglFramebuffer.handle) {
|
|
3006
|
+
if (this.props.framebuffer) {
|
|
3009
3007
|
const drawBuffers = this.props.framebuffer.colorAttachments.map((_, i) => 36064 + i);
|
|
3010
3008
|
this.device.gl.drawBuffers(drawBuffers);
|
|
3011
3009
|
} else {
|
|
@@ -3590,14 +3588,11 @@ var WEBGLRenderPipeline = class extends import_core16.RenderPipeline {
|
|
|
3590
3588
|
_uniformCount = 0;
|
|
3591
3589
|
_uniformSetters = {};
|
|
3592
3590
|
// TODO are these used?
|
|
3593
|
-
get [Symbol.toStringTag]() {
|
|
3594
|
-
return "WEBGLRenderPipeline";
|
|
3595
|
-
}
|
|
3596
3591
|
constructor(device, props) {
|
|
3597
3592
|
super(device, props);
|
|
3598
3593
|
this.device = device;
|
|
3599
3594
|
this.handle = this.props.handle || this.device.gl.createProgram();
|
|
3600
|
-
this.device.
|
|
3595
|
+
this.device.setSpectorMetadata(this.handle, { id: this.props.id });
|
|
3601
3596
|
this.vs = props.vs;
|
|
3602
3597
|
this.fs = props.fs;
|
|
3603
3598
|
const { varyings, bufferMode = 35981 } = props;
|
|
@@ -3606,18 +3601,15 @@ var WEBGLRenderPipeline = class extends import_core16.RenderPipeline {
|
|
|
3606
3601
|
this.device.gl.transformFeedbackVaryings(this.handle, varyings, bufferMode);
|
|
3607
3602
|
}
|
|
3608
3603
|
this._linkShaders();
|
|
3609
|
-
import_core16.log.time(
|
|
3604
|
+
import_core16.log.time(1, `RenderPipeline ${this.id} - shaderLayout introspection`)();
|
|
3610
3605
|
this.introspectedLayout = getShaderLayoutFromGLSL(this.device.gl, this.handle);
|
|
3611
|
-
import_core16.log.timeEnd(
|
|
3606
|
+
import_core16.log.timeEnd(1, `RenderPipeline ${this.id} - shaderLayout introspection`)();
|
|
3612
3607
|
this.shaderLayout = mergeShaderLayout(this.introspectedLayout, props.shaderLayout);
|
|
3613
3608
|
}
|
|
3614
3609
|
destroy() {
|
|
3615
3610
|
if (this.handle) {
|
|
3616
|
-
this.device.gl.useProgram(null);
|
|
3617
3611
|
this.device.gl.deleteProgram(this.handle);
|
|
3618
3612
|
this.destroyed = true;
|
|
3619
|
-
this.handle.destroyed = true;
|
|
3620
|
-
this.handle = null;
|
|
3621
3613
|
}
|
|
3622
3614
|
}
|
|
3623
3615
|
/**
|
|
@@ -4657,7 +4649,9 @@ var WEBGLQuerySet = class extends import_core21.QuerySet {
|
|
|
4657
4649
|
|
|
4658
4650
|
// dist/adapter/webgl-device.js
|
|
4659
4651
|
var WebGLDevice = class extends import_core22.Device {
|
|
4652
|
+
//
|
|
4660
4653
|
// Public `Device` API
|
|
4654
|
+
//
|
|
4661
4655
|
/** type of this device */
|
|
4662
4656
|
type = "webgl";
|
|
4663
4657
|
/** The underlying WebGL context */
|
|
@@ -4666,8 +4660,6 @@ var WebGLDevice = class extends import_core22.Device {
|
|
|
4666
4660
|
limits;
|
|
4667
4661
|
info;
|
|
4668
4662
|
canvasContext;
|
|
4669
|
-
preferredColorFormat = "rgba8unorm";
|
|
4670
|
-
preferredDepthFormat = "depth24plus";
|
|
4671
4663
|
lost;
|
|
4672
4664
|
_resolveContextLost;
|
|
4673
4665
|
/** WebGL2 context. */
|
|
@@ -4734,6 +4726,7 @@ var WebGLDevice = class extends import_core22.Device {
|
|
|
4734
4726
|
if (this.props._initializeFeatures) {
|
|
4735
4727
|
this.features.initializeFeatures();
|
|
4736
4728
|
}
|
|
4729
|
+
this.canvasContext.resize();
|
|
4737
4730
|
const glState = new WebGLStateTracker(this.gl, {
|
|
4738
4731
|
log: (...args) => import_core22.log.log(1, ...args)()
|
|
4739
4732
|
});
|
|
@@ -4874,6 +4867,13 @@ var WebGLDevice = class extends import_core22.Device {
|
|
|
4874
4867
|
const webglState = WebGLStateTracker.get(this.gl);
|
|
4875
4868
|
webglState.pop();
|
|
4876
4869
|
}
|
|
4870
|
+
/**
|
|
4871
|
+
* Storing data on a special field on WebGLObjects makes that data visible in SPECTOR chrome debug extension
|
|
4872
|
+
* luma.gl ids and props can be inspected
|
|
4873
|
+
*/
|
|
4874
|
+
setSpectorMetadata(handle, props) {
|
|
4875
|
+
handle.__SPECTOR_Metadata = props;
|
|
4876
|
+
}
|
|
4877
4877
|
/**
|
|
4878
4878
|
* Returns the GL.<KEY> constant that corresponds to a numeric value of a GL constant
|
|
4879
4879
|
* Be aware that there are some duplicates especially for constants that are 0,
|
|
@@ -4933,16 +4933,6 @@ var WebGLDevice = class extends import_core22.Device {
|
|
|
4933
4933
|
getWebGLExtension(this.gl, name, this._extensions);
|
|
4934
4934
|
return this._extensions;
|
|
4935
4935
|
}
|
|
4936
|
-
// INTERNAL SUPPORT METHODS FOR WEBGL RESOURCES
|
|
4937
|
-
/**
|
|
4938
|
-
* Storing data on a special field on WebGLObjects makes that data visible in SPECTOR chrome debug extension
|
|
4939
|
-
* luma.gl ids and props can be inspected
|
|
4940
|
-
*/
|
|
4941
|
-
_setWebGLDebugMetadata(handle, resource, options) {
|
|
4942
|
-
handle.luma = resource;
|
|
4943
|
-
const spectorMetadata = { props: options.spector, id: options.spector.id };
|
|
4944
|
-
handle.__SPECTOR_Metadata = spectorMetadata;
|
|
4945
|
-
}
|
|
4946
4936
|
};
|
|
4947
4937
|
function setConstantFloatArray(device, location, array) {
|
|
4948
4938
|
switch (array.length) {
|