From 8e9e94d084316e8723951bcf9595c45dfb735c2a Mon Sep 17 00:00:00 2001 From: Erico Nunes Date: Thu, 19 Dec 2019 22:51:07 +0100 Subject: [PATCH] lima: set shader caps to optimize control flow 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 Reviewed-by: Vasily Khoruzhick Tested-by: Marge Bot Part-of: --- src/gallium/drivers/lima/lima_screen.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/lima/lima_screen.c b/src/gallium/drivers/lima/lima_screen.c index 4dc1fc652b8..9610018115d 100644 --- a/src/gallium/drivers/lima/lima_screen.c +++ b/src/gallium/drivers/lima/lima_screen.c @@ -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; } -- 2.30.2