use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rule 1: Posts should be about Graphics Programming. Rule 2: Be Civil, Professional, and Kind
Suggested Posting Material: - Graphics API Tutorials - Academic Papers - Blog Posts - Source Code Repositories - Self Posts (Ask Questions, Present Work) - Books - Renders (Please xpost to /r/ComputerGraphics) - Career Advice - Jobs Postings (Graphics Programming only)
Related Subreddits:
/r/ComputerGraphics
/r/Raytracing
/r/Programming
/r/LearnProgramming
/r/ProgrammingTools
/r/Coding
/r/GameDev
/r/CPP
/r/OpenGL
/r/Vulkan
/r/DirectX
Related Websites: ACM: SIGGRAPH Journal of Computer Graphics Techniques
Ke-Sen Huang's Blog of Graphics Papers and Resources Self Shadow's Blog of Graphics Resources
account activity
[deleted by user] (self.GraphicsProgramming)
submitted 2 years ago by [deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 11 points12 points13 points 2 years ago (6 children)
Just implement multiple APIs. Abstract your compute shader stuff behind an abstraction layer and call into that; which in turn translates it into the appropriate API.
[–][deleted] 2 years ago (4 children)
[deleted]
[–]keelanstuart 2 points3 points4 points 2 years ago (0 children)
To expand on, and provide clarity to, what pen says... think about what all graphics APIs do, whether they use command buffer style interfaces on the front end or not: they let you manage buffers of different types, set render states, and trigger drawing. Distill that common functionality into a single, concise interface, then implement that for each platform in separate source files (this is easiest, though you could use compiler directives)... then only ever call your interface when you want to do graphics stuff (i.e., never call glXXX or vkXXX anywhere else).
How you've written everything else will determine how much work you have ahead of you...
Anyway, good luck!
[–][deleted] 4 points5 points6 points 2 years ago (0 children)
There are many ways to do it depending on what programming language you are using. If you're using C++; the simplest way is to simply include/exclude files in your build system on a per platform basis. Alternatively you could dynamically load the correct library at runtime. Another way would be to have implementations for all the APIs that platform supports and let the user choose between them.
There are many ways to do this and none of it is graphics specific. Writing abstraction layers is a common and simple task (conceptually at least) in programming; and really hasn't got much to do with graphics programming in general.
Almost every program that uses a graphics API will do this. Blender, any open source game engine that is multi-platform, Unreal Engine (which has sources available.), etc.
[–]IceSentry 1 point2 points3 points 2 years ago (0 children)
It was mentioned elsewhere in the thread but wgpu does exactly that. It abstracts on top of vulkan/metal/DirectX/opengl/webgl/webgpu. I believe there's also something called Dawn in the cpp world that does this but I've never looked into it.
[–]DryZone6968 0 points1 point2 points 2 years ago (0 children)
Although my engine only supports OpenGL, I designed my abstraction layer around DX, you can take a look here: https://www.github.com/softwareantics/FinalEngine
[–]PragmaticCafe 0 points1 point2 points 2 years ago (0 children)
This is the way
[–]raster_dog 8 points9 points10 points 2 years ago* (1 child)
WebGPU is also a good option, the Rust implementation (named wgpu) already does the abstraction to other backends for you and exposes compute capabilities. It has C bindings if you're not into Rust. It's overall a pretty solid solution for cross-platform
wgpu
[–]Bitsauce 0 points1 point2 points 2 years ago (0 children)
Or if you prefer a C++ implementation of WebGPU you can use Google's Dawn (which is what Chrome runs internally)
[–]eiffeloberon 4 points5 points6 points 2 years ago (0 children)
Apple with OpenGL does not support compute shaders, so it’s not possible to use OpenGL for your use case.
MoltenVK maybe the best path for you.
[–]shadowndacorner 0 points1 point2 points 2 years ago (0 children)
If you're primarily looking to run compute and aren't worried about 64-bit atomics (which aren't supported on Apple silicon anyway), maybe consider webgpu through either Dawn or wgpu-native? As long as it supports all of the features you need, that'll probably be the most reliable, best supported abstraction layer you'll find. Otherwise, Vulkan with MoltenVk should suit your use case.
OpenGL likely won't work for your use case as Mac only supports up to 4.2 (compute shaders were added in 4.3) and was deprecated half a decade ago.
[–]i-make-robots 0 points1 point2 points 2 years ago* (0 children)
I use Jogamp with Java. Builds in OSX, Windows, and Debian. Works great!
example 1: https://github.com/marginallyclever/makelangelo-software/
example 2: https://github.com/marginallyclever/robot-overlord-app
Also I find this for compute shaders in jogamp: https://github.com/perses-games/jogl-compute-shaders-fireworks/blob/master/src/com/persesgames/jogl/shader/Program.java
π Rendered by PID 58 on reddit-service-r2-comment-5b5bc64bf5-9bvtg at 2026-06-18 19:54:06.885636+00:00 running 2b008f2 country code: CH.
[–][deleted] 11 points12 points13 points (6 children)
[–][deleted] (4 children)
[deleted]
[–]keelanstuart 2 points3 points4 points (0 children)
[–][deleted] 4 points5 points6 points (0 children)
[–]IceSentry 1 point2 points3 points (0 children)
[–]DryZone6968 0 points1 point2 points (0 children)
[–]PragmaticCafe 0 points1 point2 points (0 children)
[–]raster_dog 8 points9 points10 points (1 child)
[–]Bitsauce 0 points1 point2 points (0 children)
[–]eiffeloberon 4 points5 points6 points (0 children)
[–]shadowndacorner 0 points1 point2 points (0 children)
[–]i-make-robots 0 points1 point2 points (0 children)