From: Marek Olšák Date: Sat, 13 Mar 2021 09:11:36 +0000 (-0500) Subject: radeonsi: use pipe_sampler_state::border_color_is_integer to simplify stuff X-Git-Tag: upstream/21.2.3~6304 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a94bd9033d4b440e7892d3fb030a41e81ba51311;p=platform%2Fupstream%2Fmesa.git radeonsi: use pipe_sampler_state::border_color_is_integer to simplify stuff We don't need the separate integer sampler state if we know the border color type. Acked-by: Pierre-Eric Pelloux-Prayer Part-of: --- diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c index de14de1..cb52295 100644 --- a/src/gallium/drivers/radeonsi/si_descriptors.c +++ b/src/gallium/drivers/radeonsi/si_descriptors.c @@ -434,9 +434,7 @@ static void si_set_sampler_state_desc(struct si_sampler_state *sstate, struct si_sampler_view *sview, struct si_texture *tex, uint32_t *desc) { - if (sview && sview->is_integer) - memcpy(desc, sstate->integer_val, 4 * 4); - else if (tex && tex->upgraded_depth && (!sview || !sview->is_stencil_sampler)) + if (tex && tex->upgraded_depth && sview && !sview->is_stencil_sampler) memcpy(desc, sstate->upgraded_depth_val, 4 * 4); else memcpy(desc, sstate->val, 4 * 4); diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index a1ca487..3673af9 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -679,7 +679,6 @@ struct si_sampler_view { ubyte base_level; ubyte block_width; bool is_stencil_sampler; - bool is_integer; bool dcc_incompatible; }; @@ -690,7 +689,6 @@ struct si_sampler_state { unsigned magic; #endif uint32_t val[4]; - uint32_t integer_val[4]; uint32_t upgraded_depth_val[4]; }; diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index f8674b9..332ef80 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -4343,20 +4343,6 @@ struct pipe_sampler_view *si_create_sampler_view_custom(struct pipe_context *ctx sctx->screen, tex, true, state->target, pipe_format, state_swizzle, first_level, last_level, state->u.tex.first_layer, last_layer, width, height, depth, view->state, view->fmask_state); - const struct util_format_description *desc = util_format_description(pipe_format); - view->is_integer = false; - - for (unsigned i = 0; i < desc->nr_channels; ++i) { - if (desc->channel[i].type == UTIL_FORMAT_TYPE_VOID) - continue; - - /* Whether the number format is {U,S}{SCALED,INT} */ - view->is_integer = (desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED || - desc->channel[i].type == UTIL_FORMAT_TYPE_SIGNED) && - (desc->channel[i].pure_integer || !desc->channel[i].normalized); - break; - } - view->base_level_info = &surflevel[base_level]; view->base_level = base_level; view->block_width = util_format_get_blockwidth(pipe_format); @@ -4517,7 +4503,8 @@ static void *si_create_sampler_state(struct pipe_context *ctx, S_008F38_XY_MIN_FILTER(si_tex_filter(state->min_img_filter, max_aniso)) | S_008F38_MIP_FILTER(si_tex_mipfilter(state->min_mip_filter)) | S_008F38_MIP_POINT_PRECLAMP(0)); - rstate->val[3] = si_translate_border_color(sctx, state, &state->border_color, false); + rstate->val[3] = si_translate_border_color(sctx, state, &state->border_color, + state->border_color_is_integer); if (sscreen->info.chip_class >= GFX10) { rstate->val[2] |= S_008F38_ANISO_OVERRIDE_GFX10(1); @@ -4527,10 +4514,6 @@ static void *si_create_sampler_state(struct pipe_context *ctx, S_008F38_ANISO_OVERRIDE_GFX8(sctx->chip_class >= GFX8); } - /* Create sampler resource for integer textures. */ - memcpy(rstate->integer_val, rstate->val, sizeof(rstate->val)); - rstate->integer_val[3] = si_translate_border_color(sctx, state, &state->border_color, true); - /* Create sampler resource for upgraded depth textures. */ memcpy(rstate->upgraded_depth_val, rstate->val, sizeof(rstate->val));