Commit 7ed830b8 authored by Raphael Junqueira's avatar Raphael Junqueira Committed by Alexandre Julliard

Add GLXFBConfig on Wine_GLContext (we should remove XVisualInfo

references on code). Hook glGetIntegerv on GL_ALPHA_BITS to query on GLXFBConfig instead of glGetInteger (as it returns bad value).
parent 0edbaf7e
...@@ -261,6 +261,9 @@ sub GenerateThunk($$$$) ...@@ -261,6 +261,9 @@ sub GenerateThunk($$$$)
if ( $func_ref->[0] eq "glGetString" ) { if ( $func_ref->[0] eq "glGetString" ) {
$wine_func_ref_name = "internal_glGetString"; $wine_func_ref_name = "internal_glGetString";
} }
if ( $func_ref->[0] eq "glGetIntegerv" ) {
$wine_func_ref_name = "internal_glGetIntegerv";
}
$ret = "$ret$prefix$wine_func_ref_name( $call_arg);\n"; $ret = "$ret$prefix$wine_func_ref_name( $call_arg);\n";
if ($thread_safe) { if ($thread_safe) {
$ret = "$ret LEAVE_GL();\n"; $ret = "$ret LEAVE_GL();\n";
......
...@@ -73,5 +73,6 @@ extern OpenGL_extension extension_registry[]; ...@@ -73,5 +73,6 @@ extern OpenGL_extension extension_registry[];
extern int extension_registry_size; extern int extension_registry_size;
const GLubyte* internal_glGetString(GLenum name); const GLubyte* internal_glGetString(GLenum name);
void internal_glGetIntegerv(GLenum pname, GLint* params);
#endif /* __DLLS_OPENGL32_OPENGL_EXT_H */ #endif /* __DLLS_OPENGL32_OPENGL_EXT_H */
...@@ -1329,7 +1329,7 @@ void WINAPI wine_glGetHistogramParameteriv( GLenum target, GLenum pname, GLint* ...@@ -1329,7 +1329,7 @@ void WINAPI wine_glGetHistogramParameteriv( GLenum target, GLenum pname, GLint*
void WINAPI wine_glGetIntegerv( GLenum pname, GLint* params ) { void WINAPI wine_glGetIntegerv( GLenum pname, GLint* params ) {
TRACE("(%d, %p)\n", pname, params ); TRACE("(%d, %p)\n", pname, params );
ENTER_GL(); ENTER_GL();
glGetIntegerv( pname, params ); internal_glGetIntegerv( pname, params );
LEAVE_GL(); LEAVE_GL();
} }
......
...@@ -64,8 +64,9 @@ static char* internal_gl_extensions = NULL; ...@@ -64,8 +64,9 @@ static char* internal_gl_extensions = NULL;
typedef struct wine_glcontext { typedef struct wine_glcontext {
HDC hdc; HDC hdc;
Display *display; Display *display;
GLXContext ctx;
XVisualInfo *vis; XVisualInfo *vis;
GLXFBConfig fb_conf;
GLXContext ctx;
struct wine_glcontext *next; struct wine_glcontext *next;
struct wine_glcontext *prev; struct wine_glcontext *prev;
} Wine_GLContext; } Wine_GLContext;
...@@ -186,6 +187,28 @@ HGLRC WINAPI wglCreateContext(HDC hdc) ...@@ -186,6 +187,28 @@ HGLRC WINAPI wglCreateContext(HDC hdc)
ret->display = display; ret->display = display;
ret->vis = vis; ret->vis = vis;
{
int hdcPF = GetPixelFormat(hdc);
int nCfgs_fmt = 0;
GLXFBConfig* cfgs_fmt = NULL;
GLXFBConfig cur_cfg;
int value;
int gl_test = 0;
cfgs_fmt = glXGetFBConfigs(display, DefaultScreen(display), &nCfgs_fmt);
if (NULL == cfgs_fmt || 0 == nCfgs_fmt) {
ERR("Cannot get FB Configs, expect problems.\n");
return NULL;
}
cur_cfg = cfgs_fmt[hdcPF - 1];
gl_test = glXGetFBConfigAttrib(display, cur_cfg, GLX_FBCONFIG_ID, &value);
if (gl_test) {
ERR("Failed to retrieve FBCONFIG_ID from GLXFBConfig, expect problems.\n");
return NULL;
}
ret->fb_conf = cur_cfg;
XFree(cfgs_fmt);
}
TRACE(" creating context %p (GL context creation delayed)\n", ret); TRACE(" creating context %p (GL context creation delayed)\n", ret);
return (HGLRC) ret; return (HGLRC) ret;
} }
...@@ -442,7 +465,6 @@ BOOL WINAPI wglMakeCurrent(HDC hdc, ...@@ -442,7 +465,6 @@ BOOL WINAPI wglMakeCurrent(HDC hdc,
} else { } else {
Wine_GLContext *ctx = (Wine_GLContext *) hglrc; Wine_GLContext *ctx = (Wine_GLContext *) hglrc;
Drawable drawable = get_drawable( hdc ); Drawable drawable = get_drawable( hdc );
if (ctx->ctx == NULL) { if (ctx->ctx == NULL) {
ctx->ctx = glXCreateContext(ctx->display, ctx->vis, NULL, True); ctx->ctx = glXCreateContext(ctx->display, ctx->vis, NULL, True);
TRACE(" created a delayed OpenGL context (%p) for %p\n", ctx->ctx, ctx->vis); TRACE(" created a delayed OpenGL context (%p) for %p\n", ctx->ctx, ctx->vis);
...@@ -799,6 +821,18 @@ const GLubyte * internal_glGetString(GLenum name) { ...@@ -799,6 +821,18 @@ const GLubyte * internal_glGetString(GLenum name) {
return (const GLubyte *) internal_gl_extensions; return (const GLubyte *) internal_gl_extensions;
} }
void internal_glGetIntegerv(GLenum pname, GLint* params) {
glGetIntegerv(pname, params);
if (pname == GL_ALPHA_BITS) {
GLint tmp;
GLXContext gl_ctx = glXGetCurrentContext();
Wine_GLContext* ret = get_context_from_GLXContext(gl_ctx);
glXGetFBConfigAttrib(ret->display, ret->fb_conf, GLX_ALPHA_SIZE, &tmp);
TRACE("returns GL_ALPHA_BITS as '%d'\n", tmp);
*params = tmp;
}
}
/* No need to load any other libraries as according to the ABI, libGL should be self-sufficient and /* No need to load any other libraries as according to the ABI, libGL should be self-sufficient and
include all dependencies include all dependencies
......
...@@ -357,23 +357,23 @@ static unsigned ConvertAttribWGLtoGLX(const int* iWGLAttr, int* oGLXAttr, Wine_G ...@@ -357,23 +357,23 @@ static unsigned ConvertAttribWGLtoGLX(const int* iWGLAttr, int* oGLXAttr, Wine_G
break; break;
case WGL_RED_BITS_ARB: case WGL_RED_BITS_ARB:
pop = iWGLAttr[++cur]; pop = iWGLAttr[++cur];
TRACE("pAttr[%d] = GLX_RED_SIZE: %d\n", cur, pop);
PUSH2(oGLXAttr, GLX_RED_SIZE, pop); PUSH2(oGLXAttr, GLX_RED_SIZE, pop);
TRACE("pAttr[%d] = GLX_RED_SIZE: %d\n", cur, pop);
break; break;
case WGL_GREEN_BITS_ARB: case WGL_GREEN_BITS_ARB:
pop = iWGLAttr[++cur]; pop = iWGLAttr[++cur];
TRACE("pAttr[%d] = GLX_GREEN_SIZE: %d\n", cur, pop);
PUSH2(oGLXAttr, GLX_GREEN_SIZE, pop); PUSH2(oGLXAttr, GLX_GREEN_SIZE, pop);
TRACE("pAttr[%d] = GLX_GREEN_SIZE: %d\n", cur, pop);
break; break;
case WGL_ALPHA_BITS_ARB: case WGL_ALPHA_BITS_ARB:
pop = iWGLAttr[++cur]; pop = iWGLAttr[++cur];
TRACE("pAttr[%d] = GLX_ALPHA_SIZE: %d\n", cur, pop);
PUSH2(oGLXAttr, GLX_ALPHA_SIZE, pop); PUSH2(oGLXAttr, GLX_ALPHA_SIZE, pop);
TRACE("pAttr[%d] = GLX_ALPHA_SIZE: %d\n", cur, pop);
break; break;
case WGL_DEPTH_BITS_ARB: case WGL_DEPTH_BITS_ARB:
pop = iWGLAttr[++cur]; pop = iWGLAttr[++cur];
TRACE("pAttr[%d] = GLX_DEPTH_SIZE: %d\n", cur, pop);
PUSH2(oGLXAttr, GLX_DEPTH_SIZE, pop); PUSH2(oGLXAttr, GLX_DEPTH_SIZE, pop);
TRACE("pAttr[%d] = GLX_DEPTH_SIZE: %d\n", cur, pop);
break; break;
case WGL_STENCIL_BITS_ARB: case WGL_STENCIL_BITS_ARB:
pop = iWGLAttr[++cur]; pop = iWGLAttr[++cur];
...@@ -689,8 +689,11 @@ GLboolean WINAPI wglChoosePixelFormatARB(HDC hdc, const int *piAttribIList, cons ...@@ -689,8 +689,11 @@ GLboolean WINAPI wglChoosePixelFormatARB(HDC hdc, const int *piAttribIList, cons
continue ; continue ;
} }
if (fmt_id == tmp_fmt_id) { if (fmt_id == tmp_fmt_id) {
int tmp;
piFormats[pfmt_it] = it_fmt + 1; piFormats[pfmt_it] = it_fmt + 1;
++pfmt_it; ++pfmt_it;
glXGetFBConfigAttrib(display, cfgs_fmt[it_fmt], GLX_ALPHA_SIZE, &tmp);
TRACE("for FBCONFIG_ID(%d/%d) found '%d'\n", it_fmt + 1, nCfgs_fmt, tmp);
break ; break ;
} }
} }
......
...@@ -212,7 +212,6 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev, ...@@ -212,7 +212,6 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
} }
if (ppfd->iPixelType == PFD_TYPE_RGBA) { if (ppfd->iPixelType == PFD_TYPE_RGBA) {
ADD2(GLX_RENDER_TYPE, GLX_RGBA_BIT); ADD2(GLX_RENDER_TYPE, GLX_RGBA_BIT);
ADD2(GLX_BUFFER_SIZE, ppfd->cColorBits);
if (32 == ppfd->cDepthBits) { if (32 == ppfd->cDepthBits) {
/** /**
* for 32 bpp depth buffers force to use 24. * for 32 bpp depth buffers force to use 24.
...@@ -222,7 +221,15 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev, ...@@ -222,7 +221,15 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
} else { } else {
TEST_AND_ADD2(ppfd->cDepthBits, GLX_DEPTH_SIZE, ppfd->cDepthBits); TEST_AND_ADD2(ppfd->cDepthBits, GLX_DEPTH_SIZE, ppfd->cDepthBits);
} }
TEST_AND_ADD2(ppfd->cAlphaBits, GLX_ALPHA_SIZE, ppfd->cAlphaBits); if (32 == ppfd->cColorBits) {
ADD2(GLX_RED_SIZE, 8);
ADD2(GLX_GREEN_SIZE, 8);
ADD2(GLX_BLUE_SIZE, 8);
ADD2(GLX_ALPHA_SIZE, 8);
} else {
ADD2(GLX_BUFFER_SIZE, ppfd->cColorBits);
TEST_AND_ADD2(ppfd->cAlphaBits, GLX_ALPHA_SIZE, ppfd->cAlphaBits);
}
} }
TEST_AND_ADD2(ppfd->cStencilBits, GLX_STENCIL_SIZE, ppfd->cStencilBits); TEST_AND_ADD2(ppfd->cStencilBits, GLX_STENCIL_SIZE, ppfd->cStencilBits);
TEST_AND_ADD2(ppfd->cAuxBuffers, GLX_AUX_BUFFERS, ppfd->cAuxBuffers); TEST_AND_ADD2(ppfd->cAuxBuffers, GLX_AUX_BUFFERS, ppfd->cAuxBuffers);
...@@ -444,7 +451,24 @@ BOOL X11DRV_SetPixelFormat(X11DRV_PDEVICE *physDev, ...@@ -444,7 +451,24 @@ BOOL X11DRV_SetPixelFormat(X11DRV_PDEVICE *physDev,
TRACE("(%p,%d,%p)\n", physDev, iPixelFormat, ppfd); TRACE("(%p,%d,%p)\n", physDev, iPixelFormat, ppfd);
physDev->current_pf = iPixelFormat; physDev->current_pf = iPixelFormat;
if (TRACE_ON(opengl)) {
int nCfgs_fmt = 0;
GLXFBConfig* cfgs_fmt = NULL;
GLXFBConfig cur_cfg;
int value;
int gl_test = 0;
cfgs_fmt = pglXGetFBConfigs(gdi_display, DefaultScreen(gdi_display), &nCfgs_fmt);
cur_cfg = cfgs_fmt[iPixelFormat - 1];
gl_test = pglXGetFBConfigAttrib(gdi_display, cur_cfg, GLX_FBCONFIG_ID, &value);
if (gl_test) {
ERR("Failed to retrieve FBCONFIG_ID from GLXFBConfig, expect problems.\n");
} else {
FIXME("have FBCONFIG_ID %x\n", value);
}
XFree(cfgs_fmt);
}
return TRUE; return TRUE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment