-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
BACKENDS: Merge 3D graphics managers with the 2D ones #6651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -96,8 +96,6 @@ class OSystem_iOS7 : public ModularGraphicsBackend, public EventsBaseBackend { | |||
void setFeatureState(Feature f, bool enable) override; | |||
bool getFeatureState(Feature f) override; | |||
|
|||
bool setGraphicsMode(int mode, uint flags) override; | |||
|
|||
TouchMode getCurrentTouchMode() const { return _currentTouchMode; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
; after functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer not to modify this one to not blur the code changes.
The PR is already big enough. :)
I've tested Grim Fandango in iOS and it works. I've tested a couple of shaders which works. One shader, crt/hyllian, didn't work as expected. Perhaps not all shaders will work with the 3d engine. However, when exiting with that shader scummVM crashes because of _gameScreen being NULL when setting up the new 2D graphicManager. It only happens with that shader. Perhaps you can test that specific shader on Linux and see if the same thing happens. |
I did some fixes but never got this bug when testing with the shader. I hope it's really fixed anyway. |
I tested this on Windows 11 24H2 with MSYS2, using TWP as a game target. It works great, and shader support is there as well. Great job! |
I added two more fixes to the PR:
|
Hum my last addition fails the build because the setting I added is only supported on SDL 2.32+. |
This is now fixed differently (in TWP instead of globally). |
@@ -112,6 +111,37 @@ OSystem_iOS7::~OSystem_iOS7() { | |||
delete _graphicsManager; | |||
} | |||
|
|||
#if defined(USE_OPENGL_GAME) || defined(USE_OPENGL_SHADERS) | |||
Common::Array<uint> OSystem_iOS7::getSupportedAntiAliasingLevels() const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to share this code across all platforms when framebufferObjectMultisampleSupported
is in use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose we could but I didn't find an elegant way for it.
5d8a34d
to
53f1375
Compare
How easy would it be to transplant the changes from PR #4633 on top of this PR? |
I am not sure about it. What would remain is fixing enter3D and leave3D to save and restore the state in a GLES1 compliant way. One point that bothers me is: do you have any platform to test this? Because, I don't. |
If you start one of the dark side demos, you can see a bug that affects all the freescape games when using this code, there is some issue with the viewport handling: (pressing "space" a couple of times will take you to the game, which looks good otherwise). For reference, it should look like this: |
I've tested the libretro port on Win11, linux and Android with TWP and Grim Fandango, it looks like is working very good... great job! |
I'd been using Mesa while working on the PR, and I should be able to test on Android as well. |
Well, I think we should postpone this to later. |
This allows to get the real SDL error message.
Move the definitions where they belong and avoid a runtime check for the GL renderer.
It's useless now
Also remove the now unused common parts
This fixes a segfault when starting in 16-bits rendering mode.
This allows the engine to react to screen changes which happened when it was unable to track them.
Now that there is one backend for all 2D and 3D, the state must be checked.
Shader pipeline expects the framebuffer to be alive when cleaning up. A SIGSEGV can happen when notifyContextCreate is called twice in a row. This should never happen, but better be safe.
This function was never used before so there is no consequences.
This is only supported on SDL2. On SDL1.2, the window is completely managed by SDL and we cannot know when it would get destroyed.
kFeatureFullscreenToggleKeepsContext was a feature only used internally by the SDL backend. Remove it and replace it by a virtual function. Make the common code agnostic of the 3D rendering mode.
3D renderer initializes context using functions from this optional part of OpenGL 1.2. This fixes a segfault on Windows XP OpenGL.
The data returned by SDL_GetPreferredLocales is allocated in one block.
And indicates to the user that the shader failed to apply.
With the SDL 3D manager the system cursor was used. This is not the case anymore.
The system cursor is never displayed because we are in relative mode.
Thank you for testing and for the diagnostic, it's now fixed. |
Last call for testing: I plan to merge this on tomorrow. |
Merging now (and watching the buildbot failures). |
I did a quick test on OSXPPC, which relies on SDL1.2 (it was running commit 53f1375, i.e. before the latest PR changes) I've tested Grim/Monkey4, mostly (and also a bit of SCUMM/AGS in case of any regression). I didn't see any obvious issue ✅ FWIW, this was on an iBook G4 running OSX 10.4, so it's limited to OpenGL 1.3. I won't have access to my other OSX Leopard machines (with OpenGL 2.0 support) before a few weeks, though. So yeah, for this port this looks fine. I hope to find some time this summer for more extensive testing there. Output on this machine:
|
This (big) PR removes the graphics3d folder inherited from ResidualVM and merges the needed parts inside the
OpenGLGraphicsManager
and its platform specific descendants.Several fixes which were revealed during my testing are also included in the PR even touching the now removed 3D graphics manager.
I tried to test as much combinations as I could between SDL1.2/2, FBO, shaders, OpenGL/ES2, antialiasing and bit-depth support.
The main tests have been done on Linux, with various versions of Mesa (up to 3.5, limited to OpenGL 1.2 support), 16-bits Xorg server and SDL1.2 and 2.
A quick test on SDL3 has been done (and uncovered an unrelated bug).
Android and Windows 95 and XP also got tested, although the rendering of these MS platforms may not perfect due to the MS OpenGL buggy implementation.
For iOS, only the build has been tested.
libretro port has not been tested at all. It should "magically" gain 3D engines support.
Some things need to be done: