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, 30 Nov 2012 23:08:38 +0000 (15:08 -0800)
commit962a1c07b44fe500b79b3ca6806d72a432c1f055
treebcdcc4899a70401e8341bbe48b96976d11633e82
parent60a11e295b86475ff334291a5b483e422371b21c
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.

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