glamor: Track the next vertex offset as we go in render accel.
I want to extract the VBO mapping code, and as part of that I need to get the global vbo_offset munging to stop. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Markus Wick <markus at selfnet.de>
This commit is contained in:
parent
438d8aceec
commit
03a33048a7
@ -702,7 +702,7 @@ void glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv,
|
|||||||
glamor_composite_shader *shader,
|
glamor_composite_shader *shader,
|
||||||
struct blendinfo *op_info);
|
struct blendinfo *op_info);
|
||||||
|
|
||||||
void glamor_setup_composite_vbo(ScreenPtr screen, int n_verts);
|
void *glamor_setup_composite_vbo(ScreenPtr screen, int n_verts);
|
||||||
|
|
||||||
/* glamor_trapezoid.c */
|
/* glamor_trapezoid.c */
|
||||||
void glamor_trapezoids(CARD8 op,
|
void glamor_trapezoids(CARD8 op,
|
||||||
|
@ -701,7 +701,7 @@ glamor_composite_with_copy(CARD8 op,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void *
|
||||||
glamor_setup_composite_vbo(ScreenPtr screen, int n_verts)
|
glamor_setup_composite_vbo(ScreenPtr screen, int n_verts)
|
||||||
{
|
{
|
||||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||||
@ -765,6 +765,8 @@ glamor_setup_composite_vbo(ScreenPtr screen, int n_verts)
|
|||||||
glEnableVertexAttribArray(GLAMOR_VERTEX_MASK);
|
glEnableVertexAttribArray(GLAMOR_VERTEX_MASK);
|
||||||
}
|
}
|
||||||
glamor_put_context(glamor_priv);
|
glamor_put_context(glamor_priv);
|
||||||
|
|
||||||
|
return glamor_priv->vb + glamor_priv->vbo_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1226,7 +1228,6 @@ glamor_composite_with_shader(CARD8 op,
|
|||||||
GLfloat dst_xscale, dst_yscale;
|
GLfloat dst_xscale, dst_yscale;
|
||||||
GLfloat mask_xscale = 1, mask_yscale = 1, src_xscale = 1, src_yscale = 1;
|
GLfloat mask_xscale = 1, mask_yscale = 1, src_xscale = 1, src_yscale = 1;
|
||||||
struct shader_key key, key_ca;
|
struct shader_key key, key_ca;
|
||||||
float *vertices;
|
|
||||||
int dest_x_off, dest_y_off;
|
int dest_x_off, dest_y_off;
|
||||||
int source_x_off, source_y_off;
|
int source_x_off, source_y_off;
|
||||||
int mask_x_off, mask_y_off;
|
int mask_x_off, mask_y_off;
|
||||||
@ -1303,9 +1304,10 @@ glamor_composite_with_shader(CARD8 op,
|
|||||||
while (nrect) {
|
while (nrect) {
|
||||||
int mrect, rect_processed;
|
int mrect, rect_processed;
|
||||||
int vb_stride;
|
int vb_stride;
|
||||||
|
float *vertices;
|
||||||
|
|
||||||
mrect = nrect > nrect_max ? nrect_max : nrect;
|
mrect = nrect > nrect_max ? nrect_max : nrect;
|
||||||
glamor_setup_composite_vbo(screen, mrect * vert_stride);
|
vertices = glamor_setup_composite_vbo(screen, mrect * vert_stride);
|
||||||
rect_processed = mrect;
|
rect_processed = mrect;
|
||||||
vb_stride = glamor_priv->vb_stride / sizeof(float);
|
vb_stride = glamor_priv->vb_stride / sizeof(float);
|
||||||
while (mrect--) {
|
while (mrect--) {
|
||||||
@ -1331,7 +1333,7 @@ glamor_composite_with_shader(CARD8 op,
|
|||||||
("dest(%d,%d) source(%d %d) mask (%d %d), width %d height %d \n",
|
("dest(%d,%d) source(%d %d) mask (%d %d), width %d height %d \n",
|
||||||
x_dest, y_dest, x_source, y_source, x_mask, y_mask, width,
|
x_dest, y_dest, x_source, y_source, x_mask, y_mask, width,
|
||||||
height);
|
height);
|
||||||
vertices = (float *) (glamor_priv->vb + glamor_priv->vbo_offset);
|
|
||||||
assert(glamor_priv->vbo_offset <
|
assert(glamor_priv->vbo_offset <
|
||||||
glamor_priv->vbo_size - glamor_priv->vb_stride);
|
glamor_priv->vbo_size - glamor_priv->vb_stride);
|
||||||
glamor_set_normalize_vcoords_ext(dest_pixmap_priv, dst_xscale,
|
glamor_set_normalize_vcoords_ext(dest_pixmap_priv, dst_xscale,
|
||||||
@ -1361,10 +1363,14 @@ glamor_composite_with_shader(CARD8 op,
|
|||||||
y_mask + height,
|
y_mask + height,
|
||||||
glamor_priv->yInverted,
|
glamor_priv->yInverted,
|
||||||
vertices, vb_stride);
|
vertices, vb_stride);
|
||||||
|
vertices += 2;
|
||||||
}
|
}
|
||||||
glamor_priv->render_nr_verts += 4;
|
glamor_priv->render_nr_verts += 4;
|
||||||
glamor_priv->vbo_offset += glamor_priv->vb_stride * 4;
|
glamor_priv->vbo_offset += glamor_priv->vb_stride * 4;
|
||||||
rects++;
|
rects++;
|
||||||
|
|
||||||
|
/* We've incremented by one of our 4 verts, now do the other 3. */
|
||||||
|
vertices += 3 * vb_stride;
|
||||||
}
|
}
|
||||||
glamor_flush_composite_rects(screen);
|
glamor_flush_composite_rects(screen);
|
||||||
nrect -= rect_processed;
|
nrect -= rect_processed;
|
||||||
|
Loading…
Reference in New Issue
Block a user