glcpp: Rewrite line-continuation support to act globally.
authorCarl Worth <cworth@cworth.org>
Thu, 29 Nov 2012 22:49:46 +0000 (14:49 -0800)
committerCarl Worth <cworth@cworth.org>
Fri, 11 Jan 2013 21:55:41 +0000 (13:55 -0800)
commit2483039aca78078f21a57e8e950a0bc0181fbd3d
treec422c7ee9f4d58ca5c5fb424bd8afa2340ab48c9
parent63d156900ffeab0740698c6404aabac9f7a98dba
glcpp: Rewrite line-continuation support to act globally.

Previously, we were only supporting line-continuation backslash characters
within lines of pre-processor directives, (as per the specification). With
OpenGL 4.2 and GLES3, line continuations are now supported anywhere within a
shader.

While changing this, also fix a bug where the preprocessor was ignoring
line continuation characters when a line ended in multiple backslash
characters.

The new code is also more efficient than the old. Previously, we would
perform a ralloc copy at each newline. We now perform copies only at each
occurrence of a line-continuation.

This commit fixes the line-continuation.vert test in piglit.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/glsl/glcpp/pp.c