summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/common/meta.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index a2a7b2d48ff..79fbf4919cb 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -2733,6 +2733,7 @@ static GLenum
get_temp_image_type(struct gl_context *ctx, mesa_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:
@@ -2743,9 +2744,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);