mirror of https://github.com/encounter/SDL.git
SDL_video: Added SDL_GL_FLOATBUFFERS to allow Cocoa GL contexts to use EDR
This commit is contained in:
parent
0b9868b026
commit
60d1944e46
|
@ -248,7 +248,8 @@ typedef enum
|
|||
SDL_GL_FRAMEBUFFER_SRGB_CAPABLE,
|
||||
SDL_GL_CONTEXT_RELEASE_BEHAVIOR,
|
||||
SDL_GL_CONTEXT_RESET_NOTIFICATION,
|
||||
SDL_GL_CONTEXT_NO_ERROR
|
||||
SDL_GL_CONTEXT_NO_ERROR,
|
||||
SDL_GL_FLOATBUFFERS
|
||||
} SDL_GLattr;
|
||||
|
||||
typedef enum
|
||||
|
|
|
@ -368,6 +368,7 @@ struct SDL_VideoDevice
|
|||
int stereo;
|
||||
int multisamplebuffers;
|
||||
int multisamplesamples;
|
||||
int floatbuffers;
|
||||
int accelerated;
|
||||
int major_version;
|
||||
int minor_version;
|
||||
|
|
|
@ -3519,6 +3519,7 @@ SDL_GL_ResetAttributes()
|
|||
_this->gl_config.stereo = 0;
|
||||
_this->gl_config.multisamplebuffers = 0;
|
||||
_this->gl_config.multisamplesamples = 0;
|
||||
_this->gl_config.floatbuffers = 0;
|
||||
_this->gl_config.retained_backing = 1;
|
||||
_this->gl_config.accelerated = -1; /* accelerated or not, both are fine */
|
||||
|
||||
|
@ -3607,6 +3608,9 @@ SDL_GL_SetAttribute(SDL_GLattr attr, int value)
|
|||
case SDL_GL_MULTISAMPLESAMPLES:
|
||||
_this->gl_config.multisamplesamples = value;
|
||||
break;
|
||||
case SDL_GL_FLOATBUFFERS:
|
||||
_this->gl_config.floatbuffers = value;
|
||||
break;
|
||||
case SDL_GL_ACCELERATED_VISUAL:
|
||||
_this->gl_config.accelerated = value;
|
||||
break;
|
||||
|
|
|
@ -261,6 +261,9 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window)
|
|||
attr[i++] = _this->gl_config.multisamplesamples;
|
||||
attr[i++] = NSOpenGLPFANoRecovery;
|
||||
}
|
||||
if (_this->gl_config.floatbuffers) {
|
||||
attr[i++] = NSOpenGLPFAColorFloat;
|
||||
}
|
||||
|
||||
if (_this->gl_config.accelerated >= 0) {
|
||||
if (_this->gl_config.accelerated) {
|
||||
|
|
|
@ -74,6 +74,11 @@
|
|||
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_pixel_format_float
|
||||
#define WGL_ARB_pixel_format_float
|
||||
#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_context_flush_control
|
||||
#define WGL_ARB_context_flush_control
|
||||
#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
|
||||
|
@ -597,6 +602,10 @@ WIN_GL_SetupWindowInternal(_THIS, SDL_Window * window)
|
|||
*iAttr++ = _this->gl_config.multisamplesamples;
|
||||
}
|
||||
|
||||
if (_this->gl_config.floatbuffers) {
|
||||
*iAttr++ = WGL_TYPE_RGBA_FLOAT_ARB;
|
||||
}
|
||||
|
||||
if (_this->gl_config.framebuffer_srgb_capable) {
|
||||
*iAttr++ = WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB;
|
||||
*iAttr++ = _this->gl_config.framebuffer_srgb_capable;
|
||||
|
|
|
@ -118,6 +118,16 @@ typedef GLXContext(*PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display * dpy,
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef GLX_ARB_fbconfig_float
|
||||
#define GLX_ARB_fbconfig_float
|
||||
#ifndef GLX_RGBA_FLOAT_TYPE_ARB
|
||||
#define GLX_RGBA_FLOAT_TYPE_ARB 0x20B9
|
||||
#endif
|
||||
#ifndef GLX_RGBA_FLOAT_BIT_ARB
|
||||
#define GLX_RGBA_FLOAT_BIT_ARB 0x00000004
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef GLX_ARB_create_context_no_error
|
||||
#define GLX_ARB_create_context_no_error
|
||||
#ifndef GLX_CONTEXT_OPENGL_NO_ERROR_ARB
|
||||
|
@ -492,7 +502,11 @@ X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int si
|
|||
/* Setup our GLX attributes according to the gl_config. */
|
||||
if( for_FBConfig ) {
|
||||
attribs[i++] = GLX_RENDER_TYPE;
|
||||
attribs[i++] = GLX_RGBA_BIT;
|
||||
if (_this->gl_config.floatbuffers) {
|
||||
attribs[i++] = GLX_RGBA_FLOAT_BIT_ARB;
|
||||
} else {
|
||||
attribs[i++] = GLX_RGBA_BIT;
|
||||
}
|
||||
} else {
|
||||
attribs[i++] = GLX_RGBA;
|
||||
}
|
||||
|
@ -560,6 +574,10 @@ X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int si
|
|||
attribs[i++] = _this->gl_config.multisamplesamples;
|
||||
}
|
||||
|
||||
if (_this->gl_config.floatbuffers) {
|
||||
attribs[i++] = GLX_RGBA_FLOAT_TYPE_ARB;
|
||||
}
|
||||
|
||||
if (_this->gl_config.framebuffer_srgb_capable) {
|
||||
attribs[i++] = GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB;
|
||||
attribs[i++] = True; /* always needed, for_FBConfig or not! */
|
||||
|
|
Loading…
Reference in New Issue