Opened 8 years ago
Closed 3 years ago
#13340 closed bug (fixed)
BGLView::GetGLProcAddress and eglGetProcAddress return NULL always
Reported by: | waddlesplash | Owned by: | kallisti5 |
---|---|---|---|
Priority: | normal | Milestone: | Unscheduled |
Component: | Kits/OpenGL Kit | Version: | R1/Development |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description
Encountered on x64 with Mesa 17.0.0-1. The Dolphin emulator's OpenGL system tries to get the address of glGetIntegerv
, and both the official EGL system as well as the BGL backend I wrote for it return NULL when attempting to fetch the address of that function.
The complete port is here: https://github.com/waddlesplash/dolphin/tree/haiku
Note that if you want to use it, you'll need to change the "CPU Backend" to "Cached Interpreter" (the JIT is presently broken due to #13292), and enable logging (set log level to "Info", toggle all logging systems.)
Change History (3)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
I don't know why fRenderer is not also set in the constructor, but I assume for a reason, perhaps to prevent unattached views from stealing CPU cycles. Regardless, if GetGLProcAddress() is called before the AttachedToWindow() callback has time to execute, fRenderer will be NULL, and as a result, GetGLProcAddress() will fail.
Since we define the behavior for BGLView, this might be OK (I'm inclined to think it is not, as offscreen BGLViews are completely legitimate, no?) but for EGL it is absolutely not OK; as EGL is a platform-independent API and must return values for eglGetProcAddr() even if the window init is not completely finished.
comment:3 by , 3 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I think this has been fixed at this point. At least I completed the Dolphin emulator port without any strange workaround or hacks needed, I think.
I can't find where in the Dolphin sources it calls cInterfaceBGL::Create() but I believe it calls GetGLProcAddress() either in the same function or at least in the same thread without break.
GetGLProcAddress() depends on the BGLDispatcher which is retrieved from the BGLRenderer(fRenderer)
The renderer is not set until AttachedToWindow()
while the GLRendererRoster it depends on is set in the constructor
I don't know why fRenderer is not also set in the constructor, but I assume for a reason, perhaps to prevent unattached views from stealing CPU cycles. Regardless, if GetGLProcAddress() is called before the AttachedToWindow() callback has time to execute, fRenderer will be NULL, and as a result, GetGLProcAddress() will fail.
If this is indeed the case, the best solution may be to either inherit from BGLView and override the constructor and AttachedToWindow() functions, or it may just be easier (due to dependencies) to copy and paste the files and rename the class, changing the location of the one line... a little messy, but it should work fine.
The BGLView sources are located in the Mesa repo. If you need any additional help or if this doesn't solve the problem, let me know!