From 4afce5efdd47a5140a20246895f1a729e24b7b9b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolai=20H=C3=A4hnle?= Date: Tue, 14 Nov 2017 15:37:36 +0100 Subject: [PATCH] radeonsi/gfx10: determine view->is_integer based on the pipe_format It was convenient, but NUM_FORMAT no longer exists in gfx10. Acked-by: Bas Nieuwenhuizen --- src/gallium/drivers/radeonsi/si_state.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index a82f8dc6a89..347d7b84b4c 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -4231,12 +4231,21 @@ si_create_sampler_view_custom(struct pipe_context *ctx, width, height, depth, view->state, view->fmask_state); - unsigned num_format = G_008F14_NUM_FORMAT(view->state[1]); - view->is_integer = - num_format == V_008F14_IMG_NUM_FORMAT_USCALED || - num_format == V_008F14_IMG_NUM_FORMAT_SSCALED || - num_format == V_008F14_IMG_NUM_FORMAT_UINT || - num_format == V_008F14_IMG_NUM_FORMAT_SINT; + 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); -- 2.30.2