summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_cc.c
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2013-01-11 07:15:18 -0800
committerCarl Worth <cworth@cworth.org>2013-01-14 15:35:37 -0800
commit258453716f001eab1288d99765213221d0599ca4 (patch)
tree87d586d066e1a84d2b5b739b7a897a3e09c2be74 /src/mesa/drivers/dri/i965/brw_cc.c
parent6d4d4b00ddfbd3257ecd129fec5b813be7e36fe9 (diff)
downloadexternal_mesa3d-258453716f001eab1288d99765213221d0599ca4.zip
external_mesa3d-258453716f001eab1288d99765213221d0599ca4.tar.gz
external_mesa3d-258453716f001eab1288d99765213221d0599ca4.tar.bz2
i965: Avoid blending with destination alpha when RB format has no alpha bits
The hardware does not support a render target without an alpha channel. So when the user creates a render buffer with no alpha channel, there actually is storage available for alpha internally. It requires special care to avoid these unwanted alpha bits from causing any problems. Specifically, when blending, and when the blend factors would read the destination alpha values, this commit coerces the blend factors to instead be either 0 or 1 as appropriate. A similar fix was made for pre-gen6 hardware in commit eadd9b8e and this commit shares the fixup function written by Ian then. This commit the following es3conform test: rgb8_rgba8_rgb As well as the following piglit (sub) tests: EXT_framebuffer_object/fbo-blending-formats/3 EXT_framebuffer_object/fbo-blending-formats/GL_RGB EXT_framebuffer_object/fbo-blending-formats/GL_RGB8 Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_cc.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_cc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c
index 78809da..f5affcf 100644
--- a/src/mesa/drivers/dri/i965/brw_cc.c
+++ b/src/mesa/drivers/dri/i965/brw_cc.c
@@ -75,8 +75,8 @@ const struct brw_tracked_state brw_cc_vp = {
* replace it with a function that hard-wires destination alpha to 1.0. This
* is used when rendering to xRGB targets.
*/
-static GLenum
-fix_xRGB_alpha(GLenum function)
+GLenum
+brw_fix_xRGB_alpha(GLenum function)
{
switch (function) {
case GL_DST_ALPHA:
@@ -159,10 +159,10 @@ static void upload_cc_unit(struct brw_context *brw)
* with GL_ONE and GL_ONE_MINUS_DST_ALPHA with GL_ZERO.
*/
if (ctx->DrawBuffer->Visual.alphaBits == 0) {
- srcRGB = fix_xRGB_alpha(srcRGB);
- srcA = fix_xRGB_alpha(srcA);
- dstRGB = fix_xRGB_alpha(dstRGB);
- dstA = fix_xRGB_alpha(dstA);
+ srcRGB = brw_fix_xRGB_alpha(srcRGB);
+ srcA = brw_fix_xRGB_alpha(srcA);
+ dstRGB = brw_fix_xRGB_alpha(dstRGB);
+ dstA = brw_fix_xRGB_alpha(dstA);
}
if (eqRGB == GL_MIN || eqRGB == GL_MAX) {