@luma.gl/webgl 9.0.0-alpha.50 → 9.0.0-alpha.52
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-shader.d.ts +2 -1
- package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-shader.js +11 -23
- package/dist/adapter/resources/webgl-shader.js.map +1 -1
- package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
- package/dist/context/debug/webgl-developer-tools.js +5 -4
- package/dist/context/debug/webgl-developer-tools.js.map +1 -1
- package/dist/dist.dev.js +834 -95
- package/dist/index.cjs +13 -45
- package/dist.min.js +43 -40
- package/package.json +5 -5
- package/src/adapter/resources/webgl-shader.ts +26 -23
- package/src/context/debug/webgl-developer-tools.ts +7 -6
- package/dist/adapter/helpers/get-shader-info.d.ts +0 -9
- package/dist/adapter/helpers/get-shader-info.d.ts.map +0 -1
- package/dist/adapter/helpers/get-shader-info.js +0 -25
- package/dist/adapter/helpers/get-shader-info.js.map +0 -1
- package/src/adapter/helpers/get-shader-info.ts +0 -41
package/dist/index.cjs
CHANGED
|
@@ -1331,13 +1331,13 @@ var GLState = class {
|
|
|
1331
1331
|
constructor(gl, {
|
|
1332
1332
|
copyState = false,
|
|
1333
1333
|
// Copy cache from params (slow) or initialize from WebGL defaults (fast)
|
|
1334
|
-
log:
|
|
1334
|
+
log: log9 = () => {
|
|
1335
1335
|
}
|
|
1336
1336
|
// Logging function, called when gl parameter change calls are actually issued
|
|
1337
1337
|
} = {}) {
|
|
1338
1338
|
this.gl = gl;
|
|
1339
1339
|
this.cache = copyState ? getGLParameters(gl) : Object.assign({}, GL_PARAMETER_DEFAULTS);
|
|
1340
|
-
this.log =
|
|
1340
|
+
this.log = log9;
|
|
1341
1341
|
this._updateCache = this._updateCache.bind(this);
|
|
1342
1342
|
Object.seal(this);
|
|
1343
1343
|
}
|
|
@@ -4155,31 +4155,6 @@ function onValidateGLFunc(props, functionName, functionArgs) {
|
|
|
4155
4155
|
var import_core18 = require("@luma.gl/core");
|
|
4156
4156
|
var import_constants16 = require("@luma.gl/constants");
|
|
4157
4157
|
|
|
4158
|
-
// src/adapter/helpers/get-shader-info.ts
|
|
4159
|
-
function getShaderInfo(source, defaultName) {
|
|
4160
|
-
return {
|
|
4161
|
-
name: getShaderName(source, defaultName),
|
|
4162
|
-
language: "glsl",
|
|
4163
|
-
version: getShaderVersion(source)
|
|
4164
|
-
};
|
|
4165
|
-
}
|
|
4166
|
-
function getShaderName(shader, defaultName = "unnamed") {
|
|
4167
|
-
const SHADER_NAME_REGEXP = /#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/;
|
|
4168
|
-
const match = SHADER_NAME_REGEXP.exec(shader);
|
|
4169
|
-
return match ? match[1] : defaultName;
|
|
4170
|
-
}
|
|
4171
|
-
function getShaderVersion(source) {
|
|
4172
|
-
let version = 100;
|
|
4173
|
-
const words = source.match(/[^\s]+/g);
|
|
4174
|
-
if (words && words.length >= 2 && words[0] === "#version") {
|
|
4175
|
-
const v = parseInt(words[1], 10);
|
|
4176
|
-
if (Number.isFinite(v)) {
|
|
4177
|
-
version = v;
|
|
4178
|
-
}
|
|
4179
|
-
}
|
|
4180
|
-
return version;
|
|
4181
|
-
}
|
|
4182
|
-
|
|
4183
4158
|
// src/adapter/helpers/parse-shader-compiler-log.ts
|
|
4184
4159
|
function parseShaderCompilerLog(errLog) {
|
|
4185
4160
|
const lines = errLog.split(/\r?\n/);
|
|
@@ -4229,7 +4204,7 @@ var WEBGLShader = class extends import_core18.Shader {
|
|
|
4229
4204
|
device;
|
|
4230
4205
|
handle;
|
|
4231
4206
|
constructor(device, props) {
|
|
4232
|
-
super(device,
|
|
4207
|
+
super(device, props);
|
|
4233
4208
|
this.device = device;
|
|
4234
4209
|
switch (this.props.stage) {
|
|
4235
4210
|
case "vertex":
|
|
@@ -4250,9 +4225,12 @@ var WEBGLShader = class extends import_core18.Shader {
|
|
|
4250
4225
|
this.destroyed = true;
|
|
4251
4226
|
}
|
|
4252
4227
|
}
|
|
4253
|
-
async
|
|
4254
|
-
|
|
4255
|
-
|
|
4228
|
+
async getCompilationInfo() {
|
|
4229
|
+
return this.getCompilationInfoSync();
|
|
4230
|
+
}
|
|
4231
|
+
getCompilationInfoSync() {
|
|
4232
|
+
const log9 = this.device.gl.getShaderInfoLog(this.handle);
|
|
4233
|
+
return parseShaderCompilerLog(log9);
|
|
4256
4234
|
}
|
|
4257
4235
|
// PRIVATE METHODS
|
|
4258
4236
|
_compile(source) {
|
|
@@ -4262,23 +4240,13 @@ ${source2}`;
|
|
|
4262
4240
|
const { gl } = this.device;
|
|
4263
4241
|
gl.shaderSource(this.handle, source);
|
|
4264
4242
|
gl.compileShader(this.handle);
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
const messages = parsedLog.filter((message2) => message2.type === "error");
|
|
4270
|
-
const formattedLog = (0, import_core18.formatCompilerLog)(messages, source, { showSourceCode: true });
|
|
4271
|
-
const shaderName = getShaderInfo(source).name;
|
|
4272
|
-
const shaderDescription = `${this.stage} shader ${shaderName}`;
|
|
4273
|
-
import_core18.log.error(`GLSL compilation errors in ${shaderDescription}
|
|
4274
|
-
${formattedLog}`)();
|
|
4275
|
-
throw new Error(`GLSL compilation errors in ${shaderName}`);
|
|
4243
|
+
this.compilationStatus = gl.getShaderParameter(this.handle, import_constants16.GL.COMPILE_STATUS) ? "success" : "error";
|
|
4244
|
+
this.debugShader();
|
|
4245
|
+
if (this.compilationStatus === "error") {
|
|
4246
|
+
throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);
|
|
4276
4247
|
}
|
|
4277
4248
|
}
|
|
4278
4249
|
};
|
|
4279
|
-
function getShaderIdFromProps(props) {
|
|
4280
|
-
return getShaderInfo(props.source).name || props.id || (0, import_core18.uid)(`unnamed ${props.stage}-shader`);
|
|
4281
|
-
}
|
|
4282
4250
|
|
|
4283
4251
|
// src/adapter/resources/webgl-render-pass.ts
|
|
4284
4252
|
var import_core19 = require("@luma.gl/core");
|