Commit 24be3065 authored by Raphael Junqueira's avatar Raphael Junqueira Committed by Alexandre Julliard

- some cleanup and warning fixes

- split of CreateDevice gl/gxl detection code into FillGLCaps - implementation of resolution change (using ChangeDisplaySettings) but desactived as ChangeDisplaySettings don't seem to work well - begin of swap chain support (now need to split/clean gxlpbuffer/glxpixmap code for swap chain use)
parent bca452ee
......@@ -394,18 +394,12 @@ struct IDirect3DDevice8Impl
GLXContext glCtx;
XVisualInfo *visInfo;
Display *display;
HWND win_handle;
Window win;
GLXContext render_ctx;
Drawable drawable;
/* OpenGL Extension related */
#if 0
BOOL isMultiTexture;
BOOL isDot3;
UINT TextureUnits;
UINT clipPlanes;
UINT maxLights;
#endif
/* Cursor management */
BOOL bCursorVisible;
......@@ -590,7 +584,13 @@ struct IDirect3DSwapChain8Impl
/* IDirect3DSwapChain8 fields */
IDirect3DSurface8Impl *frontBuffer;
IDirect3DSurface8Impl *backBuffer;
IDirect3DSurface8Impl *depthStencilBuffer;
D3DPRESENT_PARAMETERS PresentParms;
/* OpenGL/GLX related */
GLXContext swap_ctx;
Drawable swap_drawable;
};
/* IUnknown: */
......
......@@ -1153,9 +1153,68 @@ BOOL WINAPI IDirect3DDevice8Impl_ShowCursor(LPDIRECT3DDEVICE8 iface, BOOL b
return D3D_OK;
}
HRESULT WINAPI IDirect3DDevice8Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE8 iface, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain8** pSwapChain) {
IDirect3DSwapChain8Impl* object;
ICOM_THIS(IDirect3DDevice8Impl,iface);
FIXME("(%p) : stub\n", This);
*pSwapChain = NULL;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DDevice8Impl));
if (NULL == object) {
return D3DERR_OUTOFVIDEOMEMORY;
}
object->lpVtbl = &Direct3DSwapChain8_Vtbl;
object->ref = 1;
TRACE("(%p)->(DepthStencil:(%u,%s), BackBufferFormat:(%u,%s))\n", This,
pPresentationParameters->AutoDepthStencilFormat, debug_d3dformat(pPresentationParameters->AutoDepthStencilFormat),
pPresentationParameters->BackBufferFormat, debug_d3dformat(pPresentationParameters->BackBufferFormat));
if (pPresentationParameters->Windowed && ((pPresentationParameters->BackBufferWidth == 0) ||
(pPresentationParameters->BackBufferHeight == 0))) {
RECT Rect;
GetClientRect(This->win_handle, &Rect);
if (pPresentationParameters->BackBufferWidth == 0) {
pPresentationParameters->BackBufferWidth = Rect.right;
TRACE("Updating width to %d\n", pPresentationParameters->BackBufferWidth);
}
if (pPresentationParameters->BackBufferHeight == 0) {
pPresentationParameters->BackBufferHeight = Rect.bottom;
TRACE("Updating height to %d\n", pPresentationParameters->BackBufferHeight);
}
}
/* Save the presentation parms now filled in correctly */
memcpy(&object->PresentParms, pPresentationParameters, sizeof(D3DPRESENT_PARAMETERS));
IDirect3DDevice8Impl_CreateRenderTarget((LPDIRECT3DDEVICE8) object,
pPresentationParameters->BackBufferWidth,
pPresentationParameters->BackBufferHeight,
pPresentationParameters->BackBufferFormat,
pPresentationParameters->MultiSampleType,
TRUE,
(LPDIRECT3DSURFACE8*) &object->frontBuffer);
IDirect3DDevice8Impl_CreateRenderTarget((LPDIRECT3DDEVICE8) object,
pPresentationParameters->BackBufferWidth,
pPresentationParameters->BackBufferHeight,
pPresentationParameters->BackBufferFormat,
pPresentationParameters->MultiSampleType,
TRUE,
(LPDIRECT3DSURFACE8*) &object->backBuffer);
if (pPresentationParameters->EnableAutoDepthStencil) {
IDirect3DDevice8Impl_CreateDepthStencilSurface((LPDIRECT3DDEVICE8) object,
pPresentationParameters->BackBufferWidth,
pPresentationParameters->BackBufferHeight,
pPresentationParameters->AutoDepthStencilFormat,
D3DMULTISAMPLE_NONE,
(LPDIRECT3DSURFACE8*) &object->depthStencilBuffer);
} else {
object->depthStencilBuffer = NULL;
}
*pSwapChain = (IDirect3DSwapChain8*) object;
return D3D_OK;
}
HRESULT WINAPI IDirect3DDevice8Impl_Reset(LPDIRECT3DDEVICE8 iface, D3DPRESENT_PARAMETERS* pPresentationParameters) {
......
......@@ -243,19 +243,6 @@ HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D3DLOCKE
if (SUCCEEDED(hr) && NULL != cont) {
IDirect3DBaseTexture8Impl_SetDirty(cont, TRUE);
#if 0
/* Now setup the texture appropraitly */
D3DRESOURCETYPE containerType = IDirect3DBaseTexture8Impl_GetType(cont);
if (containerType == D3DRTYPE_TEXTURE) {
IDirect3DTexture8Impl* pTexture = (IDirect3DTexture8Impl*) cont;
pTexture->Dirty = TRUE;
} else if (containerType == D3DRTYPE_CUBETEXTURE) {
IDirect3DCubeTexture8Impl* pTexture = (IDirect3DCubeTexture8Impl*) cont;
pTexture->Dirty = TRUE;
} else {
FIXME("Set dirty on container type %d\n", containerType);
}
#endif
IDirect3DBaseTexture8_Release(cont);
cont = NULL;
}
......
......@@ -56,8 +56,9 @@ ULONG WINAPI IDirect3DSwapChain8Impl_Release(LPDIRECT3DSWAPCHAIN8 iface) {
ICOM_THIS(IDirect3DSwapChain8Impl,iface);
ULONG ref = --This->ref;
TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
if (ref == 0)
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
......@@ -67,10 +68,19 @@ HRESULT WINAPI IDirect3DSwapChain8Impl_Present(LPDIRECT3DSWAPCHAIN8 iface, CONST
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IDirect3DSwapChain8Impl_GetBackBuffer(LPDIRECT3DSWAPCHAIN8 iface, UINT BackBuffer, D3DBACKBUFFER_TYPE Type,IDirect3DSurface8** ppBackBuffer) {
HRESULT WINAPI IDirect3DSwapChain8Impl_GetBackBuffer(LPDIRECT3DSWAPCHAIN8 iface, UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8** ppBackBuffer) {
ICOM_THIS(IDirect3DSwapChain8Impl,iface);
FIXME("(%p) : stub\n", This);
*ppBackBuffer = NULL;
*ppBackBuffer = (LPDIRECT3DSURFACE8) This->backBuffer;
TRACE("(%p) : BackBuf %d Type %d returning %p\n", This, BackBuffer, Type, *ppBackBuffer);
if (BackBuffer > This->PresentParms.BackBufferCount - 1) {
FIXME("Only one backBuffer currently supported\n");
return D3DERR_INVALIDCALL;
}
/* Note inc ref on returned surface */
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) *ppBackBuffer);
return D3D_OK;
}
......
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