Validate that the texture is no larger than the graphics cards largest

supported texture.
This commit is contained in:
Oliver Stieber 2005-07-30 19:05:58 +00:00 committed by Alexandre Julliard
parent 7eb81fabeb
commit cc884e0ae6
2 changed files with 22 additions and 3 deletions

View File

@ -591,6 +591,12 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, UINT Wid
MultisampleQuality=0;
}
/** FIXME: Check that the format is supported
* by the device.
*******************************/
/* TODO: add support for dxt2 and dxt4 formats */
if (Format == D3DFMT_DXT2 || Format == D3DFMT_DXT4) return D3DERR_NOTAVAILABLE;
/* Non-power2 support */
/* Find the nearest pow2 match */
@ -608,7 +614,17 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, UINT Wid
}
}
/** TODO: Check against the maximum texture sizes supported by the video card **/
/** Check against the maximum texture sizes supported by the video card **/
if (pow2Width > GL_LIMITS(texture_size) || pow2Height > GL_LIMITS(texture_size)) {
/* one of three options
1: Do the same as we do with nonpow 2 and scale the texture, (any texture ops would require the texture to be scaled which is potentially slow)
2: Set the texture to the maxium size (bad idea)
3: WARN and return D3DERR_NOTAVAILABLE;
*/
WARN("(%p) Application requested a surface w %d, h %d, but the graphics card only supports %d\n", This, Width, Height, GL_LIMITS(texture_size));
return D3DERR_NOTAVAILABLE;
}
/** DXTn mipmaps use the same number of 'levels' down to eg. 8x1, but since
@ -1206,7 +1222,6 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevice* ifac
object->presentParms.PresentationInterval = *(pPresentationParameters->PresentationInterval);
/* FIXME: check for any failures */
/*********************
* Create the back, front and stencil buffers
*******************/

View File

@ -1586,9 +1586,13 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
IWineD3DStateBlock_AddRef((IWineD3DStateBlock*)object->updateStateBlock);
/* Setup surfaces for the backbuffer, frontbuffer and depthstencil buffer */
/* Setup some defaults for creating the implicite swapchain */
ENTER_GL();
IWineD3DImpl_FillGLCaps(&This->gl_info, IWineD3DImpl_GetAdapterDisplay(iface, Adapter));
LEAVE_GL();
/* Setup the implicit swapchain */
TRACE("Creating implicit swapchain\n");
if (D3D_OK != D3DCB_CreateAdditionalSwapChain((IUnknown *) object->parent, pPresentationParameters, (IWineD3DSwapChain **)&swapchain) || swapchain == NULL) {
WARN("Failed to create implicite swapchain\n");
goto create_device_error;