wined3d: Implement Init3D and Uninit3D.
This commit is contained in:
parent
b9fc3f8eb1
commit
d04f0507cf
|
@ -69,9 +69,7 @@ ULONG WINAPI IDirect3DDevice8Impl_Release(LPDIRECT3DDEVICE8 iface) {
|
||||||
|
|
||||||
if (ref == 0) {
|
if (ref == 0) {
|
||||||
TRACE("Releasing wined3d device %p\n", This->WineD3DDevice);
|
TRACE("Releasing wined3d device %p\n", This->WineD3DDevice);
|
||||||
/* Activate this when it's implemented in wined3d(d3d7 merge)
|
|
||||||
IWineD3DDevice_Uninit3D(This->WineD3DDevice);
|
IWineD3DDevice_Uninit3D(This->WineD3DDevice);
|
||||||
*/
|
|
||||||
IWineD3DDevice_Release(This->WineD3DDevice);
|
IWineD3DDevice_Release(This->WineD3DDevice);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
}
|
}
|
||||||
|
|
|
@ -323,7 +323,7 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice(LPDIRECT3D8 iface, UINT Adapter, D3
|
||||||
localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz;
|
localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz;
|
||||||
localParameters.PresentationInterval = &pPresentationParameters->FullScreen_PresentationInterval;/* Renamed in dx9 */
|
localParameters.PresentationInterval = &pPresentationParameters->FullScreen_PresentationInterval;/* Renamed in dx9 */
|
||||||
|
|
||||||
hr =IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &localParameters, &object->WineD3DDevice, (IUnknown *)object, D3D8CB_CreateAdditionalSwapChain);
|
hr =IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &object->WineD3DDevice, (IUnknown *)object);
|
||||||
|
|
||||||
if (hr != D3D_OK) {
|
if (hr != D3D_OK) {
|
||||||
HeapFree(GetProcessHeap(), 0, object);
|
HeapFree(GetProcessHeap(), 0, object);
|
||||||
|
@ -333,14 +333,12 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice(LPDIRECT3D8 iface, UINT Adapter, D3
|
||||||
|
|
||||||
TRACE("(%p) : Created Device %p\n", This, object);
|
TRACE("(%p) : Created Device %p\n", This, object);
|
||||||
|
|
||||||
/* Activate this when it's implemented in wined3d(d3d7 merge)
|
|
||||||
hr = IWineD3DDevice_Init3D(object->WineD3DDevice, &localParameters, D3D8CB_CreateAdditionalSwapChain);
|
hr = IWineD3DDevice_Init3D(object->WineD3DDevice, &localParameters, D3D8CB_CreateAdditionalSwapChain);
|
||||||
if (hr != D3D_OK) {
|
if (hr != D3D_OK) {
|
||||||
FIXME("(%p) D3D Initialization failed for WineD3DDevice %p\n", This, object->WineD3DDevice);
|
FIXME("(%p) D3D Initialization failed for WineD3DDevice %p\n", This, object->WineD3DDevice);
|
||||||
HeapFree(GetProcessHeap(), 0, object);
|
HeapFree(GetProcessHeap(), 0, object);
|
||||||
*ppReturnedDeviceInterface = NULL;
|
*ppReturnedDeviceInterface = NULL;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,9 +57,7 @@ ULONG WINAPI IDirect3DDevice9Impl_Release(LPDIRECT3DDEVICE9 iface) {
|
||||||
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
|
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
|
||||||
|
|
||||||
if (ref == 0) {
|
if (ref == 0) {
|
||||||
/* Activate this when it's implemented in WineD3D(d3d7 merge)
|
|
||||||
IWineD3DDevice_Uninit3D(This->WineD3DDevice);
|
IWineD3DDevice_Uninit3D(This->WineD3DDevice);
|
||||||
*/
|
|
||||||
IWineD3DDevice_Release(This->WineD3DDevice);
|
IWineD3DDevice_Release(This->WineD3DDevice);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
}
|
}
|
||||||
|
|
|
@ -307,7 +307,7 @@ HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3
|
||||||
localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz;
|
localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz;
|
||||||
localParameters.PresentationInterval = &pPresentationParameters->PresentationInterval;
|
localParameters.PresentationInterval = &pPresentationParameters->PresentationInterval;
|
||||||
|
|
||||||
hr =IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &localParameters, &object->WineD3DDevice, (IUnknown *)object, D3D9CB_CreateAdditionalSwapChain);
|
hr =IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &object->WineD3DDevice, (IUnknown *)object);
|
||||||
|
|
||||||
if (hr != D3D_OK) {
|
if (hr != D3D_OK) {
|
||||||
HeapFree(GetProcessHeap(), 0, object);
|
HeapFree(GetProcessHeap(), 0, object);
|
||||||
|
@ -317,14 +317,12 @@ HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3
|
||||||
|
|
||||||
TRACE("(%p) : Created Device %p\n", This, object);
|
TRACE("(%p) : Created Device %p\n", This, object);
|
||||||
|
|
||||||
/* Activate this when it's implemented in wined3d(d3d7 merge)
|
hr = IWineD3DDevice_Init3D(object->WineD3DDevice, &localParameters, D3D9CB_CreateAdditionalSwapChain);
|
||||||
hr = IWineD3DDevice_Init3D(object->WineD3DDevice, &localParameters, D3D8CB_CreateAdditionalSwapChain);
|
|
||||||
if (hr != D3D_OK) {
|
if (hr != D3D_OK) {
|
||||||
FIXME("(%p) D3D Initialization failed for WineD3DDevice %p\n", This, object->WineD3DDevice);
|
FIXME("(%p) D3D Initialization failed for WineD3DDevice %p\n", This, object->WineD3DDevice);
|
||||||
HeapFree(GetProcessHeap(), 0, object);
|
HeapFree(GetProcessHeap(), 0, object);
|
||||||
*ppReturnedDeviceInterface = NULL;
|
*ppReturnedDeviceInterface = NULL;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -361,49 +361,8 @@ ULONG WINAPI IWineD3DDeviceImpl_Release(IWineD3DDevice *iface) {
|
||||||
|
|
||||||
if (!refCount) {
|
if (!refCount) {
|
||||||
/* TODO: Clean up all the surfaces and textures! */
|
/* TODO: Clean up all the surfaces and textures! */
|
||||||
/* FIXME: Create targets and state blocks in d3d8 */
|
|
||||||
if (((IWineD3DImpl *)This->wineD3D)->dxVersion >= 8) { /*We don't create state blocks for d3d7 yet*/
|
|
||||||
/* NOTE: You must release the parent if the object was created via a callback
|
/* NOTE: You must release the parent if the object was created via a callback
|
||||||
** ***************************/
|
** ***************************/
|
||||||
/* TODO: this is exactly the same as required by _Reset.., so at some point we need to move the code so that is can be called by reset add release... */
|
|
||||||
/* Release all of the swapchains, except the implicit swapchain */
|
|
||||||
IUnknown* stencilBufferParent;
|
|
||||||
IUnknown* swapChainParent;
|
|
||||||
|
|
||||||
/* NOTE: Don't release swapchain 0 here, it's 'special' */
|
|
||||||
SwapChainList *nextSwapchain = This->swapchains;
|
|
||||||
if (nextSwapchain != NULL) {
|
|
||||||
nextSwapchain = nextSwapchain->next;
|
|
||||||
} else {
|
|
||||||
WARN("Expected to find the implicit swapchain\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* release all the other swapchains */
|
|
||||||
while (nextSwapchain != NULL) {
|
|
||||||
SwapChainList *prevSwapchain = nextSwapchain;
|
|
||||||
nextSwapchain = nextSwapchain->next;
|
|
||||||
IWineD3DSwapChain_Release(prevSwapchain->swapchain);
|
|
||||||
/* NOTE: no need to free the list element, it will be done by the release callback
|
|
||||||
HeapFree(GetProcessHeap(), 0, prevSwapchain); */
|
|
||||||
}
|
|
||||||
/* Release the buffers (with sanity checks)*/
|
|
||||||
if(This->stencilBufferTarget != NULL && (IWineD3DSurface_Release(This->stencilBufferTarget) >0)){
|
|
||||||
if(This->depthStencilBuffer != This->stencilBufferTarget)
|
|
||||||
FIXME("(%p) Something's still holding the depthStencilBuffer\n",This);
|
|
||||||
}
|
|
||||||
This->stencilBufferTarget = NULL;
|
|
||||||
|
|
||||||
if(IWineD3DSurface_Release(This->renderTarget) >0){
|
|
||||||
/* This check is a bit silly, itshould be in swapchain_release FIXME("(%p) Something's still holding the renderTarget\n",This); */
|
|
||||||
}
|
|
||||||
This->renderTarget = NULL;
|
|
||||||
|
|
||||||
IWineD3DSurface_GetParent(This->depthStencilBuffer, &stencilBufferParent);
|
|
||||||
IUnknown_Release(stencilBufferParent); /* once for the get parent */
|
|
||||||
if(IUnknown_Release(stencilBufferParent) >0){ /* the second time for when it was created */
|
|
||||||
FIXME("(%p) Something's still holding the depthStencilBuffer\n",This);
|
|
||||||
}
|
|
||||||
This->depthStencilBuffer = NULL;
|
|
||||||
|
|
||||||
/* Release the update stateblock */
|
/* Release the update stateblock */
|
||||||
if(IWineD3DStateBlock_Release((IWineD3DStateBlock *)This->updateStateBlock) > 0){
|
if(IWineD3DStateBlock_Release((IWineD3DStateBlock *)This->updateStateBlock) > 0){
|
||||||
|
@ -423,21 +382,12 @@ ULONG WINAPI IWineD3DDeviceImpl_Release(IWineD3DDevice *iface) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (This->swapchains != NULL) {
|
|
||||||
/* Swapchain 0 is special because it's created in startup with a hanging parent, so we have to release its parent now */
|
|
||||||
IWineD3DSwapChain_GetParent(This->swapchains->swapchain, &swapChainParent);
|
|
||||||
IUnknown_Release(swapChainParent); /* once for the get parent */
|
|
||||||
if (IUnknown_Release(swapChainParent) > 0) { /* the second time for when it was created */
|
|
||||||
FIXME("(%p) Something's still holding the implicit swapchain\n", This);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (This->resources != NULL ) {
|
if (This->resources != NULL ) {
|
||||||
FIXME("(%p) Device released with resources still bound, acceptable but unexpected\n", This);
|
FIXME("(%p) Device released with resources still bound, acceptable but unexpected\n", This);
|
||||||
dumpResources(This->resources);
|
dumpResources(This->resources);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
IWineD3D_Release(This->wineD3D);
|
IWineD3D_Release(This->wineD3D);
|
||||||
This->wineD3D = NULL;
|
This->wineD3D = NULL;
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
|
@ -1689,13 +1639,150 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreatePalette(IWineD3DDevice *iface, DWORD Fla
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, WINED3DPRESENT_PARAMETERS* pPresentationParameters, D3DCB_CREATEADDITIONALSWAPCHAIN D3DCB_CreateAdditionalSwapChain) {
|
HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, WINED3DPRESENT_PARAMETERS* pPresentationParameters, D3DCB_CREATEADDITIONALSWAPCHAIN D3DCB_CreateAdditionalSwapChain) {
|
||||||
FIXME("This call is a d3d7 merge stub. It will be implemented later\n");
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
|
||||||
|
IWineD3DSwapChainImpl *swapchain;
|
||||||
|
|
||||||
|
TRACE("(%p)->(%p,%p)\n", This, pPresentationParameters, D3DCB_CreateAdditionalSwapChain);
|
||||||
|
if(This->d3d_initialized) return WINED3DERR_INVALIDCALL;
|
||||||
|
|
||||||
|
/* TODO: Test if OpenGL is compiled in and loaded */
|
||||||
|
|
||||||
|
/* Setup the implicit swapchain */
|
||||||
|
TRACE("Creating implicit swapchain\n");
|
||||||
|
if (D3D_OK != D3DCB_CreateAdditionalSwapChain((IUnknown *) This->parent, pPresentationParameters, (IWineD3DSwapChain **)&swapchain) || swapchain == NULL) {
|
||||||
|
WARN("Failed to create implicit swapchain\n");
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(swapchain->backBuffer) {
|
||||||
|
TRACE("Setting rendertarget to %p\n", swapchain->backBuffer);
|
||||||
|
This->renderTarget = swapchain->backBuffer;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TRACE("Setting rendertarget to %p\n", swapchain->frontBuffer);
|
||||||
|
This->renderTarget = swapchain->frontBuffer;
|
||||||
|
}
|
||||||
|
IWineD3DSurface_AddRef(This->renderTarget);
|
||||||
|
/* Depth Stencil support */
|
||||||
|
This->stencilBufferTarget = This->depthStencilBuffer;
|
||||||
|
if (NULL != This->stencilBufferTarget) {
|
||||||
|
IWineD3DSurface_AddRef(This->stencilBufferTarget);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set up some starting GL setup */
|
||||||
|
ENTER_GL();
|
||||||
|
/*
|
||||||
|
* Initialize openGL extension related variables
|
||||||
|
* with Default values
|
||||||
|
*/
|
||||||
|
|
||||||
|
((IWineD3DImpl *) This->wineD3D)->isGLInfoValid = IWineD3DImpl_FillGLCaps( &((IWineD3DImpl *) This->wineD3D)->gl_info, swapchain->display);
|
||||||
|
/* Setup all the devices defaults */
|
||||||
|
IWineD3DStateBlock_InitStartupStateBlock((IWineD3DStateBlock *)This->stateBlock);
|
||||||
|
#if 0
|
||||||
|
IWineD3DImpl_CheckGraphicsMemory();
|
||||||
|
#endif
|
||||||
|
LEAVE_GL();
|
||||||
|
|
||||||
|
{ /* Set a default viewport */
|
||||||
|
D3DVIEWPORT9 vp;
|
||||||
|
vp.X = 0;
|
||||||
|
vp.Y = 0;
|
||||||
|
vp.Width = *(pPresentationParameters->BackBufferWidth);
|
||||||
|
vp.Height = *(pPresentationParameters->BackBufferHeight);
|
||||||
|
vp.MinZ = 0.0f;
|
||||||
|
vp.MaxZ = 1.0f;
|
||||||
|
IWineD3DDevice_SetViewport((IWineD3DDevice *)This, &vp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Initialize the current view state */
|
||||||
|
This->modelview_valid = 1;
|
||||||
|
This->proj_valid = 0;
|
||||||
|
This->view_ident = 1;
|
||||||
|
This->last_was_rhw = 0;
|
||||||
|
glGetIntegerv(GL_MAX_LIGHTS, &This->maxConcurrentLights);
|
||||||
|
TRACE("(%p) All defaults now set up, leaving Init3D with %p\n", This, This);
|
||||||
|
|
||||||
|
/* Clear the screen */
|
||||||
|
IWineD3DDevice_Clear((IWineD3DDevice *) This, 0, NULL, D3DCLEAR_STENCIL|D3DCLEAR_ZBUFFER|D3DCLEAR_TARGET, 0x00, 1.0, 0);
|
||||||
|
|
||||||
|
This->d3d_initialized = TRUE;
|
||||||
|
return WINED3D_OK;
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface) {
|
HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface) {
|
||||||
FIXME("This call is a d3d7 merge stub. It will be implemented later\n");
|
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
|
||||||
return WINED3DERR_INVALIDCALL;
|
int texstage;
|
||||||
|
IUnknown* stencilBufferParent;
|
||||||
|
IUnknown* swapChainParent;
|
||||||
|
SwapChainList *nextSwapchain;
|
||||||
|
TRACE("(%p)\n", This);
|
||||||
|
|
||||||
|
if(!This->d3d_initialized) return WINED3DERR_INVALIDCALL;
|
||||||
|
|
||||||
|
for(texstage = 0; texstage < GL_LIMITS(textures); texstage++) {
|
||||||
|
IWineD3DDevice_SetTexture(iface, texstage, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* NOTE: You must release the parent if the object was created via a callback
|
||||||
|
** ***************************/
|
||||||
|
/* Release all of the swapchains, except the implicit swapchain */
|
||||||
|
|
||||||
|
/* NOTE: Don't release swapchain 0 here, it's 'special' */
|
||||||
|
TRACE("Finding implicit swapchain\n");
|
||||||
|
nextSwapchain = This->swapchains;
|
||||||
|
if (nextSwapchain != NULL) {
|
||||||
|
nextSwapchain = nextSwapchain->next;
|
||||||
|
} else {
|
||||||
|
WARN("Expected to find the implicit swapchain\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
TRACE("Releasing swapchains. nextSwapchain = %p\n", nextSwapchain);
|
||||||
|
/* release all the other swapchains */
|
||||||
|
while (nextSwapchain != NULL) {
|
||||||
|
SwapChainList *prevSwapchain = nextSwapchain;
|
||||||
|
nextSwapchain = nextSwapchain->next;
|
||||||
|
TRACE("Releasing swapchain %p\n", prevSwapchain->swapchain);
|
||||||
|
IWineD3DSwapChain_Release(prevSwapchain->swapchain);
|
||||||
|
/* NOTE: no need to free the list element, it will be done by the release callback
|
||||||
|
HeapFree(GetProcessHeap(), 0, prevSwapchain); */
|
||||||
|
}
|
||||||
|
/* Release the buffers (with sanity checks)*/
|
||||||
|
TRACE("Releasing the depth stencil buffer at %p\n", This->stencilBufferTarget);
|
||||||
|
if(This->stencilBufferTarget != NULL && (IWineD3DSurface_Release(This->stencilBufferTarget) >0)){
|
||||||
|
if(This->depthStencilBuffer != This->stencilBufferTarget)
|
||||||
|
FIXME("(%p) Something's still holding the depthStencilBuffer\n",This);
|
||||||
|
}
|
||||||
|
This->stencilBufferTarget = NULL;
|
||||||
|
|
||||||
|
TRACE("Releasing the render target at %p\n", This->renderTarget);
|
||||||
|
if(IWineD3DSurface_Release(This->renderTarget) >0){
|
||||||
|
/* This check is a bit silly, itshould be in swapchain_release FIXME("(%p) Something's still holding the renderTarget\n",This); */
|
||||||
|
}
|
||||||
|
TRACE("Setting rendertarget to NULL\n");
|
||||||
|
This->renderTarget = NULL;
|
||||||
|
|
||||||
|
IWineD3DSurface_GetParent(This->depthStencilBuffer, &stencilBufferParent);
|
||||||
|
IUnknown_Release(stencilBufferParent); /* once for the get parent */
|
||||||
|
if(IUnknown_Release(stencilBufferParent) >0){ /* the second time for when it was created */
|
||||||
|
FIXME("(%p) Something's still holding the depthStencilBuffer\n",This);
|
||||||
|
}
|
||||||
|
This->depthStencilBuffer = NULL;
|
||||||
|
|
||||||
|
TRACE("Releasing the implicit swapchain\n");
|
||||||
|
if (This->swapchains != NULL) {
|
||||||
|
/* Swapchain 0 is special because it's created in startup with a hanging parent, so we have to release its parent now */
|
||||||
|
IWineD3DSwapChain_GetParent(This->swapchains->swapchain, &swapChainParent);
|
||||||
|
IUnknown_Release(swapChainParent); /* once for the get parent */
|
||||||
|
if (IUnknown_Release(swapChainParent) > 0) { /* the second time for when it was created */
|
||||||
|
FIXME("(%p) Something's still holding the implicit swapchain\n", This);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
This->swapchains = NULL;
|
||||||
|
|
||||||
|
This->d3d_initialized = FALSE;
|
||||||
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IWineD3DDeviceImpl_EnumDisplayModes(IWineD3DDevice *iface, DWORD Flags, UINT Width, UINT Height, WINED3DFORMAT pixelformat, LPVOID context, D3DCB_ENUMDISPLAYMODESCALLBACK callback) {
|
HRESULT WINAPI IWineD3DDeviceImpl_EnumDisplayModes(IWineD3DDevice *iface, DWORD Flags, UINT Width, UINT Height, WINED3DFORMAT pixelformat, LPVOID context, D3DCB_ENUMDISPLAYMODESCALLBACK callback) {
|
||||||
|
|
|
@ -203,7 +203,7 @@ ULONG WINAPI IWineD3DImpl_Release(IWineD3D *iface) {
|
||||||
* IWineD3D parts follows
|
* IWineD3D parts follows
|
||||||
**********************************************************/
|
**********************************************************/
|
||||||
|
|
||||||
static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display) {
|
BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display) {
|
||||||
const char *GL_Extensions = NULL;
|
const char *GL_Extensions = NULL;
|
||||||
const char *GLX_Extensions = NULL;
|
const char *GLX_Extensions = NULL;
|
||||||
const char *gl_string = NULL;
|
const char *gl_string = NULL;
|
||||||
|
@ -1744,13 +1744,11 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, WINED3D
|
||||||
/* Note due to structure differences between dx8 and dx9 D3DPRESENT_PARAMETERS,
|
/* Note due to structure differences between dx8 and dx9 D3DPRESENT_PARAMETERS,
|
||||||
and fields being inserted in the middle, a new structure is used in place */
|
and fields being inserted in the middle, a new structure is used in place */
|
||||||
HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, WINED3DDEVTYPE DeviceType, HWND hFocusWindow,
|
HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, WINED3DDEVTYPE DeviceType, HWND hFocusWindow,
|
||||||
DWORD BehaviourFlags, WINED3DPRESENT_PARAMETERS* pPresentationParameters,
|
DWORD BehaviourFlags, IWineD3DDevice** ppReturnedDeviceInterface,
|
||||||
IWineD3DDevice** ppReturnedDeviceInterface, IUnknown *parent,
|
IUnknown *parent) {
|
||||||
D3DCB_CREATEADDITIONALSWAPCHAIN D3DCB_CreateAdditionalSwapChain) {
|
|
||||||
|
|
||||||
IWineD3DDeviceImpl *object = NULL;
|
IWineD3DDeviceImpl *object = NULL;
|
||||||
IWineD3DImpl *This = (IWineD3DImpl *)iface;
|
IWineD3DImpl *This = (IWineD3DImpl *)iface;
|
||||||
IWineD3DSwapChainImpl *swapchain;
|
|
||||||
|
|
||||||
/* Validate the adapter number */
|
/* Validate the adapter number */
|
||||||
if (Adapter >= IWineD3D_GetAdapterCount(iface)) {
|
if (Adapter >= IWineD3D_GetAdapterCount(iface)) {
|
||||||
|
@ -1775,11 +1773,8 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, WINED3
|
||||||
/* Set the state up as invalid until the device is fully created */
|
/* Set the state up as invalid until the device is fully created */
|
||||||
object->state = WINED3DERR_DRIVERINTERNALERROR;
|
object->state = WINED3DERR_DRIVERINTERNALERROR;
|
||||||
|
|
||||||
TRACE("(%p)->(Adptr:%d, DevType: %x, FocusHwnd: %p, BehFlags: %lx, PresParms: %p, RetDevInt: %p)\n", This, Adapter, DeviceType,
|
TRACE("(%p)->(Adptr:%d, DevType: %x, FocusHwnd: %p, BehFlags: %lx, RetDevInt: %p)\n", This, Adapter, DeviceType,
|
||||||
hFocusWindow, BehaviourFlags, pPresentationParameters, ppReturnedDeviceInterface);
|
hFocusWindow, BehaviourFlags, ppReturnedDeviceInterface);
|
||||||
TRACE("(%p)->(DepthStencil:(%u,%s), BackBufferFormat:(%u,%s))\n", This,
|
|
||||||
*(pPresentationParameters->AutoDepthStencilFormat), debug_d3dformat(*(pPresentationParameters->AutoDepthStencilFormat)),
|
|
||||||
*(pPresentationParameters->BackBufferFormat), debug_d3dformat(*(pPresentationParameters->BackBufferFormat)));
|
|
||||||
|
|
||||||
/* Save the creation parameters */
|
/* Save the creation parameters */
|
||||||
object->createParms.AdapterOrdinal = Adapter;
|
object->createParms.AdapterOrdinal = Adapter;
|
||||||
|
@ -1791,9 +1786,6 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, WINED3
|
||||||
object->adapterNo = Adapter;
|
object->adapterNo = Adapter;
|
||||||
object->devType = DeviceType;
|
object->devType = DeviceType;
|
||||||
|
|
||||||
/* FIXME: Use for dx7 code eventually too! */
|
|
||||||
/* Deliberately no indentation here, as this if will be removed when dx8 support merged in */
|
|
||||||
if (This->dxVersion >= 8) {
|
|
||||||
TRACE("(%p) : Creating stateblock\n", This);
|
TRACE("(%p) : Creating stateblock\n", This);
|
||||||
/* Creating the startup stateBlock - Note Special Case: 0 => Don't fill in yet! */
|
/* Creating the startup stateBlock - Note Special Case: 0 => Don't fill in yet! */
|
||||||
if (WINED3D_OK != IWineD3DDevice_CreateStateBlock((IWineD3DDevice *)object,
|
if (WINED3D_OK != IWineD3DDevice_CreateStateBlock((IWineD3DDevice *)object,
|
||||||
|
@ -1813,65 +1805,6 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, WINED3
|
||||||
IWineD3DImpl_FillGLCaps(&This->gl_info, IWineD3DImpl_GetAdapterDisplay(iface, Adapter));
|
IWineD3DImpl_FillGLCaps(&This->gl_info, IWineD3DImpl_GetAdapterDisplay(iface, Adapter));
|
||||||
LEAVE_GL();
|
LEAVE_GL();
|
||||||
|
|
||||||
/* Setup the implicit swapchain */
|
|
||||||
TRACE("Creating implicit swapchain\n");
|
|
||||||
if (WINED3D_OK != D3DCB_CreateAdditionalSwapChain((IUnknown *) object->parent, pPresentationParameters, (IWineD3DSwapChain **)&swapchain) || swapchain == NULL) {
|
|
||||||
WARN("Failed to create implicit swapchain\n");
|
|
||||||
goto create_device_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
object->renderTarget = swapchain->backBuffer;
|
|
||||||
IWineD3DSurface_AddRef(object->renderTarget);
|
|
||||||
/* Depth Stencil support */
|
|
||||||
object->stencilBufferTarget = object->depthStencilBuffer;
|
|
||||||
if (NULL != object->stencilBufferTarget) {
|
|
||||||
IWineD3DSurface_AddRef(object->stencilBufferTarget);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set up some starting GL setup */
|
|
||||||
ENTER_GL();
|
|
||||||
/*
|
|
||||||
* Initialize openGL extension related variables
|
|
||||||
* with Default values
|
|
||||||
*/
|
|
||||||
|
|
||||||
This->isGLInfoValid = IWineD3DImpl_FillGLCaps(&This->gl_info, swapchain->display);
|
|
||||||
/* Setup all the devices defaults */
|
|
||||||
IWineD3DStateBlock_InitStartupStateBlock((IWineD3DStateBlock *)object->stateBlock);
|
|
||||||
#if 0
|
|
||||||
IWineD3DImpl_CheckGraphicsMemory();
|
|
||||||
#endif
|
|
||||||
LEAVE_GL();
|
|
||||||
|
|
||||||
{ /* Set a default viewport */
|
|
||||||
D3DVIEWPORT9 vp;
|
|
||||||
vp.X = 0;
|
|
||||||
vp.Y = 0;
|
|
||||||
vp.Width = *(pPresentationParameters->BackBufferWidth);
|
|
||||||
vp.Height = *(pPresentationParameters->BackBufferHeight);
|
|
||||||
vp.MinZ = 0.0f;
|
|
||||||
vp.MaxZ = 1.0f;
|
|
||||||
IWineD3DDevice_SetViewport((IWineD3DDevice *)object, &vp);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Initialize the current view state */
|
|
||||||
object->modelview_valid = 1;
|
|
||||||
object->proj_valid = 0;
|
|
||||||
object->view_ident = 1;
|
|
||||||
object->last_was_rhw = 0;
|
|
||||||
glGetIntegerv(GL_MAX_LIGHTS, &object->maxConcurrentLights);
|
|
||||||
TRACE("(%p,%d) All defaults now set up, leaving CreateDevice with %p\n", This, Adapter, object);
|
|
||||||
|
|
||||||
/* Clear the screen */
|
|
||||||
IWineD3DDevice_Clear((IWineD3DDevice *) object, 0, NULL, D3DCLEAR_STENCIL|D3DCLEAR_ZBUFFER|D3DCLEAR_TARGET, 0x00, 1.0, 0);
|
|
||||||
|
|
||||||
} else { /* End of FIXME: remove when dx8 merged in */
|
|
||||||
|
|
||||||
FIXME("(%p) Incomplete stub for d3d8\n", This);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set the state of the device to valid */
|
/* set the state of the device to valid */
|
||||||
object->state = WINED3D_OK;
|
object->state = WINED3D_OK;
|
||||||
|
|
||||||
|
@ -1901,10 +1834,6 @@ create_device_error:
|
||||||
IWineD3DSurface_Release(object->stencilBufferTarget);
|
IWineD3DSurface_Release(object->stencilBufferTarget);
|
||||||
object->stencilBufferTarget = NULL;
|
object->stencilBufferTarget = NULL;
|
||||||
}
|
}
|
||||||
if (swapchain != NULL) {
|
|
||||||
IWineD3DSwapChain_Release((IWineD3DSwapChain *)swapchain);
|
|
||||||
swapchain = NULL;
|
|
||||||
}
|
|
||||||
HeapFree(GetProcessHeap(), 0, object);
|
HeapFree(GetProcessHeap(), 0, object);
|
||||||
*ppReturnedDeviceInterface = NULL;
|
*ppReturnedDeviceInterface = NULL;
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
|
|
|
@ -377,6 +377,10 @@ void drawPrimitive(IWineD3DDevice *iface,
|
||||||
const void *idxData,
|
const void *idxData,
|
||||||
int minIndex);
|
int minIndex);
|
||||||
|
|
||||||
|
/* Routine to fill gl caps for swapchains and IWineD3D */
|
||||||
|
BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info,
|
||||||
|
Display* display);
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Structures required to draw primitives
|
* Structures required to draw primitives
|
||||||
*/
|
*/
|
||||||
|
@ -569,6 +573,7 @@ typedef struct IWineD3DDeviceImpl
|
||||||
|
|
||||||
/* Device state management */
|
/* Device state management */
|
||||||
HRESULT state;
|
HRESULT state;
|
||||||
|
BOOL d3d_initialized;
|
||||||
|
|
||||||
/* Screen buffer resources */
|
/* Screen buffer resources */
|
||||||
glContext contextCache[CONTEXT_CACHE];
|
glContext contextCache[CONTEXT_CACHE];
|
||||||
|
|
|
@ -324,7 +324,7 @@ DECLARE_INTERFACE_(IWineD3D, IWineD3DBase)
|
||||||
STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DFORMAT AdapterFormat, DWORD Usage, WINED3DRESOURCETYPE RType, WINED3DFORMAT CheckFormat) PURE;
|
STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DFORMAT AdapterFormat, DWORD Usage, WINED3DRESOURCETYPE RType, WINED3DFORMAT CheckFormat) PURE;
|
||||||
STDMETHOD(CheckDeviceFormatConversion)(THIS_ UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DFORMAT SourceFormat, WINED3DFORMAT TargetFormat) PURE;
|
STDMETHOD(CheckDeviceFormatConversion)(THIS_ UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DFORMAT SourceFormat, WINED3DFORMAT TargetFormat) PURE;
|
||||||
STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DCAPS *pCaps) PURE;
|
STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DCAPS *pCaps) PURE;
|
||||||
STDMETHOD(CreateDevice)(THIS_ UINT Adapter, WINED3DDEVTYPE DeviceType,HWND hFocusWindow, DWORD BehaviorFlags, WINED3DPRESENT_PARAMETERS *pPresentationParameters, struct IWineD3DDevice **ppReturnedDeviceInterface, IUnknown *parent, D3DCB_CREATEADDITIONALSWAPCHAIN pFn3) PURE;
|
STDMETHOD(CreateDevice)(THIS_ UINT Adapter, WINED3DDEVTYPE DeviceType,HWND hFocusWindow, DWORD BehaviorFlags, struct IWineD3DDevice **ppReturnedDeviceInterface, IUnknown *parent) PURE;
|
||||||
|
|
||||||
};
|
};
|
||||||
#undef INTERFACE
|
#undef INTERFACE
|
||||||
|
@ -350,7 +350,7 @@ DECLARE_INTERFACE_(IWineD3D, IWineD3DBase)
|
||||||
#define IWineD3D_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f)
|
#define IWineD3D_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f)
|
||||||
#define IWineD3D_CheckDeviceFormatConversion(p,a,b,c,d) (p)->lpVtbl->CheckDeviceFormatConversion(p,a,b,c,d)
|
#define IWineD3D_CheckDeviceFormatConversion(p,a,b,c,d) (p)->lpVtbl->CheckDeviceFormatConversion(p,a,b,c,d)
|
||||||
#define IWineD3D_GetDeviceCaps(p,a,b,c) (p)->lpVtbl->GetDeviceCaps(p,a,b,c)
|
#define IWineD3D_GetDeviceCaps(p,a,b,c) (p)->lpVtbl->GetDeviceCaps(p,a,b,c)
|
||||||
#define IWineD3D_CreateDevice(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f,g,h)
|
#define IWineD3D_CreateDevice(p,a,b,c,d,e,f) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define the main WineD3D entrypoint */
|
/* Define the main WineD3D entrypoint */
|
||||||
|
|
Loading…
Reference in New Issue