Commit Graph

6853 Commits

Author SHA1 Message Date
rogerman 15f5b169cc Video Filters: Improve performance of Deposterize and XBRZ CPU-based filters. (Based on PR #631.)
- Special thanks to @m42a for the inspiration on this code!
2024-08-01 21:07:24 -07:00
rogerman be51e41c04 Ugh, let's try fixing the last stubborn Meson build script... 2024-08-01 18:00:54 -07:00
rogerman 46990f2d85 Fix some issues with Meson build scripts. (Regression from commit ca566eb.) 2024-08-01 17:51:12 -07:00
rogerman ca566eb11b OpenGL Renderer: Finalize all renderer-client integration to "just work".
- These changes now presume that standard OpenGL and OpenGL ES are mutually exclusive. We will NOT support running a standard OpenGL context and an OpenGL ES context in the same process.
- Clients must explicitly request supporting the OpenGL 3D renderer in their build configuration. Build configurations must define ENABLE_OPENGL_STANDARD (replacing the HAVE_OPENGL macro) or ENABLE_OPENGL_ES. If neither macro is defined, then the OpenGL 3D renderer will be assumed unavailable.
- Meson and Autotools now use better header/library checks for OpenGL functionality with their associated context type.
- Add a new Code::Blocks project file that can make builds for CLI, GTK, and GTK2.
- GTK and GTK2 ports now have the option to run a legacy OpenGL context, a 3.2 Core Profile context, or simply choosing the best context automatically like before.
- GTK and GTK2 ports have GLX and EGL as new context types. OSMesa and SDL have been updated to the latest design pattern.
- GTK and GTK2 ports can now be configured (via Meson or Autotools) to use a GLX, OSMesa, EGL, or SDL context.
- OSMesa contexts are now marked as deprecated. I don't know of anyone who still uses them, and I've never been able to get it to work correctly for years. Now that we have GLX contexts for compatibility purposes, OSMesa contexts are now completely redundant.
- Fix a bug with the GTK port where ancient GPUs without FBO support can still run framebuffers at custom sizes.
- For POSIX ports, move all "avout" and context creation files to the "shared" directory for better file organization.
2024-08-01 17:08:01 -07:00
rogerman 0a78fa2a2b OpenGL Renderer: Fix a few bugs here and there.
- Fix a compiling bug for ES due to missing tokens.
- Fix Fog and Edge Mark feature availability when running legacy OpenGL. (Regressions from commit 0c7cb99 and commit 8b5ac56.)
- glDrawBuffer() now determines its own algorithm at runtime instead of at compile time. This change is being done to be consistent with all of the other Standard vs ES changes.
2024-08-01 00:11:05 -07:00
rogerman 2f177d19a2 Cocoa Port: Update OpenGL renderer integration code to reflect current design patterns. 2024-07-26 14:56:36 -07:00
rogerman 4c90c2d9ee OpenGL ES Renderer: Finalize the last remaining bug fixes so that the ES renderer can work "out of the box".
- Respect the draw buffers ordering rules that are unique to ES.
- Report the actual OpenGL variant being requested when initializing the renderer.
- Add oglrender_deinit() function pointer so that clients can properly handle the destruction of their associated context resources at the correct time.
- Certain internal OpenGL info is now assigned at run time instead of at compile time. This change now allows any of the OpenGL renderers to run side-by-side.
2024-07-26 11:10:50 -07:00
rogerman d6532b9e91 OpenGL ES Renderer: Fix TBO-based polygon state uploading. 2024-07-24 15:28:56 -07:00
rogerman d58c0e9331 OpenGL Renderer: Oops! Fix a compiling issue introduced in commit e2a25e2. 2024-07-23 21:39:07 -07:00
rogerman e2a25e2412 OpenGL Renderer: Fix various rendering bugs.
- Fix a potential unaligned access crashing bug in ES when clear images are to be rendered.
- Fix an ES bug where clear images would fail to render when MSAA is enabled.
- Fix a legacy OpenGL bug where toon table colors were not ignoring their alpha bit, according to GBATEK.
2024-07-23 21:28:15 -07:00
rogerman f323dc464f Windows Port: Fix bug where the OpenGL 3D renderer would fail to initialize at program startup. (Regression from commit 76fe5f7. Fixes #815.) 2024-07-22 22:47:29 -07:00
zeromus 8e77a8d9f1
Merge pull request #818 from cyanea-bt/windows_paths
Windows Port: Fix empty defaults for path settings
2024-07-22 19:43:37 -05:00
cyanea-bt 5754425458 Windows Port: Fix empty defaults for path settings.
(Regression from commit 3511e14. Fixes #817.)
2024-07-23 01:57:59 +02:00
rogerman 12ed7dd054 Colorspace Handler: Fix alpha detection logic in ColorspaceConvert5551To8888_*() and ColorspaceConvert5551To6665_*(). 2024-07-21 21:02:50 -07:00
rogerman 368cd49fb6 OpenGL Renderer: Tighten up some code related to clear image. 2024-07-20 22:54:44 -07:00
rogerman 3ef927100b OpenGL Renderer: Fix some longstanding graphical glitches related to running Edge Mark and Fog with MSAA.
- These graphical glitches are resolved only when running 3.2 Core Profile with the GL_ARB_sample_shading extension, available on all modern GPUs.
- Do some minor optimizations to the Edge Mark and Fog shaders.
- Also fix an FBO attachment bug in legacy OpenGL that was introduced in commit 8b5ac56.
2024-07-20 20:49:44 -07:00
rogerman 8b5ac56d66 OpenGL Renderer: More FBO rework. 2024-07-19 14:38:05 -07:00
rogerman 60385bd099 OpenGL Renderer: Rework how the output framebuffers work.
- The output framebuffers now bind their own FBOs rather than changing draw targets with glDrawBuffer().
- Rework the general FBO management.
- Legacy OpenGL now outputs native RGBA color if FBOs are supported. This should give a minor performance increase on older GPUs.
- The fixed-function pipeline can now flip the framebuffer on GPU. This greatly reduces the CPU usage when doing the final color conversion and gives a significant performance increase on ancient GPUs.
2024-07-18 21:45:00 -07:00
rogerman 811e1de45e OpenGL Renderer: Oops! Roll back some internal test code that accidentally slipped into commit 0c7cb99. 2024-07-18 12:46:11 -07:00
rogerman 3e650f2f73 OpenGL Renderer: Add entry point for glBlendColor, fixing compiling on Windows. (Regression from commit 0c7cb99.) 2024-07-18 12:26:53 -07:00
rogerman 0c7cb99d78 OpenGL Renderer: Greatly simplify the fog rendering pass.
- There is no more need to switch to the working texture as the destination for the fog output. This change will be essential for future commits.
- The dual-source blending method has been obsoleted and removed.
- FBOs are no longer required for the fog feature, easing requirements for ancient GPUs.
- Ancient GPUs may see a small performance benefit due to shader simplification.
2024-07-18 12:17:25 -07:00
rogerman 70fef83ded OpenGL Renderer: Fix bug when the screen wasn't being cleared properly when no polygons are being sent to the renderer. (Regression from commit 241ca96.) 2024-07-16 16:15:47 -07:00
rogerman ff9231bb34 OpenGL Renderer: 16-bit texture data that is converted to 32-bit is now byte-swapped correctly on big endian systems. 2024-07-15 23:09:53 -07:00
rogerman ab1d37a44f Colorspace Handler: Fix compiling on AltiVec systems. (Regression from commit 586aea5.) 2024-07-15 23:07:24 -07:00
rogerman cc0b3ed00d Cocoa Port: Update the OpenGL blitter code to reflect the current code pattern in OGLRender.h.
- Centralize all header includes into OGLDisplayOutput.h.
- Update all extension versions of OpenGL functions/tokens that would be core in OpenGL v1.5.
2024-07-15 16:52:43 -07:00
rogerman 80694cd966 OpenGL ES Renderer: More ES fixes.
- Change the remaining FBO attachments that I missed the last time to use RGBA8 internal format.
- Fix picky ancient drivers that won't accept GL_RED as a texture internal format. It has been changed to GL_LUMINANCE.
- Fix picky ES drivers that demand that the external format used in both glTexImage2D() and glTexSubImage2D() are exactly the same.
- OpenGL ES doesn't support GL_UNSIGNED_SHORT_1_5_5_5_REV for texture data, and GL_UNSIGNED_SHORT_5_5_5_1 is incompatible with our data. So instead, all 16-bit data will be converted to 32-bit LE before uploading it via the textures, and such ES textures will now take GL_UNSIGNED_BYTE format.
- Remove the #include for EGL/egl.h in OGLRender.h, since EGL shouldn't exist at this level of the code stack.
2024-07-15 16:45:21 -07:00
rogerman 586aea5310 Colorspace Handler: Add new functions for 16-bit to 18-bit and 32-bit color conversion, now respecting the 16-bit color's alpha bit.
- ColorspaceConvert5551To8888()
- ColorspaceConvert5551To6665()
- ColorspaceConvertBuffer5551To8888()
- ColorspaceConvertBuffer5551To6665()
- Also rename the existing 16-bit color conversion functions to help further distinguish the functions from one another.
2024-07-15 16:24:02 -07:00
Roger Manuel 4b0805e139
Windows Port: Fix yet another compiling issue related to the OpenGL context. (Fixes #811.) 2024-07-15 10:00:38 -07:00
rogerman 15a6e51739 OpenGL Renderer: Add support for Fog, Edge Mark, and on-GPU framebuffer color conversion for ancient GPUs that have support for shaders and FBOs, but lack support for GL_EXT_framebuffer_blit. 2024-07-14 19:38:29 -07:00
rogerman de62116cc8 Windows Port: Fix OpenGL renderer init failure. (Regression from commit 76fe5f7. Fixes #810.) 2024-07-14 17:22:47 -07:00
rogerman 241ca96cf1 OpenGL Renderer: Fix issues that would throw a GL error.
- glTexParameteri() with GL_TEXTURE_2D_MULTISAMPLE throws INVALID_ENUM when trying to assign a sampler-related state, so these calls have been removed.
- glMapBufferRange() throws GL_INVALID_OPERATION if the buffer size is 0, so check for this condition first.
2024-07-13 10:43:04 -07:00
rogerman aaf88d9f14 OpenGL ES Renderer: More ES tune-ups.
- Any ES-specific error messages are now reported as "OpenGL ES" instead of "OpenGL".
- Explicitly declare the internal format of all textures and RBOs used as FBO attachments as "GL_RGBA8" instead of the generic "GL_RGBA". This may fix some extremely picky ES drivers that would throw GL_INVALID_ENUM if we don't use a sized internal format.
- Hard code the read pixels format as GL_RGBA and the read data type as GL_UNSIGNED_BYTE. It is meaningless to rely on GL_IMPLEMENTATION_COLOR_READ_FORMAT and GL_IMPLEMENTATION_COLOR_READ_TYPE since we are reading from our own FBOs that are hard coded to GL_RGBA8 format.
- Require that OpenGL ES contexts support the GL_OES_surfaceless_context extension, since we are doing offscreen rendering strictly on FBOs only. This extension has been around for a very long time, and so this serves as a kind of compatibility check.
2024-07-12 15:41:09 -07:00
rogerman d480f95d79 Cocoa Port: Fix yet another crash-on-exit bug that could happen when running on an older system. 2024-07-12 12:00:49 -07:00
SimonAfek dd88556d53
CI: update github workflows (#809)
* Update macOS version in build_interface.yml

* Typo fixes in build_interface.yml

* build.yml: Update runner images

* build.yml: Update deprecated actions

* build_interface.yml: Update runner images

* build_interface.yml: Update deprecated actions

* build_interface.yml: Remove unnecessary packages from macOS "brew install" line to address warnings

* build_win.yml: Update runner image + remove vs-version parameter from setup-msbuild action

* build_win.yml: Update deprecated actions
2024-07-11 17:38:52 +02:00
rogerman 00dd6fb97a OpenGL ES Renderer: Use the proper ES extension header, and also avoid double #defining some of the tokens. 2024-07-10 21:53:49 -07:00
rogerman bb3011c262 OpenGL Renderer: Return to a more traditional method of doing texture reads in shaders, effectively removing dependent texture reads where appropriate.
- This change won't affect standard OpenGL on a desktop PC, but may improve performance on lesser GPUs trying to run OpenGL ES.
2024-07-10 16:01:13 -07:00
rogerman 86a29d768a OpenGL ES Renderer: Do some minor changes/fixes.
- Fix a bug where _isShaderFixedLocationSupported wasn't being set to true, causing shaders to fail.
- OpenGL version checks now account for non-compliant ES drivers that contain text before the version number.
- Manually set the default read/draw buffers for all FBOs upon creation. We shouldn't need to do this, since they should always be set later, but just in case...
- Add missing GL_BGRA macro.
- Tidy up the OpenGL naming in some error strings.
2024-07-10 13:59:02 -07:00
rogerman 3a6f2f6dc5 OpenGL ES Renderer: Add a new OpenGL ES 3.0 renderer. 2024-07-09 23:00:27 -07:00
rogerman 0e88f9aa94 OpenGL Renderer: Final changes for OpenGL ES compatibility. 2024-07-09 22:03:33 -07:00
rogerman 384854f6e7 OpenGL Renderer: More updates to the 3.2 Core Profile renderer to be more cross-compatible with OpenGL ES 3.0.
- Add support for fixed locations in shaders for OpenGL 3.3 and later.
- The fog density table texture is now a 2D texture instead of a 1D texture.
- Fix a memory leak where the polygon state texture wasn't being deleted upon the destruction of the OpenGLRenderer object.
2024-07-09 01:18:50 -07:00
rogerman 7dbece1082 OpenGL: Do some minor changes to the 3.2 Core Profile renderer to make it more cross-compatible with OpenGL ES 3.0.
- PBO handling now works via glMapBufferRange() instead of glMapBuffer().
- Polygon states can now be uploaded using plain integer textures. 64k UBOs and TBOs are no longer required.
2024-07-06 16:20:53 -07:00
rogerman 09090e93f9 GFX3D: Change POLYLIST_SIZE to 16384 to ensure proper memory alignment with buffers based on CLIPPED_POLYLIST_SIZE and VERTLIST_SIZE. 2024-07-06 13:58:05 -07:00
rogerman c962c550e7 OpenGL: Handle legacy functions and tokens more gracefully for OpenGL variants that may not have them. 2024-07-05 18:13:43 -07:00
rogerman 76fe5f758c OpenGL: More changes in preparation of OpenGL ES.
- Slightly change the names of attachment defines so that they can be distinguished from the native OpenGL attachment defines.
- The minimum version driver check now accounts for OpenGL ES.
- OpenGLRendererCreate() can now handle any possible OpenGL variant, as declared in the OpenGLVariantID enum.
- Framebuffer read backs may now assigned their format and data type. (Legacy OpenGL assigns the format as GL_BGRA, while 3.2 Core Profile assigns the format as GL_RGBA.)
2024-07-03 16:55:47 -07:00
rogerman ba56bbc7c2 OGLRender_3_2.cpp... try again... 2024-07-03 13:05:43 -07:00
rogerman 3ec0b0c2e1 OpenGL: Continue preparation for adding OpenGL ES. (Related to commit 086980d.) 2024-07-03 13:01:17 -07:00
rogerman fc6ff8edbd GPU: Fix a bug on big-endian systems where setting the backdrop color could cause a crash. 2024-07-02 01:35:10 -07:00
rogerman fe0ae83c40 Cocoa Port: Fix a longstanding, yet rare, crash that may occur when quitting the app. 2024-07-02 00:16:46 -07:00
rogerman d4163a1893 OpenGL: Fix building on Windows and Linux. (Regression from commit 086980d.) 2024-07-01 16:26:46 -07:00
rogerman 086980deaf OpenGL: Start reorganizing stuff in preparation for adding new OpenGL variants, such as OpenGL ES.
- All platform-specific header includes are now centralized in OGLRender.h.
- Remove all ARB and EXT versions of legacy functions (everything pre 3.0). Legacy functions now only reference their core versions.
- Do a some minor code cleanup.
2024-07-01 16:19:05 -07:00