Commit 8daf96c2 authored by Lionel Ulmer's avatar Lionel Ulmer Committed by Alexandre Julliard

- fix bug in 'Blt DEPTH_FILL' override

- added a lock around the flushing of a surface to the frame buffer - optimize texture loading my minimizing the cases where a conversion needs to occur and also by reusing the allocated memory
parent 4c591d4e
...@@ -929,7 +929,7 @@ Main_IDirect3DDeviceImpl_7_Load(LPDIRECT3DDEVICE7 iface, ...@@ -929,7 +929,7 @@ Main_IDirect3DDeviceImpl_7_Load(LPDIRECT3DDEVICE7 iface,
ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface); ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface);
FIXME("(%p/%p)->(%p,%p,%p,%p,%08lx): Partially Implemented!\n", This, iface, lpDestTex, lpDestPoint, lpSrcTex, lprcSrcRect, dwFlags); FIXME("(%p/%p)->(%p,%p,%p,%p,%08lx): Partially Implemented!\n", This, iface, lpDestTex, lpDestPoint, lpSrcTex, lprcSrcRect, dwFlags);
IDirect3DTexture2_Load(COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7, IDirect3DTexture2, lpDestTex), IDirect3DTexture2_Load(COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7, IDirect3DTexture2, lpDestTex),
COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7, IDirect3DTexture2, lpSrcTex)); COM_INTERFACE_CAST(IDirectDrawSurfaceImpl, IDirectDrawSurface7, IDirect3DTexture2, lpSrcTex));
return DD_OK; return DD_OK;
} }
......
...@@ -109,7 +109,7 @@ static BOOL opengl_flip( LPVOID dev, LPVOID drawable) ...@@ -109,7 +109,7 @@ static BOOL opengl_flip( LPVOID dev, LPVOID drawable)
{ {
IDirect3DDeviceImpl *d3d_dev = (IDirect3DDeviceImpl *) dev; IDirect3DDeviceImpl *d3d_dev = (IDirect3DDeviceImpl *) dev;
IDirect3DDeviceGLImpl *gl_d3d_dev = (IDirect3DDeviceGLImpl *) dev; IDirect3DDeviceGLImpl *gl_d3d_dev = (IDirect3DDeviceGLImpl *) dev;
TRACE("(%p, %ld)\n", gl_d3d_dev->display,(Drawable)drawable); TRACE("(%p, %ld)\n", gl_d3d_dev->display,(Drawable)drawable);
ENTER_GL(); ENTER_GL();
if (gl_d3d_dev->state == SURFACE_MEMORY) { if (gl_d3d_dev->state == SURFACE_MEMORY) {
...@@ -119,6 +119,7 @@ static BOOL opengl_flip( LPVOID dev, LPVOID drawable) ...@@ -119,6 +119,7 @@ static BOOL opengl_flip( LPVOID dev, LPVOID drawable)
gl_d3d_dev->front_state = SURFACE_GL; gl_d3d_dev->front_state = SURFACE_GL;
glXSwapBuffers(gl_d3d_dev->display, (Drawable)drawable); glXSwapBuffers(gl_d3d_dev->display, (Drawable)drawable);
LEAVE_GL(); LEAVE_GL();
return TRUE; return TRUE;
} }
...@@ -2523,12 +2524,16 @@ d3ddevice_blt(IDirectDrawSurfaceImpl *This, LPRECT rdst, ...@@ -2523,12 +2524,16 @@ d3ddevice_blt(IDirectDrawSurfaceImpl *This, LPRECT rdst,
/* This is easy to handle for the D3D Device... */ /* This is easy to handle for the D3D Device... */
DWORD color = lpbltfx->u5.dwFillColor; DWORD color = lpbltfx->u5.dwFillColor;
D3DRECT rect; D3DRECT rect;
TRACE(" executing D3D Device override.\n"); TRACE(" executing D3D Device override.\n");
rect.u1.x1 = rdst->left;
rect.u2.y1 = rdst->top; if (rdst) {
rect.u3.x2 = rdst->right; rect.u1.x1 = rdst->left;
rect.u4.y2 = rdst->bottom; rect.u2.y1 = rdst->top;
d3ddevice_clear(This->d3ddevice, 1, &rect, D3DCLEAR_TARGET, color, 0.0, 0x00000000); rect.u3.x2 = rdst->right;
rect.u4.y2 = rdst->bottom;
}
d3ddevice_clear(This->d3ddevice, rdst != NULL ? 1 : 0, &rect, D3DCLEAR_TARGET, color, 0.0, 0x00000000);
return DD_OK; return DD_OK;
} }
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
...@@ -2845,6 +2850,9 @@ static void d3ddevice_flush_to_frame_buffer(IDirect3DDeviceImpl *d3d_dev, LPCREC ...@@ -2845,6 +2850,9 @@ static void d3ddevice_flush_to_frame_buffer(IDirect3DDeviceImpl *d3d_dev, LPCREC
GLint tex_state; GLint tex_state;
int x, y; int x, y;
/* This is to prevent another thread to actually lock the buffer while we flush it on screen */
EnterCriticalSection(&(d3d_dev->crit));
loc_rect.top = 0; loc_rect.top = 0;
loc_rect.left = 0; loc_rect.left = 0;
loc_rect.bottom = surf->surface_desc.dwHeight; loc_rect.bottom = surf->surface_desc.dwHeight;
...@@ -2884,6 +2892,7 @@ static void d3ddevice_flush_to_frame_buffer(IDirect3DDeviceImpl *d3d_dev, LPCREC ...@@ -2884,6 +2892,7 @@ static void d3ddevice_flush_to_frame_buffer(IDirect3DDeviceImpl *d3d_dev, LPCREC
glPixelStorei(GL_UNPACK_SWAP_BYTES, TRUE); glPixelStorei(GL_UNPACK_SWAP_BYTES, TRUE);
} else { } else {
ERR(" unsupported pixel format at frame buffer flush.\n"); ERR(" unsupported pixel format at frame buffer flush.\n");
LeaveCriticalSection(&(d3d_dev->crit));
return; return;
} }
...@@ -2973,6 +2982,9 @@ static void d3ddevice_flush_to_frame_buffer(IDirect3DDeviceImpl *d3d_dev, LPCREC ...@@ -2973,6 +2982,9 @@ static void d3ddevice_flush_to_frame_buffer(IDirect3DDeviceImpl *d3d_dev, LPCREC
} }
} }
#endif #endif
/* And leave the critical section... */
LeaveCriticalSection(&(d3d_dev->crit));
} }
static void d3ddevice_unlock_update(IDirectDrawSurfaceImpl* This, LPCRECT pRect) static void d3ddevice_unlock_update(IDirectDrawSurfaceImpl* This, LPCRECT pRect)
......
...@@ -81,6 +81,9 @@ typedef struct IDirect3DTextureGLImpl ...@@ -81,6 +81,9 @@ typedef struct IDirect3DTextureGLImpl
BOOLEAN initial_upload_done; BOOLEAN initial_upload_done;
BOOLEAN dirty_flag; BOOLEAN dirty_flag;
/* Surface optimization */
void *surface_ptr;
/* This is for now used to override 'standard' surface stuff to be as transparent as possible */ /* This is for now used to override 'standard' surface stuff to be as transparent as possible */
void (*final_release)(struct IDirectDrawSurfaceImpl *This); void (*final_release)(struct IDirectDrawSurfaceImpl *This);
void (*lock_update)(IDirectDrawSurfaceImpl* This, LPCRECT pRect, DWORD dwFlags); void (*lock_update)(IDirectDrawSurfaceImpl* This, LPCRECT pRect, DWORD dwFlags);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment