- some tracing fixes
- flush the right buffer to the screen
This commit is contained in:
parent
c577c27e2b
commit
97f216c93c
|
@ -253,7 +253,7 @@ struct IDirect3DDeviceImpl
|
||||||
void (*matrices_updated)(IDirect3DDeviceImpl *This, DWORD matrices);
|
void (*matrices_updated)(IDirect3DDeviceImpl *This, DWORD matrices);
|
||||||
void (*set_matrices)(IDirect3DDeviceImpl *This, DWORD matrices,
|
void (*set_matrices)(IDirect3DDeviceImpl *This, DWORD matrices,
|
||||||
D3DMATRIX *world_mat, D3DMATRIX *view_mat, D3DMATRIX *proj_mat);
|
D3DMATRIX *world_mat, D3DMATRIX *view_mat, D3DMATRIX *proj_mat);
|
||||||
void (*flush_to_framebuffer)(IDirect3DDeviceImpl *This, LPCRECT pRect);
|
void (*flush_to_framebuffer)(IDirect3DDeviceImpl *This, LPCRECT pRect, IDirectDrawSurfaceImpl *surf);
|
||||||
|
|
||||||
STATEBLOCK state_block;
|
STATEBLOCK state_block;
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ static BOOL opengl_flip( LPVOID dev, LPVOID drawable)
|
||||||
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_DIRTY) {
|
if (gl_d3d_dev->state == SURFACE_MEMORY_DIRTY) {
|
||||||
d3d_dev->flush_to_framebuffer(d3d_dev, NULL);
|
d3d_dev->flush_to_framebuffer(d3d_dev, NULL, gl_d3d_dev->lock_surf);
|
||||||
}
|
}
|
||||||
gl_d3d_dev->state = SURFACE_GL;
|
gl_d3d_dev->state = SURFACE_GL;
|
||||||
gl_d3d_dev->front_state = SURFACE_GL;
|
gl_d3d_dev->front_state = SURFACE_GL;
|
||||||
|
@ -1128,7 +1128,7 @@ static void draw_primitive_strided(IDirect3DDeviceImpl *This,
|
||||||
|
|
||||||
ENTER_GL();
|
ENTER_GL();
|
||||||
if (glThis->state == SURFACE_MEMORY_DIRTY) {
|
if (glThis->state == SURFACE_MEMORY_DIRTY) {
|
||||||
This->flush_to_framebuffer(This, NULL);
|
This->flush_to_framebuffer(This, NULL, glThis->lock_surf);
|
||||||
}
|
}
|
||||||
LEAVE_GL();
|
LEAVE_GL();
|
||||||
|
|
||||||
|
@ -2466,7 +2466,7 @@ static HRESULT d3ddevice_clear(IDirect3DDeviceImpl *This,
|
||||||
|
|
||||||
if (glThis->state == SURFACE_MEMORY_DIRTY) {
|
if (glThis->state == SURFACE_MEMORY_DIRTY) {
|
||||||
/* TODO: optimize here the case where Clear changes all the screen... */
|
/* TODO: optimize here the case where Clear changes all the screen... */
|
||||||
This->flush_to_framebuffer(This, NULL);
|
This->flush_to_framebuffer(This, NULL, glThis->lock_surf);
|
||||||
}
|
}
|
||||||
glThis->state = SURFACE_GL;
|
glThis->state = SURFACE_GL;
|
||||||
|
|
||||||
|
@ -2738,8 +2738,18 @@ static void d3ddevice_lock_update(IDirectDrawSurfaceImpl* This, LPCRECT pRect, D
|
||||||
|
|
||||||
if ((This->surface_desc.ddsCaps.dwCaps & (DDSCAPS_FRONTBUFFER|DDSCAPS_PRIMARYSURFACE)) != 0) {
|
if ((This->surface_desc.ddsCaps.dwCaps & (DDSCAPS_FRONTBUFFER|DDSCAPS_PRIMARYSURFACE)) != 0) {
|
||||||
is_front = TRUE;
|
is_front = TRUE;
|
||||||
|
if ((gl_d3d_dev->front_state != SURFACE_GL) &&
|
||||||
|
(gl_d3d_dev->front_lock_surf != This)) {
|
||||||
|
ERR("Change of front buffer.. Expect graphic corruptions !\n");
|
||||||
|
}
|
||||||
|
gl_d3d_dev->front_lock_surf = This;
|
||||||
} else if ((This->surface_desc.ddsCaps.dwCaps & (DDSCAPS_BACKBUFFER)) == (DDSCAPS_BACKBUFFER)) {
|
} else if ((This->surface_desc.ddsCaps.dwCaps & (DDSCAPS_BACKBUFFER)) == (DDSCAPS_BACKBUFFER)) {
|
||||||
is_front = FALSE;
|
is_front = FALSE;
|
||||||
|
if ((gl_d3d_dev->state != SURFACE_GL) &&
|
||||||
|
(gl_d3d_dev->lock_surf != This)) {
|
||||||
|
ERR("Change of back buffer.. Expect graphic corruptions !\n");
|
||||||
|
}
|
||||||
|
gl_d3d_dev->lock_surf = This;
|
||||||
} else {
|
} else {
|
||||||
ERR("Wrong surface type for locking !\n");
|
ERR("Wrong surface type for locking !\n");
|
||||||
return;
|
return;
|
||||||
|
@ -2848,10 +2858,9 @@ static void d3ddevice_lock_update(IDirectDrawSurfaceImpl* This, LPCRECT pRect, D
|
||||||
|
|
||||||
#define UNLOCK_TEX_SIZE 256
|
#define UNLOCK_TEX_SIZE 256
|
||||||
|
|
||||||
static void d3ddevice_flush_to_frame_buffer(IDirect3DDeviceImpl *d3d_dev, LPCRECT pRect) {
|
static void d3ddevice_flush_to_frame_buffer(IDirect3DDeviceImpl *d3d_dev, LPCRECT pRect, IDirectDrawSurfaceImpl *surf) {
|
||||||
GLenum buffer_type, buffer_color;
|
GLenum buffer_type, buffer_color;
|
||||||
RECT loc_rect;
|
RECT loc_rect;
|
||||||
IDirectDrawSurfaceImpl *surf = d3d_dev->surface;
|
|
||||||
IDirect3DDeviceGLImpl* gl_d3d_dev = (IDirect3DDeviceGLImpl*) d3d_dev;
|
IDirect3DDeviceGLImpl* gl_d3d_dev = (IDirect3DDeviceGLImpl*) d3d_dev;
|
||||||
GLint depth_test, alpha_test, cull_face, lighting, min_tex, max_tex, tex_env, blend, stencil_test;
|
GLint depth_test, alpha_test, cull_face, lighting, min_tex, max_tex, tex_env, blend, stencil_test;
|
||||||
GLuint initial_texture;
|
GLuint initial_texture;
|
||||||
|
@ -3016,7 +3025,7 @@ static void d3ddevice_unlock_update(IDirectDrawSurfaceImpl* This, LPCRECT pRect)
|
||||||
ENTER_GL();
|
ENTER_GL();
|
||||||
glGetIntegerv(GL_DRAW_BUFFER, &prev_draw);
|
glGetIntegerv(GL_DRAW_BUFFER, &prev_draw);
|
||||||
glDrawBuffer(GL_FRONT);
|
glDrawBuffer(GL_FRONT);
|
||||||
d3d_dev->flush_to_framebuffer(d3d_dev, pRect);
|
d3d_dev->flush_to_framebuffer(d3d_dev, pRect, gl_d3d_dev->front_lock_surf);
|
||||||
glDrawBuffer(prev_draw);
|
glDrawBuffer(prev_draw);
|
||||||
LEAVE_GL();
|
LEAVE_GL();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -208,7 +208,7 @@ static void execute(IDirect3DExecuteBufferImpl *This,
|
||||||
ENTER_GL();
|
ENTER_GL();
|
||||||
|
|
||||||
if (((IDirect3DDeviceGLImpl *) lpDevice)->state == SURFACE_MEMORY_DIRTY) {
|
if (((IDirect3DDeviceGLImpl *) lpDevice)->state == SURFACE_MEMORY_DIRTY) {
|
||||||
lpDevice->flush_to_framebuffer(lpDevice, NULL);
|
lpDevice->flush_to_framebuffer(lpDevice, NULL, ((IDirect3DDeviceGLImpl *) lpDevice)->lock_surf);
|
||||||
}
|
}
|
||||||
((IDirect3DDeviceGLImpl *) lpDevice)->state = SURFACE_GL;
|
((IDirect3DDeviceGLImpl *) lpDevice)->state = SURFACE_GL;
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "mesa_private.h"
|
#include "mesa_private.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
|
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
|
||||||
|
WINE_DECLARE_DEBUG_CHANNEL(ddraw_geom);
|
||||||
|
|
||||||
HRESULT WINAPI
|
HRESULT WINAPI
|
||||||
Main_IDirect3DVertexBufferImpl_7_1T_QueryInterface(LPDIRECT3DVERTEXBUFFER7 iface,
|
Main_IDirect3DVertexBufferImpl_7_1T_QueryInterface(LPDIRECT3DVERTEXBUFFER7 iface,
|
||||||
|
@ -352,25 +353,25 @@ process_vertices_strided(IDirect3DVertexBufferImpl *This,
|
||||||
copy_and_next(dest_ptr, tex_coord, 2 * sizeof(D3DVALUE));
|
copy_and_next(dest_ptr, tex_coord, 2 * sizeof(D3DVALUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TRACE_ON(ddraw)) {
|
if (TRACE_ON(ddraw_geom)) {
|
||||||
if ((dwVertexTypeDesc & D3DFVF_POSITION_MASK) == D3DFVF_XYZ) {
|
if ((dwVertexTypeDesc & D3DFVF_POSITION_MASK) == D3DFVF_XYZ) {
|
||||||
D3DVALUE *position =
|
D3DVALUE *position =
|
||||||
(D3DVALUE *) (((char *) lpStrideData->position.lpvData) + i * lpStrideData->position.dwStride);
|
(D3DVALUE *) (((char *) lpStrideData->position.lpvData) + i * lpStrideData->position.dwStride);
|
||||||
TRACE(" %f %f %f", position[0], position[1], position[2]);
|
TRACE_(ddraw_geom)(" %f %f %f", position[0], position[1], position[2]);
|
||||||
} else if ((dwVertexTypeDesc & D3DFVF_POSITION_MASK) == D3DFVF_XYZRHW) {
|
} else if ((dwVertexTypeDesc & D3DFVF_POSITION_MASK) == D3DFVF_XYZRHW) {
|
||||||
D3DVALUE *position =
|
D3DVALUE *position =
|
||||||
(D3DVALUE *) (((char *) lpStrideData->position.lpvData) + i * lpStrideData->position.dwStride);
|
(D3DVALUE *) (((char *) lpStrideData->position.lpvData) + i * lpStrideData->position.dwStride);
|
||||||
TRACE(" %f %f %f %f", position[0], position[1], position[2], position[3]);
|
TRACE_(ddraw_geom)(" %f %f %f %f", position[0], position[1], position[2], position[3]);
|
||||||
}
|
}
|
||||||
if (dwVertexTypeDesc & D3DFVF_NORMAL) {
|
if (dwVertexTypeDesc & D3DFVF_NORMAL) {
|
||||||
D3DVALUE *normal =
|
D3DVALUE *normal =
|
||||||
(D3DVALUE *) (((char *) lpStrideData->normal.lpvData) + i * lpStrideData->normal.dwStride);
|
(D3DVALUE *) (((char *) lpStrideData->normal.lpvData) + i * lpStrideData->normal.dwStride);
|
||||||
TRACE(" / %f %f %f", normal[0], normal[1], normal[2]);
|
TRACE_(ddraw_geom)(" / %f %f %f", normal[0], normal[1], normal[2]);
|
||||||
}
|
}
|
||||||
if (dwVertexTypeDesc & D3DFVF_DIFFUSE) {
|
if (dwVertexTypeDesc & D3DFVF_DIFFUSE) {
|
||||||
DWORD *color_d =
|
DWORD *color_d =
|
||||||
(DWORD *) (((char *) lpStrideData->diffuse.lpvData) + i * lpStrideData->diffuse.dwStride);
|
(DWORD *) (((char *) lpStrideData->diffuse.lpvData) + i * lpStrideData->diffuse.dwStride);
|
||||||
TRACE(" / %02lx %02lx %02lx %02lx",
|
TRACE_(ddraw_geom)(" / %02lx %02lx %02lx %02lx",
|
||||||
(*color_d >> 16) & 0xFF,
|
(*color_d >> 16) & 0xFF,
|
||||||
(*color_d >> 8) & 0xFF,
|
(*color_d >> 8) & 0xFF,
|
||||||
(*color_d >> 0) & 0xFF,
|
(*color_d >> 0) & 0xFF,
|
||||||
|
@ -379,7 +380,7 @@ process_vertices_strided(IDirect3DVertexBufferImpl *This,
|
||||||
if (dwVertexTypeDesc & D3DFVF_SPECULAR) {
|
if (dwVertexTypeDesc & D3DFVF_SPECULAR) {
|
||||||
DWORD *color_s =
|
DWORD *color_s =
|
||||||
(DWORD *) (((char *) lpStrideData->specular.lpvData) + i * lpStrideData->specular.dwStride);
|
(DWORD *) (((char *) lpStrideData->specular.lpvData) + i * lpStrideData->specular.dwStride);
|
||||||
TRACE(" / %02lx %02lx %02lx %02lx",
|
TRACE_(ddraw_geom)(" / %02lx %02lx %02lx %02lx",
|
||||||
(*color_s >> 16) & 0xFF,
|
(*color_s >> 16) & 0xFF,
|
||||||
(*color_s >> 8) & 0xFF,
|
(*color_s >> 8) & 0xFF,
|
||||||
(*color_s >> 0) & 0xFF,
|
(*color_s >> 0) & 0xFF,
|
||||||
|
@ -389,9 +390,9 @@ process_vertices_strided(IDirect3DVertexBufferImpl *This,
|
||||||
D3DVALUE *tex_coord =
|
D3DVALUE *tex_coord =
|
||||||
(D3DVALUE *) (((char *) lpStrideData->textureCoords[tex_index].lpvData) +
|
(D3DVALUE *) (((char *) lpStrideData->textureCoords[tex_index].lpvData) +
|
||||||
i * lpStrideData->textureCoords[tex_index].dwStride);
|
i * lpStrideData->textureCoords[tex_index].dwStride);
|
||||||
TRACE(" / %f %f", tex_coord[0], tex_coord[1]);
|
TRACE_(ddraw_geom)(" / %f %f", tex_coord[0], tex_coord[1]);
|
||||||
}
|
}
|
||||||
TRACE("\n");
|
TRACE_(ddraw_geom)("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1004,9 +1004,6 @@ Main_DirectDrawSurface_Lock(LPDIRECTDRAWSURFACE7 iface, LPRECT prect,
|
||||||
/* First, copy the Surface description */
|
/* First, copy the Surface description */
|
||||||
DD_STRUCT_COPY_BYSIZE(pDDSD,&(This->surface_desc));
|
DD_STRUCT_COPY_BYSIZE(pDDSD,&(This->surface_desc));
|
||||||
|
|
||||||
TRACE("locked surface returning description : \n");
|
|
||||||
if (TRACE_ON(ddraw)) DDRAW_dump_surface_desc(pDDSD);
|
|
||||||
|
|
||||||
/* Used to optimize the D3D Device locking */
|
/* Used to optimize the D3D Device locking */
|
||||||
This->lastlocktype = flags & (DDLOCK_READONLY|DDLOCK_WRITEONLY);
|
This->lastlocktype = flags & (DDLOCK_READONLY|DDLOCK_WRITEONLY);
|
||||||
|
|
||||||
|
@ -1014,8 +1011,7 @@ Main_DirectDrawSurface_Lock(LPDIRECTDRAWSURFACE7 iface, LPRECT prect,
|
||||||
* (Not documented.) */
|
* (Not documented.) */
|
||||||
if (prect != NULL) {
|
if (prect != NULL) {
|
||||||
TRACE(" lprect: %ldx%ld-%ldx%ld\n",
|
TRACE(" lprect: %ldx%ld-%ldx%ld\n",
|
||||||
prect->top,prect->left,prect->bottom,prect->right
|
prect->top,prect->left,prect->bottom,prect->right);
|
||||||
);
|
|
||||||
if ((prect->top < 0) ||
|
if ((prect->top < 0) ||
|
||||||
(prect->left < 0) ||
|
(prect->left < 0) ||
|
||||||
(prect->bottom < 0) ||
|
(prect->bottom < 0) ||
|
||||||
|
@ -1033,6 +1029,9 @@ Main_DirectDrawSurface_Lock(LPDIRECTDRAWSURFACE7 iface, LPRECT prect,
|
||||||
This->lock_update(This, NULL, flags);
|
This->lock_update(This, NULL, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TRACE("locked surface returning description : \n");
|
||||||
|
if (TRACE_ON(ddraw)) DDRAW_dump_surface_desc(pDDSD);
|
||||||
|
|
||||||
return DD_OK;
|
return DD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,6 +123,7 @@ typedef struct IDirect3DDeviceGLImpl
|
||||||
|
|
||||||
GLuint unlock_tex;
|
GLuint unlock_tex;
|
||||||
SURFACE_STATE state, front_state;
|
SURFACE_STATE state, front_state;
|
||||||
|
IDirectDrawSurfaceImpl *lock_surf, *front_lock_surf;
|
||||||
} IDirect3DDeviceGLImpl;
|
} IDirect3DDeviceGLImpl;
|
||||||
|
|
||||||
/* This is for the OpenGL additions... */
|
/* This is for the OpenGL additions... */
|
||||||
|
|
Loading…
Reference in New Issue