vk: Use consistent names for anv_*_view variables
Rename all anv_*_view variables to follow this convention: - sview -> anv_surface_view - bview -> anv_buffer_view - iview -> anv_image_view - aview -> anv_attachment_view - cview -> anv_color_attachment_view - ds_view -> anv_depth_stencil_attachment_view This clarifies existing code. And it will reduce noise in the upcoming commits that merge VkAttachmentView into VkImageView.
This commit is contained in:
parent
ffd051830d
commit
74193a880f
|
@ -432,16 +432,19 @@ anv_cmd_buffer_emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
|
||||||
* put the color attachments into the binding table.
|
* put the color attachments into the binding table.
|
||||||
*/
|
*/
|
||||||
for (uint32_t a = 0; a < attachments; a++) {
|
for (uint32_t a = 0; a < attachments; a++) {
|
||||||
const struct anv_attachment_view *attachment =
|
const struct anv_attachment_view *aview =
|
||||||
fb->attachments[subpass->color_attachments[a]];
|
fb->attachments[subpass->color_attachments[a]];
|
||||||
|
|
||||||
assert(attachment->attachment_type == ANV_ATTACHMENT_VIEW_TYPE_COLOR);
|
assert(aview->attachment_type == ANV_ATTACHMENT_VIEW_TYPE_COLOR);
|
||||||
const struct anv_color_attachment_view *view =
|
|
||||||
(const struct anv_color_attachment_view *)attachment;
|
|
||||||
|
|
||||||
bt_map[a] = view->view.surface_state.offset + state_offset;
|
const struct anv_color_attachment_view *cview =
|
||||||
add_surface_state_reloc(cmd_buffer, view->view.surface_state,
|
(const struct anv_color_attachment_view *) aview;
|
||||||
view->view.bo, view->view.offset);
|
|
||||||
|
const struct anv_surface_view *sview = &cview->surface_view;
|
||||||
|
|
||||||
|
bt_map[a] = sview->surface_state.offset + state_offset;
|
||||||
|
add_surface_state_reloc(cmd_buffer, sview->surface_state,
|
||||||
|
sview->bo, sview->offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layout == NULL)
|
if (layout == NULL)
|
||||||
|
@ -462,11 +465,11 @@ anv_cmd_buffer_emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
|
||||||
if (desc->type != ANV_DESCRIPTOR_TYPE_SURFACE_VIEW)
|
if (desc->type != ANV_DESCRIPTOR_TYPE_SURFACE_VIEW)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
struct anv_surface_view *view = desc->surface_view;
|
const struct anv_surface_view *sview = desc->surface_view;
|
||||||
|
|
||||||
bt_map[start + b] = view->surface_state.offset + state_offset;
|
bt_map[start + b] = sview->surface_state.offset + state_offset;
|
||||||
add_surface_state_reloc(cmd_buffer, view->surface_state,
|
add_surface_state_reloc(cmd_buffer, sview->surface_state,
|
||||||
view->bo, view->offset);
|
sview->bo, sview->offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1396,19 +1396,19 @@ VkResult
|
||||||
anv_buffer_view_create(
|
anv_buffer_view_create(
|
||||||
struct anv_device * device,
|
struct anv_device * device,
|
||||||
const VkBufferViewCreateInfo* pCreateInfo,
|
const VkBufferViewCreateInfo* pCreateInfo,
|
||||||
struct anv_buffer_view ** view_out)
|
struct anv_buffer_view ** bview_out)
|
||||||
{
|
{
|
||||||
ANV_FROM_HANDLE(anv_buffer, buffer, pCreateInfo->buffer);
|
ANV_FROM_HANDLE(anv_buffer, buffer, pCreateInfo->buffer);
|
||||||
struct anv_buffer_view *view;
|
struct anv_buffer_view *bview;
|
||||||
|
|
||||||
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO);
|
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO);
|
||||||
|
|
||||||
view = anv_device_alloc(device, sizeof(*view), 8,
|
bview = anv_device_alloc(device, sizeof(*bview), 8,
|
||||||
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
|
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
|
||||||
if (view == NULL)
|
if (bview == NULL)
|
||||||
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
view->view = (struct anv_surface_view) {
|
bview->surface_view = (struct anv_surface_view) {
|
||||||
.bo = buffer->bo,
|
.bo = buffer->bo,
|
||||||
.offset = buffer->offset + pCreateInfo->offset,
|
.offset = buffer->offset + pCreateInfo->offset,
|
||||||
.surface_state = anv_state_pool_alloc(&device->surface_state_pool, 64, 64),
|
.surface_state = anv_state_pool_alloc(&device->surface_state_pool, 64, 64),
|
||||||
|
@ -1416,7 +1416,7 @@ anv_buffer_view_create(
|
||||||
.range = pCreateInfo->range,
|
.range = pCreateInfo->range,
|
||||||
};
|
};
|
||||||
|
|
||||||
*view_out = view;
|
*bview_out = bview;
|
||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1428,7 +1428,7 @@ VkResult anv_DestroyBufferView(
|
||||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||||
ANV_FROM_HANDLE(anv_buffer_view, bview, _bview);
|
ANV_FROM_HANDLE(anv_buffer_view, bview, _bview);
|
||||||
|
|
||||||
anv_surface_view_fini(device, &bview->view);
|
anv_surface_view_fini(device, &bview->surface_view);
|
||||||
anv_device_free(device, bview);
|
anv_device_free(device, bview);
|
||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
|
@ -1755,7 +1755,7 @@ VkResult anv_UpdateDescriptorSets(
|
||||||
|
|
||||||
set->descriptors[write->destBinding + j] = (struct anv_descriptor) {
|
set->descriptors[write->destBinding + j] = (struct anv_descriptor) {
|
||||||
.type = ANV_DESCRIPTOR_TYPE_SURFACE_VIEW,
|
.type = ANV_DESCRIPTOR_TYPE_SURFACE_VIEW,
|
||||||
.surface_view = &iview->view,
|
.surface_view = &iview->surface_view,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1779,7 +1779,7 @@ VkResult anv_UpdateDescriptorSets(
|
||||||
|
|
||||||
set->descriptors[write->destBinding + j] = (struct anv_descriptor) {
|
set->descriptors[write->destBinding + j] = (struct anv_descriptor) {
|
||||||
.type = ANV_DESCRIPTOR_TYPE_SURFACE_VIEW,
|
.type = ANV_DESCRIPTOR_TYPE_SURFACE_VIEW,
|
||||||
.surface_view = &bview->view,
|
.surface_view = &bview->surface_view,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2001,10 +2001,10 @@ VkResult anv_CreateFramebuffer(
|
||||||
|
|
||||||
framebuffer->attachment_count = pCreateInfo->attachmentCount;
|
framebuffer->attachment_count = pCreateInfo->attachmentCount;
|
||||||
for (uint32_t i = 0; i < pCreateInfo->attachmentCount; i++) {
|
for (uint32_t i = 0; i < pCreateInfo->attachmentCount; i++) {
|
||||||
ANV_FROM_HANDLE(anv_attachment_view, view,
|
ANV_FROM_HANDLE(anv_attachment_view, aview,
|
||||||
pCreateInfo->pAttachments[i].view);
|
pCreateInfo->pAttachments[i].view);
|
||||||
|
|
||||||
framebuffer->attachments[i] = view;
|
framebuffer->attachments[i] = aview;
|
||||||
}
|
}
|
||||||
|
|
||||||
framebuffer->width = pCreateInfo->width;
|
framebuffer->width = pCreateInfo->width;
|
||||||
|
|
|
@ -374,9 +374,9 @@ VkResult anv_GetImageSubresourceLayout(
|
||||||
|
|
||||||
void
|
void
|
||||||
anv_surface_view_fini(struct anv_device *device,
|
anv_surface_view_fini(struct anv_device *device,
|
||||||
struct anv_surface_view *view)
|
struct anv_surface_view *sview)
|
||||||
{
|
{
|
||||||
anv_state_pool_free(&device->surface_state_pool, view->surface_state);
|
anv_state_pool_free(&device->surface_state_pool, sview->surface_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult
|
VkResult
|
||||||
|
@ -505,30 +505,31 @@ anv_DestroyImageView(VkDevice _device, VkImageView _iview)
|
||||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||||
ANV_FROM_HANDLE(anv_image_view, iview, _iview);
|
ANV_FROM_HANDLE(anv_image_view, iview, _iview);
|
||||||
|
|
||||||
anv_surface_view_fini(device, &iview->view);
|
anv_surface_view_fini(device, &iview->surface_view);
|
||||||
anv_device_free(device, iview);
|
anv_device_free(device, iview);
|
||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
anv_depth_stencil_view_init(struct anv_depth_stencil_view *view,
|
anv_depth_stencil_view_init(struct anv_depth_stencil_view *ds_view,
|
||||||
const VkAttachmentViewCreateInfo *pCreateInfo)
|
const VkAttachmentViewCreateInfo *pCreateInfo)
|
||||||
{
|
{
|
||||||
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
|
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
|
||||||
|
|
||||||
view->base.attachment_type = ANV_ATTACHMENT_VIEW_TYPE_DEPTH_STENCIL;
|
ds_view->attachment_view.attachment_type =
|
||||||
|
ANV_ATTACHMENT_VIEW_TYPE_DEPTH_STENCIL;
|
||||||
|
|
||||||
/* XXX: We don't handle any of these */
|
/* XXX: We don't handle any of these */
|
||||||
anv_assert(pCreateInfo->mipLevel == 0);
|
anv_assert(pCreateInfo->mipLevel == 0);
|
||||||
anv_assert(pCreateInfo->baseArraySlice == 0);
|
anv_assert(pCreateInfo->baseArraySlice == 0);
|
||||||
anv_assert(pCreateInfo->arraySize == 1);
|
anv_assert(pCreateInfo->arraySize == 1);
|
||||||
|
|
||||||
view->image = image;
|
ds_view->image = image;
|
||||||
view->format = anv_format_for_vk_format(pCreateInfo->format);
|
ds_view->format = anv_format_for_vk_format(pCreateInfo->format);
|
||||||
|
|
||||||
assert(anv_format_is_depth_or_stencil(image->format));
|
assert(anv_format_is_depth_or_stencil(image->format));
|
||||||
assert(anv_format_is_depth_or_stencil(view->format));
|
assert(anv_format_is_depth_or_stencil(ds_view->format));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct anv_surface *
|
struct anv_surface *
|
||||||
|
@ -578,17 +579,17 @@ anv_image_get_surface_for_color_attachment(struct anv_image *image)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
anv_color_attachment_view_init(struct anv_color_attachment_view *aview,
|
anv_color_attachment_view_init(struct anv_color_attachment_view *cview,
|
||||||
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)
|
||||||
{
|
{
|
||||||
switch (device->info.gen) {
|
switch (device->info.gen) {
|
||||||
case 7:
|
case 7:
|
||||||
gen7_color_attachment_view_init(aview, device, pCreateInfo, cmd_buffer);
|
gen7_color_attachment_view_init(cview, device, pCreateInfo, cmd_buffer);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
gen8_color_attachment_view_init(aview, device, pCreateInfo, cmd_buffer);
|
gen8_color_attachment_view_init(cview, device, pCreateInfo, cmd_buffer);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
unreachable("unsupported gen\n");
|
unreachable("unsupported gen\n");
|
||||||
|
@ -608,44 +609,44 @@ anv_CreateAttachmentView(VkDevice _device,
|
||||||
anv_format_for_vk_format(pCreateInfo->format);
|
anv_format_for_vk_format(pCreateInfo->format);
|
||||||
|
|
||||||
if (anv_format_is_depth_or_stencil(format)) {
|
if (anv_format_is_depth_or_stencil(format)) {
|
||||||
struct anv_depth_stencil_view *view =
|
struct anv_depth_stencil_view *ds_view =
|
||||||
anv_device_alloc(device, sizeof(*view), 8,
|
anv_device_alloc(device, sizeof(*ds_view), 8,
|
||||||
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
|
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
|
||||||
if (view == NULL)
|
if (ds_view == NULL)
|
||||||
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
anv_depth_stencil_view_init(view, pCreateInfo);
|
anv_depth_stencil_view_init(ds_view, pCreateInfo);
|
||||||
|
|
||||||
*pView = anv_attachment_view_to_handle(&view->base);
|
*pView = anv_attachment_view_to_handle(&ds_view->attachment_view);
|
||||||
} else {
|
} else {
|
||||||
struct anv_color_attachment_view *view =
|
struct anv_color_attachment_view *cview =
|
||||||
anv_device_alloc(device, sizeof(*view), 8,
|
anv_device_alloc(device, sizeof(*cview), 8,
|
||||||
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
|
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
|
||||||
if (view == NULL)
|
if (cview == NULL)
|
||||||
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||||
|
|
||||||
anv_color_attachment_view_init(view, device, pCreateInfo, NULL);
|
anv_color_attachment_view_init(cview, device, pCreateInfo, NULL);
|
||||||
|
|
||||||
*pView = anv_attachment_view_to_handle(&view->base);
|
*pView = anv_attachment_view_to_handle(&cview->attachment_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult
|
VkResult
|
||||||
anv_DestroyAttachmentView(VkDevice _device, VkAttachmentView _view)
|
anv_DestroyAttachmentView(VkDevice _device, VkAttachmentView _aview)
|
||||||
{
|
{
|
||||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||||
ANV_FROM_HANDLE(anv_attachment_view, view, _view);
|
ANV_FROM_HANDLE(anv_attachment_view, aview, _aview);
|
||||||
|
|
||||||
if (view->attachment_type == ANV_ATTACHMENT_VIEW_TYPE_COLOR) {
|
if (aview->attachment_type == ANV_ATTACHMENT_VIEW_TYPE_COLOR) {
|
||||||
struct anv_color_attachment_view *aview =
|
struct anv_color_attachment_view *cview =
|
||||||
(struct anv_color_attachment_view *)view;
|
(struct anv_color_attachment_view *) aview;
|
||||||
|
|
||||||
anv_surface_view_fini(device, &aview->view);
|
anv_surface_view_fini(device, &cview->surface_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
anv_device_free(device, view);
|
anv_device_free(device, aview);
|
||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -729,15 +729,17 @@ struct blit_region {
|
||||||
static void
|
static void
|
||||||
meta_emit_blit(struct anv_cmd_buffer *cmd_buffer,
|
meta_emit_blit(struct anv_cmd_buffer *cmd_buffer,
|
||||||
struct anv_image *src_image,
|
struct anv_image *src_image,
|
||||||
struct anv_image_view *src_view,
|
struct anv_image_view *src_iview,
|
||||||
VkOffset3D src_offset,
|
VkOffset3D src_offset,
|
||||||
VkExtent3D src_extent,
|
VkExtent3D src_extent,
|
||||||
struct anv_image *dest_image,
|
struct anv_image *dest_image,
|
||||||
struct anv_color_attachment_view *dest_view,
|
struct anv_color_attachment_view *dest_cview,
|
||||||
VkOffset3D dest_offset,
|
VkOffset3D dest_offset,
|
||||||
VkExtent3D dest_extent)
|
VkExtent3D dest_extent)
|
||||||
{
|
{
|
||||||
struct anv_device *device = cmd_buffer->device;
|
struct anv_device *device = cmd_buffer->device;
|
||||||
|
struct anv_attachment_view *dest_aview = &dest_cview->attachment_view;
|
||||||
|
struct anv_surface_view *dest_sview = &dest_cview->surface_view;
|
||||||
VkDescriptorPool dummy_desc_pool = { .handle = 1 };
|
VkDescriptorPool dummy_desc_pool = { .handle = 1 };
|
||||||
|
|
||||||
struct blit_vb_data {
|
struct blit_vb_data {
|
||||||
|
@ -758,9 +760,9 @@ meta_emit_blit(struct anv_cmd_buffer *cmd_buffer,
|
||||||
dest_offset.y + dest_extent.height,
|
dest_offset.y + dest_extent.height,
|
||||||
},
|
},
|
||||||
.tex_coord = {
|
.tex_coord = {
|
||||||
(float)(src_offset.x + src_extent.width) / (float)src_view->extent.width,
|
(float)(src_offset.x + src_extent.width) / (float)src_iview->extent.width,
|
||||||
(float)(src_offset.y + src_extent.height) / (float)src_view->extent.height,
|
(float)(src_offset.y + src_extent.height) / (float)src_iview->extent.height,
|
||||||
(float)(src_offset.z + src_extent.depth) / (float)src_view->extent.depth,
|
(float)(src_offset.z + src_extent.depth) / (float)src_iview->extent.depth,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -770,9 +772,9 @@ meta_emit_blit(struct anv_cmd_buffer *cmd_buffer,
|
||||||
dest_offset.y + dest_extent.height,
|
dest_offset.y + dest_extent.height,
|
||||||
},
|
},
|
||||||
.tex_coord = {
|
.tex_coord = {
|
||||||
(float)src_offset.x / (float)src_view->extent.width,
|
(float)src_offset.x / (float)src_iview->extent.width,
|
||||||
(float)(src_offset.y + src_extent.height) / (float)src_view->extent.height,
|
(float)(src_offset.y + src_extent.height) / (float)src_iview->extent.height,
|
||||||
(float)(src_offset.z + src_extent.depth) / (float)src_view->extent.depth,
|
(float)(src_offset.z + src_extent.depth) / (float)src_iview->extent.depth,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -782,9 +784,9 @@ meta_emit_blit(struct anv_cmd_buffer *cmd_buffer,
|
||||||
dest_offset.y,
|
dest_offset.y,
|
||||||
},
|
},
|
||||||
.tex_coord = {
|
.tex_coord = {
|
||||||
(float)src_offset.x / (float)src_view->extent.width,
|
(float)src_offset.x / (float)src_iview->extent.width,
|
||||||
(float)src_offset.y / (float)src_view->extent.height,
|
(float)src_offset.y / (float)src_iview->extent.height,
|
||||||
(float)src_offset.z / (float)src_view->extent.depth,
|
(float)src_offset.z / (float)src_iview->extent.depth,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -822,7 +824,7 @@ meta_emit_blit(struct anv_cmd_buffer *cmd_buffer,
|
||||||
.descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
|
.descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
|
||||||
.pDescriptors = (VkDescriptorInfo[]) {
|
.pDescriptors = (VkDescriptorInfo[]) {
|
||||||
{
|
{
|
||||||
.imageView = anv_image_view_to_handle(src_view),
|
.imageView = anv_image_view_to_handle(src_iview),
|
||||||
.imageLayout = VK_IMAGE_LAYOUT_GENERAL
|
.imageLayout = VK_IMAGE_LAYOUT_GENERAL
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -836,12 +838,12 @@ meta_emit_blit(struct anv_cmd_buffer *cmd_buffer,
|
||||||
.attachmentCount = 1,
|
.attachmentCount = 1,
|
||||||
.pAttachments = (VkAttachmentBindInfo[]) {
|
.pAttachments = (VkAttachmentBindInfo[]) {
|
||||||
{
|
{
|
||||||
.view = anv_attachment_view_to_handle(&dest_view->base),
|
.view = anv_attachment_view_to_handle(dest_aview),
|
||||||
.layout = VK_IMAGE_LAYOUT_GENERAL
|
.layout = VK_IMAGE_LAYOUT_GENERAL
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
.width = dest_view->base.extent.width,
|
.width = dest_aview->extent.width,
|
||||||
.height = dest_view->base.extent.height,
|
.height = dest_aview->extent.height,
|
||||||
.layers = 1
|
.layers = 1
|
||||||
}, &fb);
|
}, &fb);
|
||||||
|
|
||||||
|
@ -852,7 +854,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->view.format->vk_format,
|
.format = dest_sview->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,
|
||||||
|
@ -998,8 +1000,8 @@ do_buffer_copy(struct anv_cmd_buffer *cmd_buffer,
|
||||||
anv_image_from_handle(dest_image)->bo = dest;
|
anv_image_from_handle(dest_image)->bo = dest;
|
||||||
anv_image_from_handle(dest_image)->offset = dest_offset;
|
anv_image_from_handle(dest_image)->offset = dest_offset;
|
||||||
|
|
||||||
struct anv_image_view src_view;
|
struct anv_image_view src_iview;
|
||||||
anv_image_view_init(&src_view, cmd_buffer->device,
|
anv_image_view_init(&src_iview, cmd_buffer->device,
|
||||||
&(VkImageViewCreateInfo) {
|
&(VkImageViewCreateInfo) {
|
||||||
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
||||||
.image = src_image,
|
.image = src_image,
|
||||||
|
@ -1021,8 +1023,8 @@ do_buffer_copy(struct anv_cmd_buffer *cmd_buffer,
|
||||||
},
|
},
|
||||||
cmd_buffer);
|
cmd_buffer);
|
||||||
|
|
||||||
struct anv_color_attachment_view dest_view;
|
struct anv_color_attachment_view dest_cview;
|
||||||
anv_color_attachment_view_init(&dest_view, cmd_buffer->device,
|
anv_color_attachment_view_init(&dest_cview, cmd_buffer->device,
|
||||||
&(VkAttachmentViewCreateInfo) {
|
&(VkAttachmentViewCreateInfo) {
|
||||||
.sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
|
||||||
.image = dest_image,
|
.image = dest_image,
|
||||||
|
@ -1035,11 +1037,11 @@ do_buffer_copy(struct anv_cmd_buffer *cmd_buffer,
|
||||||
|
|
||||||
meta_emit_blit(cmd_buffer,
|
meta_emit_blit(cmd_buffer,
|
||||||
anv_image_from_handle(src_image),
|
anv_image_from_handle(src_image),
|
||||||
&src_view,
|
&src_iview,
|
||||||
(VkOffset3D) { 0, 0, 0 },
|
(VkOffset3D) { 0, 0, 0 },
|
||||||
(VkExtent3D) { width, height, 1 },
|
(VkExtent3D) { width, height, 1 },
|
||||||
anv_image_from_handle(dest_image),
|
anv_image_from_handle(dest_image),
|
||||||
&dest_view,
|
&dest_cview,
|
||||||
(VkOffset3D) { 0, 0, 0 },
|
(VkOffset3D) { 0, 0, 0 },
|
||||||
(VkExtent3D) { width, height, 1 });
|
(VkExtent3D) { width, height, 1 });
|
||||||
|
|
||||||
|
@ -1138,7 +1140,7 @@ void anv_CmdCopyImage(
|
||||||
ANV_FROM_HANDLE(anv_image, src_image, srcImage);
|
ANV_FROM_HANDLE(anv_image, src_image, srcImage);
|
||||||
ANV_FROM_HANDLE(anv_image, dest_image, destImage);
|
ANV_FROM_HANDLE(anv_image, dest_image, destImage);
|
||||||
|
|
||||||
const VkImageViewType src_view_type =
|
const VkImageViewType src_iview_type =
|
||||||
meta_blit_get_src_image_view_type(src_image);
|
meta_blit_get_src_image_view_type(src_image);
|
||||||
|
|
||||||
struct anv_saved_state saved_state;
|
struct anv_saved_state saved_state;
|
||||||
|
@ -1146,12 +1148,12 @@ void anv_CmdCopyImage(
|
||||||
meta_prepare_blit(cmd_buffer, &saved_state);
|
meta_prepare_blit(cmd_buffer, &saved_state);
|
||||||
|
|
||||||
for (unsigned r = 0; r < regionCount; r++) {
|
for (unsigned r = 0; r < regionCount; r++) {
|
||||||
struct anv_image_view src_view;
|
struct anv_image_view src_iview;
|
||||||
anv_image_view_init(&src_view, cmd_buffer->device,
|
anv_image_view_init(&src_iview, cmd_buffer->device,
|
||||||
&(VkImageViewCreateInfo) {
|
&(VkImageViewCreateInfo) {
|
||||||
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
||||||
.image = srcImage,
|
.image = srcImage,
|
||||||
.viewType = src_view_type,
|
.viewType = src_iview_type,
|
||||||
.format = src_image->format->vk_format,
|
.format = src_image->format->vk_format,
|
||||||
.channels = {
|
.channels = {
|
||||||
VK_CHANNEL_SWIZZLE_R,
|
VK_CHANNEL_SWIZZLE_R,
|
||||||
|
@ -1183,8 +1185,8 @@ void anv_CmdCopyImage(
|
||||||
if (pRegions[r].extent.depth > 1)
|
if (pRegions[r].extent.depth > 1)
|
||||||
anv_finishme("FINISHME: copy multiple depth layers");
|
anv_finishme("FINISHME: copy multiple depth layers");
|
||||||
|
|
||||||
struct anv_color_attachment_view dest_view;
|
struct anv_color_attachment_view dest_cview;
|
||||||
anv_color_attachment_view_init(&dest_view, cmd_buffer->device,
|
anv_color_attachment_view_init(&dest_cview, cmd_buffer->device,
|
||||||
&(VkAttachmentViewCreateInfo) {
|
&(VkAttachmentViewCreateInfo) {
|
||||||
.sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
|
||||||
.image = destImage,
|
.image = destImage,
|
||||||
|
@ -1196,10 +1198,10 @@ void anv_CmdCopyImage(
|
||||||
cmd_buffer);
|
cmd_buffer);
|
||||||
|
|
||||||
meta_emit_blit(cmd_buffer,
|
meta_emit_blit(cmd_buffer,
|
||||||
src_image, &src_view,
|
src_image, &src_iview,
|
||||||
pRegions[r].srcOffset,
|
pRegions[r].srcOffset,
|
||||||
pRegions[r].extent,
|
pRegions[r].extent,
|
||||||
dest_image, &dest_view,
|
dest_image, &dest_cview,
|
||||||
dest_offset,
|
dest_offset,
|
||||||
pRegions[r].extent);
|
pRegions[r].extent);
|
||||||
}
|
}
|
||||||
|
@ -1222,7 +1224,7 @@ void anv_CmdBlitImage(
|
||||||
ANV_FROM_HANDLE(anv_image, src_image, srcImage);
|
ANV_FROM_HANDLE(anv_image, src_image, srcImage);
|
||||||
ANV_FROM_HANDLE(anv_image, dest_image, destImage);
|
ANV_FROM_HANDLE(anv_image, dest_image, destImage);
|
||||||
|
|
||||||
const VkImageViewType src_view_type =
|
const VkImageViewType src_iview_type =
|
||||||
meta_blit_get_src_image_view_type(src_image);
|
meta_blit_get_src_image_view_type(src_image);
|
||||||
|
|
||||||
struct anv_saved_state saved_state;
|
struct anv_saved_state saved_state;
|
||||||
|
@ -1232,12 +1234,12 @@ void anv_CmdBlitImage(
|
||||||
meta_prepare_blit(cmd_buffer, &saved_state);
|
meta_prepare_blit(cmd_buffer, &saved_state);
|
||||||
|
|
||||||
for (unsigned r = 0; r < regionCount; r++) {
|
for (unsigned r = 0; r < regionCount; r++) {
|
||||||
struct anv_image_view src_view;
|
struct anv_image_view src_iview;
|
||||||
anv_image_view_init(&src_view, cmd_buffer->device,
|
anv_image_view_init(&src_iview, cmd_buffer->device,
|
||||||
&(VkImageViewCreateInfo) {
|
&(VkImageViewCreateInfo) {
|
||||||
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
||||||
.image = srcImage,
|
.image = srcImage,
|
||||||
.viewType = src_view_type,
|
.viewType = src_iview_type,
|
||||||
.format = src_image->format->vk_format,
|
.format = src_image->format->vk_format,
|
||||||
.channels = {
|
.channels = {
|
||||||
VK_CHANNEL_SWIZZLE_R,
|
VK_CHANNEL_SWIZZLE_R,
|
||||||
|
@ -1269,8 +1271,8 @@ void anv_CmdBlitImage(
|
||||||
if (pRegions[r].destExtent.depth > 1)
|
if (pRegions[r].destExtent.depth > 1)
|
||||||
anv_finishme("FINISHME: copy multiple depth layers");
|
anv_finishme("FINISHME: copy multiple depth layers");
|
||||||
|
|
||||||
struct anv_color_attachment_view dest_view;
|
struct anv_color_attachment_view dest_cview;
|
||||||
anv_color_attachment_view_init(&dest_view, cmd_buffer->device,
|
anv_color_attachment_view_init(&dest_cview, cmd_buffer->device,
|
||||||
&(VkAttachmentViewCreateInfo) {
|
&(VkAttachmentViewCreateInfo) {
|
||||||
.sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
|
||||||
.image = destImage,
|
.image = destImage,
|
||||||
|
@ -1282,10 +1284,10 @@ void anv_CmdBlitImage(
|
||||||
cmd_buffer);
|
cmd_buffer);
|
||||||
|
|
||||||
meta_emit_blit(cmd_buffer,
|
meta_emit_blit(cmd_buffer,
|
||||||
src_image, &src_view,
|
src_image, &src_iview,
|
||||||
pRegions[r].srcOffset,
|
pRegions[r].srcOffset,
|
||||||
pRegions[r].srcExtent,
|
pRegions[r].srcExtent,
|
||||||
dest_image, &dest_view,
|
dest_image, &dest_cview,
|
||||||
dest_offset,
|
dest_offset,
|
||||||
pRegions[r].destExtent);
|
pRegions[r].destExtent);
|
||||||
}
|
}
|
||||||
|
@ -1362,8 +1364,8 @@ void anv_CmdCopyBufferToImage(
|
||||||
proxy_format,
|
proxy_format,
|
||||||
&pRegions[r]);
|
&pRegions[r]);
|
||||||
|
|
||||||
struct anv_image_view src_view;
|
struct anv_image_view src_iview;
|
||||||
anv_image_view_init(&src_view, cmd_buffer->device,
|
anv_image_view_init(&src_iview, cmd_buffer->device,
|
||||||
&(VkImageViewCreateInfo) {
|
&(VkImageViewCreateInfo) {
|
||||||
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
||||||
.image = srcImage,
|
.image = srcImage,
|
||||||
|
@ -1399,8 +1401,8 @@ void anv_CmdCopyBufferToImage(
|
||||||
if (pRegions[r].imageExtent.depth > 1)
|
if (pRegions[r].imageExtent.depth > 1)
|
||||||
anv_finishme("FINISHME: copy multiple depth layers");
|
anv_finishme("FINISHME: copy multiple depth layers");
|
||||||
|
|
||||||
struct anv_color_attachment_view dest_view;
|
struct anv_color_attachment_view dest_cview;
|
||||||
anv_color_attachment_view_init(&dest_view, cmd_buffer->device,
|
anv_color_attachment_view_init(&dest_cview, cmd_buffer->device,
|
||||||
&(VkAttachmentViewCreateInfo) {
|
&(VkAttachmentViewCreateInfo) {
|
||||||
.sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
|
||||||
.image = anv_image_to_handle(dest_image),
|
.image = anv_image_to_handle(dest_image),
|
||||||
|
@ -1413,11 +1415,11 @@ void anv_CmdCopyBufferToImage(
|
||||||
|
|
||||||
meta_emit_blit(cmd_buffer,
|
meta_emit_blit(cmd_buffer,
|
||||||
anv_image_from_handle(srcImage),
|
anv_image_from_handle(srcImage),
|
||||||
&src_view,
|
&src_iview,
|
||||||
(VkOffset3D) { 0, 0, 0 },
|
(VkOffset3D) { 0, 0, 0 },
|
||||||
pRegions[r].imageExtent,
|
pRegions[r].imageExtent,
|
||||||
dest_image,
|
dest_image,
|
||||||
&dest_view,
|
&dest_cview,
|
||||||
dest_offset,
|
dest_offset,
|
||||||
pRegions[r].imageExtent);
|
pRegions[r].imageExtent);
|
||||||
|
|
||||||
|
@ -1440,7 +1442,7 @@ void anv_CmdCopyImageToBuffer(
|
||||||
VkDevice vk_device = anv_device_to_handle(cmd_buffer->device);
|
VkDevice vk_device = anv_device_to_handle(cmd_buffer->device);
|
||||||
struct anv_saved_state saved_state;
|
struct anv_saved_state saved_state;
|
||||||
|
|
||||||
const VkImageViewType src_view_type =
|
const VkImageViewType src_iview_type =
|
||||||
meta_blit_get_src_image_view_type(src_image);
|
meta_blit_get_src_image_view_type(src_image);
|
||||||
|
|
||||||
meta_prepare_blit(cmd_buffer, &saved_state);
|
meta_prepare_blit(cmd_buffer, &saved_state);
|
||||||
|
@ -1449,12 +1451,12 @@ void anv_CmdCopyImageToBuffer(
|
||||||
if (pRegions[r].imageExtent.depth > 1)
|
if (pRegions[r].imageExtent.depth > 1)
|
||||||
anv_finishme("FINISHME: copy multiple depth layers");
|
anv_finishme("FINISHME: copy multiple depth layers");
|
||||||
|
|
||||||
struct anv_image_view src_view;
|
struct anv_image_view src_iview;
|
||||||
anv_image_view_init(&src_view, cmd_buffer->device,
|
anv_image_view_init(&src_iview, cmd_buffer->device,
|
||||||
&(VkImageViewCreateInfo) {
|
&(VkImageViewCreateInfo) {
|
||||||
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
|
||||||
.image = srcImage,
|
.image = srcImage,
|
||||||
.viewType = src_view_type,
|
.viewType = src_iview_type,
|
||||||
.format = src_image->format->vk_format,
|
.format = src_image->format->vk_format,
|
||||||
.channels = {
|
.channels = {
|
||||||
VK_CHANNEL_SWIZZLE_R,
|
VK_CHANNEL_SWIZZLE_R,
|
||||||
|
@ -1481,8 +1483,8 @@ void anv_CmdCopyImageToBuffer(
|
||||||
dest_format,
|
dest_format,
|
||||||
&pRegions[r]);
|
&pRegions[r]);
|
||||||
|
|
||||||
struct anv_color_attachment_view dest_view;
|
struct anv_color_attachment_view dest_cview;
|
||||||
anv_color_attachment_view_init(&dest_view, cmd_buffer->device,
|
anv_color_attachment_view_init(&dest_cview, cmd_buffer->device,
|
||||||
&(VkAttachmentViewCreateInfo) {
|
&(VkAttachmentViewCreateInfo) {
|
||||||
.sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
|
||||||
.image = destImage,
|
.image = destImage,
|
||||||
|
@ -1495,11 +1497,11 @@ void anv_CmdCopyImageToBuffer(
|
||||||
|
|
||||||
meta_emit_blit(cmd_buffer,
|
meta_emit_blit(cmd_buffer,
|
||||||
anv_image_from_handle(srcImage),
|
anv_image_from_handle(srcImage),
|
||||||
&src_view,
|
&src_iview,
|
||||||
pRegions[r].imageOffset,
|
pRegions[r].imageOffset,
|
||||||
pRegions[r].imageExtent,
|
pRegions[r].imageExtent,
|
||||||
anv_image_from_handle(destImage),
|
anv_image_from_handle(destImage),
|
||||||
&dest_view,
|
&dest_cview,
|
||||||
(VkOffset3D) { 0, 0, 0 },
|
(VkOffset3D) { 0, 0, 0 },
|
||||||
pRegions[r].imageExtent);
|
pRegions[r].imageExtent);
|
||||||
|
|
||||||
|
@ -1546,8 +1548,8 @@ void anv_CmdClearColorImage(
|
||||||
for (uint32_t r = 0; r < rangeCount; r++) {
|
for (uint32_t r = 0; r < rangeCount; r++) {
|
||||||
for (uint32_t l = 0; l < pRanges[r].mipLevels; l++) {
|
for (uint32_t l = 0; l < pRanges[r].mipLevels; l++) {
|
||||||
for (uint32_t s = 0; s < pRanges[r].arraySize; s++) {
|
for (uint32_t s = 0; s < pRanges[r].arraySize; s++) {
|
||||||
struct anv_color_attachment_view view;
|
struct anv_color_attachment_view cview;
|
||||||
anv_color_attachment_view_init(&view, cmd_buffer->device,
|
anv_color_attachment_view_init(&cview, cmd_buffer->device,
|
||||||
&(VkAttachmentViewCreateInfo) {
|
&(VkAttachmentViewCreateInfo) {
|
||||||
.sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
|
.sType = VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,
|
||||||
.image = _image,
|
.image = _image,
|
||||||
|
@ -1558,6 +1560,9 @@ void anv_CmdClearColorImage(
|
||||||
},
|
},
|
||||||
cmd_buffer);
|
cmd_buffer);
|
||||||
|
|
||||||
|
struct anv_attachment_view *aview = &cview.attachment_view;
|
||||||
|
struct anv_surface_view *sview = &cview.surface_view;
|
||||||
|
|
||||||
VkFramebuffer fb;
|
VkFramebuffer fb;
|
||||||
anv_CreateFramebuffer(anv_device_to_handle(cmd_buffer->device),
|
anv_CreateFramebuffer(anv_device_to_handle(cmd_buffer->device),
|
||||||
&(VkFramebufferCreateInfo) {
|
&(VkFramebufferCreateInfo) {
|
||||||
|
@ -1565,12 +1570,12 @@ void anv_CmdClearColorImage(
|
||||||
.attachmentCount = 1,
|
.attachmentCount = 1,
|
||||||
.pAttachments = (VkAttachmentBindInfo[]) {
|
.pAttachments = (VkAttachmentBindInfo[]) {
|
||||||
{
|
{
|
||||||
.view = anv_attachment_view_to_handle(&view.base),
|
.view = anv_attachment_view_to_handle(aview),
|
||||||
.layout = VK_IMAGE_LAYOUT_GENERAL
|
.layout = VK_IMAGE_LAYOUT_GENERAL
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
.width = view.base.extent.width,
|
.width = aview->extent.width,
|
||||||
.height = view.base.extent.height,
|
.height = aview->extent.height,
|
||||||
.layers = 1
|
.layers = 1
|
||||||
}, &fb);
|
}, &fb);
|
||||||
|
|
||||||
|
@ -1581,7 +1586,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->vk_format,
|
.format = sview->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,
|
||||||
|
@ -1617,8 +1622,8 @@ void anv_CmdClearColorImage(
|
||||||
.renderArea = {
|
.renderArea = {
|
||||||
.offset = { 0, 0, },
|
.offset = { 0, 0, },
|
||||||
.extent = {
|
.extent = {
|
||||||
.width = view.base.extent.width,
|
.width = aview->extent.width,
|
||||||
.height = view.base.extent.height,
|
.height = aview->extent.height,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
.renderPass = pass,
|
.renderPass = pass,
|
||||||
|
|
|
@ -1242,11 +1242,11 @@ struct anv_surface_view {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct anv_buffer_view {
|
struct anv_buffer_view {
|
||||||
struct anv_surface_view view;
|
struct anv_surface_view surface_view;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct anv_image_view {
|
struct anv_image_view {
|
||||||
struct anv_surface_view view;
|
struct anv_surface_view surface_view;
|
||||||
VkExtent3D extent;
|
VkExtent3D extent;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1261,12 +1261,12 @@ struct anv_attachment_view {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct anv_color_attachment_view {
|
struct anv_color_attachment_view {
|
||||||
struct anv_attachment_view base;
|
struct anv_attachment_view attachment_view;
|
||||||
struct anv_surface_view view;
|
struct anv_surface_view surface_view;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct anv_depth_stencil_view {
|
struct anv_depth_stencil_view {
|
||||||
struct anv_attachment_view base;
|
struct anv_attachment_view attachment_view;
|
||||||
const struct anv_image *image; /**< VkAttachmentViewCreateInfo::image */
|
const struct anv_image *image; /**< VkAttachmentViewCreateInfo::image */
|
||||||
const struct anv_format *format; /**< VkAttachmentViewCreateInfo::format */
|
const struct anv_format *format; /**< VkAttachmentViewCreateInfo::format */
|
||||||
};
|
};
|
||||||
|
@ -1306,24 +1306,24 @@ gen8_image_view_init(struct anv_image_view *iview,
|
||||||
const VkImageViewCreateInfo* pCreateInfo,
|
const VkImageViewCreateInfo* pCreateInfo,
|
||||||
struct anv_cmd_buffer *cmd_buffer);
|
struct anv_cmd_buffer *cmd_buffer);
|
||||||
|
|
||||||
void anv_color_attachment_view_init(struct anv_color_attachment_view *view,
|
void anv_color_attachment_view_init(struct anv_color_attachment_view *cview,
|
||||||
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 gen7_color_attachment_view_init(struct anv_color_attachment_view *aview,
|
void gen7_color_attachment_view_init(struct anv_color_attachment_view *cview,
|
||||||
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 gen8_color_attachment_view_init(struct anv_color_attachment_view *aview,
|
void gen8_color_attachment_view_init(struct anv_color_attachment_view *cview,
|
||||||
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);
|
||||||
|
|
||||||
VkResult anv_buffer_view_create(struct anv_device *device,
|
VkResult anv_buffer_view_create(struct anv_device *device,
|
||||||
const VkBufferViewCreateInfo *pCreateInfo,
|
const VkBufferViewCreateInfo *pCreateInfo,
|
||||||
struct anv_buffer_view **view_out);
|
struct anv_buffer_view **bview_out);
|
||||||
|
|
||||||
void anv_fill_buffer_surface_state(struct anv_device *device, void *state,
|
void anv_fill_buffer_surface_state(struct anv_device *device, void *state,
|
||||||
const struct anv_format *format,
|
const struct anv_format *format,
|
||||||
|
@ -1335,7 +1335,7 @@ void gen8_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,
|
||||||
struct anv_surface_view *view);
|
struct anv_surface_view *sview);
|
||||||
|
|
||||||
struct anv_sampler {
|
struct anv_sampler {
|
||||||
uint32_t state[4];
|
uint32_t state[4];
|
||||||
|
|
|
@ -529,20 +529,20 @@ static void
|
||||||
gen7_cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
|
gen7_cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
|
||||||
{
|
{
|
||||||
const struct anv_framebuffer *fb = cmd_buffer->state.framebuffer;
|
const struct anv_framebuffer *fb = cmd_buffer->state.framebuffer;
|
||||||
const struct anv_depth_stencil_view *view =
|
const struct anv_depth_stencil_view *ds_view =
|
||||||
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
||||||
const struct anv_image *image = view ? view->image : NULL;
|
const struct anv_image *image = ds_view ? ds_view->image : NULL;
|
||||||
const bool has_depth = view && view->format->depth_format;
|
const bool has_depth = ds_view && ds_view->format->depth_format;
|
||||||
const bool has_stencil = view && view->format->has_stencil;
|
const bool has_stencil = ds_view && ds_view->format->has_stencil;
|
||||||
|
|
||||||
/* Emit 3DSTATE_DEPTH_BUFFER */
|
/* Emit 3DSTATE_DEPTH_BUFFER */
|
||||||
if (has_depth) {
|
if (has_depth) {
|
||||||
anv_batch_emit(&cmd_buffer->batch, GEN7_3DSTATE_DEPTH_BUFFER,
|
anv_batch_emit(&cmd_buffer->batch, GEN7_3DSTATE_DEPTH_BUFFER,
|
||||||
.SurfaceType = SURFTYPE_2D,
|
.SurfaceType = SURFTYPE_2D,
|
||||||
.DepthWriteEnable = view->format->depth_format,
|
.DepthWriteEnable = ds_view->format->depth_format,
|
||||||
.StencilWriteEnable = has_stencil,
|
.StencilWriteEnable = has_stencil,
|
||||||
.HierarchicalDepthBufferEnable = false,
|
.HierarchicalDepthBufferEnable = false,
|
||||||
.SurfaceFormat = view->format->depth_format,
|
.SurfaceFormat = ds_view->format->depth_format,
|
||||||
.SurfacePitch = image->depth_surface.stride - 1,
|
.SurfacePitch = image->depth_surface.stride - 1,
|
||||||
.SurfaceBaseAddress = {
|
.SurfaceBaseAddress = {
|
||||||
.bo = image->bo,
|
.bo = image->bo,
|
||||||
|
|
|
@ -65,20 +65,21 @@ VkResult gen7_CreateBufferView(
|
||||||
VkBufferView* pView)
|
VkBufferView* pView)
|
||||||
{
|
{
|
||||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||||
struct anv_buffer_view *view;
|
struct anv_buffer_view *bview;
|
||||||
VkResult result;
|
VkResult result;
|
||||||
|
|
||||||
result = anv_buffer_view_create(device, pCreateInfo, &view);
|
result = anv_buffer_view_create(device, pCreateInfo, &bview);
|
||||||
if (result != VK_SUCCESS)
|
if (result != VK_SUCCESS)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
const struct anv_format *format =
|
const struct anv_format *format =
|
||||||
anv_format_for_vk_format(pCreateInfo->format);
|
anv_format_for_vk_format(pCreateInfo->format);
|
||||||
|
|
||||||
gen7_fill_buffer_surface_state(view->view.surface_state.map, format,
|
gen7_fill_buffer_surface_state(bview->surface_view.surface_state.map,
|
||||||
view->view.offset, pCreateInfo->range);
|
format, bview->surface_view.offset,
|
||||||
|
pCreateInfo->range);
|
||||||
|
|
||||||
*pView = anv_buffer_view_to_handle(view);
|
*pView = anv_buffer_view_to_handle(bview);
|
||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +273,7 @@ gen7_image_view_init(struct anv_image_view *iview,
|
||||||
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
|
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
|
||||||
|
|
||||||
const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange;
|
const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange;
|
||||||
struct anv_surface_view *view = &iview->view;
|
struct anv_surface_view *sview = &iview->surface_view;
|
||||||
struct anv_surface *surface =
|
struct anv_surface *surface =
|
||||||
anv_image_get_surface_for_aspect_mask(image, range->aspectMask);
|
anv_image_get_surface_for_aspect_mask(image, range->aspectMask);
|
||||||
|
|
||||||
|
@ -285,9 +286,9 @@ gen7_image_view_init(struct anv_image_view *iview,
|
||||||
if (pCreateInfo->viewType != VK_IMAGE_VIEW_TYPE_2D)
|
if (pCreateInfo->viewType != VK_IMAGE_VIEW_TYPE_2D)
|
||||||
anv_finishme("non-2D image views");
|
anv_finishme("non-2D image views");
|
||||||
|
|
||||||
view->bo = image->bo;
|
sview->bo = image->bo;
|
||||||
view->offset = image->offset + surface->offset;
|
sview->offset = image->offset + surface->offset;
|
||||||
view->format = anv_format_for_vk_format(pCreateInfo->format);
|
sview->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),
|
||||||
|
@ -345,42 +346,44 @@ gen7_image_view_init(struct anv_image_view *iview,
|
||||||
.BlueClearColor = 0,
|
.BlueClearColor = 0,
|
||||||
.AlphaClearColor = 0,
|
.AlphaClearColor = 0,
|
||||||
.ResourceMinLOD = 0.0,
|
.ResourceMinLOD = 0.0,
|
||||||
.SurfaceBaseAddress = { NULL, view->offset },
|
.SurfaceBaseAddress = { NULL, sview->offset },
|
||||||
};
|
};
|
||||||
|
|
||||||
if (cmd_buffer) {
|
if (cmd_buffer) {
|
||||||
view->surface_state =
|
sview->surface_state =
|
||||||
anv_state_stream_alloc(&cmd_buffer->surface_state_stream, 64, 64);
|
anv_state_stream_alloc(&cmd_buffer->surface_state_stream, 64, 64);
|
||||||
} else {
|
} else {
|
||||||
view->surface_state =
|
sview->surface_state =
|
||||||
anv_state_pool_alloc(&device->surface_state_pool, 64, 64);
|
anv_state_pool_alloc(&device->surface_state_pool, 64, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
GEN7_RENDER_SURFACE_STATE_pack(NULL, view->surface_state.map, &surface_state);
|
GEN7_RENDER_SURFACE_STATE_pack(NULL, sview->surface_state.map,
|
||||||
|
&surface_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gen7_color_attachment_view_init(struct anv_color_attachment_view *aview,
|
gen7_color_attachment_view_init(struct anv_color_attachment_view *cview,
|
||||||
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)
|
||||||
{
|
{
|
||||||
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_attachment_view *aview = &cview->attachment_view;
|
||||||
|
struct anv_surface_view *sview = &cview->surface_view;
|
||||||
struct anv_surface *surface =
|
struct anv_surface *surface =
|
||||||
anv_image_get_surface_for_color_attachment(image);
|
anv_image_get_surface_for_color_attachment(image);
|
||||||
|
|
||||||
aview->base.attachment_type = ANV_ATTACHMENT_VIEW_TYPE_COLOR;
|
aview->attachment_type = ANV_ATTACHMENT_VIEW_TYPE_COLOR;
|
||||||
|
|
||||||
anv_assert(pCreateInfo->arraySize > 0);
|
anv_assert(pCreateInfo->arraySize > 0);
|
||||||
anv_assert(pCreateInfo->mipLevel < image->levels);
|
anv_assert(pCreateInfo->mipLevel < image->levels);
|
||||||
anv_assert(pCreateInfo->baseArraySlice + pCreateInfo->arraySize <= image->array_size);
|
anv_assert(pCreateInfo->baseArraySlice + pCreateInfo->arraySize <= image->array_size);
|
||||||
|
|
||||||
view->bo = image->bo;
|
sview->bo = image->bo;
|
||||||
view->offset = image->offset + surface->offset;
|
sview->offset = image->offset + surface->offset;
|
||||||
view->format = anv_format_for_vk_format(pCreateInfo->format);
|
sview->format = anv_format_for_vk_format(pCreateInfo->format);
|
||||||
|
|
||||||
aview->base.extent = (VkExtent3D) {
|
aview->extent = (VkExtent3D) {
|
||||||
.width = anv_minify(image->extent.width, pCreateInfo->mipLevel),
|
.width = anv_minify(image->extent.width, pCreateInfo->mipLevel),
|
||||||
.height = anv_minify(image->extent.height, pCreateInfo->mipLevel),
|
.height = anv_minify(image->extent.height, pCreateInfo->mipLevel),
|
||||||
.depth = anv_minify(image->extent.depth, pCreateInfo->mipLevel),
|
.depth = anv_minify(image->extent.depth, pCreateInfo->mipLevel),
|
||||||
|
@ -394,17 +397,17 @@ gen7_color_attachment_view_init(struct anv_color_attachment_view *aview,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd_buffer) {
|
if (cmd_buffer) {
|
||||||
view->surface_state =
|
sview->surface_state =
|
||||||
anv_state_stream_alloc(&cmd_buffer->surface_state_stream, 64, 64);
|
anv_state_stream_alloc(&cmd_buffer->surface_state_stream, 64, 64);
|
||||||
} else {
|
} else {
|
||||||
view->surface_state =
|
sview->surface_state =
|
||||||
anv_state_pool_alloc(&device->surface_state_pool, 64, 64);
|
anv_state_pool_alloc(&device->surface_state_pool, 64, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct GEN7_RENDER_SURFACE_STATE surface_state = {
|
struct GEN7_RENDER_SURFACE_STATE surface_state = {
|
||||||
.SurfaceType = SURFTYPE_2D,
|
.SurfaceType = SURFTYPE_2D,
|
||||||
.SurfaceArray = image->array_size > 1,
|
.SurfaceArray = image->array_size > 1,
|
||||||
.SurfaceFormat = view->format->surface_format,
|
.SurfaceFormat = sview->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],
|
||||||
|
|
||||||
|
@ -444,9 +447,10 @@ gen7_color_attachment_view_init(struct anv_color_attachment_view *aview,
|
||||||
.BlueClearColor = 0,
|
.BlueClearColor = 0,
|
||||||
.AlphaClearColor = 0,
|
.AlphaClearColor = 0,
|
||||||
.ResourceMinLOD = 0.0,
|
.ResourceMinLOD = 0.0,
|
||||||
.SurfaceBaseAddress = { NULL, view->offset },
|
.SurfaceBaseAddress = { NULL, sview->offset },
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GEN7_RENDER_SURFACE_STATE_pack(NULL, view->surface_state.map, &surface_state);
|
GEN7_RENDER_SURFACE_STATE_pack(NULL, sview->surface_state.map,
|
||||||
|
&surface_state);
|
||||||
}
|
}
|
||||||
|
|
|
@ -458,11 +458,11 @@ static void
|
||||||
gen8_cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
|
gen8_cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
|
||||||
{
|
{
|
||||||
const struct anv_framebuffer *fb = cmd_buffer->state.framebuffer;
|
const struct anv_framebuffer *fb = cmd_buffer->state.framebuffer;
|
||||||
const struct anv_depth_stencil_view *view =
|
const struct anv_depth_stencil_view *ds_view =
|
||||||
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
||||||
const struct anv_image *image = view ? view->image : NULL;
|
const struct anv_image *image = ds_view ? ds_view->image : NULL;
|
||||||
const bool has_depth = view && view->format->depth_format;
|
const bool has_depth = ds_view && ds_view->format->depth_format;
|
||||||
const bool has_stencil = view && view->format->has_stencil;
|
const bool has_stencil = ds_view && ds_view->format->has_stencil;
|
||||||
|
|
||||||
/* FIXME: Implement the PMA stall W/A */
|
/* FIXME: Implement the PMA stall W/A */
|
||||||
/* FIXME: Width and Height are wrong */
|
/* FIXME: Width and Height are wrong */
|
||||||
|
@ -471,10 +471,10 @@ gen8_cmd_buffer_emit_depth_stencil(struct anv_cmd_buffer *cmd_buffer)
|
||||||
if (has_depth) {
|
if (has_depth) {
|
||||||
anv_batch_emit(&cmd_buffer->batch, GEN8_3DSTATE_DEPTH_BUFFER,
|
anv_batch_emit(&cmd_buffer->batch, GEN8_3DSTATE_DEPTH_BUFFER,
|
||||||
.SurfaceType = SURFTYPE_2D,
|
.SurfaceType = SURFTYPE_2D,
|
||||||
.DepthWriteEnable = view->format->depth_format,
|
.DepthWriteEnable = ds_view->format->depth_format,
|
||||||
.StencilWriteEnable = has_stencil,
|
.StencilWriteEnable = has_stencil,
|
||||||
.HierarchicalDepthBufferEnable = false,
|
.HierarchicalDepthBufferEnable = false,
|
||||||
.SurfaceFormat = view->format->depth_format,
|
.SurfaceFormat = ds_view->format->depth_format,
|
||||||
.SurfacePitch = image->depth_surface.stride - 1,
|
.SurfacePitch = image->depth_surface.stride - 1,
|
||||||
.SurfaceBaseAddress = {
|
.SurfaceBaseAddress = {
|
||||||
.bo = image->bo,
|
.bo = image->bo,
|
||||||
|
|
|
@ -109,20 +109,21 @@ VkResult gen8_CreateBufferView(
|
||||||
VkBufferView* pView)
|
VkBufferView* pView)
|
||||||
{
|
{
|
||||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||||
struct anv_buffer_view *view;
|
struct anv_buffer_view *bview;
|
||||||
VkResult result;
|
VkResult result;
|
||||||
|
|
||||||
result = anv_buffer_view_create(device, pCreateInfo, &view);
|
result = anv_buffer_view_create(device, pCreateInfo, &bview);
|
||||||
if (result != VK_SUCCESS)
|
if (result != VK_SUCCESS)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
const struct anv_format *format =
|
const struct anv_format *format =
|
||||||
anv_format_for_vk_format(pCreateInfo->format);
|
anv_format_for_vk_format(pCreateInfo->format);
|
||||||
|
|
||||||
gen8_fill_buffer_surface_state(view->view.surface_state.map, format,
|
gen8_fill_buffer_surface_state(bview->surface_view.surface_state.map,
|
||||||
view->view.offset, pCreateInfo->range);
|
format, bview->surface_view.offset,
|
||||||
|
pCreateInfo->range);
|
||||||
|
|
||||||
*pView = anv_buffer_view_to_handle(view);
|
*pView = anv_buffer_view_to_handle(bview);
|
||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -148,7 +149,7 @@ gen8_image_view_init(struct anv_image_view *iview,
|
||||||
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
|
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
|
||||||
|
|
||||||
const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange;
|
const VkImageSubresourceRange *range = &pCreateInfo->subresourceRange;
|
||||||
struct anv_surface_view *view = &iview->view;
|
struct anv_surface_view *sview = &iview->surface_view;
|
||||||
struct anv_surface *surface =
|
struct anv_surface *surface =
|
||||||
anv_image_get_surface_for_aspect_mask(image, range->aspectMask);
|
anv_image_get_surface_for_aspect_mask(image, range->aspectMask);
|
||||||
|
|
||||||
|
@ -161,9 +162,9 @@ gen8_image_view_init(struct anv_image_view *iview,
|
||||||
const struct anv_image_view_info view_type_info =
|
const struct anv_image_view_info view_type_info =
|
||||||
anv_image_view_info_for_vk_image_view_type(pCreateInfo->viewType);
|
anv_image_view_info_for_vk_image_view_type(pCreateInfo->viewType);
|
||||||
|
|
||||||
view->bo = image->bo;
|
sview->bo = image->bo;
|
||||||
view->offset = image->offset + surface->offset;
|
sview->offset = image->offset + surface->offset;
|
||||||
view->format = format_info;
|
sview->format = format_info;
|
||||||
|
|
||||||
iview->extent = (VkExtent3D) {
|
iview->extent = (VkExtent3D) {
|
||||||
.width = anv_minify(image->extent.width, range->baseMipLevel),
|
.width = anv_minify(image->extent.width, range->baseMipLevel),
|
||||||
|
@ -266,28 +267,30 @@ gen8_image_view_init(struct anv_image_view *iview,
|
||||||
.ShaderChannelSelectBlue = vk_to_gen_swizzle[pCreateInfo->channels.b],
|
.ShaderChannelSelectBlue = vk_to_gen_swizzle[pCreateInfo->channels.b],
|
||||||
.ShaderChannelSelectAlpha = vk_to_gen_swizzle[pCreateInfo->channels.a],
|
.ShaderChannelSelectAlpha = vk_to_gen_swizzle[pCreateInfo->channels.a],
|
||||||
.ResourceMinLOD = 0.0,
|
.ResourceMinLOD = 0.0,
|
||||||
.SurfaceBaseAddress = { NULL, view->offset },
|
.SurfaceBaseAddress = { NULL, sview->offset },
|
||||||
};
|
};
|
||||||
|
|
||||||
if (cmd_buffer) {
|
if (cmd_buffer) {
|
||||||
view->surface_state =
|
sview->surface_state =
|
||||||
anv_state_stream_alloc(&cmd_buffer->surface_state_stream, 64, 64);
|
anv_state_stream_alloc(&cmd_buffer->surface_state_stream, 64, 64);
|
||||||
} else {
|
} else {
|
||||||
view->surface_state =
|
sview->surface_state =
|
||||||
anv_state_pool_alloc(&device->surface_state_pool, 64, 64);
|
anv_state_pool_alloc(&device->surface_state_pool, 64, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
GEN8_RENDER_SURFACE_STATE_pack(NULL, view->surface_state.map, &surface_state);
|
GEN8_RENDER_SURFACE_STATE_pack(NULL, sview->surface_state.map,
|
||||||
|
&surface_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gen8_color_attachment_view_init(struct anv_color_attachment_view *aview,
|
gen8_color_attachment_view_init(struct anv_color_attachment_view *cview,
|
||||||
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)
|
||||||
{
|
{
|
||||||
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_attachment_view *aview = &cview->attachment_view;
|
||||||
|
struct anv_surface_view *sview = &cview->surface_view;
|
||||||
struct anv_surface *surface =
|
struct anv_surface *surface =
|
||||||
anv_image_get_surface_for_color_attachment(image);
|
anv_image_get_surface_for_color_attachment(image);
|
||||||
const struct anv_format *format_info =
|
const struct anv_format *format_info =
|
||||||
|
@ -296,17 +299,17 @@ gen8_color_attachment_view_init(struct anv_color_attachment_view *aview,
|
||||||
uint32_t depth = 1; /* RENDER_SURFACE_STATE::Depth */
|
uint32_t depth = 1; /* RENDER_SURFACE_STATE::Depth */
|
||||||
uint32_t rt_view_extent = 1; /* RENDER_SURFACE_STATE::RenderTargetViewExtent */
|
uint32_t rt_view_extent = 1; /* RENDER_SURFACE_STATE::RenderTargetViewExtent */
|
||||||
|
|
||||||
aview->base.attachment_type = ANV_ATTACHMENT_VIEW_TYPE_COLOR;
|
aview->attachment_type = ANV_ATTACHMENT_VIEW_TYPE_COLOR;
|
||||||
|
|
||||||
anv_assert(pCreateInfo->arraySize > 0);
|
anv_assert(pCreateInfo->arraySize > 0);
|
||||||
anv_assert(pCreateInfo->mipLevel < image->levels);
|
anv_assert(pCreateInfo->mipLevel < image->levels);
|
||||||
anv_assert(pCreateInfo->baseArraySlice + pCreateInfo->arraySize <= image->array_size);
|
anv_assert(pCreateInfo->baseArraySlice + pCreateInfo->arraySize <= image->array_size);
|
||||||
|
|
||||||
view->bo = image->bo;
|
sview->bo = image->bo;
|
||||||
view->offset = image->offset + surface->offset;
|
sview->offset = image->offset + surface->offset;
|
||||||
view->format = anv_format_for_vk_format(pCreateInfo->format);
|
sview->format = anv_format_for_vk_format(pCreateInfo->format);
|
||||||
|
|
||||||
aview->base.extent = (VkExtent3D) {
|
aview->extent = (VkExtent3D) {
|
||||||
.width = anv_minify(image->extent.width, pCreateInfo->mipLevel),
|
.width = anv_minify(image->extent.width, pCreateInfo->mipLevel),
|
||||||
.height = anv_minify(image->extent.height, pCreateInfo->mipLevel),
|
.height = anv_minify(image->extent.height, pCreateInfo->mipLevel),
|
||||||
.depth = anv_minify(image->extent.depth, pCreateInfo->mipLevel),
|
.depth = anv_minify(image->extent.depth, pCreateInfo->mipLevel),
|
||||||
|
@ -345,17 +348,17 @@ gen8_color_attachment_view_init(struct anv_color_attachment_view *aview,
|
||||||
* indicates the extent of the accessible 'R' coordinates minus 1 on
|
* indicates the extent of the accessible 'R' coordinates minus 1 on
|
||||||
* the LOD currently being rendered to.
|
* the LOD currently being rendered to.
|
||||||
*/
|
*/
|
||||||
rt_view_extent = aview->base.extent.depth;
|
rt_view_extent = aview->extent.depth;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
unreachable(!"bad VkImageType");
|
unreachable(!"bad VkImageType");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd_buffer) {
|
if (cmd_buffer) {
|
||||||
view->surface_state =
|
sview->surface_state =
|
||||||
anv_state_stream_alloc(&cmd_buffer->surface_state_stream, 64, 64);
|
anv_state_stream_alloc(&cmd_buffer->surface_state_stream, 64, 64);
|
||||||
} else {
|
} else {
|
||||||
view->surface_state =
|
sview->surface_state =
|
||||||
anv_state_pool_alloc(&device->surface_state_pool, 64, 64);
|
anv_state_pool_alloc(&device->surface_state_pool, 64, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,10 +411,11 @@ gen8_color_attachment_view_init(struct anv_color_attachment_view *aview,
|
||||||
.ShaderChannelSelectBlue = SCS_BLUE,
|
.ShaderChannelSelectBlue = SCS_BLUE,
|
||||||
.ShaderChannelSelectAlpha = SCS_ALPHA,
|
.ShaderChannelSelectAlpha = SCS_ALPHA,
|
||||||
.ResourceMinLOD = 0.0,
|
.ResourceMinLOD = 0.0,
|
||||||
.SurfaceBaseAddress = { NULL, view->offset },
|
.SurfaceBaseAddress = { NULL, sview->offset },
|
||||||
};
|
};
|
||||||
|
|
||||||
GEN8_RENDER_SURFACE_STATE_pack(NULL, view->surface_state.map, &surface_state);
|
GEN8_RENDER_SURFACE_STATE_pack(NULL, sview->surface_state.map,
|
||||||
|
&surface_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult gen8_CreateSampler(
|
VkResult gen8_CreateSampler(
|
||||||
|
|
Loading…
Reference in New Issue