From 1f98bf8da028c4d0e2b47cc1a59e6f004e2207a1 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Mon, 14 Dec 2015 16:14:20 -0800 Subject: [PATCH] anv: Pass an isl_format into fill_buffer_surface_state --- src/vulkan/anv_cmd_buffer.c | 2 +- src/vulkan/anv_device.c | 2 +- src/vulkan/anv_image.c | 3 ++- src/vulkan/anv_private.h | 10 +++++----- src/vulkan/gen7_state.c | 4 ++-- src/vulkan/gen8_state.c | 4 ++-- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/vulkan/anv_cmd_buffer.c b/src/vulkan/anv_cmd_buffer.c index 4dc3704ebf3..984b885a4b6 100644 --- a/src/vulkan/anv_cmd_buffer.c +++ b/src/vulkan/anv_cmd_buffer.c @@ -605,7 +605,7 @@ fill_descriptor_buffer_surface_state(struct anv_device *device, void *state, } anv_fill_buffer_surface_state(device, state, - anv_format_for_vk_format(format), + anv_format_for_vk_format(format)->surface_format, offset, range, 1); } diff --git a/src/vulkan/anv_device.c b/src/vulkan/anv_device.c index 7ddad58cf6f..ff224907854 100644 --- a/src/vulkan/anv_device.c +++ b/src/vulkan/anv_device.c @@ -1493,7 +1493,7 @@ void anv_DestroyBuffer( void anv_fill_buffer_surface_state(struct anv_device *device, void *state, - const struct anv_format *format, + enum isl_format format, uint32_t offset, uint32_t range, uint32_t stride) { switch (device->info.gen) { diff --git a/src/vulkan/anv_image.c b/src/vulkan/anv_image.c index dcad2affb2c..659fe80b320 100644 --- a/src/vulkan/anv_image.c +++ b/src/vulkan/anv_image.c @@ -521,7 +521,8 @@ anv_CreateBufferView(VkDevice _device, const struct anv_format *format = anv_format_for_vk_format(pCreateInfo->format); - anv_fill_buffer_surface_state(device, view->surface_state.map, format, + anv_fill_buffer_surface_state(device, view->surface_state.map, + format->surface_format, view->offset, pCreateInfo->range, format->isl_layout->bpb / 8); diff --git a/src/vulkan/anv_private.h b/src/vulkan/anv_private.h index d2b65711fc4..c5ab92c5438 100644 --- a/src/vulkan/anv_private.h +++ b/src/vulkan/anv_private.h @@ -1524,20 +1524,20 @@ struct anv_buffer_view { }; void anv_fill_buffer_surface_state(struct anv_device *device, void *state, - const struct anv_format *format, + enum isl_format format, uint32_t offset, uint32_t range, uint32_t stride); -void gen7_fill_buffer_surface_state(void *state, const struct anv_format *format, +void gen7_fill_buffer_surface_state(void *state, enum isl_format format, uint32_t offset, uint32_t range, uint32_t stride); -void gen75_fill_buffer_surface_state(void *state, const struct anv_format *format, +void gen75_fill_buffer_surface_state(void *state, enum isl_format format, uint32_t offset, uint32_t range, uint32_t stride); -void gen8_fill_buffer_surface_state(void *state, const struct anv_format *format, +void gen8_fill_buffer_surface_state(void *state, enum isl_format format, uint32_t offset, uint32_t range, uint32_t stride); -void gen9_fill_buffer_surface_state(void *state, const struct anv_format *format, +void gen9_fill_buffer_surface_state(void *state, enum isl_format format, uint32_t offset, uint32_t range, uint32_t stride); diff --git a/src/vulkan/gen7_state.c b/src/vulkan/gen7_state.c index 108ebe7c225..f58283f7d05 100644 --- a/src/vulkan/gen7_state.c +++ b/src/vulkan/gen7_state.c @@ -57,7 +57,7 @@ anv_surftype(const struct anv_image *image, VkImageViewType view_type) } GENX_FUNC(GEN7, GEN75) void -genX(fill_buffer_surface_state)(void *state, const struct anv_format *format, +genX(fill_buffer_surface_state)(void *state, enum isl_format format, uint32_t offset, uint32_t range, uint32_t stride) { @@ -65,7 +65,7 @@ genX(fill_buffer_surface_state)(void *state, const struct anv_format *format, struct GENX(RENDER_SURFACE_STATE) surface_state = { .SurfaceType = SURFTYPE_BUFFER, - .SurfaceFormat = format->surface_format, + .SurfaceFormat = format, .SurfaceVerticalAlignment = VALIGN_4, .SurfaceHorizontalAlignment = HALIGN_4, .TiledSurface = false, diff --git a/src/vulkan/gen8_state.c b/src/vulkan/gen8_state.c index aa57073c3e8..eee2515e220 100644 --- a/src/vulkan/gen8_state.c +++ b/src/vulkan/gen8_state.c @@ -57,7 +57,7 @@ anv_surftype(const struct anv_image *image, VkImageViewType view_type) } void -genX(fill_buffer_surface_state)(void *state, const struct anv_format *format, +genX(fill_buffer_surface_state)(void *state, enum isl_format format, uint32_t offset, uint32_t range, uint32_t stride) { uint32_t num_elements = range / stride; @@ -65,7 +65,7 @@ genX(fill_buffer_surface_state)(void *state, const struct anv_format *format, struct GENX(RENDER_SURFACE_STATE) surface_state = { .SurfaceType = SURFTYPE_BUFFER, .SurfaceArray = false, - .SurfaceFormat = format->surface_format, + .SurfaceFormat = format, .SurfaceVerticalAlignment = VALIGN4, .SurfaceHorizontalAlignment = HALIGN4, .TileMode = LINEAR, -- 2.30.2