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().
-- v2: vkd3d-shader/hlsl: Always specify resource on intrinsic_tex().
From: Francisco Casas fcasas@codeweavers.com
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(). --- libs/vkd3d-shader/hlsl.y | 5 +---- tests/sampler.shader_test | 9 +++++++++ 2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 10deda75..864970a2 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -3273,16 +3273,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))) diff --git a/tests/sampler.shader_test b/tests/sampler.shader_test index 2cb70a0b..23741a35 100644 --- a/tests/sampler.shader_test +++ b/tests/sampler.shader_test @@ -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)); +}
This merge request was approved by Zebediah Figura.
This merge request was approved by Giovanni Mascellani.
This merge request was approved by Henri Verbeet.