return error(GL_INVALID_OPERATION);
}
- texture->setImage(context, level, width, height, depth, GetSizedInternalFormat(internalformat, type), type, context->getUnpackInfo(), context->getPixels(data));
+ GLenum sizedInternalFormat = GetSizedInternalFormat(internalformat, type);
+
+ GLenum validationError = context->getPixels(&data, type, context->getRequiredBufferSize(width, height, depth, sizedInternalFormat, type));
+ if(validationError != GL_NONE)
+ {
+ return error(validationError);
+ }
+
+ texture->setImage(context, level, width, height, depth, sizedInternalFormat, type, context->getUnpackInfo(), data);
}
}
GLenum validationError = ValidateSubImageParams(false, width, height, depth, xoffset, yoffset, zoffset, target, level, sizedInternalFormat, texture);
if(validationError == GL_NONE)
{
- texture->subImage(context, level, xoffset, yoffset, zoffset, width, height, depth, sizedInternalFormat, type, context->getUnpackInfo(), context->getPixels(data));
+ GLenum validationError = context->getPixels(&data, type, context->getRequiredBufferSize(width, height, depth, sizedInternalFormat, type));
+ if(validationError != GL_NONE)
+ {
+ return error(validationError);
+ }
+
+ texture->subImage(context, level, xoffset, yoffset, zoffset, width, height, depth, sizedInternalFormat, type, context->getUnpackInfo(), data);
}
else
{
return error(GL_INVALID_OPERATION);
}
+ GLenum validationError = context->getPixels(&data, texture->getType(target, level), imageSize);
+ if(validationError != GL_NONE)
+ {
+ return error(validationError);
+ }
+
texture->setCompressedImage(level, internalformat, width, height, depth, imageSize, data);
}
}
return error(validationError);
}
- if(width == 0 || height == 0 || depth == 0 || !data)
+ if(width == 0 || height == 0 || depth == 0)
{
return;
}
return error(GL_INVALID_OPERATION);
}
- texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, context->getPixels(data));
+ GLenum validationError = context->getPixels(&data, texture->getType(target, level), imageSize);
+ if(validationError != GL_NONE)
+ {
+ return error(validationError);
+ }
+
+ texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
}
}