From: Danylo Piliaiev Date: Fri, 12 Jun 2020 13:04:44 +0000 (+0300) Subject: st/mesa: account for "loose", per-mipmap level textures in CopyImageSubData X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8ce8895b69a7523513eceed096233c3a348880a7;p=mesa.git st/mesa: account for "loose", per-mipmap level textures in CopyImageSubData We may have "loose", per-image gallium resources. The src_image->Level may not match the gallium resource texture level. In such case it is prescribed (in st_AllocTextureImageBuffer) to specify mipmap level as zero. Fixes: f04f13622f3e71bee057d60a6be9c53b92b56cc9 Signed-off-by: Danylo Piliaiev Reviewed-by: Marek Olšák Part-of: --- diff --git a/src/mesa/state_tracker/st_cb_copyimage.c b/src/mesa/state_tracker/st_cb_copyimage.c index a58cdf62703..5d9c77fdede 100644 --- a/src/mesa/state_tracker/st_cb_copyimage.c +++ b/src/mesa/state_tracker/st_cb_copyimage.c @@ -645,8 +645,9 @@ st_CopyImageSubData(struct gl_context *ctx, if (src_image) { struct st_texture_image *src = st_texture_image(src_image); + struct st_texture_object *stObj = st_texture_object(src_image->TexObject); src_res = src->pt; - src_level = src_image->Level; + src_level = stObj->pt != src_res ? 0 : src_image->Level; src_z += src_image->Face; if (src_image->TexObject->Immutable) { src_level += src_image->TexObject->MinLevel; @@ -660,8 +661,9 @@ st_CopyImageSubData(struct gl_context *ctx, if (dst_image) { struct st_texture_image *dst = st_texture_image(dst_image); + struct st_texture_object *stObj = st_texture_object(dst_image->TexObject); dst_res = dst->pt; - dst_level = dst_image->Level; + dst_level = stObj->pt != dst_res ? 0 : dst_image->Level; dst_z += dst_image->Face; if (dst_image->TexObject->Immutable) { dst_level += dst_image->TexObject->MinLevel;