From bf8a187f71bd667a0dc0f70164a897d8e62361a8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 27 Feb 2009 22:18:33 -0700 Subject: [PATCH] mesa: replace FEEDBACK_TOKEN macro with _mesa_feedback_token() inline function --- src/mesa/main/drawpix.c | 8 ++++---- src/mesa/main/feedback.c | 31 ++++++++++++++++--------------- src/mesa/main/feedback.h | 17 ++++++++++------- src/mesa/swrast/s_feedback.c | 8 ++++---- 4 files changed, 34 insertions(+), 30 deletions(-) diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index 13cfa0e756e..e9de0c097a0 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -103,7 +103,7 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, else if (ctx->RenderMode == GL_FEEDBACK) { /* Feedback the current raster pos info */ FLUSH_CURRENT( ctx, 0 ); - FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); + _mesa_feedback_token( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); _mesa_feedback_vertex( ctx, ctx->Current.RasterPos, ctx->Current.RasterColor, @@ -166,7 +166,7 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, } else if (ctx->RenderMode == GL_FEEDBACK) { FLUSH_CURRENT( ctx, 0 ); - FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_COPY_PIXEL_TOKEN ); + _mesa_feedback_token( ctx, (GLfloat) (GLint) GL_COPY_PIXEL_TOKEN ); _mesa_feedback_vertex( ctx, ctx->Current.RasterPos, ctx->Current.RasterColor, @@ -243,7 +243,7 @@ _mesa_Bitmap( GLsizei width, GLsizei height, #if _HAVE_FULL_GL else if (ctx->RenderMode == GL_FEEDBACK) { FLUSH_CURRENT(ctx, 0); - FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_BITMAP_TOKEN ); + _mesa_feedback_token( ctx, (GLfloat) (GLint) GL_BITMAP_TOKEN ); _mesa_feedback_vertex( ctx, ctx->Current.RasterPos, ctx->Current.RasterColor, @@ -311,7 +311,7 @@ _mesa_DrawDepthPixelsMESA( GLsizei width, GLsizei height, else if (ctx->RenderMode == GL_FEEDBACK) { /* Feedback the current raster pos info */ FLUSH_CURRENT( ctx, 0 ); - FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); + _mesa_feedback_token( ctx, (GLfloat) (GLint) GL_DRAW_PIXEL_TOKEN ); _mesa_feedback_vertex( ctx, ctx->Current.RasterPos, ctx->Current.RasterColor, diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c index 9a62db0be3b..5073ccbef59 100644 --- a/src/mesa/main/feedback.c +++ b/src/mesa/main/feedback.c @@ -111,8 +111,8 @@ _mesa_PassThrough( GLfloat token ) if (ctx->RenderMode==GL_FEEDBACK) { FLUSH_VERTICES(ctx, 0); - FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_PASS_THROUGH_TOKEN ); - FEEDBACK_TOKEN( ctx, token ); + _mesa_feedback_token( ctx, (GLfloat) (GLint) GL_PASS_THROUGH_TOKEN ); + _mesa_feedback_token( ctx, token ); } } @@ -127,31 +127,32 @@ _mesa_feedback_vertex(GLcontext *ctx, GLfloat index, const GLfloat texcoord[4]) { - FEEDBACK_TOKEN( ctx, win[0] ); - FEEDBACK_TOKEN( ctx, win[1] ); + _mesa_feedback_token( ctx, win[0] ); + _mesa_feedback_token( ctx, win[1] ); if (ctx->Feedback._Mask & FB_3D) { - FEEDBACK_TOKEN( ctx, win[2] ); + _mesa_feedback_token( ctx, win[2] ); } if (ctx->Feedback._Mask & FB_4D) { - FEEDBACK_TOKEN( ctx, win[3] ); + _mesa_feedback_token( ctx, win[3] ); } if (ctx->Feedback._Mask & FB_INDEX) { - FEEDBACK_TOKEN( ctx, (GLfloat) index ); + _mesa_feedback_token( ctx, (GLfloat) index ); } if (ctx->Feedback._Mask & FB_COLOR) { - FEEDBACK_TOKEN( ctx, color[0] ); - FEEDBACK_TOKEN( ctx, color[1] ); - FEEDBACK_TOKEN( ctx, color[2] ); - FEEDBACK_TOKEN( ctx, color[3] ); + _mesa_feedback_token( ctx, color[0] ); + _mesa_feedback_token( ctx, color[1] ); + _mesa_feedback_token( ctx, color[2] ); + _mesa_feedback_token( ctx, color[3] ); } if (ctx->Feedback._Mask & FB_TEXTURE) { - FEEDBACK_TOKEN( ctx, texcoord[0] ); - FEEDBACK_TOKEN( ctx, texcoord[1] ); - FEEDBACK_TOKEN( ctx, texcoord[2] ); - FEEDBACK_TOKEN( ctx, texcoord[3] ); + _mesa_feedback_token( ctx, texcoord[0] ); + _mesa_feedback_token( ctx, texcoord[1] ); + _mesa_feedback_token( ctx, texcoord[2] ); + _mesa_feedback_token( ctx, texcoord[3] ); } } + #endif /* _HAVE_FULL_GL */ diff --git a/src/mesa/main/feedback.h b/src/mesa/main/feedback.h index c6478b02e10..72c2acd5edd 100644 --- a/src/mesa/main/feedback.h +++ b/src/mesa/main/feedback.h @@ -30,13 +30,6 @@ #include "mtypes.h" -#define FEEDBACK_TOKEN( CTX, T ) \ - if (CTX->Feedback.Count < CTX->Feedback.BufferSize) { \ - CTX->Feedback.Buffer[CTX->Feedback.Count] = (GLfloat) (T); \ - } \ - CTX->Feedback.Count++; - - extern void _mesa_init_feedback( GLcontext *ctx ); @@ -48,6 +41,16 @@ _mesa_feedback_vertex( GLcontext *ctx, const GLfloat texcoord[4] ); +static INLINE void +_mesa_feedback_token( GLcontext *ctx, GLfloat token ) +{ + if (ctx->Feedback.Count < ctx->Feedback.BufferSize) { + ctx->Feedback.Buffer[ctx->Feedback.Count] = token; + } + ctx->Feedback.Count++; +} + + extern void _mesa_update_hitflag( GLcontext *ctx, GLfloat z ); diff --git a/src/mesa/swrast/s_feedback.c b/src/mesa/swrast/s_feedback.c index aa79531277c..7bb914b6589 100644 --- a/src/mesa/swrast/s_feedback.c +++ b/src/mesa/swrast/s_feedback.c @@ -59,8 +59,8 @@ _swrast_feedback_triangle(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2) { if (_swrast_culltriangle(ctx, v0, v1, v2)) { - FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN); - FEEDBACK_TOKEN(ctx, (GLfloat) 3); /* three vertices */ + _mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN); + _mesa_feedback_token(ctx, (GLfloat) 3); /* three vertices */ if (ctx->Light.ShadeModel == GL_SMOOTH) { feedback_vertex(ctx, v0, v0); @@ -86,7 +86,7 @@ _swrast_feedback_line(GLcontext *ctx, const SWvertex *v0, if (swrast->StippleCounter == 0) token = GL_LINE_RESET_TOKEN; - FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) token); + _mesa_feedback_token(ctx, (GLfloat) (GLint) token); if (ctx->Light.ShadeModel == GL_SMOOTH) { feedback_vertex(ctx, v0, v0); @@ -104,7 +104,7 @@ _swrast_feedback_line(GLcontext *ctx, const SWvertex *v0, void _swrast_feedback_point(GLcontext *ctx, const SWvertex *v) { - FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) GL_POINT_TOKEN); + _mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POINT_TOKEN); feedback_vertex(ctx, v, v); } -- 2.30.2