From 7f9b03cc8b44759895d5c4c42cfef8fa78269e7c Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 22 Feb 2016 15:46:23 -0800 Subject: [PATCH] anv: Emit 3DSTATE_PUSH_CONSTANT_ALLOC_* via a loop. Now we're emitting HS and DS packets as well. --- src/intel/vulkan/anv_pipeline.c | 6 ++++++ src/intel/vulkan/anv_private.h | 1 + src/intel/vulkan/genX_pipeline_util.h | 17 ++++++++--------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index df78362ee70..672640ac24c 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -885,6 +885,12 @@ gen7_compute_urb_partition(struct anv_pipeline *pipeline) pipeline->urb.start[MESA_SHADER_TESS_EVAL] = push_constant_chunks; 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; } static void diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 3e3cbf09a68..041ad87f75d 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1410,6 +1410,7 @@ struct anv_pipeline { uint32_t scratch_start[MESA_SHADER_STAGES]; uint32_t total_scratch; struct { + uint8_t push_size[MESA_SHADER_FRAGMENT + 1]; uint32_t start[MESA_SHADER_GEOMETRY + 1]; uint32_t size[MESA_SHADER_GEOMETRY + 1]; uint32_t entries[MESA_SHADER_GEOMETRY + 1]; diff --git a/src/intel/vulkan/genX_pipeline_util.h b/src/intel/vulkan/genX_pipeline_util.h index dea96a934b8..cf4e0358741 100644 --- a/src/intel/vulkan/genX_pipeline_util.h +++ b/src/intel/vulkan/genX_pipeline_util.h @@ -200,15 +200,14 @@ emit_urb_setup(struct anv_pipeline *pipeline) .Address = { &device->workaround_bo, 0 }); #endif - anv_batch_emit(&pipeline->batch, GENX(3DSTATE_PUSH_CONSTANT_ALLOC_VS), - .ConstantBufferOffset = 0, - .ConstantBufferSize = 4); - anv_batch_emit(&pipeline->batch, GENX(3DSTATE_PUSH_CONSTANT_ALLOC_GS), - .ConstantBufferOffset = 4, - .ConstantBufferSize = 4); - anv_batch_emit(&pipeline->batch, GENX(3DSTATE_PUSH_CONSTANT_ALLOC_PS), - .ConstantBufferOffset = 8, - .ConstantBufferSize = 4); + unsigned push_start = 0; + for (int i = MESA_SHADER_VERTEX; i <= MESA_SHADER_FRAGMENT; i++) { + anv_batch_emit(&pipeline->batch, GENX(3DSTATE_PUSH_CONSTANT_ALLOC_VS), + ._3DCommandSubOpcode = 18 + i, + .ConstantBufferOffset = push_start, + .ConstantBufferSize = pipeline->urb.push_size[i]); + push_start += pipeline->urb.push_size[i]; + } for (int i = MESA_SHADER_VERTEX; i <= MESA_SHADER_GEOMETRY; i++) { anv_batch_emit(&pipeline->batch, GENX(3DSTATE_URB_VS), -- 2.30.2