[PATCH 3/6] d3dcompiler: Implement ID3D10ShaderReflectionConstantBuffer GetVariableByIndex() method.

Matteo Bruni mbruni at codeweavers.com
Thu Nov 14 13:59:57 CST 2019


From: Connor McAdams <conmanx360 at gmail.com>

Signed-off-by: Connor McAdams <conmanx360 at gmail.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
 dlls/d3dcompiler_43/reflection.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c
index 34a9984768d..5c08cdf5e45 100644
--- a/dlls/d3dcompiler_43/reflection.c
+++ b/dlls/d3dcompiler_43/reflection.c
@@ -2077,9 +2077,17 @@ 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 *cb = impl_from_ID3D10ShaderReflectionConstantBuffer(iface);
 
-    return &null_variable.ID3D10ShaderReflectionVariable_iface;
+    TRACE("iface %p, index %u.\n", iface, index);
+
+    if (index >= cb->variable_count)
+    {
+        WARN("Invalid index specified.\n");
+        return &null_variable.ID3D10ShaderReflectionVariable_iface;
+    }
+
+    return &cb->variables[index].ID3D10ShaderReflectionVariable_iface;
 }
 
 static ID3D10ShaderReflectionVariable * STDMETHODCALLTYPE d3d10_shader_reflection_constant_buffer_GetVariableByName(
-- 
2.21.0




More information about the wine-devel mailing list