src/render/opengles2


Log

Author Commit Date CI Message
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
Ozkan Sezer c68d3ab7 2017-08-17T21:35:46 Watcom supports __FUNCTION__ identifier (and surely not __PRETTY_FUNCTION__) Partially fixes Bugzilla #3758.
Sam Lantinga 9451cd81 2017-08-14T20:07:30 Fixed compiler warnings
Sam Lantinga 36ba9248 2017-08-14T10:04:59 Fixed setting the texture blend mode in the OpenGL ES2 renderer
Sam Lantinga c59d9923 2017-08-14T05:51:44 Implemented more flexible blending modes for accelerated renderers This fixes bug 2594 - Propose new blend mode, SDL_BLENDMODE_BLEND_DSTA blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD, SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD); This fixes bug 2828 - Subtractive Blending blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_SUBTRACT, SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_SUBTRACT); This goes partway to fixing bug 3684 - Add support for a pre-multiplied alpha blending mode blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD, SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD);
Philipp Wiesemann 63b3e06f 2017-06-03T23:00:15 Corrected names of header file guards.
Philipp Wiesemann 266816b4 2017-03-26T21:00:19 Removed newlines from error messages.
Sam Lantinga 45b774e3 2017-01-01T18:33:28 Updated copyright for 2017
Ryan C. Gordon e93e91f0 2016-11-23T21:52:48 Pacify some GCC strict-aliasing compiler warnings.
Ryan C. Gordon 40c2a6fb 2016-11-23T11:49:26 Fixed more compiler warnings.
Sam Lantinga 57d01d7d 2016-11-13T22:57:41 Patch from Sylvain to fix clang warnings
Sam Lantinga 662f966c 2016-10-13T08:46:34 Fixed bug 3355 - false "Invalid renderer" after creating an "opengles2" renderer. Call SDL_GL_GetDrawableSize() directly because we may be in the initialization path and SDL_GetRendererOutputSize() will fail because the renderer magic isn't set up yet.
Sam Lantinga ecea3c4a 2016-10-01T13:33:32 Fixed bug 3169 - GLES2_CreateRenderer does not check SDL_GL_GetAttribute result, causing use of uninitialized data Yann Dirson When attempting to force use of opengles2 renderer with: int wanted_renderer = -1; for (int i = 0; i < numrenderers; i++) { SDL_RendererInfo renderer_info; if (SDL_GetRenderDriverInfo(i, &renderer_info) != 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't get renderer driver info: %s\n", SDL_GetError()); quit(2); } std::cerr << "Renderer " << i << " '" << renderer_info.name << "': flags=0x" << std::hex << renderer_info.flags << std::dec << ", " << renderer_info.num_texture_formats << " texture formats, max=" << renderer_info.max_texture_width << "x" << renderer_info.max_texture_height << "\n"; if (!strcmp(renderer_info.name, "opengles2")) { std::cerr << " selecting!\n"; wanted_renderer = i; } } renderer = SDL_CreateRenderer(window, wanted_renderer, 0); ... on banana pi or raspberry pi I get an error like the following (the actual context profile value varies, being used uninitialized) ERROR: Couldn't create renderer: Unknown OpenGL context profile 900 With this patch I get the following, which should help more pointing to a real problem: ERROR: Couldn't create renderer: Failed getting OpenGL glGetString entry point I pushed a patch (based on master branch of unofficial git mirror): https://github.com/O-Computers/SDL/commit/550389c89f4e73a0a5294f95b9f6e6c18ba48509 I'll be opening a different bug for the underlying issue.
Sam Lantinga 77305d47 2016-10-01T11:46:32 Fixed bug 3345 - SDL_RenderClear inconsistency with ClipRect Simon Hug The description of the SDL_RenderClear function in the SDL_render.h header says the following: "This function clears the entire rendering target, ignoring the viewport." The word "entire" implies that the clipping rectangle set with SDL_RenderSetClipRect also gets ignored. This is left somewhat ambiguous if only the viewport is mentioned. Minor thing, but let's see what the implementations actually do. The software renderer ignores the clipping rectangle when clearing. It even has a comment on this: /* By definition the clear ignores the clip rect */ Most other render drivers (opengl, opengles, opengles2, direct3d, and psp [I assume. Can't test it.]) use the scissor test for the ClipRect and don't disable it when clearing. Clearing will only happen within the clipping rectangle for these drivers. An exception is direct3d11 which uses a clear function that ignores the scissor test.
Sam Lantinga 061cc5e7 2016-10-01T11:38:53 Fixed bug 3349 - GLES2_RenderReadPixels doesn't use target texture format Simon Hug The OpenGL ES 2 renderer does not check the target texture format when using SDL_RenderReadPixels and just always uses ABGR8888. This can result in swapped or wrong colors. The attached patch adds a check and selects the target texture format, if a texture is set as the target.
Sam Lantinga 51d6371e 2016-10-01T11:34:04 Fixed bug 3350 - GL renderers don't need to flip rows after reading back pixels from the target texture Simon Hug All OpenGL renderers always flip the rows of the pixels that come from glReadPixels. This is unnecessary for target textures since these are already top down. Also, the rect->y value can be used directly for target textures for the same reason. I don't see any code that would handle the logical render size for target textures. Or am I missing something? The attached patch makes the renderers only the flip rows if the data comes from the default framebuffer.
Sam Lantinga 42065e78 2016-01-02T10:10:34 Updated copyright to 2016
Ryan C. Gordon f893ce3d 2015-12-28T15:15:58 OpenGL+GLES renderers: Fixed incorrect clip rectangle coords (thanks, Marcel!). Fixes Bugzilla #2700.
Alex Szpakowski 0c463d77 2015-12-10T20:25:34 SDL_GL_GetAttribute: If a GL context isn't active, only return failure when the specified attribute needs an active GL context to be queried.
Philipp Wiesemann 0e45984f 2015-06-21T17:33:46 Fixed crash if initialization of EGL failed but was tried again later. The internal function SDL_EGL_LoadLibrary() did not delete and remove a mostly uninitialized data structure if loading the library first failed. A later try to use EGL then skipped initialization and assumed it was previously successful because the data structure now already existed. This led to at least one crash in the internal function SDL_EGL_ChooseConfig() because a NULL pointer was dereferenced to make a call to eglBindAPI().
Sam Lantinga a4eb0dea 2015-06-14T19:10:51 Fixed bug 2908 - Fix clang warnings Simon Deschenes My build system still shows warning as errors. The first warning says that the member named instances can never be false (or NULL) as it is a static array, and we should check for instances[index] which we do anyway.
Philipp Wiesemann fd8b7c1c 2015-06-05T19:41:18 Fixed comments at conditional compilation macros.
Sam Lantinga da190975 2015-05-28T18:57:10 Fixed clip rectangle calculation when there is a viewport offset
Sam Lantinga 2c4a6ea0 2015-05-26T06:27:46 Updated the copyright year to 2015
Alex Szpakowski fcee3e73 2015-05-16T17:35:36 Code style cleanup in the GLES and GLES2 render backends.
Ryan C. Gordon b72938c8 2015-04-20T12:22:44 Windows: Always set the system timer resolution to 1ms by default. An existing hint lets apps that don't need the timer resolution changed avoid this, to save battery, etc, but this fixes several problems in timing, audio callbacks not firing fast enough, etc. Fixes Bugzilla #2944.
Alex Szpakowski fe6c797c 2015-04-10T23:30:31 Fixed an iOS view orientation issue when SDL_GL_CreateContext or SDL_CreateRenderer is called.
Edward Rudd b88ca1b4 2015-02-10T16:28:56 the last parameter of XChangeProperty is the number of elements.. and when the element format is 32.. the element is "long" so we have 5 long elements here. Yes this seems confusing as on mac+linux Long is either 32 or 64bits depending on the architecture, but this is how the X11 protocol is defined. Thus 5 is the correct value for the nelts here. Not 5 or 10 depending on the architecture. More info on the confusion https://bugs.freedesktop.org/show_bug.cgi?id=16802
Philipp Wiesemann b48e54aa 2015-01-26T22:00:29 Fixed bug 2802 - [patch] Fix android build compiling in wrong filesystem implementation Jonas Kulla The configure script didn't differentiate between Linux and Android, unconditionally compiling in the unix implementation of SDL_sysfilesystem.c. I'm probably one of the very few people building SDL for android using classic configure + standalone toolchain, so this has gone undetected all along.
Alex Szpakowski ea5d1a8a 2015-01-15T01:15:24 Merged default into iOS-improvements
Ryan C. Gordon f5bbbe41 2014-12-26T22:30:19 GLES2: Only use VBOs for Emscripten (for now). This is causing a regression on actual iOS hardware, which we should revisit after 2.0.4 ships.
Ryan C. Gordon fe40a172 2014-12-18T00:19:52 Initial merge of Emscripten port! With this commit, you can compile SDL2 with Emscripten ( http://emscripten.org/ ), and make your SDL-based C/C++ program into a web app. This port was due to the efforts of several people, including: Charlie Birks, Sathyanarayanan Gunasekaran, Jukka Jyl?nki, Alon Zakai, Edward Rudd, Bruce Mitchener, and Martin Gerhardy. (Thanks, everyone!)
David Ludwig 70438be2 2014-12-03T10:55:23 WinRT: fixed bug whereby SDL would override an app's default orientation WinRT apps can set a default, preferred orientation via a .appxmanifest file. SDL was overriding this on app startup, and making the app use all possible orientations (landscape and portrait). Thanks to Eric Wing for the heads up on this!
Alex Szpakowski ba6392d7 2014-12-01T07:31:22 Fixed SDL_GetRendererOutputSize on iOS when high-DPI mode is enabled on a Retina device.
Philipp Wiesemann 9c398852 2014-11-22T22:20:40 Corrected header file documentation comment.
Pierre-Loup A. Griffais 24c86b55 2014-09-11T19:24:42 [X11] Reconcile logical keyboard state with physical state on FocusIn since the window system doesn't do it for us like other platforms. This prevents sticky keys and missed keys when going in and out of focus, for example Alt would appear to stick if switching away from an SDL app with Alt-Tab and had to be pressed again. CR: Sam
Philipp Wiesemann 2c1faa40 2014-08-12T23:37:12 Fixed warnings about unused local variables.
Sam Lantinga 6fef39d6 2014-08-06T11:34:54 Added NV12 and NV21 texture support for OpenGL and OpenGL ES 2.0 renderers
Sam Lantinga 7187b74c 2014-07-07T11:00:25 Fixed compiler warnings on iOS
Sam Lantinga 3d5f4a69 2014-06-25T21:06:47 Fixed YUV texture update with a subrect in OpenGL ES 2.0 - thanks Sylvain!
Sam Lantinga b4deeeba 2014-06-25T00:58:40 Fixed bug 2595 - Padded, non-contiguous YUV does not display correctly using OpenGL ES 2.0 renderer Sylvain Ok, I found out : GLES2_UpdateTexture is just not handling the YUV, I will attach a patch.
Gabriel Jacobo e63e1a5e 2014-06-23T09:25:27 Fixes OpenGL ES 2 renderer (Thanks Sylvain Becker)
Sam Lantinga d65ac778 2014-06-22T02:48:43 Restore window OpenGL state if creating an OpenGL renderer fails
Sam Lantinga 5df11f8a 2014-06-21T21:46:42 Made SDL_PIXELFORMAT_ARGB8888 the default texture format for consistency across renderer implementations.
Sam Lantinga 62bdecc8 2014-06-21T12:45:54 Fixed compiler warning with new OpenGL ES header files
Sam Lantinga e8f8e672 2014-06-21T12:38:46 Fixed bug 2595 - Padded, non-contiguous YUV does not display correctly using OpenGL ES 2.0 renderer Alvin The new OpenGL ES 2.0 YUV Texture support does not correctly display padded, non-contiguous YUV data. I am using SDL2 95bd3d33482e (as provided by 'hg id --id') from Mercurial. The YUV data I am using is provided by the FFMPEG family of libraries. According to FFMPEG's documentation, "The linesize [pitch] may be larger than the size of usable data -- there may be extra padding present for performance reasons." The dimensions of the video file that I am using are 480x360. What I get from FFMPEG is a Ypitch of 512, and Upitch and Vpitch are both 256. When I pack new Y, U and V buffers with only the "usable" data (Ypitch is 480 and Upitch and Vpitch are both 240), and use those new buffers, the image is display correctly. It appears that the Ypitch, Upitch and Vpitch parameters are not being used by SDL_UpdateYUVTexture(). I use SDL_PIXELFORMAT_YV12 for my YUV texture, however, the same results are seen when I use SDL_PIXELFORMAT_IYUV. Not sure if this is related or not, but when I render the YUV texture (padded and unpadded) to a RGB24 texture, the resulting image is greyscale (or could by just the Y channel). The URL field for this bug entry is set to my email (SDL mailing list archive) which includes an example image of what I see when rendering padded, non-contiguous YUV data.
Sam Lantinga 9fb2cc10 2014-06-07T11:36:08 dront78 implemented YUV texture support for OpenGL ES 2.0
Gabriel Jacobo 1e352d79 2014-06-06T15:45:59 Chrome's Native Client backend implementation
J?rgen P. Tjern? defd90b6 2014-04-19T13:15:41 Render: Allow empty cliprect. This fixes an issue where an empty cliprect is treated the same as a NULL cliprect, causing the render backends to disable clipping. Also adds a new API, SDL_RenderIsClipEnabled(render) that allows you to differentiate between: - SDL_RenderSetClipRect(render, NULL) - SDL_Rect r = {0,0,0,0}; SDL_RenderSetClipRect(render, &r); Fixes https://bugzilla.libsdl.org/show_bug.cgi?id=2504
David Ludwig 3dcb451f 2014-04-09T21:29:19 Added a README file regarding WinRT support To note, this file is currently formatted with CRLF line endings, rather than LF, to allow the file to be viewed with Notepad.
Sam Lantinga f9a58968 2014-03-13T21:21:26 Added missing copyright notices
Sam Lantinga a8f540fe 2014-03-09T22:48:38 Fixed renderer flags to include support for target textures after the renderer is created.
Sam Lantinga 1367bf87 2014-03-09T11:36:47 Integrated David Ludwig's support for Windows RT
Gabriel Jacobo f61602b4 2014-02-27T20:21:46 Improve window recreation logic in OpenGL* renderers
Gabriel Jacobo 4c192bc8 2014-02-25T17:42:34 Fixes #2308, recreate window if GL requirements for the renderer are not met If the window has been created with values for SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_MAJOR_VERSION and SDL_GL_CONTEXT_MINOR_VERSION not matching those required by the renderer, attempt to recreate the window. This is needed on platforms where both GL and GLES 1/2 surfaces are supported by the video backend, requiring that the window be recreated when switching between context types.
Sam Lantinga b331ada8 2014-02-09T01:49:01 Fixed bug 2354 - [ES 2.0] SDL_RenderClear clears render target with wrong color ny00 SDL_RenderClear clears a render target with the wrong color, if the opengles2 renderer driver is used and the target texture's format is SDL_PIXELFORMAT_ARGB8888. The bug is *not* reproduced if SDL_PIXELFORMAT_ABGR8888 is used as the texture format (the first from the renderer's list). It is further not reproduced using any of the following renderer drivers: opengl, opengles (apparently powered by Gallium3D), software. Finally, the correct color can be drawn using SDL_RenderFillRect (instead of SDL_RenderClear). A few details about the current setup: - OS: Ubuntu 12.04 for x86_64 - GPU: GeForce GTX 460 - GPU driver version: 331.20-0ubuntu1~xedgers~precise1 (from the xorg-edgers PPA) --- Seth Williams Sam, It appears that the clear just needs to take the render target format into consideration. Seth.
Sam Lantinga 58edac3e 2014-02-02T00:53:27 Fixed bug 2374 - Update copyright for 2014... Is it that time already??
Sam Lantinga 7fe277cd 2013-12-23T17:15:32 Fixed float to int conversion warning, which was a legitimate bug.
CarniBlood 472068dd 2013-12-19T06:01:18 fixed gles/gles2 renderer creation fail on Android when default major/minor version doesn't match
Gabriel Jacobo f848adff 2013-11-29T10:06:08 Improve Android pause/resume behavior.
David Ludwig b6f80d85 2013-11-29T00:19:46 WinRT: enable the OpenGL ES 2 SDL_Renderer backend, if and when OpenGL ES 2 support is compiled in
Ryan C. Gordon 7e1289af 2013-11-24T23:56:17 Make internal SDL sources include SDL_internal.h instead of SDL_config.h The new header will include SDL_config.h, but allows for other global stuff.
Gabriel Jacobo 61959aa6 2013-11-22T13:24:53 OpenGL ES support for Windows
Sam Lantinga 36b75917 2013-10-05T12:29:05 Do a 32-bit compare on RGBA values. Thsi should be inlined in optimized builds.
Ryan C. Gordon 5607cc45 2013-10-05T00:29:57 Avoid redundant state changes in the GLES2 renderer.
Ryan C. Gordon 500e4f6f 2013-10-04T11:25:14 Removed "u_colorTable" uniform from the GLES2 renderer. It's not used anywhere.
Sam Lantinga 50989846 2013-10-03T20:48:52 Added optional error checking for OpenGL ES 2.0 in the same style as the OpenGL renderer. You can enable it like this: SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
Ryan C. Gordon 958640e5 2013-10-02T22:16:11 Get rid of glGetError() calls in GLES2 renderer. It's not usually useful, and it causes pipeline stalls.
Sam Lantinga 22a972a4 2013-09-30T22:16:14 Fixed bug 2122 - SDL_CreateTexture allows illegal texture sizes Lloyd Bryant SDL_CreateTexture() is succeeding (i.e. returning a valid pointer) when the requested horizontal or vertical size of the texture exceeds the maximum allowed by the render. This results in hard-to-understand errors showing up when later attempting to use that texture (such as with SDL_SetRenderTarget()).
Gabriel Jacobo ace1e98a 2013-08-29T15:02:32 Fixes bug #2040, prepare SDL_GL_CONTEXT_EGL for deprecation on v2.1 SDL_GL_CONTEXT_EGL = 1 is now internally treated as profile_mask = SDL_GL_CONTEXT_PROFILE_ES
Sam Lantinga f79fc33a 2013-08-29T08:29:21 Christoph Mallon: Remove pointless if (x) before SDL_free(x)
Gabriel Jacobo f60bcf8b 2013-08-22T17:26:22 Fix warning in GL ES2 renderer
Gabriel Jacobo dad42067 2013-08-12T11:13:50 Fixes #2022, do not resume on Android when surfaceChanged If the app is in landscape mode and the user presses the power button, a pause is followed immediately by a surfaceChanged event because the lock screen is shown in portrait mode. This triggers a "false" resume. So, we just pause and resume following the onWindowFocusChanged events. Also, wait for SDL_APP_WILLENTERBACKGROUND and SDL_APP_DIDENTERBACKGROUND before blocking the event pump.
Sam Lantinga 1ad936eb 2013-08-11T19:56:43 Fixed bug 2027 - Full-screen appears to be broken - hang in SDL_DestroyWindow() Rainer Deyke I'm running Linux Mint 15 with the Cinnamon window manager. SDL_DestroyWindow consistently locks up for me when the window if fullscreen.