From: Kristian Høgsberg Kristensen Date: Wed, 19 Aug 2015 23:01:33 +0000 (-0700) Subject: vk: Add generic wrapper for filling out buffer surface state X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8fe74ec45c93b3ec64243f351a7e2173a76cf788;p=mesa.git vk: Add generic wrapper for filling out buffer surface state We need this for generating surface state on the fly for dynamic buffer views. Signed-off-by: Kristian Høgsberg Kristensen --- diff --git a/src/vulkan/anv_cmd_buffer.c b/src/vulkan/anv_cmd_buffer.c index 4e3264cda69..951bb103430 100644 --- a/src/vulkan/anv_cmd_buffer.c +++ b/src/vulkan/anv_cmd_buffer.c @@ -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); diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c index a33981d7350..bf256765bdf 100644 --- a/src/vulkan/anv_device.c +++ b/src/vulkan/anv_device.c @@ -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, diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index 3a46e37bc3a..2f741aca101 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -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);