radeonsi: remove si_create_sampler_view_custom and related code
authorMarek Olšák <marek.olsak@amd.com>
Mon, 25 Apr 2022 07:52:59 +0000 (03:52 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 3 May 2022 15:11:08 +0000 (11:11 -0400)
This was used for compressed and subsampled gfx copies.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16215>

src/gallium/drivers/radeonsi/si_descriptors.c
src/gallium/drivers/radeonsi/si_pipe.h
src/gallium/drivers/radeonsi/si_state.c
src/gallium/drivers/radeonsi/si_state.h

index c0ee237..6dba441 100644 (file)
@@ -470,7 +470,7 @@ static void si_set_sampler_view_desc(struct si_context *sctx, struct si_sampler_
    bool is_separate_stencil = tex->db_compatible && sview->is_stencil_sampler;
 
    memcpy(desc, sview->state, 8 * 4);
-   si_set_mutable_tex_desc_fields(sctx->screen, tex, sview->base_level_info, sview->base_level,
+   si_set_mutable_tex_desc_fields(sctx->screen, tex, sview->base_level_info, 0,
                                   sview->base.u.tex.first_level, sview->block_width,
                                   is_separate_stencil, 0, desc);
 
index 5bdab0c..e389110 100644 (file)
@@ -700,7 +700,6 @@ struct si_sampler_view {
    uint32_t state[8];
    uint32_t fmask_state[8];
    const struct legacy_surf_level *base_level_info;
-   ubyte base_level;
    ubyte block_width;
    bool is_stencil_sampler;
    bool dcc_incompatible;
index bdbda1a..6e77da7 100644 (file)
@@ -4365,22 +4365,15 @@ static void si_make_texture_descriptor(struct si_screen *screen, struct si_textu
  * @param ctx          context
  * @param texture      texture
  * @param state                sampler view template
- * @param width0       width0 override (for compressed textures as int)
- * @param height0      height0 override (for compressed textures as int)
- * @param force_level   set the base address to the level (for compressed textures)
  */
-struct pipe_sampler_view *si_create_sampler_view_custom(struct pipe_context *ctx,
+static struct pipe_sampler_view *si_create_sampler_view(struct pipe_context *ctx,
                                                         struct pipe_resource *texture,
-                                                        const struct pipe_sampler_view *state,
-                                                        unsigned width0, unsigned height0,
-                                                        unsigned force_level)
+                                                        const struct pipe_sampler_view *state)
 {
    struct si_context *sctx = (struct si_context *)ctx;
    struct si_sampler_view *view = CALLOC_STRUCT_CL(si_sampler_view);
    struct si_texture *tex = (struct si_texture *)texture;
-   unsigned base_level, first_level, last_level;
    unsigned char state_swizzle[4];
-   unsigned height, depth, width;
    unsigned last_layer = state->u.tex.last_layer;
    enum pipe_format pipe_format;
    const struct legacy_surf_level *surflevel;
@@ -4413,23 +4406,6 @@ struct pipe_sampler_view *si_create_sampler_view_custom(struct pipe_context *ctx
    state_swizzle[2] = state->swizzle_b;
    state_swizzle[3] = state->swizzle_a;
 
-   base_level = 0;
-   first_level = state->u.tex.first_level;
-   last_level = state->u.tex.last_level;
-   width = width0;
-   height = height0;
-   depth = texture->depth0;
-
-   if (sctx->chip_class <= GFX8 && force_level) {
-      assert(force_level == first_level && force_level == last_level);
-      base_level = force_level;
-      first_level = 0;
-      last_level = 0;
-      width = u_minify(width, force_level);
-      height = u_minify(height, force_level);
-      depth = u_minify(depth, force_level);
-   }
-
    /* This is not needed if gallium frontends set last_layer correctly. */
    if (state->target == PIPE_TEXTURE_1D || state->target == PIPE_TEXTURE_2D ||
        state->target == PIPE_TEXTURE_RECT || state->target == PIPE_TEXTURE_CUBE)
@@ -4488,23 +4464,16 @@ struct pipe_sampler_view *si_create_sampler_view_custom(struct pipe_context *ctx
       vi_dcc_formats_are_incompatible(texture, state->u.tex.first_level, state->format);
 
    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, width, height, depth, view->state, view->fmask_state);
+      sctx->screen, tex, true, state->target, pipe_format, state_swizzle,
+      state->u.tex.first_level, state->u.tex.last_level,
+      state->u.tex.first_layer, last_layer, texture->width0, texture->height0, texture->depth0,
+            view->state, view->fmask_state);
 
-   view->base_level_info = &surflevel[base_level];
-   view->base_level = base_level;
+   view->base_level_info = &surflevel[0];
    view->block_width = util_format_get_blockwidth(pipe_format);
    return &view->base;
 }
 
-static struct pipe_sampler_view *si_create_sampler_view(struct pipe_context *ctx,
-                                                        struct pipe_resource *texture,
-                                                        const struct pipe_sampler_view *state)
-{
-   return si_create_sampler_view_custom(ctx, texture, state, texture ? texture->width0 : 0,
-                                        texture ? texture->height0 : 0, 0);
-}
-
 static void si_sampler_view_destroy(struct pipe_context *ctx, struct pipe_sampler_view *state)
 {
    struct si_sampler_view *view = (struct si_sampler_view *)state;
index 4cf01ba..8888ca7 100644 (file)
@@ -531,11 +531,6 @@ void si_init_cs_preamble_state(struct si_context *sctx, bool uses_reg_shadowing)
 void si_make_buffer_descriptor(struct si_screen *screen, struct si_resource *buf,
                                enum pipe_format format, unsigned offset, unsigned size,
                                uint32_t *state);
-struct pipe_sampler_view *si_create_sampler_view_custom(struct pipe_context *ctx,
-                                                        struct pipe_resource *texture,
-                                                        const struct pipe_sampler_view *state,
-                                                        unsigned width0, unsigned height0,
-                                                        unsigned force_level);
 void si_set_sampler_depth_decompress_mask(struct si_context *sctx, struct si_texture *tex);
 void si_update_fb_dirtiness_after_rendering(struct si_context *sctx);
 void si_mark_display_dcc_dirty(struct si_context *sctx, struct si_texture *tex);