Implement BlendFactor renderstate

Kovács András andras at csevego.net
Fri Sep 1 16:05:55 CDT 2006


Hi,
I implemented D3DBLEND_BLENDFACTOR & D3DBLEND_INVBLENDFACTOR blending value.
Without this, if a program uses blendfactor, it won't display blended result.
With this my sample app works on wine as on windows.
This patch applies to the top of 
Remove-unnecessary-glBlendColor-in-TextureFactor-renderstate patch.
Changelog:
* Implement BlendFactor renderstate

Best Regards,
--
Lamarr
Kovács András
andras at csevego.net
http://csevego.net
-------------- next part --------------
From nobody Mon Sep 17 00:00:00 2001
From: Kovács András <andras at gep.sth.sze.hu>
Date: Fri Sep 1 22:56:26 2006 +0200
Subject: [PATCH] Implement BlendFactor renderstate
---

 dlls/wined3d/device.c |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

08cc4e57b1f66675be6ea1eae558394c63159425
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index a20f2e0..be90664 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3608,6 +3608,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl
                 This->srcBlend = newVal;
                 This->dstBlend = newVal;
                 break;
+            case D3DBLEND_BLENDFACTOR        : newVal = GL_CONSTANT_COLOR;   break;
+            case D3DBLEND_INVBLENDFACTOR     : newVal = GL_ONE_MINUS_CONSTANT_COLOR;  break;
             default:
                 FIXME("Unrecognized src/dest blend value %ld (%d)\n", Value, State);
             }
@@ -4534,8 +4536,24 @@ static HRESULT WINAPI IWineD3DDeviceImpl
 
     case WINED3DRS_BLENDFACTOR               :
     {
-        if(0xFFFFFFFF != Value)
-            ERR("(%p)->(%s,%ld) not yet implemented. Missing of cap D3DPBLENDCAPS_BLENDFACTOR wasn't honored?\n", This, debug_d3drenderstate(State), Value);
+        float col[4];
+        if (GL_SUPPORT(ARB_IMAGING)) {
+
+            TRACE("Setting BlendFactor to %ld", Value);
+
+            D3DCOLORTOGLFLOAT4(Value, col);
+            if (0xFFFFFFFF != Value) {
+                glEnable(GL_BLEND);
+                checkGLcall("glEnable(GL_BLEND)");
+            }
+            else {
+               glDisable(GL_BLEND);
+               checkGLcall("glDisable(GL_BLEND)");
+            }
+            glBlendColor (col[0],col[1],col[2],col[3]);
+        } else {
+           WARN("Unsupported in local OpenGL implementation: glBlendColor\n");
+        }
         break;
     }
 
-- 
1.2.4



More information about the wine-patches mailing list