Francisco Casas : vkd3d-shader/hlsl: Check texture dimension type on method calls.
Alexandre Julliard
julliard at winehq.org
Wed Feb 9 16:03:04 CST 2022
Module: vkd3d
Branch: master
Commit: 75afa731df8111fa07e3ba248eea9fd4fe894cec
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=75afa731df8111fa07e3ba248eea9fd4fe894cec
Author: Francisco Casas <fcasas at codeweavers.com>
Date: Thu Jan 27 15:31:24 2022 -0300
vkd3d-shader/hlsl: Check texture dimension type on method calls.
Signed-off-by: Francisco Casas <fcasas at codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
libs/vkd3d-shader/hlsl.y | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index d51b56e..f861011 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -1871,12 +1871,21 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
/* Only HLSL_IR_LOAD can return an object. */
object_load = hlsl_ir_load(object);
- if (!strcmp(name, "Load"))
+ if (!strcmp(name, "Load")
+ && object_type->sampler_dim != HLSL_SAMPLER_DIM_CUBE
+ && object_type->sampler_dim != HLSL_SAMPLER_DIM_CUBEARRAY)
{
const unsigned int sampler_dim = hlsl_sampler_dim_count(object_type->sampler_dim);
struct hlsl_ir_resource_load *load;
struct hlsl_ir_node *coords;
+ if (object_type->sampler_dim == HLSL_SAMPLER_DIM_2DMS
+ || object_type->sampler_dim == HLSL_SAMPLER_DIM_2DMSARRAY)
+ {
+ FIXME("'Load' method for multi-sample textures.\n");
+ return false;
+ }
+
if (params->args_count < 1 || params->args_count > 3)
{
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_WRONG_PARAMETER_COUNT,
@@ -1884,7 +1893,9 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
return false;
}
if (params->args_count >= 2)
- FIXME("Ignoring index and/or offset parameter(s).\n");
+ hlsl_fixme(ctx, loc, "Offset parameter.");
+ if (params->args_count == 3)
+ hlsl_fixme(ctx, loc, "Tiled resource status argument.");
/* +1 for the mipmap level */
if (!(coords = add_implicit_conversion(ctx, instrs, params->args[0],
@@ -1897,7 +1908,9 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
list_add_tail(instrs, &load->node.entry);
return true;
}
- else if (!strcmp(name, "Sample"))
+ else if (!strcmp(name, "Sample")
+ && object_type->sampler_dim != HLSL_SAMPLER_DIM_2DMS
+ && object_type->sampler_dim != HLSL_SAMPLER_DIM_2DMSARRAY)
{
const unsigned int sampler_dim = hlsl_sampler_dim_count(object_type->sampler_dim);
const struct hlsl_type *sampler_type;
@@ -1947,8 +1960,12 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
list_add_tail(instrs, &load->node.entry);
return true;
}
- else if (!strcmp(name, "Gather") || !strcmp(name, "GatherRed") || !strcmp(name, "GatherBlue")
+ else if ((!strcmp(name, "Gather") || !strcmp(name, "GatherRed") || !strcmp(name, "GatherBlue")
|| !strcmp(name, "GatherGreen") || !strcmp(name, "GatherAlpha"))
+ && (object_type->sampler_dim == HLSL_SAMPLER_DIM_2D
+ || object_type->sampler_dim == HLSL_SAMPLER_DIM_2DARRAY
+ || object_type->sampler_dim == HLSL_SAMPLER_DIM_CUBE
+ || object_type->sampler_dim == HLSL_SAMPLER_DIM_CUBEARRAY))
{
const unsigned int sampler_dim = hlsl_sampler_dim_count(object_type->sampler_dim);
enum hlsl_resource_load_type load_type;
More information about the wine-cvs
mailing list