[wined3d] Add FIXME & don't crash when creating device with non-x^2 dims

Felix Nawothnig felix.nawothnig at t-online.de
Wed Jun 8 08:32:25 CDT 2005


ChangeLog:
  - Output a FIXME when a surface with dimensions not being a power of
    two is requested.
  - Fail gracefully when IWineD3DImpl_CreateDevice fails to create the
    front- or backbuffer.
-------------- next part --------------
Index: device.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/device.c,v
retrieving revision 1.30
diff -u -r1.30 device.c
--- device.c	6 Jun 2005 19:50:35 -0000	1.30
+++ device.c	8 Jun 2005 13:19:42 -0000
@@ -412,9 +412,8 @@
     while (pow2Width < Width) pow2Width <<= 1;
     while (pow2Height < Height) pow2Height <<= 1;
 
-    /* TODO: support for non-power 2 textures */
     if(pow2Width > Width || pow2Height > Height){
-        /** TODO: add support for non power two compressed textures (OpenGL provices support for * non-power-two textures gratis) **/
+        FIXME("non-power-two textures unsupported\n"); /* OpenGL provides support for these gratis */
         return D3DERR_NOTAVAILABLE;
     }
 
Index: directx.c
===================================================================
RCS file: /home/wine/wine/dlls/wined3d/directx.c,v
retrieving revision 1.30
diff -u -r1.30 directx.c
--- directx.c	6 Jun 2005 19:50:35 -0000	1.30
+++ directx.c	8 Jun 2005 13:19:48 -0000
@@ -1496,6 +1496,7 @@
     IWineD3DImpl       *This    = (IWineD3DImpl *)iface;
     int                 num;
     XVisualInfo         template;
+    HRESULT             res;
 
     /* Validate the adapter number */
     if (Adapter >= IWineD3D_GetAdapterCount(iface)) {
@@ -1659,25 +1660,28 @@
        parms. Fix this by passing in a function to call which takes identical parms
        and handles the differences at the d3dx layer, and returns the IWineD3DSurface
        pointer rather than the created D3D8/9 one                                      */
-    D3DCB_CreateRenderTarget((IUnknown *) parent,
-                             *(pPresentationParameters->BackBufferWidth),
-                             *(pPresentationParameters->BackBufferHeight),
-                             *(pPresentationParameters->BackBufferFormat),
-                             *(pPresentationParameters->MultiSampleType),
-                             *(pPresentationParameters->MultiSampleQuality),
-                             TRUE,
-                             (IWineD3DSurface **) &object->frontBuffer,
-                             NULL);
-
-    D3DCB_CreateRenderTarget((IUnknown *) parent,
-                             *(pPresentationParameters->BackBufferWidth),
-                             *(pPresentationParameters->BackBufferHeight),
-                             *(pPresentationParameters->BackBufferFormat),
-                             *(pPresentationParameters->MultiSampleType),
-                             *(pPresentationParameters->MultiSampleQuality),
-                             TRUE,
-                             (IWineD3DSurface **) &object->backBuffer,
-                             NULL);
+    if ((res = D3DCB_CreateRenderTarget((IUnknown *) parent,
+                                        *(pPresentationParameters->BackBufferWidth),
+                                        *(pPresentationParameters->BackBufferHeight),
+                                        *(pPresentationParameters->BackBufferFormat),
+                                        *(pPresentationParameters->MultiSampleType),
+                                        *(pPresentationParameters->MultiSampleQuality),
+                                        TRUE,
+                                        (IWineD3DSurface **) &object->frontBuffer,
+                                        NULL) != D3D_OK) ||
+        (res = D3DCB_CreateRenderTarget((IUnknown *) parent,
+                                        *(pPresentationParameters->BackBufferWidth),
+                                        *(pPresentationParameters->BackBufferHeight),
+                                        *(pPresentationParameters->BackBufferFormat),
+                                        *(pPresentationParameters->MultiSampleType),
+                                        *(pPresentationParameters->MultiSampleQuality),
+                                        TRUE,
+                                        (IWineD3DSurface **) &object->backBuffer,
+                                       NULL) != D3D_OK))
+    {
+        ERR("D3DCB_CreateRenderTarget() failed\n");
+        return res;
+    }
 
 /* TODO: 
     if (*(pPresentationParameters->EnableAutoDepthStencil)) {


More information about the wine-patches mailing list