aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnuj Phogat <anuj.phogat@gmail.com>2014-06-11 18:07:36 -0700
committerCarl Worth <cworth@cworth.org>2014-08-06 14:50:18 -0700
commit29e2f11f5dda5833327bf2225f6ca4e8ca7f9c42 (patch)
tree9f7978b33063a263f04584ae4615fefbe1cf2651
parent8dc1caa1ade604a8652d3a5d5e3158c1b1ca777c (diff)
meta: Use _mesa_get_format_bits() to get the GL_RED_BITS
We currently get red bits from ctx->DrawBuffer->Visual.redBits by making a false assumption that the texture we're writing to (in glCopyTexImage2D()) is used as a DrawBuffer. Fixes many failures in gles3 Khronos CTS test: copy_tex_image_conversions_required Cc: <mesa-stable@lists.freedesktop.org> Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com> Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com> (cherry picked from commit 7de90890c64d019c56e5a06e427b207220729997) Conflicts: src/mesa/drivers/common/meta.c
-rw-r--r--src/mesa/drivers/common/meta.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 6c269849a8a..6d7768dea16 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -2741,9 +2741,8 @@ _mesa_meta_blit_shader_table_cleanup(struct blit_shader_table *table)
static GLenum
get_temp_image_type(struct gl_context *ctx, mesa_format format)
{
- GLenum baseFormat;
-
- baseFormat = _mesa_get_format_base_format(format);
+ const GLenum baseFormat = _mesa_get_format_base_format(format);
+ const GLint format_red_bits = _mesa_get_format_bits(format, GL_RED_BITS);
switch (baseFormat) {
case GL_RGBA:
@@ -2754,9 +2753,9 @@ get_temp_image_type(struct gl_context *ctx, mesa_format format)
case GL_LUMINANCE:
case GL_LUMINANCE_ALPHA:
case GL_INTENSITY:
- if (ctx->DrawBuffer->Visual.redBits <= 8) {
+ if (format_red_bits <= 8) {
return GL_UNSIGNED_BYTE;
- } else if (ctx->DrawBuffer->Visual.redBits <= 16) {
+ } else if (format_red_bits <= 16) {
return GL_UNSIGNED_SHORT;
} else {
GLenum datatype = _mesa_get_format_datatype(format);