vk/meta: Save and restore the old bindings pointer
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 16 May 2015 17:28:04 +0000 (10:28 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Sat, 16 May 2015 17:28:04 +0000 (10:28 -0700)
If we don't do this then recursive meta is completely broken.  What happens
is that the outer meta call may change the bindings pointer and the inner
meta call will change it again and, when it exits set it back to the
default.  However, the outer meta call may be relying on it being left
alone so it uses the non-meta descriptor sets instead of its own.

src/vulkan/meta.c

index 75d148b73c0eb9286e7c0fa9d078d574dae3f3a9..1255761c4d673f6a745a7275ade88d3680d7382a 100644 (file)
@@ -149,15 +149,17 @@ anv_device_init_meta_clear_state(struct anv_device *device)
 #define NUM_VB_USED 2
 struct anv_saved_state {
    struct anv_bindings bindings;
-   struct anv_pipeline *pipeline;
+   struct anv_bindings *old_bindings;
+   struct anv_pipeline *old_pipeline;
 };
 
 static void
 anv_cmd_buffer_save(struct anv_cmd_buffer *cmd_buffer,
                     struct anv_saved_state *state)
 {
+   state->old_bindings = cmd_buffer->bindings;
    cmd_buffer->bindings = &state->bindings;
-   state->pipeline = cmd_buffer->pipeline;
+   state->old_pipeline = cmd_buffer->pipeline;
 
    /* Initialize render targets for the meta bindings. */
    anv_cmd_buffer_fill_render_targets(cmd_buffer);
@@ -167,8 +169,8 @@ static void
 anv_cmd_buffer_restore(struct anv_cmd_buffer *cmd_buffer,
                        const struct anv_saved_state *state)
 {
-   cmd_buffer->bindings = &cmd_buffer->default_bindings;
-   cmd_buffer->pipeline = state->pipeline;
+   cmd_buffer->bindings = state->old_bindings;
+   cmd_buffer->pipeline = state->old_pipeline;
 
    cmd_buffer->vb_dirty |= (1 << NUM_VB_USED) - 1;
    cmd_buffer->dirty |= ANV_CMD_BUFFER_PIPELINE_DIRTY |