X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmesa%2Fstate_tracker%2Fst_cb_rasterpos.c;h=32d465c5cceee5399c67054120409493337855c6;hb=1dd8e2757852682af44b63193c89dff3c09c7703;hp=8867ca5652efa755df009cef13faa8174876f0f4;hpb=4df482086ebf0663c708b089d8d8d22de0ef972c;p=mesa.git diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c index 8867ca5652e..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]; @@ -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,9 +178,9 @@ 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 = CALLOC_STRUCT(rastpos_stage); + struct rastpos_stage *rs = ST_CALLOC_STRUCT(rastpos_stage); GLuint i; rs->stage.draw = draw; @@ -194,9 +194,10 @@ new_draw_rastpos_stage(GLcontext *ctx, struct draw_context *draw) rs->stage.destroy = rastpos_destroy; rs->ctx = ctx; - for (i = 0; i < VERT_ATTRIB_MAX; i++) { + for (i = 0; i < Elements(rs->array); i++) { rs->array[i].Size = 4; rs->array[i].Type = GL_FLOAT; + rs->array[i].Format = GL_RGBA; rs->array[i].Stride = 0; rs->array[i].StrideB = 0; rs->array[i].Ptr = (GLubyte *) ctx->Current.Attrib[i]; @@ -219,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; @@ -239,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; @@ -250,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); + } } @@ -259,3 +268,5 @@ void st_init_rasterpos_functions(struct dd_function_table *functions) { functions->RasterPos = st_RasterPos; } + +#endif /* FEATURE_rastpos */