mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/hlsl: Handle NULL constants.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
committed by
Henri Verbeet
parent
d945d5e78c
commit
b4d957f848
Notes:
Henri Verbeet
2024-08-13 21:26:02 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/980
@@ -386,6 +386,7 @@ static void hlsl_type_calculate_reg_size(struct hlsl_ctx *ctx, struct hlsl_type
|
||||
case HLSL_CLASS_HULL_SHADER:
|
||||
case HLSL_CLASS_GEOMETRY_SHADER:
|
||||
case HLSL_CLASS_BLEND_STATE:
|
||||
case HLSL_CLASS_NULL:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -461,6 +462,7 @@ static bool type_is_single_component(const struct hlsl_type *type)
|
||||
case HLSL_CLASS_HULL_SHADER:
|
||||
case HLSL_CLASS_GEOMETRY_SHADER:
|
||||
case HLSL_CLASS_BLEND_STATE:
|
||||
case HLSL_CLASS_NULL:
|
||||
return true;
|
||||
|
||||
case HLSL_CLASS_VECTOR:
|
||||
@@ -627,6 +629,7 @@ unsigned int hlsl_type_get_component_offset(struct hlsl_ctx *ctx, struct hlsl_ty
|
||||
case HLSL_CLASS_VOID:
|
||||
case HLSL_CLASS_SCALAR:
|
||||
case HLSL_CLASS_CONSTANT_BUFFER:
|
||||
case HLSL_CLASS_NULL:
|
||||
vkd3d_unreachable();
|
||||
}
|
||||
type = next_type;
|
||||
@@ -1023,6 +1026,7 @@ unsigned int hlsl_type_component_count(const struct hlsl_type *type)
|
||||
case HLSL_CLASS_HULL_SHADER:
|
||||
case HLSL_CLASS_GEOMETRY_SHADER:
|
||||
case HLSL_CLASS_BLEND_STATE:
|
||||
case HLSL_CLASS_NULL:
|
||||
return 1;
|
||||
|
||||
case HLSL_CLASS_EFFECT_GROUP:
|
||||
@@ -1115,6 +1119,7 @@ bool hlsl_types_are_equal(const struct hlsl_type *t1, const struct hlsl_type *t2
|
||||
case HLSL_CLASS_HULL_SHADER:
|
||||
case HLSL_CLASS_GEOMETRY_SHADER:
|
||||
case HLSL_CLASS_BLEND_STATE:
|
||||
case HLSL_CLASS_NULL:
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1464,7 +1469,7 @@ struct hlsl_ir_node *hlsl_new_constant(struct hlsl_ctx *ctx, struct hlsl_type *t
|
||||
{
|
||||
struct hlsl_ir_constant *c;
|
||||
|
||||
VKD3D_ASSERT(type->class <= HLSL_CLASS_VECTOR);
|
||||
VKD3D_ASSERT(type->class <= HLSL_CLASS_VECTOR || type->class == HLSL_CLASS_NULL);
|
||||
|
||||
if (!(c = hlsl_alloc(ctx, sizeof(*c))))
|
||||
return NULL;
|
||||
@@ -1527,6 +1532,12 @@ struct hlsl_ir_node *hlsl_new_string_constant(struct hlsl_ctx *ctx, const char *
|
||||
return &s->node;
|
||||
}
|
||||
|
||||
struct hlsl_ir_node *hlsl_new_null_constant(struct hlsl_ctx *ctx, const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
struct hlsl_constant_value value = { 0 };
|
||||
return hlsl_new_constant(ctx, ctx->builtin_types.null, &value, loc);
|
||||
}
|
||||
|
||||
struct hlsl_ir_node *hlsl_new_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op,
|
||||
struct hlsl_ir_node *operands[HLSL_MAX_OPERANDS],
|
||||
struct hlsl_type *data_type, const struct vkd3d_shader_location *loc)
|
||||
@@ -2568,6 +2579,7 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru
|
||||
case HLSL_CLASS_HULL_SHADER:
|
||||
case HLSL_CLASS_GEOMETRY_SHADER:
|
||||
case HLSL_CLASS_BLEND_STATE:
|
||||
case HLSL_CLASS_NULL:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3930,6 +3942,7 @@ static void declare_predefined_types(struct hlsl_ctx *ctx)
|
||||
|
||||
ctx->builtin_types.string = hlsl_new_simple_type(ctx, "STRING", HLSL_CLASS_STRING);
|
||||
ctx->builtin_types.Void = hlsl_new_simple_type(ctx, "void", HLSL_CLASS_VOID);
|
||||
ctx->builtin_types.null = hlsl_new_simple_type(ctx, "NULL", HLSL_CLASS_NULL);
|
||||
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "DepthStencilView", HLSL_CLASS_DEPTH_STENCIL_VIEW));
|
||||
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "DepthStencilState", HLSL_CLASS_DEPTH_STENCIL_STATE));
|
||||
hlsl_scope_add_type(ctx->globals, hlsl_new_simple_type(ctx, "fxgroup", HLSL_CLASS_EFFECT_GROUP));
|
||||
|
Reference in New Issue
Block a user