X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fstate_tracker%2Fst_cb_rasterpos.c;h=32d465c5cceee5399c67054120409493337855c6;hb=1dd8e2757852682af44b63193c89dff3c09c7703;hp=3bcccd0df46dc16da818a28e55f2317e04d2cbf2;hpb=3fff84a999e7d564c16846340bb2b7dac75fb8b3;p=mesa.git diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c index 3bcccd0df46..32d465c5cce 100644 --- a/src/mesa/state_tracker/st_cb_rasterpos.c +++ b/src/mesa/state_tracker/st_cb_rasterpos.c @@ -38,19 +38,19 @@ #include "main/imports.h" #include "main/macros.h" +#include "main/mfeatures.h" #include "main/feedback.h" #include "st_context.h" #include "st_atom.h" #include "st_draw.h" #include "st_cb_rasterpos.h" -#include "st_draw.h" #include "draw/draw_context.h" #include "draw/draw_pipe.h" -#include "shader/prog_instruction.h" #include "vbo/vbo.h" +#if FEATURE_rastpos /** * Our special drawing pipeline stage (replaces rasterization). @@ -58,7 +58,7 @@ struct rastpos_stage { struct draw_stage stage; /**< Base class */ - GLcontext *ctx; /**< Rendering context */ + struct gl_context *ctx; /**< Rendering context */ /* vertex attrib info we can setup once and re-use */ struct gl_client_array array[VERT_ATTRIB_MAX]; @@ -102,7 +102,7 @@ rastpos_line( struct draw_stage *stage, struct prim_header *prim ) static void rastpos_destroy(struct draw_stage *stage) { - _mesa_free(stage); + free(stage); } @@ -111,7 +111,7 @@ rastpos_destroy(struct draw_stage *stage) * else copy the current attrib. */ static void -update_attrib(GLcontext *ctx, const GLuint *outputMapping, +update_attrib(struct gl_context *ctx, const GLuint *outputMapping, const struct vertex_header *vert, GLfloat *dest, GLuint result, GLuint defaultAttrib) @@ -133,8 +133,8 @@ static void rastpos_point(struct draw_stage *stage, struct prim_header *prim) { struct rastpos_stage *rs = rastpos_stage(stage); - GLcontext *ctx = rs->ctx; - struct st_context *st = ctx->st; + struct gl_context *ctx = rs->ctx; + struct st_context *st = st_context(ctx); const GLfloat height = (GLfloat) ctx->DrawBuffer->Height; const GLuint *outputMapping = st->vertex_result_to_slot; const GLfloat *pos; @@ -178,7 +178,7 @@ rastpos_point(struct draw_stage *stage, struct prim_header *prim) * Create rasterpos "drawing" stage. */ static struct rastpos_stage * -new_draw_rastpos_stage(GLcontext *ctx, struct draw_context *draw) +new_draw_rastpos_stage(struct gl_context *ctx, struct draw_context *draw) { struct rastpos_stage *rs = ST_CALLOC_STRUCT(rastpos_stage); GLuint i; @@ -220,9 +220,9 @@ new_draw_rastpos_stage(GLcontext *ctx, struct draw_context *draw) static void -st_RasterPos(GLcontext *ctx, const GLfloat v[4]) +st_RasterPos(struct gl_context *ctx, const GLfloat v[4]) { - struct st_context *st = ctx->st; + struct st_context *st = st_context(ctx); struct draw_context *draw = st->draw; struct rastpos_stage *rs; @@ -240,7 +240,7 @@ st_RasterPos(GLcontext *ctx, const GLfloat v[4]) draw_set_rasterize_stage(st->draw, st->rastpos_stage); /* make sure everything's up to date */ - st_validate_state(ctx->st); + st_validate_state(st); /* This will get set only if rastpos_point(), above, gets called */ ctx->Current.RasterPosValid = GL_FALSE; @@ -251,7 +251,15 @@ st_RasterPos(GLcontext *ctx, const GLfloat v[4]) rs->array[0].Ptr = (GLubyte *) v; /* draw the point */ - st_feedback_draw_vbo(ctx, rs->arrays, &rs->prim, 1, NULL, 0, 1); + st_feedback_draw_vbo(ctx, rs->arrays, &rs->prim, 1, NULL, GL_TRUE, 0, 1); + + /* restore draw's rasterization stage depending on rendermode */ + if (ctx->RenderMode == GL_FEEDBACK) { + draw_set_rasterize_stage(draw, st->feedback_stage); + } + else if (ctx->RenderMode == GL_SELECT) { + draw_set_rasterize_stage(draw, st->selection_stage); + } } @@ -260,3 +268,5 @@ void st_init_rasterpos_functions(struct dd_function_table *functions) { functions->RasterPos = st_RasterPos; } + +#endif /* FEATURE_rastpos */