vk: Issue PIPELINE_SELECT before setting up render pass
authorKristian Høgsberg Kristensen <krh@owl.jf.intel.com>
Thu, 7 Jan 2016 00:41:22 +0000 (16:41 -0800)
committerKristian Høgsberg Kristensen <krh@owl.jf.intel.com>
Fri, 8 Jan 2016 00:31:57 +0000 (16:31 -0800)
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

index 9b03b0a5c56ec88a2498022a012f8f3a6261ebe2..74f7e32952d875032cd80353f6f8e7f0332de507 100644 (file)
@@ -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),