Commit graph

17 commits

Author SHA1 Message Date
Sam Lantinga 29f4a5ba0e Add GLES2 shader prologue infrastructure. (by @eloj)
There is supposedly an OpenGL ES2 target that does not support precision specifiers. However, the existing logic to detect this is currently broken in two ways:

1) There's a typo of the `#ifdef` as `#if`.
2) Checking for `GL_FRAGMENT_PRECISION_HIGH` can not be the correct way to detect this platform. Other targets, including some desktops, will also not have this defined (for various reasons).

Because some of the shader code is missing precision specifiers, and because a default is ONLY provided if `GL_FRAGMENT_PRECISION_HIGH` is set, these other targets break.

Instead of 'hard-coding' the prologue string into shaders in the C source, use our ability to provide a list of strings to `glShaderSource` instead, leaving the determination to run-time.

This commit closes https://github.com/libsdl-org/SDL/pull/6182
2022-09-06 15:55:27 -07:00
pionere 3f8b450de2
extend the code hidden by SDL_HAVE_YUV 2022-03-09 15:03:30 +01:00
Sam Lantinga 120c76c84b Updated copyright for 2022 2022-01-03 09:40:21 -08:00
Sam Lantinga 9ec2b35147 Fixed the GLES2 shader count to be in sync with the enum 2021-11-15 13:45:53 -08:00
Sam Lantinga c55ab9631f Added a hint for alternate OpenGL NV12 data format 2021-11-13 22:21:57 -08:00
Sylvain Becker f40551c5f6 GLES2 SDL_Renderer: remove old ZUNE_HD defines and simplify shader cache 2021-02-10 10:22:16 -05:00
Sam Lantinga 9130f7c377 Updated copyright for 2021 2021-01-02 10:25:38 -08:00
Sam Lantinga a8780c6a28 Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
Sam Lantinga 5e13087b0f Updated copyright for 2019 2019-01-04 22:01:14 -08:00
Sam Lantinga e3cc5b2c6b Updated copyright for 2018 2018-01-03 10:03:25 -08:00
Sam Lantinga e8bbbb37f1 Added support for Android video textures 2017-12-12 12:52:17 -08:00
Sam Lantinga a6a4e27ae8 Updated SDL's YUV support, many thanks to Adrien Descamps
New functions get and set the YUV colorspace conversion mode:
	SDL_SetYUVConversionMode()
	SDL_GetYUVConversionMode()
	SDL_GetYUVConversionModeForResolution()

SDL_ConvertPixels() converts between all supported RGB and YUV formats, with SSE acceleration for converting from planar YUV formats (YV12, NV12, etc) to common RGB/RGBA formats.

Added a new test program, testyuv, to verify correctness and speed of YUV conversion functionality.
2017-11-12 22:51:12 -08:00
Sam Lantinga c59d9923b3 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);
2017-08-14 05:51:44 -07:00
Philipp Wiesemann 63b3e06f75 Corrected names of header file guards. 2017-06-03 23:00:15 +02:00
Sam Lantinga 45b774e3f7 Updated copyright for 2017 2017-01-01 18:33:28 -08:00
Sam Lantinga 42065e785d Updated copyright to 2016 2016-01-02 10:10:34 -08:00
Philipp Wiesemann 0e45984fa0 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().
2015-06-21 17:33:46 +02:00