Improve OpenGL ES and modern OpenGL compatibility#1760
Merged
Conversation
This update improves the OpenGL backend to support Modern OpenGL (Core Profile 3.3+ and GLES 3.0+), while retaining a fallback to Legacy OpenGL 2.1. Changes include: - **Context Creation**: `doInit` now attempts to create a modern context first. If that fails, it retries with a legacy compatibility context. - **Shader Compatibility**: Shaders (OSD, External, and CRT) are now dynamically patched with the correct `#version` preamble and keyword definitions (`attribute` vs `in`, `varying` vs `out`) to match the active context. - **VAO Support**: Implemented Vertex Array Objects (VAOs) usage across the rendering pipeline (OSD, External Shaders, crtemu), which is mandatory for Core Profile contexts. - **crtemu updates**: Updated `crtemu.h` to handle VAOs and dynamic shader compilation. Fixed a uniform name mismatch in the blur shader. This ensures better compatibility with drivers that deprecate legacy features or default to Core profiles.
- Allow OpenGL ES contexts to initialize instead of aborting. - Manually load VAO functions (glGenVertexArrays, glBindVertexArray, glDeleteVertexArrays) if GLEW fails to load them, including OES variants. This improves compatibility on platforms like Raspberry Pi 4/5. - Log available video drivers if SDL_Init fails to assist with debugging.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes # .
Changes proposed in this pull request:
@midwan