Comments (4)
Good observations!
- Agreed. We could use dynamic UB bindings here to make sure individual swapchain frames are assigned non-overlapping, exclusive regions of memory they would be operating on.
Will fix this for the next update.
Random trivia: sounds like this is something the validation layers should capture, eh?
- I have to disagree here. A few starting points:
- the app uses the FIFO presentation mode;
- our swapchain is built of 3 swapchain images.
- acquire_image_by_setting_semaphore() implicitly calls vkAcquireNextImageKHR()
You said that vkAcquireNextImageKHR()
cannot be counted on the behavior of blocking till the next image becomes available. What I understand by next image is any swapchain image which is re-used (ie. it is not being acquired for the first time). Am I following you correctly?
If so, let's continue. Anvil's acquire function uses a timeout of UINT64_MAX and checks the VK result for any errors that may be reported by the func. Furthermore, we do specify a wait & a signal semaphore in order to ensure GPU does not write to the same swapchain image without first having it presented. That should defend us from any GPU-side sync issues, correct?
Now, from the CPU side, granted that no assertion failure is being reported right after we are being returned execution flow by vkAcquireNextImageKHR(), I'm assuming we're also protected on the CPU end. Fences are heavy-hammered. I may be wrong here but my understanding is you'd only use them for some sort of inter-process or inter-device synchronization, for which semaphores would not be a good fit.
Am I missing something trivial in the picture here?
from anvil.
I've picked Dan's brains on 2) and after a bit of a brainstorm we concluded that you're right about the CPU aspect. We're going ot need that CPU-levle sync in order to make things aligned with the spec.
Thanks for spotting this! It's definitely not a trivial bug. It seems like it's a good candidate for validation layer improvement.
from anvil.
What I understand by next image is any swapchain image which is re-used (ie. it is not being acquired for the first time). Am I following you correctly?
Ah - I think this is where there's confusion, and I must admit I spent way too much time reading the Vulkan Spec to try and understand this and the consequences of it. It's allowed to return as long as:
- It knows which image it's going to give you next
- It can guarantee the semaphore will be signalled
- It can guarantee the fence will be signalled
1 is extremely important, because it means that if it just uses a simple round-robin algorithm then it's allowed to just quickly push the index, semaphore, and fence into a list and return immediately with the prediction.
This means the presentation engine is allowed to give you an index that it already has queued in its FIFO, and that the same index is allowed to appear multiple times in the FIFO with different semaphores and fences.
In fact, if the presentation engine weren't running for some reason, its FIFO could get filled up to system memory capacity with "1,2,3,1,2,3,1,2,3,1,2,3,1,2,3..." and it would still be a valid implementation.
from anvil.
Both issues have been fixed internally. The relevant fixes will land in the update planned for this week.
from anvil.
Related Issues (20)
- Why can't the user recreate swapchains?
- Suggestion: Add CMake option to use SDK location for glslang library HOT 2
- BaseDevice::is_extension_enabled does not work with instance extensions?
- VK_ERROR_EXTENSION_NOT_PRESENT error if device group extension is not supported by GPU HOT 2
- Not building on ubuntu 18.10 HOT 3
- Unhandled VK_ERROR_OUT_OF_DATE_KHR when Anvil-based program with window is minimized with Nvidia drivers HOT 3
- Queue::submit with blocking-flag set does not guarantee command buffer completion? HOT 1
- Assertion failure when using specialization constants HOT 1
- Assertion failure in BaseDevice::init with a Radeon R9 Fury HOT 1
- GCC 8+ does not compile successfully. (-Werror=class-memaccess) HOT 5
- Crash when submitting queue on Nvidia GPUs HOT 2
- Why is HLSL support turned off if ANVIL_LINK_WITH_GLSLANG flag is set? HOT 1
- record_bind_pipeline(..., PipelineID) is a O(logn) function, n count of pipelines. A faster alternative might should be added.
- QueryPool::get_query_pool_results calculates query size incorrectly
- Concerning wstring-to-string conversion in WIN32 implementation HOT 1
- Unusable with NVidia HOT 1
- get_image_format_properties uses stencil usage flags of 0, which is not allowed
- Error compiling with GCC 9 on Linux HOT 1
- Error Compiling with VS CMake HOT 2
- Is there any future roadmap? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anvil.