Go to the source code of this file.
Data Structures | |
struct | rastpos_stage |
glRasterPos implementation. More... | |
Functions | |
static struct rastpos_stage * | rastpos_stage (struct draw_stage *stage) |
static void | rastpos_flush (struct draw_stage *stage, unsigned flags) |
static void | rastpos_reset_stipple_counter (struct draw_stage *stage) |
static void | rastpos_tri (struct draw_stage *stage, struct prim_header *prim) |
static void | rastpos_line (struct draw_stage *stage, struct prim_header *prim) |
static void | rastpos_destroy (struct draw_stage *stage) |
static void | update_attrib (GLcontext *ctx, const GLuint *outputMapping, const struct vertex_header *vert, GLfloat *dest, GLuint result, GLuint defaultAttrib) |
Update a raster pos attribute from the vertex result if it's present, else copy the current attrib. | |
static void | rastpos_point (struct draw_stage *stage, struct prim_header *prim) |
Normally, this function would render a GL_POINT. | |
static struct rastpos_stage * | new_draw_rastpos_stage (GLcontext *ctx, struct draw_context *draw) |
Create rasterpos "drawing" stage. | |
static void | st_RasterPos (GLcontext *ctx, const GLfloat v[4]) |
void | st_init_rasterpos_functions (struct dd_function_table *functions) |
static struct rastpos_stage* new_draw_rastpos_stage | ( | GLcontext * | ctx, | |
struct draw_context * | draw | |||
) | [static, read] |
Create rasterpos "drawing" stage.
Definition at line 181 of file st_cb_rasterpos.c.
References rastpos_stage::array, rastpos_stage::arrays, CALLOC_STRUCT, rastpos_stage::ctx, draw_stage::destroy, draw_stage::draw, draw_stage::flush, draw_stage::line, draw_stage::next, draw_stage::point, rastpos_stage::prim, rastpos_destroy(), rastpos_flush(), rastpos_line(), rastpos_point(), rastpos_reset_stipple_counter(), rastpos_tri(), draw_stage::reset_stipple_counter, rastpos_stage::stage, and draw_stage::tri.
00182 { 00183 struct rastpos_stage *rs = CALLOC_STRUCT(rastpos_stage); 00184 GLuint i; 00185 00186 rs->stage.draw = draw; 00187 rs->stage.next = NULL; 00188 rs->stage.point = rastpos_point; 00189 rs->stage.line = rastpos_line; 00190 rs->stage.tri = rastpos_tri; 00191 rs->stage.flush = rastpos_flush; 00192 rs->stage.destroy = rastpos_destroy; 00193 rs->stage.reset_stipple_counter = rastpos_reset_stipple_counter; 00194 rs->stage.destroy = rastpos_destroy; 00195 rs->ctx = ctx; 00196 00197 for (i = 0; i < VERT_ATTRIB_MAX; i++) { 00198 rs->array[i].Size = 4; 00199 rs->array[i].Type = GL_FLOAT; 00200 rs->array[i].Stride = 0; 00201 rs->array[i].StrideB = 0; 00202 rs->array[i].Ptr = (GLubyte *) ctx->Current.Attrib[i]; 00203 rs->array[i].Enabled = GL_TRUE; 00204 rs->array[i].Normalized = GL_TRUE; 00205 rs->array[i].BufferObj = NULL; 00206 rs->arrays[i] = &rs->array[i]; 00207 } 00208 00209 rs->prim.mode = GL_POINTS; 00210 rs->prim.indexed = 0; 00211 rs->prim.begin = 1; 00212 rs->prim.end = 1; 00213 rs->prim.weak = 0; 00214 rs->prim.start = 0; 00215 rs->prim.count = 1; 00216 00217 return rs; 00218 }
static void rastpos_destroy | ( | struct draw_stage * | stage | ) | [static] |
static void rastpos_flush | ( | struct draw_stage * | stage, | |
unsigned | flags | |||
) | [static] |
static void rastpos_line | ( | struct draw_stage * | stage, | |
struct prim_header * | prim | |||
) | [static] |
Definition at line 96 of file st_cb_rasterpos.c.
References assert.
00097 { 00098 /* should never get here */ 00099 assert(0); 00100 }
static void rastpos_point | ( | struct draw_stage * | stage, | |
struct prim_header * | prim | |||
) | [static] |
Normally, this function would render a GL_POINT.
Definition at line 133 of file st_cb_rasterpos.c.
References rastpos_stage::ctx, vertex_header::data, rastpos_stage(), st_fb_orientation(), update_attrib(), prim_header::v, st_context::vertex_result_to_slot, and Y_0_TOP.
00134 { 00135 struct rastpos_stage *rs = rastpos_stage(stage); 00136 GLcontext *ctx = rs->ctx; 00137 struct st_context *st = ctx->st; 00138 const GLfloat height = (GLfloat) ctx->DrawBuffer->Height; 00139 const GLuint *outputMapping = st->vertex_result_to_slot; 00140 const GLfloat *pos; 00141 GLuint i; 00142 00143 /* if we get here, we didn't get clipped */ 00144 ctx->Current.RasterPosValid = GL_TRUE; 00145 00146 /* update raster pos */ 00147 pos = prim->v[0]->data[0]; 00148 ctx->Current.RasterPos[0] = pos[0]; 00149 if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) 00150 ctx->Current.RasterPos[1] = height - pos[1]; /* invert Y */ 00151 else 00152 ctx->Current.RasterPos[1] = pos[1]; 00153 ctx->Current.RasterPos[2] = pos[2]; 00154 ctx->Current.RasterPos[3] = pos[3]; 00155 00156 /* update other raster attribs */ 00157 update_attrib(ctx, outputMapping, prim->v[0], 00158 ctx->Current.RasterColor, 00159 VERT_RESULT_COL0, VERT_ATTRIB_COLOR0); 00160 00161 update_attrib(ctx, outputMapping, prim->v[0], 00162 ctx->Current.RasterSecondaryColor, 00163 VERT_RESULT_COL1, VERT_ATTRIB_COLOR1); 00164 00165 for (i = 0; i < MAX_TEXTURE_UNITS; i++) { 00166 update_attrib(ctx, outputMapping, prim->v[0], 00167 ctx->Current.RasterTexCoords[i], 00168 VERT_RESULT_TEX0 + i, VERT_ATTRIB_TEX0 + i); 00169 } 00170 00171 if (ctx->RenderMode == GL_SELECT) { 00172 _mesa_update_hitflag( ctx, ctx->Current.RasterPos[2] ); 00173 } 00174 }
static void rastpos_reset_stipple_counter | ( | struct draw_stage * | stage | ) | [static] |
static struct rastpos_stage* rastpos_stage | ( | struct draw_stage * | stage | ) | [static, read] |
Definition at line 71 of file st_cb_rasterpos.c.
00072 { 00073 return (struct rastpos_stage *) stage; 00074 }
static void rastpos_tri | ( | struct draw_stage * | stage, | |
struct prim_header * | prim | |||
) | [static] |
Definition at line 89 of file st_cb_rasterpos.c.
References assert.
00090 { 00091 /* should never get here */ 00092 assert(0); 00093 }
void st_init_rasterpos_functions | ( | struct dd_function_table * | functions | ) |
Definition at line 258 of file st_cb_rasterpos.c.
References st_RasterPos().
00259 { 00260 functions->RasterPos = st_RasterPos; 00261 }
static void st_RasterPos | ( | GLcontext * | ctx, | |
const GLfloat | v[4] | |||
) | [static] |
Definition at line 222 of file st_cb_rasterpos.c.
References rastpos_stage::array, rastpos_stage::arrays, st_context::draw, draw, draw_set_rasterize_stage(), new_draw_rastpos_stage(), rastpos_stage::prim, rastpos_stage(), st_context::rastpos_stage, st_feedback_draw_vbo(), st_validate_state(), and rastpos_stage::stage.
00223 { 00224 struct st_context *st = ctx->st; 00225 struct draw_context *draw = st->draw; 00226 struct rastpos_stage *rs; 00227 00228 if (st->rastpos_stage) { 00229 /* get rastpos stage info */ 00230 rs = rastpos_stage(st->rastpos_stage); 00231 } 00232 else { 00233 /* create rastpos draw stage */ 00234 rs = new_draw_rastpos_stage(ctx, draw); 00235 st->rastpos_stage = &rs->stage; 00236 } 00237 00238 /* plug our rastpos stage into the draw module */ 00239 draw_set_rasterize_stage(st->draw, st->rastpos_stage); 00240 00241 /* make sure everything's up to date */ 00242 st_validate_state(ctx->st); 00243 00244 /* This will get set only if rastpos_point(), above, gets called */ 00245 ctx->Current.RasterPosValid = GL_FALSE; 00246 00247 /* All vertex attribs but position were previously initialized above. 00248 * Just plug in position pointer now. 00249 */ 00250 rs->array[0].Ptr = (GLubyte *) v; 00251 00252 /* draw the point */ 00253 st_feedback_draw_vbo(ctx, rs->arrays, &rs->prim, 1, NULL, 0, 1); 00254 }
static void update_attrib | ( | GLcontext * | ctx, | |
const GLuint * | outputMapping, | |||
const struct vertex_header * | vert, | |||
GLfloat * | dest, | |||
GLuint | result, | |||
GLuint | defaultAttrib | |||
) | [static] |
Update a raster pos attribute from the vertex result if it's present, else copy the current attrib.
Definition at line 114 of file st_cb_rasterpos.c.
References COPY_4V, and vertex_header::data.
00118 { 00119 const GLfloat *src; 00120 const GLuint k = outputMapping[result]; 00121 if (k != ~0U) 00122 src = vert->data[k]; 00123 else 00124 src = ctx->Current.Attrib[defaultAttrib]; 00125 COPY_4V(dest, src); 00126 }