static void feedback_tri( struct draw_stage *stage, struct prim_header *prim ) { struct feedback_stage *fs = feedback_stage(stage); struct draw_context *draw = stage->draw; _mesa_feedback_token(fs->ctx, (GLfloat) GL_POLYGON_TOKEN); _mesa_feedback_token(fs->ctx, (GLfloat) 3); /* three vertices */ feedback_vertex(fs->ctx, draw, prim->v[0]); feedback_vertex(fs->ctx, draw, prim->v[1]); feedback_vertex(fs->ctx, draw, prim->v[2]); }
/* * Put triangle in feedback buffer. */ void gl_feedback_triangle( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv ) { if (gl_cull_triangle( ctx, v0, v1, v2, 0 )) { FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_POLYGON_TOKEN ); FEEDBACK_TOKEN( ctx, (GLfloat) 3 ); /* three vertices */ feedback_vertex( ctx, v0, pv ); feedback_vertex( ctx, v1, pv ); feedback_vertex( ctx, v2, pv ); } }
void gl_feedback_line( GLcontext *ctx, GLuint v1, GLuint v2, GLuint pv ) { GLenum token = GL_LINE_TOKEN; if (ctx->StippleCounter==0) token = GL_LINE_RESET_TOKEN; FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) token ); feedback_vertex( ctx, v1, pv ); feedback_vertex( ctx, v2, pv ); ctx->StippleCounter++; }
static void feedback_line( struct draw_stage *stage, struct prim_header *prim ) { struct feedback_stage *fs = feedback_stage(stage); struct draw_context *draw = stage->draw; if (fs->reset_stipple_counter) { _mesa_feedback_token(fs->ctx, (GLfloat) GL_LINE_RESET_TOKEN); fs->reset_stipple_counter = GL_FALSE; } else { _mesa_feedback_token(fs->ctx, (GLfloat) GL_LINE_TOKEN); } feedback_vertex(fs->ctx, draw, prim->v[0]); feedback_vertex(fs->ctx, draw, prim->v[1]); }
static void feedback_point( struct draw_stage *stage, struct prim_header *prim ) { struct feedback_stage *fs = feedback_stage(stage); struct draw_context *draw = stage->draw; _mesa_feedback_token(fs->ctx, (GLfloat) GL_POINT_TOKEN); feedback_vertex(fs->ctx, draw, prim->v[0]); }
void _swrast_feedback_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) { GLenum token = GL_LINE_TOKEN; SWcontext *swrast = SWRAST_CONTEXT(ctx); if (swrast->StippleCounter==0) token = GL_LINE_RESET_TOKEN; FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) token ); if (ctx->Light.ShadeModel == GL_SMOOTH) { feedback_vertex( ctx, v0, v0 ); feedback_vertex( ctx, v1, v1 ); } else { feedback_vertex( ctx, v0, v1 ); feedback_vertex( ctx, v1, v1 ); } swrast->StippleCounter++; }
void gl_feedback_points( GLcontext *ctx, GLuint first, GLuint last ) { const struct vertex_buffer *VB = ctx->VB; GLuint i; for (i=first;i<last;i++) { if (VB->ClipMask[i]==0) { FEEDBACK_TOKEN( ctx, (GLfloat) (GLint) GL_POINT_TOKEN ); feedback_vertex( ctx, i, i ); } } }
/* * Put triangle in feedback buffer. */ void _swrast_feedback_triangle(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1, const SWvertex *v2) { if (!_swrast_culltriangle(ctx, v0, v1, v2)) { _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); feedback_vertex(ctx, v1, v1); feedback_vertex(ctx, v2, v2); } else { feedback_vertex(ctx, v0, v2); feedback_vertex(ctx, v1, v2); feedback_vertex(ctx, v2, v2); } } }
/* * Put triangle in feedback buffer. */ void _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 */ if (ctx->Light.ShadeModel == GL_SMOOTH) { feedback_vertex(ctx, v0, v0); feedback_vertex(ctx, v1, v1); feedback_vertex(ctx, v2, v2); } else { feedback_vertex(ctx, v0, v2); feedback_vertex(ctx, v1, v2); feedback_vertex(ctx, v2, v2); } } }
void _swrast_feedback_point(struct gl_context *ctx, const SWvertex *v) { _mesa_feedback_token(ctx, (GLfloat) (GLint) GL_POINT_TOKEN); feedback_vertex(ctx, v, v); }
void gl_feedback_block(block_t *block) { if (block->len == 0) { return; } int size = feedback_sizeof(state.feedback.type); GLfloat *v, *c, *t; int v1, v2, v3; int first = _index(block, 0); for (int j = 0; j < block->len; j++) { int i = _index(block, j); v2 = v1; v3 = v2; v1 = i; // TODO: overflow'd feedback returns -1 in glRenderMode #define polygon(n) { if (feedback_overflow(size * n)) return; feedback_polygon(n); state.feedback.values -= 1; } switch (block->mode) { case GL_LINES: if (i % 2 == 1) { polygon(2); feedback_vertex(block, v2); feedback_vertex(block, v1); } break; case GL_LINE_LOOP: // catch the loop segment if (i == block->len - 1) { polygon(2); feedback_vertex(block, v1); feedback_vertex(block, first); } case GL_LINE_STRIP: if (i > 0) { polygon(2); feedback_vertex(block, v2); feedback_vertex(block, v1); } break; case GL_TRIANGLES: if (i % 3 == 2) { polygon(3); feedback_vertex(block, v3); feedback_vertex(block, v2); feedback_vertex(block, v1); } case GL_TRIANGLE_FAN: if (i > 1) { polygon(3); feedback_vertex(block, v2); feedback_vertex(block, v1); feedback_vertex(block, first); } break; case GL_TRIANGLE_STRIP: if (i > 1) { polygon(3); feedback_vertex(block, v3); feedback_vertex(block, v2); feedback_vertex(block, v1); } break; case GL_POINTS: polygon(1); feedback_vertex(block, v1); break; default: printf("warning: unsupported GL_SELECT mode: %s\n", gl_str(block->mode)); return; } } }
void _swrast_feedback_point(GLcontext *ctx, const SWvertex *v) { FEEDBACK_TOKEN(ctx, (GLfloat) (GLint) GL_POINT_TOKEN); feedback_vertex(ctx, v, v); }