/* 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,
}
}
- /* 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) &&
"%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;
+ }
}
}