Repository navigation
Fix colorAttachmentCount error in dynamicrenderinglocalread example #1268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 4 commits
e16a70f
47e55ba
c101810
5ae2c86
891a531
3e5942f
6aa2ee4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,6 +101,20 @@ class VulkanExample : public VulkanExampleBase | |
| .synchronization2 = VK_TRUE, | ||
| }; | ||
| deviceCreatepNextChain = &enabledSynchronization2FeaturesKHR; | ||
|
|
||
| #if (defined(VK_USE_PLATFORM_IOS_MVK) || defined(VK_USE_PLATFORM_METAL_EXT)) && TARGET_OS_SIMULATOR | ||
| static const VkBool32 valueFalse = VK_FALSE; | ||
|
|
||
| // On iOS Simulator use layer setting to disable MoltenVK's Metal argument buffers - otherwise blank display | ||
| VkLayerSettingEXT layerSetting; | ||
| layerSetting.pLayerName = "MoltenVK"; | ||
| layerSetting.pSettingName = "MVK_CONFIG_USE_METAL_ARGUMENT_BUFFERS"; | ||
| layerSetting.type = VK_LAYER_SETTING_TYPE_BOOL32_EXT; | ||
| layerSetting.pValues = &valueFalse; | ||
| layerSetting.valueCount = 1; | ||
|
|
||
| enabledLayerSettings.push_back( layerSetting ); | ||
| #endif | ||
| } | ||
|
|
||
| ~VulkanExample() | ||
|
|
@@ -124,6 +138,8 @@ class VulkanExample : public VulkanExampleBase | |
| for (auto& buffer : uniformBuffers) { | ||
| buffer.destroy(); | ||
| } | ||
| vkDestroyBuffer(device, lightsBuffer.buffer, nullptr); | ||
| vkFreeMemory(device, lightsBuffer.memory, nullptr); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -156,7 +172,7 @@ class VulkanExample : public VulkanExampleBase | |
| } | ||
|
|
||
| // Enable physical device features required for this example | ||
| virtual void getEnabledFeatures() | ||
| virtual void getEnabledFeatures() override | ||
| { | ||
| // Enable anisotropic filtering if supported | ||
| if (deviceFeatures.samplerAnisotropy) { | ||
|
|
@@ -440,7 +456,7 @@ class VulkanExample : public VulkanExampleBase | |
| } | ||
| } | ||
|
|
||
| void prepare() | ||
| void prepare() override | ||
| { | ||
| VulkanExampleBase::prepare(); | ||
| // Since we use an extension, we need to expliclity load the function pointers for extension related Vulkan commands | ||
|
|
@@ -494,7 +510,7 @@ class VulkanExample : public VulkanExampleBase | |
| colorAttachments[i] = { | ||
| .sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO, | ||
| .imageView = imageViewList[i], | ||
| .imageLayout = VK_IMAGE_LAYOUT_RENDERING_LOCAL_READ_KHR, | ||
| .imageLayout = (i == 0) ? VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL : VK_IMAGE_LAYOUT_RENDERING_LOCAL_READ_KHR, | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this needs fixing. IMO this is a false positive and I've raised an issue in the VVL repo about this.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting. Referring to your issue KhronosGroup/Vulkan-ValidationLayers#12039 where you discuss MoltenVK does not support this extension so I can't test there. However, I will try on my Windows 11 and linux machines to see if my AMD card supports it, and report back later.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Scratch that idea re the I will leave my original change in place for now and resolve once your VVL issue is looked at.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @SaschaWillems I have given up waiting for the VVL team to fix this defect. I have reverted my workaround in this PR and limited the scope to fixing the remaining Should now be ready for your review and merge. |
||
| .resolveMode = VK_RESOLVE_MODE_NONE, | ||
| .loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR, | ||
| .storeOp = VK_ATTACHMENT_STORE_OP_STORE, | ||
|
|
@@ -565,6 +581,15 @@ class VulkanExample : public VulkanExampleBase | |
| vkCmdBindDescriptorSets(cmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, passes.composition.pipelineLayout, 0, 1, &passes.composition.descriptorSet, 0, nullptr); | ||
| vkCmdDraw(cmdBuffer, 3, 1, 0, 0); | ||
|
|
||
| vkCmdEndRenderingKHR(cmdBuffer); | ||
|
|
||
| // Update renderingInfo to use current swapchain image as single color attachment for the UI | ||
| colorAttachments[0].imageView = swapChain.imageViews[currentImageIndex]; | ||
| colorAttachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD; | ||
| renderingInfo.colorAttachmentCount = 1; | ||
|
|
||
| vkCmdBeginRenderingKHR(cmdBuffer, &renderingInfo); | ||
|
|
||
| drawUI(cmdBuffer); | ||
|
|
||
| vkCmdEndRenderingKHR(cmdBuffer); | ||
|
|
@@ -584,7 +609,7 @@ class VulkanExample : public VulkanExampleBase | |
| VK_CHECK_RESULT(vkEndCommandBuffer(cmdBuffer)); | ||
| } | ||
|
|
||
| virtual void render() | ||
| virtual void render() override | ||
| { | ||
| if (!prepared) | ||
| return; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.