vc4: Add a flag in the screen to track control flow support.
authorEric Anholt <eric@anholt.net>
Mon, 11 Jul 2016 17:55:18 +0000 (10:55 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 13 Jul 2016 00:42:40 +0000 (17:42 -0700)
For now it's still always false, but I need it in place for kernel
backwards compat support as I extend the backend for control flow.

src/gallium/drivers/vc4/vc4_program.c
src/gallium/drivers/vc4/vc4_screen.c
src/gallium/drivers/vc4/vc4_screen.h

index 0a231b2f6e8be80a52038d7430b0933887727a8b..dec14453203aeb71b42062e976128b9cd4b80fa3 100644 (file)
@@ -1765,6 +1765,7 @@ vc4_shader_ntq(struct vc4_context *vc4, enum qstage stage,
 {
         struct vc4_compile *c = qir_compile_init();
 
+        c->vc4 = vc4;
         c->stage = stage;
         c->shader_state = &key->shader_state->base;
         c->program_id = key->shader_state->program_id;
index 609dc91365595b0fdb0f12cf68159773197bfcec..f60500ddec3dcbb77cabc9983498b56a1f63b8bf 100644 (file)
@@ -329,8 +329,10 @@ vc4_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
         case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
         case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
                 return 16384;
+
         case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
-                return 0;
+                return vc4_screen(pscreen)->has_control_flow;
+
         case PIPE_SHADER_CAP_MAX_INPUTS:
                 if (shader == PIPE_SHADER_FRAGMENT)
                         return 8;
@@ -494,6 +496,12 @@ vc4_screen_is_format_supported(struct pipe_screen *pscreen,
         return retval == usage;
 }
 
+static bool
+vc4_supports_branches(struct vc4_screen *screen)
+{
+        return false;
+}
+
 struct pipe_screen *
 vc4_screen_create(int fd)
 {
@@ -512,6 +520,9 @@ vc4_screen_create(int fd)
         screen->fd = fd;
         list_inithead(&screen->bo_cache.time_list);
 
+        if (vc4_supports_branches(screen))
+                screen->has_control_flow = true;
+
         vc4_fence_init(screen);
 
         vc4_debug = debug_get_option_vc4_debug();
index 03f76b257e3578f7327b0c0b9767f2ae713a3eef..6cecca63bc486eeaed7a37585a0b959fe22bf0b9 100644 (file)
@@ -75,6 +75,7 @@ struct vc4_screen {
 
         uint32_t bo_size;
         uint32_t bo_count;
+        bool has_control_flow;
 };
 
 static inline struct vc4_screen *