From 7637b02aaa4df9efaf856ee855ba03b5fe81d821 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg=20Kristensen?= Date: Thu, 11 Jun 2015 15:21:49 -0700 Subject: [PATCH] vk: Emit PIPELINE_SELECT on demand --- src/vulkan/device.c | 12 +++++++++--- src/vulkan/private.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/vulkan/device.c b/src/vulkan/device.c index 9e872de89b6..e44fb2b1cd9 100644 --- a/src/vulkan/device.c +++ b/src/vulkan/device.c @@ -2424,10 +2424,8 @@ VkResult anv_BeginCommandBuffer( { struct anv_cmd_buffer *cmd_buffer = (struct anv_cmd_buffer *) cmdBuffer; - anv_batch_emit(&cmd_buffer->batch, GEN8_PIPELINE_SELECT, - .PipelineSelection = _3D); - anv_cmd_buffer_emit_state_base_address(cmd_buffer); + cmd_buffer->current_pipeline = UINT32_MAX; return VK_SUCCESS; } @@ -3071,6 +3069,14 @@ anv_cmd_buffer_flush_state(struct anv_cmd_buffer *cmd_buffer) uint32_t vb_emit = cmd_buffer->vb_dirty & pipeline->vb_used; + assert((pipeline->active_stages & VK_SHADER_STAGE_COMPUTE_BIT) == 0); + + if (cmd_buffer->current_pipeline != _3D) { + anv_batch_emit(&cmd_buffer->batch, GEN8_PIPELINE_SELECT, + .PipelineSelection = _3D); + cmd_buffer->current_pipeline = _3D; + } + if (vb_emit) { const uint32_t num_buffers = __builtin_popcount(vb_emit); const uint32_t num_dwords = 1 + num_buffers * 4; diff --git a/src/vulkan/private.h b/src/vulkan/private.h index 3e4dc796420..8bc5fd10880 100644 --- a/src/vulkan/private.h +++ b/src/vulkan/private.h @@ -650,6 +650,7 @@ struct anv_cmd_buffer { struct anv_state_stream dynamic_state_stream; /* State required while building cmd buffer */ + uint32_t current_pipeline; uint32_t vb_dirty; uint32_t dirty; uint32_t descriptors_dirty; -- 2.30.2