From b961ba44ed01d4aa590609fc91ab1250ac7d9559 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 21 Jan 2013 12:18:02 -0800 Subject: [PATCH] i965: Examine _BaseFormat when deciding to perform xRGB_alpha fixups The renderbuffer's Format field may have an alpha channel even when the underlying _BaseFormat does not. This can happen when mesa chooses to use RGBA16 for an RGB16 format, for example. So look at _BaseFormat when deciding whether to fixup the blend factors. This test improves the results of at least the following piglit tests: EXT_frambebuffer_object/fbo-blending-formats {GL_RGB10, GL_RGB12, GL_RGB16} EXT_texture_snorm/fbo-blending-formats {GL_RGB16_SNORM, GLRGB8_SNORM, GL_RGB_SNORM} But none of these actually change from FAIL to PASS yet. The R, G, and B probe values are fixed with this commit, but the tests still fail because the alpha values are still wrong. Reviewed-by: Eric Anholt --- src/mesa/drivers/dri/i965/gen6_cc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/gen6_cc.c b/src/mesa/drivers/dri/i965/gen6_cc.c index fcd1794b8f5..d32f6366b7c 100644 --- a/src/mesa/drivers/dri/i965/gen6_cc.c +++ b/src/mesa/drivers/dri/i965/gen6_cc.c @@ -32,6 +32,7 @@ #include "intel_batchbuffer.h" #include "main/macros.h" #include "main/enums.h" +#include "main/glformats.h" static void gen6_upload_blend_state(struct brw_context *brw) @@ -125,7 +126,7 @@ gen6_upload_blend_state(struct brw_context *brw) * not read the alpha channel, but will instead use the correct * implicit value for alpha. */ - if (_mesa_get_format_bits(rb->Format, GL_ALPHA_BITS) == 0) + if (!_mesa_base_format_has_channel(rb->_BaseFormat, GL_TEXTURE_ALPHA_TYPE)) { srcRGB = brw_fix_xRGB_alpha(srcRGB); srcA = brw_fix_xRGB_alpha(srcA); -- 2.30.2