mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 08:08:20 +00:00
d3dcompiler: Use hlsl_report_message() where possible.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f114a0a8e6
commit
3b66245922
|
@ -1826,48 +1826,52 @@ input_mod: KW_IN
|
||||||
$$ = HLSL_STORAGE_IN | HLSL_STORAGE_OUT;
|
$$ = HLSL_STORAGE_IN | HLSL_STORAGE_OUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
type: base_type
|
type:
|
||||||
{
|
|
||||||
$$ = $1;
|
|
||||||
}
|
|
||||||
| KW_VECTOR '<' base_type ',' C_INTEGER '>'
|
|
||||||
{
|
|
||||||
if ($3->type != HLSL_CLASS_SCALAR)
|
|
||||||
{
|
|
||||||
hlsl_message("Line %u: vectors of non-scalar types are not allowed.\n",
|
|
||||||
hlsl_ctx.line_no);
|
|
||||||
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
|
|
||||||
YYABORT;
|
|
||||||
}
|
|
||||||
if ($5 < 1 || $5 > 4)
|
|
||||||
{
|
|
||||||
hlsl_message("Line %u: vector size must be between 1 and 4.\n",
|
|
||||||
hlsl_ctx.line_no);
|
|
||||||
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
|
|
||||||
YYABORT;
|
|
||||||
}
|
|
||||||
|
|
||||||
$$ = new_hlsl_type(NULL, HLSL_CLASS_VECTOR, $3->base_type, $5, 1);
|
base_type
|
||||||
}
|
{
|
||||||
| KW_MATRIX '<' base_type ',' C_INTEGER ',' C_INTEGER '>'
|
$$ = $1;
|
||||||
{
|
}
|
||||||
if ($3->type != HLSL_CLASS_SCALAR)
|
| KW_VECTOR '<' base_type ',' C_INTEGER '>'
|
||||||
{
|
{
|
||||||
hlsl_message("Line %u: matrices of non-scalar types are not allowed.\n",
|
if ($3->type != HLSL_CLASS_SCALAR)
|
||||||
hlsl_ctx.line_no);
|
{
|
||||||
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
|
hlsl_report_message(get_location(&@3), HLSL_LEVEL_ERROR,
|
||||||
YYABORT;
|
"vectors of non-scalar types are not allowed\n");
|
||||||
}
|
YYABORT;
|
||||||
if ($5 < 1 || $5 > 4 || $7 < 1 || $7 > 4)
|
}
|
||||||
{
|
if ($5 < 1 || $5 > 4)
|
||||||
hlsl_message("Line %u: matrix dimensions must be between 1 and 4.\n",
|
{
|
||||||
hlsl_ctx.line_no);
|
hlsl_report_message(get_location(&@5), HLSL_LEVEL_ERROR,
|
||||||
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
|
"vector size must be between 1 and 4\n");
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
$$ = new_hlsl_type(NULL, HLSL_CLASS_MATRIX, $3->base_type, $7, $5);
|
$$ = new_hlsl_type(NULL, HLSL_CLASS_VECTOR, $3->base_type, $5, 1);
|
||||||
}
|
}
|
||||||
|
| KW_MATRIX '<' base_type ',' C_INTEGER ',' C_INTEGER '>'
|
||||||
|
{
|
||||||
|
if ($3->type != HLSL_CLASS_SCALAR)
|
||||||
|
{
|
||||||
|
hlsl_report_message(get_location(&@3), HLSL_LEVEL_ERROR,
|
||||||
|
"matrices of non-scalar types are not allowed\n");
|
||||||
|
YYABORT;
|
||||||
|
}
|
||||||
|
if ($5 < 1 || $5 > 4)
|
||||||
|
{
|
||||||
|
hlsl_report_message(get_location(&@5), HLSL_LEVEL_ERROR,
|
||||||
|
"matrix row count must be between 1 and 4\n");
|
||||||
|
YYABORT;
|
||||||
|
}
|
||||||
|
if ($7 < 1 || $7 > 4)
|
||||||
|
{
|
||||||
|
hlsl_report_message(get_location(&@7), HLSL_LEVEL_ERROR,
|
||||||
|
"matrix column count must be between 1 and 4\n");
|
||||||
|
YYABORT;
|
||||||
|
}
|
||||||
|
|
||||||
|
$$ = new_hlsl_type(NULL, HLSL_CLASS_MATRIX, $3->base_type, $7, $5);
|
||||||
|
}
|
||||||
|
|
||||||
base_type:
|
base_type:
|
||||||
|
|
||||||
|
@ -1904,11 +1908,7 @@ base_type:
|
||||||
{
|
{
|
||||||
$$ = get_type(hlsl_ctx.cur_scope, $2, TRUE);
|
$$ = get_type(hlsl_ctx.cur_scope, $2, TRUE);
|
||||||
if ($$->type != HLSL_CLASS_STRUCT)
|
if ($$->type != HLSL_CLASS_STRUCT)
|
||||||
{
|
hlsl_report_message(get_location(&@1), HLSL_LEVEL_ERROR, "'%s' redefined as a structure\n", $2);
|
||||||
hlsl_message("Line %u: redefining %s as a structure.\n",
|
|
||||||
hlsl_ctx.line_no, $2);
|
|
||||||
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
|
|
||||||
}
|
|
||||||
d3dcompiler_free($2);
|
d3dcompiler_free($2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2291,9 +2291,8 @@ primary_expr: C_FLOAT
|
||||||
|
|
||||||
if (!(var = get_variable(hlsl_ctx.cur_scope, $1)))
|
if (!(var = get_variable(hlsl_ctx.cur_scope, $1)))
|
||||||
{
|
{
|
||||||
hlsl_message("Line %d: variable '%s' not declared\n",
|
hlsl_report_message(get_location(&@1), HLSL_LEVEL_ERROR,
|
||||||
hlsl_ctx.line_no, $1);
|
"variable '%s' is not declared\n", $1);
|
||||||
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
|
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
if ((load = new_var_load(var, get_location(&@1))))
|
if ((load = new_var_load(var, get_location(&@1))))
|
||||||
|
@ -2425,23 +2424,21 @@ postfix_expr: primary_expr
|
||||||
TRACE("%s constructor.\n", debug_hlsl_type($2));
|
TRACE("%s constructor.\n", debug_hlsl_type($2));
|
||||||
if ($1)
|
if ($1)
|
||||||
{
|
{
|
||||||
hlsl_message("Line %u: unexpected modifier in a constructor.\n",
|
hlsl_report_message(get_location(&@1), HLSL_LEVEL_ERROR,
|
||||||
hlsl_ctx.line_no);
|
"unexpected modifier on a constructor\n");
|
||||||
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
|
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
if ($2->type > HLSL_CLASS_LAST_NUMERIC)
|
if ($2->type > HLSL_CLASS_LAST_NUMERIC)
|
||||||
{
|
{
|
||||||
hlsl_message("Line %u: constructors are allowed only for numeric data types.\n",
|
hlsl_report_message(get_location(&@2), HLSL_LEVEL_ERROR,
|
||||||
hlsl_ctx.line_no);
|
"constructors may only be used with numeric data types\n");
|
||||||
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
|
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
if ($2->dimx * $2->dimy != initializer_size(&$4))
|
if ($2->dimx * $2->dimy != initializer_size(&$4))
|
||||||
{
|
{
|
||||||
hlsl_message("Line %u: wrong number of components in constructor.\n",
|
hlsl_report_message(get_location(&@4), HLSL_LEVEL_ERROR,
|
||||||
hlsl_ctx.line_no);
|
"expected %u components in constructor, but got %u\n",
|
||||||
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
|
$2->dimx * $2->dimy, initializer_size(&$4));
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
assert($4.args_count <= ARRAY_SIZE(constructor->args));
|
assert($4.args_count <= ARRAY_SIZE(constructor->args));
|
||||||
|
|
Loading…
Reference in a new issue