mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-27 02:46:08 +08:00
Fixed handling framebuffer_srgb_capable for EGL and iOS
This commit is contained in:
+3
-3
@@ -1268,14 +1268,14 @@ EGLSurface SDL_EGL_CreateSurface(SDL_VideoDevice *_this, SDL_Window *window, Nat
|
|||||||
ANativeWindow_setBuffersGeometry(nw, 0, 0, format_wanted);
|
ANativeWindow_setBuffersGeometry(nw, 0, 0, format_wanted);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (_this->gl_config.framebuffer_srgb_capable) {
|
if (_this->gl_config.framebuffer_srgb_capable >= 0) {
|
||||||
#ifdef EGL_KHR_gl_colorspace
|
#ifdef EGL_KHR_gl_colorspace
|
||||||
if (SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_KHR_gl_colorspace")) {
|
if (SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_KHR_gl_colorspace")) {
|
||||||
attribs[attr++] = EGL_GL_COLORSPACE_KHR;
|
attribs[attr++] = EGL_GL_COLORSPACE_KHR;
|
||||||
attribs[attr++] = EGL_GL_COLORSPACE_SRGB_KHR;
|
attribs[attr++] = _this->gl_config.framebuffer_srgb_capable ? EGL_GL_COLORSPACE_SRGB_KHR : EGL_GL_COLORSPACE_LINEAR_KHR;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
if (_this->gl_config.framebuffer_srgb_capable > 0) {
|
||||||
SDL_SetError("EGL implementation does not support sRGB system framebuffers");
|
SDL_SetError("EGL implementation does not support sRGB system framebuffers");
|
||||||
return EGL_NO_SURFACE;
|
return EGL_NO_SURFACE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
aBits:(int)aBits
|
aBits:(int)aBits
|
||||||
depthBits:(int)depthBits
|
depthBits:(int)depthBits
|
||||||
stencilBits:(int)stencilBits
|
stencilBits:(int)stencilBits
|
||||||
sRGB:(BOOL)sRGB
|
sRGB:(int)sRGB
|
||||||
multisamples:(int)multisamples
|
multisamples:(int)multisamples
|
||||||
context:(EAGLContext *)glcontext;
|
context:(EAGLContext *)glcontext;
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@
|
|||||||
aBits:(int)aBits
|
aBits:(int)aBits
|
||||||
depthBits:(int)depthBits
|
depthBits:(int)depthBits
|
||||||
stencilBits:(int)stencilBits
|
stencilBits:(int)stencilBits
|
||||||
sRGB:(BOOL)sRGB
|
sRGB:(int)sRGB
|
||||||
multisamples:(int)multisamples
|
multisamples:(int)multisamples
|
||||||
context:(EAGLContext *)glcontext
|
context:(EAGLContext *)glcontext
|
||||||
{
|
{
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
samples = SDL_min(samples, maxsamples);
|
samples = SDL_min(samples, maxsamples);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sRGB) {
|
if (sRGB > 0) {
|
||||||
colorFormat = kEAGLColorFormatSRGBA8;
|
colorFormat = kEAGLColorFormatSRGBA8;
|
||||||
colorBufferFormat = GL_SRGB8_ALPHA8;
|
colorBufferFormat = GL_SRGB8_ALPHA8;
|
||||||
} else if (rBits >= 8 || gBits >= 8 || bBits >= 8 || aBits > 0) {
|
} else if (rBits >= 8 || gBits >= 8 || bBits >= 8 || aBits > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user