aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2015-09-15 19:32:10 -0400
committerEmil Velikov <[email protected]>2015-09-17 14:59:08 +0100
commit8fd7f10ae0583f8e01f0b9e8e1130113ca18945c (patch)
treee253ae09363345bd080277dab5631ece5319aa85
parenta9df9b1854081a933a86c74e173a82bfb29fbe92 (diff)
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 <[email protected]> Cc: "10.6 11.0" <[email protected]> Reviewed-by: Glenn Kennard <[email protected]> (cherry picked from commit eb081681df248750727a8a76436760d617b4a6a9)
-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 a1c181cfe49..a019c34aefb 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -253,8 +253,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;