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:
@@ -506,6 +506,9 @@ cmd_buffer_emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
|
|||||||
if (!view)
|
if (!view)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
const struct anv_format *format =
|
||||||
|
anv_format_for_vk_format(view->format);
|
||||||
|
|
||||||
struct anv_state state =
|
struct anv_state state =
|
||||||
anv_cmd_buffer_alloc_surface_state(cmd_buffer, 64, 64);
|
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];
|
d->dynamic_offsets[surface_slots[b].dynamic_slot];
|
||||||
|
|
||||||
offset = view->offset + dynamic_offset;
|
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);
|
view->range - dynamic_offset);
|
||||||
} else {
|
} else {
|
||||||
offset = view->offset;
|
offset = view->offset;
|
||||||
|
@@ -1318,12 +1318,9 @@ VkResult anv_DestroyBuffer(
|
|||||||
// Buffer view functions
|
// Buffer view functions
|
||||||
|
|
||||||
void
|
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)
|
uint32_t offset, uint32_t range)
|
||||||
{
|
{
|
||||||
const struct anv_format *info;
|
|
||||||
|
|
||||||
info = anv_format_for_vk_format(format);
|
|
||||||
/* This assumes RGBA float format. */
|
/* This assumes RGBA float format. */
|
||||||
uint32_t stride = 4;
|
uint32_t stride = 4;
|
||||||
uint32_t num_elements = range / stride;
|
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 = {
|
struct GEN8_RENDER_SURFACE_STATE surface_state = {
|
||||||
.SurfaceType = SURFTYPE_BUFFER,
|
.SurfaceType = SURFTYPE_BUFFER,
|
||||||
.SurfaceArray = false,
|
.SurfaceArray = false,
|
||||||
.SurfaceFormat = info->surface_format,
|
.SurfaceFormat = format->surface_format,
|
||||||
.SurfaceVerticalAlignment = VALIGN4,
|
.SurfaceVerticalAlignment = VALIGN4,
|
||||||
.SurfaceHorizontalAlignment = HALIGN4,
|
.SurfaceHorizontalAlignment = HALIGN4,
|
||||||
.TileMode = LINEAR,
|
.TileMode = LINEAR,
|
||||||
@@ -1395,7 +1392,7 @@ VkResult anv_CreateBufferView(
|
|||||||
view->range = pCreateInfo->range;
|
view->range = pCreateInfo->range;
|
||||||
|
|
||||||
anv_fill_buffer_surface_state(view->surface_state.map,
|
anv_fill_buffer_surface_state(view->surface_state.map,
|
||||||
pCreateInfo->format,
|
anv_format_for_vk_format(pCreateInfo->format),
|
||||||
view->offset, pCreateInfo->range);
|
view->offset, pCreateInfo->range);
|
||||||
|
|
||||||
*pView = anv_buffer_view_to_handle(bview);
|
*pView = anv_buffer_view_to_handle(bview);
|
||||||
|
@@ -1003,7 +1003,7 @@ void anv_color_attachment_view_init(struct anv_color_attachment_view *view,
|
|||||||
struct anv_device *device,
|
struct anv_device *device,
|
||||||
const VkAttachmentViewCreateInfo* pCreateInfo,
|
const VkAttachmentViewCreateInfo* pCreateInfo,
|
||||||
struct anv_cmd_buffer *cmd_buffer);
|
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);
|
uint32_t offset, uint32_t range);
|
||||||
|
|
||||||
void anv_surface_view_fini(struct anv_device *device,
|
void anv_surface_view_fini(struct anv_device *device,
|
||||||
|
Reference in New Issue
Block a user