aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/common/meta_tex_subimage.c
diff options
context:
space:
mode:
authorAnuj Phogat <[email protected]>2015-07-24 15:53:58 -0700
committerAnuj Phogat <[email protected]>2015-09-14 15:22:37 -0700
commit64e25167ed284619dacab42fdada0bb0fea71321 (patch)
tree1877142bf116f119954ae44dafdffe3403c8fac1 /src/mesa/drivers/common/meta_tex_subimage.c
parent5877a594d54fdd2b3aa329f4d35b3491a7ee8a33 (diff)
meta: Abort meta pbo path if TexSubImage need signed unsigned conversion
See similar fix for Readpixels in mesa commit 0d20790. Jason suggested we need that for TexSubImage as well. Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa/drivers/common/meta_tex_subimage.c')
-rw-r--r--src/mesa/drivers/common/meta_tex_subimage.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/src/mesa/drivers/common/meta_tex_subimage.c b/src/mesa/drivers/common/meta_tex_subimage.c
index 33c22aa139d..181dde9d045 100644
--- a/src/mesa/drivers/common/meta_tex_subimage.c
+++ b/src/mesa/drivers/common/meta_tex_subimage.c
@@ -45,6 +45,24 @@
#include "uniforms.h"
#include "varray.h"
+static bool
+need_signed_unsigned_int_conversion(mesa_format mesaFormat,
+ GLenum format, GLenum type)
+{
+ const GLenum mesaFormatType = _mesa_get_format_datatype(mesaFormat);
+ const bool is_format_integer = _mesa_is_enum_format_integer(format);
+ return (mesaFormatType == GL_INT &&
+ is_format_integer &&
+ (type == GL_UNSIGNED_INT ||
+ type == GL_UNSIGNED_SHORT ||
+ type == GL_UNSIGNED_BYTE)) ||
+ (mesaFormatType == GL_UNSIGNED_INT &&
+ is_format_integer &&
+ (type == GL_INT ||
+ type == GL_SHORT ||
+ type == GL_BYTE));
+}
+
static struct gl_texture_image *
create_texture_for_pbo(struct gl_context *ctx,
bool create_pbo, GLenum pbo_target,
@@ -183,6 +201,13 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint dims,
if (ctx->_ImageTransferState)
return false;
+ /* This function rely on BlitFramebuffer to fill in the pixel data for
+ * glTex[Sub]Image*D. But, BlitFrameBuffer doesn't support signed to
+ * unsigned or unsigned to signed integer conversions.
+ */
+ if (need_signed_unsigned_int_conversion(tex_image->TexFormat, format, type))
+ return false;
+
/* For arrays, use a tall (height * depth) 2D texture but taking into
* account the inter-image padding specified with the image height packing
* property.
@@ -266,24 +291,6 @@ fail:
return success;
}
-static bool
-need_signed_unsigned_int_conversion(mesa_format rbFormat,
- GLenum format, GLenum type)
-{
- const GLenum srcType = _mesa_get_format_datatype(rbFormat);
- const bool is_dst_format_integer = _mesa_is_enum_format_integer(format);
- return (srcType == GL_INT &&
- is_dst_format_integer &&
- (type == GL_UNSIGNED_INT ||
- type == GL_UNSIGNED_SHORT ||
- type == GL_UNSIGNED_BYTE)) ||
- (srcType == GL_UNSIGNED_INT &&
- is_dst_format_integer &&
- (type == GL_INT ||
- type == GL_SHORT ||
- type == GL_BYTE));
-}
-
bool
_mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims,
struct gl_texture_image *tex_image,