Roderick Colenbrander : wined3d: Fix glBlendColorEXT for use on RivaTNT.

Alexandre Julliard julliard at winehq.org
Mon Jan 14 09:33:13 CST 2008


Module: wine
Branch: master
Commit: 916b56391d6d8e7516a6584db8105f3702ac9d50
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=916b56391d6d8e7516a6584db8105f3702ac9d50

Author: Roderick Colenbrander <thunderbird2k at gmx.net>
Date:   Sat Jan 12 23:32:24 2008 +0000

wined3d: Fix glBlendColorEXT for use on RivaTNT.

---

 dlls/wined3d/directx.c    |   13 +++++++++----
 dlls/wined3d/state.c      |    5 +++++
 include/wine/wined3d_gl.h |    3 ++-
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 1386a76..aac3c7b 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -83,6 +83,7 @@ static const struct {
     {"GL_ARB_shader_objects",               ARB_SHADER_OBJECTS,             0                           },
 
     /* EXT */
+    {"GL_EXT_blend_color",                  EXT_BLEND_COLOR,                0                           },
     {"GL_EXT_blend_minmax",                 EXT_BLEND_MINMAX,               0                           },
     {"GL_EXT_fog_coord",                    EXT_FOG_COORD,                  0                           },
     {"GL_EXT_framebuffer_blit",             EXT_FRAMEBUFFER_BLIT,           0                           },
@@ -2224,8 +2225,7 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
                        WINED3DPCMPCAPS_NEVER        |
                        WINED3DPCMPCAPS_NOTEQUAL;
 
-    *pCaps->SrcBlendCaps  = WINED3DPBLENDCAPS_BLENDFACTOR     |
-                            WINED3DPBLENDCAPS_BOTHINVSRCALPHA |
+    *pCaps->SrcBlendCaps  = WINED3DPBLENDCAPS_BOTHINVSRCALPHA |
                             WINED3DPBLENDCAPS_BOTHSRCALPHA    |
                             WINED3DPBLENDCAPS_DESTALPHA       |
                             WINED3DPBLENDCAPS_DESTCOLOR       |
@@ -2239,8 +2239,7 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
                             WINED3DPBLENDCAPS_SRCCOLOR        |
                             WINED3DPBLENDCAPS_ZERO;
 
-    *pCaps->DestBlendCaps = WINED3DPBLENDCAPS_BLENDFACTOR     |
-                            WINED3DPBLENDCAPS_DESTALPHA       |
+    *pCaps->DestBlendCaps = WINED3DPBLENDCAPS_DESTALPHA       |
                             WINED3DPBLENDCAPS_DESTCOLOR       |
                             WINED3DPBLENDCAPS_INVDESTALPHA    |
                             WINED3DPBLENDCAPS_INVDESTCOLOR    |
@@ -2257,6 +2256,12 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
      * legacy settings for srcblend only
      */
 
+    if( GL_SUPPORT(EXT_BLEND_COLOR)) {
+        *pCaps->SrcBlendCaps |= WINED3DPBLENDCAPS_BLENDFACTOR;
+        *pCaps->DestBlendCaps |= WINED3DPBLENDCAPS_BLENDFACTOR;
+    }
+
+
     *pCaps->AlphaCmpCaps = WINED3DPCMPCAPS_ALWAYS       |
                            WINED3DPCMPCAPS_EQUAL        |
                            WINED3DPCMPCAPS_GREATER      |
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 59ff3d4..46aa6e4 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -356,6 +356,11 @@ static void state_blend(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
 static void state_blendfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
     float col[4];
 
+    if(!GL_SUPPORT(EXT_BLEND_COLOR)) {
+        WARN("Unsupported in local OpenGL implementation: glBlendColorEXT\n");
+        return;
+    }
+
     TRACE("Setting BlendFactor to %d\n", stateblock->renderState[WINED3DRS_BLENDFACTOR]);
     D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_BLENDFACTOR], col);
     GL_EXTCALL(glBlendColorEXT (col[0],col[1],col[2],col[3]));
diff --git a/include/wine/wined3d_gl.h b/include/wine/wined3d_gl.h
index f51a4e6..4379039 100644
--- a/include/wine/wined3d_gl.h
+++ b/include/wine/wined3d_gl.h
@@ -3188,6 +3188,7 @@ typedef enum _GL_SupportedExt {
   ARB_VERTEX_SHADER,
   ARB_SHADER_OBJECTS,
   /* EXT */
+  EXT_BLEND_COLOR,
   EXT_BLEND_MINMAX,
   EXT_FOG_COORD,
   EXT_FRAMEBUFFER_OBJECT,
@@ -3257,7 +3258,7 @@ typedef enum _GL_SupportedExt {
     /* GL_ARB_draw_buffers */ \
     USE_GL_FUNC(PGLFNDRAWBUFFERSARBPROC,                            glDrawBuffersARB,                           ARB_DRAW_BUFFERS,       NULL );\
     /* GL_ARB_imaging, GL_EXT_blend_minmax */ \
-    USE_GL_FUNC(PGLFNBLENDCOLORPROC,                                glBlendColorEXT,                            EXT_BLEND_MINMAX,       NULL );\
+    USE_GL_FUNC(PGLFNBLENDCOLORPROC,                                glBlendColorEXT,                            EXT_BLEND_COLOR,        NULL );\
     USE_GL_FUNC(PGLFNBLENDEQUATIONPROC,                             glBlendEquationEXT,                         EXT_BLEND_MINMAX,       NULL );\
     /* GL_ARB_multisample */ \
     USE_GL_FUNC(WINED3D_PFNGLSAMPLECOVERAGEARBPROC,                 glSampleCoverageARB,                        ARB_MULTISAMPLE,        NULL );\




More information about the wine-cvs mailing list