d3dcompiler: Parse type name strings.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-07-29 12:44:17 -05:00 committed by Alexandre Julliard
parent bed677e343
commit 72b74d7cdc
2 changed files with 22 additions and 5 deletions

View File

@ -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;

View File

@ -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 */