mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Store the matrix majority as a type modifiers bitmask.
This commit is contained in:
parent
b3c620954b
commit
75ab9d31ef
Notes:
Alexandre Julliard
2023-02-28 22:10:58 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Francisco Casas (@fcasas) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/102
@ -2973,7 +2973,7 @@ static bool hlsl_ctx_init(struct hlsl_ctx *ctx, const char *source_name,
|
||||
ctx->location.line = ctx->location.column = 1;
|
||||
vkd3d_string_buffer_cache_init(&ctx->string_buffers);
|
||||
|
||||
ctx->matrix_majority = HLSL_COLUMN_MAJOR;
|
||||
ctx->matrix_majority = HLSL_MODIFIER_COLUMN_MAJOR;
|
||||
|
||||
list_init(&ctx->scopes);
|
||||
|
||||
|
@ -116,12 +116,6 @@ enum hlsl_sampler_dim
|
||||
HLSL_SAMPLER_DIM_MAX = HLSL_SAMPLER_DIM_CUBEARRAY,
|
||||
};
|
||||
|
||||
enum hlsl_matrix_majority
|
||||
{
|
||||
HLSL_COLUMN_MAJOR,
|
||||
HLSL_ROW_MAJOR
|
||||
};
|
||||
|
||||
enum hlsl_regset
|
||||
{
|
||||
HLSL_REGSET_SAMPLERS,
|
||||
@ -735,7 +729,7 @@ struct hlsl_ctx
|
||||
const struct hlsl_ir_function_decl *cur_function;
|
||||
|
||||
/* Default matrix majority for matrix types. Can be set by a pragma within the HLSL source. */
|
||||
enum hlsl_matrix_majority matrix_majority;
|
||||
unsigned int matrix_majority;
|
||||
|
||||
/* Basic data types stored for convenience. */
|
||||
struct
|
||||
|
@ -233,14 +233,14 @@ row_major {return KW_ROW_MAJOR; }
|
||||
struct hlsl_ctx *ctx = yyget_extra(yyscanner);
|
||||
|
||||
TRACE("#pragma setting row_major mode.\n");
|
||||
ctx->matrix_majority = HLSL_ROW_MAJOR;
|
||||
ctx->matrix_majority = HLSL_MODIFIER_ROW_MAJOR;
|
||||
BEGIN(pp_ignore);
|
||||
}
|
||||
<pp_pragma>pack_matrix{WS}*\({WS}*column_major{WS}*\) {
|
||||
struct hlsl_ctx *ctx = yyget_extra(yyscanner);
|
||||
|
||||
TRACE("#pragma setting column_major mode.\n");
|
||||
ctx->matrix_majority = HLSL_COLUMN_MAJOR;
|
||||
ctx->matrix_majority = HLSL_MODIFIER_COLUMN_MAJOR;
|
||||
BEGIN(pp_ignore);
|
||||
}
|
||||
<pp_pragma>{NEWLINE} {
|
||||
|
@ -886,10 +886,7 @@ static struct hlsl_type *apply_type_modifiers(struct hlsl_ctx *ctx, struct hlsl_
|
||||
&& !(type->modifiers & HLSL_MODIFIERS_MAJORITY_MASK)
|
||||
&& type->type == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
if (ctx->matrix_majority == HLSL_COLUMN_MAJOR)
|
||||
default_majority = HLSL_MODIFIER_COLUMN_MAJOR;
|
||||
else
|
||||
default_majority = HLSL_MODIFIER_ROW_MAJOR;
|
||||
default_majority = ctx->matrix_majority;
|
||||
}
|
||||
else if (type->type != HLSL_CLASS_MATRIX)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user