[Mesa-dev] [PATCH 03/16] mesa: Add error conditions for compressed textures with 3D blocks
Anuj Phogat
anuj.phogat at gmail.com
Sat Mar 5 01:29:48 UTC 2016
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
src/mesa/main/teximage.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index ba72353..f5de1c5 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1187,11 +1187,11 @@ error_check_subtexture_dimensions(struct gl_context *ctx, GLuint dims,
*/
_mesa_get_format_block_size(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)",
+ "%s(xoffset = %d, yoffset = %d, zoffset = %d)",
func, xoffset, yoffset);
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;
--
2.5.0
More information about the mesa-dev
mailing list