vk: Merge anv_attachment_view into anv_image_view

This prepares for merging VkAttachmentView into VkImageView.
This commit is contained in:
Chad Versace
2015-10-06 11:42:43 -07:00
parent 6b5ce5daf5
commit d4446a7e58
9 changed files with 71 additions and 95 deletions

View File

@@ -431,11 +431,8 @@ 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 *aview = const struct anv_image_view *iview =
fb->attachments[subpass->color_attachments[a]]; fb->attachments[subpass->color_attachments[a]];
const struct anv_image_view *iview = &aview->image_view;
assert(aview->attachment_type == ANV_ATTACHMENT_VIEW_TYPE_COLOR);
bt_map[a] = iview->surface_state.offset + state_offset; bt_map[a] = iview->surface_state.offset + state_offset;
add_surface_state_reloc(cmd_buffer, iview->surface_state, add_surface_state_reloc(cmd_buffer, iview->surface_state,
@@ -814,7 +811,7 @@ VkResult anv_ResetCommandPool(
/** /**
* Return NULL if the current subpass has no depthstencil attachment. * Return NULL if the current subpass has no depthstencil attachment.
*/ */
const struct anv_attachment_view * const struct anv_image_view *
anv_cmd_buffer_get_depth_stencil_view(const struct anv_cmd_buffer *cmd_buffer) anv_cmd_buffer_get_depth_stencil_view(const struct anv_cmd_buffer *cmd_buffer)
{ {
const struct anv_subpass *subpass = cmd_buffer->state.subpass; const struct anv_subpass *subpass = cmd_buffer->state.subpass;
@@ -823,10 +820,10 @@ anv_cmd_buffer_get_depth_stencil_view(const struct anv_cmd_buffer *cmd_buffer)
if (subpass->depth_stencil_attachment == VK_ATTACHMENT_UNUSED) if (subpass->depth_stencil_attachment == VK_ATTACHMENT_UNUSED)
return NULL; return NULL;
const struct anv_attachment_view *aview = const struct anv_image_view *iview =
fb->attachments[subpass->depth_stencil_attachment]; fb->attachments[subpass->depth_stencil_attachment];
assert(aview->attachment_type == ANV_ATTACHMENT_VIEW_TYPE_DEPTH_STENCIL); assert(anv_format_is_depth_or_stencil(iview->format));
return aview; return iview;
} }

View File

@@ -1960,7 +1960,7 @@ VkResult anv_CreateFramebuffer(
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO); assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO);
size_t size = sizeof(*framebuffer) + size_t size = sizeof(*framebuffer) +
sizeof(struct anv_attachment_view *) * pCreateInfo->attachmentCount; sizeof(struct anv_image_view *) * pCreateInfo->attachmentCount;
framebuffer = anv_device_alloc(device, size, 8, framebuffer = anv_device_alloc(device, size, 8,
VK_SYSTEM_ALLOC_TYPE_API_OBJECT); VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
if (framebuffer == NULL) if (framebuffer == NULL)
@@ -1968,10 +1968,9 @@ 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, aview, VkAttachmentView _aview = pCreateInfo->pAttachments[i].view;
pCreateInfo->pAttachments[i].view); VkImageView _iview = { _aview.handle };
framebuffer->attachments[i] = anv_image_view_from_handle(_iview);
framebuffer->attachments[i] = aview;
} }
framebuffer->width = pCreateInfo->width; framebuffer->width = pCreateInfo->width;

View File

@@ -490,41 +490,32 @@ anv_CreateImageView(VkDevice _device,
return VK_SUCCESS; return VK_SUCCESS;
} }
static void
anv_image_view_fini(struct anv_device *device,
struct anv_image_view *iview)
{
anv_state_pool_free(&device->surface_state_pool, iview->surface_state);
}
void void
anv_DestroyImageView(VkDevice _device, VkImageView _iview) 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_image_view_fini(device, iview); anv_state_pool_free(&device->surface_state_pool, iview->surface_state);
anv_device_free(device, iview); anv_device_free(device, iview);
} }
static void static void
anv_depth_stencil_view_init(struct anv_attachment_view *aview, anv_depth_stencil_view_init(struct anv_image_view *iview,
const VkAttachmentViewCreateInfo *pCreateInfo) const VkAttachmentViewCreateInfo *pCreateInfo)
{ {
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image); ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
aview->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);
aview->image_view.image = image; iview->image = image;
aview->image_view.format = anv_format_for_vk_format(pCreateInfo->format); iview->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(aview->image_view.format)); assert(anv_format_is_depth_or_stencil(iview->format));
} }
struct anv_surface * struct anv_surface *
@@ -574,17 +565,17 @@ anv_image_get_surface_for_color_attachment(struct anv_image *image)
} }
void void
anv_color_attachment_view_init(struct anv_attachment_view *aview, anv_color_attachment_view_init(struct anv_image_view *iview,
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(iview, 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(iview, device, pCreateInfo, cmd_buffer);
break; break;
default: default:
unreachable("unsupported gen\n"); unreachable("unsupported gen\n");
@@ -597,25 +588,25 @@ anv_CreateAttachmentView(VkDevice _device,
VkAttachmentView *pView) VkAttachmentView *pView)
{ {
ANV_FROM_HANDLE(anv_device, device, _device); ANV_FROM_HANDLE(anv_device, device, _device);
struct anv_attachment_view *aview; struct anv_image_view *iview;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO); assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO);
aview = anv_device_alloc(device, sizeof(*aview), 8, iview = anv_device_alloc(device, sizeof(*iview), 8,
VK_SYSTEM_ALLOC_TYPE_API_OBJECT); VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
if (aview == NULL) if (iview == NULL)
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
const struct anv_format *format = const struct anv_format *format =
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)) {
anv_depth_stencil_view_init(aview, pCreateInfo); anv_depth_stencil_view_init(iview, pCreateInfo);
} else { } else {
anv_color_attachment_view_init(aview, device, pCreateInfo, NULL); anv_color_attachment_view_init(iview, device, pCreateInfo, NULL);
} }
*pView = anv_attachment_view_to_handle(aview); pView->handle = anv_image_view_to_handle(iview).handle;
return VK_SUCCESS; return VK_SUCCESS;
} }
@@ -624,11 +615,15 @@ void
anv_DestroyAttachmentView(VkDevice _device, VkAttachmentView _aview) 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, aview, _aview); VkImageView _iview = { .handle = _aview.handle };
ANV_FROM_HANDLE(anv_image_view, iview, _iview);
if (aview->attachment_type == ANV_ATTACHMENT_VIEW_TYPE_COLOR) { /* Depth and stencil render targets have no RENDER_SURFACE_STATE. Instead,
anv_image_view_fini(device, &aview->image_view); * they use 3DSTATE_DEPTH_BUFFER and 3DSTATE_STENCIL_BUFFER.
*/
if (!anv_format_is_depth_or_stencil(iview->format)) {
anv_state_pool_free(&device->surface_state_pool, iview->surface_state);
} }
anv_device_free(device, aview); anv_device_free(device, iview);
} }

View File

@@ -733,12 +733,15 @@ meta_emit_blit(struct anv_cmd_buffer *cmd_buffer,
VkOffset3D src_offset, VkOffset3D src_offset,
VkExtent3D src_extent, VkExtent3D src_extent,
struct anv_image *dest_image, struct anv_image *dest_image,
struct anv_attachment_view *dest_aview, struct anv_image_view *dest_iview,
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_image_view *dest_iview = &dest_aview->image_view;
VkImageView dest_iview_h = anv_image_view_to_handle(dest_iview);
VkAttachmentView dest_aview_h = { .handle = dest_iview_h.handle };
VkDescriptorPool dummy_desc_pool = { .handle = 1 }; VkDescriptorPool dummy_desc_pool = { .handle = 1 };
struct blit_vb_data { struct blit_vb_data {
@@ -836,7 +839,7 @@ meta_emit_blit(struct anv_cmd_buffer *cmd_buffer,
.attachmentCount = 1, .attachmentCount = 1,
.pAttachments = (VkAttachmentBindInfo[]) { .pAttachments = (VkAttachmentBindInfo[]) {
{ {
.view = anv_attachment_view_to_handle(dest_aview), .view = dest_aview_h,
.layout = VK_IMAGE_LAYOUT_GENERAL .layout = VK_IMAGE_LAYOUT_GENERAL
} }
}, },
@@ -1021,8 +1024,8 @@ do_buffer_copy(struct anv_cmd_buffer *cmd_buffer,
}, },
cmd_buffer); cmd_buffer);
struct anv_attachment_view dest_aview; struct anv_image_view dest_iview;
anv_color_attachment_view_init(&dest_aview, cmd_buffer->device, anv_color_attachment_view_init(&dest_iview, 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,
@@ -1039,7 +1042,7 @@ do_buffer_copy(struct anv_cmd_buffer *cmd_buffer,
(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_aview, &dest_iview,
(VkOffset3D) { 0, 0, 0 }, (VkOffset3D) { 0, 0, 0 },
(VkExtent3D) { width, height, 1 }); (VkExtent3D) { width, height, 1 });
@@ -1186,8 +1189,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_attachment_view dest_aview; struct anv_image_view dest_iview;
anv_color_attachment_view_init(&dest_aview, cmd_buffer->device, anv_color_attachment_view_init(&dest_iview, 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,
@@ -1202,7 +1205,7 @@ void anv_CmdCopyImage(
src_image, &src_iview, src_image, &src_iview,
pRegions[r].srcOffset, pRegions[r].srcOffset,
pRegions[r].extent, pRegions[r].extent,
dest_image, &dest_aview, dest_image, &dest_iview,
dest_offset, dest_offset,
pRegions[r].extent); pRegions[r].extent);
} }
@@ -1275,8 +1278,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_attachment_view dest_aview; struct anv_image_view dest_iview;
anv_color_attachment_view_init(&dest_aview, cmd_buffer->device, anv_color_attachment_view_init(&dest_iview, 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,
@@ -1291,7 +1294,7 @@ void anv_CmdBlitImage(
src_image, &src_iview, src_image, &src_iview,
pRegions[r].srcOffset, pRegions[r].srcOffset,
pRegions[r].srcExtent, pRegions[r].srcExtent,
dest_image, &dest_aview, dest_image, &dest_iview,
dest_offset, dest_offset,
pRegions[r].destExtent); pRegions[r].destExtent);
} }
@@ -1405,8 +1408,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_attachment_view dest_aview; struct anv_image_view dest_iview;
anv_color_attachment_view_init(&dest_aview, cmd_buffer->device, anv_color_attachment_view_init(&dest_iview, 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),
@@ -1423,7 +1426,7 @@ void anv_CmdCopyBufferToImage(
(VkOffset3D) { 0, 0, 0 }, (VkOffset3D) { 0, 0, 0 },
pRegions[r].imageExtent, pRegions[r].imageExtent,
dest_image, dest_image,
&dest_aview, &dest_iview,
dest_offset, dest_offset,
pRegions[r].imageExtent); pRegions[r].imageExtent);
@@ -1490,8 +1493,8 @@ void anv_CmdCopyImageToBuffer(
dest_format, dest_format,
&pRegions[r]); &pRegions[r]);
struct anv_attachment_view dest_aview; struct anv_image_view dest_iview;
anv_color_attachment_view_init(&dest_aview, cmd_buffer->device, anv_color_attachment_view_init(&dest_iview, 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,
@@ -1508,7 +1511,7 @@ void anv_CmdCopyImageToBuffer(
pRegions[r].imageOffset, pRegions[r].imageOffset,
pRegions[r].imageExtent, pRegions[r].imageExtent,
anv_image_from_handle(destImage), anv_image_from_handle(destImage),
&dest_aview, &dest_iview,
(VkOffset3D) { 0, 0, 0 }, (VkOffset3D) { 0, 0, 0 },
pRegions[r].imageExtent); pRegions[r].imageExtent);
@@ -1555,8 +1558,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_attachment_view aview; struct anv_image_view iview;
anv_color_attachment_view_init(&aview, cmd_buffer->device, anv_color_attachment_view_init(&iview, 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,
@@ -1567,7 +1570,8 @@ void anv_CmdClearColorImage(
}, },
cmd_buffer); cmd_buffer);
struct anv_image_view *iview = &aview.image_view; VkImageView iview_h = anv_image_view_to_handle(&iview);
VkAttachmentView aview_h = { .handle = iview_h.handle };
VkFramebuffer fb; VkFramebuffer fb;
anv_CreateFramebuffer(anv_device_to_handle(cmd_buffer->device), anv_CreateFramebuffer(anv_device_to_handle(cmd_buffer->device),
@@ -1576,12 +1580,12 @@ void anv_CmdClearColorImage(
.attachmentCount = 1, .attachmentCount = 1,
.pAttachments = (VkAttachmentBindInfo[]) { .pAttachments = (VkAttachmentBindInfo[]) {
{ {
.view = anv_attachment_view_to_handle(&aview), .view = aview_h,
.layout = VK_IMAGE_LAYOUT_GENERAL .layout = VK_IMAGE_LAYOUT_GENERAL
} }
}, },
.width = iview->extent.width, .width = iview.extent.width,
.height = iview->extent.height, .height = iview.extent.height,
.layers = 1 .layers = 1
}, &fb); }, &fb);
@@ -1592,7 +1596,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 = iview->format->vk_format, .format = iview.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,
@@ -1628,8 +1632,8 @@ void anv_CmdClearColorImage(
.renderArea = { .renderArea = {
.offset = { 0, 0, }, .offset = { 0, 0, },
.extent = { .extent = {
.width = iview->extent.width, .width = iview.extent.width,
.height = iview->extent.height, .height = iview.extent.height,
}, },
}, },
.renderPass = pass, .renderPass = pass,

View File

@@ -994,7 +994,7 @@ anv_cmd_buffer_push_constants(struct anv_cmd_buffer *cmd_buffer,
void anv_cmd_buffer_clear_attachments(struct anv_cmd_buffer *cmd_buffer, void anv_cmd_buffer_clear_attachments(struct anv_cmd_buffer *cmd_buffer,
struct anv_render_pass *pass, struct anv_render_pass *pass,
const VkClearValue *clear_values); const VkClearValue *clear_values);
const struct anv_attachment_view * const struct anv_image_view *
anv_cmd_buffer_get_depth_stencil_view(const struct anv_cmd_buffer *cmd_buffer); anv_cmd_buffer_get_depth_stencil_view(const struct anv_cmd_buffer *cmd_buffer);
void anv_cmd_buffer_dump(struct anv_cmd_buffer *cmd_buffer); void anv_cmd_buffer_dump(struct anv_cmd_buffer *cmd_buffer);
@@ -1252,16 +1252,6 @@ struct anv_image_view {
VkExtent3D extent; /**< Extent of VkImageViewCreateInfo::baseMipLevel. */ VkExtent3D extent; /**< Extent of VkImageViewCreateInfo::baseMipLevel. */
}; };
enum anv_attachment_view_type {
ANV_ATTACHMENT_VIEW_TYPE_COLOR,
ANV_ATTACHMENT_VIEW_TYPE_DEPTH_STENCIL,
};
struct anv_attachment_view {
enum anv_attachment_view_type attachment_type;
struct anv_image_view image_view;
};
struct anv_image_create_info { struct anv_image_create_info {
const VkImageCreateInfo *vk_info; const VkImageCreateInfo *vk_info;
bool force_tile_mode; bool force_tile_mode;
@@ -1297,17 +1287,17 @@ 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_attachment_view *aview, void anv_color_attachment_view_init(struct anv_image_view *iview,
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_attachment_view *aview, void gen7_color_attachment_view_init(struct anv_image_view *iview,
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_attachment_view *aview, void gen8_color_attachment_view_init(struct anv_image_view *iview,
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);
@@ -1338,7 +1328,7 @@ struct anv_framebuffer {
VkDynamicViewportState vp_state; VkDynamicViewportState vp_state;
uint32_t attachment_count; uint32_t attachment_count;
const struct anv_attachment_view * attachments[0]; const struct anv_image_view * attachments[0];
}; };
struct anv_subpass { struct anv_subpass {
@@ -1424,7 +1414,6 @@ ANV_DEFINE_HANDLE_CASTS(anv_physical_device, VkPhysicalDevice)
ANV_DEFINE_HANDLE_CASTS(anv_queue, VkQueue) ANV_DEFINE_HANDLE_CASTS(anv_queue, VkQueue)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_cmd_pool, VkCmdPool) ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_cmd_pool, VkCmdPool)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_attachment_view, VkAttachmentView)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_buffer, VkBuffer) ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_buffer, VkBuffer)
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_buffer_view, VkBufferView); ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_buffer_view, VkBufferView);
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_descriptor_set, VkDescriptorSet) ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_descriptor_set, VkDescriptorSet)

View File

@@ -529,9 +529,8 @@ 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_attachment_view *aview = const struct anv_image_view *iview =
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer); anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
const struct anv_image_view *iview = aview ? &aview->image_view : NULL;
const struct anv_image *image = iview ? iview->image : NULL; const struct anv_image *image = iview ? iview->image : NULL;
const bool has_depth = iview && iview->format->depth_format; const bool has_depth = iview && iview->format->depth_format;
const bool has_stencil = iview && iview->format->has_stencil; const bool has_stencil = iview && iview->format->has_stencil;

View File

@@ -360,18 +360,15 @@ gen7_image_view_init(struct anv_image_view *iview,
} }
void void
gen7_color_attachment_view_init(struct anv_attachment_view *aview, gen7_color_attachment_view_init(struct anv_image_view *iview,
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_image_view *iview = &aview->image_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->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 File

@@ -458,9 +458,8 @@ 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_attachment_view *aview = const struct anv_image_view *iview =
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer); anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
const struct anv_image_view *iview = aview ? &aview->image_view : NULL;
const struct anv_image *image = iview ? iview->image : NULL; const struct anv_image *image = iview ? iview->image : NULL;
const bool has_depth = iview && iview->format->depth_format; const bool has_depth = iview && iview->format->depth_format;
const bool has_stencil = iview && iview->format->has_stencil; const bool has_stencil = iview && iview->format->has_stencil;

View File

@@ -281,13 +281,12 @@ gen8_image_view_init(struct anv_image_view *iview,
} }
void void
gen8_color_attachment_view_init(struct anv_attachment_view *aview, gen8_color_attachment_view_init(struct anv_image_view *iview,
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_image_view *iview = &aview->image_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,8 +295,6 @@ gen8_color_attachment_view_init(struct anv_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->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);