rust-windowing / softbuffer

Easily write an image to a window
Apache License 2.0
333 stars 48 forks source link

Does softbuffer not do rendering? #243

Closed KylerBessert closed 1 month ago

KylerBessert commented 1 month ago

I was reading up on softbuffer from this post ; https://users.rust-lang.org/t/new-library-for-gpu-less-2d-display-in-winit-softbuffer-is-now-ready-for-use/70591

and it says "I haven't used bevy before, but I think that you might misunderstand what Softbuffer does. Softbuffer does not do any rendering"

but if I am not mistaken you can draw pixels onto this buffer and present it as seen the the softbuffer examples.

So I am just wondering if I am missing something here? How can it not do any rendering while even in the examples it is rendering.

Thanks for any insight into this!

kpreid commented 1 month ago

you can draw pixels onto this buffer

The user of softbuffer is responsible for choosing what pixels to put in the buffer, which is rendering. Rendering is computing an image, not displaying it. softbuffer only handles display.

KylerBessert commented 1 month ago

you can draw pixels onto this buffer

The user of softbuffer is responsible for choosing what pixels to put in the buffer, which is rendering. Rendering is computing an image, not displaying it. softbuffer only handles display.

So softbuffer gives the user aka you the ability to render to the buffer which is hooked into the display? I am not sure how this is much different than say graphics apis that are used like vulkan, opengl, directx. I know those are very advanced with a lot of features, but at the end of the day you are the developer that is telling vulkan, etc. what to put into the buffer.

tronical commented 1 month ago

The buffer Vulkan, OpenGL, etc. render into is not the same buffer that softbuffer provides. softbuffer is for those users who do not use those APIs but have their own way of producing the pixels, then place them into the softbuffer provided buffer, and softbuffer takes care of making the contents (pixels) of said buffer appear within the configured window.

kpreid commented 1 month ago

I know those are very advanced with a lot of features, but at the end of the day you are the developer that is telling vulkan, etc. what to put into the buffer.

If you use Vulkan then you might be giving it pixels, but if you're using the main part of Vulkan then you're giving it meshes (or other forms of scene data) that Vulkan then arranges to rasterize and shade to produce an image that didn't exist before. That's rendering. That's the part that Vulkan can do and softbuffer cannot do. softbuffer only displays an image you supply in a window; it doesn't make an image.

KylerBessert commented 1 month ago

Ok I understand softbuffer a lot more now. I have used opengl and vulkan in the past a few times each, and after checking the examples for softbuffer having pixels drawn to the window/buffer just seemed like the same thing as vulkan or opengl. I see now the differences between them, and hope softbuffer works well for my needs!

Thanks both of you for helping me wrap my head around this crate better.