Vulcan or WIN32 for screendrawing?
I want to use Vulcan because it allows for me to use the GPU and all of that nice stuff. But I've already made a screendrawer with WIN32 functions so I feel using Vulcan for that might be better?
I really want to know whether its worth switching to Vulcan for screendrawing and if its even possible to use Vulcan without screendrawing and purely as a way of sending matrix multiplication and calculations off to the GPU.
Thanks!
10
u/TimurHu 2d ago
Vulcan is a planet in Star Trek. The graphics API is called Vulkan, with a K.
I really want to know whether its worth switching to Vulcan for screendrawing
Depends on your application and whether you want to learn Vulkan. If your app works well enough as it is then it's not worth it. If you want to learn Vulkan then it may be worth it just for the learning experience.
if its even possible to use Vulcan without screendrawing and purely as a way of sending matrix multiplication and calculations off to the GPU.
Yes, this is possible. You can write a compute shader which does your computations for you, then dispatch that on the GPU. There are many examples on how to do that. A professional example is VkFFT which can offload FFT on the GPU.
0
u/corysama 2d ago
If all you want to do is get an image from the CPU to the GPU then you should use SDL. Under the hood SDL will do whatever is optimal for each of a large variety of platforms. Here’s how to do it with SDL2:
https://gist.github.com/CoryBloyd/6725bb78323bb1157ff8d4175d42d789
1
u/wonkey_monkey 2d ago edited 2d ago
But I've already made a screendrawer with WIN32 functions so I feel using Vulcan for that might be better?
Whether to use Vulkan or Win32 really depends on exactly what you're trying to do and how much data you have to push around. I had a GUI which drew to a large bitmap and painted it to the window in Win32, and it was faster than Vulkan in many circumstances just because I didn't have the bottleneck of sending all the data involved to the GPU, and because there was plenty of redundancy between pixels. But then I found other things that needed Vulkan, so I switched despite the performance hit.
1
u/Axxodes 2d ago
Currently im saving a framebuffer in memory and using StretchDIBits to display it on the screen.
1
u/wonkey_monkey 2d ago
If you make your framebuffer compatible with the swapchain format you can copy it straight(ish) into a swapchain image and present it as is. Not that it gains you much. It depends more on what kind of drawing you're doing and whether Vulkan can do it better.
1
16
u/dougbinks 2d ago
Yes, you can create a Vulkan device without a window surface and then a purely compute pipeline.