mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Set component count for objects to 1.
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
This commit is contained in:
parent
e9829fdc65
commit
732f1737f4
Notes:
Alexandre Julliard
2022-10-18 00:13:00 +02:00
Approved-by: Zebediah Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/7
@ -548,25 +548,32 @@ struct hlsl_ir_function_decl *hlsl_get_func_decl(struct hlsl_ctx *ctx, const cha
|
||||
|
||||
unsigned int hlsl_type_component_count(const struct hlsl_type *type)
|
||||
{
|
||||
unsigned int count = 0, i;
|
||||
switch (type->type)
|
||||
{
|
||||
case HLSL_CLASS_SCALAR:
|
||||
case HLSL_CLASS_VECTOR:
|
||||
case HLSL_CLASS_MATRIX:
|
||||
return type->dimx * type->dimy;
|
||||
|
||||
if (type->type <= HLSL_CLASS_LAST_NUMERIC)
|
||||
{
|
||||
return type->dimx * type->dimy;
|
||||
}
|
||||
if (type->type == HLSL_CLASS_ARRAY)
|
||||
{
|
||||
return hlsl_type_component_count(type->e.array.type) * type->e.array.elements_count;
|
||||
}
|
||||
if (type->type != HLSL_CLASS_STRUCT)
|
||||
{
|
||||
ERR("Unexpected data type %#x.\n", type->type);
|
||||
return 0;
|
||||
}
|
||||
case HLSL_CLASS_STRUCT:
|
||||
{
|
||||
unsigned int count = 0, i;
|
||||
|
||||
for (i = 0; i < type->e.record.field_count; ++i)
|
||||
count += hlsl_type_component_count(type->e.record.fields[i].type);
|
||||
return count;
|
||||
for (i = 0; i < type->e.record.field_count; ++i)
|
||||
count += hlsl_type_component_count(type->e.record.fields[i].type);
|
||||
return count;
|
||||
}
|
||||
|
||||
case HLSL_CLASS_ARRAY:
|
||||
return hlsl_type_component_count(type->e.array.type) * type->e.array.elements_count;
|
||||
|
||||
case HLSL_CLASS_OBJECT:
|
||||
return 1;
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool hlsl_types_are_equal(const struct hlsl_type *t1, const struct hlsl_type *t2)
|
||||
|
@ -71,7 +71,7 @@ float4 main() : sv_target
|
||||
}
|
||||
|
||||
|
||||
[pixel shader fail todo]
|
||||
[pixel shader fail]
|
||||
Texture2D tex;
|
||||
|
||||
struct foo
|
||||
@ -90,7 +90,7 @@ float4 main() : sv_target
|
||||
}
|
||||
|
||||
|
||||
[pixel shader fail todo]
|
||||
[pixel shader fail]
|
||||
Texture2D tex;
|
||||
|
||||
struct foo
|
||||
|
Loading…
x
Reference in New Issue
Block a user