#include "program/program.h"
#include "swrast/swrast.h"
#include "drivers/common/meta.h"
+#include "main/enums.h"
+#include "main/glformats.h"
/** Return offset in bytes of the field within a vertex struct */
* ReadPixels() and passed to Tex[Sub]Image().
*/
static GLenum
-get_temp_image_type(struct gl_context *ctx, GLenum baseFormat)
+get_temp_image_type(struct gl_context *ctx, gl_format format)
{
+ GLenum baseFormat, type;
+
+ baseFormat = _mesa_get_format_base_format(format);
+
switch (baseFormat) {
case GL_RGBA:
case GL_RGB:
else if (ctx->DrawBuffer->Visual.redBits <= 16)
return GL_UNSIGNED_SHORT;
else
- return GL_FLOAT;
+ return _mesa_get_format_datatype(format);
case GL_DEPTH_COMPONENT:
return GL_UNSIGNED_INT;
case GL_DEPTH_STENCIL:
format = GL_RGBA;
}
+ type = get_temp_image_type(ctx, texImage->TexFormat);
if (_mesa_is_format_integer_color(texImage->TexFormat)) {
- _mesa_problem(ctx, "unsupported integer color copyteximage");
- return;
+ format = _mesa_base_format_to_integer_format(format);
}
-
- type = get_temp_image_type(ctx, format);
bpp = _mesa_bytes_per_pixel(format, type);
if (bpp <= 0) {
_mesa_problem(ctx, "Bad bpp in _mesa_meta_CopyTexSubImage()");