[Mesa-dev] [PATCH crucible 2/4] glsl_scraper: add the ability to specify preprocessor directives
Connor Abbott
connora at valvesoftware.com
Thu Jun 8 22:09:46 UTC 2017
From: Connor Abbott <cwabbott0 at gmail.com>
Right now, if you try to put something like:
in a shader, the C preprocessor will try to interpret that line and
barf. Now glsl_scraper.py will strip out ///, so you can do something
like:
///#extension GL_foo : enable
and it'll be ignored when compiling the file itself. Yes, this is a
hack, but I couldn't think of anything better... I'm open to
suggestions.
Signed-off-by: Connor Abbott <cwabbott0 at gmail.com>
---
misc/glsl_scraper.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/misc/glsl_scraper.py b/misc/glsl_scraper.py
index efb08ac..d07c581 100644
--- a/misc/glsl_scraper.py
+++ b/misc/glsl_scraper.py
@@ -28,7 +28,7 @@ class Shader:
self.line = line
def glsl_source(self):
- return dedent(self.stream.getvalue())
+ return dedent(self.stream.getvalue()).replace('///', '')
def __run_glslc(self, extra_args=[]):
stage_flag = '-fshader-stage='
--
2.9.4
More information about the mesa-dev
mailing list