Mesa (master): glsl: skip stringification in preprocessor if in unreachable branch

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 29 23:52:10 UTC 2018


Module: Mesa
Branch: master
Commit: 28a3731e3f4688f98a909cddee261eceb47e3523
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=28a3731e3f4688f98a909cddee261eceb47e3523

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Wed Aug 29 11:36:51 2018 +1000

glsl: skip stringification in preprocessor if in unreachable branch

This fixes compilation of some "No Mans Sky" shaders where the stringification
happens in branches intended for DX12.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/compiler/glsl/glcpp/glcpp-lex.l | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/glcpp/glcpp-lex.l b/src/compiler/glsl/glcpp/glcpp-lex.l
index 9cfcc12022..fe5845acd4 100644
--- a/src/compiler/glsl/glcpp/glcpp-lex.l
+++ b/src/compiler/glsl/glcpp/glcpp-lex.l
@@ -420,8 +420,10 @@ HEXADECIMAL_INTEGER	0[xX][0-9a-fA-F]+[uU]?
 
 	/* This will catch any non-directive garbage after a HASH */
 <HASH>{NONSPACE} {
-	BEGIN INITIAL;
-	RETURN_TOKEN (GARBAGE);
+	if (!parser->skipping) {
+		BEGIN INITIAL;
+		RETURN_TOKEN (GARBAGE);
+	}
 }
 
 	/* An identifier immediately followed by '(' */




More information about the mesa-commit mailing list