Log

Author Commit Date CI Message
Sam Lantinga 758156a7 2017-11-04T09:37:29 Fixed bug 3917 - Android, issues with getManifestEnvironmentVariable We're going to push the manifest environment variables from the Java side instead of continually querying for them from the native side.
Sam Lantinga 7334a2a1 2017-11-04T09:07:33 Fixed bug 3940 - Add support for EGL_SURFACE_TYPE tomwardio Add support to be able to set EGL_SURFACE_TYPE bits when creating an EGL config. This is usefule when wanting to create pixel buffer surfaces in custom video drivers.
Conn O'Griofa bf3e363d 2017-11-04T09:04:19 Raspberry Pi: fix ES 1/PVR support & autodetect Mesa driver * The brcmGLESv2 vendor library also supports ES PVR/1 profiles * Fallback to standard Mesa libraries if the VC4 driver is loaded
Conn O'Griofa 547448df 2017-11-04T09:03:20 SDL_video: try to bootstrap KMSDRM before RPI video driver Allow better coexistence between RPI's vendor libraries and VC4 mesa driver.
Sam Lantinga 7abef33c 2017-11-04T09:00:40 Android configure-based build fixes (thanks Vit!)
Johannes Bader 17243133 2017-11-04T11:16:49 Emscripten: use cursor hotspot the cursor's hotspot simply wasn't translated to it's CSS equivalent, yet see https://developer.mozilla.org/en-US/docs/Web/CSS/cursor?v=example#Syntax. no explicit hotspot if (0|0) for compatibility with Edge and IE, which indeed don't support custom hot spots
Sam Lantinga bb8c3a9c 2017-11-02T10:41:55 Make SDL fullscreen windows on Android actually fullscreen
Sam Lantinga c954b538 2017-11-02T08:48:14 Fixed bug 3935 - Not find joysticks if android run 24-48 days. Alexander Orefkov In src\joystick\android\SDL_sysjoystick.c in SDL_SYS_JoystickDetect when SDL_GetTicks return number grater 2147483648 (after 24.85 days uptime) SDL_TICKS_PASSED(SDL_GetTicks(), timeout) return FALSE and Android_JNI_PollInputDevices is never calling. And in JoystickByDeviceId - when search for newly added joystic - after SDL_SYS_JoystickDetect item not reinitilized, and always stay NULL, cause return NULL instead of added joystick.
Sam Lantinga 522901b8 2017-11-02T08:46:14 Fixed bug 3933 - Android, no need of the listener thread Sylvain A listener thread has been added to know when the native thread would end. But now, it is more easy to only check that after the main function has returned. It's one thread less.
Sam Lantinga 1475e698 2017-11-01T19:19:21 Fixed bug 3917 - Android, issues with getManifestEnvironmentVariable Sylvain Some issue with this commit: https://hg.libsdl.org/SDL/rev/97387a8b88d3 There is a memory allocation missing.
Sam Lantinga 8c465802 2017-11-01T18:41:11 Allow the activity to persist through connecting or disconnecting a keyboard
Sam Lantinga 62c3acaf 2017-11-01T18:40:11 Moved the meta-data into the right section
Sam Lantinga 54a0245b 2017-11-01T17:41:25 Fixed bug 3926 - SDL_main export e_pluschauskas I noticed that after updating SDL to 2.0.6 my application now exports SDL_main. At GitHub SDL mirror (branch 2.0.5) SDL_main prototyped as extern C_LINKAGE int SDL_main(int argc, char *argv[]); but at branch 2.0.6 prototype is extern C_LINKAGE DECLSPEC int SDL_main(int argc, char *argv[]);
Sam Lantinga 9192c93e 2017-11-01T17:30:02 Fixed bug 3932 - Android, GetDisplayDPI release local reference Sylvain When writing JNI code, one has to make sure all local references are released otherwise the app end up crashing.
Sam Lantinga a7d2d12c 2017-11-01T10:07:04 Fixed building on non-Android platforms
Sam Lantinga a90be440 2017-11-01T10:06:58 Added controller mapping for Android TV remotes Also fixed the back button on the remote exiting the application
Sam Lantinga 4478707b 2017-10-31T13:49:59 Add SDL_GetDisplayDPI implementation on Android. (thanks Rachel!)
Sam Lantinga 6d23ea4b 2017-10-29T21:09:09 Fixed Java string comparison with ""
Sam Lantinga fa5db3a9 2017-10-28T12:11:25 Added the old ant Android build project structure
Brandon Schaefer 2ac567b7 2017-10-26T16:37:20 Fixed bug 3902 - Add a specific KMSDRM hint for low latency video
Sam Lantinga f24c6672 2017-10-26T10:49:33 Updated SDL iOS project for tvOS
Sam Lantinga 213b2490 2017-10-26T10:42:14 Added missing keyinfotable.h
Sam Lantinga 8e37bed3 2017-10-26T10:41:38 android: Fix softkeyboard issue in SDL on Android.
Ryan C. Gordon 9bbf92e3 2017-10-25T18:02:11 cocoa: Don't change the NSWindow background color. Changing the background color causes the titlebar to blend against it on modern macOS releases, making all SDL windows look wrong by default. This was set to make the window not flash white before a GL context is ready, but we can accomplish this in our window's view's drawRect implementation, too.
David Ludwig 0e032d58 2017-10-24T13:21:11 WinRT: Move Windows::Foundation::Initialize to SDL2.dll, from SDL_main. This allows C# UWP applications to use SDL2's SDL_WinRTRunApp function. Kudos to Ethan Lee (flibitijibibo@flibitijibibo.com) for the patch. Thanks!
Sam Lantinga 8fd0c22a 2017-10-24T00:17:07 Added the ability to set SDL hints from AndroidManifest.xml (thanks Rachel!) This is especially useful for things like the accelerometer hint which could be needed before application main().
Sam Lantinga 45536710 2017-10-24T00:04:40 Fixed crash if mSurface isn't set up when we pause the application
Sam Lantinga 81f7e0c1 2017-10-23T23:35:04 Removed unneeded file automatically generated by Android Studio
Sam Lantinga b8d8a1f1 2017-10-23T23:26:40 Updated the minimum and target SDK versions in AndroidManifest.xml
Sam Lantinga edf0fae1 2017-10-23T23:23:47 Updated Android build tools version, which bumped minimum deployment target to API 14 Also added native code to the Android gradle project, which allows using gradle or Android Studio to build the entire SDL application without a separate ndk-build step.
Sam Lantinga 76cdce44 2017-10-23T23:23:34 Fixed build with older Android SDK
Sam Lantinga f08480af 2017-10-23T15:23:43 Switched to new style gradle Android application build process
Sam Lantinga 862da6ff 2017-10-23T12:33:18 Added tag release-2.0.7 for changeset f69c9f74a857
Sven Hesse b89cac67 2017-10-22T20:24:58 Don't X error in SDL_CreateWindow with unsupported GL attributes
Sam Lantinga adc64f92 2017-10-21T22:26:24 Added Visual Studio solution files for WinRT projects
Sam Lantinga 10376eb9 2017-10-21T04:20:57 Fixed bug 3901 - Fix vsync-ed pageflips on the KMSDRM video driver Manuel I noticed that, at least on Intel GPU hardware, passing SDL_RENDERER_PRESENTVSYNC would result on a static console instead of the program graphics. That was due to the fact that calling drmModePageFlip() only works if we have previously set up CRTC to one of the GBM buffers with a drmModeSetCrtc() call, so now it's done and things work as expected. The KMSDRM_GLES_SetupCrtc() call is done only one time, only when needed (when egl_swapinterval is not 0: when it's 0, there's no need for it because we flip by calling drmModePageFlip() anyway). The place where KMSDRM_GLES_SetupCrtc() call is done may look strange, but it's right: it needs EGL completely ready because it needs to call eglSwapBuffers() internally to work (see more comments about it in the code).
Sam Lantinga e830ef34 2017-10-20T16:53:42 Fixed typo converting 4 channel audio to 2 channel
Sam Lantinga 9a291c1e 2017-10-20T14:51:22 Added a note about adjusting channel weights when converting to fewer channels
Sam Lantinga fe2b5fec 2017-10-20T14:48:10 Document the SDL audio channel mapping
Sam Lantinga 7a6cf53a 2017-10-20T10:45:38 Added SDL_AudioStreamFlush() to the list of new audio stream functions
Sam Lantinga c339d9ed 2017-10-20T10:29:22 Reverted changes 6acdea394736 and 1448a2ac30fe I don't want to introduce any regressions with Android TV remote support
Sam Lantinga 2001898d 2017-10-19T15:37:52 Fixed Android joystick detection
Ryan C. Gordon 72932906 2017-10-19T18:05:42 audio: Added SDL_AudioStreamFlush().
Sam Lantinga 9d9be456 2017-10-19T13:54:56 Don't use DPAD devices as joystick input on Android
Ryan C. Gordon e98920f5 2017-10-18T23:49:46 Check correct variable for malloc() results.
Sam Lantinga afefcbfe 2017-10-18T19:30:47 Fixed bug 3876 - Resampling of certain sounds adds heavy distortion Simon Hug Patch that adds [-1, 1] clamping to the scalar audio type conversions. This may come from the SDL_Convert_F32_to_X_Scalar functions. They don't clamp the float value to [-1, 1] and when they cast it to the target integer it may be too large or too small for the type and get truncated, causing horrible noise. The attached patch throws clamping in, but I don't know if that's the preferred way to fix this. For x86 (without SSE) the compiler (I tested MSVC) seems to throw a horrible amount of x87 code in it. It's a bit better with SSE, but probably still quite the performance hit. And SSE2 uses a branchless approach with maxss and minss.
Sam Lantinga 653ab5d9 2017-10-18T19:26:36 Added a staging buffer to the audio stream so that we can accumulate small amounts of data if needed when resampling
Sam Lantinga 80f8464d 2017-10-18T15:54:05 Added audio stream conversion functions: SDL_NewAudioStream SDL_AudioStreamPut SDL_AudioStreamGet SDL_AudioStreamAvailable SDL_AudioStreamClear SDL_FreeAudioStream
Sam Lantinga 9fd0d619 2017-10-18T08:52:04 Fixed bug 3821 - Allow SDL_CreateWindow and SDL_CreateRenderer with OpenGL ES 3.0 (GLES3) for Angle (Windows) Carlos Angle supports GLES3 but when using these functions (SDL_CreateWindow and SDL_CreateRenderer), defaults again to GLES2.0. A current workaround (hack) to retrieve a GLES3.0 context with Angle is: 1) set SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); after InitSDL AND after calling SDL_CreateWindow (before SDL_CreateRenderer) 2) Comment lines 2032-2044 in SDL_render_gles2.c, funtion GLES2_CreateRenderer window_flags = SDL_GetWindowFlags(window); if (!(window_flags & SDL_WINDOW_OPENGL) || profile_mask != SDL_GL_CONTEXT_PROFILE_ES || major != RENDERER_CONTEXT_MAJOR || minor != RENDERER_CONTEXT_MINOR) { changed_window = SDL_TRUE; SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, RENDERER_CONTEXT_MAJOR); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, RENDERER_CONTEXT_MINOR); if (SDL_RecreateWindow(window, window_flags | SDL_WINDOW_OPENGL) < 0) { goto error; } } This retrives a GLES3 context as confirmed using glGetString(GL_VERSION). This should be fixed by modifying a few if's.
Sam Lantinga 556a8544 2017-10-16T15:22:40 Fixed compiler warning on iOS
Sam Lantinga e4ef1885 2017-10-16T14:57:42 Fixed bug 3890 - Incomplete fix for CVE-2017-2888 Felix Geyer http://hg.libsdl.org/SDL/rev/a31ee4d64ff6 tries to fix CVE-2017-2888. Unfortunately compilers may optimize the second condition "(size / surface->pitch) != surface->h" away. See https://bugzilla.redhat.com/show_bug.cgi?id=1500623#c2 I've verified that this is also the case on Debian unstable (gcc 7.2).
Sam Lantinga a225ffc1 2017-10-16T14:39:56 Added min/max macros for the sized SDL datatypes
Sam Lantinga 8e98bdaa 2017-10-15T21:21:19 Fixed bug 3883 - SDL_assert / SDL_PromptAssertion in TTY mode does not accept options ("abriA") shoerbaffen fgets can read a newline and SDL_strcmp will never return zero.
Sam Lantinga f658a737 2017-10-15T21:07:01 Fixed bug 3882 - cmake fix for osx Ozkan Sezer In my cross-build environment with cmake-2.8.12.1, cmake does not add SDL_coreaudio.m to its makefiles and the result is a failure. The fix is simple: set the language to C for it as it is done at other places in CMakeLists.txt.
Sam Lantinga dff56c34 2017-10-13T19:55:07 Android Studio code analyzer fixes
Sam Lantinga a223560a 2017-10-13T19:30:34 Fixed bug 3880 - X Error upon quit since rev. 11607 Ozkan Sezer Since changeset 11607:60cd425a2f14, I am getting the following error upon quit. Running testsprite2, clicking the mouse, and quiting it is enough to trigger it. This is on my old Fedora9 x86-Linux: X Error of failed request: BadCursor (invalid Cursor parameter) Major opcode of failed request: 2 (X_ChangeWindowAttributes) Resource id in failed request: 0xb057340 Serial number of failed request: 905 Current serial number in output stream: 906 Reverting https://hg.libsdl.org/SDL/rev/60cd425a2f14 removes the error.
Sam Lantinga cf923648 2017-10-13T09:50:04 Fixed bug 3879 - add missing SDLCALL to SDLTest_TrackedMalloc & co. Ozkan Sezer The attached trivial patch adds missing SDLCALL to SDLTest_TrackedMalloc & co.
Ryan C. Gordon fa156741 2017-10-13T01:15:29 coreaudio: changed device close procedure to prevent long hangs in some cases. The audioqueue thread needs to keep running, and processing the CFRunLoop until the AudioQueue is disposed of, otherwise CoreAudio will hang waiting for final data to feed the device. At least, I think this is how it all works. It definitely fixes the bug here! Since AudioQueueDispose() calls AudioQueueStop() internally, there's no need for our thread to handle this, either, which is good because the AudioQueue would be disposed by this point. So now the AudioQueue is disposed first, and then our thread is joined, and everything works out okay. Just in case, we mark the device "paused" before setting everything in motion, so any further callbacks from CoreAudio will write silence and not fire the app's audio callback again. Fixes Bugzilla #3868.
Sam Lantinga 0506d4fc 2017-10-12T17:21:57 Build both 32 and 64-bit architectures in the OSX Framework
Sam Lantinga fc60db86 2017-10-12T17:17:09 Fixed compiler warning
Sam Lantinga 22b6df51 2017-10-12T14:46:28 Use the lower-case hex output to match other stack trace printouts
Sam Lantinga 70791956 2017-10-12T14:44:54 Fixed compiler warning
Sam Lantinga 5fc20176 2017-10-12T14:25:07 Fixed bug 3877 - missing SDLCALL in SDLTest_ExampleHitTestCallback Ozkan Sezer Following trivial patch adds missing SDLCALL to SDLTest_ExampleHitTestCallback()
Sam Lantinga 4b284298 2017-10-12T14:21:21 Android doesn't have libunwind.h in API 16
Sam Lantinga 41a60394 2017-10-12T14:20:17 Added missing file
Sam Lantinga 21cd2df6 2017-10-12T14:02:24 Fixed compiler warning
Sam Lantinga ba10d2b6 2017-10-12T13:55:35 Fixed compiler warning
Sam Lantinga 9c580e14 2017-10-12T13:44:28 Added functions to query and set the SDL memory allocation functions: SDL_GetMemoryFunctions() SDL_SetMemoryFunctions() SDL_GetNumAllocations()
Sam Lantinga 1887c54c 2017-10-12T13:28:48 Fixed memory leak in Cocoa mouse code The video quit call cleans up the mouse cursor driver data, which happens after mouse quit
Sam Lantinga f4cd68a5 2017-10-12T08:47:02 Fixed bug 3866 - CMake error when trying to make the 'uninstall' target when it already exists Steve Robinson In my project, the 'uninstall' target is already created by the glew library. I get this error when SDL2 tries to create it: CMake Error at _build/3rdparty/SDL2/SDL2-2.0.6/CMakeLists.txt:1816 (add_custom_target): add_custom_target cannot create target "uninstall" because another target with the same name already exists. The existing target is a custom target created in source directory "D:/Code/sdl2-tutorial/_build/3rdparty/glew/glew-2.1.0/build/cmake". See documentation for policy CMP0002 for more details. To fix it, go to the bottom of the SDL2 CMakeLists.txt file. Add an if statement to check for the existence of the target before creating it. The end result looks like this: if(NOT TARGET uninstall) configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) endif() This is how the glew library deals with this possibility in their CMakeLists.txt file.
Sam Lantinga 4f38db17 2017-10-12T08:44:45 Fixed bug 3867 - Can't find install_manifest.txt when running 'uninstall' target Steve Robinson When I try to build the 'uninstall' target in CMake when SDL2 is added to a subdirectory of my project, I get this error: 1>CMake Error at cmake_uninstall.cmake:2 (message): 1> Cannot find install manifest: 1> "D:/Code/sdl2-tutorial/_build/3rdparty/SDL2/SDL2-2.0.6/install_manifest.txt" The install_manifest.txt is actually in the top-level binary directory, not the project-specific binary directory. To fix it, change all instances of: CMAKE_CURRENT_BINARY_DIR To: CMAKE_BINARY_DIR In: cmake_uninstall.cmake.in
Sam Lantinga f4f9e39f 2017-10-12T08:41:11 Fixed bug 3874 - Compiler warnings SDL_Surface.c and SDL_cocoakeyboard.m
Sam Lantinga a7c79c5e 2017-10-12T08:37:55 Normalize touch events to the render viewport (thanks Sylvain!)
Sam Lantinga 5bed4ca9 2017-10-12T08:27:22 Fixed divide by zero with a 1x1 sized window
Sam Lantinga 0ce23a54 2017-10-12T08:08:04 Updated version to 2.0.7
Ozkan Sezer bef0fec1 2017-10-12T14:28:05 make sure that SDL_malloc(0) or SDL_calloc(0,x) doesn't return NULL.
Sam Lantinga c0019b7f 2017-10-11T13:31:21 Fixed bug 3871 - Touch events are not normalised on X11 Trent Gamblin The documentation for SDL_TouchFingerEvent says that the x and y coordinates are normalised between 0-1. I've found that to be true on Windows, Android and iOS but on X11 they are in pixel coordinates. This patch fixes the issue. This was the cleanest way I could do it with what was available without changing things around a lot but you may know a better way.
Sam Lantinga b53c35df 2017-10-11T13:26:58 Fixed size in realloc
Ryan C. Gordon 5e5f2290 2017-10-11T12:07:43 audio: Turns out the accumulation errors sound better. :/ Moving to double fixed the overflows, but using "time = i * incr" instead of "time += incr" causes clicks in the output.
Ryan C. Gordon 9bd2c6b4 2017-10-11T11:51:14 audio: Moved the resampler state up to double precision. Fixes more buffer overflows.
Ryan C. Gordon b2f5123b 2017-10-11T11:43:35 audio: calculate resampling time directly, don't increment (thanks, Eric!). Fixes buffer overruns as floating point errors accumulate. Partially fixes Bugzilla #3848.
Ryan C. Gordon 763c3871 2017-10-11T02:33:55 audio: clamp resampler interpolation values to prevent buffer overflow. Partially fixes Bugzilla #3848.
Ryan C. Gordon 0085f917 2017-10-11T02:31:58 audio: Moved unchanging variable out of loop.
Ryan C. Gordon cb8bf6bb 2017-10-11T02:03:05 audio: Make sure audio stream resampling doesn't overflow buffers.
Ryan C. Gordon 459e2b0b 2017-10-11T01:37:11 audio: Fixed check for minimum audio stream put size.
Sam Lantinga 0e495e83 2017-10-10T20:16:52 Updated WhatsNew.txt for 2.0.7 changes
Sam Lantinga 8446d4a0 2017-10-10T20:11:05 Changed overlapping memcpy to memmove
Sam Lantinga eb9e6938 2017-10-10T19:44:33 Fixed potentially calling a callback after it has been removed (and userdata possibly deleted)
Ryan C. Gordon 903ff641 2017-10-10T22:31:02 audio: SDL_ResampleCVT() should use memmove instead of memcpy. This copy can overlap. Fixes Bugzilla #3849.
Ryan C. Gordon 42fff7ce 2017-10-10T22:18:46 audio: Don't stack-allocate resampler padding. (I thought padding size ranged from 5 frames to ~30 frames (based around RESAMPLER_ZERO_CROSSINGS, which is 5), but it's actually between 512 and several thousands (based on RESAMPLER_SAMPLES_PER_ZERO_CROSSING)). It gets big fast when downsampling.
Sam Lantinga b647bd06 2017-10-10T17:41:41 The event filter and event watch functions are now thread-safe
Ethan Lee 84fb4893 2017-10-10T20:22:15 Check SDL_UDEV_DYNAMIC first, then SDL_UDEV_LIBS separately
Ryan C. Gordon 37d89aa1 2017-10-10T16:12:56 audio: reworked audio streams to have right-hand resampling padding available. Fixes Bugzilla #3851.
Sam Lantinga d90fce3c 2017-10-10T11:10:15 Exposed the joystick locking functions for multi-threaded access to the joystick API
Ryan C. Gordon 28149e11 2017-10-10T11:56:54 Added SDL_PeekIntoDataQueue().
Sam Lantinga 2657dfae 2017-10-09T11:45:15 Fixed crash in SDL_IsGameController() on Windows if called when a controller is being removed
Sam Lantinga b120fb87 2017-10-08T10:59:03 Fixed bug 3865 - [PATCH] Support for GreenAsia Inc. PSX to USB converter as SDL_GameController Manuel I would like this small patch merged that adds support for my GreenAsia Inc. PSX to USB converter, so SDL_IsGameController() returns true when using this adaptor. It's interesting because PSX/PS2 controllers connected using this model won't be detected as gamecontrollers otherwise, only as joysticks.
Sam Lantinga d2a2b0c1 2017-10-07T15:26:55 Fixed bug 3857 - SDL_ConvertPixels misses YUV conversions Sylvain There are various YUV-RGB conversion coefficients, according to https://www.fourcc.org/fccyvrgb.php I choose the first (from Video Demystified, with integer multiplication), but the current SDL2 Dither functions use in fact the next one, which follows a specifications called CCIR 601. Here's a patch to use the second ones and with previous warning corrections. There are less multiplications involved because Chroma coefficient is 1. Also, doing float multiplication is as efficient with vectorization. In the end, the YUV decoding is faster: ~165 ms vs my previous 195 ms. Moreover, if SDL2 is compiled with -march=native, then YUV decoding time drops to ~130ms, while older ones remains around ~220 ms. For information, from jpeg-9 source code: jpeg-9/jccolor.c * YCbCr is defined per CCIR 601-1, except that Cb and Cr are * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5. * The conversion equations to be implemented are therefore * Y = 0.29900 * R + 0.58700 * G + 0.11400 * B * Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE * Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE jpeg-9/jdcolor.c * YCbCr is defined per CCIR 601-1, except that Cb and Cr are * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5. * The conversion equations to be implemented are therefore * * R = Y + 1.40200 * Cr * G = Y - 0.34414 * Cb - 0.71414 * Cr * B = Y + 1.77200 * Cb
Sam Lantinga 1bfe6d60 2017-10-06T21:43:59 Fixed restoring window size when coming out of fullscreen desktop mode. Use the style of the window as it will be, not as it currently is at the time of the AdjustWindowRect call.
Sam Lantinga e9652b19 2017-10-06T16:50:24 Fixed bug 3857 - SDL_ConvertPixels misses YUV conversions Sylvain Few issues with YUV on SDL2 when using odd dimensions, and missing conversions from/back to YUV formats. 1) The big part is that SDL_ConvertPixels() does not convert to/from YUV in most cases. This now works with any format and also with odd dimensions, by adding two internal functions SDL_ConvertPixels_YUV_to_ARGB8888 and SDL_ConvertPixels_ARGB8888_to_YUV (could it be XRGB888 ?). The target format is hard coded to ARGB888 (which is the default in the internal of the software renderer). In case of different YUV conversion, it will do an intermediate conversion to a ARGB8888 buffer. SDL_ConvertPixels_YUV_to_ARGB8888 is somehow redundant with all the "Color*Dither*Mod*". But it allows some completeness of SDL_ConvertPixels to handle all YUV format. It also works with odd dimensions. Moreover, I did some benchmark(SDL_ConvertPixel vs Color32DitherYV12Mod1X and Color32DitherYUY2Mod1X). gcc-6.3 and clang-4.0. gcc performs better than clang. And, with gcc, SDL_ConvertPixels() performs better (20%) than the two C function Color32Dither*(). For instance, to convert 10 times a 3888x2592 image, it takes ~195 ms with SDL_ConvertPixels and ~235 ms with Color32Dither*(). Especially because of gcc vectorize feature that optimises all conversion loops (-ftree-loop-vectorize). Nb: I put no image pitch for the YUV buffers. because it complexify a little bit the code and the API : There would be some ambiguity when setting the pitch exactly to image width: would it a be pitch of image width (for luma and chroma). or just contiguous data ? (could set pitch=0 for the later). 2) Small issues with odd dimensions: If width "w" is odd, luma plane width is still "w" whereas chroma planes will be "(w + 1)/2". Almost the same for odd h. Solution is to strategically substitute "w" by "(w+1)/2" at the good places ... - In the repository, SDL_ConvertPixels() handles YUV only if yuv source format is exactly the same as YUV destination format. It basically does a memcpy of pixels, but it's done incorrectly when width or height is odd (wrong size of chroma planes). This is fixed. - SDL Renderers don't support odd width/height for YUV textures. This is fixed for software, opengl, opengles2. (opengles 1 does not support it and fallback to software rendering). This is *not* fixed for D3D and D3D11 ... (and others, psp ?) Only *two* Dither function are fixed ... not sure if others are really used. - This is not possible to create a NV12/NV12 texture with the software renderer, whereas other renderers allow it. This is fixed, by using SDL_ConvertPixels underneath. - It was not possible to SDL_UpdateTexture() of format NV12/NV21 with the software renderer. this is fixed. Here's also two testcases: - that do all combination of conversion. - to test partial UpdateTexture