anv/meta_resolve: Save/Restore viewport and scissor
authorChad Versace <chad.versace@intel.com>
Thu, 28 Jan 2016 04:13:10 +0000 (20:13 -0800)
committerChad Versace <chad.versace@intel.com>
Thu, 28 Jan 2016 18:03:00 +0000 (10:03 -0800)
src/vulkan/anv_meta_resolve.c

index be8407869c8b640c8236b0e1005ae2c70515f3a0..1be87c4c1982fe41b35cf77071a92e5d242c55f5 100644 (file)
@@ -37,6 +37,25 @@ struct vertex_attrs {
    float tex_position[2];
 };
 
+static void
+meta_resolve_save(struct anv_meta_saved_state *saved_state,
+                  struct anv_cmd_buffer *cmd_buffer)
+{
+   anv_meta_save(saved_state, cmd_buffer,
+                 (1 << VK_DYNAMIC_STATE_VIEWPORT) |
+                 (1 << VK_DYNAMIC_STATE_SCISSOR));
+
+   cmd_buffer->state.dynamic.viewport.count = 0;
+   cmd_buffer->state.dynamic.scissor.count = 0;
+}
+
+static void
+meta_resolve_restore(struct anv_meta_saved_state *saved_state,
+                     struct anv_cmd_buffer *cmd_buffer)
+{
+   anv_meta_restore(saved_state, cmd_buffer);
+}
+
 static nir_shader *
 build_nir_vs(void)
 {
@@ -643,7 +662,7 @@ void anv_CmdResolveImage(
    struct anv_meta_saved_state state;
    VkDevice device_h = anv_device_to_handle(device);
 
-   anv_meta_save(&state, cmd_buffer, 0);
+   meta_resolve_save(&state, cmd_buffer);
 
    assert(src_image->samples > 1);
    assert(dest_image->samples == 1);
@@ -780,5 +799,5 @@ void anv_CmdResolveImage(
       }
    }
 
-   anv_meta_restore(&state, cmd_buffer);
+   meta_resolve_restore(&state, cmd_buffer);
 }