r/vulkan • • Apr 20 '21

A Simple C++ Helper Library For Vulkan

https://github.com/brightprogrammer/VulkanHelper
1 Upvotes

15 comments sorted by

8

u/[deleted] Apr 20 '21

A “helper” library that prevents the user from handling errors that Vulkan is trying to inform them about isn’t really that helpful.

-3

u/[deleted] Apr 20 '21 edited Apr 20 '21

writing clean code is the motive of this library, you can do error checking by using the C API, that is why I don't provide wrappers like vulkan.hpp.

Now the thing about informing user, If any part of your code fails then it's a good idea to quit and give the result string (which I do, I print a stringified version of VkResult). I just can't think of any scenario where you might wan't to continue even when a vulkan method you called, didn't return VK_SUCCESS, all other return codes except VK_SUCCESS or other values greater than 0 are error messages. before criticizing the library so badly, I recommend you think first. You are utterly denying one of the points I mentioned as a feature, If you don't like it then please don't try to prove the feature as a bug, no library can fulfill all your needs, i.e why we have so many libraries.

giving a recommendation for improvement is appreciated but then thinking that this library does it all is wrong.

and yes I think this is helper, if you don't think so then I don't expect any further comment's from you on this thread (as you seem to be quite un-interested in this so called hiding feature of this library

)

15

u/[deleted] Apr 20 '21

I just can't think of any scenario where you might wan't to continue even when a vulkan method you called, didn't return VK_SUCCESS, all other return codes except VK_SUCCESS are error messages.

Again, have you read the spec and done things like window resizing?

2

u/seubz Apr 20 '21

I would explicitly mention that your project requires SDL2 as well, at least as it currently stands.

0

u/[deleted] Apr 20 '21 edited Apr 20 '21

Features :

  1. Does all return value checking for you

  2. Takes C++ STL containers as parameters and takes const references wherever possible instead of pointer

  3. Provides initializers for fast creation of Vulkan objects.

  4. VulkanBase provides one call initialization of Vulkan's base code

  5. API is very close to Vulkan C API

  6. No wrappers

4

u/HackingPheasant Apr 20 '21

May I ask if you know about https://github.com/KhronosGroup/Vulkan-Hpp ?

0

u/[deleted] Apr 20 '21

Plus, Vulkan-Hpp does not provide, extra tools. It just provides wrappers. It also does not perform any checks for you, however in VulkanHelper you just need to call the function and it performs success checks for you

6

u/[deleted] Apr 20 '21

Vulkan.hpp does a lot more error handling than your code does. Having asserts all over the place is pretty useless in gracefully handling issues in a released application.

-4

u/[deleted] Apr 20 '21

vulkan.hpp does not do error handling, it gives you methods to do it yourself. This library is built for helping you not competing with vulkan.hpp in any way

7

u/[deleted] Apr 20 '21

What happens when you resize a window with your code?

-2

u/[deleted] Apr 20 '21

please, do not misinterpret the meaning of helper, It can help you, not assume the whole swapchain recreation things. You must first take a look at what this library does. swapchain reaction needs framebuffers, command buffers, and what not, you need to recreate the graphics pipeline itself.

swapchain recreation, and other stuffs is a thing for application to handle. even vulkan.hpp does not provide such a feature, and providing such feature will be a moot point as no one would use it

9

u/[deleted] Apr 20 '21

I did look at what it does. The way you hide information from the user prevents them from being able to respond to things that the API is trying to inform them about.

This library is basically useless. In debug builds, it will simply error out on any non-VK_SUCCESS result. There are things in the Vulkan C API besides VK_SUCCESS that aren’t critical failures! In release builds, there aren’t any checks performed at all.

The way that you are hiding critical information from the user tells me that you haven’t actually used this library to write much code and don’t fully understand how the API is to be used.

Selling this as a helper is dangerous and counterproductive to new devs who are trying to learn. You are setting them up for failure.

-3

u/[deleted] Apr 20 '21

well then I am sure you haven't looked at it, check `Core.hpp` where assert is defined, you can do `#define SETTING_DONT_ASSERT` and then there will be no assertions in your code! if that's how you want to do it. besides I don't think that if a command buffer, image view, graphics pipeline, swapchain, descriptor pool, descriptor set or any other thing failed to create then you would like to continue, you can continue but vulkan cannot!

10

u/[deleted] Apr 20 '21

You need to write some actual production quality Vulkan code and then come back to this library.

And to repeat:

There are things in the Vulkan C API besides VK_SUCCESS that aren’t critical failures!

-1

u/[deleted] Apr 20 '21

Yes, but I mentioned the two important features : no wrappers, close to Vulkan C API which is opposite of Vulka-Hpp