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
...@@ -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");
if (rdst) {
rect.u1.x1 = rdst->left; rect.u1.x1 = rdst->left;
rect.u2.y1 = rdst->top; rect.u2.y1 = rdst->top;
rect.u3.x2 = rdst->right; rect.u3.x2 = rdst->right;
rect.u4.y2 = rdst->bottom; rect.u4.y2 = rdst->bottom;
d3ddevice_clear(This->d3ddevice, 1, &rect, D3DCLEAR_TARGET, color, 0.0, 0x00000000); }
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