vk/0.210.0: Rework render pass description structures

This commit is contained in:
Jason Ekstrand
2015-12-01 13:09:22 -08:00
parent 299f8f1511
commit 43f3e92348
4 changed files with 33 additions and 25 deletions

View File

@@ -1926,21 +1926,21 @@ typedef struct VkAttachmentReference {
typedef struct VkSubpassDescription { typedef struct VkSubpassDescription {
VkSubpassDescriptionFlags flags; VkSubpassDescriptionFlags flags;
VkPipelineBindPoint pipelineBindPoint; VkPipelineBindPoint pipelineBindPoint;
uint32_t inputCount; uint32_t inputAttachmentCount;
const VkAttachmentReference* pInputAttachments; const VkAttachmentReference* pInputAttachments;
uint32_t colorCount; uint32_t colorAttachmentCount;
const VkAttachmentReference* pColorAttachments; const VkAttachmentReference* pColorAttachments;
const VkAttachmentReference* pResolveAttachments; const VkAttachmentReference* pResolveAttachments;
VkAttachmentReference depthStencilAttachment; const VkAttachmentReference* pDepthStencilAttachment;
uint32_t preserveCount; uint32_t preserveAttachmentCount;
const VkAttachmentReference* pPreserveAttachments; const VkAttachmentReference* pPreserveAttachments;
} VkSubpassDescription; } VkSubpassDescription;
typedef struct VkSubpassDependency { typedef struct VkSubpassDependency {
uint32_t srcSubpass; uint32_t srcSubpass;
uint32_t destSubpass; uint32_t dstSubpass;
VkPipelineStageFlags srcStageMask; VkPipelineStageFlags srcStageMask;
VkPipelineStageFlags destStageMask; VkPipelineStageFlags dstStageMask;
VkMemoryOutputFlags outputMask; VkMemoryOutputFlags outputMask;
VkMemoryInputFlags inputMask; VkMemoryInputFlags inputMask;
VkBool32 byRegion; VkBool32 byRegion;

View File

@@ -199,18 +199,18 @@ anv_device_init_meta_blit_state(struct anv_device *device)
.subpassCount = 1, .subpassCount = 1,
.pSubpasses = &(VkSubpassDescription) { .pSubpasses = &(VkSubpassDescription) {
.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS, .pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS,
.inputCount = 0, .inputAttachmentCount = 0,
.colorCount = 1, .colorAttachmentCount = 1,
.pColorAttachments = &(VkAttachmentReference) { .pColorAttachments = &(VkAttachmentReference) {
.attachment = 0, .attachment = 0,
.layout = VK_IMAGE_LAYOUT_GENERAL, .layout = VK_IMAGE_LAYOUT_GENERAL,
}, },
.pResolveAttachments = NULL, .pResolveAttachments = NULL,
.depthStencilAttachment = (VkAttachmentReference) { .pDepthStencilAttachment = &(VkAttachmentReference) {
.attachment = VK_ATTACHMENT_UNUSED, .attachment = VK_ATTACHMENT_UNUSED,
.layout = VK_IMAGE_LAYOUT_GENERAL, .layout = VK_IMAGE_LAYOUT_GENERAL,
}, },
.preserveCount = 1, .preserveAttachmentCount = 1,
.pPreserveAttachments = &(VkAttachmentReference) { .pPreserveAttachments = &(VkAttachmentReference) {
.attachment = 0, .attachment = 0,
.layout = VK_IMAGE_LAYOUT_GENERAL, .layout = VK_IMAGE_LAYOUT_GENERAL,

View File

@@ -737,18 +737,18 @@ void anv_CmdClearColorImage(
.subpassCount = 1, .subpassCount = 1,
.pSubpasses = &(VkSubpassDescription) { .pSubpasses = &(VkSubpassDescription) {
.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS, .pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS,
.inputCount = 0, .inputAttachmentCount = 0,
.colorCount = 1, .colorAttachmentCount = 1,
.pColorAttachments = &(VkAttachmentReference) { .pColorAttachments = &(VkAttachmentReference) {
.attachment = 0, .attachment = 0,
.layout = VK_IMAGE_LAYOUT_GENERAL, .layout = VK_IMAGE_LAYOUT_GENERAL,
}, },
.pResolveAttachments = NULL, .pResolveAttachments = NULL,
.depthStencilAttachment = (VkAttachmentReference) { .pDepthStencilAttachment = &(VkAttachmentReference) {
.attachment = VK_ATTACHMENT_UNUSED, .attachment = VK_ATTACHMENT_UNUSED,
.layout = VK_IMAGE_LAYOUT_GENERAL, .layout = VK_IMAGE_LAYOUT_GENERAL,
}, },
.preserveCount = 1, .preserveAttachmentCount = 1,
.pPreserveAttachments = &(VkAttachmentReference) { .pPreserveAttachments = &(VkAttachmentReference) {
.attachment = 0, .attachment = 0,
.layout = VK_IMAGE_LAYOUT_GENERAL, .layout = VK_IMAGE_LAYOUT_GENERAL,

View File

@@ -68,26 +68,28 @@ VkResult anv_CreateRenderPass(
const VkSubpassDescription *desc = &pCreateInfo->pSubpasses[i]; const VkSubpassDescription *desc = &pCreateInfo->pSubpasses[i];
struct anv_subpass *subpass = &pass->subpasses[i]; struct anv_subpass *subpass = &pass->subpasses[i];
subpass->input_count = desc->inputCount; subpass->input_count = desc->inputAttachmentCount;
subpass->color_count = desc->colorCount; subpass->color_count = desc->colorAttachmentCount;
if (desc->inputCount > 0) { if (desc->inputAttachmentCount > 0) {
subpass->input_attachments = subpass->input_attachments =
anv_device_alloc(device, desc->inputCount * sizeof(uint32_t), anv_device_alloc(device,
desc->inputAttachmentCount * sizeof(uint32_t),
8, VK_SYSTEM_ALLOC_TYPE_API_OBJECT); 8, VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
for (uint32_t j = 0; j < desc->inputCount; j++) { for (uint32_t j = 0; j < desc->inputAttachmentCount; j++) {
subpass->input_attachments[j] subpass->input_attachments[j]
= desc->pInputAttachments[j].attachment; = desc->pInputAttachments[j].attachment;
} }
} }
if (desc->colorCount > 0) { if (desc->colorAttachmentCount > 0) {
subpass->color_attachments = subpass->color_attachments =
anv_device_alloc(device, desc->colorCount * sizeof(uint32_t), anv_device_alloc(device,
desc->colorAttachmentCount * sizeof(uint32_t),
8, VK_SYSTEM_ALLOC_TYPE_API_OBJECT); 8, VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
for (uint32_t j = 0; j < desc->colorCount; j++) { for (uint32_t j = 0; j < desc->colorAttachmentCount; j++) {
subpass->color_attachments[j] subpass->color_attachments[j]
= desc->pColorAttachments[j].attachment; = desc->pColorAttachments[j].attachment;
} }
@@ -95,16 +97,22 @@ VkResult anv_CreateRenderPass(
if (desc->pResolveAttachments) { if (desc->pResolveAttachments) {
subpass->resolve_attachments = subpass->resolve_attachments =
anv_device_alloc(device, desc->colorCount * sizeof(uint32_t), anv_device_alloc(device,
desc->colorAttachmentCount * sizeof(uint32_t),
8, VK_SYSTEM_ALLOC_TYPE_API_OBJECT); 8, VK_SYSTEM_ALLOC_TYPE_API_OBJECT);
for (uint32_t j = 0; j < desc->colorCount; j++) { for (uint32_t j = 0; j < desc->colorAttachmentCount; j++) {
subpass->resolve_attachments[j] subpass->resolve_attachments[j]
= desc->pResolveAttachments[j].attachment; = desc->pResolveAttachments[j].attachment;
} }
} }
subpass->depth_stencil_attachment = desc->depthStencilAttachment.attachment; if (desc->pDepthStencilAttachment) {
subpass->depth_stencil_attachment =
desc->pDepthStencilAttachment->attachment;
} else {
subpass->depth_stencil_attachment = VK_ATTACHMENT_UNUSED;
}
} }
*pRenderPass = anv_render_pass_to_handle(pass); *pRenderPass = anv_render_pass_to_handle(pass);