GLfloat color[4];
+ /** Bitmap's Z position */
+ GLfloat zpos;
+
struct pipe_texture *texture;
struct pipe_transfer *trans;
};
+/** Epsilon for Z comparisons */
+#define Z_EPSILON 1e-06
/**
}
/* draw textured quad */
- offset = setup_bitmap_vertex_data(st, x, y, width, height,
- ctx->Current.RasterPos[2],
- color);
+ offset = setup_bitmap_vertex_data(st, x, y, width, height, z, color);
util_draw_vertex_buffer(pipe, st->bitmap.vbuf, offset,
PIPE_PRIM_TRIANGLE_FAN,
draw_bitmap_quad(st->ctx,
cache->xpos,
cache->ypos,
- st->ctx->Current.RasterPos[2],
+ cache->zpos,
BITMAP_CACHE_WIDTH, BITMAP_CACHE_HEIGHT,
cache->texture,
cache->color);
{
struct bitmap_cache *cache = st->bitmap.cache;
int px = -999, py;
+ const GLfloat z = st->ctx->Current.RasterPos[2];
if (width > BITMAP_CACHE_WIDTH ||
height > BITMAP_CACHE_HEIGHT)
py = y - cache->ypos;
if (px < 0 || px + width > BITMAP_CACHE_WIDTH ||
py < 0 || py + height > BITMAP_CACHE_HEIGHT ||
- !TEST_EQ_4V(st->ctx->Current.RasterColor, cache->color)) {
+ !TEST_EQ_4V(st->ctx->Current.RasterColor, cache->color) ||
+ ((fabs(z - cache->zpos) > Z_EPSILON))) {
/* This bitmap would extend beyond cache bounds, or the bitmap
* color is changing
* so flush and continue.
py = (BITMAP_CACHE_HEIGHT - height) / 2;
cache->xpos = x;
cache->ypos = y - py;
+ cache->zpos = z;
cache->empty = GL_FALSE;
COPY_4FV(cache->color, st->ctx->Current.RasterColor);
}