mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 11:10:10 +01:00
meta: allow CopyTexSubImage on integer formats
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
parent
6671d0dad3
commit
091eb15b69
1 changed files with 10 additions and 6 deletions
|
|
@ -74,6 +74,8 @@
|
||||||
#include "program/program.h"
|
#include "program/program.h"
|
||||||
#include "swrast/swrast.h"
|
#include "swrast/swrast.h"
|
||||||
#include "drivers/common/meta.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 */
|
/** Return offset in bytes of the field within a vertex struct */
|
||||||
|
|
@ -3158,8 +3160,12 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
|
||||||
* ReadPixels() and passed to Tex[Sub]Image().
|
* ReadPixels() and passed to Tex[Sub]Image().
|
||||||
*/
|
*/
|
||||||
static GLenum
|
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) {
|
switch (baseFormat) {
|
||||||
case GL_RGBA:
|
case GL_RGBA:
|
||||||
case GL_RGB:
|
case GL_RGB:
|
||||||
|
|
@ -3174,7 +3180,7 @@ get_temp_image_type(struct gl_context *ctx, GLenum baseFormat)
|
||||||
else if (ctx->DrawBuffer->Visual.redBits <= 16)
|
else if (ctx->DrawBuffer->Visual.redBits <= 16)
|
||||||
return GL_UNSIGNED_SHORT;
|
return GL_UNSIGNED_SHORT;
|
||||||
else
|
else
|
||||||
return GL_FLOAT;
|
return _mesa_get_format_datatype(format);
|
||||||
case GL_DEPTH_COMPONENT:
|
case GL_DEPTH_COMPONENT:
|
||||||
return GL_UNSIGNED_INT;
|
return GL_UNSIGNED_INT;
|
||||||
case GL_DEPTH_STENCIL:
|
case GL_DEPTH_STENCIL:
|
||||||
|
|
@ -3216,12 +3222,10 @@ _mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
|
||||||
format = GL_RGBA;
|
format = GL_RGBA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type = get_temp_image_type(ctx, texImage->TexFormat);
|
||||||
if (_mesa_is_format_integer_color(texImage->TexFormat)) {
|
if (_mesa_is_format_integer_color(texImage->TexFormat)) {
|
||||||
_mesa_problem(ctx, "unsupported integer color copyteximage");
|
format = _mesa_base_format_to_integer_format(format);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type = get_temp_image_type(ctx, format);
|
|
||||||
bpp = _mesa_bytes_per_pixel(format, type);
|
bpp = _mesa_bytes_per_pixel(format, type);
|
||||||
if (bpp <= 0) {
|
if (bpp <= 0) {
|
||||||
_mesa_problem(ctx, "Bad bpp in _mesa_meta_CopyTexSubImage()");
|
_mesa_problem(ctx, "Bad bpp in _mesa_meta_CopyTexSubImage()");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue