Jump to content
  • Advertisement
ekba89

Vulkan Vulkan synchronization issue

Recommended Posts

Hi,

I am trying to fix an issue I am seeing with my engine using Vulkan. I tested my code on 2 pcs and on one of them with debug build I get flicker while moving the camera which seems to be caused by accessing wrong constant buffer values. Considering it doesn't happen with both pcs and release build makes me believe that it is a synchronization issue. That said I made some tests which proved otherwise. 

To give some details about my code, I have rendering setup in a way that cpu can record up to 3 frames ahead of the gpu and then I wait with a fence. So all the resources are tripled and I access the proper one for each frame. Currently for my test case I have 3 render threads, each having their own command buffer. First thread just does vkCmdUpdateBuffer on the buffers that will be used for other command buffers. I have pipeline barriers with srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT and dstAccessMask = VK_ACCESS_UNIFORM_READ_BIT for each update(for now) to make sure it works. Second thread fills the command buffer for gbuffer rendering. And last thread fills the command buffer for lighting. At the beginning of the lighting command buffer there is a pipeline barrier with VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, VK_ACCESS_SHADER_READ_BIT, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL to make sure all writes to it finished. And after light draw I just convert the gbuffer render targets their old format using VK_ACCESS_SHADER_READ_BIT, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL. Once all the threads are done I submit each command buffer individually(I will get to this in a little bit), with the order I mentioned. 1-Update command buffer 2-Gbuffer command buffer 3-Light command buffer.

So from what I understand from Vulkan docs pipeline barriers are creating dependency in the commands given to a single queue. So it shouldn't matter which command buffer does the barrier. In my case for example, using the buffer barrier with srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT,  dstAccessMask = VK_ACCESS_UNIFORM_READ_BIT should make that buffer available for uniform read in the future commands even if they were in another command buffer. So to find the issue tried bunch of stuff. First tried getting capture with renderdoc but I couldn't reproduce the issue when I run my app with renderdoc. Seems like it is forcing the command to happen linearly. I am not sure if there are any other tool that does similar thing. Then I tried using vkQueueWaitIdle which solved the issue as I was expecting. And I kept the most interesting to the last :). Instead of submitting the command buffers individually, if I submit as batch with VkSubmitInfo.commandBufferCount = 3, I don't see the issue happening anymore. Also in a similar fashion instead of using separate command buffers with their own Begin and End, if I use 1 command buffer and just fill that command buffer with these commands in the order I mentioned, again I don't see the issue. 

Thanks in advance.

 

Share this post


Link to post
Share on other sites
Advertisement

Further update this. I tried using semaphores so that each command buffer waits for the previous one and that worked fine which I was already expecting it to work. So for anyone that doesn't want to read the whole thing, the question is that do pipeline barriers work between multiple command buffers. For example I have command buffer A and command buffer B. A has some buffer updates and global memory barrier with src=BOTTOM_OF_PIPE and dest=TOP_OF_PIPE, and B has draw commands using those buffers. If I do vkQueueSubmit(A) and vkQueueSubmit(B), is it supposed to make all the commands on B wait for global memory barrier?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
  • Advertisement
  • Popular Tags

  • Similar Content

    • By Paul Bto
      State of the search
      I'm not looking / I'm still looking
       
      Description
      It is a third person game where you join more players to fight against bosses in the PvE style of the mmorpg, looking for online companions to help you defeat your enemy, where everyone does their respective work, such as tank, dps or heal, in groups of 5 or 10 players.
      The difference with other mmorpg is that here, since there is no open world, you will not have to go through it doing hundreds of missions and using many hours to get to the content that really interests you, which, in the case of PvE, are the dungeons and raids.
       
      Objectives of the project
      For this project we will first make a demo that will only be the boss of a 5 player dungeon.
      The first phase of this project is to release a video gameplay for crowdfunding (kickstarter maybe), so we will focus more on the visual, which could be falsified if the mechanics do not work. If the crowdfunding gives green light would be the game, which if in turn would work would be updated in the future with more dungeons and bands. The ideal would be to make a playable demo.
       
      Compensation
      If this game generates benefits outside crowdfunding, the profits will be distributed depending on the work and disbursement of each one.
       
      Technology
      Unreal. If you want to learn how to use this software with the project, you can.
       
      Required profiles
      - At the moment 2 Programmers (if has multiplayer knowledge in Unreal better).
       
      - 1 2D Artist to make the interface design and some concepts. You are going to try make interfaces like this:

      It would be ideal if you can devote at least 7 hours by week.
      It is a plus if you have experience with high level PvE content in some mmorpg.
       
      Team structure
      Pablo. Environment artist.
      Diego. Character artist.
       
      Web
      Waiting until the equipment is assembled.
       
      Contact
      pablo.barreto.jimenez@gmail.com
       
      Additional Information
      I have the GDD, it depends on the work but, I think the demo could be done in 6 months.
      Here I leave some images of what I did of the project in Unity, where basically I have been testing (The project will be done in Unreal):



       
      Desired feedback
      If you think you can give me some advice about the project, feel free to give your opinion.
       
    • By Hellados
      Hello guys, my name is Giorgi and i'm newbie game developer i'm learning Pixel art and after pixel art  i want learn C# and don't know how and where start i'm bad with programming language and know only HTML/CSS
    • By N Drew
      I am working on a 2D SideScroller game in my own made game engine using SFML and C++.I am searching for 2D artists,especially pixel artist for making and animating characters,backgrounds and other props that can be made in any Drawing Program.The artist will become part of the team of Hammer Studios and he got a part of the Revenue Sharing.If you are interested send me a mail at:ghiurcutaandrei@gmail.com .If you are not an artist but you want to be a part of our Team,Soon we will be recruiting an C++ AI programmers that worked in SFML/OpenGL.
      We work together using Discord.

    • By LukeCassa005
      I'm writing a small 3D Vulkan game engine using C++. I'm working in a team, and the other members really don't know almost anything about C++. About three years ago i found this new programming language called D wich seems very interesting, as it's very similar to C++. My idea was to implement core systems like rendering, math, serialization and so on using C++ and then wrapping all with a D framework, easier to use and less complicated. Is it worth it or I should stick only to C++ ? Does it have less performance compared to a pure c++ application ?
    • By Ike aka Dk
      Hello everyone 
      I am a programmer from Baku.
      I need a 3D Modeller for my shooter project in unity.I have 2 years Unity exp.
      Project will paid when we finish the work 
      If you interested write me on email:
      mr.danilo911@gmail.com
    • By HawkDeath
      Hi,
      I'm trying mix two textures using own shader system, but I have a problem (I think) with uniforms.
      Code: https://github.com/HawkDeath/shader/tree/test
      To debug I use RenderDocs, but I did not receive good results. In the first attachment is my result, in the second attachment is what should be.
      PS. I base on this tutorial https://learnopengl.com/Getting-started/Textures.


    • By Cello Gaming
      Hello I am looking for a team who are willing to work on a Realistic, Large, Story-based, Open-World, Survival, Horror game. I'm looking for a team that is willing to stay with me through the whole project. 
      For this project I will be needing:
      3D Modeler: Somebody who has a good understanding on how to create 3D models through Blender, Maya, 3DS Max, or any other Modeling programs of their choosing Animator: Someone able to rig and animate humans, non-humans, and machines. Artist: Someone able to make art for loading screens, GUIs, and Cover art. Environment Artist (2-3): Someone able to create a large open world for the players to explore Writer: Someone who has experience writing story-lines and can write dialogue for this project Sound Engineer: Somebody who can create sounds for character movements, environment, and animals     Ideas for The Project: - Shipwrecked on an island after getting caught in a storm out on the ocean - Start on the boat with all your friends and a bunch of NPCs where the ship doesn't crash until you talk to the captain - Able to search wreckage to find food, water, and a basic tool. - Locked areas in the wreckage that you need special tools or codes to open. - Secret chests you can find on the island through maps that you can find in abandoned houses, shacks, and wreckage of pirate ships. - Fishing rods to go fishing for different kinds of fish. - Cooking system to cook food on a grill or campfire which requires propane tanks or wood to continue burning - Underwater and land caves with plenty of resources - Mutant bosses that you can fight above or under water - Underwater life (Sharks, Fish, Large underwater Squid boss)   These are just ideas they may or may not be implemented in the final product. Any feedback on ideas for the game would be appreciated.   We will be setting up a kickstarter for people to support this, if this project gets up going, so watch for that.  
    • By Luca Falco
      https://www.youtube.com/watch?v=UMoc52DEoC8     ABOUT THE GAME: Room54 is a first-person Horror/adventure  Videogame for pc,mac and linux users. the game is currently under development by a very small team, we put so much effort in this project and we are keep doing our best for that we are going to launch a kickstarter campaing in order to reach our ideal budget to complete the project, we hope the GameDev community can help us a lot                      STORY:   Daniel is a family father like many other, one day he decide with your wife and his daughter  to spend her winter holidays at their mountain house that they have recently buy in  mountain ,a  wonderful place surrounded by the nature of the woods,  Completely far away from the caotic city life. During their holidays Daniel and his family will understand that they are not welcome there and they will discover an  hided and disturbing part of the valley that they have never seen before                       GAMEPLAY:   You will play as Daniel, a father that will try to save his family, your gameplay will be focused on discovering secrets places around valley,investigating and trying to survive, you will find object that will help you solve enigma and to stay alive. The immersive audio and  environment will make you feel constantly follow by an high anxiety dose  during the game.                         SOCIAL PAGES:     Follow us to get the latest development news and insights     IndieDB:     http://www.indiedb.com/games/room54   Twitter:       https://twitter.com/Room54Thegame   facebook:   https://www.facebook.com/Room54/
    • By this. games
      [Free]
      Looking For: 2d Artist and Animator.
      Requirements: Experience in 2d art and ability to commit to 1-2 years of work.
      Payment: Rev-Share (Think Free as the product may not end up being sold)
      Description: An 3/4 view 2d game with a Sci-fi style. The game is based on a man who was put into stasis for punishment for his crimes. He has woken up 100 years later and must now regain his position at the top of the criminal underworld by killing his opponents. There will be a "Hub World" city and then PCG gang hideouts where you fight enemies. The assets required will be tile sets for the different hideouts, assets for the city ie buildings streets etc. and characters both the player and a number of enemies.
       
      Send resume and portfolio to thisdotgames@gmail.com if you are interested.
    • By Hive Entertainment
      Hey everyone we are looking for a 2d artist for health bars, inventory, items, weapons ect. Unfortunately I can not pay at this point in time however if you are interested please let me know and I am sure we can work something out. I am also looking for landscape modelers in 3d message me for more details or email me at hiveentertainmenttech@gmail.com




  • Advertisement
  • Popular Now

  • Forum Statistics

    • Total Topics
      631378
    • Total Posts
      2999665
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!