mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 11:20:11 +01:00
vk: Add anv_format reference t anv_surface_view
Change type of anv_surface_view::format from VkFormat to const struct anv_format*. This reduces the number of lookups in the VkFormat -> anv_format table.
This commit is contained in:
parent
c11094ec9a
commit
60c4ac57f2
5 changed files with 10 additions and 19 deletions
|
|
@ -506,9 +506,6 @@ 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);
|
||||||
|
|
||||||
|
|
@ -521,7 +518,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, format, offset,
|
anv_fill_buffer_surface_state(state.map, view->format, offset,
|
||||||
view->range - dynamic_offset);
|
view->range - dynamic_offset);
|
||||||
} else {
|
} else {
|
||||||
offset = view->offset;
|
offset = view->offset;
|
||||||
|
|
|
||||||
|
|
@ -1388,11 +1388,10 @@ VkResult anv_CreateBufferView(
|
||||||
view->offset = buffer->offset + pCreateInfo->offset;
|
view->offset = buffer->offset + pCreateInfo->offset;
|
||||||
view->surface_state =
|
view->surface_state =
|
||||||
anv_state_pool_alloc(&device->surface_state_pool, 64, 64);
|
anv_state_pool_alloc(&device->surface_state_pool, 64, 64);
|
||||||
view->format = pCreateInfo->format;
|
view->format = anv_format_for_vk_format(pCreateInfo->format);
|
||||||
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, view->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);
|
||||||
|
|
|
||||||
|
|
@ -343,9 +343,6 @@ anv_image_view_init(struct anv_image_view *iview,
|
||||||
struct anv_surface_view *view = &iview->view;
|
struct anv_surface_view *view = &iview->view;
|
||||||
struct anv_surface *surface;
|
struct anv_surface *surface;
|
||||||
|
|
||||||
const struct anv_format *format_info =
|
|
||||||
anv_format_for_vk_format(pCreateInfo->format);
|
|
||||||
|
|
||||||
const struct anv_image_view_info *view_type_info
|
const struct anv_image_view_info *view_type_info
|
||||||
= &anv_image_view_info_table[pCreateInfo->viewType];
|
= &anv_image_view_info_table[pCreateInfo->viewType];
|
||||||
|
|
||||||
|
|
@ -369,7 +366,7 @@ anv_image_view_init(struct anv_image_view *iview,
|
||||||
|
|
||||||
view->bo = image->bo;
|
view->bo = image->bo;
|
||||||
view->offset = image->offset + surface->offset;
|
view->offset = image->offset + surface->offset;
|
||||||
view->format = pCreateInfo->format;
|
view->format = anv_format_for_vk_format(pCreateInfo->format);
|
||||||
|
|
||||||
iview->extent = (VkExtent3D) {
|
iview->extent = (VkExtent3D) {
|
||||||
.width = anv_minify(image->extent.width, range->baseMipLevel),
|
.width = anv_minify(image->extent.width, range->baseMipLevel),
|
||||||
|
|
@ -396,7 +393,7 @@ anv_image_view_init(struct anv_image_view *iview,
|
||||||
struct GEN8_RENDER_SURFACE_STATE surface_state = {
|
struct GEN8_RENDER_SURFACE_STATE surface_state = {
|
||||||
.SurfaceType = view_type_info->surface_type,
|
.SurfaceType = view_type_info->surface_type,
|
||||||
.SurfaceArray = image->array_size > 1,
|
.SurfaceArray = image->array_size > 1,
|
||||||
.SurfaceFormat = format_info->surface_format,
|
.SurfaceFormat = view->format->surface_format,
|
||||||
.SurfaceVerticalAlignment = anv_valign[surface->v_align],
|
.SurfaceVerticalAlignment = anv_valign[surface->v_align],
|
||||||
.SurfaceHorizontalAlignment = anv_halign[surface->h_align],
|
.SurfaceHorizontalAlignment = anv_halign[surface->h_align],
|
||||||
.TileMode = surface->tile_mode,
|
.TileMode = surface->tile_mode,
|
||||||
|
|
@ -572,8 +569,6 @@ anv_color_attachment_view_init(struct anv_color_attachment_view *aview,
|
||||||
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
|
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
|
||||||
struct anv_surface_view *view = &aview->view;
|
struct anv_surface_view *view = &aview->view;
|
||||||
struct anv_surface *surface = &image->primary_surface;
|
struct anv_surface *surface = &image->primary_surface;
|
||||||
const struct anv_format *format_info =
|
|
||||||
anv_format_for_vk_format(pCreateInfo->format);
|
|
||||||
|
|
||||||
aview->base.attachment_type = ANV_ATTACHMENT_VIEW_TYPE_COLOR;
|
aview->base.attachment_type = ANV_ATTACHMENT_VIEW_TYPE_COLOR;
|
||||||
|
|
||||||
|
|
@ -583,7 +578,7 @@ anv_color_attachment_view_init(struct anv_color_attachment_view *aview,
|
||||||
|
|
||||||
view->bo = image->bo;
|
view->bo = image->bo;
|
||||||
view->offset = image->offset + surface->offset;
|
view->offset = image->offset + surface->offset;
|
||||||
view->format = pCreateInfo->format;
|
view->format = anv_format_for_vk_format(pCreateInfo->format);
|
||||||
|
|
||||||
aview->base.extent = (VkExtent3D) {
|
aview->base.extent = (VkExtent3D) {
|
||||||
.width = anv_minify(image->extent.width, pCreateInfo->mipLevel),
|
.width = anv_minify(image->extent.width, pCreateInfo->mipLevel),
|
||||||
|
|
@ -609,7 +604,7 @@ anv_color_attachment_view_init(struct anv_color_attachment_view *aview,
|
||||||
struct GEN8_RENDER_SURFACE_STATE surface_state = {
|
struct GEN8_RENDER_SURFACE_STATE surface_state = {
|
||||||
.SurfaceType = SURFTYPE_2D,
|
.SurfaceType = SURFTYPE_2D,
|
||||||
.SurfaceArray = image->array_size > 1,
|
.SurfaceArray = image->array_size > 1,
|
||||||
.SurfaceFormat = format_info->surface_format,
|
.SurfaceFormat = view->format->surface_format,
|
||||||
.SurfaceVerticalAlignment = anv_valign[surface->v_align],
|
.SurfaceVerticalAlignment = anv_valign[surface->v_align],
|
||||||
.SurfaceHorizontalAlignment = anv_halign[surface->h_align],
|
.SurfaceHorizontalAlignment = anv_halign[surface->h_align],
|
||||||
.TileMode = surface->tile_mode,
|
.TileMode = surface->tile_mode,
|
||||||
|
|
|
||||||
|
|
@ -637,7 +637,7 @@ meta_emit_blit(struct anv_cmd_buffer *cmd_buffer,
|
||||||
.attachmentCount = 1,
|
.attachmentCount = 1,
|
||||||
.pAttachments = &(VkAttachmentDescription) {
|
.pAttachments = &(VkAttachmentDescription) {
|
||||||
.sType = VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION,
|
.sType = VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION,
|
||||||
.format = dest->view.format,
|
.format = dest->view.format->vk_format,
|
||||||
.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
|
.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
|
||||||
.storeOp = VK_ATTACHMENT_STORE_OP_STORE,
|
.storeOp = VK_ATTACHMENT_STORE_OP_STORE,
|
||||||
.initialLayout = VK_IMAGE_LAYOUT_GENERAL,
|
.initialLayout = VK_IMAGE_LAYOUT_GENERAL,
|
||||||
|
|
@ -1289,7 +1289,7 @@ void anv_CmdClearColorImage(
|
||||||
.attachmentCount = 1,
|
.attachmentCount = 1,
|
||||||
.pAttachments = &(VkAttachmentDescription) {
|
.pAttachments = &(VkAttachmentDescription) {
|
||||||
.sType = VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION,
|
.sType = VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION,
|
||||||
.format = view.view.format,
|
.format = view.view.format->vk_format,
|
||||||
.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
|
.loadOp = VK_ATTACHMENT_LOAD_OP_LOAD,
|
||||||
.storeOp = VK_ATTACHMENT_STORE_OP_STORE,
|
.storeOp = VK_ATTACHMENT_STORE_OP_STORE,
|
||||||
.initialLayout = VK_IMAGE_LAYOUT_GENERAL,
|
.initialLayout = VK_IMAGE_LAYOUT_GENERAL,
|
||||||
|
|
|
||||||
|
|
@ -941,7 +941,7 @@ struct anv_surface_view {
|
||||||
struct anv_bo *bo;
|
struct anv_bo *bo;
|
||||||
uint32_t offset; /**< VkBufferCreateInfo::offset */
|
uint32_t offset; /**< VkBufferCreateInfo::offset */
|
||||||
uint32_t range; /**< VkBufferCreateInfo::range */
|
uint32_t range; /**< VkBufferCreateInfo::range */
|
||||||
VkFormat format; /**< VkBufferCreateInfo::format */
|
const struct anv_format *format; /**< VkBufferCreateInfo::format */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct anv_buffer_view {
|
struct anv_buffer_view {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue