vk: Add generic wrapper for filling out buffer surface state
authorKristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Wed, 19 Aug 2015 23:01:33 +0000 (16:01 -0700)
committerKristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Mon, 24 Aug 2015 20:45:40 +0000 (13:45 -0700)
We need this for generating surface state on the fly for dynamic buffer
views.

Signed-off-by: Kristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
src/vulkan/anv_cmd_buffer.c
src/vulkan/anv_device.c
src/vulkan/anv_private.h

index 4e3264cda69b49e021e623ff13530992737aeece..951bb1034308fc8cbb0c160c444cad8d8bbca5d5 100644 (file)
@@ -425,8 +425,9 @@ anv_cmd_buffer_emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
                d->dynamic_offsets[surface_slots[b].dynamic_slot];
 
             offset = view->offset + dynamic_offset;
-            gen8_fill_buffer_surface_state(state.map, view->format, offset,
-                                           view->range - dynamic_offset);
+            anv_fill_buffer_surface_state(cmd_buffer->device,
+                                          state.map, view->format, offset,
+                                          view->range - dynamic_offset);
          } else {
             offset = view->offset;
             memcpy(state.map, view->surface_state.map, 64);
index a33981d7350fd459b93a799f43ad3e0542ca8b2f..bf256765bdfa3ea7589a233fb31e3db9bc0d904b 100644 (file)
@@ -1324,6 +1324,20 @@ VkResult anv_DestroyBuffer(
    return VK_SUCCESS;
 }
 
+void
+anv_fill_buffer_surface_state(struct anv_device *device, void *state,
+                              const struct anv_format *format,
+                              uint32_t offset, uint32_t range)
+{
+   switch (device->info.gen) {
+   case 8:
+      gen8_fill_buffer_surface_state(state, format, offset, range);
+      break;
+   default:
+      unreachable("unsupported gen\n");
+   }
+}
+
 VkResult
 anv_buffer_view_create(
    struct anv_device *                          device,
index 3a46e37bc3a0605ab36398567a9585c1091e32a0..2f741aca101d1ef956e47ef7cea38ff111919074 100644 (file)
@@ -1056,6 +1056,10 @@ VkResult anv_buffer_view_create(struct anv_device *device,
                                 const VkBufferViewCreateInfo *pCreateInfo,
                                 struct anv_buffer_view **view_out);
 
+void anv_fill_buffer_surface_state(struct anv_device *device, void *state,
+                                   const struct anv_format *format,
+                                   uint32_t offset, uint32_t range);
+
 void gen8_fill_buffer_surface_state(void *state, const struct anv_format *format,
                                     uint32_t offset, uint32_t range);