From: Kenneth Graunke Date: Tue, 23 Feb 2016 01:28:22 +0000 (-0800) Subject: anv: Allocate more push constant space. X-Git-Tag: android-x86-6.0-r1~2228^2~263 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=3ecd357d816dc71b2c6ebd6ace38c76ebb25674e;p=android-x86%2Fexternal-mesa.git 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. --- 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