aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/Makefile.glsl.am
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2018-10-23 16:01:12 -0700
committerMatt Turner <[email protected]>2019-01-09 16:42:40 -0800
commit412472da5cb30b603e218b34893936cc70039ded (patch)
tree52ae5402c08455560e9dd6e2dc7e2b62e4d30395 /src/compiler/Makefile.glsl.am
parent76c27e47b90647df047e785d6b3ab5d0d979a1ee (diff)
glsl: Add utility to convert text files to C strings
Will be used to convert the .glsl source file containing software fp64 routines to a .h file that can be included while building the compiler. This commit contains two squashed together: the first from Ian adding the utility (with the existing title), and the second from Dylan making the code both python2 and python3 compatible. This is somewhat modeled after the xxd utility that comes with Vim. Signed-off-by: Ian Romanick <[email protected]> xxd.py: Make python2 and 3 compatible This makes use of unicode_literals, so that undecorated strings are considered text (python2 unicode, python3 str) and not bytes in python2 and text in python3. It makes use of io.open, which provides python2 with python3's open behavior (it's an alias in python3), in particular support for the 't' and 'b' option. Finally, it decorates all of the string literals with the 'b' prefix, so that python interprets them as bytes. I've removed the stdin and stdout options, as python2 always requires these to be bytes, but python3 always treats them as text (there is a way to get at the underlying bytes buffer, but that's even more complexity), and makes the input files required arguments. In the meson we use the '@INPUT@' shorthand instead of listing each input, as meson will expand that to [prog_python, '@INPUT0@', @INPUT1@, ..., @OUTPUT@, ...]
Diffstat (limited to 'src/compiler/Makefile.glsl.am')
-rw-r--r--src/compiler/Makefile.glsl.am1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/compiler/Makefile.glsl.am b/src/compiler/Makefile.glsl.am
index a323f7b05bc..9d88d1f66ee 100644
--- a/src/compiler/Makefile.glsl.am
+++ b/src/compiler/Makefile.glsl.am
@@ -28,6 +28,7 @@ EXTRA_DIST += glsl/tests glsl/glcpp/tests glsl/README \
glsl/ir_expression_operation.py \
glsl/glcpp/glcpp-lex.l \
glsl/glcpp/glcpp-parse.y \
+ glsl/xxd.py \
SConscript.glsl
TESTS += glsl/glcpp/tests/glcpp-test.sh \