vkd3d-shader/hlsl: Always specify resource on intrinsic_tex().

Otherwise, in the added test, we get:

vkd3d-compiler: vkd3d-shader/hlsl.c:452: hlsl_init_deref_from_index_chain: Assertion `chain' failed.

because on the path that triggers the following error:

E5002: Wrong type for argument 1 of 'tex3D': expected 'sampler' or 'sampler3D', but got 'sampler2D'.

a NULL params.resource is passed to hlsl_new_resource_load() and
then to hlsl_init_deref_from_index_chain().
This commit is contained in:
Francisco Casas 2023-04-26 14:42:17 -04:00 committed by Alexandre Julliard
parent 5d735f3b0e
commit abb207fab0
Notes: Alexandre Julliard 2023-05-01 22:25:34 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/183
2 changed files with 10 additions and 4 deletions

View File

@ -3331,16 +3331,13 @@ static bool intrinsic_tex(struct hlsl_ctx *ctx, const struct parse_initializer *
name, ctx->builtin_types.sampler[dim]->name, string->buffer);
hlsl_release_string_buffer(ctx, string);
}
else
{
load_params.resource = params->args[0];
}
if (!(coords = add_implicit_conversion(ctx, params->instrs, params->args[1],
hlsl_get_vector_type(ctx, HLSL_TYPE_FLOAT, hlsl_sampler_dim_count(dim)), loc)))
coords = params->args[1];
load_params.coords = coords;
load_params.resource = params->args[0];
load_params.format = hlsl_get_vector_type(ctx, HLSL_TYPE_FLOAT, 4);
if (!(load = hlsl_new_resource_load(ctx, &load_params, loc)))

View File

@ -45,3 +45,12 @@ float4 main() : sv_target
[test]
draw quad
probe all rgba (0.25, 0, 0.25, 0)
[pixel shader fail]
sampler2D s;
float4 main() : sv_target
{
return tex3D(s, float3(0.0, 0.0, 0.0));
}