Skip to content

Commit

Permalink
Improvements to Preprocessor - spaces after #else, comments in #inclu…
Browse files Browse the repository at this point in the history
…de blocks (#7377)

Co-authored-by: Martin Valigursky <[email protected]>
  • Loading branch information
mvaligursky and Martin Valigursky authored Feb 26, 2025
1 parent 2476954 commit 154384f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/core/preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const UNDEF = /undef[ \t]+([^\n]+)\r?(?:\n|$)/g;
const IF = /(ifdef|ifndef|if)[ \t]*([^\r\n]+)\r?\n/g;

// #endif/#else or #elif EXPRESSION
const ENDIF = /(endif|else|elif)([ \t][^\r\n]+)?\r?(?:\n|$)/g;
const ENDIF = /(endif|else|elif)(?:[ \t]+([^\r\n]*))?\r?\n?/g;

// identifier
const IDENTIFIER = /([\w-]+)/;
Expand Down Expand Up @@ -402,6 +402,8 @@ class Preprocessor {
let includeSource = includes?.get(identifier);
if (includeSource !== undefined) {

includeSource = this.stripComments(includeSource);

// handle second identifier specifying loop count
if (countIdentifier) {
const countString = defines.get(countIdentifier);
Expand Down
1 change: 0 additions & 1 deletion src/extras/render-passes/render-pass-compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { GAMMA_NONE, GAMMA_SRGB, gammaNames, TONEMAP_LINEAR, tonemapNames } from
const fragmentShader = /* glsl */ `
#include "tonemappingPS"
#include "decodePS"
#include "gammaPS"
varying vec2 uv0;
Expand Down

0 comments on commit 154384f

Please sign in to comment.