Henri Verbeet : d3d10: Handle blend state in d3d10_effect_object_apply().

Alexandre Julliard julliard at winehq.org
Tue Oct 9 13:12:35 CDT 2012


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Mon Oct  8 21:32:38 2012 +0200

d3d10: Handle blend state in d3d10_effect_object_apply().

---

 dlls/d3d10/d3d10_private.h |    1 +
 dlls/d3d10/effect.c        |   20 +++++++++++++++++++-
 dlls/d3d10/tests/effect.c  |    9 ++-------
 3 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h
index fc9cb41..9449da1 100644
--- a/dlls/d3d10/d3d10_private.h
+++ b/dlls/d3d10/d3d10_private.h
@@ -76,6 +76,7 @@ struct d3d10_effect_object
     {
         ID3D10RasterizerState *rs;
         ID3D10DepthStencilState *ds;
+        ID3D10BlendState *bs;
         ID3D10VertexShader *vs;
         ID3D10PixelShader *ps;
         ID3D10GeometryShader *gs;
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
index 4b26562..1afa0b5 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -1355,6 +1355,14 @@ static HRESULT parse_fx10_object(struct d3d10_effect_object *o, const char **ptr
             break;
         }
 
+        case D3D10_EOT_BLEND_STATE:
+        {
+            ID3D10EffectBlendVariable *bv = variable->lpVtbl->AsBlend(variable);
+            if (FAILED(hr = bv->lpVtbl->GetBlendState(bv, variable_idx, &o->object.bs)))
+                return hr;
+            break;
+        }
+
         case D3D10_EOT_VERTEXSHADER:
         {
             ID3D10EffectShaderVariable *sv = variable->lpVtbl->AsShader(variable);
@@ -1385,7 +1393,6 @@ static HRESULT parse_fx10_object(struct d3d10_effect_object *o, const char **ptr
             break;
         }
 
-        case D3D10_EOT_BLEND_STATE:
         case D3D10_EOT_STENCIL_REF:
         case D3D10_EOT_BLEND_FACTOR:
         case D3D10_EOT_SAMPLE_MASK:
@@ -2181,6 +2188,10 @@ static HRESULT d3d10_effect_object_apply(struct d3d10_effect_object *o)
             ID3D10Device_OMSetDepthStencilState(device, o->object.ds, o->pass->stencil_ref);
             return S_OK;
 
+        case D3D10_EOT_BLEND_STATE:
+            ID3D10Device_OMSetBlendState(device, o->object.bs, o->pass->blend_factor, o->pass->sample_mask);
+            return S_OK;
+
         case D3D10_EOT_VERTEXSHADER:
             ID3D10Device_VSSetShader(device, o->object.vs);
             return S_OK;
@@ -2194,6 +2205,8 @@ static HRESULT d3d10_effect_object_apply(struct d3d10_effect_object *o)
             return S_OK;
 
         case D3D10_EOT_STENCIL_REF:
+        case D3D10_EOT_BLEND_FACTOR:
+        case D3D10_EOT_SAMPLE_MASK:
             return S_OK;
 
         default:
@@ -2293,6 +2306,11 @@ static void d3d10_effect_object_destroy(struct d3d10_effect_object *o)
                 ID3D10DepthStencilState_Release(o->object.ds);
             break;
 
+        case D3D10_EOT_BLEND_STATE:
+            if (o->object.bs)
+                ID3D10BlendState_Release(o->object.bs);
+            break;
+
         case D3D10_EOT_VERTEXSHADER:
             if (o->object.vs)
                 ID3D10VertexShader_Release(o->object.vs);
diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c
index ce5e18e..7f5ce0a 100644
--- a/dlls/d3d10/tests/effect.c
+++ b/dlls/d3d10/tests/effect.c
@@ -3922,12 +3922,7 @@ static void test_effect_state_groups(ID3D10Device *device)
     ok(pass_desc.BlendFactor[2] == 0.7f, "Got unexpected BlendFactor[2] %.8e.\n", pass_desc.BlendFactor[2]);
     ok(pass_desc.BlendFactor[3] == 0.8f, "Got unexpected BlendFactor[3] %.8e.\n", pass_desc.BlendFactor[3]);
     hr = pass->lpVtbl->Apply(pass, 0);
-    todo_wine ok(SUCCEEDED(hr), "Failed to apply pass, hr %#x.\n", hr);
-    if (FAILED(hr))
-    {
-        effect->lpVtbl->Release(effect);
-        return;
-    }
+    ok(SUCCEEDED(hr), "Failed to apply pass, hr %#x.\n", hr);
 
     ID3D10Device_OMGetBlendState(device, &blend_state, blend_factor, &sample_mask);
     ID3D10BlendState_GetDesc(blend_state, &blend_desc);
@@ -3958,7 +3953,7 @@ static void test_effect_state_groups(ID3D10Device *device)
     ok(!ds_desc.DepthEnable, "Got unexpected DepthEnable %#x.\n", ds_desc.DepthEnable);
     ok(ds_desc.DepthWriteMask == D3D10_DEPTH_WRITE_MASK_ZERO, "Got unexpected DepthWriteMask %#x.\n",
             ds_desc.DepthWriteMask);
-    ok(ds_desc.DepthFunc == D3D10_COMPARISON_NEVER, "Got unexpected DepthFunc %#x.\n", ds_desc.DepthFunc);
+    todo_wine ok(ds_desc.DepthFunc == D3D10_COMPARISON_NEVER, "Got unexpected DepthFunc %#x.\n", ds_desc.DepthFunc);
     ok(ds_desc.StencilEnable, "Got unexpected StencilEnable %#x.\n", ds_desc.StencilEnable);
     ok(ds_desc.StencilReadMask == 0x4, "Got unexpected StencilReadMask %#x.\n", ds_desc.StencilReadMask);
     ok(ds_desc.StencilWriteMask == 0x5, "Got unexpected StencilWriteMask %#x.\n", ds_desc.StencilWriteMask);




More information about the wine-cvs mailing list