summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnuj Phogat <anuj.phogat@gmail.com>2016-03-09 16:39:34 -0800
committerAnuj Phogat <anuj.phogat@gmail.com>2016-05-03 03:43:18 -0700
commitec60b3da695f7a80b0efd1335aa34d0aa4ddbe9a (patch)
treec140ad48ef5ab398d5e79f88d4f5eb68992b4349
parent5713461ae7e24d5392c45e130f10c719e61efa79 (diff)
downloadexternal_mesa3d-ec60b3da695f7a80b0efd1335aa34d0aa4ddbe9a.zip
external_mesa3d-ec60b3da695f7a80b0efd1335aa34d0aa4ddbe9a.tar.gz
external_mesa3d-ec60b3da695f7a80b0efd1335aa34d0aa4ddbe9a.tar.bz2
mesa: Handle 3d block sizes in getteximage error checks
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com> Reviewed-by: Brian Paul <brianp@vmware.com>
-rw-r--r--src/mesa/main/texgetimage.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 06bc8f1..4ac0ad4 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -1037,9 +1037,9 @@ dimensions_error_check(struct gl_context *ctx,
/* Extra checks for compressed textures */
{
- GLuint bw, bh;
- _mesa_get_format_block_size(texImage->TexFormat, &bw, &bh);
- if (bw > 1 || bh > 1) {
+ GLuint bw, bh, bd;
+ _mesa_get_format_block_size_3d(texImage->TexFormat, &bw, &bh, &bd);
+ if (bw > 1 || bh > 1 || bd > 1) {
/* offset must be multiple of block size */
if (xoffset % bw != 0) {
_mesa_error(ctx, GL_INVALID_VALUE,
@@ -1054,7 +1054,13 @@ dimensions_error_check(struct gl_context *ctx,
}
}
- /* The size must be a multiple of bw x bh, or we must be using a
+ if (zoffset % bd != 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "%s(zoffset = %d)", caller, zoffset);
+ return true;
+ }
+
+ /* The size must be a multiple of bw x bh x bd, or we must be using a
* offset+size that exactly hits the edge of the image.
*/
if ((width % bw != 0) &&
@@ -1070,6 +1076,13 @@ dimensions_error_check(struct gl_context *ctx,
"%s(height = %d)", caller, height);
return true;
}
+
+ if ((depth % bd != 0) &&
+ (zoffset + depth != (GLint) texImage->Depth)) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "%s(depth = %d)", caller, depth);
+ return true;
+ }
}
}