[PATCH 8/8] d3dcompiler: Complete ID3D10ShaderReflectionConstantBuffer methods.

Connor McAdams conmanx360 at gmail.com
Wed Nov 6 17:43:05 CST 2019


Completes ID3D10ShaderReflectionConstantBuffer methods that were
previously stubs.

Signed-off-by: Connor McAdams <conmanx360 at gmail.com>
---
 dlls/d3dcompiler_43/reflection.c | 36 +++++++++++++++++++++++++++++---
 1 file changed, 33 insertions(+), 3 deletions(-)

diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c
index 9d98163fa5..c0dc99f832 100644
--- a/dlls/d3dcompiler_43/reflection.c
+++ b/dlls/d3dcompiler_43/reflection.c
@@ -750,15 +750,45 @@ static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_constant_buffer_GetDesc
 static ID3D10ShaderReflectionVariable * STDMETHODCALLTYPE d3d10_shader_reflection_constant_buffer_GetVariableByIndex(
         ID3D10ShaderReflectionConstantBuffer *iface, UINT index)
 {
-    FIXME("iface %p, index %d stub!\n", iface, index);
+    struct d3dcompiler_shader_reflection_constant_buffer *reflection = impl_from_ID3D10ShaderReflectionConstantBuffer(iface);
 
-    return &null_variable.ID3D10ShaderReflectionVariable_iface;
+    TRACE("iface %p, index %u.\n", iface, index);
+
+    if (index >= reflection->variable_count)
+    {
+        WARN("Invalid index specified.\n");
+        return &null_variable.ID3D10ShaderReflectionVariable_iface;
+    }
+
+    return &reflection->variables[index].ID3D10ShaderReflectionVariable_iface;
 }
 
 static ID3D10ShaderReflectionVariable * STDMETHODCALLTYPE d3d10_shader_reflection_constant_buffer_GetVariableByName(
         ID3D10ShaderReflectionConstantBuffer *iface, const char *name)
 {
-    FIXME("iface %p, name %s stub!\n", iface, name);
+    struct d3dcompiler_shader_reflection_constant_buffer *reflection = impl_from_ID3D10ShaderReflectionConstantBuffer(iface);
+    unsigned int i;
+
+    TRACE("iface %p, name %s.\n", iface, debugstr_a(name));
+
+    if (!name)
+    {
+        WARN("Invalid argument specified.\n");
+        return &null_variable.ID3D10ShaderReflectionVariable_iface;
+    }
+
+    for (i = 0; i < reflection->variable_count; ++i)
+    {
+        struct d3dcompiler_shader_reflection_variable *v = &reflection->variables[i];
+
+        if (!strcmp(v->name, name))
+        {
+            TRACE("Returning ID3D10ShaderReflectionVariable %p.\n", v);
+            return &v->ID3D10ShaderReflectionVariable_iface;
+        }
+    }
+
+    WARN("Invalid name specified.\n");
 
     return &null_variable.ID3D10ShaderReflectionVariable_iface;
 }
-- 
2.20.1




More information about the wine-devel mailing list