Sasha Szpakowski
17ecb11ed6
macOS: fix initial Metal drawable size in certain multi-display setups
...
(cherry picked from commit baca26d727 )
2023-02-01 22:42:12 -08:00
slime
d2160c29d1
iOS: implement SDL_GetWindowSizeInPixels.
2022-10-05 18:39:18 -07:00
slime
f8f562dace
iOS: remove dead pre-iOS 8 codepaths.
...
SDL hasn't supported those older iOS versions for a little while now.
2022-10-02 19:57:46 -07:00
slime
bbeacd72c4
Fix some credit comments.
2022-10-02 19:32:36 -07:00
slime
b204db1e6b
cocoa: change Shape data to use ObjC objects instead of C structs.
...
Fixes #6089
2022-08-21 14:49:00 -07:00
slime
65647b3417
SDL_Render: use high precision texcoords in ES2 shaders, when possible
...
Fixes #5884
2022-07-22 19:03:53 -07:00
Alex Szpakowski
e9c7b5191c
macOS: Fix reference counts of internal window data.
...
Fixes crashes when destroying or recreating a window (#5664 ).
2022-05-16 18:17:27 -07:00
Alex Szpakowski
f871c178b9
macOS: remove dead code for supporting 10.6 at runtime.
2022-05-10 14:04:14 -07:00
Alex Szpakowski
ec8fa57750
macOS: always use Objective-C ARC (automatic ref counting).
...
Change Cocoa SDL_VideoData and SDL_WindowData implementations from C structs to Objective-C objects, since bridging between C and ObjC is easier that way.
2022-05-09 21:53:40 -07:00
Alex Szpakowski
d35c737f1c
macOS: change min supported OS from 10.6 to 10.7.
2022-05-09 21:53:40 -07:00
Alex Szpakowski
724468ae2c
GL renderer uses glDrawArrays instead of glBegin/glEnd.
...
Also change internal colors sent to GL to use unorm8 components instead of float, for improved performance.
2021-12-27 10:52:47 -05:00
Alex Szpakowski
7f5339e6c4
Document the packed integer formats SDL_Color is bit-compatible with.
2021-12-14 12:19:16 -08:00
Alex Szpakowski
3a5e148b13
Renderer backends use SDL_Color instead of int for geometry colors.
2021-12-14 12:19:16 -08:00
Alex Szpakowski
323ba6c008
d3d11 renderer: reduce vertex bandwidth and calculations.
2021-12-13 15:14:33 -08:00
Alex Szpakowski
ba4ef461ea
macOS: Fix implicit integer downcast warnings
2021-10-23 17:45:27 -04:00
Alex Szpakowski
09231c42ea
Fix flags check in test code
2021-02-15 08:43:53 -08:00
Alex Szpakowski
9b9d0d484d
mac/iOS: allow Metal in windows created without an explicit backend
...
Fixes SDL_CreateWindowAndRenderer (and similar situations) not choosing a Metal backend. See #3991 .
Passing an explicit backend into CreateWindow, eg SDL_WINDOW_OPENGL or SDL_WINDOW_METAL, will still prevent the window from being used with other backend types.
2021-02-15 08:43:53 -08:00
Alex Szpakowski
d4d32833f4
macOS: Fix Xcode project when deployment target is > 10.7
...
SDL_mfijoystick.m requires ARC, but the Xcode project's macOS targets weren't compiling the file with ARC enabled.
2021-02-14 13:51:34 -05:00
Alex Szpakowski
bda618a2af
iOS: remove some unused code, minor code style cleanup.
2019-10-27 11:41:48 -03:00
Alex Szpakowski
df49e2a572
iOS: replace a deprecated function call with a non-deprecated equivalent.
2019-10-27 11:41:11 -03:00
Alex Szpakowski
a963e36e2d
macOS: more robust detection and switching of exclusive-fullscreen display modes (bug #4822 ).
2019-10-26 15:27:51 -03:00
Alex Szpakowski
a9b867ab07
macOS Fix potential memory leaks in the Metal renderer caught by clang's static analyzer.
2019-10-26 14:39:50 -03:00
Alex Szpakowski
59beaccd50
macOS: Expose high dpi-capable display modes on macOS 10.13+.
...
Fixes an issue in macOS 10.15 where the displayed content would move up after entering, exiting and re-entering exclusive fullscreen when certain display modes were used (bug #4822 ).
Bug #3949 is also related to this change.
2019-10-24 20:15:54 -03:00
Alex Szpakowski
216f5b98ac
metal: Fix compilation when using older Apple SDKs (bug #4828 ).
2019-10-17 18:48:58 -03:00
Alex Szpakowski
074f6a512d
macOS: Fix the initial window background not being black since macOS 10.14.2 or so, when OpenGL is used (bug #4810 ). Also fixes "CGContext: invalid context 0x0" errors when an OpenGL window is created (bug #4470 ).
2019-10-14 00:51:53 -03:00
Alex Szpakowski
009226c61e
macOS: Fix non-highdpi OpenGL contexts not scaling properly in macOS 10.15 (bug 4810 and 4822).
2019-10-13 21:39:20 -03:00
Alex Szpakowski
f8bdefe1b5
macOS: Fix asserts in SDL_Render's metal scissor code when the window is resized.
2019-10-13 15:18:28 -03:00
Alex Szpakowski
1773da89f9
macOS: Fix a new issue in 10.15 where the window decorations don't always get restored after SDL_SetWindowFullscreen(window, 0).
2019-10-13 12:16:40 -03:00
Alex Szpakowski
f46ac1e9f7
macOS: Fix SDL_metal.h not being copied to the framework's Headers folder when SDL.framework is built using Xcode.
2019-09-27 20:15:42 -03:00
Alex Szpakowski
0c26373842
gl/gles/gles2 render: fix SDL_RenderClear being affected by the clip rect in some situations.
2019-08-26 18:49:04 -03:00
Alex Szpakowski
dd29abb478
macOS: Use the proper type (NSSize instead of CGSize) for the bounds of metal views.
2019-08-22 19:23:52 -03:00
Alex Szpakowski
bfdb0e9743
metal renderer: optimize SDL_RenderFillRect slightly.
2019-08-18 10:38:32 -03:00
Alex Szpakowski
ff7888e698
render: fix colors not being set properly after the previous change
2019-08-18 09:35:11 -03:00
Alex Szpakowski
1be03b4089
render: avoid a couple redundant memcmp calls in all drawing functions. Improves performance slightly.
2019-08-17 22:26:33 -03:00
Alex Szpakowski
e8278d0d5b
metal renderer: use vertex attributes instead of indexing into a buffer with the vertex id in the shader. Allows for more flexibility with vertex setup in the future.
...
Also optimize vertex buffer binding slightly.
2019-08-17 16:53:08 -03:00
Alex Szpakowski
55a46abf0a
metal renderer: more closely match buffer data alignment requirements from the metal specification.
2019-08-17 01:09:30 -03:00
Alex Szpakowski
69c6924ccc
render: simplify vertex and uniform data allocation. Improves performance of various SDL_Render functions (bug #4764 ).
2019-08-17 00:43:44 -03:00
Alex Szpakowski
e5acccc7c3
metal renderer: use the device address space instead of the constant address space for colors.
...
It doesn't negatively impact GPU performance in my tests, and it removes the need for 256 byte memory alignment of color data on macOS.
2019-08-17 00:37:22 -03:00
Alex Szpakowski
3fb5cabe5e
metal: Update compiled shaders based on compilation script changes
2019-08-16 22:13:30 -03:00
Alex Szpakowski
9e57e3e595
metal: Update shader compilation script with fixes for newer xcode versions and for running on older platforms
2019-08-16 22:11:50 -03:00
Alex Szpakowski
79cd6cfc94
iOS: Fix issues with Split VIew on iPad (bugs #4586 , #4705 ).
2019-08-15 19:38:12 -03:00
Alex Szpakowski
aebaa316c7
Add public APIs for creating a Metal view attached to an SDL window. Add SDL_metal.h.
2019-08-05 12:35:32 -03:00
Alex Szpakowski
f3683d3a09
macOS: fix a typo in touch handling code.
2019-08-04 23:30:55 -03:00
Alex Szpakowski
109cbd6e8b
Fix touch-related compile errors on Linux.
2019-08-04 16:56:40 -03:00
Alex Szpakowski
2fb71ac52d
Implement touch window IDs on x11/xinput2.
2019-08-04 00:34:23 -03:00
Alex Szpakowski
d5ec735a33
Add a windowID field to SDL_TouchFingerEvent (bug #4331 ).
...
This is unimplemented on some platforms and will cause compile errors when building those platform backends for now.
2019-08-01 18:22:12 -03:00
Alex Szpakowski
39e8b007a7
macOS: fix atomics using deprecated functions instead of compiler intrinsics, when SDL is built with the Xcode project.
2019-07-27 14:08:51 -03:00
Alex Szpakowski
8fb8adfc90
macOS: Fix SDL_GL_CreateContext/MakeCurrent on non-main threads causing a Main Thread Checker warning when built with Xcode 11 / the macOS 10.15 SDK.
...
Fixes bug #4714 .
2019-07-13 17:04:02 -03:00
Alex Szpakowski
027887da15
iOS: Fix the window size not being set properly when Split View is used on an iPad (bug #4586 ).
2019-07-01 14:52:56 -03:00
Alex Szpakowski
9306ef9b10
Fix synthetically generated mouse events getting lost forever after the device orientation changes (or the window is otherwise resized) while a finger is touching the screen.
2019-06-16 14:10:30 -03:00
Alex Szpakowski
f4625f52f2
iOS: remove some code which could affect the state of UIViews that aren't owned by SDL.
...
It was originally added to work around an input event problem in the code of a specific app which mixed SDL and native UIViews, but that app solved its problems in a better manner since then.
2019-06-16 13:52:27 -03:00
Alex Szpakowski
50f5123190
macOS: Fix the coordinate space of SDL_GetDisplayUsableBounds (thanks Tim!)
...
Fixes bug #4518 .
2019-06-12 19:57:30 -03:00
Alex Szpakowski
74e86a51d8
iOS: Remove didAddSubview override in NSWindow, its code breaks things which rely on focus changing within SDL's UIWindow (bug #4659 ).
2019-06-12 19:15:56 -03:00
Alex Szpakowski
9b5811592d
iOS: return SDL_GetWindowSize from SDL_GL_GetDrawableSize if there's no GLES view in the window (matches the behaviour of SDL_GL_GetDrawableSize on other platforms). Addresses bug #4629 .
2019-05-26 18:53:36 -03:00
Alex Szpakowski
90b08881ab
iOS: Remove code trying to support compilation on the iOS 7 SDK, the deployment target has been set to iOS 8 for years and there's other unconditionally compiled code that depends on newer SDKs so that code is useless.
2019-04-17 20:41:05 -03:00
Alex Szpakowski
9d7b26155a
macOS: Fix compilation when using the 10.9 SDK or older.
2019-04-17 20:14:40 -03:00
Alex Szpakowski
00c824a8b0
Fix disabling OpenGL vsync on macOS 10.14.4+ (bug #4575 ).
2019-04-10 22:30:58 -03:00
Alex Szpakowski
65e07b3884
iOS/tvOS: fix support for SDL_GameControllerGetButton(controller, GUIDE) with MFi controllers (thanks Caleb!)
...
Fixes bug #4463 .
2019-01-31 19:52:47 -04:00
Alex Szpakowski
dc3443602b
render: Fix internal state getting out of sync when destroying a texture that was just rendered and then creating a new one, in the GL and GLES2 backends. Fixes bug #4433 .
2018-12-21 20:53:31 -04:00
Alex Szpakowski
c7db6ade7d
metal: Implement SDL_LockTexture for YUV formats.
2018-12-19 18:27:21 -04:00
Alex Szpakowski
ce8c716ada
metal: Implement SDL_LockTexture for non-YUV textures.
2018-12-18 14:23:05 -04:00
Alex Szpakowski
37b1f989ce
metal: use a staging texture in SDL_UpdateTexture, to make sure it doesn't stomp texture data being drawn in a previous frame on the GPU.
2018-11-25 22:13:09 -04:00
Alex Szpakowski
872936a485
metal: Fix an incorrect division.
2018-11-21 23:46:37 -04:00
Alex Szpakowski
4a58722b9f
metal: SDL_RenderFillRects uses one draw call per 16k rectangles (within the given FillRects call), instead of one draw call per rectangle. Reduces CPU usage when drawing many rectangles.
2018-11-21 23:37:23 -04:00
Alex Szpakowski
c525ff354d
cocoa: fix building with the macOS 10.7 SDK (thanks Riccardo!)
...
Fixes bug #4368
2018-11-10 20:56:23 -04:00
Alex Szpakowski
5029d50ea8
Add SDL_TouchDeviceType enum and SDL_GetTouchDeviceType(SDL_TouchID id).
...
Touch device types include SDL_TOUCH_DEVICE_DIRECT (a touch screen with window-relative coordinates for touches), SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE (a trackpad-style device with absolute device coordinates), and SDL_TOUCH_DEVICE_INDIRECT_RELATIVE (a trackpad-style device with screen cursor-relative coordinates).
Phone screens are an example of a direct device type. Mac trackpads are the indirect-absolute touch device type. The Apple TV remote is an indirect-relative touch device type.
2018-11-10 16:15:48 -04:00
Alex Szpakowski
244b79e194
metal: SDL_RenderReadPixels on macOS synchronizes the render target's texture data if it's managed, before reading from it.
2018-11-04 14:31:56 -04:00
Alex Szpakowski
c9fed27289
metal: fix the SDL_RENDERER_PRESENTVSYNC flag not being set on the renderer info on macOS, when vsync is used.
2018-11-04 12:31:02 -04:00
Alex Szpakowski
c2bba9e448
metal: fix the size of the buffer used for constant data.
2018-11-04 12:24:05 -04:00
Alex Szpakowski
457390fcf8
metal: avoid an extra buffer allocation and GPU data copy in RunCommandQueue, it's not needed. Improves overall performance.
2018-11-01 20:24:21 -03:00
Alex Szpakowski
4e86dfd8d1
metal: remove an obsolete section of a constant buffer.
2018-11-01 19:49:01 -03:00
Alex Szpakowski
e2ad654f2e
iOS: Don't ignore the requested alpha bit size when determining whether to use an RGBA8 backbuffer.
2018-10-14 17:26:10 -03:00
Alex Szpakowski
8c41e2624e
metal: Fix SDL_RenderReadPixels to wait for the GPU to finish rendering to the active texture before reading its pixels.
2018-10-13 03:36:42 -03:00
Alex Szpakowski
d8022d19b4
macOS: Fixed MoltenVK dynamic library loading code.
2018-10-12 23:23:52 -03:00
Alex Szpakowski
d9094421e1
metal: Fix high dpi and resizing on macOS, and clean up iOS code. Fixes bug #4250 .
2018-10-12 17:55:42 -03:00
Alex Szpakowski
fb485986eb
macOS: Fix a crash when the video subsystem quits, if SDL_MAC_NO_SANDBOX was defined when SDL was compiled.
2018-09-30 11:26:41 -03:00
Alex Szpakowski
3bfada2e02
Android: resolve symlinks in SDL_AndroidGetInternalStoragePath (thanks Henrique Gemignani and cigumo!)
...
Fixes issues on modern Android versions when the path is used in code that explicitly doesn't follow symlinks (such as PHYSFS_mkdir).
2018-01-10 19:56:51 -04:00
Alex Szpakowski
7d5437bb31
metal: set max texture size based on device capability.
2018-01-07 22:00:37 -04:00
Alex Szpakowski
a8c0532c08
metal: Fix pipeline states to use the pixel format of the current render target, instead of a hard-coded format.
2018-01-07 16:57:32 -04:00
Alex Szpakowski
740a90af37
metal: Add support for YUV/NV12 texture formats.
2018-01-06 18:54:12 -04:00
Alex Szpakowski
9a8683b275
metal: use a private instead of managed buffer for the renderer's non-changing constant data.
...
Recommended by Xcode's Metal frame capture analysis.
2018-01-04 22:16:42 -04:00
Alex Szpakowski
990ebba55a
metal: Implement fast hardware clearing when possible, by deferring the start of a render pass until a clear or draw operation happens.
2018-01-04 19:29:33 -04:00
Alex Szpakowski
888198ee31
metal: Misc. improvements.
...
- Use a single buffer for various non-changing constants accessed by the GPU, instead of multiple buffers.
- Do the half-pixel offset for points and lines using a transform matrix so we don't need a malloc when rendering.
- Don't add a half-pixel offset for other primitives and textures. This matches D3D and GL render behaviour.
- Remove the half-texel texture coordinate offset since it's not needed now that there's no more half-pixel position offset when rendering a texture.
- Don't try to set texture usage on iOS 8 since it doesn't exist there.
2018-01-03 00:43:01 -04:00
Alex Szpakowski
f9cd765020
metal and moltenvk: fix highdpi.
2018-01-02 21:44:28 -04:00
Alex Szpakowski
ef1014ac68
configure script: Implement testing for build-time Metal SDK support.
2018-01-02 19:06:14 -04:00
Alex Szpakowski
07f08b47ff
metal: Fix a typo preventing iOS compilation...
2018-01-01 23:06:08 -04:00
Alex Szpakowski
1cc6603378
metal: Clean up manual reference counting. Fixes some memory leaks.
2018-01-01 23:03:50 -04:00
Alex Szpakowski
a452a08458
iOS: fix build
2018-01-01 19:40:29 -04:00
Alex Szpakowski
639ea9fdbc
metal: Use sampler state objects instead of shader-declared samplers for linear vs nearest filtering.
...
This avoids a ton of shader duplication once multiple shaders that use samplers are added (e.g. the currently missing YUV shaders).
2018-01-01 19:37:16 -04:00
Alex Szpakowski
cf45cf70e5
metal: Add support for custom blend modes.
2018-01-01 18:06:27 -04:00
Alex Szpakowski
85470a2f95
metal: implement SDL_RenderCopyEx, and fix a memory leak in SDL_CreateTexture.
2017-12-31 21:06:16 -04:00
Alex Szpakowski
047d387b2e
metal: Use the existing cocoa code for creating a Metal view on macOS. Fixes the renderer size when the window is resized.
2017-12-31 15:30:08 -04:00
Alex Szpakowski
48fea0cee4
macOS: Fix MoltenVK Metal view resizing, and allow the metal view to be used without vulkan.
2017-12-31 15:21:25 -04:00
Alex Szpakowski
42b19c9749
metal: Respect the vsync flag on macOS 10.13+.
2017-12-30 22:39:55 -04:00
Alex Szpakowski
e24dc9053b
metal: use a projection matrix instead of manually transforming vertices into clip space on the CPU.
2017-12-30 20:32:22 -04:00
Alex Szpakowski
49df65c25a
metal: only 4 (instead of 5) vertices are needed to draw rectangles and textures, and only 3 (instead of 5) vertices are needed to cover the screen for the 'full-screen quad' when clearing.
2017-12-30 18:48:07 -04:00
Alex Szpakowski
64ec4c3334
macOS: Make sure the desktop's display mode is always in SDL's list of display modes.
2017-12-29 22:13:40 -04:00
Alex Szpakowski
5501bcc834
macOS: Fix an OS-generated warning printed to stdout on launch in bundled apps.
2017-11-09 22:24:09 -04:00
Alex Szpakowski
fb071a4cd9
Mac: Fix the menu bar not always working for non-.app-bundled apps. Fixes bug #3051 .
2017-09-25 20:49:31 -03:00
Alex Szpakowski
e5cfb58f4a
iOS MoltenVK code style cleanup.
2017-09-21 20:30:25 -03:00