@luma.gl/gltf 9.0.0-alpha.50 → 9.0.0-alpha.51
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/dist.dev.js +179 -110
- package/dist.min.js +134 -131
- package/package.json +6 -6
package/dist/dist.dev.js
CHANGED
|
@@ -1356,26 +1356,172 @@ var __exports__ = (() => {
|
|
|
1356
1356
|
__publicField(Texture, "STORAGE_BINDING", 8);
|
|
1357
1357
|
__publicField(Texture, "RENDER_ATTACHMENT", 16);
|
|
1358
1358
|
|
|
1359
|
+
// ../core/src/lib/compiler-log/format-compiler-log.ts
|
|
1360
|
+
function formatCompilerLog(shaderLog, source, options) {
|
|
1361
|
+
let formattedLog = "";
|
|
1362
|
+
const lines = source.split(/\r?\n/);
|
|
1363
|
+
const log3 = shaderLog.slice().sort((a, b) => a.lineNum - b.lineNum);
|
|
1364
|
+
switch (options?.showSourceCode || "no") {
|
|
1365
|
+
case "all":
|
|
1366
|
+
let currentMessage = 0;
|
|
1367
|
+
for (let lineNum = 1; lineNum <= lines.length; lineNum++) {
|
|
1368
|
+
formattedLog += getNumberedLine(lines[lineNum - 1], lineNum, options);
|
|
1369
|
+
while (log3.length > currentMessage && log3[currentMessage].lineNum === lineNum) {
|
|
1370
|
+
const message2 = log3[currentMessage++];
|
|
1371
|
+
formattedLog += formatCompilerMessage(message2, lines, message2.lineNum, {
|
|
1372
|
+
...options,
|
|
1373
|
+
inlineSource: false
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
return formattedLog;
|
|
1378
|
+
case "issues":
|
|
1379
|
+
case "no":
|
|
1380
|
+
for (const message2 of shaderLog) {
|
|
1381
|
+
formattedLog += formatCompilerMessage(message2, lines, message2.lineNum, {
|
|
1382
|
+
inlineSource: options?.showSourceCode !== "no"
|
|
1383
|
+
});
|
|
1384
|
+
}
|
|
1385
|
+
return formattedLog;
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
function formatCompilerMessage(message2, lines, lineNum, options) {
|
|
1389
|
+
if (options?.inlineSource) {
|
|
1390
|
+
const numberedLines = getNumberedLines(lines, lineNum);
|
|
1391
|
+
const positionIndicator = message2.linePos > 0 ? `${" ".repeat(message2.linePos + 5)}^^^
|
|
1392
|
+
` : "";
|
|
1393
|
+
return `
|
|
1394
|
+
${numberedLines}${positionIndicator}${message2.type.toUpperCase()}: ${message2.message}
|
|
1395
|
+
|
|
1396
|
+
`;
|
|
1397
|
+
}
|
|
1398
|
+
return options?.html ? `<div class='luma-compiler-log-error' style="color:red;"><b> ${message2.type.toUpperCase()}: ${message2.message}</b></div>` : `${message2.type.toUpperCase()}: ${message2.message}`;
|
|
1399
|
+
}
|
|
1400
|
+
function getNumberedLines(lines, lineNum, options) {
|
|
1401
|
+
let numberedLines = "";
|
|
1402
|
+
for (let lineIndex = lineNum - 2; lineIndex <= lineNum; lineIndex++) {
|
|
1403
|
+
const sourceLine = lines[lineIndex - 1];
|
|
1404
|
+
if (sourceLine !== void 0) {
|
|
1405
|
+
numberedLines += getNumberedLine(sourceLine, lineNum, options);
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
return numberedLines;
|
|
1409
|
+
}
|
|
1410
|
+
function getNumberedLine(line, lineNum, options) {
|
|
1411
|
+
return `${padLeft(String(lineNum), 4)}: ${line}${options?.html ? "<br/>" : "\n"}`;
|
|
1412
|
+
}
|
|
1413
|
+
function padLeft(string, paddedLength) {
|
|
1414
|
+
let result = "";
|
|
1415
|
+
for (let i = string.length; i < paddedLength; ++i) {
|
|
1416
|
+
result += " ";
|
|
1417
|
+
}
|
|
1418
|
+
return result + string;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
// ../core/src/lib/compiler-log/get-shader-info.ts
|
|
1422
|
+
function getShaderInfo(source, defaultName) {
|
|
1423
|
+
return {
|
|
1424
|
+
name: getShaderName(source, defaultName),
|
|
1425
|
+
language: "glsl",
|
|
1426
|
+
version: getShaderVersion(source)
|
|
1427
|
+
};
|
|
1428
|
+
}
|
|
1429
|
+
function getShaderName(shader, defaultName = "unnamed") {
|
|
1430
|
+
const SHADER_NAME_REGEXP = /#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/;
|
|
1431
|
+
const match = SHADER_NAME_REGEXP.exec(shader);
|
|
1432
|
+
return match ? match[1] : defaultName;
|
|
1433
|
+
}
|
|
1434
|
+
function getShaderVersion(source) {
|
|
1435
|
+
let version = 100;
|
|
1436
|
+
const words = source.match(/[^\s]+/g);
|
|
1437
|
+
if (words && words.length >= 2 && words[0] === "#version") {
|
|
1438
|
+
const v = parseInt(words[1], 10);
|
|
1439
|
+
if (Number.isFinite(v)) {
|
|
1440
|
+
version = v;
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
return version;
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1359
1446
|
// ../core/src/adapter/resources/shader.ts
|
|
1360
1447
|
var _Shader = class extends Resource {
|
|
1361
1448
|
get [Symbol.toStringTag]() {
|
|
1362
1449
|
return "Shader";
|
|
1363
1450
|
}
|
|
1451
|
+
compilationStatus = "pending";
|
|
1364
1452
|
constructor(device, props) {
|
|
1365
|
-
super(device,
|
|
1453
|
+
super(device, {
|
|
1454
|
+
id: getShaderIdFromProps(props),
|
|
1455
|
+
...props
|
|
1456
|
+
}, _Shader.defaultProps);
|
|
1366
1457
|
this.stage = this.props.stage;
|
|
1367
1458
|
this.source = this.props.source;
|
|
1368
1459
|
}
|
|
1460
|
+
getCompilationInfoSync() {
|
|
1461
|
+
return null;
|
|
1462
|
+
}
|
|
1463
|
+
async debugShader() {
|
|
1464
|
+
switch (this.props.debug) {
|
|
1465
|
+
case "never":
|
|
1466
|
+
return;
|
|
1467
|
+
case "errors":
|
|
1468
|
+
if (this.compilationStatus === "success") {
|
|
1469
|
+
return;
|
|
1470
|
+
}
|
|
1471
|
+
break;
|
|
1472
|
+
case "warnings":
|
|
1473
|
+
case "always":
|
|
1474
|
+
break;
|
|
1475
|
+
}
|
|
1476
|
+
const messages = await this.getCompilationInfo();
|
|
1477
|
+
if (this.props.debug === "warnings" && messages?.length === 0) {
|
|
1478
|
+
return;
|
|
1479
|
+
}
|
|
1480
|
+
this._displayShaderLog(messages);
|
|
1481
|
+
}
|
|
1482
|
+
_displayShaderLog(messages) {
|
|
1483
|
+
if (typeof document === "undefined" || !document?.createElement) {
|
|
1484
|
+
return;
|
|
1485
|
+
}
|
|
1486
|
+
const shaderName = getShaderInfo(this.source).name;
|
|
1487
|
+
const shaderTitle = `${this.stage} ${shaderName}`;
|
|
1488
|
+
const htmlLog = formatCompilerLog(messages, this.source, {
|
|
1489
|
+
showSourceCode: "all",
|
|
1490
|
+
html: true
|
|
1491
|
+
});
|
|
1492
|
+
const button = document.createElement("Button");
|
|
1493
|
+
button.innerHTML = `
|
|
1494
|
+
<h1>Shader Compilation Error in ${shaderTitle}</h1><br /><br />
|
|
1495
|
+
<code style="user-select:text;"><pre>
|
|
1496
|
+
${htmlLog}
|
|
1497
|
+
</pre></code>`;
|
|
1498
|
+
button.style.top = "10px";
|
|
1499
|
+
button.style.left = "10px";
|
|
1500
|
+
button.style.position = "absolute";
|
|
1501
|
+
button.style.zIndex = "9999";
|
|
1502
|
+
button.style.width = "100%";
|
|
1503
|
+
button.style.textAlign = "left";
|
|
1504
|
+
document.body.appendChild(button);
|
|
1505
|
+
document.getElementsByClassName("luma-compiler-log-error")[0]?.scrollIntoView();
|
|
1506
|
+
button.onclick = () => {
|
|
1507
|
+
const dataURI = `data:text/plain,${encodeURIComponent(this.source)}`;
|
|
1508
|
+
navigator.clipboard.writeText(dataURI);
|
|
1509
|
+
};
|
|
1510
|
+
}
|
|
1369
1511
|
};
|
|
1370
1512
|
var Shader = _Shader;
|
|
1371
1513
|
__publicField(Shader, "defaultProps", {
|
|
1372
1514
|
...Resource.defaultProps,
|
|
1515
|
+
language: "auto",
|
|
1373
1516
|
stage: "vertex",
|
|
1374
1517
|
source: "",
|
|
1375
1518
|
sourceMap: null,
|
|
1376
|
-
|
|
1377
|
-
|
|
1519
|
+
entryPoint: "main",
|
|
1520
|
+
debug: "errors"
|
|
1378
1521
|
});
|
|
1522
|
+
function getShaderIdFromProps(props) {
|
|
1523
|
+
return getShaderInfo(props.source).name || props.id || uid(`unnamed ${props.stage}-shader`);
|
|
1524
|
+
}
|
|
1379
1525
|
|
|
1380
1526
|
// ../core/src/adapter/resources/sampler.ts
|
|
1381
1527
|
var _Sampler = class extends Resource {
|
|
@@ -2408,46 +2554,6 @@ var __exports__ = (() => {
|
|
|
2408
2554
|
return `${dataType}x${components}`;
|
|
2409
2555
|
}
|
|
2410
2556
|
|
|
2411
|
-
// ../core/src/lib/compiler-log/format-compiler-log.ts
|
|
2412
|
-
function formatCompilerLog(shaderLog, source, options) {
|
|
2413
|
-
const lines = source.split(/\r?\n/);
|
|
2414
|
-
let formattedLog = "";
|
|
2415
|
-
for (const message2 of shaderLog) {
|
|
2416
|
-
formattedLog += formatCompilerMessage(message2, lines, message2.lineNum, options);
|
|
2417
|
-
}
|
|
2418
|
-
return formattedLog;
|
|
2419
|
-
}
|
|
2420
|
-
function formatCompilerMessage(message2, lines, lineNum, options) {
|
|
2421
|
-
if (options?.showSourceCode) {
|
|
2422
|
-
const positionIndicator = message2.linePos > 0 ? `${" ".repeat(message2.linePos + 5)}^^^
|
|
2423
|
-
` : "";
|
|
2424
|
-
const numberedLines = getNumberedLines(lines, lineNum);
|
|
2425
|
-
return `${numberedLines}${positionIndicator}${message2.type.toUpperCase()}: ${message2.message}
|
|
2426
|
-
|
|
2427
|
-
`;
|
|
2428
|
-
}
|
|
2429
|
-
return `${message2.type.toUpperCase()}: ${message2.message}
|
|
2430
|
-
`;
|
|
2431
|
-
}
|
|
2432
|
-
function getNumberedLines(lines, lineNum) {
|
|
2433
|
-
let numberedLines = "";
|
|
2434
|
-
for (let line = lineNum - 2; line <= lineNum; line++) {
|
|
2435
|
-
const sourceLine = lines[line];
|
|
2436
|
-
if (sourceLine !== void 0) {
|
|
2437
|
-
numberedLines += `${padLeft(String(line), 4)}: ${sourceLine}
|
|
2438
|
-
`;
|
|
2439
|
-
}
|
|
2440
|
-
}
|
|
2441
|
-
return numberedLines;
|
|
2442
|
-
}
|
|
2443
|
-
function padLeft(string, paddedLength) {
|
|
2444
|
-
let result = "";
|
|
2445
|
-
for (let i = string.length; i < paddedLength; ++i) {
|
|
2446
|
-
result += " ";
|
|
2447
|
-
}
|
|
2448
|
-
return result + string;
|
|
2449
|
-
}
|
|
2450
|
-
|
|
2451
2557
|
// ../core/src/lib/utils/cast.ts
|
|
2452
2558
|
function cast(value) {
|
|
2453
2559
|
return value;
|
|
@@ -3337,19 +3443,19 @@ ${moduleSource}
|
|
|
3337
3443
|
}
|
|
3338
3444
|
|
|
3339
3445
|
// ../shadertools/src/lib/glsl-utils/get-shader-info.ts
|
|
3340
|
-
function
|
|
3446
|
+
function getShaderInfo2(source, defaultName) {
|
|
3341
3447
|
return {
|
|
3342
|
-
name:
|
|
3448
|
+
name: getShaderName2(source, defaultName),
|
|
3343
3449
|
language: "glsl",
|
|
3344
|
-
version:
|
|
3450
|
+
version: getShaderVersion2(source)
|
|
3345
3451
|
};
|
|
3346
3452
|
}
|
|
3347
|
-
function
|
|
3453
|
+
function getShaderName2(shader, defaultName = "unnamed") {
|
|
3348
3454
|
const SHADER_NAME_REGEXP = /#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/;
|
|
3349
3455
|
const match = SHADER_NAME_REGEXP.exec(shader);
|
|
3350
3456
|
return match ? match[1] : defaultName;
|
|
3351
3457
|
}
|
|
3352
|
-
function
|
|
3458
|
+
function getShaderVersion2(source) {
|
|
3353
3459
|
let version = 100;
|
|
3354
3460
|
const words = source.match(/[^\s]+/g);
|
|
3355
3461
|
if (words && words.length >= 2 && words[0] === "#version") {
|
|
@@ -3498,7 +3604,7 @@ precision highp float;
|
|
|
3498
3604
|
log: log3
|
|
3499
3605
|
} = options;
|
|
3500
3606
|
assert3(typeof source === "string", "shader source must be a string");
|
|
3501
|
-
const sourceVersion = language === "glsl" ?
|
|
3607
|
+
const sourceVersion = language === "glsl" ? getShaderInfo2(source).version : -1;
|
|
3502
3608
|
const targetVersion = platformInfo.shaderLanguageVersion;
|
|
3503
3609
|
const sourceVersionDirective = sourceVersion === 100 ? "#version 100" : "#version 300 es";
|
|
3504
3610
|
const sourceLines = source.split("\n");
|
|
@@ -6410,14 +6516,14 @@ uniform mat4 u_MVPMatrix;
|
|
|
6410
6516
|
uniform mat4 u_ModelMatrix;
|
|
6411
6517
|
uniform mat4 u_NormalMatrix;
|
|
6412
6518
|
|
|
6413
|
-
|
|
6414
|
-
|
|
6519
|
+
out vec3 pbr_vPosition;
|
|
6520
|
+
out vec2 pbr_vUV;
|
|
6415
6521
|
|
|
6416
6522
|
#ifdef HAS_NORMALS
|
|
6417
6523
|
# ifdef HAS_TANGENTS
|
|
6418
|
-
|
|
6524
|
+
out mat3 pbr_vTBN;
|
|
6419
6525
|
# else
|
|
6420
|
-
|
|
6526
|
+
out vec3 pbr_vNormal;
|
|
6421
6527
|
# endif
|
|
6422
6528
|
#endif
|
|
6423
6529
|
|
|
@@ -6509,15 +6615,15 @@ uniform vec4 u_ScaleDiffBaseMR;
|
|
|
6509
6615
|
uniform vec4 u_ScaleFGDSpec;
|
|
6510
6616
|
#endif
|
|
6511
6617
|
|
|
6512
|
-
|
|
6618
|
+
in vec3 pbr_vPosition;
|
|
6513
6619
|
|
|
6514
|
-
|
|
6620
|
+
in vec2 pbr_vUV;
|
|
6515
6621
|
|
|
6516
6622
|
#ifdef HAS_NORMALS
|
|
6517
6623
|
#ifdef HAS_TANGENTS
|
|
6518
|
-
|
|
6624
|
+
in mat3 pbr_vTBN;
|
|
6519
6625
|
#else
|
|
6520
|
-
|
|
6626
|
+
in vec3 pbr_vNormal;
|
|
6521
6627
|
#endif
|
|
6522
6628
|
#endif
|
|
6523
6629
|
|
|
@@ -6586,7 +6692,7 @@ vec3 getNormal()
|
|
|
6586
6692
|
#endif
|
|
6587
6693
|
|
|
6588
6694
|
#ifdef HAS_NORMALMAP
|
|
6589
|
-
vec3 n =
|
|
6695
|
+
vec3 n = texture(u_NormalSampler, pbr_vUV).rgb;
|
|
6590
6696
|
n = normalize(tbn * ((2.0 * n - 1.0) * vec3(u_NormalScale, u_NormalScale, 1.0)));
|
|
6591
6697
|
#else
|
|
6592
6698
|
// The tbn matrix is linearly interpolated, so we need to re-normalize
|
|
@@ -6605,7 +6711,7 @@ vec3 getIBLContribution(PBRInfo pbrInputs, vec3 n, vec3 reflection)
|
|
|
6605
6711
|
float mipCount = 9.0; // resolution of 512x512
|
|
6606
6712
|
float lod = (pbrInputs.perceptualRoughness * mipCount);
|
|
6607
6713
|
// retrieve a scale and bias to F0. See [1], Figure 3
|
|
6608
|
-
vec3 brdf = SRGBtoLINEAR(
|
|
6714
|
+
vec3 brdf = SRGBtoLINEAR(texture(u_brdfLUT,
|
|
6609
6715
|
vec2(pbrInputs.NdotV, 1.0 - pbrInputs.perceptualRoughness))).rgb;
|
|
6610
6716
|
vec3 diffuseLight = SRGBtoLINEAR(textureCube(u_DiffuseEnvSampler, n)).rgb;
|
|
6611
6717
|
|
|
@@ -6712,7 +6818,7 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
6712
6818
|
{
|
|
6713
6819
|
// The albedo may be defined from a base texture or a flat color
|
|
6714
6820
|
#ifdef HAS_BASECOLORMAP
|
|
6715
|
-
vec4 baseColor = SRGBtoLINEAR(
|
|
6821
|
+
vec4 baseColor = SRGBtoLINEAR(texture(u_BaseColorSampler, pbr_vUV)) * u_BaseColorFactor;
|
|
6716
6822
|
#else
|
|
6717
6823
|
vec4 baseColor = u_BaseColorFactor;
|
|
6718
6824
|
#endif
|
|
@@ -6737,7 +6843,7 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
6737
6843
|
#ifdef HAS_METALROUGHNESSMAP
|
|
6738
6844
|
// Roughness is stored in the 'g' channel, metallic is stored in the 'b' channel.
|
|
6739
6845
|
// This layout intentionally reserves the 'r' channel for (optional) occlusion map data
|
|
6740
|
-
vec4 mrSample =
|
|
6846
|
+
vec4 mrSample = texture(u_MetallicRoughnessSampler, pbr_vUV);
|
|
6741
6847
|
perceptualRoughness = mrSample.g * perceptualRoughness;
|
|
6742
6848
|
metallic = mrSample.b * metallic;
|
|
6743
6849
|
#endif
|
|
@@ -6816,12 +6922,12 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
6816
6922
|
|
|
6817
6923
|
// Apply optional PBR terms for additional (optional) shading
|
|
6818
6924
|
#ifdef HAS_OCCLUSIONMAP
|
|
6819
|
-
float ao =
|
|
6925
|
+
float ao = texture(u_OcclusionSampler, pbr_vUV).r;
|
|
6820
6926
|
color = mix(color, color * ao, u_OcclusionStrength);
|
|
6821
6927
|
#endif
|
|
6822
6928
|
|
|
6823
6929
|
#ifdef HAS_EMISSIVEMAP
|
|
6824
|
-
vec3 emissive = SRGBtoLINEAR(
|
|
6930
|
+
vec3 emissive = SRGBtoLINEAR(texture(u_EmissiveSampler, pbr_vUV)).rgb * u_EmissiveFactor;
|
|
6825
6931
|
color += emissive;
|
|
6826
6932
|
#endif
|
|
6827
6933
|
|
|
@@ -12555,31 +12661,6 @@ void main(void) {}`;
|
|
|
12555
12661
|
}
|
|
12556
12662
|
}
|
|
12557
12663
|
|
|
12558
|
-
// ../webgl/src/adapter/helpers/get-shader-info.ts
|
|
12559
|
-
function getShaderInfo2(source, defaultName) {
|
|
12560
|
-
return {
|
|
12561
|
-
name: getShaderName2(source, defaultName),
|
|
12562
|
-
language: "glsl",
|
|
12563
|
-
version: getShaderVersion2(source)
|
|
12564
|
-
};
|
|
12565
|
-
}
|
|
12566
|
-
function getShaderName2(shader, defaultName = "unnamed") {
|
|
12567
|
-
const SHADER_NAME_REGEXP = /#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/;
|
|
12568
|
-
const match = SHADER_NAME_REGEXP.exec(shader);
|
|
12569
|
-
return match ? match[1] : defaultName;
|
|
12570
|
-
}
|
|
12571
|
-
function getShaderVersion2(source) {
|
|
12572
|
-
let version = 100;
|
|
12573
|
-
const words = source.match(/[^\s]+/g);
|
|
12574
|
-
if (words && words.length >= 2 && words[0] === "#version") {
|
|
12575
|
-
const v = parseInt(words[1], 10);
|
|
12576
|
-
if (Number.isFinite(v)) {
|
|
12577
|
-
version = v;
|
|
12578
|
-
}
|
|
12579
|
-
}
|
|
12580
|
-
return version;
|
|
12581
|
-
}
|
|
12582
|
-
|
|
12583
12664
|
// ../webgl/src/adapter/helpers/parse-shader-compiler-log.ts
|
|
12584
12665
|
function parseShaderCompilerLog(errLog) {
|
|
12585
12666
|
const lines = errLog.split(/\r?\n/);
|
|
@@ -12626,10 +12707,7 @@ void main(void) {}`;
|
|
|
12626
12707
|
// ../webgl/src/adapter/resources/webgl-shader.ts
|
|
12627
12708
|
var WEBGLShader = class extends Shader {
|
|
12628
12709
|
constructor(device, props) {
|
|
12629
|
-
super(device,
|
|
12630
|
-
id: getShaderIdFromProps(props),
|
|
12631
|
-
...props
|
|
12632
|
-
});
|
|
12710
|
+
super(device, props);
|
|
12633
12711
|
this.device = device;
|
|
12634
12712
|
switch (this.props.stage) {
|
|
12635
12713
|
case "vertex":
|
|
@@ -12650,9 +12728,12 @@ void main(void) {}`;
|
|
|
12650
12728
|
this.destroyed = true;
|
|
12651
12729
|
}
|
|
12652
12730
|
}
|
|
12653
|
-
async
|
|
12731
|
+
async getCompilationInfo() {
|
|
12732
|
+
return this.getCompilationInfoSync();
|
|
12733
|
+
}
|
|
12734
|
+
getCompilationInfoSync() {
|
|
12654
12735
|
const log3 = this.device.gl.getShaderInfoLog(this.handle);
|
|
12655
|
-
return
|
|
12736
|
+
return parseShaderCompilerLog(log3);
|
|
12656
12737
|
}
|
|
12657
12738
|
_compile(source) {
|
|
12658
12739
|
const addGLSLVersion = (source2) => source2.startsWith("#version ") ? source2 : `#version 100
|
|
@@ -12663,25 +12744,13 @@ ${source2}`;
|
|
|
12663
12744
|
} = this.device;
|
|
12664
12745
|
gl.shaderSource(this.handle, source);
|
|
12665
12746
|
gl.compileShader(this.handle);
|
|
12666
|
-
|
|
12667
|
-
|
|
12668
|
-
|
|
12669
|
-
|
|
12670
|
-
const messages = parsedLog.filter((message2) => message2.type === "error");
|
|
12671
|
-
const formattedLog = formatCompilerLog(messages, source, {
|
|
12672
|
-
showSourceCode: true
|
|
12673
|
-
});
|
|
12674
|
-
const shaderName = getShaderInfo2(source).name;
|
|
12675
|
-
const shaderDescription = `${this.stage} shader ${shaderName}`;
|
|
12676
|
-
log.error(`GLSL compilation errors in ${shaderDescription}
|
|
12677
|
-
${formattedLog}`)();
|
|
12678
|
-
throw new Error(`GLSL compilation errors in ${shaderName}`);
|
|
12747
|
+
this.compilationStatus = gl.getShaderParameter(this.handle, GLEnum2.COMPILE_STATUS) ? "success" : "error";
|
|
12748
|
+
this.debugShader();
|
|
12749
|
+
if (this.compilationStatus === "error") {
|
|
12750
|
+
throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);
|
|
12679
12751
|
}
|
|
12680
12752
|
}
|
|
12681
12753
|
};
|
|
12682
|
-
function getShaderIdFromProps(props) {
|
|
12683
|
-
return getShaderInfo2(props.source).name || props.id || uid(`unnamed ${props.stage}-shader`);
|
|
12684
|
-
}
|
|
12685
12754
|
|
|
12686
12755
|
// ../webgl/src/adapter/resources/webgl-render-pass.ts
|
|
12687
12756
|
var GL_DEPTH_BUFFER_BIT = 256;
|