mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
vkd3d-compiler: Add get_source_type_info helper.
Signed-off-by: Isabella Bosia <ibosia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c6e36bf240
commit
76c8c05fdb
@ -42,7 +42,7 @@ enum
|
|||||||
OPTION_VERSION,
|
OPTION_VERSION,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct
|
static const struct source_type_info
|
||||||
{
|
{
|
||||||
enum vkd3d_shader_source_type type;
|
enum vkd3d_shader_source_type type;
|
||||||
const char *name;
|
const char *name;
|
||||||
@ -246,6 +246,17 @@ static enum vkd3d_shader_target_type parse_target_type(const char *target)
|
|||||||
return VKD3D_SHADER_TARGET_NONE;
|
return VKD3D_SHADER_TARGET_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct source_type_info *get_source_type_info(enum vkd3d_shader_source_type type)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(source_type_info); ++i)
|
||||||
|
if (type == source_type_info[i].type)
|
||||||
|
return &source_type_info[i];
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct target_type_info *get_target_type_info(enum vkd3d_shader_target_type type)
|
static const struct target_type_info *get_target_type_info(enum vkd3d_shader_target_type type)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -349,38 +360,25 @@ static bool parse_command_line(int argc, char **argv, struct options *options)
|
|||||||
static void print_source_types(void)
|
static void print_source_types(void)
|
||||||
{
|
{
|
||||||
const enum vkd3d_shader_source_type *source_types;
|
const enum vkd3d_shader_source_type *source_types;
|
||||||
unsigned int count, i, j;
|
unsigned int count, i;
|
||||||
|
|
||||||
source_types = vkd3d_shader_get_supported_source_types(&count);
|
source_types = vkd3d_shader_get_supported_source_types(&count);
|
||||||
fputs("Supported source types:\n", stdout);
|
fputs("Supported source types:\n", stdout);
|
||||||
for (i = 0; i < count; ++i)
|
for (i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
for (j = 0; j < ARRAY_SIZE(source_type_info); ++j)
|
const struct source_type_info *type = get_source_type_info(source_types[i]);
|
||||||
{
|
if (type)
|
||||||
if (source_types[i] == source_type_info[j].type)
|
fprintf(stdout, " %s %s", type->name, type->description);
|
||||||
{
|
|
||||||
fprintf(stdout, " %s %s\n", source_type_info[j].name, source_type_info[j].description);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_target_types(enum vkd3d_shader_source_type source_type)
|
static void print_target_types(enum vkd3d_shader_source_type source_type)
|
||||||
{
|
{
|
||||||
const enum vkd3d_shader_target_type *target_types;
|
const enum vkd3d_shader_target_type *target_types;
|
||||||
const char *source_type_name;
|
const char *source_type_name = get_source_type_info(source_type)->name;
|
||||||
unsigned int count, i;
|
unsigned int count, i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(source_type_info); ++i)
|
|
||||||
{
|
|
||||||
if (source_type == source_type_info[i].type)
|
|
||||||
{
|
|
||||||
source_type_name = source_type_info[i].name;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
target_types = vkd3d_shader_get_supported_target_types(source_type, &count);
|
target_types = vkd3d_shader_get_supported_target_types(source_type, &count);
|
||||||
fprintf(stdout, "Supported target types for source type '%s':\n", source_type_name);
|
fprintf(stdout, "Supported target types for source type '%s':\n", source_type_name);
|
||||||
for (i = 0; i < count; ++i)
|
for (i = 0; i < count; ++i)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user