summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_cb_feedback.c29
-rw-r--r--src/mesa/state_tracker/st_draw.c30
-rw-r--r--src/mesa/tnl/t_vp_build.c7
3 files changed, 43 insertions, 23 deletions
diff --git a/src/mesa/state_tracker/st_cb_feedback.c b/src/mesa/state_tracker/st_cb_feedback.c
index 5e334e3c857..923e1cdb893 100644
--- a/src/mesa/state_tracker/st_cb_feedback.c
+++ b/src/mesa/state_tracker/st_cb_feedback.c
@@ -93,8 +93,9 @@ feedback_vertex(GLcontext *ctx, const struct draw_context *draw,
const GLfloat ci = 0;
GLuint slot;
+ /* Recall that Y=0=Top of window for Gallium wincoords */
win[0] = v->data[0][0];
- win[1] = v->data[0][1];
+ win[1] = ctx->DrawBuffer->Height - v->data[0][1];
win[2] = v->data[0][2];
win[3] = 1.0F / v->data[0][3];
@@ -104,13 +105,13 @@ feedback_vertex(GLcontext *ctx, const struct draw_context *draw,
*/
slot = st->vertex_result_to_slot[VERT_RESULT_COL0];
- if (slot)
+ if (slot != ~0)
color = v->data[slot];
else
color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
slot = st->vertex_result_to_slot[VERT_RESULT_TEX0];
- if (slot)
+ if (slot != ~0)
texcoord = v->data[slot];
else
texcoord = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
@@ -294,13 +295,6 @@ st_RenderMode(GLcontext *ctx, GLenum newMode )
draw_set_rasterize_stage(draw, st->selection_stage);
/* Plug in new vbo draw function */
vbo->draw_prims = st_feedback_draw_vbo;
- /* setup post-transform vertex attribs */
- {
- /* just emit pos as GLfloat[4] */
- static const uint attrs[1] = { FORMAT_4F };
- const interp_mode *interp = NULL;
- draw_set_vertex_attributes(draw, attrs, interp, 1);
- }
}
else {
if (!st->feedback_stage)
@@ -308,19 +302,8 @@ st_RenderMode(GLcontext *ctx, GLenum newMode )
draw_set_rasterize_stage(draw, st->feedback_stage);
/* Plug in new vbo draw function */
vbo->draw_prims = st_feedback_draw_vbo;
- /* setup post-transform vertex attribs */
- {
- /* emit all attribs as GLfloat[4] */
- uint attrs[PIPE_MAX_SHADER_OUTPUTS];
- interp_mode interp[PIPE_MAX_SHADER_OUTPUTS];
- GLuint n = st->state.vs->state.num_outputs;
- GLuint i;
- for (i = 0; i < n; i++) {
- attrs[i] = FORMAT_4F;
- interp[i] = INTERP_NONE;
- }
- draw_set_vertex_attributes(draw, attrs, interp, n);
- }
+ /* need to generate/use a vertex program that emits pos/color/tex */
+ st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
}
}
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 7fcc4d8e65f..1806a1888ba 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -310,6 +310,35 @@ st_draw_vertices(GLcontext *ctx, unsigned prim,
}
+/**
+ * Set the (private) draw module's post-transformed vertex format when in
+ * GL_SELECT or GL_FEEDBACK mode.
+ */
+static void
+set_feedback_vertex_format(GLcontext *ctx)
+{
+ struct st_context *st = ctx->st;
+ uint attrs[PIPE_MAX_SHADER_OUTPUTS];
+ interp_mode interp[PIPE_MAX_SHADER_OUTPUTS];
+ GLuint n, i;
+
+ if (ctx->RenderMode == GL_FEEDBACK) {
+ /* emit all attribs (pos, color, texcoord) as GLfloat[4] */
+ n = st->state.vs->state.num_outputs;
+ for (i = 0; i < n; i++) {
+ attrs[i] = FORMAT_4F;
+ interp[i] = INTERP_NONE;
+ }
+ }
+ else {
+ assert(ctx->RenderMode == GL_SELECT);
+ n = 1;
+ attrs[0] = FORMAT_4F;
+ interp[0] = INTERP_NONE;
+ }
+
+ draw_set_vertex_attributes(st->draw, attrs, interp, n);
+}
/**
@@ -359,6 +388,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
draw_set_clip_state(draw, &st->state.clip);
draw_set_rasterizer_state(draw, &st->state.rasterizer->state);
draw_bind_vertex_shader(draw, st->state.vs->data);
+ set_feedback_vertex_format(ctx);
/* loop over TGSI shader inputs to determine vertex buffer
* and attribute info
diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c
index b28102b1b91..a588b0d16b0 100644
--- a/src/mesa/tnl/t_vp_build.c
+++ b/src/mesa/tnl/t_vp_build.c
@@ -134,6 +134,13 @@ static struct state_key *make_state_key( GLcontext *ctx )
assert(fp);
key->fragprog_inputs_read = fp->Base.InputsRead;
+ if (ctx->RenderMode == GL_FEEDBACK) {
+ /* This is a bit of a hack, but you can imagine feedback mode as using
+ * a special no-op fragment shader that just requires particular
+ * inputs (inputs which satisfy feedback mode).
+ */
+ key->fragprog_inputs_read |= FRAG_BIT_COL0 | FRAG_BIT_TEX0;
+ }
key->separate_specular = (ctx->Light.Model.ColorControl ==
GL_SEPARATE_SPECULAR_COLOR);