Jump to content
  • Advertisement
Sign in to follow this  
Ryan_001

Vulkan Vulkan command pools and buffer questions

This topic is 1025 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Been reading through the Vulkan 1.0 spec and I have a few small questions about command pools, buffers, and render targets.

 

Command Pools:

- When vkResetCommandPool() is called are the command buffers just reset or are they destroyed and have to be recreated?

- On page 49, it states:

– VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT controls whether command buffers allocated
from the pool can be individually reset. If this flag is set, individual command buffers allocated from the pool can be
reset either explicitly, by calling vkResetCommandBuffer, or implicitly, by calling
vkBeginCommandBuffer on an executable command buffer. If this flag is not set, then
vkResetCommandBuffer and vkBeginCommandBuffer (on an executable command buffer) must not be
called on the command buffers allocated from the pool, and they can only be reset in bulk by calling
vkResetCommandPool.

 

If I can't call vkBeginCommandBuffer(), how would a command buffer ever be used?  Isn't it a requirement to call vkBeginCommandBuffer() prior to recording any commands in the buffer?  Is it that command buffers from a pool without the bit set are already implicitly in a 'recording' state and vkBeginCommandBuffer() isn't required or is vkBeginCommandBuffer() only callable once and can't be used a second time to reset the command buffer (it seems to imply the latter in 5.3 but doesn't really out right state it)?

 

Command Buffers:

- I am a bit uncertain about the VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT.  I take it without setting this bit, a command buffer can only be used once at any given time?  Later on, on page 59, it seems to suggest not using this bit can lead to increased performance, but in order to re-use a command buffer it seems almost a necessity to have this bit set.  When re-using a command buffer: are they expecting us to record multiple identical command buffers and rotate them for optimal performance, or does the bit not really matter performance-wise and set it and forget, or am I reading the whole thing wrong and a command buffer can be used when/where-ever as long as its not reset and/or destroyed during its use?  It just seems strange to me that a seemingly read-only structure (ie. the command buffer) would need a special bit set to indicate that it can be read from multiple locations.

 

Render Targets:

- The documentation seems to imply these are required.  Knowing access dependencies seems important so I can see why it would be a necessity.  But in the documentation of many of the functions it seems to imply that they aren't required.  For example, on page 66 the repeated use of the phrase "if vkCmdExecuteCommands is being called within a render pass ...", seems to imply that a render pass is optional.  Are they required at all times?  Required for graphical commands but ignored for compute/other commands?  Are they optional but good to have for performance benefit?

Share this post


Link to post
Share on other sites
Advertisement


If I can't call vkBeginCommandBuffer(), how would a command buffer ever be used? Isn't it a requirement to call vkBeginCommandBuffer() prior to recording any commands in the buffer? Is it that command buffers from a pool without the bit set are already implicitly in a 'recording' state and vkBeginCommandBuffer() isn't required or is vkBeginCommandBuffer() only callable once and can't be used a second time to reset the command buffer (it seems to imply the latter in 5.3 but doesn't really out right state it)?

 

You can call it once, while the command buffer is still in the "initial state", and it only becomes executable after some commands have been recorded into it for the first time; see the first few paragraphs of "Chapter 5. Command Buffers".

 


- When vkResetCommandPool() is called are the command buffers just reset or are they destroyed and have to be recreated?

 

I'm not sure but I think it only resets it, but it may release internally-used host memory depending on the flags passed (that memory would presumably be allocated back when recording a new batch of commands in that command buffer).

 

Also experimenting with Vulkan so take my comments with a grain of salt smile.png

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!