wined3d/state.c: Set blend states in accordance with MSDN

Christoph Bumiller e0425955 at stud3.tuwien.ac.at
Thu Jan 4 10:36:17 CST 2007


I noticed that MSDN states that the blending state 
D3DRS_BOTHINVSRCALPHA doesn't set both SRCBLEND and DESTBLEND to 
ONE_MINUS_SRC_ALPHA (as the name suggests), it sets SRCBLEND to 
ONE_MINUS_SRC_ALPHA and DSTBLEND to SRC_ALPHA, similar with 
BOTHSRCALPHA. Also, BOTHINVSRCALPHA is not allowed wine D3DRS_DESTBLEND 
(I don't know about BOTHSRCALPHA since it's only stated as obsolete).

The attached patch is one possibility to correct this, but I'm unsure 
what to set the factors to should they be used with DESTBLEND (which 
they shouldn't, so I added a FIXME; also, I inverted them there), or 
whether to remove them there altogether.

This was already pointed out by someone back in 2004 I found ... so 
what should be done about this?

-------------- next part --------------
>From 803ea8bb3a8cbe443ea5c1f229832c87db64128f Mon Sep 17 00:00:00 2001
From: Christoph Bumiller <chr at ECHELON.(none)>
Date: Thu, 4 Jan 2007 17:22:49 +0100
Subject: Set blend states in accordance with MSDN

---
 dlls/wined3d/state.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index c99be0e..e230e74 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -246,11 +246,11 @@ static void state_blend(DWORD state, IWi
         case WINED3DBLEND_SRCALPHASAT        : srcBlend = GL_SRC_ALPHA_SATURATE;  break;
 
         case WINED3DBLEND_BOTHSRCALPHA       : srcBlend = GL_SRC_ALPHA;
-            dstBlend = GL_SRC_ALPHA;
+            dstBlend = GL_ONE_MINUS_SRC_ALPHA;
             break;
 
         case WINED3DBLEND_BOTHINVSRCALPHA    : srcBlend = GL_ONE_MINUS_SRC_ALPHA;
-            dstBlend = GL_ONE_MINUS_SRC_ALPHA;
+            dstBlend = GL_SRC_ALPHA;
             break;
 
         case WINED3DBLEND_BLENDFACTOR        : srcBlend = GL_CONSTANT_COLOR;   break;
@@ -273,11 +273,13 @@ static void state_blend(DWORD state, IWi
         case WINED3DBLEND_SRCALPHASAT        : dstBlend = GL_SRC_ALPHA_SATURATE;  break;
 
         case WINED3DBLEND_BOTHSRCALPHA       : dstBlend = GL_SRC_ALPHA;
-            srcBlend = GL_SRC_ALPHA;
+            srcBlend = GL_ONE_MINUS_SRC_ALPHA;
+	    FIXME("WINED3DBLEND_BOTHSRCALPHA used with WINED3DRS_DESTBLEND\n");
             break;
 
         case WINED3DBLEND_BOTHINVSRCALPHA    : dstBlend = GL_ONE_MINUS_SRC_ALPHA;
-            srcBlend = GL_ONE_MINUS_SRC_ALPHA;
+            srcBlend = GL_SRC_ALPHA;
+	    FIXME("WINED3DBLEND_BOTHINVSRCALPHA used with WINED3DRS_DESTBLEND\n");
             break;
 
         case D3DBLEND_BLENDFACTOR        : dstBlend = GL_CONSTANT_COLOR;   break;
-- 
1.4.4



More information about the wine-patches mailing list