Rico Schüller : d3dcompiler: Implement ID3D11ShaderRefleflection::GetVariableByName().

Alexandre Julliard julliard at winehq.org
Wed Feb 23 13:01:53 CST 2011


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

Author: Rico Schüller <kgbricola at web.de>
Date:   Tue Feb 22 21:01:11 2011 +0100

d3dcompiler: Implement ID3D11ShaderRefleflection::GetVariableByName().

---

 dlls/d3dcompiler_43/reflection.c |   31 +++++++++++++++++++++++++++++--
 1 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c
index 22522bf..b751725 100644
--- a/dlls/d3dcompiler_43/reflection.c
+++ b/dlls/d3dcompiler_43/reflection.c
@@ -418,9 +418,36 @@ static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetPatchConstantP
 static struct ID3D11ShaderReflectionVariable * STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetVariableByName(
         ID3D11ShaderReflection *iface, LPCSTR name)
 {
-    FIXME("iface %p, name %s stub!\n", iface, name);
+    struct d3dcompiler_shader_reflection *This = impl_from_ID3D11ShaderReflection(iface);
+    unsigned int i, k;
 
-    return NULL;
+    TRACE("iface %p, name %s\n", iface, debugstr_a(name));
+
+    if (!name)
+    {
+        WARN("Invalid name specified\n");
+        return &null_variable.ID3D11ShaderReflectionVariable_iface;
+    }
+
+    for (i = 0; i < This->constant_buffer_count; ++i)
+    {
+        struct d3dcompiler_shader_reflection_constant_buffer *cb = &This->constant_buffers[i];
+
+        for (k = 0; k < cb->variable_count; ++k)
+        {
+            struct d3dcompiler_shader_reflection_variable *v = &cb->variables[k];
+
+            if (!strcmp(v->name, name))
+            {
+                TRACE("Returning ID3D11ShaderReflectionVariable %p.\n", v);
+                return &v->ID3D11ShaderReflectionVariable_iface;
+            }
+        }
+    }
+
+    WARN("Invalid name specified\n");
+
+    return &null_variable.ID3D11ShaderReflectionVariable_iface;
 }
 
 static HRESULT STDMETHODCALLTYPE d3dcompiler_shader_reflection_GetResourceBindingDescByName(




More information about the wine-cvs mailing list