vk: Pass anv_format to anv_fill_buffer_surface_state()

This moves the translation of VkFormat to anv_format from
anv_fill_buffer_surface_state() to its caller.

A prep commit to reduce more VkFormat -> anv_format translations.
This commit is contained in:
Chad Versace
2015-08-17 13:20:33 -07:00
parent ded736f16a
commit c11094ec9a
3 changed files with 8 additions and 8 deletions

View File

@@ -506,6 +506,9 @@ cmd_buffer_emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
if (!view)
continue;
const struct anv_format *format =
anv_format_for_vk_format(view->format);
struct anv_state state =
anv_cmd_buffer_alloc_surface_state(cmd_buffer, 64, 64);
@@ -518,7 +521,7 @@ cmd_buffer_emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
d->dynamic_offsets[surface_slots[b].dynamic_slot];
offset = view->offset + dynamic_offset;
anv_fill_buffer_surface_state(state.map, view->format, offset,
anv_fill_buffer_surface_state(state.map, format, offset,
view->range - dynamic_offset);
} else {
offset = view->offset;

View File

@@ -1318,12 +1318,9 @@ VkResult anv_DestroyBuffer(
// Buffer view functions
void
anv_fill_buffer_surface_state(void *state, VkFormat format,
anv_fill_buffer_surface_state(void *state, const struct anv_format *format,
uint32_t offset, uint32_t range)
{
const struct anv_format *info;
info = anv_format_for_vk_format(format);
/* This assumes RGBA float format. */
uint32_t stride = 4;
uint32_t num_elements = range / stride;
@@ -1331,7 +1328,7 @@ anv_fill_buffer_surface_state(void *state, VkFormat format,
struct GEN8_RENDER_SURFACE_STATE surface_state = {
.SurfaceType = SURFTYPE_BUFFER,
.SurfaceArray = false,
.SurfaceFormat = info->surface_format,
.SurfaceFormat = format->surface_format,
.SurfaceVerticalAlignment = VALIGN4,
.SurfaceHorizontalAlignment = HALIGN4,
.TileMode = LINEAR,
@@ -1395,7 +1392,7 @@ VkResult anv_CreateBufferView(
view->range = pCreateInfo->range;
anv_fill_buffer_surface_state(view->surface_state.map,
pCreateInfo->format,
anv_format_for_vk_format(pCreateInfo->format),
view->offset, pCreateInfo->range);
*pView = anv_buffer_view_to_handle(bview);

View File

@@ -1003,7 +1003,7 @@ void anv_color_attachment_view_init(struct anv_color_attachment_view *view,
struct anv_device *device,
const VkAttachmentViewCreateInfo* pCreateInfo,
struct anv_cmd_buffer *cmd_buffer);
void anv_fill_buffer_surface_state(void *state, VkFormat format,
void anv_fill_buffer_surface_state(void *state, const struct anv_format *format,
uint32_t offset, uint32_t range);
void anv_surface_view_fini(struct anv_device *device,