Module: vkd3d
Branch: master
Commit: 75ab9d31efcd06c8f50c4bce2c01331e630d3a49
URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/75ab9d31efcd06c8f50c4bce2c013…
Author: Zebediah Figura <zfigura(a)codeweavers.com>
Date: Tue Mar 29 18:49:10 2022 -0500
vkd3d-shader/hlsl: Store the matrix majority as a type modifiers bitmask.
---
libs/vkd3d-shader/hlsl.c | 2 +-
libs/vkd3d-shader/hlsl.h | 8 +-------
libs/vkd3d-shader/hlsl.l | 4 ++--
libs/vkd3d-shader/hlsl.y | 5 +----
4 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
index d15abe50..3cf3e6d0 100644
--- a/libs/vkd3d-shader/hlsl.c
+++ b/libs/vkd3d-shader/hlsl.c
@@ -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);
diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h
index 62049e8d..24d0f517 100644
--- a/libs/vkd3d-shader/hlsl.h
+++ b/libs/vkd3d-shader/hlsl.h
@@ -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
diff --git a/libs/vkd3d-shader/hlsl.l b/libs/vkd3d-shader/hlsl.l
index 59f31fcd..adff1da0 100644
--- a/libs/vkd3d-shader/hlsl.l
+++ b/libs/vkd3d-shader/hlsl.l
@@ -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} {
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index c187cc47..c072362c 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -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)
{