wined3d: Move over to WGL.
This commit is contained in:
parent
58275065a1
commit
ac3927a73e
@ -65,12 +65,12 @@ static void Context_MarkStateDirty(WineD3DContext *context, DWORD state) {
|
|||||||
*
|
*
|
||||||
* Params:
|
* Params:
|
||||||
* This: Device to add the context for
|
* This: Device to add the context for
|
||||||
* display: X display this context uses
|
* hdc: device context
|
||||||
* glCtx: glX context to add
|
* glCtx: WGL context to add
|
||||||
* drawable: drawable used with this context.
|
* pbuffer: optional pbuffer used with this context
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
static WineD3DContext *AddContextToArray(IWineD3DDeviceImpl *This, Display *display, GLXContext glCtx, Drawable drawable) {
|
static WineD3DContext *AddContextToArray(IWineD3DDeviceImpl *This, HWND win_handle, HDC hdc, HGLRC glCtx, HPBUFFERARB pbuffer) {
|
||||||
WineD3DContext **oldArray = This->contexts;
|
WineD3DContext **oldArray = This->contexts;
|
||||||
DWORD state;
|
DWORD state;
|
||||||
|
|
||||||
@ -92,9 +92,10 @@ static WineD3DContext *AddContextToArray(IWineD3DDeviceImpl *This, Display *disp
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
This->contexts[This->numContexts]->display = display;
|
This->contexts[This->numContexts]->hdc = hdc;
|
||||||
This->contexts[This->numContexts]->glCtx = glCtx;
|
This->contexts[This->numContexts]->glCtx = glCtx;
|
||||||
This->contexts[This->numContexts]->drawable = drawable;
|
This->contexts[This->numContexts]->pbuffer = pbuffer;
|
||||||
|
This->contexts[This->numContexts]->win_handle = win_handle;
|
||||||
HeapFree(GetProcessHeap(), 0, oldArray);
|
HeapFree(GetProcessHeap(), 0, oldArray);
|
||||||
|
|
||||||
/* Mark all states dirty to force a proper initialization of the states on the first use of the context
|
/* Mark all states dirty to force a proper initialization of the states on the first use of the context
|
||||||
@ -116,144 +117,103 @@ static WineD3DContext *AddContextToArray(IWineD3DDeviceImpl *This, Display *disp
|
|||||||
* * Params:
|
* * Params:
|
||||||
* This: Device to activate the context for
|
* This: Device to activate the context for
|
||||||
* target: Surface this context will render to
|
* target: Surface this context will render to
|
||||||
* display: X11 connection
|
* win_handle: handle to the window which we are drawing to
|
||||||
* win: Target window. NULL for a pbuffer
|
* create_pbuffer: tells whether to create a pbuffer or not
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target, Display *display, Window win) {
|
WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target, HWND win_handle, BOOL create_pbuffer) {
|
||||||
Drawable drawable = win, oldDrawable;
|
HDC oldDrawable, hdc;
|
||||||
XVisualInfo *visinfo = NULL;
|
HPBUFFERARB pbuffer = NULL;
|
||||||
GLXContext ctx = NULL, oldCtx;
|
HGLRC ctx = NULL, oldCtx;
|
||||||
WineD3DContext *ret = NULL;
|
WineD3DContext *ret = NULL;
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
TRACE("(%p): Creating a %s context for render target %p\n", This, win ? "onscreen" : "offscreen", target);
|
TRACE("(%p): Creating a %s context for render target %p\n", This, create_pbuffer ? "offscreen" : "onscreen", target);
|
||||||
|
|
||||||
if(!win) {
|
if(create_pbuffer) {
|
||||||
long int visualid;
|
HDC hdc_parent = GetDC(win_handle);
|
||||||
int attribs[256];
|
int iPixelFormat = 1; /* We only have a single useful format in Wine's OpenGL32, so use this for now. It should be fixed. */
|
||||||
int nAttribs = 0;
|
|
||||||
int i;
|
|
||||||
int val;
|
|
||||||
int index = -1;
|
|
||||||
|
|
||||||
TRACE("Creating a pBuffer drawable for the new context\n");
|
TRACE("Creating a pBuffer drawable for the new context\n");
|
||||||
|
pbuffer = GL_EXTCALL(wglCreatePbufferARB(hdc_parent, iPixelFormat, target->currentDesc.Width, target->currentDesc.Height, 0));
|
||||||
attribs[nAttribs++] = GLX_PBUFFER_WIDTH;
|
if(!pbuffer) {
|
||||||
attribs[nAttribs++] = target->currentDesc.Width;
|
|
||||||
attribs[nAttribs++] = GLX_PBUFFER_HEIGHT;
|
|
||||||
attribs[nAttribs++] = target->currentDesc.Height;
|
|
||||||
attribs[nAttribs++] = None;
|
|
||||||
|
|
||||||
visualid = (VisualID)GetPropA(GetDesktopWindow(), "__wine_x11_visual_id");
|
|
||||||
TRACE("Found x visual ID : %ld\n", visualid);
|
|
||||||
|
|
||||||
/* Search for the fbconfig that corresponds to Wine's default X visual */
|
|
||||||
for(i=0; i < This->adapter->nCfgs; i++)
|
|
||||||
{
|
|
||||||
glXGetFBConfigAttrib(display, This->adapter->cfgs[i], GLX_VISUAL_ID, &val);
|
|
||||||
|
|
||||||
/* We have found the fbconfig :) */
|
|
||||||
if(val == visualid) {
|
|
||||||
index = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(index == -1) {
|
|
||||||
ERR("Cannot find an fbconfig corresponding to visualid=%lx\n", visualid);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
visinfo = glXGetVisualFromFBConfig(display, This->adapter->cfgs[index]);
|
|
||||||
if(!visinfo) {
|
|
||||||
ERR("Cannot find a visual for the pbuffer\n");
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
drawable = glXCreatePbuffer(display, This->adapter->cfgs[index], attribs);
|
|
||||||
if(!drawable) {
|
|
||||||
ERR("Cannot create a pbuffer\n");
|
ERR("Cannot create a pbuffer\n");
|
||||||
|
ReleaseDC(win_handle, hdc_parent);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
/* Create an onscreen target */
|
|
||||||
XVisualInfo template;
|
|
||||||
int num;
|
|
||||||
|
|
||||||
template.visualid = (VisualID)GetPropA(GetDesktopWindow(), "__wine_x11_visual_id");
|
/* In WGL a pbuffer is 'wrapped' inside a HDC to 'fool' wglMakeCurrent */
|
||||||
/* TODO: change this to find a similar visual, but one with a stencil/zbuffer buffer that matches the request
|
hdc = GL_EXTCALL(wglGetPbufferDCARB(pbuffer));
|
||||||
(or the best possible if none is requested) */
|
if(!hdc) {
|
||||||
TRACE("Found x visual ID : %ld\n", template.visualid);
|
ERR("Cannot get a HDC for pbuffer (%p)\n", pbuffer);
|
||||||
visinfo = XGetVisualInfo(display, VisualIDMask, &template, &num);
|
GL_EXTCALL(wglDestroyPbufferARB(pbuffer));
|
||||||
|
ReleaseDC(win_handle, hdc_parent);
|
||||||
if (NULL == visinfo) {
|
|
||||||
ERR("cannot really get XVisual\n");
|
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
ReleaseDC(win_handle, hdc_parent);
|
||||||
} else {
|
} else {
|
||||||
int n, value;
|
PIXELFORMATDESCRIPTOR pfd;
|
||||||
/* Write out some debug info about the visual/s */
|
int iPixelFormat;
|
||||||
TRACE("Using x visual ID : %ld\n", template.visualid);
|
|
||||||
TRACE(" visual info: %p\n", visinfo);
|
hdc = GetDC(win_handle);
|
||||||
TRACE(" num items : %d\n", num);
|
if(hdc == NULL) {
|
||||||
for (n = 0;n < num; n++) {
|
ERR("Cannot retrieve a device context!\n");
|
||||||
TRACE("=====item=====: %d\n", n + 1);
|
goto out;
|
||||||
TRACE(" visualid : %ld\n", visinfo[n].visualid);
|
|
||||||
TRACE(" screen : %d\n", visinfo[n].screen);
|
|
||||||
TRACE(" depth : %u\n", visinfo[n].depth);
|
|
||||||
TRACE(" class : %d\n", visinfo[n].class);
|
|
||||||
TRACE(" red_mask : %ld\n", visinfo[n].red_mask);
|
|
||||||
TRACE(" green_mask : %ld\n", visinfo[n].green_mask);
|
|
||||||
TRACE(" blue_mask : %ld\n", visinfo[n].blue_mask);
|
|
||||||
TRACE(" colormap_size : %d\n", visinfo[n].colormap_size);
|
|
||||||
TRACE(" bits_per_rgb : %d\n", visinfo[n].bits_per_rgb);
|
|
||||||
/* log some extra glx info */
|
|
||||||
glXGetConfig(display, visinfo, GLX_AUX_BUFFERS, &value);
|
|
||||||
TRACE(" gl_aux_buffers : %d\n", value);
|
|
||||||
glXGetConfig(display, visinfo, GLX_BUFFER_SIZE ,&value);
|
|
||||||
TRACE(" gl_buffer_size : %d\n", value);
|
|
||||||
glXGetConfig(display, visinfo, GLX_RED_SIZE, &value);
|
|
||||||
TRACE(" gl_red_size : %d\n", value);
|
|
||||||
glXGetConfig(display, visinfo, GLX_GREEN_SIZE, &value);
|
|
||||||
TRACE(" gl_green_size : %d\n", value);
|
|
||||||
glXGetConfig(display, visinfo, GLX_BLUE_SIZE, &value);
|
|
||||||
TRACE(" gl_blue_size : %d\n", value);
|
|
||||||
glXGetConfig(display, visinfo, GLX_ALPHA_SIZE, &value);
|
|
||||||
TRACE(" gl_alpha_size : %d\n", value);
|
|
||||||
glXGetConfig(display, visinfo, GLX_DEPTH_SIZE ,&value);
|
|
||||||
TRACE(" gl_depth_size : %d\n", value);
|
|
||||||
glXGetConfig(display, visinfo, GLX_STENCIL_SIZE, &value);
|
|
||||||
TRACE(" gl_stencil_size : %d\n", value);
|
|
||||||
}
|
|
||||||
/* Now choose a similar visual ID*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx = glXCreateContext(display, visinfo,
|
/* PixelFormat selection */
|
||||||
This->numContexts ? This->contexts[0]->glCtx : NULL,
|
/* TODO: fill cColorBits/cDepthBits with target->resource.format */
|
||||||
GL_TRUE);
|
ZeroMemory(&pfd, sizeof(pfd));
|
||||||
|
pfd.nSize = sizeof(pfd);
|
||||||
|
pfd.nVersion = 1;
|
||||||
|
pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | PFD_DRAW_TO_WINDOW;/*PFD_GENERIC_ACCELERATED*/
|
||||||
|
pfd.iPixelType = PFD_TYPE_RGBA;
|
||||||
|
pfd.cColorBits = 32;
|
||||||
|
pfd.cDepthBits = 24;
|
||||||
|
pfd.cStencilBits = 8;
|
||||||
|
pfd.iLayerType = PFD_MAIN_PLANE;
|
||||||
|
|
||||||
|
iPixelFormat = ChoosePixelFormat(hdc, &pfd);
|
||||||
|
if(!iPixelFormat) {
|
||||||
|
/* If this happens something is very wrong as ChoosePixelFormat barely fails */
|
||||||
|
ERR("Can't find a suitable iPixelFormat\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
DescribePixelFormat(hdc, iPixelFormat, sizeof(pfd), &pfd);
|
||||||
|
SetPixelFormat(hdc, iPixelFormat, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx = wglCreateContext(hdc);
|
||||||
|
if(This->numContexts) wglShareLists(This->contexts[0]->glCtx, ctx);
|
||||||
|
|
||||||
if(!ctx) {
|
if(!ctx) {
|
||||||
ERR("Failed to create a glX context\n");
|
ERR("Failed to create a WGL context\n");
|
||||||
if(drawable != win) glXDestroyPbuffer(display, drawable);
|
if(create_pbuffer) {
|
||||||
|
GL_EXTCALL(wglReleasePbufferDCARB(pbuffer, hdc));
|
||||||
|
GL_EXTCALL(wglDestroyPbufferARB(pbuffer));
|
||||||
|
}
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
ret = AddContextToArray(This, display, ctx, drawable);
|
ret = AddContextToArray(This, win_handle, hdc, ctx, pbuffer);
|
||||||
if(!ret) {
|
if(!ret) {
|
||||||
ERR("Failed to add the newly created context to the context list\n");
|
ERR("Failed to add the newly created context to the context list\n");
|
||||||
glXDestroyContext(display, ctx);
|
wglDeleteContext(ctx);
|
||||||
if(drawable != win) glXDestroyPbuffer(display, drawable);
|
if(create_pbuffer) {
|
||||||
|
GL_EXTCALL(wglReleasePbufferDCARB(pbuffer, hdc));
|
||||||
|
GL_EXTCALL(wglDestroyPbufferARB(pbuffer));
|
||||||
|
}
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
ret->surface = (IWineD3DSurface *) target;
|
ret->surface = (IWineD3DSurface *) target;
|
||||||
ret->isPBuffer = win == 0;
|
ret->isPBuffer = create_pbuffer;
|
||||||
ret->tid = GetCurrentThreadId();
|
ret->tid = GetCurrentThreadId();
|
||||||
|
|
||||||
TRACE("Successfully created new context %p\n", ret);
|
TRACE("Successfully created new context %p\n", ret);
|
||||||
|
|
||||||
/* Set up the context defaults */
|
/* Set up the context defaults */
|
||||||
oldCtx = glXGetCurrentContext();
|
oldCtx = wglGetCurrentContext();
|
||||||
oldDrawable = glXGetCurrentDrawable();
|
oldDrawable = wglGetCurrentDC();
|
||||||
if(glXMakeCurrent(display, drawable, ctx) == FALSE) {
|
if(wglMakeCurrent(hdc, ctx) == FALSE) {
|
||||||
ERR("Cannot activate context to set up defaults\n");
|
ERR("Cannot activate context to set up defaults\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -325,11 +285,10 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(oldDrawable && oldCtx) {
|
if(oldDrawable && oldCtx) {
|
||||||
glXMakeCurrent(display, oldDrawable, oldCtx);
|
wglMakeCurrent(oldDrawable, oldCtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if(visinfo) XFree(visinfo);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,14 +347,16 @@ void DestroyContext(IWineD3DDeviceImpl *This, WineD3DContext *context) {
|
|||||||
|
|
||||||
/* check that we are the current context first */
|
/* check that we are the current context first */
|
||||||
TRACE("Destroying ctx %p\n", context);
|
TRACE("Destroying ctx %p\n", context);
|
||||||
if(glXGetCurrentContext() == context->glCtx){
|
if(wglGetCurrentContext() == context->glCtx){
|
||||||
glXMakeCurrent(context->display, None, NULL);
|
wglMakeCurrent(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
glXDestroyContext(context->display, context->glCtx);
|
|
||||||
if(context->isPBuffer) {
|
if(context->isPBuffer) {
|
||||||
glXDestroyPbuffer(context->display, context->drawable);
|
GL_EXTCALL(wglReleasePbufferDCARB(context->pbuffer, context->hdc));
|
||||||
}
|
GL_EXTCALL(wglDestroyPbufferARB(context->pbuffer));
|
||||||
|
} else ReleaseDC(context->win_handle, context->hdc);
|
||||||
|
wglDeleteContext(context->glCtx);
|
||||||
|
|
||||||
RemoveContextFromArray(This, context);
|
RemoveContextFromArray(This, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -671,8 +632,8 @@ static inline WineD3DContext *FindContext(IWineD3DDeviceImpl *This, IWineD3DSurf
|
|||||||
* Create the context on the same server as the primary swapchain. The primary swapchain is exists at this point.
|
* Create the context on the same server as the primary swapchain. The primary swapchain is exists at this point.
|
||||||
*/
|
*/
|
||||||
This->pbufferContext = CreateContext(This, targetimpl,
|
This->pbufferContext = CreateContext(This, targetimpl,
|
||||||
((IWineD3DSwapChainImpl *) This->swapchains[0])->context[0]->display,
|
((IWineD3DSwapChainImpl *) This->swapchains[0])->context[0]->win_handle,
|
||||||
0 /* Window */);
|
TRUE /* pbuffer */);
|
||||||
This->pbufferWidth = targetimpl->currentDesc.Width;
|
This->pbufferWidth = targetimpl->currentDesc.Width;
|
||||||
This->pbufferHeight = targetimpl->currentDesc.Height;
|
This->pbufferHeight = targetimpl->currentDesc.Height;
|
||||||
}
|
}
|
||||||
@ -784,9 +745,11 @@ void ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, ContextU
|
|||||||
|
|
||||||
/* Activate the opengl context */
|
/* Activate the opengl context */
|
||||||
if(context != This->activeContext) {
|
if(context != This->activeContext) {
|
||||||
Bool ret;
|
BOOL ret;
|
||||||
TRACE("Switching gl ctx to %p, drawable=%ld, ctx=%p\n", context, context->drawable, context->glCtx);
|
TRACE("Switching gl ctx to %p, hdc=%p ctx=%p\n", context, context->hdc, context->glCtx);
|
||||||
ret = glXMakeCurrent(context->display, context->drawable, context->glCtx);
|
LEAVE_GL();
|
||||||
|
ret = wglMakeCurrent(context->hdc, context->glCtx);
|
||||||
|
ENTER_GL();
|
||||||
if(ret == FALSE) {
|
if(ret == FALSE) {
|
||||||
ERR("Failed to activate the new context\n");
|
ERR("Failed to activate the new context\n");
|
||||||
}
|
}
|
||||||
|
@ -51,26 +51,6 @@ const WINED3DLIGHT WINED3D_default_light = {
|
|||||||
0.0 /* Phi */
|
0.0 /* Phi */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* x11drv GDI escapes */
|
|
||||||
#define X11DRV_ESCAPE 6789
|
|
||||||
enum x11drv_escape_codes
|
|
||||||
{
|
|
||||||
X11DRV_GET_DISPLAY, /* get X11 display for a DC */
|
|
||||||
X11DRV_GET_DRAWABLE, /* get current drawable for a DC */
|
|
||||||
X11DRV_GET_FONT, /* get current X font for a DC */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* retrieve the X display to use on a given DC */
|
|
||||||
static inline Display *get_display( HDC hdc )
|
|
||||||
{
|
|
||||||
Display *display;
|
|
||||||
enum x11drv_escape_codes escape = X11DRV_GET_DISPLAY;
|
|
||||||
|
|
||||||
if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape,
|
|
||||||
sizeof(display), (LPSTR)&display )) display = NULL;
|
|
||||||
return display;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static function declarations */
|
/* static function declarations */
|
||||||
static void WINAPI IWineD3DDeviceImpl_AddResource(IWineD3DDevice *iface, IWineD3DResource *resource);
|
static void WINAPI IWineD3DDeviceImpl_AddResource(IWineD3DDevice *iface, IWineD3DResource *resource);
|
||||||
|
|
||||||
@ -1212,7 +1192,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
|
|||||||
IWineD3DSwapChainImpl *object; /** NOTE: impl ref allowed since this is a create function **/
|
IWineD3DSwapChainImpl *object; /** NOTE: impl ref allowed since this is a create function **/
|
||||||
HRESULT hr = WINED3D_OK;
|
HRESULT hr = WINED3D_OK;
|
||||||
IUnknown *bufferParent;
|
IUnknown *bufferParent;
|
||||||
Display *display;
|
|
||||||
|
|
||||||
TRACE("(%p) : Created Aditional Swap Chain\n", This);
|
TRACE("(%p) : Created Aditional Swap Chain\n", This);
|
||||||
|
|
||||||
@ -1242,28 +1221,18 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
|
|||||||
}
|
}
|
||||||
|
|
||||||
object->win_handle = GetAncestor(object->win_handle, GA_ROOT);
|
object->win_handle = GetAncestor(object->win_handle, GA_ROOT);
|
||||||
if ( !( object->win = (Window)GetPropA(object->win_handle, "__wine_x11_whole_window") ) ) {
|
|
||||||
ERR("Can't get drawable (window), HWND:%p doesn't have the property __wine_x11_whole_window\n", object->win_handle);
|
|
||||||
return WINED3DERR_NOTAVAILABLE;
|
|
||||||
}
|
|
||||||
hDc = GetDC(object->win_handle);
|
hDc = GetDC(object->win_handle);
|
||||||
display = get_display(hDc);
|
TRACE("Using hDc %p\n", hDc);
|
||||||
ReleaseDC(object->win_handle, hDc);
|
|
||||||
TRACE("Using a display of %p %p\n", display, hDc);
|
|
||||||
|
|
||||||
if (NULL == display || NULL == hDc) {
|
if (NULL == hDc) {
|
||||||
WARN("Failed to get a display and HDc for Window %p\n", object->win_handle);
|
WARN("Failed to get a HDc for Window %p\n", object->win_handle);
|
||||||
return WINED3DERR_NOTAVAILABLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (object->win == 0) {
|
|
||||||
WARN("Failed to get a valid XVisuial ID for the window %p\n", object->win_handle);
|
|
||||||
return WINED3DERR_NOTAVAILABLE;
|
return WINED3DERR_NOTAVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
object->orig_width = GetSystemMetrics(SM_CXSCREEN);
|
object->orig_width = GetSystemMetrics(SM_CXSCREEN);
|
||||||
object->orig_height = GetSystemMetrics(SM_CYSCREEN);
|
object->orig_height = GetSystemMetrics(SM_CYSCREEN);
|
||||||
object->orig_fmt = pixelformat_for_depth(GetDeviceCaps(hDc, BITSPIXEL) * GetDeviceCaps(hDc, PLANES));
|
object->orig_fmt = pixelformat_for_depth(GetDeviceCaps(hDc, BITSPIXEL) * GetDeviceCaps(hDc, PLANES));
|
||||||
|
ReleaseDC(object->win_handle, hDc);
|
||||||
|
|
||||||
/** MSDN: If Windowed is TRUE and either of the BackBufferWidth/Height values is zero,
|
/** MSDN: If Windowed is TRUE and either of the BackBufferWidth/Height values is zero,
|
||||||
* then the corresponding dimension of the client area of the hDeviceWindow
|
* then the corresponding dimension of the client area of the hDeviceWindow
|
||||||
@ -1324,7 +1293,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
|
|||||||
object->num_contexts = 1;
|
object->num_contexts = 1;
|
||||||
|
|
||||||
ENTER_GL();
|
ENTER_GL();
|
||||||
object->context[0] = CreateContext(This, (IWineD3DSurfaceImpl *) object->frontBuffer, display, object->win);
|
object->context[0] = CreateContext(This, (IWineD3DSurfaceImpl *) object->frontBuffer, object->win_handle, FALSE /* pbuffer */);
|
||||||
LEAVE_GL();
|
LEAVE_GL();
|
||||||
|
|
||||||
if (!object->context[0]) {
|
if (!object->context[0]) {
|
||||||
@ -1332,8 +1301,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
|
|||||||
hr = WINED3DERR_NOTAVAILABLE;
|
hr = WINED3DERR_NOTAVAILABLE;
|
||||||
goto error;
|
goto error;
|
||||||
} else {
|
} else {
|
||||||
TRACE("Context created (HWND=%p, glContext=%p, Window=%ld)\n",
|
TRACE("Context created (HWND=%p, glContext=%p)\n",
|
||||||
object->win_handle, object->context[0]->glCtx, object->win);
|
object->win_handle, object->context[0]->glCtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
|
@ -123,26 +123,6 @@ static const struct {
|
|||||||
* Utility functions follow
|
* Utility functions follow
|
||||||
**********************************************************/
|
**********************************************************/
|
||||||
|
|
||||||
/* x11drv GDI escapes */
|
|
||||||
#define X11DRV_ESCAPE 6789
|
|
||||||
enum x11drv_escape_codes
|
|
||||||
{
|
|
||||||
X11DRV_GET_DISPLAY, /* get X11 display for a DC */
|
|
||||||
X11DRV_GET_DRAWABLE, /* get current drawable for a DC */
|
|
||||||
X11DRV_GET_FONT, /* get current X font for a DC */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* retrieve the X display to use on a given DC */
|
|
||||||
static inline Display *get_display( HDC hdc )
|
|
||||||
{
|
|
||||||
Display *display;
|
|
||||||
enum x11drv_escape_codes escape = X11DRV_GET_DISPLAY;
|
|
||||||
|
|
||||||
if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape,
|
|
||||||
sizeof(display), (LPSTR)&display )) display = NULL;
|
|
||||||
return display;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Adapters */
|
/* Adapters */
|
||||||
static int numAdapters = 0;
|
static int numAdapters = 0;
|
||||||
static struct WineD3DAdapter Adapters[1];
|
static struct WineD3DAdapter Adapters[1];
|
||||||
@ -212,8 +192,7 @@ static void WineD3D_ReleaseFakeGLContext(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static BOOL WineD3D_CreateFakeGLContext(void) {
|
static BOOL WineD3D_CreateFakeGLContext(void) {
|
||||||
GLXContext glCtx;
|
HGLRC glCtx = NULL;
|
||||||
HGLRC wglCtx = NULL;
|
|
||||||
|
|
||||||
ENTER_GL();
|
ENTER_GL();
|
||||||
EnterCriticalSection(&wined3d_fake_gl_context_cs);
|
EnterCriticalSection(&wined3d_fake_gl_context_cs);
|
||||||
@ -224,7 +203,7 @@ static BOOL WineD3D_CreateFakeGLContext(void) {
|
|||||||
|
|
||||||
wined3d_fake_gl_context_foreign = TRUE;
|
wined3d_fake_gl_context_foreign = TRUE;
|
||||||
|
|
||||||
glCtx = glXGetCurrentContext();
|
glCtx = wglGetCurrentContext();
|
||||||
if (!glCtx) {
|
if (!glCtx) {
|
||||||
PIXELFORMATDESCRIPTOR pfd;
|
PIXELFORMATDESCRIPTOR pfd;
|
||||||
int iPixelFormat;
|
int iPixelFormat;
|
||||||
@ -262,14 +241,14 @@ static BOOL WineD3D_CreateFakeGLContext(void) {
|
|||||||
SetPixelFormat(wined3d_fake_gl_context_hdc, iPixelFormat, &pfd);
|
SetPixelFormat(wined3d_fake_gl_context_hdc, iPixelFormat, &pfd);
|
||||||
|
|
||||||
/* Create a GL context */
|
/* Create a GL context */
|
||||||
wglCtx = wglCreateContext(wined3d_fake_gl_context_hdc);
|
glCtx = wglCreateContext(wined3d_fake_gl_context_hdc);
|
||||||
if (!wglCtx) {
|
if (!glCtx) {
|
||||||
WARN_(d3d_caps)("Error creating default context for capabilities initialization\n");
|
WARN_(d3d_caps)("Error creating default context for capabilities initialization\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make it the current GL context */
|
/* Make it the current GL context */
|
||||||
if (!wglMakeCurrent(wined3d_fake_gl_context_hdc, wglCtx)) {
|
if (!wglMakeCurrent(wined3d_fake_gl_context_hdc, glCtx)) {
|
||||||
WARN_(d3d_caps)("Error setting default context as current for capabilities initialization\n");
|
WARN_(d3d_caps)("Error setting default context as current for capabilities initialization\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@ -288,7 +267,7 @@ static BOOL WineD3D_CreateFakeGLContext(void) {
|
|||||||
if(wined3d_fake_gl_context_hwnd)
|
if(wined3d_fake_gl_context_hwnd)
|
||||||
DestroyWindow(wined3d_fake_gl_context_hwnd);
|
DestroyWindow(wined3d_fake_gl_context_hwnd);
|
||||||
wined3d_fake_gl_context_hwnd = NULL;
|
wined3d_fake_gl_context_hwnd = NULL;
|
||||||
if(wglCtx) wglDeleteContext(wglCtx);
|
if(glCtx) wglDeleteContext(glCtx);
|
||||||
LeaveCriticalSection(&wined3d_fake_gl_context_cs);
|
LeaveCriticalSection(&wined3d_fake_gl_context_cs);
|
||||||
LEAVE_GL();
|
LEAVE_GL();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -413,17 +392,19 @@ static void select_shader_max_constants(
|
|||||||
**********************************************************/
|
**********************************************************/
|
||||||
|
|
||||||
#define GLINFO_LOCATION (*gl_info)
|
#define GLINFO_LOCATION (*gl_info)
|
||||||
BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display) {
|
BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) {
|
||||||
const char *GL_Extensions = NULL;
|
const char *GL_Extensions = NULL;
|
||||||
const char *GLX_Extensions = NULL;
|
const char *WGL_Extensions = NULL;
|
||||||
const char *gl_string = NULL;
|
const char *gl_string = NULL;
|
||||||
const char *gl_string_cursor = NULL;
|
const char *gl_string_cursor = NULL;
|
||||||
GLint gl_max;
|
GLint gl_max;
|
||||||
GLfloat gl_floatv[2];
|
GLfloat gl_floatv[2];
|
||||||
Bool test = 0;
|
|
||||||
int major = 1, minor = 0;
|
int major = 1, minor = 0;
|
||||||
BOOL return_value = TRUE;
|
BOOL return_value = TRUE;
|
||||||
int i;
|
int i;
|
||||||
|
HDC hdc;
|
||||||
|
HMODULE mod_gl;
|
||||||
|
PROC (WINAPI *p_wglGetProcAddress)(LPCSTR lpszProc);
|
||||||
|
|
||||||
/* Make sure that we've got a context */
|
/* Make sure that we've got a context */
|
||||||
/* TODO: CreateFakeGLContext should really take a display as a parameter */
|
/* TODO: CreateFakeGLContext should really take a display as a parameter */
|
||||||
@ -431,22 +412,14 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display) {
|
|||||||
if (!WineD3D_CreateFakeGLContext() || wined3d_fake_gl_context_foreign)
|
if (!WineD3D_CreateFakeGLContext() || wined3d_fake_gl_context_foreign)
|
||||||
return_value = FALSE;
|
return_value = FALSE;
|
||||||
|
|
||||||
TRACE_(d3d_caps)("(%p, %p)\n", gl_info, display);
|
TRACE_(d3d_caps)("(%p)\n", gl_info);
|
||||||
|
|
||||||
gl_string = (const char *) glGetString(GL_RENDERER);
|
gl_string = (const char *) glGetString(GL_RENDERER);
|
||||||
if (NULL == gl_string)
|
if (NULL == gl_string)
|
||||||
gl_string = "None";
|
gl_string = "None";
|
||||||
strcpy(gl_info->gl_renderer, gl_string);
|
strcpy(gl_info->gl_renderer, gl_string);
|
||||||
|
|
||||||
/* Fill in the GL info retrievable depending on the display */
|
|
||||||
if (NULL != display) {
|
|
||||||
test = glXQueryVersion(display, &major, &minor);
|
|
||||||
gl_info->glx_version = ((major & 0x0000FFFF) << 16) | (minor & 0x0000FFFF);
|
|
||||||
} else {
|
|
||||||
FIXME("Display must not be NULL, use glXGetCurrentDisplay or getAdapterDisplay()\n");
|
|
||||||
}
|
|
||||||
gl_string = (const char *) glGetString(GL_VENDOR);
|
gl_string = (const char *) glGetString(GL_VENDOR);
|
||||||
|
|
||||||
TRACE_(d3d_caps)("Filling vendor string %s\n", gl_string);
|
TRACE_(d3d_caps)("Filling vendor string %s\n", gl_string);
|
||||||
if (gl_string != NULL) {
|
if (gl_string != NULL) {
|
||||||
/* Fill in the GL vendor */
|
/* Fill in the GL vendor */
|
||||||
@ -606,10 +579,23 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display) {
|
|||||||
gl_info->vs_arb_constantsF = 0;
|
gl_info->vs_arb_constantsF = 0;
|
||||||
gl_info->ps_arb_constantsF = 0;
|
gl_info->ps_arb_constantsF = 0;
|
||||||
|
|
||||||
|
/* To bypass the opengl32 thunks load wglGetProcAddress from gdi32 (glXGetProcAddress wrapper) instead of opengl32's */
|
||||||
|
mod_gl = LoadLibraryA("gdi32.dll");
|
||||||
|
if(!mod_gl) {
|
||||||
|
ERR("Can't load gdi32.dll!\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
p_wglGetProcAddress = (void*)GetProcAddress(mod_gl, "wglGetProcAddress");
|
||||||
|
if(!p_wglGetProcAddress) {
|
||||||
|
ERR("Unable to load wglGetProcAddress!\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Now work out what GL support this card really has */
|
/* Now work out what GL support this card really has */
|
||||||
#define USE_GL_FUNC(type, pfn) gl_info->pfn = (type) glXGetProcAddressARB( (const GLubyte *) #pfn);
|
#define USE_GL_FUNC(type, pfn) gl_info->pfn = (type) p_wglGetProcAddress( (const char *) #pfn);
|
||||||
GL_EXT_FUNCS_GEN;
|
GL_EXT_FUNCS_GEN;
|
||||||
GLX_EXT_FUNCS_GEN;
|
WGL_EXT_FUNCS_GEN;
|
||||||
#undef USE_GL_FUNC
|
#undef USE_GL_FUNC
|
||||||
|
|
||||||
/* Retrieve opengl defaults */
|
/* Retrieve opengl defaults */
|
||||||
@ -1002,28 +988,32 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display) {
|
|||||||
|
|
||||||
/* TODO: config lookups */
|
/* TODO: config lookups */
|
||||||
|
|
||||||
if (display != NULL) {
|
/* Make sure there's an active HDC else the WGL extensions will fail */
|
||||||
GLX_Extensions = glXQueryExtensionsString(display, DefaultScreen(display));
|
hdc = wglGetCurrentDC();
|
||||||
TRACE_(d3d_caps)("GLX_Extensions reported:\n");
|
if (hdc) {
|
||||||
|
WGL_Extensions = GL_EXTCALL(wglGetExtensionsStringARB(hdc));
|
||||||
|
TRACE_(d3d_caps)("WGL_Extensions reported:\n");
|
||||||
|
|
||||||
if (NULL == GLX_Extensions) {
|
if (NULL == WGL_Extensions) {
|
||||||
ERR(" GLX_Extensions returns NULL\n");
|
ERR(" WGL_Extensions returns NULL\n");
|
||||||
} else {
|
} else {
|
||||||
while (*GLX_Extensions != 0x00) {
|
while (*WGL_Extensions != 0x00) {
|
||||||
const char *Start = GLX_Extensions;
|
const char *Start = WGL_Extensions;
|
||||||
char ThisExtn[256];
|
char ThisExtn[256];
|
||||||
|
|
||||||
memset(ThisExtn, 0x00, sizeof(ThisExtn));
|
memset(ThisExtn, 0x00, sizeof(ThisExtn));
|
||||||
while (*GLX_Extensions != ' ' && *GLX_Extensions != 0x00) {
|
while (*WGL_Extensions != ' ' && *WGL_Extensions != 0x00) {
|
||||||
GLX_Extensions++;
|
WGL_Extensions++;
|
||||||
}
|
}
|
||||||
memcpy(ThisExtn, Start, (GLX_Extensions - Start));
|
memcpy(ThisExtn, Start, (WGL_Extensions - Start));
|
||||||
TRACE_(d3d_caps)("- %s\n", ThisExtn);
|
TRACE_(d3d_caps)("- %s\n", ThisExtn);
|
||||||
if (strstr(ThisExtn, "GLX_SGI_video_sync")) {
|
|
||||||
gl_info->supported[SGI_VIDEO_SYNC] = TRUE;
|
if (strstr(ThisExtn, "WGL_ARB_pbuffer")) {
|
||||||
|
gl_info->supported[WGL_ARB_PBUFFER] = TRUE;
|
||||||
|
TRACE_(d3d_caps)("FOUND: WGL_ARB_pbuffer support\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*GLX_Extensions == ' ') GLX_Extensions++;
|
if (*WGL_Extensions == ' ') WGL_Extensions++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1306,7 +1296,7 @@ static HRESULT WINAPI IWineD3DImpl_GetAdapterIdentifier(IWineD3D *iface, UINT Ad
|
|||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL IWineD3DImpl_IsGLXFBConfigCompatibleWithRenderFmt(Display *display, GLXFBConfig cfgs, WINED3DFORMAT Format) {
|
static BOOL IWineD3DImpl_IsGLXFBConfigCompatibleWithRenderFmt(int iPixelFormat, WINED3DFORMAT Format) {
|
||||||
#if 0 /* This code performs a strict test between the format and the current X11 buffer depth, which may give the best performance */
|
#if 0 /* This code performs a strict test between the format and the current X11 buffer depth, which may give the best performance */
|
||||||
int gl_test;
|
int gl_test;
|
||||||
int rb, gb, bb, ab, type, buf_sz;
|
int rb, gb, bb, ab, type, buf_sz;
|
||||||
@ -1374,7 +1364,7 @@ return FALSE;
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL IWineD3DImpl_IsGLXFBConfigCompatibleWithDepthFmt(Display *display, GLXFBConfig cfgs, WINED3DFORMAT Format) {
|
static BOOL IWineD3DImpl_IsGLXFBConfigCompatibleWithDepthFmt(int iPixelFormat, WINED3DFORMAT Format) {
|
||||||
#if 0/* This code performs a strict test between the format and the current X11 buffer depth, which may give the best performance */
|
#if 0/* This code performs a strict test between the format and the current X11 buffer depth, which may give the best performance */
|
||||||
int gl_test;
|
int gl_test;
|
||||||
int db, sb;
|
int db, sb;
|
||||||
@ -1451,8 +1441,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDepthStencilMatch(IWineD3D *iface, UINT
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (it = 0; it < Adapters[Adapter].nCfgs; ++it) {
|
for (it = 0; it < Adapters[Adapter].nCfgs; ++it) {
|
||||||
if (IWineD3DImpl_IsGLXFBConfigCompatibleWithRenderFmt(Adapters[Adapter].display, Adapters[Adapter].cfgs[it], RenderTargetFormat)) {
|
if (IWineD3DImpl_IsGLXFBConfigCompatibleWithRenderFmt(it, RenderTargetFormat)) {
|
||||||
if (IWineD3DImpl_IsGLXFBConfigCompatibleWithDepthFmt(Adapters[Adapter].display, Adapters[Adapter].cfgs[it], DepthStencilFormat)) {
|
if (IWineD3DImpl_IsGLXFBConfigCompatibleWithDepthFmt(it, DepthStencilFormat)) {
|
||||||
TRACE_(d3d_caps)("(%p) : Formats matched\n", This);
|
TRACE_(d3d_caps)("(%p) : Formats matched\n", This);
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
@ -1499,10 +1489,8 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceType(IWineD3D *iface, UINT Adapter
|
|||||||
WINED3DFORMAT DisplayFormat, WINED3DFORMAT BackBufferFormat, BOOL Windowed) {
|
WINED3DFORMAT DisplayFormat, WINED3DFORMAT BackBufferFormat, BOOL Windowed) {
|
||||||
|
|
||||||
IWineD3DImpl *This = (IWineD3DImpl *)iface;
|
IWineD3DImpl *This = (IWineD3DImpl *)iface;
|
||||||
GLXFBConfig* cfgs = NULL;
|
|
||||||
int nCfgs = 0;
|
int nCfgs = 0;
|
||||||
int it;
|
int it;
|
||||||
Display *display;
|
|
||||||
HRESULT hr = WINED3DERR_NOTAVAILABLE;
|
HRESULT hr = WINED3DERR_NOTAVAILABLE;
|
||||||
|
|
||||||
TRACE_(d3d_caps)("(%p)-> (STUB) (Adptr:%d, CheckType:(%x,%s), DispFmt:(%x,%s), BackBuf:(%x,%s), Win?%d): stub\n",
|
TRACE_(d3d_caps)("(%p)-> (STUB) (Adptr:%d, CheckType:(%x,%s), DispFmt:(%x,%s), BackBuf:(%x,%s), Win?%d): stub\n",
|
||||||
@ -1520,16 +1508,15 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceType(IWineD3D *iface, UINT Adapter
|
|||||||
|
|
||||||
/* TODO: Store in adapter structure */
|
/* TODO: Store in adapter structure */
|
||||||
if (WineD3D_CreateFakeGLContext()) {
|
if (WineD3D_CreateFakeGLContext()) {
|
||||||
display = get_display(wined3d_fake_gl_context_hdc);
|
nCfgs = DescribePixelFormat(wined3d_fake_gl_context_hdc, 0, 0, NULL);
|
||||||
cfgs = glXGetFBConfigs(display, DefaultScreen(display), &nCfgs);
|
|
||||||
for (it = 0; it < nCfgs; ++it) {
|
for (it = 0; it < nCfgs; ++it) {
|
||||||
if (IWineD3DImpl_IsGLXFBConfigCompatibleWithRenderFmt(display, cfgs[it], DisplayFormat)) {
|
if (IWineD3DImpl_IsGLXFBConfigCompatibleWithRenderFmt(it, DisplayFormat)) {
|
||||||
hr = WINED3D_OK;
|
hr = WINED3D_OK;
|
||||||
TRACE_(d3d_caps)("OK\n");
|
TRACE_(d3d_caps)("OK\n");
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(cfgs) XFree(cfgs);
|
|
||||||
if(hr != WINED3D_OK)
|
if(hr != WINED3D_OK)
|
||||||
ERR("unsupported format %s\n", debug_d3dformat(DisplayFormat));
|
ERR("unsupported format %s\n", debug_d3dformat(DisplayFormat));
|
||||||
WineD3D_ReleaseFakeGLContext();
|
WineD3D_ReleaseFakeGLContext();
|
||||||
@ -2542,8 +2529,8 @@ ULONG WINAPI D3DCB_DefaultDestroyVolume(IWineD3DVolume *pVolume) {
|
|||||||
return IUnknown_Release(volumeParent);
|
return IUnknown_Release(volumeParent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define GLINFO_LOCATION (Adapters[0].gl_info)
|
||||||
BOOL InitAdapters(void) {
|
BOOL InitAdapters(void) {
|
||||||
HDC device_context;
|
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
int ps_selected_mode, vs_selected_mode;
|
int ps_selected_mode, vs_selected_mode;
|
||||||
|
|
||||||
@ -2555,36 +2542,20 @@ BOOL InitAdapters(void) {
|
|||||||
TRACE("Initializing adapters\n");
|
TRACE("Initializing adapters\n");
|
||||||
/* For now only one default adapter */
|
/* For now only one default adapter */
|
||||||
{
|
{
|
||||||
|
int attribute;
|
||||||
TRACE("Initializing default adapter\n");
|
TRACE("Initializing default adapter\n");
|
||||||
Adapters[0].monitorPoint.x = -1;
|
Adapters[0].monitorPoint.x = -1;
|
||||||
Adapters[0].monitorPoint.y = -1;
|
Adapters[0].monitorPoint.y = -1;
|
||||||
|
|
||||||
device_context = GetDC(0);
|
ret = IWineD3DImpl_FillGLCaps(&Adapters[0].gl_info);
|
||||||
Adapters[0].display = get_display(device_context);
|
|
||||||
ReleaseDC(0, device_context);
|
|
||||||
|
|
||||||
ENTER_GL();
|
|
||||||
if(WineD3D_CreateFakeGLContext()) {
|
|
||||||
Adapters[0].cfgs = glXGetFBConfigs(Adapters[0].display, DefaultScreen(Adapters[0].display), &Adapters[0].nCfgs);
|
|
||||||
WineD3D_ReleaseFakeGLContext();
|
|
||||||
} else {
|
|
||||||
ERR("Failed to create a fake opengl context to find fbconfigs formats\n");
|
|
||||||
LEAVE_GL();
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
LEAVE_GL();
|
|
||||||
|
|
||||||
ret = IWineD3DImpl_FillGLCaps(&Adapters[0].gl_info, Adapters[0].display);
|
|
||||||
if(!ret) {
|
if(!ret) {
|
||||||
ERR("Failed to initialize gl caps for default adapter\n");
|
ERR("Failed to initialize gl caps for default adapter\n");
|
||||||
XFree(Adapters[0].cfgs);
|
|
||||||
HeapFree(GetProcessHeap(), 0, Adapters);
|
HeapFree(GetProcessHeap(), 0, Adapters);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
ret = initPixelFormats(&Adapters[0].gl_info);
|
ret = initPixelFormats(&Adapters[0].gl_info);
|
||||||
if(!ret) {
|
if(!ret) {
|
||||||
ERR("Failed to init gl formats\n");
|
ERR("Failed to init gl formats\n");
|
||||||
XFree(Adapters[0].cfgs);
|
|
||||||
HeapFree(GetProcessHeap(), 0, Adapters);
|
HeapFree(GetProcessHeap(), 0, Adapters);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -2592,6 +2563,12 @@ BOOL InitAdapters(void) {
|
|||||||
Adapters[0].driver = "Display";
|
Adapters[0].driver = "Display";
|
||||||
Adapters[0].description = "Direct3D HAL";
|
Adapters[0].description = "Direct3D HAL";
|
||||||
|
|
||||||
|
if (WineD3D_CreateFakeGLContext()) {
|
||||||
|
attribute = WGL_NUMBER_PIXEL_FORMATS_ARB;
|
||||||
|
GL_EXTCALL(wglGetPixelFormatAttribivARB(wined3d_fake_gl_context_hdc, 0, 0, 1, &attribute, &Adapters[0].nCfgs));
|
||||||
|
WineD3D_ReleaseFakeGLContext();
|
||||||
|
}
|
||||||
|
|
||||||
select_shader_mode(&Adapters[0].gl_info, WINED3DDEVTYPE_HAL, &ps_selected_mode, &vs_selected_mode);
|
select_shader_mode(&Adapters[0].gl_info, WINED3DDEVTYPE_HAL, &ps_selected_mode, &vs_selected_mode);
|
||||||
select_shader_max_constants(ps_selected_mode, vs_selected_mode, &Adapters[0].gl_info);
|
select_shader_max_constants(ps_selected_mode, vs_selected_mode, &Adapters[0].gl_info);
|
||||||
|
|
||||||
@ -2601,7 +2578,7 @@ BOOL InitAdapters(void) {
|
|||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
#undef GLINFO_LOCATION
|
||||||
|
|
||||||
/**********************************************************
|
/**********************************************************
|
||||||
* IWineD3D VTbl follows
|
* IWineD3D VTbl follows
|
||||||
|
@ -24,27 +24,6 @@
|
|||||||
#include "wined3d_private.h"
|
#include "wined3d_private.h"
|
||||||
|
|
||||||
|
|
||||||
/* TODO: move to shared header (or context manager )*/
|
|
||||||
/* x11drv GDI escapes */
|
|
||||||
#define X11DRV_ESCAPE 6789
|
|
||||||
enum x11drv_escape_codes
|
|
||||||
{
|
|
||||||
X11DRV_GET_DISPLAY, /* get X11 display for a DC */
|
|
||||||
X11DRV_GET_DRAWABLE, /* get current drawable for a DC */
|
|
||||||
X11DRV_GET_FONT, /* get current X font for a DC */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* retrieve the X display to use on a given DC */
|
|
||||||
static inline Display *get_display( HDC hdc )
|
|
||||||
{
|
|
||||||
Display *display;
|
|
||||||
enum x11drv_escape_codes escape = X11DRV_GET_DISPLAY;
|
|
||||||
|
|
||||||
if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPCSTR)&escape,
|
|
||||||
sizeof(display), (LPSTR)&display )) display = NULL;
|
|
||||||
return display;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*TODO: some of the additional parameters may be required to
|
/*TODO: some of the additional parameters may be required to
|
||||||
set the gamma ramp (for some weird reason microsoft have left swap gammaramp in device
|
set the gamma ramp (for some weird reason microsoft have left swap gammaramp in device
|
||||||
but it operates on a swapchain, it may be a good idea to move it to IWineD3DSwapChain for IWineD3D)*/
|
but it operates on a swapchain, it may be a good idea to move it to IWineD3DSwapChain for IWineD3D)*/
|
||||||
@ -199,13 +178,11 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
|
|||||||
|
|
||||||
if (pSourceRect || pDestRect) FIXME("Unhandled present options %p/%p\n", pSourceRect, pDestRect);
|
if (pSourceRect || pDestRect) FIXME("Unhandled present options %p/%p\n", pSourceRect, pDestRect);
|
||||||
/* TODO: If only source rect or dest rect are supplied then clip the window to match */
|
/* TODO: If only source rect or dest rect are supplied then clip the window to match */
|
||||||
TRACE("preseting display %p, drawable %ld\n", This->context[0]->display, This->context[0]->drawable);
|
TRACE("preseting HDC %p\n", This->context[0]->hdc);
|
||||||
|
|
||||||
/* Don't call checkGLcall, as glGetError is not applicable here */
|
/* Don't call checkGLcall, as glGetError is not applicable here */
|
||||||
if (hDestWindowOverride && This->win_handle != hDestWindowOverride) {
|
if (hDestWindowOverride && This->win_handle != hDestWindowOverride) {
|
||||||
HDC hDc;
|
|
||||||
WINED3DLOCKED_RECT r;
|
WINED3DLOCKED_RECT r;
|
||||||
Display *display;
|
|
||||||
BYTE *mem;
|
BYTE *mem;
|
||||||
|
|
||||||
TRACE("Performing dest override of swapchain %p from window %p to %p\n", This, This->win_handle, hDestWindowOverride);
|
TRACE("Performing dest override of swapchain %p from window %p to %p\n", This, This->win_handle, hDestWindowOverride);
|
||||||
@ -216,11 +193,7 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
|
|||||||
*/
|
*/
|
||||||
ERR("Cannot change the destination window of the owner of the primary context\n");
|
ERR("Cannot change the destination window of the owner of the primary context\n");
|
||||||
} else {
|
} else {
|
||||||
hDc = GetDC(hDestWindowOverride);
|
|
||||||
This->win_handle = hDestWindowOverride;
|
This->win_handle = hDestWindowOverride;
|
||||||
This->win = (Window)GetPropA( hDestWindowOverride, "__wine_x11_whole_window" );
|
|
||||||
display = get_display(hDc);
|
|
||||||
ReleaseDC(hDestWindowOverride, hDc);
|
|
||||||
|
|
||||||
/* The old back buffer has to be copied over to the new back buffer. A lockrect - switchcontext - unlockrect
|
/* The old back buffer has to be copied over to the new back buffer. A lockrect - switchcontext - unlockrect
|
||||||
* would suffice in theory, but it is rather nasty and may cause troubles with future changes of the locking code
|
* would suffice in theory, but it is rather nasty and may cause troubles with future changes of the locking code
|
||||||
@ -232,7 +205,7 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
|
|||||||
IWineD3DSurface_UnlockRect(This->backBuffer[0]);
|
IWineD3DSurface_UnlockRect(This->backBuffer[0]);
|
||||||
|
|
||||||
DestroyContext(This->wineD3DDevice, This->context[0]);
|
DestroyContext(This->wineD3DDevice, This->context[0]);
|
||||||
This->context[0] = CreateContext(This->wineD3DDevice, (IWineD3DSurfaceImpl *) This->frontBuffer, display, This->win);
|
This->context[0] = CreateContext(This->wineD3DDevice, (IWineD3DSurfaceImpl *) This->frontBuffer, This->win_handle, FALSE /* pbuffer */);
|
||||||
|
|
||||||
IWineD3DSurface_LockRect(This->backBuffer[0], &r, NULL, WINED3DLOCK_DISCARD);
|
IWineD3DSurface_LockRect(This->backBuffer[0], &r, NULL, WINED3DLOCK_DISCARD);
|
||||||
memcpy(r.pBits, mem, r.Pitch * ((IWineD3DSurfaceImpl *) This->backBuffer[0])->currentDesc.Height);
|
memcpy(r.pBits, mem, r.Pitch * ((IWineD3DSurfaceImpl *) This->backBuffer[0])->currentDesc.Height);
|
||||||
@ -241,9 +214,9 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glXSwapBuffers(This->context[0]->display, This->context[0]->drawable); /* TODO: cycle through the swapchain buffers */
|
SwapBuffers(This->context[0]->hdc); /* TODO: cycle through the swapchain buffers */
|
||||||
|
|
||||||
TRACE("glXSwapBuffers called, Starting new frame\n");
|
TRACE("SwapBuffers called, Starting new frame\n");
|
||||||
/* FPS support */
|
/* FPS support */
|
||||||
if (TRACE_ON(fps))
|
if (TRACE_ON(fps))
|
||||||
{
|
{
|
||||||
@ -564,7 +537,7 @@ WineD3DContext *IWineD3DSwapChainImpl_CreateContextForThread(IWineD3DSwapChain *
|
|||||||
TRACE("Creating a new context for swapchain %p, thread %d\n", This, GetCurrentThreadId());
|
TRACE("Creating a new context for swapchain %p, thread %d\n", This, GetCurrentThreadId());
|
||||||
|
|
||||||
ctx = CreateContext(This->wineD3DDevice, (IWineD3DSurfaceImpl *) This->frontBuffer,
|
ctx = CreateContext(This->wineD3DDevice, (IWineD3DSurfaceImpl *) This->frontBuffer,
|
||||||
This->context[0]->display, This->win);
|
This->context[0]->win_handle, FALSE /* pbuffer */);
|
||||||
if(!ctx) {
|
if(!ctx) {
|
||||||
ERR("Failed to create a new context for the swapchain\n");
|
ERR("Failed to create a new context for the swapchain\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -520,9 +520,10 @@ struct WineD3DContext {
|
|||||||
char texShaderBumpMap;
|
char texShaderBumpMap;
|
||||||
|
|
||||||
/* The actual opengl context */
|
/* The actual opengl context */
|
||||||
GLXContext glCtx;
|
HGLRC glCtx;
|
||||||
Drawable drawable;
|
HWND win_handle;
|
||||||
Display *display;
|
HDC hdc;
|
||||||
|
HPBUFFERARB pbuffer;
|
||||||
BOOL isPBuffer;
|
BOOL isPBuffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -534,7 +535,7 @@ typedef enum ContextUsage {
|
|||||||
} ContextUsage;
|
} ContextUsage;
|
||||||
|
|
||||||
void ActivateContext(IWineD3DDeviceImpl *device, IWineD3DSurface *target, ContextUsage usage);
|
void ActivateContext(IWineD3DDeviceImpl *device, IWineD3DSurface *target, ContextUsage usage);
|
||||||
WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target, Display *display, Window win);
|
WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target, HWND win, BOOL create_pbuffer);
|
||||||
void DestroyContext(IWineD3DDeviceImpl *This, WineD3DContext *context);
|
void DestroyContext(IWineD3DDeviceImpl *This, WineD3DContext *context);
|
||||||
void apply_fbo_state(IWineD3DDevice *iface);
|
void apply_fbo_state(IWineD3DDevice *iface);
|
||||||
|
|
||||||
@ -577,11 +578,9 @@ typedef struct GLPixelFormatDesc GLPixelFormatDesc;
|
|||||||
struct WineD3DAdapter
|
struct WineD3DAdapter
|
||||||
{
|
{
|
||||||
POINT monitorPoint;
|
POINT monitorPoint;
|
||||||
Display *display;
|
|
||||||
WineD3D_GL_Info gl_info;
|
WineD3D_GL_Info gl_info;
|
||||||
const char *driver;
|
const char *driver;
|
||||||
const char *description;
|
const char *description;
|
||||||
GLXFBConfig *cfgs;
|
|
||||||
int nCfgs;
|
int nCfgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1439,7 +1438,6 @@ typedef struct IWineD3DSwapChainImpl
|
|||||||
unsigned int num_contexts;
|
unsigned int num_contexts;
|
||||||
|
|
||||||
HWND win_handle;
|
HWND win_handle;
|
||||||
Window win;
|
|
||||||
} IWineD3DSwapChainImpl;
|
} IWineD3DSwapChainImpl;
|
||||||
|
|
||||||
extern const IWineD3DSwapChainVtbl IWineD3DSwapChain_Vtbl;
|
extern const IWineD3DSwapChainVtbl IWineD3DSwapChain_Vtbl;
|
||||||
|
@ -36,8 +36,6 @@
|
|||||||
#define XMD_H /* This is to prevent the Xmd.h inclusion bug :-/ */
|
#define XMD_H /* This is to prevent the Xmd.h inclusion bug :-/ */
|
||||||
#define GL_GLEXT_LEGACY
|
#define GL_GLEXT_LEGACY
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#define GLX_GLXEXT_PROTOTYPES
|
|
||||||
#include <GL/glx.h>
|
|
||||||
#undef XMD_H
|
#undef XMD_H
|
||||||
|
|
||||||
#undef APIENTRY
|
#undef APIENTRY
|
||||||
@ -1578,37 +1576,6 @@ typedef void (APIENTRY * PGLFNVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/****************************************************
|
|
||||||
* OpenGL GLX Extensions
|
|
||||||
* defines and functions pointer
|
|
||||||
****************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************
|
|
||||||
* OpenGL GLX Official Version
|
|
||||||
* defines and functions pointer
|
|
||||||
****************************************************/
|
|
||||||
/* GLX_VERSION_1_3 */
|
|
||||||
typedef GLXFBConfig * (APIENTRY * PGLXFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements);
|
|
||||||
typedef GLXFBConfig * (APIENTRY * PGLXFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
|
|
||||||
typedef int (APIENTRY * PGLXFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value);
|
|
||||||
typedef XVisualInfo * (APIENTRY * PGLXFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
|
|
||||||
typedef GLXWindow (APIENTRY * PGLXFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
|
|
||||||
typedef void (APIENTRY * PGLXFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win);
|
|
||||||
typedef GLXPixmap (APIENTRY * PGLXFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
|
|
||||||
typedef void (APIENTRY * PGLXFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap);
|
|
||||||
typedef GLXPbuffer (APIENTRY * PGLXFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list);
|
|
||||||
typedef void (APIENTRY * PGLXFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf);
|
|
||||||
typedef void (APIENTRY * PGLXFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
|
|
||||||
typedef GLXContext (APIENTRY * PGLXFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
|
|
||||||
typedef Bool (APIENTRY * PGLXFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
|
|
||||||
typedef GLXDrawable (APIENTRY * PGLXFNGLXGETCURRENTREADDRAWABLEPROC) (void);
|
|
||||||
typedef Display * (APIENTRY * PGLXFNGLXGETCURRENTDISPLAYPROC) (void);
|
|
||||||
typedef int (APIENTRY * PGLXFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value);
|
|
||||||
typedef void (APIENTRY * PGLXFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask);
|
|
||||||
typedef void (APIENTRY * PGLXFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************
|
/****************************************************
|
||||||
* Enumerated types
|
* Enumerated types
|
||||||
****************************************************/
|
****************************************************/
|
||||||
@ -1758,6 +1725,9 @@ typedef enum _GL_SupportedExt {
|
|||||||
/* SGI */
|
/* SGI */
|
||||||
SGI_VIDEO_SYNC,
|
SGI_VIDEO_SYNC,
|
||||||
|
|
||||||
|
/* WGL extensions */
|
||||||
|
WGL_ARB_PBUFFER,
|
||||||
|
|
||||||
OPENGL_SUPPORTED_EXT_END
|
OPENGL_SUPPORTED_EXT_END
|
||||||
} GL_SupportedExt;
|
} GL_SupportedExt;
|
||||||
|
|
||||||
@ -2129,16 +2099,6 @@ typedef enum _GL_SupportedExt {
|
|||||||
USE_GL_FUNC(PGLFNVERTEXATTRIB4USVPROC, glVertexAttrib4usv); \
|
USE_GL_FUNC(PGLFNVERTEXATTRIB4USVPROC, glVertexAttrib4usv); \
|
||||||
USE_GL_FUNC(PGLFNVERTEXATTRIBPOINTERPROC, glVertexAttribPointer); \
|
USE_GL_FUNC(PGLFNVERTEXATTRIBPOINTERPROC, glVertexAttribPointer); \
|
||||||
|
|
||||||
#define GLX_EXT_FUNCS_GEN \
|
|
||||||
/** GLX_VERSION_1_3 **/ \
|
|
||||||
USE_GL_FUNC(PGLXFNGLXCREATEPBUFFERPROC, glXCreatePbuffer); \
|
|
||||||
USE_GL_FUNC(PGLXFNGLXDESTROYPBUFFERPROC, glXDestroyPbuffer); \
|
|
||||||
USE_GL_FUNC(PGLXFNGLXCREATEPIXMAPPROC, glXCreatePixmap); \
|
|
||||||
USE_GL_FUNC(PGLXFNGLXDESTROYPIXMAPPROC, glXDestroyPixmap); \
|
|
||||||
USE_GL_FUNC(PGLXFNGLXCREATENEWCONTEXTPROC, glXCreateNewContext); \
|
|
||||||
USE_GL_FUNC(PGLXFNGLXMAKECONTEXTCURRENTPROC, glXMakeContextCurrent); \
|
|
||||||
USE_GL_FUNC(PGLXFNGLXCHOOSEFBCONFIGPROC, glXChooseFBConfig); \
|
|
||||||
|
|
||||||
#undef APIENTRY
|
#undef APIENTRY
|
||||||
#undef CALLBACK
|
#undef CALLBACK
|
||||||
#undef WINAPI
|
#undef WINAPI
|
||||||
@ -2148,6 +2108,108 @@ typedef enum _GL_SupportedExt {
|
|||||||
#define WINAPI __stdcall
|
#define WINAPI __stdcall
|
||||||
#define APIENTRY WINAPI
|
#define APIENTRY WINAPI
|
||||||
|
|
||||||
|
/****************************************************
|
||||||
|
* OpenGL WGL defines and functions pointer
|
||||||
|
****************************************************/
|
||||||
|
|
||||||
|
/* WGL_ARB_extensions_string */
|
||||||
|
typedef const char * (WINAPI * WINED3D_PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
|
||||||
|
/* WGL_ARB_pixel_format */
|
||||||
|
#ifndef WGL_ARB_pixel_format
|
||||||
|
#define WGL_ARB_pixel_format 1
|
||||||
|
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
|
||||||
|
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
|
||||||
|
#define WGL_DRAW_TO_BITMAP_ARB 0x2002
|
||||||
|
#define WGL_ACCELERATION_ARB 0x2003
|
||||||
|
#define WGL_NEED_PALETTE_ARB 0x2004
|
||||||
|
#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
|
||||||
|
#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
|
||||||
|
#define WGL_SWAP_METHOD_ARB 0x2007
|
||||||
|
#define WGL_NUMBER_OVERLAYS_ARB 0x2008
|
||||||
|
#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
|
||||||
|
#define WGL_TRANSPARENT_ARB 0x200A
|
||||||
|
#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
|
||||||
|
#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
|
||||||
|
#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
|
||||||
|
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
|
||||||
|
#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
|
||||||
|
#define WGL_SHARE_DEPTH_ARB 0x200C
|
||||||
|
#define WGL_SHARE_STENCIL_ARB 0x200D
|
||||||
|
#define WGL_SHARE_ACCUM_ARB 0x200E
|
||||||
|
#define WGL_SUPPORT_GDI_ARB 0x200F
|
||||||
|
#define WGL_SUPPORT_OPENGL_ARB 0x2010
|
||||||
|
#define WGL_DOUBLE_BUFFER_ARB 0x2011
|
||||||
|
#define WGL_STEREO_ARB 0x2012
|
||||||
|
#define WGL_PIXEL_TYPE_ARB 0x2013
|
||||||
|
#define WGL_COLOR_BITS_ARB 0x2014
|
||||||
|
#define WGL_RED_BITS_ARB 0x2015
|
||||||
|
#define WGL_RED_SHIFT_ARB 0x2016
|
||||||
|
#define WGL_GREEN_BITS_ARB 0x2017
|
||||||
|
#define WGL_GREEN_SHIFT_ARB 0x2018
|
||||||
|
#define WGL_BLUE_BITS_ARB 0x2019
|
||||||
|
#define WGL_BLUE_SHIFT_ARB 0x201A
|
||||||
|
#define WGL_ALPHA_BITS_ARB 0x201B
|
||||||
|
#define WGL_ALPHA_SHIFT_ARB 0x201C
|
||||||
|
#define WGL_ACCUM_BITS_ARB 0x201D
|
||||||
|
#define WGL_ACCUM_RED_BITS_ARB 0x201E
|
||||||
|
#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
|
||||||
|
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
|
||||||
|
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
|
||||||
|
#define WGL_DEPTH_BITS_ARB 0x2022
|
||||||
|
#define WGL_STENCIL_BITS_ARB 0x2023
|
||||||
|
#define WGL_AUX_BUFFERS_ARB 0x2024
|
||||||
|
#define WGL_NO_ACCELERATION_ARB 0x2025
|
||||||
|
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
|
||||||
|
#define WGL_FULL_ACCELERATION_ARB 0x2027
|
||||||
|
#define WGL_SWAP_EXCHANGE_ARB 0x2028
|
||||||
|
#define WGL_SWAP_COPY_ARB 0x2029
|
||||||
|
#define WGL_SWAP_UNDEFINED_ARB 0x202A
|
||||||
|
#define WGL_TYPE_RGBA_ARB 0x202B
|
||||||
|
#define WGL_TYPE_COLORINDEX_ARB 0x202C
|
||||||
|
#endif
|
||||||
|
typedef BOOL (WINAPI * WINED3D_PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
|
||||||
|
typedef BOOL (WINAPI * WINED3D_PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
|
||||||
|
typedef BOOL (WINAPI * WINED3D_PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
|
||||||
|
/* WGL_ARB_make_current_read */
|
||||||
|
typedef BOOL (WINAPI * WINED3D_PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||||
|
typedef HDC (WINAPI * WINED3D_PFNWGLGETCURRENTREADDCARBPROC) (void);
|
||||||
|
/* WGL_ARB_pbuffer */
|
||||||
|
#ifndef WGL_ARB_pbuffer
|
||||||
|
#define WGL_ARB_pbuffer 1
|
||||||
|
#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
|
||||||
|
#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
|
||||||
|
#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
|
||||||
|
#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
|
||||||
|
#define WGL_PBUFFER_LARGEST_ARB 0x2033
|
||||||
|
#define WGL_PBUFFER_WIDTH_ARB 0x2034
|
||||||
|
#define WGL_PBUFFER_HEIGHT_ARB 0x2035
|
||||||
|
#define WGL_PBUFFER_LOST_ARB 0x2036
|
||||||
|
#endif
|
||||||
|
DECLARE_HANDLE(HPBUFFERARB);
|
||||||
|
typedef HPBUFFERARB (WINAPI * WINED3D_PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
|
||||||
|
typedef HDC (WINAPI * WINED3D_PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
|
||||||
|
typedef int (WINAPI * WINED3D_PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
|
||||||
|
typedef BOOL (WINAPI * WINED3D_PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
|
||||||
|
typedef BOOL (WINAPI * WINED3D_PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
|
||||||
|
#ifndef WGL_ARB_pixel_format_float
|
||||||
|
#define WGL_ARB_pixel_format_float 1
|
||||||
|
#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define WGL_EXT_FUNCS_GEN \
|
||||||
|
USE_GL_FUNC(WINED3D_PFNWGLGETEXTENSIONSSTRINGARBPROC, wglGetExtensionsStringARB); \
|
||||||
|
USE_GL_FUNC(WINED3D_PFNWGLGETPIXELFORMATATTRIBIVARBPROC, wglGetPixelFormatAttribivARB); \
|
||||||
|
USE_GL_FUNC(WINED3D_PFNWGLGETPIXELFORMATATTRIBFVARBPROC, wglGetPixelFormatAttribfvARB); \
|
||||||
|
USE_GL_FUNC(WINED3D_PFNWGLCHOOSEPIXELFORMATARBPROC, wglChoosePixelFormatARB); \
|
||||||
|
USE_GL_FUNC(WINED3D_PFNWGLMAKECONTEXTCURRENTARBPROC, wglMakeContextCurrentARB); \
|
||||||
|
USE_GL_FUNC(WINED3D_PFNWGLGETCURRENTREADDCARBPROC, wglGetCurrentReadDCARB); \
|
||||||
|
USE_GL_FUNC(WINED3D_PFNWGLCREATEPBUFFERARBPROC, wglCreatePbufferARB); \
|
||||||
|
USE_GL_FUNC(WINED3D_PFNWGLGETPBUFFERDCARBPROC, wglGetPbufferDCARB); \
|
||||||
|
USE_GL_FUNC(WINED3D_PFNWGLRELEASEPBUFFERDCARBPROC, wglReleasePbufferDCARB); \
|
||||||
|
USE_GL_FUNC(WINED3D_PFNWGLDESTROYPBUFFERARBPROC, wglDestroyPbufferARB); \
|
||||||
|
USE_GL_FUNC(WINED3D_PFNWGLQUERYPBUFFERARBPROC, wglQueryPbufferARB);
|
||||||
|
|
||||||
|
|
||||||
/****************************************************
|
/****************************************************
|
||||||
* Structures
|
* Structures
|
||||||
****************************************************/
|
****************************************************/
|
||||||
@ -2208,8 +2270,8 @@ typedef struct _WineD3D_GL_Info {
|
|||||||
|
|
||||||
/** OpenGL EXT and ARB functions ptr */
|
/** OpenGL EXT and ARB functions ptr */
|
||||||
GL_EXT_FUNCS_GEN;
|
GL_EXT_FUNCS_GEN;
|
||||||
/** OpenGL GLX functions ptr */
|
/** OpenGL WGL functions ptr */
|
||||||
GLX_EXT_FUNCS_GEN;
|
WGL_EXT_FUNCS_GEN;
|
||||||
/** OpenGL 2.0 functions ptr */
|
/** OpenGL 2.0 functions ptr */
|
||||||
/* GL2_FUNCS_GEN; */
|
/* GL2_FUNCS_GEN; */
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user