etnaviv: add gpu_supports_texture_target(..)
authorChristian Gmeiner <christian.gmeiner@gmail.com>
Fri, 9 Aug 2019 09:26:14 +0000 (11:26 +0200)
committerChristian Gmeiner <christian.gmeiner@gmail.com>
Fri, 9 Aug 2019 13:08:20 +0000 (13:08 +0000)
Currently I am seeing a handful of the following debug message:
translate_texture_target:495: Unhandled texture target: 0

PIPE_BUFFER is not handled in translate_texture_target(..) which makes
sense as it is used to translate from PIPE_XXX to GPU specific value
during etna_create_sampler_view_state(..).

To fix this problem introduce gpu_supports_texture_target(..) which just
checks if the texture target is supported.

Fixes: dfe048058fa ("etnaviv: support 3D and 2D array textures")
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
src/gallium/drivers/etnaviv/etnaviv_screen.c

index 455ccba790b418057c66ead8f18175cf7f851ec3..27c990bbccb51d3ba4795e93cde4a40cebefc6cc 100644 (file)
@@ -362,6 +362,23 @@ etna_screen_get_timestamp(struct pipe_screen *pscreen)
    return os_time_get_nano();
 }
 
+static bool
+gpu_supports_texture_target(struct etna_screen *screen,
+                            enum pipe_texture_target target)
+{
+   if (target == PIPE_TEXTURE_CUBE_ARRAY)
+      return false;
+
+   /* pre-halti has no array/3D */
+   if (screen->specs.halti < 0 &&
+       (target == PIPE_TEXTURE_1D_ARRAY ||
+        target == PIPE_TEXTURE_2D_ARRAY ||
+        target == PIPE_TEXTURE_3D))
+      return false;
+
+   return true;
+}
+
 static bool
 gpu_supports_texure_format(struct etna_screen *screen, uint32_t fmt,
                            enum pipe_format format)
@@ -404,14 +421,7 @@ etna_screen_is_format_supported(struct pipe_screen *pscreen,
    struct etna_screen *screen = etna_screen(pscreen);
    unsigned allowed = 0;
 
-   if (translate_texture_target(target) == ETNA_NO_MATCH)
-      return false;
-
-   /* pre-halti has no array/3D */
-   if (screen->specs.halti < 0 &&
-       (target == PIPE_TEXTURE_1D_ARRAY ||
-        target == PIPE_TEXTURE_2D_ARRAY ||
-        target == PIPE_TEXTURE_3D))
+   if (!gpu_supports_texture_target(screen, target))
       return false;
 
    if (MAX2(1, sample_count) != MAX2(1, storage_sample_count))