return GL_TRUE;
}
- /* size must be multiple of bw by bh or equal to whole texture size */
- if ((subWidth % bw != 0) && subWidth != (GLint) destImage->Width) {
+ /* The size must be a multiple of bw x bh, or we must be using a
+ * offset+size that exactly hits the edge of the image. This
+ * is important for small mipmap levels (1x1, 2x1, etc) and for
+ * NPOT textures.
+ */
+ if ((subWidth % bw != 0) &&
+ (xoffset + subWidth != (GLint) destImage->Width)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s%dD(width = %d)", function, dims, subWidth);
return GL_TRUE;
}
- if ((subHeight % bh != 0) && subHeight != (GLint) destImage->Height) {
+ if ((subHeight % bh != 0) &&
+ (yoffset + subHeight != (GLint) destImage->Height)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"%s%dD(height = %d)", function, dims, subHeight);
return GL_TRUE;