Skip to content

Commit

Permalink
Merge pull request #14049 from Popov72/fix-shader-parsing
Browse files Browse the repository at this point in the history
Shaders: Fix shader parsing
  • Loading branch information
sebavan committed Jul 14, 2023
2 parents 7b296ec + c9ed586 commit 519745d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions packages/dev/core/src/Engines/Processors/shaderCodeCursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ export class ShaderCodeCursor {
// No semicolon in the line
this._lines.push(trimmedLine);
} else if (semicolonIndex === trimmedLine.length - 1) {
// Semicolon at the end of the line
this._lines.push(trimmedLine);
// Single semicolon at the end of the line
// If trimmedLine == ";", we must not push, to be backward compatible with the old code!
if (trimmedLine.length > 1) {
this._lines.push(trimmedLine);
}
} else {
// Semicolon in the middle of the line
const split = line.split(";");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export class PerturbNormalBlock extends NodeMaterialBlock {
state._emitExtension("derivatives", "#extension GL_OES_standard_derivatives : enable");

const tangentReplaceString = { search: /defined\(TANGENT\)/g, replace: worldTangent.isConnected ? "defined(TANGENT)" : "defined(IGNORE)" };
const tbnVarying = { search: /varying mat3 vTBN/g, replace: "" };
const tbnVarying = { search: /varying mat3 vTBN;/g, replace: "" };
const normalMatrixReplaceString = { search: /uniform mat4 normalMatrix;/g, replace: "" };

const TBN = this.TBN;
Expand Down

0 comments on commit 519745d

Please sign in to comment.