mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader: Get rid of hlsl_base_type_to_string().
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
60f7735b20
commit
124069907d
@ -639,55 +639,37 @@ static int compare_function_decl_rb(const void *key, const struct rb_entry *entr
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *hlsl_base_type_to_string(const struct hlsl_type *type)
|
||||
{
|
||||
const char *name = "(unknown)";
|
||||
|
||||
switch (type->base_type)
|
||||
{
|
||||
case HLSL_TYPE_FLOAT: name = "float"; break;
|
||||
case HLSL_TYPE_HALF: name = "half"; break;
|
||||
case HLSL_TYPE_DOUBLE: name = "double"; break;
|
||||
case HLSL_TYPE_INT: name = "int"; break;
|
||||
case HLSL_TYPE_UINT: name = "uint"; break;
|
||||
case HLSL_TYPE_BOOL: name = "bool"; break;
|
||||
case HLSL_TYPE_SAMPLER:
|
||||
switch (type->sampler_dim)
|
||||
{
|
||||
case HLSL_SAMPLER_DIM_GENERIC: name = "sampler"; break;
|
||||
case HLSL_SAMPLER_DIM_1D: name = "sampler1D"; break;
|
||||
case HLSL_SAMPLER_DIM_2D: name = "sampler2D"; break;
|
||||
case HLSL_SAMPLER_DIM_3D: name = "sampler3D"; break;
|
||||
case HLSL_SAMPLER_DIM_CUBE: name = "samplerCUBE"; break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
FIXME("Unhandled case %u.\n", type->base_type);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
char *hlsl_type_to_string(const struct hlsl_type *type)
|
||||
{
|
||||
const char *name;
|
||||
char *string;
|
||||
|
||||
static const char base_types[HLSL_TYPE_LAST_SCALAR + 1][7] =
|
||||
{
|
||||
"float",
|
||||
"half",
|
||||
"double",
|
||||
"int",
|
||||
"uint",
|
||||
"bool",
|
||||
};
|
||||
|
||||
if (type->name)
|
||||
return vkd3d_strdup(type->name);
|
||||
|
||||
switch (type->type)
|
||||
{
|
||||
case HLSL_CLASS_SCALAR:
|
||||
return vkd3d_strdup(hlsl_base_type_to_string(type));
|
||||
return vkd3d_strdup(base_types[type->base_type]);
|
||||
|
||||
case HLSL_CLASS_VECTOR:
|
||||
name = hlsl_base_type_to_string(type);
|
||||
name = base_types[type->base_type];
|
||||
if ((string = malloc(strlen(name) + 2)))
|
||||
sprintf(string, "%s%u", name, type->dimx);
|
||||
return string;
|
||||
|
||||
case HLSL_CLASS_MATRIX:
|
||||
name = hlsl_base_type_to_string(type);
|
||||
name = base_types[type->base_type];
|
||||
if ((string = malloc(strlen(name) + 4)))
|
||||
sprintf(string, "%s%ux%u", name, type->dimx, type->dimy);
|
||||
return string;
|
||||
@ -907,8 +889,7 @@ static void dump_ir_constant(struct vkd3d_string_buffer *buffer, const struct hl
|
||||
break;
|
||||
|
||||
default:
|
||||
vkd3d_string_buffer_printf(buffer, "Constants of type %s not supported\n",
|
||||
hlsl_base_type_to_string(type));
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
if (type->dimx != 1)
|
||||
|
@ -496,7 +496,6 @@ static inline void hlsl_src_remove(struct hlsl_src *src)
|
||||
|
||||
const char *debug_hlsl_type(const struct hlsl_type *type) DECLSPEC_HIDDEN;
|
||||
|
||||
const char *hlsl_base_type_to_string(const struct hlsl_type *type) DECLSPEC_HIDDEN;
|
||||
char *hlsl_type_to_string(const struct hlsl_type *type) DECLSPEC_HIDDEN;
|
||||
char *hlsl_modifiers_to_string(unsigned int modifiers) DECLSPEC_HIDDEN;
|
||||
const char *hlsl_node_type_to_string(enum hlsl_ir_node_type type) DECLSPEC_HIDDEN;
|
||||
|
@ -909,13 +909,14 @@ static unsigned int evaluate_array_dimension(struct hlsl_ir_node *node)
|
||||
case HLSL_TYPE_INT:
|
||||
return constant->value.i[0];
|
||||
case HLSL_TYPE_FLOAT:
|
||||
case HLSL_TYPE_HALF:
|
||||
return constant->value.f[0];
|
||||
case HLSL_TYPE_DOUBLE:
|
||||
return constant->value.d[0];
|
||||
case HLSL_TYPE_BOOL:
|
||||
return constant->value.b[0];
|
||||
default:
|
||||
WARN("Invalid type %s.\n", hlsl_base_type_to_string(constant->node.data_type));
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user