Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shaders: Fix shader parsing #14049

Merged
merged 2 commits into from Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/dev/core/src/Engines/Processors/shaderCodeCursor.ts
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
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