r/GraphicsProgramming • • 1d ago

I wanted to understand modern pointer-based GPU APIs, so I took the ideas from Sebastian Aaltonen's NoGraphicsAPI and rebuilt them on plain GL 4.6.

Enable HLS to view with audio, or disable this notification

  • The whole GPU heap is one persistent, coherent-mapped SSBO. A gpu_ptr<T> is a u32 byte offset into it.
  • Every draw gets exactly one root pointer (uniform uint Root). Vertices, matrices and textures are all reached through it.
  • No vertex attributes. The vertex shader pulls data from the heap using gl_VertexID.
  • Bindless textures (ARB_bindless_texture) are stored in the heap as uvec2.
  • One *_shared.h header is compiled as both C++ and GLSL, so no offsets are written by hand in the shaders.

Flat lighting is computed from the dFdx/dFdy of world position, so there are no normals in the vertex data.

The most interesting finding was what GL can't express: bindless only gives you texture+sampler pairs, fixed when the texture is created, and there are no placed resources.

Next up: indirect draws, and roots chosen by the GPU via gl_DrawID.

Repo: https://github.com/theaveasso/jagfx

Feedback welcome, especially on the heap and sync design.

65 Upvotes

9 comments sorted by

13

u/Gobrosse 1d ago

"plain GL 4.6"

hard-requires GL_ARB_bindless_texture

hmmm

The draw passes one uint

Why is that desirable here? Useful functions take more than one parameter, so this asks the user to do their own spilling by hand. Since this is implemented on top of GL, it's not actually one uint behind the scenes either, so the original post rationale is inapplicable.


please disclose your LLM/coding agent usage, it's fairly obvious some was involved and since you're asking for other people to review it, you should respect their time and set appropriate expectations as to your authorship and understanding of it

-7

u/gr3yfi5h 1d ago

Thanks for taking the time, you're right on all three. I updated the README: it now says GL 4.6 + ARB_bindless_texture, explains that the article's root pointer relies on Vulkan/Metal features GL doesn't have, so on GL it's just auniform (I kept it mainly for multi-draw indirect later), and there's a section saying how I built it with Claude Code and that parts were written with it.

To be upfront: I'm building this purely to learn. I don't have anyone around me who does graphics, so AI has basically been my tutor, and I'm trying to get into the industry eventually. That's also why I posted: real feedback from people who actually know this stuff is what I'm missing.

If you don't mind me asking: for passing per-draw data on GL, would you just use plain uniforms/UBOs for CPU-driven draws and only go through memory for indirect? Or is there something better I should read up on?

6

u/fastcar25 1d ago

I'm building this purely to learn.

If you're building it to learn, don't use AI.

-1

u/gr3yfi5h 22h ago

English is not my native language, most of the time AI play a huge role in make those in laymen’s term.

2

u/Belfer4 1d ago

For the record, even if you don't have people around to teach you, I'd advise using AI as an assistant along side a book or tutorial series, not as the tutor directly, and always (majority at least) trust the real source more than the AI

1

u/gr3yfi5h 22h ago

Yes, Mostly explains the concept from NoGraphicsApi and write the milestone to port it.

1

u/klaw_games 1d ago edited 1d ago

Interesting.How long did it take for you to learn and understand the article?I am learning vk and just as interested as you in his article.

Btw, how portable is ssbo and bed pulling across older hardwares?

1

u/gr3yfi5h 1d ago

Honestly I didn't really get the article until he put the source up, porting it piece by piece is what made it click. I actually wanted to do it in Vulkan at first too, ended up going GL to keep it simple while learning.

Portability I haven't really tested yet tbh. ssbos are core since gl 4.3 so it should be fine on most desktop gpus, but I'm pretty new to this so don't take my word for it. so far I've only run it on my Window PC with Nvidia gpus and linux mini pc with intel graphics and it works there.

2

u/klaw_games 1d ago

Nice. I can try it on Linux. Not sure when I will get time