radeonsi/gfx10: implement si_is_format_supported
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 14 Nov 2017 14:20:06 +0000 (15:20 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 3 Jul 2019 19:51:12 +0000 (15:51 -0400)
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/gallium/drivers/radeonsi/si_state.c

index ca1671e..a82f8dc 100644 (file)
@@ -2008,6 +2008,15 @@ static unsigned si_tex_dim(struct si_screen *sscreen, struct si_texture *tex,
 
 static bool si_is_sampler_format_supported(struct pipe_screen *screen, enum pipe_format format)
 {
+       struct si_screen *sscreen = (struct si_screen *)screen;
+
+       if (sscreen->info.chip_class >= GFX10) {
+               const struct gfx10_format *fmt = &gfx10_format_table[format];
+               if (!fmt->img_format || fmt->buffers_only)
+                       return false;
+               return true;
+       }
+
        const struct util_format_description *desc = util_format_description(format);
        if (!desc)
                return false;
@@ -2136,6 +2145,7 @@ static unsigned si_is_vertex_format_supported(struct pipe_screen *screen,
                                              enum pipe_format format,
                                              unsigned usage)
 {
+       struct si_screen *sscreen = (struct si_screen *)screen;
        const struct util_format_description *desc;
        int first_non_void;
        unsigned data_format;
@@ -2165,6 +2175,13 @@ static unsigned si_is_vertex_format_supported(struct pipe_screen *screen,
                }
        }
 
+       if (sscreen->info.chip_class >= GFX10) {
+               const struct gfx10_format *fmt = &gfx10_format_table[format];
+               if (!fmt->img_format || fmt->img_format >= 128)
+                       return 0;
+               return usage;
+       }
+
        first_non_void = util_format_get_first_non_void_channel(format);
        data_format = si_translate_buffer_dataformat(screen, desc, first_non_void);
        if (data_format == V_008F0C_BUF_DATA_FORMAT_INVALID)