wininet: Move cookie-related stubs to cookie.c
[wine] / dlls / wined3d / directx.c
index 01b4103..1074576 100644 (file)
@@ -299,6 +299,8 @@ static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display)
             }
 
             minor = atoi(gl_string_cursor);
+            minor = major*100+minor;
+            major = 10;
 
             break;
 
@@ -366,7 +368,7 @@ static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display)
             minor = 9;
         }
         gl_info->gl_driver_version = MAKEDWORD_VERSION(major, minor);
-        TRACE_(d3d_caps)("found GL_VERSION  (%s)->(0x%08lx)\n", debugstr_a(gl_string), gl_info->gl_driver_version);
+        TRACE_(d3d_caps)("found GL_VERSION  (%s)->%i.%i->(0x%08lx)\n", debugstr_a(gl_string), major, minor, gl_info->gl_driver_version);
 
         /* Fill in the renderer information */
 
@@ -564,6 +566,9 @@ static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display)
             } else if (strcmp(ThisExtn, "GL_EXT_secondary_color") == 0) {
                 TRACE_(d3d_caps)(" FOUND: EXT Secondary coord support\n");
                 gl_info->supported[EXT_SECONDARY_COLOR] = TRUE;
+            } else if (strcmp(ThisExtn, "GL_EXT_stencil_two_side") == 0) {
+                TRACE_(d3d_caps)(" FOUND: EXT Stencil two side support\n");
+                gl_info->supported[EXT_STENCIL_TWO_SIDE] = TRUE;
             } else if (strcmp(ThisExtn, "GL_EXT_stencil_wrap") == 0) {
                 TRACE_(d3d_caps)(" FOUND: EXT Stencil wrap support\n");
                 gl_info->supported[EXT_STENCIL_WRAP] = TRUE;
@@ -637,6 +642,9 @@ static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display)
              * ATI
              */
             /** TODO */
+            } else if (strcmp(ThisExtn, "GL_ATI_separate_stencil") == 0) {
+                TRACE_(d3d_caps)(" FOUND: ATI Separate stencil support\n");
+                gl_info->supported[ATI_SEPARATE_STENCIL] = TRUE;
             } else if (strcmp(ThisExtn, "GL_ATI_texture_env_combine3") == 0) {
                 TRACE_(d3d_caps)(" FOUND: ATI Texture Env combine (3) support\n");
                 gl_info->supported[ATI_TEXTURE_ENV_COMBINE3] = TRUE;
@@ -1007,8 +1015,11 @@ HRESULT WINAPI IWineD3DImpl_GetAdapterIdentifier(IWineD3D *iface, UINT Adapter,
            reuse the values once we have a context which is valid. Values from
            a temporary context may differ from the final ones                 */
         if (isGLInfoValid == FALSE) {
+            WineD3D_Context *fake_ctx = NULL;
+            if (glXGetCurrentContext() == NULL) fake_ctx = WineD3D_CreateFakeGLContext();
             /* If we don't know the device settings, go query them now */
             isGLInfoValid = IWineD3DImpl_FillGLCaps(&This->gl_info, IWineD3DImpl_GetAdapterDisplay(iface, Adapter));
+            if (fake_ctx != NULL) WineD3D_ReleaseFakeGLContext(fake_ctx);
         }
 
         /* If it worked, return the information requested */
@@ -1019,7 +1030,8 @@ HRESULT WINAPI IWineD3DImpl_GetAdapterIdentifier(IWineD3D *iface, UINT Adapter,
 
           /* Note dx8 doesn't supply a DeviceName */
           if (NULL != pIdentifier->DeviceName) strcpy(pIdentifier->DeviceName, "\\\\.\\DISPLAY"); /* FIXME: May depend on desktop? */
-          pIdentifier->DriverVersion->u.HighPart = 0xa;
+          /* Current Windows drivers have versions like 6.14.... (some older have an earlier version) */
+          pIdentifier->DriverVersion->u.HighPart = MAKEDWORD_VERSION(6, 14);
           pIdentifier->DriverVersion->u.LowPart = This->gl_info.gl_driver_version;
           *(pIdentifier->VendorId) = This->gl_info.gl_vendor;
           *(pIdentifier->DeviceId) = This->gl_info.gl_card;
@@ -1033,8 +1045,10 @@ HRESULT WINAPI IWineD3DImpl_GetAdapterIdentifier(IWineD3D *iface, UINT Adapter,
           strcpy(pIdentifier->Driver, "Display");
           strcpy(pIdentifier->Description, "Direct3D HAL");
           if (NULL != pIdentifier->DeviceName) strcpy(pIdentifier->DeviceName, "\\\\.\\DISPLAY"); /* FIXME: May depend on desktop? */
-          pIdentifier->DriverVersion->u.HighPart = 0xa;
-          pIdentifier->DriverVersion->u.LowPart = MAKEDWORD_VERSION(76, 76); /* last Linux Nvidia drivers */
+          /* Current Windows Nvidia drivers have versions like e.g. 6.14.10.5672 */
+          pIdentifier->DriverVersion->u.HighPart = MAKEDWORD_VERSION(6, 14);
+          /* 71.74 is a current Linux Nvidia driver version */
+          pIdentifier->DriverVersion->u.LowPart = MAKEDWORD_VERSION(10, (71*100+74));
           *(pIdentifier->VendorId) = VENDOR_NVIDIA;
           *(pIdentifier->DeviceId) = CARD_NVIDIA_GEFORCE4_TI4600;
           *(pIdentifier->SubSysId) = 0;
@@ -1313,7 +1327,7 @@ HRESULT WINAPI IWineD3DImpl_CheckDeviceType(IWineD3D *iface, UINT Adapter, D3DDE
 }
 
 HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapter, D3DDEVTYPE DeviceType, 
-                                              WINED3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, WINED3DFORMAT CheckFormat) {
+                                              WINED3DFORMAT AdapterFormat, DWORD Usage, WINED3DRESOURCETYPE RType, WINED3DFORMAT CheckFormat) {
     IWineD3DImpl *This = (IWineD3DImpl *)iface;
     TRACE_(d3d_caps)("(%p)-> (STUB) (Adptr:%d, DevType:(%u,%s), AdptFmt:(%u,%s), Use:(%lu,%s), ResTyp:(%x,%s), CheckFmt:(%u,%s)) ",
           This,
@@ -1448,16 +1462,18 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVT
 
     *pCaps->Caps                    = 0;
     *pCaps->Caps2                   = D3DCAPS2_CANRENDERWINDOWED;
-    *pCaps->Caps3                   = D3DDEVCAPS_HWTRANSFORMANDLIGHT;
+    *pCaps->Caps3                   = WINED3DDEVCAPS_HWTRANSFORMANDLIGHT;
     *pCaps->PresentationIntervals   = D3DPRESENT_INTERVAL_IMMEDIATE;
 
     *pCaps->CursorCaps              = 0;
 
 
-    *pCaps->DevCaps                 = D3DDEVCAPS_DRAWPRIMTLVERTEX    |
-                                      D3DDEVCAPS_HWTRANSFORMANDLIGHT |
-                                      D3DDEVCAPS_PUREDEVICE          |
-                                      D3DDEVCAPS_HWRASTERIZATION;
+    *pCaps->DevCaps                 = WINED3DDEVCAPS_DRAWPRIMTLVERTEX    |
+                                      WINED3DDEVCAPS_HWTRANSFORMANDLIGHT |
+                                      WINED3DDEVCAPS_EXECUTEVIDEOMEMORY  |
+                                      WINED3DDEVCAPS_PUREDEVICE          |
+                                      WINED3DDEVCAPS_HWRASTERIZATION     |
+                                      WINED3DDEVCAPS_TEXTUREVIDEOMEMORY;
 
 
     *pCaps->PrimitiveMiscCaps       = D3DPMISCCAPS_CULLCCW               |
@@ -1468,25 +1484,25 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVT
                                       D3DPMISCCAPS_MASKZ;
                                /*NOT: D3DPMISCCAPS_TSSARGTEMP*/
 
-    *pCaps->RasterCaps              = D3DPRASTERCAPS_DITHER    |
-                                      D3DPRASTERCAPS_PAT       |
-                                      D3DPRASTERCAPS_WFOG      |
-                                      D3DPRASTERCAPS_ZFOG      |
-                                      D3DPRASTERCAPS_FOGVERTEX |
-                                      D3DPRASTERCAPS_FOGTABLE  |
-                                      D3DPRASTERCAPS_FOGRANGE;
+    *pCaps->RasterCaps              = WINED3DPRASTERCAPS_DITHER    |
+                                      WINED3DPRASTERCAPS_PAT       |
+                                      WINED3DPRASTERCAPS_WFOG      |
+                                      WINED3DPRASTERCAPS_ZFOG      |
+                                      WINED3DPRASTERCAPS_FOGVERTEX |
+                                      WINED3DPRASTERCAPS_FOGTABLE  |
+                                      WINED3DPRASTERCAPS_FOGRANGE;
 
     if (GL_SUPPORT(EXT_TEXTURE_FILTER_ANISOTROPIC)) {
-      *pCaps->RasterCaps |= D3DPRASTERCAPS_ANISOTROPY    |
-                            D3DPRASTERCAPS_ZBIAS         |
-                            D3DPRASTERCAPS_MIPMAPLODBIAS;
+      *pCaps->RasterCaps |= WINED3DPRASTERCAPS_ANISOTROPY    |
+                            WINED3DPRASTERCAPS_ZBIAS         |
+                            WINED3DPRASTERCAPS_MIPMAPLODBIAS;
     }
                         /* FIXME Add:
-                          D3DPRASTERCAPS_COLORPERSPECTIVE
-                          D3DPRASTERCAPS_STRETCHBLTMULTISAMPLE
-                          D3DPRASTERCAPS_ANTIALIASEDGES
-                          D3DPRASTERCAPS_ZBUFFERLESSHSR
-                          D3DPRASTERCAPS_WBUFFER */
+                          WINED3DPRASTERCAPS_COLORPERSPECTIVE
+                          WINED3DPRASTERCAPS_STRETCHBLTMULTISAMPLE
+                          WINED3DPRASTERCAPS_ANTIALIASEDGES
+                          WINED3DPRASTERCAPS_ZBUFFERLESSHSR
+                          WINED3DPRASTERCAPS_WBUFFER */
 
     *pCaps->ZCmpCaps = D3DPCMPCAPS_ALWAYS       |
                        D3DPCMPCAPS_EQUAL        |
@@ -1501,39 +1517,39 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVT
     *pCaps->DestBlendCaps = 0xFFFFFFFF;   /*FIXME: Tidy up later */
     *pCaps->AlphaCmpCaps  = 0xFFFFFFFF;   /*FIXME: Tidy up later */
 
-    *pCaps->ShadeCaps     = D3DPSHADECAPS_SPECULARGOURAUDRGB |
-                            D3DPSHADECAPS_COLORGOURAUDRGB;
+    *pCaps->ShadeCaps     = WINED3DPSHADECAPS_SPECULARGOURAUDRGB |
+                            WINED3DPSHADECAPS_COLORGOURAUDRGB;
 
-    *pCaps->TextureCaps =  D3DPTEXTURECAPS_ALPHA              |
-                           D3DPTEXTURECAPS_ALPHAPALETTE       |
-                           D3DPTEXTURECAPS_VOLUMEMAP          |
-                           D3DPTEXTURECAPS_MIPMAP             |
-                           D3DPTEXTURECAPS_PROJECTED          |
-                           D3DPTEXTURECAPS_PERSPECTIVE        |
-                           D3DPTEXTURECAPS_VOLUMEMAP_POW2 ;
+    *pCaps->TextureCaps =  WINED3DPTEXTURECAPS_ALPHA              |
+                           WINED3DPTEXTURECAPS_ALPHAPALETTE       |
+                           WINED3DPTEXTURECAPS_VOLUMEMAP          |
+                           WINED3DPTEXTURECAPS_MIPMAP             |
+                           WINED3DPTEXTURECAPS_PROJECTED          |
+                           WINED3DPTEXTURECAPS_PERSPECTIVE        |
+                           WINED3DPTEXTURECAPS_VOLUMEMAP_POW2 ;
                           /* TODO: add support for NON-POW2 if avaialble
 
                           */
-    if (This->dxVersion > 8) {
-        *pCaps->TextureCaps |= D3DPTEXTURECAPS_NONPOW2CONDITIONAL;
+    if (This->dxVersion >= 8) {
+        *pCaps->TextureCaps |= WINED3DPTEXTURECAPS_NONPOW2CONDITIONAL;
 
     } else {  /* NONPOW2 isn't accessible by d3d8 yet */
-        *pCaps->TextureCaps |= D3DPTEXTURECAPS_POW2;
+        *pCaps->TextureCaps |= WINED3DPTEXTURECAPS_POW2;
     }
 
     if (GL_SUPPORT(ARB_TEXTURE_CUBE_MAP)) {
-        *pCaps->TextureCaps |= D3DPTEXTURECAPS_CUBEMAP     |
-                             D3DPTEXTURECAPS_MIPCUBEMAP    |
-                             D3DPTEXTURECAPS_CUBEMAP_POW2;
+        *pCaps->TextureCaps |= WINED3DPTEXTURECAPS_CUBEMAP     |
+                             WINED3DPTEXTURECAPS_MIPCUBEMAP    |
+                             WINED3DPTEXTURECAPS_CUBEMAP_POW2;
 
     }
 
-    *pCaps->TextureFilterCaps = D3DPTFILTERCAPS_MAGFLINEAR |
-                                D3DPTFILTERCAPS_MAGFPOINT  |
-                                D3DPTFILTERCAPS_MINFLINEAR |
-                                D3DPTFILTERCAPS_MINFPOINT  |
-                                D3DPTFILTERCAPS_MIPFLINEAR |
-                                D3DPTFILTERCAPS_MIPFPOINT;
+    *pCaps->TextureFilterCaps = WINED3DPTFILTERCAPS_MAGFLINEAR |
+                                WINED3DPTFILTERCAPS_MAGFPOINT  |
+                                WINED3DPTFILTERCAPS_MINFLINEAR |
+                                WINED3DPTFILTERCAPS_MINFPOINT  |
+                                WINED3DPTFILTERCAPS_MIPFLINEAR |
+                                WINED3DPTFILTERCAPS_MIPFPOINT;
 
     *pCaps->CubeTextureFilterCaps = 0;
     *pCaps->VolumeTextureFilterCaps = 0;
@@ -1645,11 +1661,11 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVT
     *pCaps->MaxPointSize    = GL_LIMITS(pointsize);
 
 
-    *pCaps->VertexProcessingCaps = D3DVTXPCAPS_DIRECTIONALLIGHTS |
-                                   D3DVTXPCAPS_MATERIALSOURCE7   |
-                                   D3DVTXPCAPS_POSITIONALLIGHTS  |
-                                   D3DVTXPCAPS_LOCALVIEWER |
-                                   D3DVTXPCAPS_TEXGEN;
+    *pCaps->VertexProcessingCaps = WINED3DVTXPCAPS_DIRECTIONALLIGHTS |
+                                   WINED3DVTXPCAPS_MATERIALSOURCE7   |
+                                   WINED3DVTXPCAPS_POSITIONALLIGHTS  |
+                                   WINED3DVTXPCAPS_LOCALVIEWER |
+                                   WINED3DVTXPCAPS_TEXGEN;
                                   /* FIXME: Add 
                                      D3DVTXPCAPS_TWEENING */
 
@@ -1707,10 +1723,10 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVT
         *pCaps->NumSimultaneousRTs                = max_buffers;
         *pCaps->StretchRectFilterCaps             = 0;
         /* TODO: add
-           D3DPTFILTERCAPS_MINFPOINT
-           D3DPTFILTERCAPS_MAGFPOINT
-           D3DPTFILTERCAPS_MINFLINEAR
-           D3DPTFILTERCAPS_MAGFLINEAR
+           WINED3DPTFILTERCAPS_MINFPOINT
+           WINED3DPTFILTERCAPS_MAGFPOINT
+           WINED3DPTFILTERCAPS_MINFLINEAR
+           WINED3DPTFILTERCAPS_MAGFLINEAR
         */
         *pCaps->VS20Caps.Caps                     = 0;
         *pCaps->PS20Caps.Caps                     = 0;
@@ -1775,9 +1791,9 @@ HRESULT  WINAPI  IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
     object->adapterNo                    = Adapter;
     object->devType                      = DeviceType;
 
-    /* FIXME: Use for dx8 code eventually too! */
+    /* 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) {
+    if (This->dxVersion >= 8) {
         TRACE("(%p) : Creating stateblock\n", This);
         /* Creating the startup stateBlock - Note Special Case: 0 => Don't fill in yet! */
         if (D3D_OK != IWineD3DDevice_CreateStateBlock((IWineD3DDevice *)object,