mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Make some FIXME messages into proper compiler errors.
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
65a13c8290
commit
c08a9cff7f
@ -55,6 +55,23 @@ void hlsl_warning(struct hlsl_ctx *ctx, const struct vkd3d_shader_location loc,
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void hlsl_fixme(struct hlsl_ctx *ctx, const struct vkd3d_shader_location loc, const char *fmt, ...)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
string = hlsl_get_string_buffer(ctx);
|
||||
vkd3d_string_buffer_printf(string, "Aborting due to not yet implemented feature: ");
|
||||
vkd3d_string_buffer_vprintf(string, fmt, args);
|
||||
vkd3d_shader_error(ctx->message_context, &loc, VKD3D_SHADER_ERROR_HLSL_NOT_IMPLEMENTED, "%s", string->buffer);
|
||||
hlsl_release_string_buffer(ctx, string);
|
||||
va_end(args);
|
||||
|
||||
if (!ctx->result)
|
||||
ctx->result = VKD3D_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
bool hlsl_add_var(struct hlsl_ctx *ctx, struct hlsl_ir_var *decl, bool local_var)
|
||||
{
|
||||
struct hlsl_scope *scope = ctx->cur_scope;
|
||||
@ -1031,7 +1048,7 @@ static void dump_ir_constant(struct vkd3d_string_buffer *buffer, const struct hl
|
||||
vkd3d_string_buffer_printf(buffer, "}");
|
||||
}
|
||||
|
||||
static const char *debug_expr_op(const struct hlsl_ir_expr *expr)
|
||||
const char *debug_hlsl_expr_op(enum hlsl_ir_expr_op op)
|
||||
{
|
||||
static const char *const op_names[] =
|
||||
{
|
||||
@ -1082,14 +1099,14 @@ static const char *debug_expr_op(const struct hlsl_ir_expr *expr)
|
||||
[HLSL_OP3_LERP] = "lerp",
|
||||
};
|
||||
|
||||
return op_names[expr->op];
|
||||
return op_names[op];
|
||||
}
|
||||
|
||||
static void dump_ir_expr(struct vkd3d_string_buffer *buffer, const struct hlsl_ir_expr *expr)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
vkd3d_string_buffer_printf(buffer, "%s (", debug_expr_op(expr));
|
||||
vkd3d_string_buffer_printf(buffer, "%s (", debug_hlsl_expr_op(expr->op));
|
||||
for (i = 0; i < 3 && expr->operands[i].node; ++i)
|
||||
{
|
||||
dump_src(buffer, &expr->operands[i]);
|
||||
|
@ -590,6 +590,7 @@ static inline void hlsl_release_string_buffer(struct hlsl_ctx *ctx, struct vkd3d
|
||||
vkd3d_string_buffer_release(&ctx->string_buffers, buffer);
|
||||
}
|
||||
|
||||
const char *debug_hlsl_expr_op(enum hlsl_ir_expr_op op);
|
||||
const char *debug_hlsl_type(struct hlsl_ctx *ctx, const struct hlsl_type *type);
|
||||
const char *debug_hlsl_writemask(unsigned int writemask);
|
||||
|
||||
@ -651,6 +652,8 @@ struct hlsl_ir_load *hlsl_new_var_load(struct hlsl_ctx *ctx, struct hlsl_ir_var
|
||||
|
||||
void hlsl_error(struct hlsl_ctx *ctx, const struct vkd3d_shader_location loc,
|
||||
enum vkd3d_shader_error error, const char *fmt, ...) VKD3D_PRINTF_FUNC(4, 5);
|
||||
void hlsl_fixme(struct hlsl_ctx *ctx, const struct vkd3d_shader_location loc,
|
||||
const char *fmt, ...) VKD3D_PRINTF_FUNC(3, 4);
|
||||
void hlsl_warning(struct hlsl_ctx *ctx, const struct vkd3d_shader_location loc,
|
||||
enum vkd3d_shader_error error, const char *fmt, ...) VKD3D_PRINTF_FUNC(4, 5);
|
||||
void hlsl_note(struct hlsl_ctx *ctx, const struct vkd3d_shader_location loc,
|
||||
|
@ -1213,7 +1213,7 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct list *in
|
||||
{
|
||||
if (lhs->type == HLSL_IR_EXPR && hlsl_ir_expr(lhs)->op == HLSL_OP1_CAST)
|
||||
{
|
||||
FIXME("Cast on the lhs.\n");
|
||||
hlsl_fixme(ctx, lhs->loc, "Cast on the LHS.");
|
||||
vkd3d_free(store);
|
||||
return NULL;
|
||||
}
|
||||
@ -1223,7 +1223,7 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct list *in
|
||||
unsigned int width, s = swizzle->swizzle;
|
||||
|
||||
if (lhs->data_type->type == HLSL_CLASS_MATRIX)
|
||||
FIXME("Assignments with writemasks and matrices on lhs are not supported yet.\n");
|
||||
hlsl_fixme(ctx, lhs->loc, "Matrix assignment with a writemask.");
|
||||
|
||||
if (!invert_swizzle(&s, &writemask, &width))
|
||||
{
|
||||
@ -1338,7 +1338,9 @@ static void struct_var_initializer(struct hlsl_ctx *ctx, struct list *list, stru
|
||||
list_add_tail(list, &store->node.entry);
|
||||
}
|
||||
else
|
||||
FIXME("Initializing with \"mismatched\" fields is not supported yet.\n");
|
||||
{
|
||||
hlsl_fixme(ctx, node->loc, "Implicit cast in structure initializer.");
|
||||
}
|
||||
}
|
||||
|
||||
vkd3d_free(initializer->args);
|
||||
@ -1502,14 +1504,14 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t
|
||||
}
|
||||
if (v->arrays.count)
|
||||
{
|
||||
FIXME("Initializing arrays is not supported yet.\n");
|
||||
hlsl_fixme(ctx, v->loc, "Array initializer.");
|
||||
free_parse_initializer(&v->initializer);
|
||||
vkd3d_free(v);
|
||||
continue;
|
||||
}
|
||||
if (v->initializer.args_count > 1)
|
||||
{
|
||||
FIXME("Complex initializers are not supported yet.\n");
|
||||
hlsl_fixme(ctx, v->loc, "Complex initializer.");
|
||||
free_parse_initializer(&v->initializer);
|
||||
vkd3d_free(v);
|
||||
continue;
|
||||
@ -1786,7 +1788,7 @@ hlsl_prog:
|
||||
| hlsl_prog declaration_statement
|
||||
{
|
||||
if (!list_empty($2))
|
||||
FIXME("Uniform initializer.\n");
|
||||
hlsl_fixme(ctx, @2, "Uniform initializer.");
|
||||
hlsl_free_instr_list($2);
|
||||
}
|
||||
| hlsl_prog preproc_directive
|
||||
@ -2769,7 +2771,7 @@ postfix_expr:
|
||||
}
|
||||
|
||||
if ($2->type == HLSL_CLASS_MATRIX)
|
||||
FIXME("Matrix constructors are not supported yet.\n");
|
||||
hlsl_fixme(ctx, @2, "Matrix constructor.");
|
||||
|
||||
sprintf(name, "<constructor-%x>", counter++);
|
||||
if (!(var = hlsl_new_synthetic_var(ctx, name, $2, @2)))
|
||||
@ -2931,11 +2933,11 @@ shift_expr:
|
||||
add_expr
|
||||
| shift_expr OP_LEFTSHIFT add_expr
|
||||
{
|
||||
FIXME("Left shift.\n");
|
||||
hlsl_fixme(ctx, @$, "Left shift.");
|
||||
}
|
||||
| shift_expr OP_RIGHTSHIFT add_expr
|
||||
{
|
||||
FIXME("Right shift.\n");
|
||||
hlsl_fixme(ctx, @$, "Right shift.");
|
||||
}
|
||||
|
||||
relational_expr:
|
||||
@ -2972,42 +2974,42 @@ bitand_expr:
|
||||
equality_expr
|
||||
| bitand_expr '&' equality_expr
|
||||
{
|
||||
FIXME("Bitwise AND.\n");
|
||||
hlsl_fixme(ctx, @$, "Bitwise AND.");
|
||||
}
|
||||
|
||||
bitxor_expr:
|
||||
bitand_expr
|
||||
| bitxor_expr '^' bitand_expr
|
||||
{
|
||||
FIXME("Bitwise XOR.\n");
|
||||
hlsl_fixme(ctx, @$, "Bitwise XOR.");
|
||||
}
|
||||
|
||||
bitor_expr:
|
||||
bitxor_expr
|
||||
| bitor_expr '|' bitxor_expr
|
||||
{
|
||||
FIXME("Bitwise OR.\n");
|
||||
hlsl_fixme(ctx, @$, "Bitwise OR.");
|
||||
}
|
||||
|
||||
logicand_expr:
|
||||
bitor_expr
|
||||
| logicand_expr OP_AND bitor_expr
|
||||
{
|
||||
FIXME("Logical AND.\n");
|
||||
hlsl_fixme(ctx, @$, "Logical AND.");
|
||||
}
|
||||
|
||||
logicor_expr:
|
||||
logicand_expr
|
||||
| logicor_expr OP_OR logicand_expr
|
||||
{
|
||||
FIXME("Logical OR.\n");
|
||||
hlsl_fixme(ctx, @$, "Logical OR.");
|
||||
}
|
||||
|
||||
conditional_expr:
|
||||
logicor_expr
|
||||
| logicor_expr '?' expr ':' assignment_expr
|
||||
{
|
||||
FIXME("Ternary operator.\n");
|
||||
hlsl_fixme(ctx, @$, "Ternary operator.");
|
||||
}
|
||||
|
||||
assignment_expr:
|
||||
|
@ -606,7 +606,8 @@ static void write_sm1_expr(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *b
|
||||
|
||||
if (instr->data_type->base_type != HLSL_TYPE_FLOAT)
|
||||
{
|
||||
FIXME("Non-float operations need to be lowered.\n");
|
||||
/* These need to be lowered. */
|
||||
hlsl_fixme(ctx, instr->loc, "SM1 non-float expression.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -636,7 +637,7 @@ static void write_sm1_expr(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *b
|
||||
break;
|
||||
|
||||
default:
|
||||
FIXME("Unhandled op %u.\n", expr->op);
|
||||
hlsl_fixme(ctx, instr->loc, "SM1 \"%s\" expression.", debug_hlsl_expr_op(expr->op));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -765,8 +766,9 @@ static void write_sm1_instructions(struct hlsl_ctx *ctx, struct vkd3d_bytecode_b
|
||||
{
|
||||
if (instr->data_type->type == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
FIXME("Matrix operations need to be lowered.\n");
|
||||
break;
|
||||
/* These need to be lowered. */
|
||||
hlsl_fixme(ctx, instr->loc, "SM1 matrix expression.");
|
||||
continue;
|
||||
}
|
||||
|
||||
assert(instr->data_type->type == HLSL_CLASS_SCALAR || instr->data_type->type == HLSL_CLASS_VECTOR);
|
||||
|
@ -112,6 +112,7 @@ enum vkd3d_shader_error
|
||||
VKD3D_SHADER_ERROR_HLSL_INVALID_RETURN = 5014,
|
||||
VKD3D_SHADER_ERROR_HLSL_OVERLAPPING_RESERVATIONS = 5015,
|
||||
VKD3D_SHADER_ERROR_HLSL_INVALID_RESERVATION = 5016,
|
||||
VKD3D_SHADER_ERROR_HLSL_NOT_IMPLEMENTED = 5017,
|
||||
|
||||
VKD3D_SHADER_WARNING_HLSL_IMPLICIT_TRUNCATION = 5300,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user