Commit Graph

424 Commits

Author SHA1 Message Date
Johannes Schickel
e66e9e44d3 OPENGL: Accelerate palette lookups with shaders.
This currently is limited to GL contexts.
2016-03-16 20:29:26 +01:00
Johannes Schickel
de3846923c OPENGL: Introduce simple abstraction for surfaces.
This is basically an interface extracted from Texture without any knowledge
about any actual implementation, except for copyRectToTexture, fill, and
dirty rect handling. These are convenient helpers.
2016-03-16 20:29:26 +01:00
Johannes Schickel
8b0cf0c5f7 OPENGL: Cleanup. Remove Texture::getHardwareFormat. 2016-03-16 20:29:26 +01:00
Johannes Schickel
618adec7b0 OPENGL: Move color key handling for CLUT8 to TextureCLUT8. 2016-03-16 20:29:26 +01:00
Johannes Schickel
db2917dde5 OPENGL: Fix texture format for BGR565. 2016-03-16 20:29:26 +01:00
Johannes Schickel
9844d89231 OPENGL: Move max texture size information to Context. 2016-03-16 20:29:26 +01:00
Johannes Schickel
b081fe63e8 OPENGL: Create new abstraction for GL texture objects. 2016-03-16 20:29:26 +01:00
Johannes Schickel
5eb0ac0c9e OPENGL: Remove (some) unused GL definitions. 2016-03-16 20:29:26 +01:00
Johannes Schickel
b8d79261ed OPENGLSDL: Request "standard" GL contexts.
Compatibility profiles only exist in modern OpenGL and we request an ancient
version.
2016-03-16 20:29:26 +01:00
Johannes Schickel
8a3eecb73a OPENGL: Unify shader implementation for GL and GLES2. 2016-03-16 20:29:25 +01:00
Johannes Schickel
fc52f73050 OPENGL: Slightly cleanup programmable pipeline handling. 2016-03-16 20:29:25 +01:00
Johannes Schickel
c7c870bf7f OPENGL: (Partly) move context specific handling to Context.
This does not include (most) shader setup, and projection matrices yet.
2016-03-16 20:29:25 +01:00
Johannes Schickel
5752f125e1 OPENGL: Make Context::reset explicitly reset state. 2016-03-16 20:29:25 +01:00
Johannes Schickel
1802c939a1 OPENGL: Slight simplifcation for opengl-func.h usage. 2016-03-16 20:29:25 +01:00
Johannes Schickel
b7e64c6eeb OPENGLSDL: Destroy GL context on exit with SDL2. 2016-03-16 20:29:25 +01:00
Johannes Schickel
d029f16799 OPENGL: Handle destruction gracefully when no context is setup. 2016-03-16 20:29:25 +01:00
Johannes Schickel
fee1aa5502 OPENGL: Add support for shaders with GL contexts. 2016-03-16 20:29:25 +01:00
Johannes Schickel
19abd8ccbb OPENGL: Reset context description on context destroy. 2016-03-16 20:29:25 +01:00
Johannes Schickel
1c61e017a0 OPENGL: Reset full context structure. 2016-03-16 20:29:25 +01:00
Johannes Schickel
fe88375ff3 OPENGL: Support GLES2 contexts. 2016-03-16 20:29:25 +01:00
Johannes Schickel
e931018673 OPENGL: Typo. 2016-03-16 20:29:25 +01:00
Johannes Schickel
c5ce812711 OPENGL: Simplify orthogonal projection setup. 2016-03-16 20:29:25 +01:00
Johannes Schickel
67e2790beb OPENGLSDL: Slight cleanup. 2016-03-16 20:29:25 +01:00
Johannes Schickel
af727afe0c OPENGL: Simplify context type setting. 2016-03-16 20:29:25 +01:00
Johannes Schickel
da062ad1ea OPENGLSDL: Try to use GL(ES) context SDL2 defaults to. 2016-03-16 20:29:25 +01:00
Johannes Schickel
2277144623 OPENGL: Support RGB555 for OpenGL ES output.
This mode should *not* be used by any new engines/code. If someone is going
to use it and says it works with the OpenGL output, please make them wear a
red uniform and beam them onto a remote planet.
2016-03-16 20:29:25 +01:00
Johannes Schickel
d6d3e17d53 OPENGL: Allow runtime specification of OpenGL mode.
Formerly, we required that the OpenGL mode was fixed at compile time. Now we
allow the code to work with whatever it is given at runtime.

It is still possible to force a context type on compile time.
2016-03-16 20:29:25 +01:00
Johannes Schickel
9816e4f350 OPENGL: Remove support for ARGB8888.
This used to be used by Sword25. Since it is not supported by GLES and no
engine code uses it we drop support. Hopefully, this helps people to realize
they should not use that format in their engine.
2016-03-16 20:29:24 +01:00
Johannes Schickel
e11f4df111 OPENGL: Rename GLCALL to GL_CALL. 2016-03-16 20:29:24 +01:00
Johannes Schickel
4a781737c1 OPENGL: Resolve OpenGL functions on run-time.
Formerly we relied on static linkage. However, in the presense of modern
OpenGL (ES) implementations it is not easily identifable which library to link
against. For example, on Linux amd64 with nVidia drivers and SDL2 setup to
create a GLES 1.1 context one would need to link against libGL.so. However,
traditionally GLES 1.1 required to link against libGLESv1_CM.so. To prevent a
huge mess we simply resolve the OpenGL functions on run-time now and stop
linking against a static library (in most cases).

GLES support needs to be enabled manually on configure time for now.

Tizen changes have NOT been tested.
2016-03-16 20:29:24 +01:00
Johannes Schickel
b3b3d37e3b OPENGL: Define GLCALL in opengl-sys.h.
debug.h is now always included and all calls should be made through GLCALL.
2016-03-16 20:29:24 +01:00
Johannes Schickel
8f3783da09 OPENGL: Add functionality to query OpenGL functions on runtime.
This can and will be used for future extension usage support.

Tizen changes have been untested.
2016-03-16 20:29:24 +01:00
Johannes Schickel
e5e234b864 OPENGL: Refactor GL extension handling slightly. 2016-03-16 20:29:24 +01:00
Johannes Schickel
fd688b73d7 SDL: Work around bug #7038 by limiting mode reset to Win32.
Bug is: "IRIX: X BadMatch when trying to start any 640x480 game".

40e019efd4 introduced resetting the pixel depth
when unloading modes for SDL output. This was required to make mode listing
for OpenGL work on Win8+.

This causes issues on non-Win32 platforms though. SDL might not give us a valid
a pixel depth, causing the resetting to fail. A particular example is X11 on
IRIX, when only 16bit output modes work. Initially SDL tells us that the pixel
depth is 32bit. Trying to set this up causes a crash though.

Since there is no way to validate SDL's return value, we simply limit the reset
to platforms where it is actually required, i.e. Win32.
2016-02-17 16:17:39 +01:00
Johannes Schickel
366e164705 SDL: Implement initial support for resizable window with SDL2.
The code is disabled for now.
2015-12-18 19:12:11 +01:00
Johannes Schickel
64f9c902dd OPENGL: Smooth mouse experience when black bars are visible.
This gets rid of the feeling of the mouse sticking to black borders by using
the full output resolution as area for tracking game mouse movement. The same
behavior is present in plain SDL output with SDL2.
2015-12-14 20:26:05 +01:00
Johannes Schickel
898773e12f OPENGLSDL: Set proper mouse emulation dimensions.
Formerly we did not initialize the mouse emulation from SdlEventSource
properly. Now hopefully joysticks etc. should work fine with the SDL OpenGL
output too.
2015-12-13 23:53:27 +01:00
Johannes Schickel
5d48e211aa SDL: Fix mouse emulation with SDL2.
The mouse emulation via keyboard (or other means) was broken with
079037b739.
2015-12-13 21:30:25 +01:00
Johannes Schickel
942d0fdad4 OPENGL: Limit scissor override to invisible overlay.
This fixes some corner cases which caused black bars to appear for a few screen
updates when the overlay is visible.
2015-12-13 21:30:25 +01:00
Johannes Schickel
cbc517f14f SDL: Fix warpMouse for SDL2.
Thanks to bgK for noticing.
2015-12-13 15:44:42 +01:00
Johannes Schickel
693834e8c6 OPENGL: Implement black borders using scissor test. 2015-12-12 22:40:20 +01:00
Johannes Schickel
f65a8b2689 OPENGL: Only redraw screen when actual changes happened. 2015-12-12 22:31:35 +01:00
Johannes Schickel
fe2ee9ecf5 OPENGL: Refactor screen refresh handling.
Subclasses of OpenGLGraphicsManager are now supposed to supply a refreshScreen
function which handles actual screen updating (for example, buffer swapping).
2015-12-12 22:31:35 +01:00
Johannes Schickel
3232050dfc OPENGL: Fix include guard name. 2015-12-12 22:31:35 +01:00
Johannes Schickel
33be7ef5dd Merge branch 'rpi-sdl2'
This is a manual merge of pull request #632. The history fo the PR has been
cleaned up.
2015-12-08 21:43:34 +01:00
vanfanel
66dbb7f485 SDL/DISPMANX: Remove dispmanx graphics output. 2015-12-08 21:41:40 +01:00
vanfanel
1eecc41ef6 OPENGLSDL: Request GLES1.1 context with SDL2 for GLES targets. 2015-12-08 21:41:40 +01:00
Johannes Schickel
457640a162 SDL: Prevent cursor from leaving screen area in fullscreen with SDL2. 2015-12-08 15:43:36 +01:00
Johannes Schickel
079037b739 SDL: Prevent graphics stretching in fullscreen when using SDL2.
As a side effect we get better coordinates from mouse move events in
fullscreen, i.e. we do not get actual window coordinates but something close
to actual viewport coordinates. The easily noticable issue is that mouse
coordinates inside black bars are outside of the viewport. For example, the
x coordinate can get negative when there's a black bar at the left side.
2015-12-08 15:41:10 +01:00
vanfanel
9d831d0c42 SDL/DISPMANX Fixed small issues with merging: Use append_var, fix spacing issues and changed SurfaceSdlGraphicsManager constructor call parameters on DispmanXSdlGraphicsManager constructor. 2015-11-12 14:03:14 +01:00