summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_atom_texture.c
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2015-09-15 19:32:10 -0400
committerIlia Mirkin <imirkin@alum.mit.edu>2015-09-16 12:51:58 -0400
commiteb081681df248750727a8a76436760d617b4a6a9 (patch)
treeaa46019ab0d6efc10b064cc87d5cc116fcc6c522 /src/mesa/state_tracker/st_atom_texture.c
parent1aff899a874abddc2d79e595242a233e874e4a96 (diff)
downloadexternal_mesa3d-eb081681df248750727a8a76436760d617b4a6a9.zip
external_mesa3d-eb081681df248750727a8a76436760d617b4a6a9.tar.gz
external_mesa3d-eb081681df248750727a8a76436760d617b4a6a9.tar.bz2
st/mesa: avoid integer overflows with buffers >= 512MB
This fixes failures with the newly-submitted max-size texture buffer piglit test for GPUs exposing >= 128M max texels. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Diffstat (limited to 'src/mesa/state_tracker/st_atom_texture.c')
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index 31e0f6b..3e37752 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -274,8 +274,8 @@ st_create_texture_sampler_view_from_stobj(struct pipe_context *pipe,
return NULL;
size = MIN2(stObj->pt->width0 - base, (unsigned)stObj->base.BufferSize);
- f = ((base * 8) / desc->block.bits) * desc->block.width;
- n = ((size * 8) / desc->block.bits) * desc->block.width;
+ f = (base / (desc->block.bits / 8)) * desc->block.width;
+ n = (size / (desc->block.bits / 8)) * desc->block.width;
if (!n)
return NULL;
templ.u.buf.first_element = f;