Mesa (master): mesa: Handle 3d block sizes in teximage error checks
Anuj Phogat
aphogat at kemper.freedesktop.org
Tue May 3 10:39:58 UTC 2016
Module: Mesa
Branch: master
Commit: 84a44844f2ca90be40579a76651b8fdc2b859dda
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=84a44844f2ca90be40579a76651b8fdc2b859dda
Author: Anuj Phogat <anuj.phogat at gmail.com>
Date: Thu Feb 11 10:06:13 2016 -0800
mesa: Handle 3d block sizes in teximage error checks
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
---
src/mesa/main/teximage.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 6b0744b..7cf15f5 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1112,7 +1112,7 @@ error_check_subtexture_dimensions(struct gl_context *ctx, GLuint dims,
GLsizei subDepth, const char *func)
{
const GLenum target = destImage->TexObject->Target;
- GLuint bw, bh;
+ GLuint bw, bh, bd;
/* Check size */
if (subWidth < 0) {
@@ -1185,14 +1185,14 @@ error_check_subtexture_dimensions(struct gl_context *ctx, GLuint dims,
* compressed formats supported by Mesa allow sub-textures to be updated
* along compressed block boundaries.
*/
- _mesa_get_format_block_size(destImage->TexFormat, &bw, &bh);
+ _mesa_get_format_block_size_3d(destImage->TexFormat, &bw, &bh, &bd);
- if (bw != 1 || bh != 1) {
+ if (bw != 1 || bh != 1 || bd != 1) {
/* offset must be multiple of block size */
- if ((xoffset % bw != 0) || (yoffset % bh != 0)) {
+ if ((xoffset % bw != 0) || (yoffset % bh != 0) || (zoffset % bd != 0)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "%s(xoffset = %d, yoffset = %d)",
- func, xoffset, yoffset);
+ "%s(xoffset = %d, yoffset = %d, zoffset = %d)",
+ func, xoffset, yoffset, zoffset);
return GL_TRUE;
}
@@ -1214,6 +1214,13 @@ error_check_subtexture_dimensions(struct gl_context *ctx, GLuint dims,
"%s(height = %d)", func, subHeight);
return GL_TRUE;
}
+
+ if ((subDepth % bd != 0) &&
+ (zoffset + subDepth != (GLint) destImage->Depth)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(depth = %d)", func, subDepth);
+ return GL_TRUE;
+ }
}
return GL_FALSE;
More information about the mesa-commit
mailing list