Skip to content

functions: add a couple of missing stubs - #113

Open
mardy wants to merge 4 commits into
devkitPro:masterfrom
mardy:add-missing-stubs
Open

functions: add a couple of missing stubs#113
mardy wants to merge 4 commits into
devkitPro:masterfrom
mardy:add-missing-stubs

Conversation

@mardy

@mardy mardy commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

The SDL3 test program testgl1 loads all the GL functions declared in the render backend2 and fails to start if any of these fail.

Exporting these two functions allows the testgl program to run.

UPDATE: I added a few more commits to fix/improve the FBO code. With these, the SDL3's renderer backend using OpenGL correctly works with opengx. We are most likely not going to use it (I'll port the GX backend we have in SDL2), but it's good to know that it's a working option.

mardy added 4 commits August 11, 2026 20:18
The SDL3 test program testgl[1] loads all the GL functions declared in
the render backend[2] and fails to start if any of these fail.

Exporting these two functions allows the testgl program to run.

[1]: https://github.com/libsdl-org/SDL/blob/main/test/testgl.c
[2]: https://github.com/libsdl-org/SDL/blob/main/src/render/opengl/SDL_glfuncs.h
This is completely missing out the alpha function, but is good enough to
make the SDL3's OpenGL renderer to work.
Restore the condition check as it was before commit 6a474f8
(fbo: implement FBO API). Unfortunately that commit does not explain why
this change was made, it may also be that it was only needed during
certain stages of development; by itself, the change does not make much
sense and it break at least one very simple use case:

1. Bind an empty texture to the FB (let's call it "A")
2. Draw a couple of textures
3. Unbind the FB
4. Draw the texture "A" on the screen
5. Error: the first texture drawn in point 2 will be vertically flipped

This is what happens running SDL3's testrendercopyex.c test using the
OpenGL render backend (backed by opengx). This commit fixes that case.
Improve the way the FBO module is used:

1. Add FBO functions (both with the OpenGL 3.0 name and with the older
   "EXT" suffix) to the ogx_get_proc_address() lookup tables. This is
   done only if the FBO module is actually used, using the same weak
   symbol trick we use for the shader functions.

2. Add a ogx_enable_module_fbo() function that the client can call to
   force the inclusion of the FBO code. This function also registers the
   GL_EXT_framebuffer_object extension.

With these changes the OpenGL renderer backend in SDL3 can be used with
opengx without any changes (other than calling ogx_enable_module_fbo()
in its initialization code).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant