parent
6c79930413
commit
8377b9d49b
|
@ -45,12 +45,6 @@ const GUID IID_D3DDEVICE_OpenGL = {
|
||||||
{ 0x82,0x2d,0xa8,0xd5,0x31,0x87,0xca,0xfa }
|
{ 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
|
#ifndef HAVE_GLEXT_PROTOTYPES
|
||||||
/* This is for non-OpenGL ABI compliant glext.h headers :-) */
|
/* This is for non-OpenGL ABI compliant glext.h headers :-) */
|
||||||
typedef void (* PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat,
|
typedef void (* PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat,
|
||||||
|
@ -358,9 +352,6 @@ static HRESULT enum_texture_format_OpenGL(LPD3DENUMTEXTUREFORMATSCALLBACK cb_1,
|
||||||
if (cb_1) if (cb_1(&sdesc , context) == 0) return DD_OK;
|
if (cb_1) if (cb_1(&sdesc , context) == 0) return DD_OK;
|
||||||
if (cb_2) if (cb_2(pformat, 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");
|
TRACE("Enumerating GL_RGB packed GL_UNSIGNED_SHORT_5_6_5 (16)\n");
|
||||||
pformat->dwFlags = DDPF_RGB;
|
pformat->dwFlags = DDPF_RGB;
|
||||||
pformat->u1.dwRGBBitCount = 16;
|
pformat->u1.dwRGBBitCount = 16;
|
||||||
|
@ -400,7 +391,6 @@ static HRESULT enum_texture_format_OpenGL(LPD3DENUMTEXTUREFORMATSCALLBACK cb_1,
|
||||||
pformat->u5.dwRGBAlphaBitMask = 0x00000000;
|
pformat->u5.dwRGBAlphaBitMask = 0x00000000;
|
||||||
if (cb_1) if (cb_1(&sdesc , context) == 0) return DD_OK;
|
if (cb_1) if (cb_1(&sdesc , context) == 0) return DD_OK;
|
||||||
if (cb_2) if (cb_2(pformat, 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");
|
TRACE("Enumerating GL_ARGB (no direct OpenGL equivalent - conversion needed)\n");
|
||||||
pformat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
|
pformat->dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
|
||||||
|
|
|
@ -606,8 +606,6 @@ GL_IDirect3DTextureImpl_2_1T_GetHandle(LPDIRECT3DTEXTURE2 iface,
|
||||||
return D3D_OK;
|
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
|
HRESULT WINAPI
|
||||||
GL_IDirect3DTextureImpl_2_1T_Load(LPDIRECT3DTEXTURE2 iface,
|
GL_IDirect3DTextureImpl_2_1T_Load(LPDIRECT3DTEXTURE2 iface,
|
||||||
LPDIRECT3DTEXTURE2 lpD3DTexture2)
|
LPDIRECT3DTEXTURE2 lpD3DTexture2)
|
||||||
|
@ -637,10 +635,8 @@ GL_IDirect3DTextureImpl_2_1T_Load(LPDIRECT3DTEXTURE2 iface,
|
||||||
if ( This->surface_desc.ddsCaps.dwCaps & DDSCAPS_ALLOCONLOAD )
|
if ( This->surface_desc.ddsCaps.dwCaps & DDSCAPS_ALLOCONLOAD )
|
||||||
/* If the surface is not allocated and its location is not yet specified,
|
/* If the surface is not allocated and its location is not yet specified,
|
||||||
force it to video memory */
|
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;
|
This->surface_desc.ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY;
|
||||||
WARN("This case is not properly handled yet.. Expect errors !\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Suppress the ALLOCONLOAD flag */
|
/* Suppress the ALLOCONLOAD flag */
|
||||||
This->surface_desc.ddsCaps.dwCaps &= ~DDSCAPS_ALLOCONLOAD;
|
This->surface_desc.ddsCaps.dwCaps &= ~DDSCAPS_ALLOCONLOAD;
|
||||||
|
@ -783,6 +779,17 @@ ICOM_VTABLE(IDirect3DTexture2) VTABLE_IDirect3DTexture2 =
|
||||||
XCAST(Load) GL_IDirect3DTextureImpl_2_1T_Load,
|
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__)
|
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
|
||||||
#undef XCAST
|
#undef XCAST
|
||||||
#endif
|
#endif
|
||||||
|
@ -816,6 +823,14 @@ HRESULT d3dtexture_create(IDirect3DImpl *d3d, IDirectDrawSurfaceImpl *surf, BOOL
|
||||||
{
|
{
|
||||||
IDirect3DTextureGLImpl *private;
|
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));
|
private = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DTextureGLImpl));
|
||||||
if (private == NULL) return DDERR_OUTOFMEMORY;
|
if (private == NULL) return DDERR_OUTOFMEMORY;
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,7 @@ Main_DirectDrawSurface_Construct(IDirectDrawSurfaceImpl *This,
|
||||||
DDRAW_IDDS3_Thunk_VTable);
|
DDRAW_IDDS3_Thunk_VTable);
|
||||||
ICOM_INIT_INTERFACE(This, IDirectDrawGammaControl,
|
ICOM_INIT_INTERFACE(This, IDirectDrawGammaControl,
|
||||||
DDRAW_IDDGC_VTable);
|
DDRAW_IDDGC_VTable);
|
||||||
|
|
||||||
/* There is no generic implementation of IDDS7 or texture */
|
/* There is no generic implementation of IDDS7 or texture */
|
||||||
|
|
||||||
Main_DirectDraw_AddSurface(pDD, This);
|
Main_DirectDraw_AddSurface(pDD, This);
|
||||||
|
@ -195,8 +196,7 @@ Main_DirectDrawSurface_QueryInterface(LPDIRECTDRAWSURFACE7 iface, REFIID riid,
|
||||||
/* In case the texture surface was created before the D3D creation */
|
/* In case the texture surface was created before the D3D creation */
|
||||||
if ((This->surface_desc.ddsCaps.dwCaps & DDSCAPS_TEXTURE) == 0) return E_NOINTERFACE;
|
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... */
|
/* Create a 'delayed' private field only if it is not an offscreen texture... */
|
||||||
if ((This->tex_private == NULL) &&
|
if (This->tex_private == NULL) {
|
||||||
((This->surface_desc.ddsCaps.dwCaps & (DDSCAPS_OFFSCREENPLAIN|DDSCAPS_SYSTEMMEMORY)) == 0)) {
|
|
||||||
if (This->ddraw_owner->d3d == NULL) {
|
if (This->ddraw_owner->d3d == NULL) {
|
||||||
ERR("Texture created with no D3D object yet.. Not supported !\n");
|
ERR("Texture created with no D3D object yet.. Not supported !\n");
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
|
|
|
@ -41,10 +41,9 @@ GLenum convert_D3D_compare_to_GL(D3DCMPFUNC dwRenderState)
|
||||||
case D3DCMP_NOTEQUAL: return GL_NOTEQUAL;
|
case D3DCMP_NOTEQUAL: return GL_NOTEQUAL;
|
||||||
case D3DCMP_GREATEREQUAL: return GL_GEQUAL;
|
case D3DCMP_GREATEREQUAL: return GL_GEQUAL;
|
||||||
case D3DCMP_ALWAYS: return GL_ALWAYS;
|
case D3DCMP_ALWAYS: return GL_ALWAYS;
|
||||||
default:
|
default: ERR("Unexpected compare type %d !\n", dwRenderState);
|
||||||
ERR("Unexpected compare type !!!\n");
|
|
||||||
return GL_NEVER;
|
|
||||||
}
|
}
|
||||||
|
return GL_ALWAYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,7 +91,7 @@ void set_render_state(D3DRENDERSTATETYPE dwRenderStateType,
|
||||||
case D3DTADDRESS_WRAP: arg = GL_REPEAT; break;
|
case D3DTADDRESS_WRAP: arg = GL_REPEAT; break;
|
||||||
case D3DTADDRESS_CLAMP: arg = GL_CLAMP; break;
|
case D3DTADDRESS_CLAMP: arg = GL_CLAMP; break;
|
||||||
case D3DTADDRESS_BORDER: arg = GL_CLAMP_TO_EDGE; 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) ||
|
if ((dwRenderStateType == D3DRENDERSTATE_TEXTUREADDRESSU) ||
|
||||||
(dwRenderStateType == D3DRENDERSTATE_TEXTUREADDRESS))
|
(dwRenderStateType == D3DRENDERSTATE_TEXTUREADDRESS))
|
||||||
|
|
Loading…
Reference in New Issue