diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 8b593719426..aff4ae81b60 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -485,6 +485,10 @@ search_drawpixels_cache(struct st_context *st, entry->image) { assert(entry->texture); + if (memcmp(&entry->pixelmaps, &st->ctx->PixelMaps, + sizeof(struct gl_pixelmaps)) != 0) + continue; + /* check if the pixel data is the same */ if (memcmp(pixels, entry->image, width * height * bpp) == 0) { /* Success - found a cache match */ @@ -555,6 +559,8 @@ cache_drawpixels_image(struct st_context *st, entry->height = height; entry->format = format; entry->type = type; + memcpy(&entry->pixelmaps, &st->ctx->PixelMaps, + sizeof(struct gl_pixelmaps)); entry->user_pointer = pixels; free(entry->image); entry->image = malloc(width * height * bpp); diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 5787b6adb29..fca561316fd 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -93,6 +93,7 @@ struct drawpix_cache_entry { GLsizei width, height; GLenum format, type; + struct gl_pixelmaps pixelmaps; const void *user_pointer; /**< Last user 'pixels' pointer */ void *image; /**< Copy of the glDrawPixels image data */ struct pipe_resource *texture;