Signed-off-by: Francisco Casas <fcasas(a)codeweavers.com>
---
libs/vkd3d-shader/hlsl.y | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index 389ff057..04854577 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -1837,7 +1837,9 @@ 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 = sampler_dim_count(object_type->sampler_dim);
struct hlsl_ir_resource_load *load;
@@ -1863,7 +1865,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 = sampler_dim_count(object_type->sampler_dim);
const struct hlsl_type *sampler_type;
@@ -1913,8 +1917,16 @@ 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")
- || !strcmp(name, "GatherGreen") || !strcmp(name, "GatherAlpha"))
+ 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_2DMSARRAY
+ || object_type->sampler_dim == HLSL_SAMPLER_DIM_CUBE
+ || object_type->sampler_dim == HLSL_SAMPLER_DIM_CUBEARRAY))
{
const unsigned int sampler_dim = sampler_dim_count(object_type->sampler_dim);
enum hlsl_resource_load_type load_type;
--
2.25.1