@luma.gl/core 9.0.9 → 9.0.10
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/render-pipeline.d.ts +6 -8
- package/dist/adapter/resources/render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/render-pipeline.js +3 -2
- package/dist/dist.dev.js +190 -79
- package/dist/dist.min.js +7 -7
- package/dist/index.cjs +19 -3
- package/dist/index.cjs.map +2 -2
- package/dist/init.js +1 -1
- package/dist/lib/luma.d.ts +1 -0
- package/dist/lib/luma.d.ts.map +1 -1
- package/dist/lib/luma.js +20 -0
- package/package.json +2 -2
- package/src/adapter/resources/render-pipeline.ts +15 -13
- package/src/lib/luma.ts +23 -0
package/dist/init.js
CHANGED
|
@@ -11,7 +11,7 @@ import { lumaStats } from "./utils/stats-manager.js";
|
|
|
11
11
|
function initializeLuma() {
|
|
12
12
|
// Version detection using babel plugin
|
|
13
13
|
// @ts-expect-error
|
|
14
|
-
const VERSION = typeof "9.0.
|
|
14
|
+
const VERSION = typeof "9.0.10" !== 'undefined' ? "9.0.10" : 'running from source';
|
|
15
15
|
const STARTUP_MESSAGE = 'set luma.log.level=1 (or higher) to trace rendering';
|
|
16
16
|
// Assign luma.log.level in console to control logging: \
|
|
17
17
|
// 0: none, 1: minimal, 2: verbose, 3: attribute/uniforms, 4: gl logs
|
package/dist/lib/luma.d.ts
CHANGED
|
@@ -33,5 +33,6 @@ export declare class luma {
|
|
|
33
33
|
static attachDevice(props: AttachDeviceProps): Promise<Device>;
|
|
34
34
|
/** Creates a device. Asynchronously. */
|
|
35
35
|
static createDevice(props?: CreateDeviceProps): Promise<Device>;
|
|
36
|
+
static enforceWebGL2(enforce?: boolean): void;
|
|
36
37
|
}
|
|
37
38
|
//# sourceMappingURL=luma.d.ts.map
|
package/dist/lib/luma.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"luma.d.ts","sourceRoot":"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,GAAE,OAAc,GAAG,IAAI;CAsBpD"}
|
package/dist/lib/luma.js
CHANGED
|
@@ -106,6 +106,26 @@ export class luma {
|
|
|
106
106
|
}
|
|
107
107
|
throw new Error('No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.');
|
|
108
108
|
}
|
|
109
|
+
static enforceWebGL2(enforce = true) {
|
|
110
|
+
const prototype = HTMLCanvasElement.prototype;
|
|
111
|
+
if (!enforce && prototype.originalGetContext) {
|
|
112
|
+
// Reset the original getContext function
|
|
113
|
+
prototype.getContext = prototype.originalGetContext;
|
|
114
|
+
prototype.originalGetContext = undefined;
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
// Store the original getContext function
|
|
118
|
+
prototype.originalGetContext = prototype.getContext;
|
|
119
|
+
// Override the getContext function
|
|
120
|
+
prototype.getContext = function (contextId, options) {
|
|
121
|
+
// Attempt to force WebGL2 for all WebGL1 contexts
|
|
122
|
+
if (contextId === 'webgl' || contextId === 'experimental-webgl') {
|
|
123
|
+
return this.originalGetContext('webgl2', options);
|
|
124
|
+
}
|
|
125
|
+
// For any other type, return the original context
|
|
126
|
+
return this.originalGetContext(contextId, options);
|
|
127
|
+
};
|
|
128
|
+
}
|
|
109
129
|
}
|
|
110
130
|
/** Convert a list of devices to a map */
|
|
111
131
|
function getDeviceMap(deviceClasses /* : typeof Device */) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luma.gl/core",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.10",
|
|
4
4
|
"description": "The luma.gl core Device API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"@probe.gl/stats": "^4.0.2",
|
|
47
47
|
"@types/offscreencanvas": "^2019.6.4"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "aa5e354fd9502a84e43c9e312ad33d9c155fed01"
|
|
50
50
|
}
|
|
@@ -43,13 +43,12 @@ export type RenderPipelineProps = ResourceProps & {
|
|
|
43
43
|
/** Parameters that are controlled by pipeline */
|
|
44
44
|
parameters?: RenderPipelineParameters;
|
|
45
45
|
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
instanceCount?: number;
|
|
46
|
+
// /** Use instanced rendering? */
|
|
47
|
+
// isInstanced?: boolean;
|
|
48
|
+
// /** Number of instances */
|
|
49
|
+
// instanceCount?: number;
|
|
50
|
+
// /** Number of vertices */
|
|
51
|
+
// vertexCount?: number;
|
|
53
52
|
|
|
54
53
|
/** Buffers, Textures, Samplers for the shader bindings */
|
|
55
54
|
bindings?: Record<string, Binding>;
|
|
@@ -77,8 +76,9 @@ export abstract class RenderPipeline extends Resource<RenderPipelineProps> {
|
|
|
77
76
|
topology: 'triangle-list',
|
|
78
77
|
parameters: {},
|
|
79
78
|
|
|
80
|
-
|
|
81
|
-
instanceCount: 0,
|
|
79
|
+
// isInstanced: false,
|
|
80
|
+
// instanceCount: 0,
|
|
81
|
+
// vertexCount: 0,
|
|
82
82
|
|
|
83
83
|
bindings: {},
|
|
84
84
|
uniforms: {}
|
|
@@ -122,12 +122,14 @@ export abstract class RenderPipeline extends Resource<RenderPipelineProps> {
|
|
|
122
122
|
topology?: PrimitiveTopology;
|
|
123
123
|
/** vertex attributes */
|
|
124
124
|
vertexArray: VertexArray;
|
|
125
|
-
/**
|
|
126
|
-
|
|
127
|
-
/** Number of "rows" in 'vertex' buffers */
|
|
128
|
-
vertexCount?: number;
|
|
125
|
+
/** Use instanced rendering? */
|
|
126
|
+
isInstanced?: boolean;
|
|
129
127
|
/** Number of "rows" in 'instance' buffers */
|
|
130
128
|
instanceCount?: number;
|
|
129
|
+
/** Number of "rows" in 'vertex' buffers */
|
|
130
|
+
vertexCount?: number;
|
|
131
|
+
/** Number of "rows" in index buffer */
|
|
132
|
+
indexCount?: number;
|
|
131
133
|
/** First vertex to draw from */
|
|
132
134
|
firstVertex?: number;
|
|
133
135
|
/** First index to draw from */
|
package/src/lib/luma.ts
CHANGED
|
@@ -149,6 +149,29 @@ export class luma {
|
|
|
149
149
|
'No matching device found. Ensure `@luma.gl/webgl` and/or `@luma.gl/webgpu` modules are imported.'
|
|
150
150
|
);
|
|
151
151
|
}
|
|
152
|
+
|
|
153
|
+
static enforceWebGL2(enforce: boolean = true): void {
|
|
154
|
+
const prototype = HTMLCanvasElement.prototype as any;
|
|
155
|
+
if (!enforce && prototype.originalGetContext) {
|
|
156
|
+
// Reset the original getContext function
|
|
157
|
+
prototype.getContext = prototype.originalGetContext;
|
|
158
|
+
prototype.originalGetContext = undefined;
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Store the original getContext function
|
|
163
|
+
prototype.originalGetContext = prototype.getContext;
|
|
164
|
+
|
|
165
|
+
// Override the getContext function
|
|
166
|
+
prototype.getContext = function (contextId: string, options?: WebGLContextAttributes) {
|
|
167
|
+
// Attempt to force WebGL2 for all WebGL1 contexts
|
|
168
|
+
if (contextId === 'webgl' || contextId === 'experimental-webgl') {
|
|
169
|
+
return this.originalGetContext('webgl2', options);
|
|
170
|
+
}
|
|
171
|
+
// For any other type, return the original context
|
|
172
|
+
return this.originalGetContext(contextId, options);
|
|
173
|
+
};
|
|
174
|
+
}
|
|
152
175
|
}
|
|
153
176
|
|
|
154
177
|
/** Convert a list of devices to a map */
|