diff options
author | Nicolai Hähnle <[email protected]> | 2017-06-06 19:21:26 +0200 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2017-06-19 12:05:15 +0200 |
commit | 25e5534734b7de2a2359c42eeff5fd0c3c0507da (patch) | |
tree | 23eda6264ab465407c3f1dfad30c3ca7876b7968 | |
parent | 4d5bb1b9877aecaefec53fca231a3df25e101e9a (diff) |
gallium/radeon/gfx9: fix PBO texture uploads to compressed textures
st/mesa creates a surface that reinterprets the compressed blocks as
RGBA16UI or RGBA32UI. We have to adjust width0 & height0 accordingly to
avoid out-of-bounds memory accesses by CB.
Cc: 17.1 <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r-- | src/gallium/drivers/radeon/r600_texture.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index 25abdd69125..d0492d68c9c 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -1967,6 +1967,8 @@ static struct pipe_surface *r600_create_surface(struct pipe_context *pipe, unsigned level = templ->u.tex.level; unsigned width = u_minify(tex->width0, level); unsigned height = u_minify(tex->height0, level); + unsigned width0 = tex->width0; + unsigned height0 = tex->height0; if (tex->target != PIPE_BUFFER && templ->format != tex->format) { const struct util_format_description *tex_desc @@ -1985,11 +1987,14 @@ static struct pipe_surface *r600_create_surface(struct pipe_context *pipe, width = nblks_x * templ_desc->block.width; height = nblks_y * templ_desc->block.height; + + width0 = util_format_get_nblocksx(tex->format, width0); + height0 = util_format_get_nblocksy(tex->format, height0); } } return r600_create_surface_custom(pipe, tex, templ, - tex->width0, tex->height0, + width0, height0, width, height); } |