How do we know if a command buffer is being recorded or not?

Also are we allowed to end the recording of a command buffer without having recorded any operations in it? Does the return value of

vkBeginCommandBuffer()

indicate anything about the state of the command buffer? Thank you in advance.

How do we know if a command buffer is being recorded or not?

You created it and you either did or did not start recording into it. Vulkan is an API for grownups; it is up to you to keep track of the stuff that you yourself do.

If your program’s structure is not such that this information is obvious by its structure or contractually assumed, then you should keep track of it yourself. But it’s better to structure your program so that the question never needs to be asked.

Also are we allowed to end the recording of a command buffer without having recorded any operations in it?

Is there a Valid Usage statement on vkEndCommandBuffer that would prevent it? If not, then you’re allowed to do it.

Does the return value of vkBeginCommandBuffer indicate anything about the state of the command buffer?

What would it need to “indicate” “about the state of the command buffer”? Recording can either begin successfully or emit one of the error codes listed in the specification/documentation.

Yeah, I get that. I did take a look at the registry to see what it said about this as well. I only wanted to confirm that this was the case.

If your program’s structure is not such that this information is obvious by its structure or contractually assumed, then you should keep track of it yourself. But it’s better to structure your program so that the question never needs to be asked.

It is readily apparent in my code as to whether or not a command buffer is being recorded, so I don’t think I will run into this problem.

Thank you for the advice.

Use the validation layers, if your command buffer isn’t in an appropriate state when you manage it, they will notify you. Just make sure that in the “release” version of your program, every scenario that could end in a warning from those layers is avoided.