-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
Added MSAA to GLES2 backend #28518
Added MSAA to GLES2 backend #28518
Conversation
Note for release managers: if/when merged, let it simmer in the master pot for a while for potential fixups, but otherwise it should be a nice candidate for cherry-picking in 3.1.2. |
Changes to fix the travis ci edit: Okay attempt number two, I reordered some stuff and scoped off a section with |
@akien-mga when you get a chance I could use a hand with the travis-ci errors. I have resolved most, the last one is only for android and iphone. Neither one properly recognizes the OpenGL-specific constants. They are used the same as in GLES3, so they should be defined somewhere, but I can't figure out what travis needs in order to recognize that. I suspect the solution is going to be to have a defines section at the top of the files like we currently have for the texture API, but wrapped in an godot/drivers/gles2/rasterizer_storage_gles2.cpp Lines 43 to 70 in 7018de8
|
@clayjohn The problem is that those methods and constants are not defined in OpenGL ES 2.0, but they are in OpenGL 2.1. From a quick look, there doesn't seem to be widely supported extensions to bring those to OpenGL ES 2.0. So this code should be enclosed in |
I guess we need to make sure to limit the API calls to things enabled by https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_framebuffer_multisample.txt (for OpenGL 1.5+ so BTW, useful reference to find matching extensions: https://chromium.googlesource.com/angle/angle/+/master/src/libANGLE/renderer/gl/FeatureSupportGL.md |
Also:
in https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_multisampled_render_to_texture.txt |
So there are several things to do for OpenGL ES 2.0 support:
|
8a420fe
to
3ec88b8
Compare
1a7f485
to
7acd7dd
Compare
@akien-mga Im gonna need some help figuring out the GLAPIENTRY stuff. I thought I could get it to work by including <GLES2/glext.h> because that is where the definitions of the functions are stored, but it didn't work. reduz suggested just defining the functions in the file. That may be our best option. But I'm not sure how that would work while still keeping things nice and clean. I added stuff to the glad file for 2.1, this should make things work without the EXT call. (I'm just mirroring how it is already done in rasterizer_gles2.cpp) |
@clayjohn The errors are:
But as I mentioned above, and as per the extension, you should use |
I tried this fixup locally, and that fixes the build for Android, but then there's a link error for those EXT symbols: https://hastebin.com/nazajegiti |
@akien-mga I added es2 to glad.h and then included it for iphone and android. It builds successfully for android now, but I am unable to test iphone. I had to change an SCsub file in order to get scons to compile glad.h when using android or iphone. |
c130f0c
to
e9258fe
Compare
8725b65
to
7a87aae
Compare
@akien-mga Just pushed another version. Now im loading the needed functions for ios and android manually. Turns out ios also has a different way of handling multisampled buffers. Also, I can't build for ios so I'm pretty much just relying on travis-ci to let me know if I made a mistake here... |
74bfda6
to
a3d5aec
Compare
@godotengine/ios Can I get someone from the ios team to test this on an ios device? @akien-mga This is finally passing travis-ci!! @reduz Can you review this again as I made a few changes to get it working with ios and android? |
As discussed on IRC, there are some concerns about how this will work on real GLES2-only devices (was only tested on GLES3-capable devices) and especially on iOS. Since we don't have a battery of devices nor QA testers available to check it before merging, we'll go with our usual workflow: test in production. Please give the feature a try in the master branch and report any issue you encounter. To release maintainers: this means of course that it shouldn't be cherry-picked for the 3.1 branch right away. We should wait until we're confident that tests in the master branch confirm that the feature works well everywhere. |
Thanks a lot! |
Note to release maintainers: if we decide to cherry-pick this, there are quite a few follow-up PRs to include (search "MSAA" in merged PRs). Overall probably not worth the trouble given that the 3.2 release is imminent and includes a lot of GLES2 fixes. |
As discussed with @reduz, this PR checks to see if the multisample FBO extension is available on the hardware, if so it renders to a multisample renderbuffer and blits back to the normal framebuffer at the end of frame or when the screen is being read from.
Fixes #25843