tetra icon indicating copy to clipboard operation
tetra copied to clipboard

Is the OpenGL layer safe?

Open 17cupsofcoffee opened this issue 5 years ago • 3 comments

...probably not!

This is a tracking issue for ensuring that the OpenGL layer in Tetra makes correct use of unsafe, and that there's no way to cause undefined behavior via Tetra's API.

Long term, we might want to move to using a more established library for the graphics backend (#51), but in the short term we should probably at least avoid shooting ourselves in the foot.

Issues found so far:

  • #1 - OpenGL handles can be used-after-free if the context gets dropped (fixed)

17cupsofcoffee avatar Apr 15 '19 15:04 17cupsofcoffee

I wonder how much it maters? At some point u decide that all new development is against Vulkan... Though I know it's not well supported on OSX, there are projects looking to fix that.

cheako avatar Apr 18 '19 06:04 cheako

Instead of targeting Vulkan directly a better approach is to go for something like gfx-hal for a lowl-level/unsafe abstraction over the three modern graphics APIs (dx12, metal, vulkan) or for a higher level safe option like wgpu, venturing into the latter recently.

xla avatar Apr 18 '19 06:04 xla

gfx-hal is definitely on my radar (and I'd definitely choose that route over raw Vulkan) - the main blocker for me switching is that I haven't been able to get it working with SDL (and I don't really want to switch to Winit for various reasons). That said, I know this is definitely possible, because Sev on Discord has managed to get it up and running.

Also the API is complicated and it scares me :p

Either way, discussion of switching backends entirely would be a better fit on #51 - this is more for ensure that our current backend isn't going to shoot people in the foot in the meantime :)

17cupsofcoffee avatar Apr 18 '19 10:04 17cupsofcoffee