Commit Graph

11015 Commits

Author SHA1 Message Date
Ryan C. Gordon
8f69685114 render: first (untested!) shot at converting D3D11 renderer to new interfaces.
Probably doesn't even compile yet.

--HG--
branch : SDL-ryan-batching-renderer
2018-10-03 00:52:37 -04:00
Ryan C. Gordon
aa25eac8b2 render: Make the GL backends cache and defer more state changes.
--HG--
branch : SDL-ryan-batching-renderer
2018-10-01 22:53:45 -04:00
Ryan C. Gordon
ed989b22d3 render: D3D9 doesn't need to check for stream offset support anymore.
We don't use offsets at all now. Too slow.

--HG--
branch : SDL-ryan-batching-renderer
2018-10-01 13:41:15 -04:00
Ryan C. Gordon
0dba45d345 render: Set the D3D9 stream source once and choose offsets during draw calls.
This is _much_ faster than setting the offsets with SetStreamSource!

--HG--
branch : SDL-ryan-batching-renderer
2018-10-01 11:32:08 -04:00
Ryan C. Gordon
2cab97f9dc render: Patched to compile.
--HG--
branch : SDL-ryan-batching-renderer
2018-10-01 03:02:54 -04:00
Ryan C. Gordon
1b0158b580 render: first shot at moving Direct3D 9 backend to new interface. Untested!
--HG--
branch : SDL-ryan-batching-renderer
2018-10-01 01:23:02 -04:00
Ryan C. Gordon
faad181a71 render: patched to compile on C89 compilers, other untested code fixes.
--HG--
branch : SDL-ryan-batching-renderer
2018-09-29 04:00:38 +00:00
Ryan C. Gordon
408e4c9099 opengles1: set some non-zero drawstate defaults.
--HG--
branch : SDL-ryan-batching-renderer
2018-09-28 19:48:14 -04:00
Ryan C. Gordon
14c2b06a9c render: moved opengles2 over to new interface.
--HG--
branch : SDL-ryan-batching-renderer
2018-09-28 19:47:44 -04:00
Ryan C. Gordon
a6eda22a6a cocoa: Force an OpenGL context update when the window becomes key.
Fixes missing rendering on macOS 10.14 ("Mojave").

Fixes Bugzilla #4272.
(transplanted from 55489adbb75c8eb7c7719a3f9c85a15d06df2f27)

--HG--
branch : SDL-ryan-batching-renderer
2018-09-26 20:10:32 -04:00
Ryan C. Gordon
7f0ebb3cd4 render: Do state cache improvements for GLES1, too.
--HG--
branch : SDL-ryan-batching-renderer
2018-09-25 21:35:09 -04:00
Ryan C. Gordon
b7fa8ed2af render: OpenGL renderer now caches some state, to improve non-batching mode.
(other minor bug fixes in here, too)

--HG--
branch : SDL-ryan-batching-renderer
2018-09-25 19:20:31 -04:00
Ryan C. Gordon
268a7ace96 render: Move non-batching flushes to different place.
This lets us batch up a few commands that are all related to the same API
call.

--HG--
branch : SDL-ryan-batching-renderer
2018-09-25 17:04:47 -04:00
Ryan C. Gordon
fa8e424e86 render: opengles renderer actually works now. :)
--HG--
branch : SDL-ryan-batching-renderer
2018-09-25 16:17:10 -04:00
Ryan C. Gordon
efa07a8ede render: First shot at converting opengles renderer to new interfaces.
--HG--
branch : SDL-ryan-batching-renderer
2018-09-25 10:41:25 -04:00
Ryan C. Gordon
b0e46a4a68 render: get rid of the predeclared functions in the GL and Metal renderers.
(others to come as I continue to update render backends!)

--HG--
branch : SDL-ryan-batching-renderer
2018-09-24 12:30:47 -04:00
Ryan C. Gordon
611f845747 render: Make opengl backend take advantage of new high-level features.
--HG--
branch : SDL-ryan-batching-renderer
2018-09-24 02:08:34 -04:00
Ryan C. Gordon
65ec350cba render: Add command queue debug logging.
--HG--
branch : SDL-ryan-batching-renderer
2018-09-24 02:07:35 -04:00
Ryan C. Gordon
d86e6ca134 render: Update Metal and GL backends to use new high-level features, etc.
Now nothing is uploaded as dynamic data with Metal's setVertexBytes, etc; it's
all in the one big vertex buffer, now.

--HG--
branch : SDL-ryan-batching-renderer
2018-09-23 23:22:56 -04:00
Ryan C. Gordon
9a4dcd13fb render: A bunch of high-level improvements.
- high-level filters out duplicate render commands from the queue so
  backends don't have to.
- Setting draw color is now a render command, so backends can put color
  information into the vertex buffer to upload with everything else instead
  of setting it with slower dynamic data later.
- backends can request that they always batch, even for legacy programs,
  since the lowlevel API can deal with it (Metal, and eventually Vulkan
  and such...)
- high-level makes sure the queue has at least one setdrawcolor and
  setviewport command before any draw calls, so the backends don't ever have
  to manage cases where this hasn't been explicitly set yet.
- backends allocating vertex buffer space can specify alignment, and the
  high-level will keep track of gaps in the buffer between the last used
  positions and the aligned data that can be used for later allocations
  (Metal and such need to specify some constant data on 256 byte boundaries,
  but we don't want to waste all that space we had to skip to meet alignment
  requirements).

--HG--
branch : SDL-ryan-batching-renderer
2018-09-23 23:20:40 -04:00
Ryan C. Gordon
68a85f28c3 render: First shot at moving metal backend over to new batching system.
--HG--
branch : SDL-ryan-batching-renderer
2018-09-20 16:40:04 -04:00
Ryan C. Gordon
f9e1ac8841 render: first shot at reworking opengl backend for new batching system.
--HG--
branch : SDL-ryan-batching-renderer
2018-09-20 16:36:54 -04:00
Ryan C. Gordon
9674e72d76 render: Move to a batching system for rendering (work in progress).
--HG--
branch : SDL-ryan-batching-renderer
2018-09-20 15:46:02 -04:00
Ryan C. Gordon
1495475a85 testsprite2: report average FPS in blocks of five seconds.
This makes the reporting more accurate, vs startup inefficiencies and other
scheduling burps.

--HG--
branch : SDL-ryan-batching-renderer
2018-09-20 15:41:57 -04:00
Ryan C. Gordon
4466cb6ab2 gles2: Make render command queue dynamic.
It now uses a growable linked list that keeps a pool of allocated items for
reuse, and reallocs the vertex array as necessary. Testsprite2 can scale to
20,000 (or more!) draws now without drama.

--HG--
branch : SDL-ryan-batching-renderer
2018-09-09 15:09:38 -04:00
Ryan C. Gordon
a94e0df711 gles2: Major renderer optimization. Work in progress!
This moves all the rendering to a command list that is flushed to the GL as
necessary, making most common activities upload a single vertex buffer per
frame and dramatically reducing state changes. In pathological cases,
like Emscripten running on iOS's Safari, performance can go from a dozen
draw calls killing your performance to 1000 draw calls running smoothly.

This is work in progress, and not ready to ship. Among other things, it has
a hardcoded array that isn't checked for overflow. But the basic idea is
sound!

--HG--
branch : SDL-ryan-batching-renderer
2018-09-08 18:26:11 -04:00
Ryan C. Gordon
6ac7353add Created SDL-ryan-batching-renderer branch for the WIP renderer rewrite.
--HG--
branch : SDL-ryan-batching-renderer
2018-09-25 10:45:37 -04:00
Ryan C. Gordon
cdac13e19c metal: Make sure layer drawableSize is adjusted on resize.
Fixes Bugzilla #4250.
2018-09-06 00:56:13 -04:00
Ryan C. Gordon
3ac049e49c Fixed a comment typo. 2018-09-05 21:24:13 -04:00
Sam Lantinga
1c88fc1cbf Fixed bug 4002 - Android, nativeRunMain() fails on some phone with arm64-v8a
Sylvain

The issue is totally reproducible on P8 Lite.

"The dlopen() call doesn't include the app's native library directory. The behavior of  dlopen() by Android is not guaranteed".

Workaround in getMainSharedObject()

Just replace
    return library;
with
    return getContext().getApplicationInfo().nativeLibraryDir + "/" + library;
2018-09-05 15:54:46 -07:00
Sam Lantinga
88d7d340f8 Speculatively disable rumble on the Razer Panthera Evo, which doesn't have rumble motors and probably hangs in the same way the Panthera does. 2018-09-05 15:28:06 -07:00
Sam Lantinga
1da5d57b3d Updated Xcode library version to match libtool output with Ozkan's change 2018-09-05 13:04:50 -07:00
Sam Lantinga
47eb5c669e Don't overwrite the default binding when changing the binding for a controller that was using the default. 2018-09-05 12:16:01 -07:00
Sam Lantinga
7fe3c4b2ad Added binding for Mad Catz FightStick TE S+ (PS3) on Mac OS X 2018-09-05 11:24:23 -07:00
Sam Lantinga
5d8d1ac764 Added support for the Razer Panthera Fightstick
Fixed bindings for the Mad Catz FightStick TE S+
2018-09-05 11:18:50 -07:00
Ozkan Sezer
1d8d253674 CMakeLists.txt: fix typo SDL_SENSORS_DISABLED -> SDL_SENSOR_DISABLED 2018-09-02 23:57:06 +03:00
Ryan C. Gordon
846526767d test: Makefile should copy .dat files for testoverlay2. 2018-09-02 00:35:11 -04:00
Ryan C. Gordon
3987531781 metal: SDL_UpdateYUVTexture shouldn't swap planes based on format. 2018-09-01 20:47:12 -04:00
Sam Lantinga
a28c07e23d Better fix to make sure we're only returning controllers from the HIDAPI joystick API 2018-08-31 18:10:21 -07:00
Sam Lantinga
789f59f5df Removed VID/PID 0x1532/0x0037, which was listed in the Linux kernel as a Razer Sabertooth, because at least one variant of the Razer DeathAdder mouse shows up with this VID/PID. 2018-08-31 17:47:34 -07:00
Ozkan Sezer
3512d4dbbb fix permissions 2018-08-30 12:50:10 +03:00
Sam Lantinga
aaa121432e Don't show the Razer Raiju sound interface as a game controller 2018-08-29 20:55:02 -07:00
Sam Lantinga
07f8de33f6 Fixed compiler warning and use higher precision in angle calculation 2018-08-29 20:23:42 -07:00
Sam Lantinga
f3e84167ad Don't rumble Bluetooth PS4 controllers by default, as that switches the controller into extended input report mode, which breaks games that use DirectInput. 2018-08-29 20:23:39 -07:00
Sam Lantinga
29ce0288aa Fixed whitespace 2018-08-29 20:23:36 -07:00
Sam Lantinga
3de426698b Fixed Xbox One S Bluetooth support on Mac OS X 2018-08-29 18:56:54 -07:00
Ozkan Sezer
0dd9dfe464 SDL_evdev.c: undefine _THIS before redefining it.
src/core/linux/SDL_evdev.c:104:1: warning: "_THIS" redefined
In file included from src/core/linux/../../events/SDL_events_c.h:26,
                 from src/core/linux/SDL_evdev.c:45:
src/core/linux/../../events/../video/SDL_sysvideo.h:146:1: warning: this is the location of the previous definition
2018-08-29 11:04:02 +03:00
Sam Lantinga
61f11dafb5 Fixed Windows build 2018-08-28 16:19:31 -07:00
Sam Lantinga
eddc4411e4 Fixed bug 4229 - Add support for ABGR format in DirectFB renderer
Alexandre

DirectFB supports 32-bit ABGR pixel format via DSPF_ABGR, but SDL doesn't map SDL_PIXELFORMAT_ABGR8888 to DSPF_ABGR.

A patch is attached and should add support for ABGR pixel format devices.
2018-08-28 13:37:11 -07:00
Andreas Müller
eb2445d1ea GLES2: Get sin/cos out of vertex shader
The only place angle is activated and causes effect is RenderCopyEx. All other
methods which use vertex shader, leave angle disabled and cause useless sin/cos
calculation in shader.

To get around shader's interface is changed to a vector that contains results
of sin and cos. To behave properly when disabled, cos value is set with offset
-1.0 making 0.0 default when deactivated.

As nice side effect it simplifies GLES2_UpdateVertexBuffer: All attributes are
vectors now.

Additional background:

* On RaspberryPi it gives a performace win for operations. Tested with
  [1] numbers go down for 5-10% (not easy to estimate due to huge variation).
* SDL_RenderCopyEx was tested with [2]
* It works around left rotated display caused by low accuracy sin implemetation
  in RaspberryPi/VC4 [3]

[1] https://github.com/schnitzeltony/sdl2box
[2] https://github.com/schnitzeltony/sdl2rendercopyex
[3] https://github.com/anholt/mesa/issues/110

Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
2018-08-28 12:57:51 -07:00