Mesa (master): mesa: Set green, blue channels to zero only for formats with these components
Anuj Phogat
aphogat at kemper.freedesktop.org
Fri Jul 24 19:12:33 UTC 2015
Module: Mesa
Branch: master
Commit: bbbefec7323d0a338346233ab4ab715bcf4e1b78
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bbbefec7323d0a338346233ab4ab715bcf4e1b78
Author: Anuj Phogat <anuj.phogat at gmail.com>
Date: Thu Jun 11 16:44:45 2015 -0700
mesa: Set green, blue channels to zero only for formats with these components
This is an optimization which avoids setting pixel transfer operations
when not required. _mesa_ReadPixels falls back to slower path if
transfer operations are set.
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
---
src/mesa/drivers/common/meta.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index ca10bbe..826f223 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -3159,9 +3159,16 @@ decompress_texture_image(struct gl_context *ctx,
* returned as red and two-channel texture values are returned as
* red/alpha.
*/
- if ((baseTexFormat == GL_LUMINANCE ||
- baseTexFormat == GL_LUMINANCE_ALPHA ||
- baseTexFormat == GL_INTENSITY) ||
+ if (((baseTexFormat == GL_LUMINANCE ||
+ baseTexFormat == GL_LUMINANCE_ALPHA ||
+ baseTexFormat == GL_INTENSITY) &&
+ (destBaseFormat == GL_RGBA ||
+ destBaseFormat == GL_RGB ||
+ destBaseFormat == GL_RG ||
+ destBaseFormat == GL_GREEN ||
+ destBaseFormat == GL_BLUE ||
+ destBaseFormat == GL_BGRA ||
+ destBaseFormat == GL_BGR)) ||
/* If we're reading back an RGB(A) texture (using glGetTexImage) as
* luminance then we need to return L=tex(R).
*/
More information about the mesa-commit
mailing list