mesa/st: take pixelmaps in to account in drawpixels cache

Otherwise we might use cache item with different mapping.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12492
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33191>
This commit is contained in:
Tapani Pälli
2025-01-23 15:06:07 +02:00
committed by Marge Bot
parent c172f6ef01
commit e28f24fbf2
2 changed files with 7 additions and 0 deletions
@@ -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);
+1
View File
@@ -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;