lima: set shader caps to optimize control flow
authorErico Nunes <nunes.erico@gmail.com>
Thu, 19 Dec 2019 21:51:07 +0000 (22:51 +0100)
committerErico Nunes <nunes.erico@gmail.com>
Fri, 20 Dec 2019 19:59:15 +0000 (20:59 +0100)
With these new caps, nir is able to unroll loops and optimize
conditionals much more efficiently in both gpit and ppir.
panfrost and vc4 were used as reference for the values.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3176>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3176>

src/gallium/drivers/lima/lima_screen.c

index 4dc1fc652b85b1f2f4c5b404a7657da5a8a8d822..9610018115d35090a0e7cb42653cc9627be3a34f 100644 (file)
@@ -178,6 +178,9 @@ get_vertex_shader_param(struct lima_screen *screen,
    case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
       return 16384; /* need investigate */
 
+   case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
+      return 1024;
+
    case PIPE_SHADER_CAP_MAX_INPUTS:
       return 16; /* attributes */
 
@@ -185,7 +188,8 @@ get_vertex_shader_param(struct lima_screen *screen,
       return LIMA_MAX_VARYING_NUM; /* varying */
 
    case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
-      return 4096; /* need investigate */
+      return 16 * 1024 * sizeof(float);
+
    case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
       return 1;
 
@@ -195,6 +199,9 @@ get_vertex_shader_param(struct lima_screen *screen,
    case PIPE_SHADER_CAP_MAX_TEMPS:
       return 256; /* need investigate */
 
+   case PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT:
+      return 32;
+
    default:
       return 0;
    }
@@ -214,8 +221,12 @@ get_fragment_shader_param(struct lima_screen *screen,
    case PIPE_SHADER_CAP_MAX_INPUTS:
       return LIMA_MAX_VARYING_NUM - 1; /* varying, minus gl_Position */
 
+   case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
+      return 1024;
+
    case PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE:
-      return 4096; /* need investigate */
+      return 16 * 1024 * sizeof(float);
+
    case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
       return 1;
 
@@ -236,6 +247,9 @@ get_fragment_shader_param(struct lima_screen *screen,
    case PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR:
       return 0;
 
+   case PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT:
+      return 32;
+
    default:
       return 0;
    }