From 5a468a3ca226ba0248248e83827a433185212fc3 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: (cherry picked from commit 4ba884b8140fc64d433959cbe9ef46fa12f4fd07) --- .gitlab-ci/deqp-softpipe-fails.txt | 56 -------------------- .pick_status.json | 2 +- src/gallium/drivers/softpipe/sp_tex_sample.c | 14 ++--- src/gallium/drivers/softpipe/sp_tex_sample.h | 2 + 4 files changed, 11 insertions(+), 63 deletions(-) diff --git a/.gitlab-ci/deqp-softpipe-fails.txt b/.gitlab-ci/deqp-softpipe-fails.txt index 5bb7f297722..fcbbc90c5f8 100644 --- a/.gitlab-ci/deqp-softpipe-fails.txt +++ b/.gitlab-ci/deqp-softpipe-fails.txt @@ -575,55 +575,15 @@ dEQP-GLES31.functional.texture.filtering.cube_array.sizes.63x63x18_nearest_mipma dEQP-GLES31.functional.texture.filtering.cube_array.sizes.64x64x12_nearest_mipmap_linear dEQP-GLES31.functional.texture.filtering.cube_array.sizes.64x64x12_nearest_mipmap_nearest dEQP-GLES31.functional.texture.filtering.cube_array.sizes.8x8x6_nearest -dEQP-GLES31.functional.texture.gather.basic.2d.rgba8i.texture_swizzle.alpha_zero_one_red -dEQP-GLES31.functional.texture.gather.basic.2d.rgba8i.texture_swizzle.blue_alpha_zero_one -dEQP-GLES31.functional.texture.gather.basic.2d.rgba8i.texture_swizzle.one_red_green_blue -dEQP-GLES31.functional.texture.gather.basic.2d.rgba8i.texture_swizzle.zero_one_red_green -dEQP-GLES31.functional.texture.gather.basic.2d.rgba8ui.texture_swizzle.alpha_zero_one_red -dEQP-GLES31.functional.texture.gather.basic.2d.rgba8ui.texture_swizzle.blue_alpha_zero_one -dEQP-GLES31.functional.texture.gather.basic.2d.rgba8ui.texture_swizzle.one_red_green_blue -dEQP-GLES31.functional.texture.gather.basic.2d.rgba8ui.texture_swizzle.zero_one_red_green -dEQP-GLES31.functional.texture.gather.basic.2d_array.rgba8i.texture_swizzle.alpha_zero_one_red -dEQP-GLES31.functional.texture.gather.basic.2d_array.rgba8i.texture_swizzle.blue_alpha_zero_one -dEQP-GLES31.functional.texture.gather.basic.2d_array.rgba8i.texture_swizzle.one_red_green_blue -dEQP-GLES31.functional.texture.gather.basic.2d_array.rgba8i.texture_swizzle.zero_one_red_green -dEQP-GLES31.functional.texture.gather.basic.2d_array.rgba8ui.texture_swizzle.alpha_zero_one_red -dEQP-GLES31.functional.texture.gather.basic.2d_array.rgba8ui.texture_swizzle.blue_alpha_zero_one -dEQP-GLES31.functional.texture.gather.basic.2d_array.rgba8ui.texture_swizzle.one_red_green_blue -dEQP-GLES31.functional.texture.gather.basic.2d_array.rgba8ui.texture_swizzle.zero_one_red_green dEQP-GLES31.functional.texture.gather.basic.cube.rgba8.no_corners.size_pot.clamp_to_edge_repeat dEQP-GLES31.functional.texture.gather.basic.cube.rgba8.no_corners.size_pot.mirrored_repeat_clamp_to_edge dEQP-GLES31.functional.texture.gather.basic.cube.rgba8.no_corners.size_pot.repeat_mirrored_repeat dEQP-GLES31.functional.texture.gather.basic.cube.rgba8i.no_corners.size_pot.clamp_to_edge_repeat dEQP-GLES31.functional.texture.gather.basic.cube.rgba8i.no_corners.size_pot.mirrored_repeat_clamp_to_edge dEQP-GLES31.functional.texture.gather.basic.cube.rgba8i.no_corners.size_pot.repeat_mirrored_repeat -dEQP-GLES31.functional.texture.gather.basic.cube.rgba8i.texture_swizzle.alpha_zero_one_red -dEQP-GLES31.functional.texture.gather.basic.cube.rgba8i.texture_swizzle.blue_alpha_zero_one -dEQP-GLES31.functional.texture.gather.basic.cube.rgba8i.texture_swizzle.one_red_green_blue -dEQP-GLES31.functional.texture.gather.basic.cube.rgba8i.texture_swizzle.zero_one_red_green dEQP-GLES31.functional.texture.gather.basic.cube.rgba8ui.no_corners.size_pot.clamp_to_edge_repeat dEQP-GLES31.functional.texture.gather.basic.cube.rgba8ui.no_corners.size_pot.mirrored_repeat_clamp_to_edge dEQP-GLES31.functional.texture.gather.basic.cube.rgba8ui.no_corners.size_pot.repeat_mirrored_repeat -dEQP-GLES31.functional.texture.gather.basic.cube.rgba8ui.texture_swizzle.alpha_zero_one_red -dEQP-GLES31.functional.texture.gather.basic.cube.rgba8ui.texture_swizzle.blue_alpha_zero_one -dEQP-GLES31.functional.texture.gather.basic.cube.rgba8ui.texture_swizzle.one_red_green_blue -dEQP-GLES31.functional.texture.gather.basic.cube.rgba8ui.texture_swizzle.zero_one_red_green -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.rgba8i.texture_swizzle.alpha_zero_one_red -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.rgba8i.texture_swizzle.blue_alpha_zero_one -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.rgba8i.texture_swizzle.one_red_green_blue -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.rgba8i.texture_swizzle.zero_one_red_green -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.rgba8ui.texture_swizzle.alpha_zero_one_red -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.rgba8ui.texture_swizzle.blue_alpha_zero_one -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.rgba8ui.texture_swizzle.one_red_green_blue -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d.rgba8ui.texture_swizzle.zero_one_red_green -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.rgba8i.texture_swizzle.alpha_zero_one_red -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.rgba8i.texture_swizzle.blue_alpha_zero_one -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.rgba8i.texture_swizzle.one_red_green_blue -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.rgba8i.texture_swizzle.zero_one_red_green -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.rgba8ui.texture_swizzle.alpha_zero_one_red -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.rgba8ui.texture_swizzle.blue_alpha_zero_one -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.rgba8ui.texture_swizzle.one_red_green_blue -dEQP-GLES31.functional.texture.gather.offset.implementation_offset.2d_array.rgba8ui.texture_swizzle.zero_one_red_green dEQP-GLES31.functional.texture.gather.offset_dynamic.implementation_offset.2d.depth32f.base_level.level_1 dEQP-GLES31.functional.texture.gather.offset_dynamic.implementation_offset.2d.depth32f.base_level.level_2 dEQP-GLES31.functional.texture.gather.offset_dynamic.implementation_offset.2d.depth32f.filter_mode.min_linear_mag_linear @@ -820,22 +780,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 dEQP-GLES31.functional.texture.gather.offset_dynamic.min_required_offset.2d_array.rgba8ui.size_pot.mirrored_repeat_clamp_to_edge dEQP-GLES31.functional.texture.gather.offset_dynamic.min_required_offset.2d_array.rgba8ui.size_pot.repeat_mirrored_repeat -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d.rgba8i.texture_swizzle.alpha_zero_one_red -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d.rgba8i.texture_swizzle.blue_alpha_zero_one -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d.rgba8i.texture_swizzle.one_red_green_blue -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d.rgba8i.texture_swizzle.zero_one_red_green -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d.rgba8ui.texture_swizzle.alpha_zero_one_red -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d.rgba8ui.texture_swizzle.blue_alpha_zero_one -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d.rgba8ui.texture_swizzle.one_red_green_blue -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d.rgba8ui.texture_swizzle.zero_one_red_green -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d_array.rgba8i.texture_swizzle.alpha_zero_one_red -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d_array.rgba8i.texture_swizzle.blue_alpha_zero_one -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d_array.rgba8i.texture_swizzle.one_red_green_blue -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d_array.rgba8i.texture_swizzle.zero_one_red_green -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d_array.rgba8ui.texture_swizzle.alpha_zero_one_red -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d_array.rgba8ui.texture_swizzle.blue_alpha_zero_one -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d_array.rgba8ui.texture_swizzle.one_red_green_blue -dEQP-GLES31.functional.texture.gather.offsets.implementation_offset.2d_array.rgba8ui.texture_swizzle.zero_one_red_green dEQP-GLES31.functional.texture.multisample.samples_1.sample_mask_and_alpha_to_coverage dEQP-GLES31.functional.texture.multisample.samples_1.sample_mask_and_sample_coverage dEQP-GLES31.functional.texture.multisample.samples_1.sample_mask_and_sample_coverage_and_alpha_to_coverage diff --git a/.pick_status.json b/.pick_status.json index c9204854e6b..755231fb9e2 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -67,7 +67,7 @@ "description": "softpipe: Fix swizzled texture gather of int textures.", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index ab7f73e92bd..f7d7cee8169 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 96fab8e3387..2770acac73b 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 {