vk: Merge anv_*_attachment_view into anv_attachment_view
Remove anv_color_attachment_view and anv_depth_stencil_view, merging them into anv_attachment_view. This prepares for merging VkAttachmentView into VkImageView.
This commit is contained in:
@@ -434,14 +434,10 @@ anv_cmd_buffer_emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
|
|||||||
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_attachment_view *aview =
|
||||||
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);
|
assert(aview->attachment_type == ANV_ATTACHMENT_VIEW_TYPE_COLOR);
|
||||||
|
|
||||||
const struct anv_color_attachment_view *cview =
|
|
||||||
(const struct anv_color_attachment_view *) aview;
|
|
||||||
|
|
||||||
const struct anv_image_view *iview = &cview->image_view;
|
|
||||||
|
|
||||||
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,
|
||||||
iview->bo, iview->offset);
|
iview->bo, iview->offset);
|
||||||
@@ -821,7 +817,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_depth_stencil_view *
|
const struct anv_attachment_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;
|
||||||
@@ -835,5 +831,5 @@ anv_cmd_buffer_get_depth_stencil_view(const struct anv_cmd_buffer *cmd_buffer)
|
|||||||
|
|
||||||
assert(aview->attachment_type == ANV_ATTACHMENT_VIEW_TYPE_DEPTH_STENCIL);
|
assert(aview->attachment_type == ANV_ATTACHMENT_VIEW_TYPE_DEPTH_STENCIL);
|
||||||
|
|
||||||
return (const struct anv_depth_stencil_view *) aview;
|
return aview;
|
||||||
}
|
}
|
||||||
|
@@ -512,24 +512,23 @@ anv_DestroyImageView(VkDevice _device, VkImageView _iview)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
anv_depth_stencil_view_init(struct anv_depth_stencil_view *ds_view,
|
anv_depth_stencil_view_init(struct anv_attachment_view *aview,
|
||||||
const VkAttachmentViewCreateInfo *pCreateInfo)
|
const VkAttachmentViewCreateInfo *pCreateInfo)
|
||||||
{
|
{
|
||||||
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
|
ANV_FROM_HANDLE(anv_image, image, pCreateInfo->image);
|
||||||
|
|
||||||
ds_view->attachment_view.attachment_type =
|
aview->attachment_type = ANV_ATTACHMENT_VIEW_TYPE_DEPTH_STENCIL;
|
||||||
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);
|
||||||
|
|
||||||
ds_view->image = image;
|
aview->image_view.image = image;
|
||||||
ds_view->format = anv_format_for_vk_format(pCreateInfo->format);
|
aview->image_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(ds_view->format));
|
assert(anv_format_is_depth_or_stencil(aview->image_view.format));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct anv_surface *
|
struct anv_surface *
|
||||||
@@ -579,17 +578,17 @@ anv_image_get_surface_for_color_attachment(struct anv_image *image)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
anv_color_attachment_view_init(struct anv_color_attachment_view *cview,
|
anv_color_attachment_view_init(struct anv_attachment_view *aview,
|
||||||
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(cview, device, pCreateInfo, cmd_buffer);
|
gen7_color_attachment_view_init(aview, device, pCreateInfo, cmd_buffer);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
gen8_color_attachment_view_init(cview, device, pCreateInfo, cmd_buffer);
|
gen8_color_attachment_view_init(aview, device, pCreateInfo, cmd_buffer);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
unreachable("unsupported gen\n");
|
unreachable("unsupported gen\n");
|
||||||
@@ -602,34 +601,26 @@ 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;
|
||||||
|
|
||||||
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,
|
||||||
|
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
|
||||||
|
if (aview == NULL)
|
||||||
|
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)) {
|
||||||
struct anv_depth_stencil_view *ds_view =
|
anv_depth_stencil_view_init(aview, pCreateInfo);
|
||||||
anv_device_alloc(device, sizeof(*ds_view), 8,
|
|
||||||
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
|
|
||||||
if (ds_view == NULL)
|
|
||||||
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
|
||||||
|
|
||||||
anv_depth_stencil_view_init(ds_view, pCreateInfo);
|
|
||||||
|
|
||||||
*pView = anv_attachment_view_to_handle(&ds_view->attachment_view);
|
|
||||||
} else {
|
} else {
|
||||||
struct anv_color_attachment_view *cview =
|
anv_color_attachment_view_init(aview, device, pCreateInfo, NULL);
|
||||||
anv_device_alloc(device, sizeof(*cview), 8,
|
|
||||||
VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
|
|
||||||
if (cview == NULL)
|
|
||||||
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
|
||||||
|
|
||||||
anv_color_attachment_view_init(cview, device, pCreateInfo, NULL);
|
|
||||||
|
|
||||||
*pView = anv_attachment_view_to_handle(&cview->attachment_view);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*pView = anv_attachment_view_to_handle(aview);
|
||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -640,10 +631,7 @@ anv_DestroyAttachmentView(VkDevice _device, VkAttachmentView _aview)
|
|||||||
ANV_FROM_HANDLE(anv_attachment_view, aview, _aview);
|
ANV_FROM_HANDLE(anv_attachment_view, aview, _aview);
|
||||||
|
|
||||||
if (aview->attachment_type == ANV_ATTACHMENT_VIEW_TYPE_COLOR) {
|
if (aview->attachment_type == ANV_ATTACHMENT_VIEW_TYPE_COLOR) {
|
||||||
struct anv_color_attachment_view *cview =
|
anv_image_view_fini(device, &aview->image_view);
|
||||||
(struct anv_color_attachment_view *) aview;
|
|
||||||
|
|
||||||
anv_image_view_fini(device, &cview->image_view);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
anv_device_free(device, aview);
|
anv_device_free(device, aview);
|
||||||
|
@@ -733,13 +733,12 @@ 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_color_attachment_view *dest_cview,
|
struct anv_attachment_view *dest_aview,
|
||||||
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_image_view *dest_iview = &dest_aview->image_view;
|
||||||
struct anv_image_view *dest_iview = &dest_cview->image_view;
|
|
||||||
VkDescriptorPool dummy_desc_pool = { .handle = 1 };
|
VkDescriptorPool dummy_desc_pool = { .handle = 1 };
|
||||||
|
|
||||||
struct blit_vb_data {
|
struct blit_vb_data {
|
||||||
@@ -1023,8 +1022,8 @@ do_buffer_copy(struct anv_cmd_buffer *cmd_buffer,
|
|||||||
},
|
},
|
||||||
cmd_buffer);
|
cmd_buffer);
|
||||||
|
|
||||||
struct anv_color_attachment_view dest_cview;
|
struct anv_attachment_view dest_aview;
|
||||||
anv_color_attachment_view_init(&dest_cview, cmd_buffer->device,
|
anv_color_attachment_view_init(&dest_aview, 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,
|
||||||
@@ -1041,7 +1040,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_cview,
|
&dest_aview,
|
||||||
(VkOffset3D) { 0, 0, 0 },
|
(VkOffset3D) { 0, 0, 0 },
|
||||||
(VkExtent3D) { width, height, 1 });
|
(VkExtent3D) { width, height, 1 });
|
||||||
|
|
||||||
@@ -1185,8 +1184,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_cview;
|
struct anv_attachment_view dest_aview;
|
||||||
anv_color_attachment_view_init(&dest_cview, cmd_buffer->device,
|
anv_color_attachment_view_init(&dest_aview, 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,
|
||||||
@@ -1201,7 +1200,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_cview,
|
dest_image, &dest_aview,
|
||||||
dest_offset,
|
dest_offset,
|
||||||
pRegions[r].extent);
|
pRegions[r].extent);
|
||||||
}
|
}
|
||||||
@@ -1271,8 +1270,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_cview;
|
struct anv_attachment_view dest_aview;
|
||||||
anv_color_attachment_view_init(&dest_cview, cmd_buffer->device,
|
anv_color_attachment_view_init(&dest_aview, 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,
|
||||||
@@ -1287,7 +1286,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_cview,
|
dest_image, &dest_aview,
|
||||||
dest_offset,
|
dest_offset,
|
||||||
pRegions[r].destExtent);
|
pRegions[r].destExtent);
|
||||||
}
|
}
|
||||||
@@ -1401,8 +1400,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_cview;
|
struct anv_attachment_view dest_aview;
|
||||||
anv_color_attachment_view_init(&dest_cview, cmd_buffer->device,
|
anv_color_attachment_view_init(&dest_aview, 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),
|
||||||
@@ -1419,7 +1418,7 @@ void anv_CmdCopyBufferToImage(
|
|||||||
(VkOffset3D) { 0, 0, 0 },
|
(VkOffset3D) { 0, 0, 0 },
|
||||||
pRegions[r].imageExtent,
|
pRegions[r].imageExtent,
|
||||||
dest_image,
|
dest_image,
|
||||||
&dest_cview,
|
&dest_aview,
|
||||||
dest_offset,
|
dest_offset,
|
||||||
pRegions[r].imageExtent);
|
pRegions[r].imageExtent);
|
||||||
|
|
||||||
@@ -1483,8 +1482,8 @@ void anv_CmdCopyImageToBuffer(
|
|||||||
dest_format,
|
dest_format,
|
||||||
&pRegions[r]);
|
&pRegions[r]);
|
||||||
|
|
||||||
struct anv_color_attachment_view dest_cview;
|
struct anv_attachment_view dest_aview;
|
||||||
anv_color_attachment_view_init(&dest_cview, cmd_buffer->device,
|
anv_color_attachment_view_init(&dest_aview, 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,
|
||||||
@@ -1501,7 +1500,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_cview,
|
&dest_aview,
|
||||||
(VkOffset3D) { 0, 0, 0 },
|
(VkOffset3D) { 0, 0, 0 },
|
||||||
pRegions[r].imageExtent);
|
pRegions[r].imageExtent);
|
||||||
|
|
||||||
@@ -1548,8 +1547,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 cview;
|
struct anv_attachment_view aview;
|
||||||
anv_color_attachment_view_init(&cview, cmd_buffer->device,
|
anv_color_attachment_view_init(&aview, 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,
|
||||||
@@ -1560,8 +1559,7 @@ void anv_CmdClearColorImage(
|
|||||||
},
|
},
|
||||||
cmd_buffer);
|
cmd_buffer);
|
||||||
|
|
||||||
struct anv_attachment_view *aview = &cview.attachment_view;
|
struct anv_image_view *iview = &aview.image_view;
|
||||||
struct anv_image_view *iview = &cview.image_view;
|
|
||||||
|
|
||||||
VkFramebuffer fb;
|
VkFramebuffer fb;
|
||||||
anv_CreateFramebuffer(anv_device_to_handle(cmd_buffer->device),
|
anv_CreateFramebuffer(anv_device_to_handle(cmd_buffer->device),
|
||||||
@@ -1570,7 +1568,7 @@ void anv_CmdClearColorImage(
|
|||||||
.attachmentCount = 1,
|
.attachmentCount = 1,
|
||||||
.pAttachments = (VkAttachmentBindInfo[]) {
|
.pAttachments = (VkAttachmentBindInfo[]) {
|
||||||
{
|
{
|
||||||
.view = anv_attachment_view_to_handle(aview),
|
.view = anv_attachment_view_to_handle(&aview),
|
||||||
.layout = VK_IMAGE_LAYOUT_GENERAL
|
.layout = VK_IMAGE_LAYOUT_GENERAL
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@@ -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_depth_stencil_view *
|
const struct anv_attachment_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);
|
||||||
@@ -1244,10 +1244,11 @@ struct anv_buffer_view {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct anv_image_view {
|
struct anv_image_view {
|
||||||
|
const struct anv_image *image; /**< VkAttachmentViewCreateInfo::image */
|
||||||
|
const struct anv_format *format; /**< VkAttachmentViewCreateInfo::format */
|
||||||
struct anv_state surface_state; /**< RENDER_SURFACE_STATE */
|
struct anv_state surface_state; /**< RENDER_SURFACE_STATE */
|
||||||
struct anv_bo *bo;
|
struct anv_bo *bo;
|
||||||
uint32_t offset; /**< Offset into bo. */
|
uint32_t offset; /**< Offset into bo. */
|
||||||
const struct anv_format *format; /**< VkImageViewCreateInfo::format */
|
|
||||||
VkExtent3D extent;
|
VkExtent3D extent;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1258,19 +1259,9 @@ enum anv_attachment_view_type {
|
|||||||
|
|
||||||
struct anv_attachment_view {
|
struct anv_attachment_view {
|
||||||
enum anv_attachment_view_type attachment_type;
|
enum anv_attachment_view_type attachment_type;
|
||||||
};
|
|
||||||
|
|
||||||
struct anv_color_attachment_view {
|
|
||||||
struct anv_attachment_view attachment_view;
|
|
||||||
struct anv_image_view image_view;
|
struct anv_image_view image_view;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct anv_depth_stencil_view {
|
|
||||||
struct anv_attachment_view attachment_view;
|
|
||||||
const struct anv_image *image; /**< VkAttachmentViewCreateInfo::image */
|
|
||||||
const struct anv_format *format; /**< VkAttachmentViewCreateInfo::format */
|
|
||||||
};
|
|
||||||
|
|
||||||
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;
|
||||||
@@ -1306,17 +1297,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_color_attachment_view *cview,
|
void anv_color_attachment_view_init(struct anv_attachment_view *aview,
|
||||||
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 *cview,
|
void gen7_color_attachment_view_init(struct anv_attachment_view *aview,
|
||||||
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 *cview,
|
void gen8_color_attachment_view_init(struct anv_attachment_view *aview,
|
||||||
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);
|
||||||
|
@@ -529,20 +529,21 @@ 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 *ds_view =
|
const struct anv_attachment_view *aview =
|
||||||
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
||||||
const struct anv_image *image = ds_view ? ds_view->image : NULL;
|
const struct anv_image_view *iview = aview ? &aview->image_view : NULL;
|
||||||
const bool has_depth = ds_view && ds_view->format->depth_format;
|
const struct anv_image *image = iview ? iview->image : NULL;
|
||||||
const bool has_stencil = ds_view && ds_view->format->has_stencil;
|
const bool has_depth = iview && iview->format->depth_format;
|
||||||
|
const bool has_stencil = iview && iview->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 = ds_view->format->depth_format,
|
.DepthWriteEnable = iview->format->depth_format,
|
||||||
.StencilWriteEnable = has_stencil,
|
.StencilWriteEnable = has_stencil,
|
||||||
.HierarchicalDepthBufferEnable = false,
|
.HierarchicalDepthBufferEnable = false,
|
||||||
.SurfaceFormat = ds_view->format->depth_format,
|
.SurfaceFormat = iview->format->depth_format,
|
||||||
.SurfacePitch = image->depth_surface.stride - 1,
|
.SurfacePitch = image->depth_surface.stride - 1,
|
||||||
.SurfaceBaseAddress = {
|
.SurfaceBaseAddress = {
|
||||||
.bo = image->bo,
|
.bo = image->bo,
|
||||||
|
@@ -360,14 +360,13 @@ gen7_image_view_init(struct anv_image_view *iview,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gen7_color_attachment_view_init(struct anv_color_attachment_view *cview,
|
gen7_color_attachment_view_init(struct anv_attachment_view *aview,
|
||||||
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_attachment_view *aview = &cview->attachment_view;
|
struct anv_image_view *iview = &aview->image_view;
|
||||||
struct anv_image_view *iview = &cview->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);
|
||||||
|
|
||||||
|
@@ -458,11 +458,12 @@ 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 *ds_view =
|
const struct anv_attachment_view *aview =
|
||||||
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
||||||
const struct anv_image *image = ds_view ? ds_view->image : NULL;
|
const struct anv_image_view *iview = aview ? &aview->image_view : NULL;
|
||||||
const bool has_depth = ds_view && ds_view->format->depth_format;
|
const struct anv_image *image = iview ? iview->image : NULL;
|
||||||
const bool has_stencil = ds_view && ds_view->format->has_stencil;
|
const bool has_depth = iview && iview->format->depth_format;
|
||||||
|
const bool has_stencil = iview && iview->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 +472,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 = ds_view->format->depth_format,
|
.DepthWriteEnable = iview->format->depth_format,
|
||||||
.StencilWriteEnable = has_stencil,
|
.StencilWriteEnable = has_stencil,
|
||||||
.HierarchicalDepthBufferEnable = false,
|
.HierarchicalDepthBufferEnable = false,
|
||||||
.SurfaceFormat = ds_view->format->depth_format,
|
.SurfaceFormat = iview->format->depth_format,
|
||||||
.SurfacePitch = image->depth_surface.stride - 1,
|
.SurfacePitch = image->depth_surface.stride - 1,
|
||||||
.SurfaceBaseAddress = {
|
.SurfaceBaseAddress = {
|
||||||
.bo = image->bo,
|
.bo = image->bo,
|
||||||
|
@@ -281,14 +281,13 @@ gen8_image_view_init(struct anv_image_view *iview,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gen8_color_attachment_view_init(struct anv_color_attachment_view *cview,
|
gen8_color_attachment_view_init(struct anv_attachment_view *aview,
|
||||||
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_attachment_view *aview = &cview->attachment_view;
|
struct anv_image_view *iview = &aview->image_view;
|
||||||
struct anv_image_view *iview = &cview->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 =
|
||||||
|
Reference in New Issue
Block a user