=?UTF-8?Q?Rico=20Sch=C3=BCller=20?=: d3dx9: Move technique name handling to technique handle validation.

Alexandre Julliard julliard at winehq.org
Mon Aug 20 14:16:18 CDT 2012


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

Author: Rico Schüller <kgbricola at web.de>
Date:   Sat Aug 18 14:59:31 2012 +0200

d3dx9: Move technique name handling to technique handle validation.

---

 dlls/d3dx9_36/effect.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
index 2ae8bd2..ef8fb86 100644
--- a/dlls/d3dx9_36/effect.c
+++ b/dlls/d3dx9_36/effect.c
@@ -469,17 +469,21 @@ static struct d3dx_technique *get_technique_by_name(struct ID3DXBaseEffectImpl *
 
 static struct d3dx_technique *is_valid_technique(struct ID3DXBaseEffectImpl *base, D3DXHANDLE technique)
 {
+    struct d3dx_technique *tech = NULL;
     unsigned int i;
 
     for (i = 0; i < base->technique_count; ++i)
     {
         if (base->technique_handles[i] == technique)
         {
-            return get_technique_struct(technique);
+            tech = get_technique_struct(technique);
+            break;
         }
     }
 
-    return NULL;
+    if (!tech) tech = get_technique_by_name(base, technique);
+
+    return tech;
 }
 
 static struct d3dx_pass *is_valid_pass(struct ID3DXBaseEffectImpl *base, D3DXHANDLE pass)
@@ -1462,8 +1466,6 @@ static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetPass(ID3DXBaseEffect *iface, D3D
 
     TRACE("iface %p, technique %p, index %u\n", This, technique, index);
 
-    if (!tech) tech = get_technique_struct(iface->lpVtbl->GetTechniqueByName(iface, technique));
-
     if (tech && index < tech->pass_count)
     {
         TRACE("Returning pass %p\n", tech->pass_handles[index]);
@@ -1482,8 +1484,6 @@ static D3DXHANDLE WINAPI ID3DXBaseEffectImpl_GetPassByName(ID3DXBaseEffect *ifac
 
     TRACE("iface %p, technique %p, name %s\n", This, technique, debugstr_a(name));
 
-    if (!tech) tech = get_technique_struct(iface->lpVtbl->GetTechniqueByName(iface, technique));
-
     if (tech && name)
     {
         unsigned int i;
@@ -3525,8 +3525,6 @@ static HRESULT WINAPI ID3DXEffectImpl_SetTechnique(ID3DXEffect *iface, D3DXHANDL
 
     TRACE("iface %p, technique %p\n", This, technique);
 
-    if (!tech) tech = get_technique_struct(iface->lpVtbl->GetTechniqueByName(iface, technique));
-
     if (tech)
     {
         UINT i;




More information about the wine-cvs mailing list