[D3D 21] Some fixes in my texture patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Changelog:
 - fix Twist demo
 - some clean-ups / traces to conform with Christian's 20bis patch

-- 
		 Lionel Ulmer - http://www.bbrox.org/
--- ../wine_base/dlls/ddraw/d3dtexture.c	Sun Dec 15 18:33:35 2002
+++ dlls/ddraw/d3dtexture.c	Sun Dec 15 18:43:26 2002
@@ -606,8 +606,6 @@
     return D3D_OK;
 }
 
-/* NOTE : if you experience crashes in this function, you must have a buggy
-          version of Mesa. See the file d3dtexture.c for a cure */
 HRESULT WINAPI
 GL_IDirect3DTextureImpl_2_1T_Load(LPDIRECT3DTEXTURE2 iface,
 				  LPDIRECT3DTEXTURE2 lpD3DTexture2)
@@ -637,10 +635,8 @@
     if ( This->surface_desc.ddsCaps.dwCaps & DDSCAPS_ALLOCONLOAD )
         /* If the surface is not allocated and its location is not yet specified,
 	   force it to video memory */ 
-        if ( !(This->surface_desc.ddsCaps.dwCaps & (DDSCAPS_SYSTEMMEMORY|DDSCAPS_VIDEOMEMORY)) ) {
+        if ( !(This->surface_desc.ddsCaps.dwCaps & (DDSCAPS_SYSTEMMEMORY|DDSCAPS_VIDEOMEMORY)) )
 	    This->surface_desc.ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY;
-	    WARN("This case is not properly handled yet.. Expect errors !\n");
-	}
 
     /* Suppress the ALLOCONLOAD flag */
     This->surface_desc.ddsCaps.dwCaps &= ~DDSCAPS_ALLOCONLOAD;
@@ -783,6 +779,17 @@
     XCAST(Load) GL_IDirect3DTextureImpl_2_1T_Load,
 };
 
+ICOM_VTABLE(IDirect3DTexture2) STUB_VTABLE_IDirect3DTexture2 =
+{
+    ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
+    XCAST(QueryInterface) Thunk_IDirect3DTextureImpl_2_QueryInterface,
+    XCAST(AddRef) Thunk_IDirect3DTextureImpl_2_AddRef,
+    XCAST(Release) Thunk_IDirect3DTextureImpl_2_Release,
+    XCAST(GetHandle) Main_IDirect3DTextureImpl_2_1T_GetHandle,
+    XCAST(PaletteChanged) Main_IDirect3DTextureImpl_2_1T_PaletteChanged,
+    XCAST(Load) Main_IDirect3DTextureImpl_2_1T_Load,
+};
+
 #if !defined(__STRICT_ANSI__) && defined(__GNUC__)
 #undef XCAST
 #endif
@@ -816,6 +823,14 @@
 {
     IDirect3DTextureGLImpl *private;
 
+    if ((surf->surface_desc.ddsCaps.dwCaps & (DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY)) != 0) {
+        /* If it is an offscreen texture, only create stub implementations.
+	   Only the IUnknown interfaces should be used anyway. */
+        ICOM_INIT_INTERFACE(surf, IDirect3DTexture,  VTABLE_IDirect3DTexture); /* No special STUB one here as all functions are stubs */
+	ICOM_INIT_INTERFACE(surf, IDirect3DTexture2, STUB_VTABLE_IDirect3DTexture2);
+        return DD_OK;
+    }
+    
     private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DTextureGLImpl));
     if (private == NULL) return DDERR_OUTOFMEMORY;
 
--- ../wine_base/dlls/ddraw/mesa.c	Sun Dec 15 18:33:35 2002
+++ dlls/ddraw/mesa.c	Sun Dec 15 18:36:14 2002
@@ -41,8 +41,9 @@
 	case D3DCMP_NOTEQUAL: return GL_NOTEQUAL;
 	case D3DCMP_GREATEREQUAL: return GL_GEQUAL;
 	case D3DCMP_ALWAYS: return GL_ALWAYS;
-	default: ERR("Unexpected compare type !!!\n");
+	default: ERR("Unexpected compare type %d !\n", dwRenderState);
     }
+    return GL_ALWAYS;
 }  
      
 
@@ -90,7 +91,7 @@
 		    case D3DTADDRESS_WRAP:   arg = GL_REPEAT; break;
 		    case D3DTADDRESS_CLAMP:  arg = GL_CLAMP; break;
 		    case D3DTADDRESS_BORDER: arg = GL_CLAMP_TO_EDGE; break;
-		    default: ERR("Unhandled TEXTUREADDRESS mode !\n");
+		    default: ERR("Unhandled TEXTUREADDRESS mode %ld !\n", dwRenderState);
 		}
 		if ((dwRenderStateType == D3DRENDERSTATE_TEXTUREADDRESSU) ||
 		    (dwRenderStateType == D3DRENDERSTATE_TEXTUREADDRESS))
--- ../wine_base/dlls/ddraw/d3ddevice/mesa.c	Sun Dec 15 17:17:15 2002
+++ dlls/ddraw/d3ddevice/mesa.c	Sun Dec 15 17:38:47 2002
@@ -45,12 +45,6 @@
   { 0x82,0x2d,0xa8,0xd5,0x31,0x87,0xca,0xfa }
 };
 
-/* Define this variable if you have an unpatched Mesa 3.0 (patches are available
-   on Mesa's home page) or version 3.1b.
-
-   Version 3.1b2 should correct this bug */
-#undef HAVE_BUGGY_MESAGL
-
 #ifndef HAVE_GLEXT_PROTOTYPES
 /* This is for non-OpenGL ABI compliant glext.h headers :-) */
 typedef void (* PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat,
@@ -358,9 +352,6 @@
     if (cb_1) if (cb_1(&sdesc , context) == 0) return DD_OK;
     if (cb_2) if (cb_2(pformat, context) == 0) return DD_OK;
 
-#ifndef HAVE_BUGGY_MESAGL
-    /* The packed texture format are buggy in Mesa. The bug was reported and corrected,
-       so that future version will work great. */
     TRACE("Enumerating GL_RGB packed GL_UNSIGNED_SHORT_5_6_5 (16)\n");
     pformat->dwFlags = DDPF_RGB;
     pformat->u1.dwRGBBitCount = 16;
@@ -400,7 +391,6 @@
     pformat->u5.dwRGBAlphaBitMask = 0x00000000;
     if (cb_1) if (cb_1(&sdesc , context) == 0) return DD_OK;
     if (cb_2) if (cb_2(pformat, context) == 0) return DD_OK;
-#endif
 
     TRACE("Enumerating GL_ARGB (no direct OpenGL equivalent - conversion needed)\n");
     pformat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
--- ../wine_base/dlls/ddraw/dsurface/main.c	Sun Dec 15 12:15:49 2002
+++ dlls/ddraw/dsurface/main.c	Sun Dec 15 18:41:11 2002
@@ -81,6 +81,7 @@
 			DDRAW_IDDS3_Thunk_VTable);
     ICOM_INIT_INTERFACE(This, IDirectDrawGammaControl,
 			DDRAW_IDDGC_VTable);
+
     /* There is no generic implementation of IDDS7 or texture */
 
     Main_DirectDraw_AddSurface(pDD, This);
@@ -195,8 +196,7 @@
 	/* In case the texture surface was created before the D3D creation */
 	if ((This->surface_desc.ddsCaps.dwCaps & DDSCAPS_TEXTURE) == 0) return E_NOINTERFACE;
 	/* Create a 'delayed' private field only if it is not an offscreen texture... */
-	if ((This->tex_private == NULL) && 
-	    ((This->surface_desc.ddsCaps.dwCaps & (DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY)) == 0)) {
+	if (This->tex_private == NULL) {
    	    if (This->ddraw_owner->d3d == NULL) {
 	        ERR("Texture created with no D3D object yet.. Not supported !\n");
 		return E_NOINTERFACE;

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux