Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/d3dcompiler_43/reflection.c | 15 +++++++++++++++
dlls/d3dcompiler_43/tests/reflection.c | 12 +++++++-----
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c
index e492011c55f..b163fca9e73 100644
--- a/dlls/d3dcompiler_43/reflection.c
+++ b/dlls/d3dcompiler_43/reflection.c
@@ -51,6 +51,7 @@ struct d3dcompiler_shader_reflection_type
D3D11_SHADER_TYPE_DESC desc;
struct d3dcompiler_shader_reflection_type_member *members;
+ char *name;
};
struct d3dcompiler_shader_reflection_type_member
@@ -222,6 +223,7 @@ static void d3dcompiler_shader_reflection_type_destroy(struct wine_rb_entry *ent
HeapFree(GetProcessHeap(), 0, t->members);
}
+ heap_free(t->name);
HeapFree(GetProcessHeap(), 0, t);
}
@@ -1244,6 +1246,19 @@ static HRESULT d3dcompiler_parse_type(struct d3dcompiler_shader_reflection_type
}
}
+ if ((type->reflection->target & D3DCOMPILER_SHADER_TARGET_VERSION_MASK) >= 0x500)
+ {
+ read_dword(&ptr, &offset);
+ if (!copy_name(data + offset, &type->name))
+ {
+ ERR("Failed to copy name.\n");
+ heap_free(members);
+ return E_OUTOFMEMORY;
+ }
+ desc->Name = type->name;
+ TRACE("Type name: %s.\n", debugstr_a(type->name));
+ }
+
type->members = members;
return S_OK;
diff --git a/dlls/d3dcompiler_43/tests/reflection.c b/dlls/d3dcompiler_43/tests/reflection.c
index 2c1c9028bbb..1b9d2d418d9 100644
--- a/dlls/d3dcompiler_43/tests/reflection.c
+++ b/dlls/d3dcompiler_43/tests/reflection.c
@@ -1207,11 +1207,11 @@ static const struct {
static const D3D11_SHADER_TYPE_DESC test_reflection_constant_buffer_type_result[] =
{
- {D3D11_SVC_INTERFACE_POINTER, D3D11_SVT_INTERFACE_POINTER, 1, 4, 0, 1, 0},
- {D3D_SVC_SCALAR, D3D_SVT_FLOAT, 1, 1, 0, 1, 0},
- {D3D_SVC_SCALAR, D3D_SVT_FLOAT, 1, 1, 2, 1, 0},
- {D3D_SVC_SCALAR, D3D_SVT_INT, 1, 1, 0, 1, 0},
- {D3D_SVC_STRUCT, D3D_SVT_VOID, 1, 2, 0, 1, 0},
+ {D3D11_SVC_INTERFACE_POINTER, D3D11_SVT_INTERFACE_POINTER, 1, 4, 0, 1, 0, "iTest"},
+ {D3D_SVC_SCALAR, D3D_SVT_FLOAT, 1, 1, 0, 1, 0, "float"},
+ {D3D_SVC_SCALAR, D3D_SVT_FLOAT, 1, 1, 2, 1, 0, "float"},
+ {D3D_SVC_SCALAR, D3D_SVT_INT, 1, 1, 0, 1, 0, "int"},
+ {D3D_SVC_STRUCT, D3D_SVT_VOID, 1, 2, 0, 1, 0, "s"},
};
static void test_reflection_constant_buffer(void)
@@ -1459,6 +1459,8 @@ static void test_reflection_constant_buffer(void)
i, tdesc.Elements, ptdesc->Elements);
ok(tdesc.Offset == ptdesc->Offset, "GetDesc(%u) Offset failed, got %u, expected %u\n",
i, tdesc.Offset, ptdesc->Offset);
+ ok(!strcmp(tdesc.Name, ptdesc->Name), "GetDesc(%u) Name failed, got %s, expected %s\n",
+ i, tdesc.Name, ptdesc->Name);
}
/* types */
--
2.20.1