[Mesa-dev] [PATCH 03/12] glsl/gsraytrace: Use __LINE__ macro to set line numbers in GLSL source strings.
Fabian Bieler
fabianbieler at fastmail.fm
Sat Mar 8 04:24:36 PST 2014
On Sat, Mar 8, 2014, at 11:13 AM, Kenneth Graunke wrote:
> On 02/05/2014 04:30 PM, Ian Romanick wrote:
> > On 02/05/2014 01:07 PM, Fabian Bieler wrote:
> >> The hardcoded numbers are a few lines off at the moment.
> >> Keeping track of the numbers through further modifications is inconvenient.
> >> The __LINE__ "constant" takes care of this automatically.
> >>
> >> Signed-off-by: Fabian Bieler <fabianbieler at fastmail.fm>
> >> ---
> >> src/glsl/gsraytrace.cpp | 10 +++++++---
> >> 1 file changed, 7 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/src/glsl/gsraytrace.cpp b/src/glsl/gsraytrace.cpp
> >> index 62a584d..31e9fda 100644
> >> --- a/src/glsl/gsraytrace.cpp
> >> +++ b/src/glsl/gsraytrace.cpp
> >> @@ -37,6 +37,10 @@
> >> // TODO: use GL_EXT_transform_feedback or GL3 equivalent
> >> // TODO: port to piglit too
> >>
> >> +#define STRINGIFY_(x) #x
> >> +#define STRINGIFY(x) STRINGIFY_(x)
> >> +#define S__LINE__ STRINGIFY(__LINE__)
> >> +
> >> static const float INF=9999.9F;
> >>
> >> static int Win;
> >> @@ -67,7 +71,7 @@ float rot[9] = {1,0,0, 0,1,0, 0,0,1};
> >> static const char* vsSource =
> >> " \n"
> >> "#version 120 \n"
> >> -"#line 63 63 \n"
> >> +"#line " S__LINE__ S__LINE__ "\n"
> >
> > I don't think this is correct before or after. The first value is the
> > line number, and the second value is the source number (like the file
> > name in C or C++). Setting the source number to the line number
> > seems... weird, at best.
> >
> > I think
> >
> > "#line " S__LINE__ "\n"
> >
> > is correct.
>
> I made this change and pushed the rest of the series. Thanks for
> porting these so they actually run!
>
> --Ken
There was an updated series on the list with fixed line tokens, a few
unnecessary but harmless 'core' keywords removed and some reviewed-by
tags. :)
I should've posted those as reply-to to this thread, sorry. But since
the changes to the pushed patches are only cosmetical no harm was done.
Thanks for pushing!
Fabian
More information about the mesa-dev
mailing list