Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-swiftshader: Commit

external/swiftshader


Commit MetaInfo

Revision67806a1738a25f04e0af2406d0fb562e59e19a48 (tree)
Time2019-04-06 05:12:15
AuthorAlexis Hetu <sugoi@goog...>
CommiterAlexis Hétu

Log Message

Input aspect support in vkCreateRenderPass

Added support for:
VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO
VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO
in vkCreateRenderPass.

These only add extra validations, but don't modify the renderpass' behavior.

Bug b/119620965

Change-Id: I0102a4f7fdd9f57de4ef7b0a813ead951dafe0bb
Tests: dEQP-VK.renderpass.*_use_input_aspect
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28448
Tested-by: Alexis Hétu <sugoi@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>

Change Summary

Incremental Difference

--- a/src/Vulkan/libVulkan.cpp
+++ b/src/Vulkan/libVulkan.cpp
@@ -318,7 +318,6 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice physicalDevice, c
318318 }
319319 }
320320
321-
322321 const VkBaseInStructure* extensionCreateInfo = reinterpret_cast<const VkBaseInStructure*>(pCreateInfo->pNext);
323322
324323 while(extensionCreateInfo)
@@ -1236,9 +1235,91 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass(VkDevice device, const VkRende
12361235 TRACE("(VkDevice device = 0x%X, const VkRenderPassCreateInfo* pCreateInfo = 0x%X, const VkAllocationCallbacks* pAllocator = 0x%X, VkRenderPass* pRenderPass = 0x%X)",
12371236 device, pCreateInfo, pAllocator, pRenderPass);
12381237
1239- if(pCreateInfo->pNext || pCreateInfo->flags)
1238+ if(pCreateInfo->flags)
12401239 {
1241- UNIMPLEMENTED("pCreateInfo->pNext || pCreateInfo->flags");
1240+ UNIMPLEMENTED("pCreateInfo->flags");
1241+ }
1242+
1243+ const VkBaseInStructure* extensionCreateInfo = reinterpret_cast<const VkBaseInStructure*>(pCreateInfo->pNext);
1244+
1245+ while(extensionCreateInfo)
1246+ {
1247+ switch(extensionCreateInfo->sType)
1248+ {
1249+ case VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO:
1250+ {
1251+ const VkRenderPassInputAttachmentAspectCreateInfo* inputAttachmentAspectCreateInfo = reinterpret_cast<const VkRenderPassInputAttachmentAspectCreateInfo*>(extensionCreateInfo);
1252+
1253+ for(uint32_t i = 0; i < inputAttachmentAspectCreateInfo->aspectReferenceCount; i++)
1254+ {
1255+ const VkInputAttachmentAspectReference& aspectReference = inputAttachmentAspectCreateInfo->pAspectReferences[i];
1256+ ASSERT(aspectReference.subpass < pCreateInfo->subpassCount);
1257+ const VkSubpassDescription& subpassDescription = pCreateInfo->pSubpasses[aspectReference.subpass];
1258+ ASSERT(aspectReference.inputAttachmentIndex < subpassDescription.inputAttachmentCount);
1259+ const VkAttachmentReference& attachmentReference = subpassDescription.pInputAttachments[aspectReference.inputAttachmentIndex];
1260+ if(attachmentReference.attachment != VK_ATTACHMENT_UNUSED)
1261+ {
1262+ // If the pNext chain includes an instance of VkRenderPassInputAttachmentAspectCreateInfo, for any
1263+ // element of the pInputAttachments member of any element of pSubpasses where the attachment member
1264+ // is not VK_ATTACHMENT_UNUSED, the aspectMask member of the corresponding element of
1265+ // VkRenderPassInputAttachmentAspectCreateInfo::pAspectReferences must only include aspects that are
1266+ // present in images of the format specified by the element of pAttachments at attachment
1267+ vk::Format format(pCreateInfo->pAttachments[attachmentReference.attachment].format);
1268+ bool isDepth = format.isDepth();
1269+ bool isStencil = format.isStencil();
1270+ ASSERT(!(aspectReference.aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) || (!isDepth && !isStencil));
1271+ ASSERT(!(aspectReference.aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) || isDepth);
1272+ ASSERT(!(aspectReference.aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) || isStencil);
1273+ }
1274+ }
1275+ }
1276+ break;
1277+ case VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO:
1278+ {
1279+ const VkRenderPassMultiviewCreateInfo* multiviewCreateInfo = reinterpret_cast<const VkRenderPassMultiviewCreateInfo*>(extensionCreateInfo);
1280+ ASSERT((multiviewCreateInfo->subpassCount == 0) || (multiviewCreateInfo->subpassCount == pCreateInfo->subpassCount));
1281+ ASSERT((multiviewCreateInfo->dependencyCount == 0) || (multiviewCreateInfo->dependencyCount == pCreateInfo->dependencyCount));
1282+
1283+ bool zeroMask = (multiviewCreateInfo->pViewMasks[0] == 0);
1284+ for(uint32_t i = 1; i < multiviewCreateInfo->subpassCount; i++)
1285+ {
1286+ ASSERT((multiviewCreateInfo->pViewMasks[i] == 0) == zeroMask);
1287+ }
1288+
1289+ if(zeroMask)
1290+ {
1291+ ASSERT(multiviewCreateInfo->correlationMaskCount == 0);
1292+ }
1293+
1294+ for(uint32_t i = 0; i < multiviewCreateInfo->dependencyCount; i++)
1295+ {
1296+ const VkSubpassDependency &dependency = pCreateInfo->pDependencies[i];
1297+ if(multiviewCreateInfo->pViewOffsets[i] != 0)
1298+ {
1299+ ASSERT(dependency.srcSubpass != dependency.dstSubpass);
1300+ ASSERT(dependency.dependencyFlags & VK_DEPENDENCY_VIEW_LOCAL_BIT);
1301+ }
1302+ if(zeroMask)
1303+ {
1304+ ASSERT(!(dependency.dependencyFlags & VK_DEPENDENCY_VIEW_LOCAL_BIT));
1305+ }
1306+ }
1307+
1308+ // If the pNext chain includes an instance of VkRenderPassMultiviewCreateInfo,
1309+ // each element of its pViewMask member must not include a bit at a position
1310+ // greater than the value of VkPhysicalDeviceLimits::maxFramebufferLayers
1311+ // pViewMask is a 32 bit value. If maxFramebufferLayers > 32, it's impossible
1312+ // for pViewMask to contain a bit at an illegal position
1313+ // Note: Verify pViewMask values instead if we hit this assert
1314+ ASSERT(vk::Cast(vk::Cast(device)->getPhysicalDevice())->getProperties().limits.maxFramebufferLayers >= 32);
1315+ }
1316+ break;
1317+ default:
1318+ UNIMPLEMENTED("extensionCreateInfo->sType");
1319+ break;
1320+ }
1321+
1322+ extensionCreateInfo = extensionCreateInfo->pNext;
12421323 }
12431324
12441325 return vk::RenderPass::Create(pAllocator, pCreateInfo, pRenderPass);
Show on old repository browser