From 3ecd357d816dc71b2c6ebd6ace38c76ebb25674e Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 22 Feb 2016 17:28:22 -0800 Subject: [PATCH] anv: Allocate more push constant space. Previously we allocated 4kB of push constant space for VS, GS, and PS (for a total of 12kB) no matter what. This works, but doesn't fully utilize the space - we have 16kB or 32kB of space. This makes anv use the same method as brw - divide up the space evenly among all active shader stages. This means HS and DS would get space, if those shader stages existed. In the future, we can probably do better by inspecting how many push constants each shader stage uses, and weight things accordingly. But this is strictly better than the old code, and ideally we'd justify a fancier solution with actual performance data. --- src/intel/vulkan/anv_pipeline.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 6c8d4add6e8..92c5c35699c 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -891,11 +891,17 @@ gen7_compute_urb_partition(struct anv_pipeline *pipeline) pipeline->urb.size[MESA_SHADER_TESS_EVAL] = 1; pipeline->urb.entries[MESA_SHADER_TESS_EVAL] = 0; - pipeline->urb.push_size[MESA_SHADER_VERTEX] = 4; - pipeline->urb.push_size[MESA_SHADER_TESS_CTRL] = 0; - pipeline->urb.push_size[MESA_SHADER_TESS_EVAL] = 0; - pipeline->urb.push_size[MESA_SHADER_GEOMETRY] = 4; - pipeline->urb.push_size[MESA_SHADER_FRAGMENT] = 4; + const unsigned stages = + _mesa_bitcount(pipeline->active_stages & VK_SHADER_STAGE_ALL_GRAPHICS); + const unsigned size_per_stage = push_constant_kb / stages; + + for (int i = MESA_SHADER_VERTEX; i < MESA_SHADER_FRAGMENT; i++) { + pipeline->urb.push_size[i] = + (pipeline->active_stages & (1 << i)) ? size_per_stage : 1; + } + + pipeline->urb.push_size[MESA_SHADER_FRAGMENT] = + push_constant_kb - size_per_stage * (stages - 1); } static void -- 2.30.2