From: Nicolai Hähnle Date: Tue, 14 Nov 2017 15:03:48 +0000 (+0100) Subject: radeonsi/gfx10: add pipe_screen::make_texture_descriptor X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=595a7f7c47d3b9bbb55d67907b3de77f1486e0b3;p=mesa.git radeonsi/gfx10: add pipe_screen::make_texture_descriptor Texture descriptors in gfx10 are very different. Acked-by: Bas Nieuwenhuizen --- diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c index 2a13ffd32f9..2b637208e1a 100644 --- a/src/gallium/drivers/radeonsi/si_descriptors.c +++ b/src/gallium/drivers/radeonsi/si_descriptors.c @@ -742,7 +742,7 @@ static void si_set_shader_image_desc(struct si_context *ctx, hw_level = 0; } - si_make_texture_descriptor(screen, tex, + screen->make_texture_descriptor(screen, tex, false, res->b.b.target, view->format, swizzle, hw_level, hw_level, diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 8512c27b2cd..57232432cc2 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -457,6 +457,19 @@ struct si_screen { uint64_t debug_flags; char renderer_string[183]; + void (*make_texture_descriptor)( + struct si_screen *screen, + struct si_texture *tex, + bool sampler, + enum pipe_texture_target target, + enum pipe_format pipe_format, + const unsigned char state_swizzle[4], + unsigned first_level, unsigned last_level, + unsigned first_layer, unsigned last_layer, + unsigned width, unsigned height, unsigned depth, + uint32_t *state, + uint32_t *fmask_state); + unsigned pa_sc_raster_config; unsigned pa_sc_raster_config_1; unsigned se_tile_repeat; diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 347d7b84b4c..dd2314aef66 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -3736,7 +3736,7 @@ static unsigned gfx9_border_color_swizzle(const unsigned char swizzle[4]) /** * Build the sampler view descriptor for a texture. */ -void +static void si_make_texture_descriptor(struct si_screen *screen, struct si_texture *tex, bool sampler, @@ -4224,7 +4224,7 @@ si_create_sampler_view_custom(struct pipe_context *ctx, state->u.tex.first_level, state->format); - si_make_texture_descriptor(sctx->screen, tex, true, + sctx->screen->make_texture_descriptor(sctx->screen, tex, true, state->target, pipe_format, state_swizzle, first_level, last_level, state->u.tex.first_layer, last_layer, @@ -4970,6 +4970,8 @@ void si_init_state_functions(struct si_context *sctx) void si_init_screen_state_functions(struct si_screen *sscreen) { sscreen->b.is_format_supported = si_is_format_supported; + + sscreen->make_texture_descriptor = si_make_texture_descriptor; } static void si_set_grbm_gfx_index(struct si_context *sctx, diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h index d1fc1c09c66..b55c99fdd4c 100644 --- a/src/gallium/drivers/radeonsi/si_state.h +++ b/src/gallium/drivers/radeonsi/si_state.h @@ -536,18 +536,6 @@ si_make_buffer_descriptor(struct si_screen *screen, struct si_resource *buf, enum pipe_format format, unsigned offset, unsigned size, uint32_t *state); -void -si_make_texture_descriptor(struct si_screen *screen, - struct si_texture *tex, - bool sampler, - enum pipe_texture_target target, - enum pipe_format pipe_format, - const unsigned char state_swizzle[4], - unsigned first_level, unsigned last_level, - unsigned first_layer, unsigned last_layer, - unsigned width, unsigned height, unsigned depth, - uint32_t *state, - uint32_t *fmask_state); struct pipe_sampler_view * si_create_sampler_view_custom(struct pipe_context *ctx, struct pipe_resource *texture, diff --git a/src/gallium/drivers/radeonsi/si_texture.c b/src/gallium/drivers/radeonsi/si_texture.c index 324669b4d62..37641c4a102 100644 --- a/src/gallium/drivers/radeonsi/si_texture.c +++ b/src/gallium/drivers/radeonsi/si_texture.c @@ -683,7 +683,7 @@ static void si_set_tex_bo_metadata(struct si_screen *sscreen, bool is_array = util_texture_is_array(res->target); uint32_t desc[8]; - si_make_texture_descriptor(sscreen, tex, true, + sscreen->make_texture_descriptor(sscreen, tex, true, res->target, res->format, swizzle, 0, res->last_level, 0, is_array ? res->array_size - 1 : 0,