[PATCH vkd3d v3 10/12] vkd3d-shader/hlsl: Include new texture dimension types in sampler_dim_count().
Francisco Casas
fcasas at codeweavers.com
Fri Dec 17 13:12:52 CST 2021
This function is also moved from hlsl.y to hlsl.h, since it can be useful in
other files.
Signed-off-by: Francisco Casas <fcasas at codeweavers.com>
---
This is done in preparation for changing write_sm4_ld() in hlsl_sm4.c.
Signed-off-by: Francisco Casas <fcasas at codeweavers.com>
---
libs/vkd3d-shader/hlsl.h | 23 +++++++++++++++++++++++
libs/vkd3d-shader/hlsl.y | 17 -----------------
2 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h
index 334610df..927dca02 100644
--- a/libs/vkd3d-shader/hlsl.h
+++ b/libs/vkd3d-shader/hlsl.h
@@ -107,6 +107,29 @@ enum hlsl_sampler_dim
HLSL_SAMPLER_DIM_MAX = HLSL_SAMPLER_DIM_CUBEARRAY,
};
+static inline unsigned int sampler_dim_count(enum hlsl_sampler_dim dim)
+{
+ switch (dim)
+ {
+ case HLSL_SAMPLER_DIM_1D:
+ return 1;
+ case HLSL_SAMPLER_DIM_1DARRAY:
+ case HLSL_SAMPLER_DIM_2D:
+ case HLSL_SAMPLER_DIM_2DMS:
+ return 2;
+ case HLSL_SAMPLER_DIM_2DARRAY:
+ case HLSL_SAMPLER_DIM_2DMSARRAY:
+ case HLSL_SAMPLER_DIM_3D:
+ case HLSL_SAMPLER_DIM_CUBE:
+ return 3;
+ case HLSL_SAMPLER_DIM_CUBEARRAY:
+ return 4;
+ default:
+ assert(0);
+ return 0;
+ }
+}
+
enum hlsl_matrix_majority
{
HLSL_COLUMN_MAJOR,
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index b7446454..389ff057 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -1513,23 +1513,6 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t
return statements_list;
}
-static unsigned int sampler_dim_count(enum hlsl_sampler_dim dim)
-{
- switch (dim)
- {
- case HLSL_SAMPLER_DIM_1D:
- return 1;
- case HLSL_SAMPLER_DIM_2D:
- return 2;
- case HLSL_SAMPLER_DIM_3D:
- case HLSL_SAMPLER_DIM_CUBE:
- return 3;
- default:
- assert(0);
- return 0;
- }
-}
-
struct find_function_call_args
{
const struct parse_initializer *params;
--
2.25.1
More information about the wine-devel
mailing list