vkd3d-shader/hlsl: Make HLSL_TYPE_STRING into a separate class.

This commit is contained in:
Zebediah Figura 2024-02-05 20:04:02 -06:00 committed by Alexandre Julliard
parent cdcf2da2eb
commit f57db442b0
Notes: Alexandre Julliard 2024-04-19 22:26:17 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/781
6 changed files with 20 additions and 7 deletions

View File

@ -1506,14 +1506,15 @@ D3DXPARAMETER_CLASS hlsl_sm1_class(const struct hlsl_type *type)
return D3DXPC_MATRIX_COLUMNS; return D3DXPC_MATRIX_COLUMNS;
else else
return D3DXPC_MATRIX_ROWS; return D3DXPC_MATRIX_ROWS;
case HLSL_CLASS_OBJECT:
return D3DXPC_OBJECT;
case HLSL_CLASS_SCALAR: case HLSL_CLASS_SCALAR:
return D3DXPC_SCALAR; return D3DXPC_SCALAR;
case HLSL_CLASS_STRUCT: case HLSL_CLASS_STRUCT:
return D3DXPC_STRUCT; return D3DXPC_STRUCT;
case HLSL_CLASS_VECTOR: case HLSL_CLASS_VECTOR:
return D3DXPC_VECTOR; return D3DXPC_VECTOR;
case HLSL_CLASS_OBJECT:
case HLSL_CLASS_STRING:
return D3DXPC_OBJECT;
case HLSL_CLASS_VOID: case HLSL_CLASS_VOID:
break; break;
} }
@ -1574,8 +1575,6 @@ D3DXPARAMETER_TYPE hlsl_sm1_base_type(const struct hlsl_type *type)
vkd3d_unreachable(); vkd3d_unreachable();
} }
break; break;
case HLSL_TYPE_STRING:
return D3DXPT_STRING;
case HLSL_TYPE_TEXTURE: case HLSL_TYPE_TEXTURE:
switch (type->sampler_dim) switch (type->sampler_dim)
{ {
@ -1607,6 +1606,9 @@ D3DXPARAMETER_TYPE hlsl_sm1_base_type(const struct hlsl_type *type)
case HLSL_CLASS_STRUCT: case HLSL_CLASS_STRUCT:
return D3DXPT_VOID; return D3DXPT_VOID;
case HLSL_CLASS_STRING:
return D3DXPT_STRING;
case HLSL_CLASS_VOID: case HLSL_CLASS_VOID:
break; break;
} }

View File

@ -437,6 +437,7 @@ static uint32_t write_fx_4_type(const struct hlsl_type *type, struct fx_write_co
case HLSL_CLASS_ARRAY: case HLSL_CLASS_ARRAY:
vkd3d_unreachable(); vkd3d_unreachable();
case HLSL_CLASS_STRING:
case HLSL_CLASS_VOID: case HLSL_CLASS_VOID:
FIXME("Writing type class %u is not implemented.\n", type->class); FIXME("Writing type class %u is not implemented.\n", type->class);
set_status(fx, VKD3D_ERROR_NOT_IMPLEMENTED); set_status(fx, VKD3D_ERROR_NOT_IMPLEMENTED);
@ -810,7 +811,6 @@ static bool is_type_supported_fx_2(struct hlsl_ctx *ctx, const struct hlsl_type
break; break;
case HLSL_TYPE_SAMPLER: case HLSL_TYPE_SAMPLER:
case HLSL_TYPE_STRING:
case HLSL_TYPE_PIXELSHADER: case HLSL_TYPE_PIXELSHADER:
case HLSL_TYPE_VERTEXSHADER: case HLSL_TYPE_VERTEXSHADER:
hlsl_fixme(ctx, loc, "Write fx 2.0 parameter object type %#x.", type->base_type); hlsl_fixme(ctx, loc, "Write fx 2.0 parameter object type %#x.", type->base_type);
@ -820,6 +820,10 @@ static bool is_type_supported_fx_2(struct hlsl_ctx *ctx, const struct hlsl_type
return false; return false;
} }
case HLSL_CLASS_STRING:
hlsl_fixme(ctx, loc, "Write fx 2.0 parameter class %#x.", type->class);
return false;
case HLSL_CLASS_VOID: case HLSL_CLASS_VOID:
return false; return false;
} }

View File

@ -366,6 +366,7 @@ static void hlsl_type_calculate_reg_size(struct hlsl_ctx *ctx, struct hlsl_type
break; break;
} }
case HLSL_CLASS_STRING:
case HLSL_CLASS_VOID: case HLSL_CLASS_VOID:
break; break;
} }
@ -428,6 +429,7 @@ static bool type_is_single_component(const struct hlsl_type *type)
{ {
case HLSL_CLASS_SCALAR: case HLSL_CLASS_SCALAR:
case HLSL_CLASS_OBJECT: case HLSL_CLASS_OBJECT:
case HLSL_CLASS_STRING:
return true; return true;
case HLSL_CLASS_VECTOR: case HLSL_CLASS_VECTOR:
@ -559,6 +561,7 @@ unsigned int hlsl_type_get_component_offset(struct hlsl_ctx *ctx, struct hlsl_ty
break; break;
case HLSL_CLASS_OBJECT: case HLSL_CLASS_OBJECT:
case HLSL_CLASS_STRING:
assert(idx == 0); assert(idx == 0);
break; break;
@ -930,6 +933,7 @@ unsigned int hlsl_type_component_count(const struct hlsl_type *type)
return hlsl_type_component_count(type->e.array.type) * type->e.array.elements_count; return hlsl_type_component_count(type->e.array.type) * type->e.array.elements_count;
case HLSL_CLASS_OBJECT: case HLSL_CLASS_OBJECT:
case HLSL_CLASS_STRING:
return 1; return 1;
case HLSL_CLASS_VOID: case HLSL_CLASS_VOID:
@ -2355,6 +2359,7 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru
} }
} }
case HLSL_CLASS_STRING:
case HLSL_CLASS_VOID: case HLSL_CLASS_VOID:
break; break;
} }
@ -3532,7 +3537,6 @@ static void declare_predefined_types(struct hlsl_ctx *ctx)
{"matrix", HLSL_CLASS_MATRIX, HLSL_TYPE_FLOAT, 4, 4}, {"matrix", HLSL_CLASS_MATRIX, HLSL_TYPE_FLOAT, 4, 4},
{"fxgroup", HLSL_CLASS_OBJECT, HLSL_TYPE_EFFECT_GROUP, 1, 1}, {"fxgroup", HLSL_CLASS_OBJECT, HLSL_TYPE_EFFECT_GROUP, 1, 1},
{"pass", HLSL_CLASS_OBJECT, HLSL_TYPE_PASS, 1, 1}, {"pass", HLSL_CLASS_OBJECT, HLSL_TYPE_PASS, 1, 1},
{"STRING", HLSL_CLASS_OBJECT, HLSL_TYPE_STRING, 1, 1},
{"texture", HLSL_CLASS_OBJECT, HLSL_TYPE_TEXTURE, 1, 1}, {"texture", HLSL_CLASS_OBJECT, HLSL_TYPE_TEXTURE, 1, 1},
{"pixelshader", HLSL_CLASS_OBJECT, HLSL_TYPE_PIXELSHADER, 1, 1}, {"pixelshader", HLSL_CLASS_OBJECT, HLSL_TYPE_PIXELSHADER, 1, 1},
{"vertexshader", HLSL_CLASS_OBJECT, HLSL_TYPE_VERTEXSHADER, 1, 1}, {"vertexshader", HLSL_CLASS_OBJECT, HLSL_TYPE_VERTEXSHADER, 1, 1},
@ -3649,6 +3653,7 @@ static void declare_predefined_types(struct hlsl_ctx *ctx)
} }
ctx->builtin_types.Void = hlsl_new_simple_type(ctx, "void", HLSL_CLASS_VOID); ctx->builtin_types.Void = hlsl_new_simple_type(ctx, "void", HLSL_CLASS_VOID);
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "STRING", HLSL_CLASS_STRING));
for (i = 0; i < ARRAY_SIZE(effect_types); ++i) for (i = 0; i < ARRAY_SIZE(effect_types); ++i)
{ {

View File

@ -79,6 +79,7 @@ enum hlsl_type_class
HLSL_CLASS_STRUCT, HLSL_CLASS_STRUCT,
HLSL_CLASS_ARRAY, HLSL_CLASS_ARRAY,
HLSL_CLASS_OBJECT, HLSL_CLASS_OBJECT,
HLSL_CLASS_STRING,
HLSL_CLASS_VOID, HLSL_CLASS_VOID,
}; };
@ -101,7 +102,6 @@ enum hlsl_base_type
HLSL_TYPE_DEPTHSTENCILVIEW, HLSL_TYPE_DEPTHSTENCILVIEW,
HLSL_TYPE_TECHNIQUE, HLSL_TYPE_TECHNIQUE,
HLSL_TYPE_EFFECT_GROUP, HLSL_TYPE_EFFECT_GROUP,
HLSL_TYPE_STRING,
}; };
enum hlsl_sampler_dim enum hlsl_sampler_dim

View File

@ -1635,6 +1635,7 @@ static bool copy_propagation_transform_load(struct hlsl_ctx *ctx,
* matrices yet. */ * matrices yet. */
return false; return false;
case HLSL_CLASS_STRING:
case HLSL_CLASS_VOID: case HLSL_CLASS_VOID:
vkd3d_unreachable(); vkd3d_unreachable();
} }

View File

@ -3008,6 +3008,7 @@ static D3D_SHADER_VARIABLE_CLASS sm4_class(const struct hlsl_type *type)
case HLSL_CLASS_ARRAY: case HLSL_CLASS_ARRAY:
case HLSL_CLASS_STRUCT: case HLSL_CLASS_STRUCT:
case HLSL_CLASS_OBJECT: case HLSL_CLASS_OBJECT:
case HLSL_CLASS_STRING:
case HLSL_CLASS_VOID: case HLSL_CLASS_VOID:
break; break;
} }