vkd3d-shader/fx: Handle the 'half' type in fx_4+.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov 2024-09-26 14:52:11 +02:00 committed by Henri Verbeet
parent 2626dcc55d
commit da0469f190
Notes: Henri Verbeet 2024-09-30 21:05:32 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1120
2 changed files with 10 additions and 1 deletions

View File

@ -467,6 +467,7 @@ static uint32_t get_fx_4_type_size(const struct hlsl_type *type)
static const uint32_t fx_4_numeric_base_type[] =
{
[HLSL_TYPE_HALF] = 1,
[HLSL_TYPE_FLOAT] = 1,
[HLSL_TYPE_INT ] = 2,
[HLSL_TYPE_UINT ] = 3,
@ -503,6 +504,7 @@ static uint32_t get_fx_4_numeric_type_description(const struct hlsl_type *type,
switch (type->e.numeric.type)
{
case HLSL_TYPE_FLOAT:
case HLSL_TYPE_HALF:
case HLSL_TYPE_INT:
case HLSL_TYPE_UINT:
case HLSL_TYPE_BOOL:
@ -579,6 +581,12 @@ static const char * get_fx_4_type_name(const struct hlsl_type *type)
case HLSL_CLASS_STRING:
return "String";
case HLSL_CLASS_SCALAR:
case HLSL_CLASS_VECTOR:
case HLSL_CLASS_MATRIX:
if (type->e.numeric.type == HLSL_TYPE_HALF)
return "float";
/* fall-through */
default:
return type->name;
}
@ -1267,6 +1275,7 @@ static uint32_t write_fx_4_default_value(struct hlsl_type *value_type, struct hl
switch (type->e.numeric.type)
{
case HLSL_TYPE_FLOAT:
case HLSL_TYPE_HALF:
case HLSL_TYPE_INT:
case HLSL_TYPE_UINT:
case HLSL_TYPE_BOOL:

View File

@ -2,7 +2,7 @@
shader model >= 4.0
shader model < 6.0
[effect todo]
[effect]
float var1 = 0.1f;
float2 var2 = {0.2f,0.3f};
float2x4 var3 = {1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0};