From 067dbd7a17e04cacf74fd08f5bc8a692fb68e202 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg=20Kristensen?= Date: Wed, 6 Jan 2016 16:41:22 -0800 Subject: [PATCH] vk: Issue PIPELINE_SELECT before setting up render pass We need to make sure we're selected the 3D pipeline before we start setting up depth and stencil buffers. --- src/vulkan/gen8_cmd_buffer.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/vulkan/gen8_cmd_buffer.c b/src/vulkan/gen8_cmd_buffer.c index 9b03b0a5c56..74f7e32952d 100644 --- a/src/vulkan/gen8_cmd_buffer.c +++ b/src/vulkan/gen8_cmd_buffer.c @@ -145,15 +145,8 @@ gen8_cmd_buffer_emit_viewport(struct anv_cmd_buffer *cmd_buffer) #endif static void -cmd_buffer_flush_state(struct anv_cmd_buffer *cmd_buffer) +flush_pipeline_select_3d(struct anv_cmd_buffer *cmd_buffer) { - struct anv_pipeline *pipeline = cmd_buffer->state.pipeline; - uint32_t *p; - - uint32_t vb_emit = cmd_buffer->state.vb_dirty & pipeline->vb_used; - - assert((pipeline->active_stages & VK_SHADER_STAGE_COMPUTE_BIT) == 0); - if (cmd_buffer->state.current_pipeline != _3D) { anv_batch_emit(&cmd_buffer->batch, GENX(PIPELINE_SELECT), #if ANV_GEN >= 9 @@ -162,6 +155,19 @@ cmd_buffer_flush_state(struct anv_cmd_buffer *cmd_buffer) .PipelineSelection = _3D); cmd_buffer->state.current_pipeline = _3D; } +} + +static void +cmd_buffer_flush_state(struct anv_cmd_buffer *cmd_buffer) +{ + struct anv_pipeline *pipeline = cmd_buffer->state.pipeline; + uint32_t *p; + + uint32_t vb_emit = cmd_buffer->state.vb_dirty & pipeline->vb_used; + + assert((pipeline->active_stages & VK_SHADER_STAGE_COMPUTE_BIT) == 0); + + flush_pipeline_select_3d(cmd_buffer); if (vb_emit) { const uint32_t num_buffers = __builtin_popcount(vb_emit); @@ -807,6 +813,8 @@ void genX(CmdBeginRenderPass)( cmd_buffer->state.framebuffer = framebuffer; cmd_buffer->state.pass = pass; + flush_pipeline_select_3d(cmd_buffer); + const VkRect2D *render_area = &pRenderPassBegin->renderArea; anv_batch_emit(&cmd_buffer->batch, GENX(3DSTATE_DRAWING_RECTANGLE), -- 2.30.2