diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index cc0651ab46c..50f3cea7b00 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -732,7 +732,11 @@ lp_setup_set_fs_images(struct lp_setup_context *setup, if (llvmpipe_resource_is_texture(res)) { uint32_t mip_offset = lp_res->mip_offsets[image->u.tex.level]; + const uint32_t bw = util_format_get_blockwidth(image->resource->format); + const uint32_t bh = util_format_get_blockheight(image->resource->format); + jit_image->width = DIV_ROUND_UP(jit_image->width, bw); + jit_image->height = DIV_ROUND_UP(jit_image->height, bh); jit_image->width = u_minify(jit_image->width, image->u.tex.level); jit_image->height = u_minify(jit_image->height, image->u.tex.level); diff --git a/src/gallium/drivers/llvmpipe/lp_state_cs.c b/src/gallium/drivers/llvmpipe/lp_state_cs.c index c655a5477a9..fb86e544ca8 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_cs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_cs.c @@ -1150,7 +1150,11 @@ lp_csctx_set_cs_images(struct lp_cs_context *csctx, if (llvmpipe_resource_is_texture(res)) { uint32_t mip_offset = lp_res->mip_offsets[image->u.tex.level]; + const uint32_t bw = util_format_get_blockwidth(image->resource->format); + const uint32_t bh = util_format_get_blockheight(image->resource->format); + jit_image->width = DIV_ROUND_UP(jit_image->width, bw); + jit_image->height = DIV_ROUND_UP(jit_image->height, bh); jit_image->width = u_minify(jit_image->width, image->u.tex.level); jit_image->height = u_minify(jit_image->height, image->u.tex.level); diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c index aa47cab3ab6..b5e8c31c729 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c +++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c @@ -469,11 +469,19 @@ prepare_shader_images( if (!img) continue; - unsigned width = u_minify(img->width0, view->u.tex.level); - unsigned height = u_minify(img->height0, view->u.tex.level); + unsigned width = img->width0; + unsigned height = img->height0; unsigned num_layers = img->depth0; unsigned num_samples = img->nr_samples; + const uint32_t bw = util_format_get_blockwidth(view->resource->format); + const uint32_t bh = util_format_get_blockheight(view->resource->format); + + width = DIV_ROUND_UP(width, bw); + height = DIV_ROUND_UP(height, bh); + width = u_minify(width, view->u.tex.level); + height = u_minify(height, view->u.tex.level); + if (!lp_img->dt) { /* regular texture - setup array of mipmap level offsets */ struct pipe_resource *res = view->resource;