[PATCH v5 10/14] d3dcompiler: Partially implement d3d10 ConstantBuffer methods.

Connor McAdams conmanx360 at gmail.com
Thu Oct 31 16:16:10 CDT 2019


Partially implement ID3D10ShaderReflectionConstantBuffer methods.

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

diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c
index 8e0c93deaa..6cd715cbad 100644
--- a/dlls/d3dcompiler_43/reflection.c
+++ b/dlls/d3dcompiler_43/reflection.c
@@ -47,6 +47,7 @@ struct d3dcompiler_shader_signature
 struct d3dcompiler_shader_reflection_type
 {
     ID3D11ShaderReflectionType ID3D11ShaderReflectionType_iface;
+    ID3D10ShaderReflectionType ID3D10ShaderReflectionType_iface;
 
     DWORD id;
     struct wine_rb_entry entry;
@@ -68,6 +69,7 @@ struct d3dcompiler_shader_reflection_type_member
 struct d3dcompiler_shader_reflection_variable
 {
     ID3D11ShaderReflectionVariable ID3D11ShaderReflectionVariable_iface;
+    ID3D10ShaderReflectionVariable ID3D10ShaderReflectionVariable_iface;
 
     struct d3dcompiler_shader_reflection_constant_buffer *constant_buffer;
     struct d3dcompiler_shader_reflection_type *type;
@@ -82,6 +84,7 @@ struct d3dcompiler_shader_reflection_variable
 struct d3dcompiler_shader_reflection_constant_buffer
 {
     ID3D11ShaderReflectionConstantBuffer ID3D11ShaderReflectionConstantBuffer_iface;
+    ID3D10ShaderReflectionConstantBuffer ID3D10ShaderReflectionConstantBuffer_iface;
 
     struct d3dcompiler_shader_reflection *reflection;
 
@@ -150,10 +153,15 @@ static const struct ID3D11ShaderReflectionConstantBufferVtbl d3dcompiler_shader_
 static const struct ID3D11ShaderReflectionVariableVtbl d3dcompiler_shader_reflection_variable_vtbl;
 static const struct ID3D11ShaderReflectionTypeVtbl d3dcompiler_shader_reflection_type_vtbl;
 
+static const struct ID3D10ShaderReflectionConstantBufferVtbl d3d10_shader_reflection_constant_buffer_vtbl;
+static const struct ID3D10ShaderReflectionVariableVtbl d3d10_shader_reflection_variable_vtbl;
+static const struct ID3D10ShaderReflectionTypeVtbl d3d10_shader_reflection_type_vtbl;
+
 /* null objects - needed for invalid calls */
-static struct d3dcompiler_shader_reflection_constant_buffer null_constant_buffer = {{&d3dcompiler_shader_reflection_constant_buffer_vtbl}};
-static struct d3dcompiler_shader_reflection_type null_type = {{&d3dcompiler_shader_reflection_type_vtbl}};
-static struct d3dcompiler_shader_reflection_variable null_variable = {{&d3dcompiler_shader_reflection_variable_vtbl},
+static struct d3dcompiler_shader_reflection_constant_buffer null_constant_buffer = {{&d3dcompiler_shader_reflection_constant_buffer_vtbl},
+    {&d3d10_shader_reflection_constant_buffer_vtbl}};
+static struct d3dcompiler_shader_reflection_type null_type = {{&d3dcompiler_shader_reflection_type_vtbl}, {&d3d10_shader_reflection_type_vtbl}};
+static struct d3dcompiler_shader_reflection_variable null_variable = {{&d3dcompiler_shader_reflection_variable_vtbl}, {&d3d10_shader_reflection_variable_vtbl},
     &null_constant_buffer, &null_type};
 
 static BOOL copy_name(const char *ptr, char **name)
@@ -890,6 +898,65 @@ static const struct ID3D11ShaderReflectionVtbl d3dcompiler_shader_reflection_vtb
     d3dcompiler_shader_reflection_GetRequiresFlags,
 };
 
+/* ID3D10ShaderReflectionConstantBuffer methods */
+#ifndef D3D_COMPILER_VERSION
+static inline struct d3dcompiler_shader_reflection_constant_buffer *impl_from_ID3D10ShaderReflectionConstantBuffer(ID3D10ShaderReflectionConstantBuffer *iface)
+{
+    return CONTAINING_RECORD(iface, struct d3dcompiler_shader_reflection_constant_buffer, ID3D10ShaderReflectionConstantBuffer_iface);
+}
+
+static HRESULT STDMETHODCALLTYPE d3d10_shader_reflection_constant_buffer_GetDesc(
+        ID3D10ShaderReflectionConstantBuffer *iface, D3D10_SHADER_BUFFER_DESC *desc)
+{
+    struct d3dcompiler_shader_reflection_constant_buffer *reflection = impl_from_ID3D10ShaderReflectionConstantBuffer(iface);
+
+    TRACE("iface %p, desc %p.\n", iface, desc);
+
+    if (reflection == &null_constant_buffer)
+    {
+        WARN("Null constant buffer specified.\n");
+        return E_FAIL;
+    }
+
+    if (!desc)
+    {
+        WARN("Invalid argument specified.\n");
+        return E_FAIL;
+    }
+
+    desc->Name = reflection->name;
+    desc->Type = reflection->type;
+    desc->Variables = reflection->variable_count;
+    desc->Size = reflection->size;
+    desc->uFlags = reflection->flags;
+
+    return S_OK;
+}
+
+static ID3D10ShaderReflectionVariable * STDMETHODCALLTYPE d3d10_shader_reflection_constant_buffer_GetVariableByIndex(
+        ID3D10ShaderReflectionConstantBuffer *iface, UINT index)
+{
+    FIXME("iface %p, index %d stub!\n", iface, index);
+
+    return &null_variable.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);
+
+    return &null_variable.ID3D10ShaderReflectionVariable_iface;
+}
+
+static const struct ID3D10ShaderReflectionConstantBufferVtbl d3d10_shader_reflection_constant_buffer_vtbl =
+{
+    d3d10_shader_reflection_constant_buffer_GetDesc,
+    d3d10_shader_reflection_constant_buffer_GetVariableByIndex,
+    d3d10_shader_reflection_constant_buffer_GetVariableByName,
+};
+#endif
+
 /* ID3D11ShaderReflectionConstantBuffer methods */
 
 static inline struct d3dcompiler_shader_reflection_constant_buffer *impl_from_ID3D11ShaderReflectionConstantBuffer(ID3D11ShaderReflectionConstantBuffer *iface)
@@ -1693,6 +1760,7 @@ static HRESULT d3dcompiler_parse_rdef(struct d3dcompiler_shader_reflection *r, c
             struct d3dcompiler_shader_reflection_constant_buffer *cb = &constant_buffers[i];
 
             cb->ID3D11ShaderReflectionConstantBuffer_iface.lpVtbl = &d3dcompiler_shader_reflection_constant_buffer_vtbl;
+            cb->ID3D10ShaderReflectionConstantBuffer_iface.lpVtbl = &d3d10_shader_reflection_constant_buffer_vtbl;
             cb->reflection = r;
 
             read_dword(&ptr, &offset);
-- 
2.20.1




More information about the wine-devel mailing list