From 8fe74ec45c93b3ec64243f351a7e2173a76cf788 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg=20Kristensen?= Date: Wed, 19 Aug 2015 16:01:33 -0700 Subject: [PATCH] vk: Add generic wrapper for filling out buffer surface state MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We need this for generating surface state on the fly for dynamic buffer views. Signed-off-by: Kristian Høgsberg Kristensen --- src/vulkan/anv_cmd_buffer.c | 5 +++-- src/vulkan/anv_device.c | 14 ++++++++++++++ src/vulkan/anv_private.h | 4 ++++ 3 files changed, 21 insertions(+), 2 deletions(-) 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); -- 2.30.2