From 4ba884b8140fc64d433959cbe9ef46fa12f4fd07 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 9 Dec 2020 11:33:16 -0800 Subject: [PATCH] softpipe: Fix swizzled texture gather of int textures. We need to pick 1u vs 1.0f based on the type of the texture, just like for normal samples. Move the decision up to the create_sampler_view, and use that value from both sampler paths. Cc: mesa-stable Reviewed-by: Adam Jackson Part-of: --- .gitlab-ci/deqp-softpipe-fails.txt | 56 ---------------------------- src/gallium/drivers/softpipe/sp_tex_sample.c | 14 ++++--- src/gallium/drivers/softpipe/sp_tex_sample.h | 2 + 3 files changed, 10 insertions(+), 62 deletions(-) diff --git a/.gitlab-ci/deqp-softpipe-fails.txt b/.gitlab-ci/deqp-softpipe-fails.txt index bb1cd2c..d084b31 100644 --- a/.gitlab-ci/deqp-softpipe-fails.txt +++ b/.gitlab-ci/deqp-softpipe-fails.txt @@ -565,55 +565,15 @@ dEQP-GLES31.functional.texture.filtering.cube_array.sizes.63x63x18_nearest_mipma dEQP-GLES31.functional.texture.filtering.cube_array.sizes.64x64x12_nearest_mipmap_linear,Fail dEQP-GLES31.functional.texture.filtering.cube_array.sizes.64x64x12_nearest_mipmap_nearest,Fail dEQP-GLES31.functional.texture.filtering.cube_array.sizes.8x8x6_nearest,Fail -dEQP-GLES31.functional.texture.gather.basic.2d.rgba8i.texture_swizzle.alpha_zero_one_red,Fail -dEQP-GLES31.functional.texture.gather.basic.2d.rgba8i.texture_swizzle.blue_alpha_zero_one,Fail -dEQP-GLES31.functional.texture.gather.basic.2d.rgba8i.texture_swizzle.one_red_green_blue,Fail -dEQP-GLES31.functional.texture.gather.basic.2d.rgba8i.texture_swizzle.zero_one_red_green,Fail -dEQP-GLES31.functional.texture.gather.basic.2d.rgba8ui.texture_swizzle.alpha_zero_one_red,Fail -dEQP-GLES31.functional.texture.gather.basic.2d.rgba8ui.texture_swizzle.blue_alpha_zero_one,Fail -dEQP-GLES31.functional.texture.gather.basic.2d.rgba8ui.texture_swizzle.one_red_green_blue,Fail -dEQP-GLES31.functional.texture.gather.basic.2d.rgba8ui.texture_swizzle.zero_one_red_green,Fail -dEQP-GLES31.functional.texture.gather.basic.2d_array.rgba8i.texture_swizzle.alpha_zero_one_red,Fail -dEQP-GLES31.functional.texture.gather.basic.2d_array.rgba8i.texture_swizzle.blue_alpha_zero_one,Fail -dEQP-GLES31.functional.texture.gather.basic.2d_array.rgba8i.texture_swizzle.one_red_green_blue,Fail -dEQP-GLES31.functional.texture.gather.basic.2d_array.rgba8i.texture_swizzle.zero_one_red_green,Fail -dEQP-GLES31.functional.texture.gather.basic.2d_array.rgba8ui.texture_swizzle.alpha_zero_one_red,Fail -dEQP-GLES31.functional.texture.gather.basic.2d_array.rgba8ui.texture_swizzle.blue_alpha_zero_one,Fail -dEQP-GLES31.functional.texture.gather.basic.2d_array.rgba8ui.texture_swizzle.one_red_green_blue,Fail -dEQP-GLES31.functional.texture.gather.basic.2d_array.rgba8ui.texture_swizzle.zero_one_red_green,Fail dEQP-GLES31.functional.texture.gather.basic.cube.rgba8.no_corners.size_pot.clamp_to_edge_repeat,Fail dEQP-GLES31.functional.texture.gather.basic.cube.rgba8.no_corners.size_pot.mirrored_repeat_clamp_to_edge,Fail dEQP-GLES31.functional.texture.gather.basic.cube.rgba8.no_corners.size_pot.repeat_mirrored_repeat,Fail dEQP-GLES31.functional.texture.gather.basic.cube.rgba8i.no_corners.size_pot.clamp_to_edge_repeat,Fail dEQP-GLES31.functional.texture.gather.basic.cube.rgba8i.no_corners.size_pot.mirrored_repeat_clamp_to_edge,Fail dEQP-GLES31.functional.texture.gather.basic.cube.rgba8i.no_corners.size_pot.repeat_mirrored_repeat,Fail -dEQP-GLES31.functional.texture.gather.basic.cube.rgba8i.texture_swizzle.alpha_zero_one_red,Fail -dEQP-GLES31.functional.texture.gather.basic.cube.rgba8i.texture_swizzle.blue_alpha_zero_one,Fail -dEQP-GLES31.functional.texture.gather.basic.cube.rgba8i.texture_swizzle.one_red_green_blue,Fail -dEQP-GLES31.functional.texture.gather.basic.cube.rgba8i.texture_swizzle.zero_one_red_green,Fail dEQP-GLES31.functional.texture.gather.basic.cube.rgba8ui.no_corners.size_pot.clamp_to_edge_repeat,Fail dEQP-GLES31.functional.texture.gather.basic.cube.rgba8ui.no_corners.size_pot.mirrored_repeat_clamp_to_edge,Fail dEQP-GLES31.functional.texture.gather.basic.cube.rgba8ui.no_corners.size_pot.repeat_mirrored_repeat,Fail -dEQP-GLES31.functional.texture.gather.basic.cube.rgba8ui.texture_swizzle.alpha_zero_one_red,Fail -dEQP-GLES31.functional.texture.gather.basic.cube.rgba8ui.texture_swizzle.blue_alpha_zero_one,Fail -dEQP-GLES31.functional.texture.gather.basic.cube.rgba8ui.texture_swizzle.one_red_green_blue,Fail -dEQP-GLES31.functional.texture.gather.basic.cube.rgba8ui.texture_swizzle.zero_one_red_green,Fail -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.rgba8i.texture_swizzle.alpha_zero_one_red,Fail -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.rgba8i.texture_swizzle.blue_alpha_zero_one,Fail -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.rgba8i.texture_swizzle.one_red_green_blue,Fail -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.rgba8i.texture_swizzle.zero_one_red_green,Fail -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.rgba8ui.texture_swizzle.alpha_zero_one_red,Fail -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.rgba8ui.texture_swizzle.blue_alpha_zero_one,Fail -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.rgba8ui.texture_swizzle.one_red_green_blue,Fail -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.rgba8ui.texture_swizzle.zero_one_red_green,Fail -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.rgba8i.texture_swizzle.alpha_zero_one_red,Fail -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.rgba8i.texture_swizzle.blue_alpha_zero_one,Fail -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.rgba8i.texture_swizzle.one_red_green_blue,Fail -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.rgba8i.texture_swizzle.zero_one_red_green,Fail -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.rgba8ui.texture_swizzle.alpha_zero_one_red,Fail -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.rgba8ui.texture_swizzle.blue_alpha_zero_one,Fail -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.rgba8ui.texture_swizzle.one_red_green_blue,Fail -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.rgba8ui.texture_swizzle.zero_one_red_green,Fail dEQP-GLES31.functional.texture.gather.offset_dynamic.implementation_offset.2d.depth32f.base_level.level_1,Fail dEQP-GLES31.functional.texture.gather.offset_dynamic.implementation_offset.2d.depth32f.base_level.level_2,Fail dEQP-GLES31.functional.texture.gather.offset_dynamic.implementation_offset.2d.depth32f.filter_mode.min_linear_mag_linear,Fail @@ -810,22 +770,6 @@ dEQP-GLES31.functional.texture.gather.offset_dynamic.min_required_offset.2d_arra dEQP-GLES31.functional.texture.gather.offset_dynamic.min_required_offset.2d_array.rgba8ui.size_pot.clamp_to_edge_repeat,Fail dEQP-GLES31.functional.texture.gather.offset_dynamic.min_required_offset.2d_array.rgba8ui.size_pot.mirrored_repeat_clamp_to_edge,Fail dEQP-GLES31.functional.texture.gather.offset_dynamic.min_required_offset.2d_array.rgba8ui.size_pot.repeat_mirrored_repeat,Fail -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d.rgba8i.texture_swizzle.alpha_zero_one_red,Fail -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d.rgba8i.texture_swizzle.blue_alpha_zero_one,Fail -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d.rgba8i.texture_swizzle.one_red_green_blue,Fail -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d.rgba8i.texture_swizzle.zero_one_red_green,Fail -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d.rgba8ui.texture_swizzle.alpha_zero_one_red,Fail -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d.rgba8ui.texture_swizzle.blue_alpha_zero_one,Fail -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d.rgba8ui.texture_swizzle.one_red_green_blue,Fail -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d.rgba8ui.texture_swizzle.zero_one_red_green,Fail -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d_array.rgba8i.texture_swizzle.alpha_zero_one_red,Fail -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d_array.rgba8i.texture_swizzle.blue_alpha_zero_one,Fail -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d_array.rgba8i.texture_swizzle.one_red_green_blue,Fail -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d_array.rgba8i.texture_swizzle.zero_one_red_green,Fail -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d_array.rgba8ui.texture_swizzle.alpha_zero_one_red,Fail -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d_array.rgba8ui.texture_swizzle.blue_alpha_zero_one,Fail -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d_array.rgba8ui.texture_swizzle.one_red_green_blue,Fail -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d_array.rgba8ui.texture_swizzle.zero_one_red_green,Fail dEQP-GLES31.functional.texture.multisample.samples_1.sample_mask_and_alpha_to_coverage,Fail dEQP-GLES31.functional.texture.multisample.samples_1.sample_mask_and_sample_coverage,Fail dEQP-GLES31.functional.texture.multisample.samples_1.sample_mask_and_sample_coverage_and_alpha_to_coverage,Fail diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 05479e2..8725930 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -1638,7 +1638,7 @@ get_gather_value(const struct sp_sampler_view *sp_sview, case PIPE_SWIZZLE_0: return 0.0; case PIPE_SWIZZLE_1: - return 1.0; + return sp_sview->oneval; default: return tx[chan][swizzle]; } @@ -2884,12 +2884,12 @@ do_swizzling(const struct pipe_sampler_view *sview, float in[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE], float out[TGSI_NUM_CHANNELS][TGSI_QUAD_SIZE]) { + struct sp_sampler_view *sp_sview = (struct sp_sampler_view *)sview; int j; const unsigned swizzle_r = sview->swizzle_r; const unsigned swizzle_g = sview->swizzle_g; const unsigned swizzle_b = sview->swizzle_b; const unsigned swizzle_a = sview->swizzle_a; - float oneval = util_format_is_pure_integer(sview->format) ? uif(1) : 1.0f; switch (swizzle_r) { case PIPE_SWIZZLE_0: @@ -2898,7 +2898,7 @@ do_swizzling(const struct pipe_sampler_view *sview, break; case PIPE_SWIZZLE_1: for (j = 0; j < 4; j++) - out[0][j] = oneval; + out[0][j] = sp_sview->oneval; break; default: assert(swizzle_r < 4); @@ -2913,7 +2913,7 @@ do_swizzling(const struct pipe_sampler_view *sview, break; case PIPE_SWIZZLE_1: for (j = 0; j < 4; j++) - out[1][j] = oneval; + out[1][j] = sp_sview->oneval; break; default: assert(swizzle_g < 4); @@ -2928,7 +2928,7 @@ do_swizzling(const struct pipe_sampler_view *sview, break; case PIPE_SWIZZLE_1: for (j = 0; j < 4; j++) - out[2][j] = oneval; + out[2][j] = sp_sview->oneval; break; default: assert(swizzle_b < 4); @@ -2943,7 +2943,7 @@ do_swizzling(const struct pipe_sampler_view *sview, break; case PIPE_SWIZZLE_1: for (j = 0; j < 4; j++) - out[3][j] = oneval; + out[3][j] = sp_sview->oneval; break; default: assert(swizzle_a < 4); @@ -3638,6 +3638,8 @@ softpipe_create_sampler_view(struct pipe_context *pipe, sview->xpot = util_logbase2( resource->width0 ); sview->ypot = util_logbase2( resource->height0 ); + + sview->oneval = util_format_is_pure_integer(view->format) ? uif(1) : 1.0f; } return (struct pipe_sampler_view *) sview; diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.h b/src/gallium/drivers/softpipe/sp_tex_sample.h index 96fab8e..2770aca 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.h +++ b/src/gallium/drivers/softpipe/sp_tex_sample.h @@ -122,6 +122,8 @@ struct sp_sampler_view compute_lambda_func compute_lambda; compute_lambda_from_grad_func compute_lambda_from_grad; union pipe_color_union border_color; + /* Value to use for PIPE_SWIZZLE_1 (integer vs float) */ + float oneval; }; struct sp_filter_funcs { -- 2.7.4