From 45a61f1782561da9a7905bf584cd188d7b108c98 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Tue, 17 Aug 2021 15:30:39 +0200 Subject: [PATCH] gallivm: fix texture-mapping with 16-bit result 16bit integer support also implies using 16-bit results when sampling textures. Because we're returning the results in float SSA values instead of int, we need to bitcast back to integers before truncating the values. Fixes: 00ff60f799c ("gallivm: add 16-bit integer support") Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/auxiliary/gallivm/lp_bld_nir.c | 20 +++++++ .../drivers/llvmpipe/ci/deqp-llvmpipe-fails.txt | 66 ---------------------- 2 files changed, 20 insertions(+), 66 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir.c b/src/gallium/auxiliary/gallivm/lp_bld_nir.c index 981db1f..e53e0fd 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_nir.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_nir.c @@ -2151,6 +2151,26 @@ static void visit_tex(struct lp_build_nir_context *bld_base, nir_tex_instr *inst params.ms_index = ms_index; params.aniso_filter_table = bld_base->aniso_filter_table; bld_base->tex(bld_base, ¶ms); + + if (nir_dest_bit_size(instr->dest) != 32) { + assert(nir_dest_bit_size(instr->dest) == 16); + LLVMTypeRef vec_type; + switch (nir_alu_type_get_base_type(instr->dest_type)) { + case nir_type_int: + vec_type = bld_base->int16_bld.vec_type; + break; + case nir_type_uint: + vec_type = bld_base->uint16_bld.vec_type; + break; + default: + unreachable("unexpected alu type"); + } + for (int i = 0; i < nir_dest_num_components(instr->dest); ++i) { + texel[i] = LLVMBuildBitCast(builder, texel[i], bld_base->int_bld.vec_type, ""); + texel[i] = LLVMBuildTrunc(builder, texel[i], vec_type, ""); + } + } + assign_dest(bld_base, &instr->dest, texel); } diff --git a/src/gallium/drivers/llvmpipe/ci/deqp-llvmpipe-fails.txt b/src/gallium/drivers/llvmpipe/ci/deqp-llvmpipe-fails.txt index 1660d2e..4bbd9a6 100644 --- a/src/gallium/drivers/llvmpipe/ci/deqp-llvmpipe-fails.txt +++ b/src/gallium/drivers/llvmpipe/ci/deqp-llvmpipe-fails.txt @@ -61,69 +61,3 @@ KHR-GL45.transform_feedback.draw_xfb_instanced_test,Crash KHR-GL45.transform_feedback.draw_xfb_stream_instanced_test,Crash KHR-GL45.transform_feedback.query_vertex_interleaved_test,Fail KHR-GL45.transform_feedback.query_vertex_separate_test,Fail -KHR-GLES31.core.compute_shader.resource-image,Crash -KHR-GLES31.core.geometry_shader.limits.max_texture_units,Fail -KHR-GLES31.core.texture_gather.offset-gather-int-2darray,Crash -KHR-GLES31.core.texture_gather.offset-gather-int-2d,Crash -KHR-GLES31.core.texture_gather.offset-gather-uint-2darray,Crash -KHR-GLES31.core.texture_gather.offset-gather-uint-2d,Crash -KHR-GLES31.core.texture_gather.plain-gather-int-2darray,Crash -KHR-GLES31.core.texture_gather.plain-gather-int-2d,Crash -KHR-GLES31.core.texture_gather.plain-gather-int-cube-rgba,Crash -KHR-GLES31.core.texture_gather.plain-gather-uint-2darray,Crash -KHR-GLES31.core.texture_gather.plain-gather-uint-2d,Crash -KHR-GLES31.core.texture_gather.plain-gather-uint-cube,Crash -KHR-GLES3.texture_repeat_mode.r32ui_11x131_0_clamp_to_edge,Crash -KHR-GLES3.texture_repeat_mode.r32ui_11x131_0_mirrored_repeat,Crash -KHR-GLES3.texture_repeat_mode.r32ui_11x131_0_repeat,Crash -KHR-GLES3.texture_repeat_mode.r32ui_11x131_1_clamp_to_edge,Crash -KHR-GLES3.texture_repeat_mode.r32ui_11x131_1_mirrored_repeat,Crash -KHR-GLES3.texture_repeat_mode.r32ui_11x131_1_repeat,Crash -KHR-GLES3.texture_repeat_mode.r32ui_11x131_2_clamp_to_edge,Crash -KHR-GLES3.texture_repeat_mode.r32ui_11x131_2_mirrored_repeat,Crash -KHR-GLES3.texture_repeat_mode.r32ui_11x131_2_repeat,Crash -KHR-GLES3.texture_repeat_mode.r32ui_49x23_0_clamp_to_edge,Crash -KHR-GLES3.texture_repeat_mode.r32ui_49x23_0_mirrored_repeat,Crash -KHR-GLES3.texture_repeat_mode.r32ui_49x23_0_repeat,Crash -KHR-GLES3.texture_repeat_mode.r32ui_49x23_1_clamp_to_edge,Crash -KHR-GLES3.texture_repeat_mode.r32ui_49x23_1_mirrored_repeat,Crash -KHR-GLES3.texture_repeat_mode.r32ui_49x23_1_repeat,Crash -KHR-GLES3.texture_repeat_mode.r32ui_49x23_2_clamp_to_edge,Crash -KHR-GLES3.texture_repeat_mode.r32ui_49x23_2_mirrored_repeat,Crash -KHR-GLES3.texture_repeat_mode.r32ui_49x23_2_repeat,Crash -KHR-GLES3.texture_repeat_mode.rg32ui_11x131_0_clamp_to_edge,Crash -KHR-GLES3.texture_repeat_mode.rg32ui_11x131_0_mirrored_repeat,Crash -KHR-GLES3.texture_repeat_mode.rg32ui_11x131_0_repeat,Crash -KHR-GLES3.texture_repeat_mode.rg32ui_11x131_1_clamp_to_edge,Crash -KHR-GLES3.texture_repeat_mode.rg32ui_11x131_1_mirrored_repeat,Crash -KHR-GLES3.texture_repeat_mode.rg32ui_11x131_1_repeat,Crash -KHR-GLES3.texture_repeat_mode.rg32ui_11x131_2_clamp_to_edge,Crash -KHR-GLES3.texture_repeat_mode.rg32ui_11x131_2_mirrored_repeat,Crash -KHR-GLES3.texture_repeat_mode.rg32ui_11x131_2_repeat,Crash -KHR-GLES3.texture_repeat_mode.rg32ui_49x23_0_clamp_to_edge,Crash -KHR-GLES3.texture_repeat_mode.rg32ui_49x23_0_mirrored_repeat,Crash -KHR-GLES3.texture_repeat_mode.rg32ui_49x23_0_repeat,Crash -KHR-GLES3.texture_repeat_mode.rg32ui_49x23_1_clamp_to_edge,Crash -KHR-GLES3.texture_repeat_mode.rg32ui_49x23_1_mirrored_repeat,Crash -KHR-GLES3.texture_repeat_mode.rg32ui_49x23_1_repeat,Crash -KHR-GLES3.texture_repeat_mode.rg32ui_49x23_2_clamp_to_edge,Crash -KHR-GLES3.texture_repeat_mode.rg32ui_49x23_2_mirrored_repeat,Crash -KHR-GLES3.texture_repeat_mode.rg32ui_49x23_2_repeat,Crash -KHR-GLES3.texture_repeat_mode.rgba32ui_11x131_0_clamp_to_edge,Crash -KHR-GLES3.texture_repeat_mode.rgba32ui_11x131_0_mirrored_repeat,Crash -KHR-GLES3.texture_repeat_mode.rgba32ui_11x131_0_repeat,Crash -KHR-GLES3.texture_repeat_mode.rgba32ui_11x131_1_clamp_to_edge,Crash -KHR-GLES3.texture_repeat_mode.rgba32ui_11x131_1_mirrored_repeat,Crash -KHR-GLES3.texture_repeat_mode.rgba32ui_11x131_1_repeat,Crash -KHR-GLES3.texture_repeat_mode.rgba32ui_11x131_2_clamp_to_edge,Crash -KHR-GLES3.texture_repeat_mode.rgba32ui_11x131_2_mirrored_repeat,Crash -KHR-GLES3.texture_repeat_mode.rgba32ui_11x131_2_repeat,Crash -KHR-GLES3.texture_repeat_mode.rgba32ui_49x23_0_clamp_to_edge,Crash -KHR-GLES3.texture_repeat_mode.rgba32ui_49x23_0_mirrored_repeat,Crash -KHR-GLES3.texture_repeat_mode.rgba32ui_49x23_0_repeat,Crash -KHR-GLES3.texture_repeat_mode.rgba32ui_49x23_1_clamp_to_edge,Crash -KHR-GLES3.texture_repeat_mode.rgba32ui_49x23_1_mirrored_repeat,Crash -KHR-GLES3.texture_repeat_mode.rgba32ui_49x23_1_repeat,Crash -KHR-GLES3.texture_repeat_mode.rgba32ui_49x23_2_clamp_to_edge,Crash -KHR-GLES3.texture_repeat_mode.rgba32ui_49x23_2_mirrored_repeat,Crash -KHR-GLES3.texture_repeat_mode.rgba32ui_49x23_2_repeat,Crash -- 2.7.4