- fix FPS computation
- some TRACEing fixes - optimize BltFast locking rectangles
This commit is contained in:
parent
ae02c5d3ed
commit
51df9314d8
|
@ -212,8 +212,8 @@ inline static Drawable get_drawable( HDC hdc )
|
|||
|
||||
#ifdef COMPUTE_FPS
|
||||
|
||||
#define MEASUREMENT_WINDOW 20
|
||||
#define NUMBER_OF_WINDOWS 4
|
||||
#define MEASUREMENT_WINDOW 5
|
||||
#define NUMBER_OF_WINDOWS 10
|
||||
|
||||
static LONGLONG perf_freq;
|
||||
static LONGLONG perf_storage[NUMBER_OF_WINDOWS];
|
||||
|
@ -279,6 +279,7 @@ static BOOL opengl_flip( LPVOID dev, LPVOID drawable)
|
|||
current_window = 0;
|
||||
}
|
||||
perf_storage[current_window] = 0;
|
||||
measurements_in_window = 0;
|
||||
}
|
||||
} else {
|
||||
prev_time = current_time;
|
||||
|
|
|
@ -816,7 +816,7 @@ DIB_DirectDrawSurface_BltFast(LPDIRECTDRAWSURFACE7 iface, DWORD dstx,
|
|||
HRESULT ret = DD_OK;
|
||||
LPBYTE sbuf, dbuf;
|
||||
RECT rsrc2;
|
||||
|
||||
RECT lock_src, lock_dst;
|
||||
|
||||
if (TRACE_ON(ddraw)) {
|
||||
TRACE("(%p)->(%ld,%ld,%p,%p,%08lx)\n",
|
||||
|
@ -836,11 +836,9 @@ DIB_DirectDrawSurface_BltFast(LPDIRECTDRAWSURFACE7 iface, DWORD dstx,
|
|||
if (This->aux_bltfast(This, dstx, dsty, src, rsrc, trans) == DD_OK) return DD_OK;
|
||||
}
|
||||
|
||||
/* We need to lock the surfaces, or we won't get refreshes when done. */
|
||||
sdesc.dwSize = sizeof(sdesc);
|
||||
IDirectDrawSurface7_Lock(src, NULL,&sdesc,DDLOCK_READONLY, 0);
|
||||
ddesc.dwSize = sizeof(ddesc);
|
||||
IDirectDrawSurface7_Lock(iface,NULL,&ddesc,DDLOCK_WRITEONLY,0);
|
||||
/* Get the surface description without locking to first compute the width / height */
|
||||
ddesc = This->surface_desc;
|
||||
sdesc = (ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, src))->surface_desc;
|
||||
|
||||
if (!rsrc) {
|
||||
WARN("rsrc is NULL!\n");
|
||||
|
@ -850,20 +848,36 @@ DIB_DirectDrawSurface_BltFast(LPDIRECTDRAWSURFACE7 iface, DWORD dstx,
|
|||
rsrc->bottom = sdesc.dwHeight;
|
||||
}
|
||||
|
||||
bpp = GET_BPP(This->surface_desc);
|
||||
sbuf = (BYTE *)sdesc.lpSurface+(rsrc->top*sdesc.u1.lPitch)+rsrc->left*bpp;
|
||||
dbuf = (BYTE *)ddesc.lpSurface+(dsty*ddesc.u1.lPitch)+dstx* bpp;
|
||||
|
||||
|
||||
h=rsrc->bottom-rsrc->top;
|
||||
if (h>ddesc.dwHeight-dsty) h=ddesc.dwHeight-dsty;
|
||||
if (h>sdesc.dwHeight-rsrc->top) h=sdesc.dwHeight-rsrc->top;
|
||||
if (h<0) h=0;
|
||||
if (h<=0) return DDERR_INVALIDRECT;
|
||||
|
||||
w=rsrc->right-rsrc->left;
|
||||
if (w>ddesc.dwWidth-dstx) w=ddesc.dwWidth-dstx;
|
||||
if (w>sdesc.dwWidth-rsrc->left) w=sdesc.dwWidth-rsrc->left;
|
||||
if (w<0) w=0;
|
||||
if (w<=0) return DDERR_INVALIDRECT;
|
||||
|
||||
/* Now compute the locking rectangle... */
|
||||
lock_src.left = rsrc->left;
|
||||
lock_src.top = rsrc->top;
|
||||
lock_src.right = lock_src.left + w;
|
||||
lock_src.bottom = lock_src.top + h;
|
||||
|
||||
lock_dst.left = dstx;
|
||||
lock_dst.top = dsty;
|
||||
lock_dst.right = dstx + w;
|
||||
lock_dst.bottom = dsty + h;
|
||||
|
||||
/* We need to lock the surfaces, or we won't get refreshes when done. */
|
||||
sdesc.dwSize = sizeof(sdesc);
|
||||
IDirectDrawSurface7_Lock(src, &lock_src, &sdesc, DDLOCK_READONLY, 0);
|
||||
ddesc.dwSize = sizeof(ddesc);
|
||||
IDirectDrawSurface7_Lock(iface, &lock_dst, &ddesc, DDLOCK_WRITEONLY, 0);
|
||||
|
||||
bpp = GET_BPP(This->surface_desc);
|
||||
sbuf = (BYTE *) sdesc.lpSurface;
|
||||
dbuf = (BYTE *) ddesc.lpSurface;
|
||||
|
||||
if (trans & (DDBLTFAST_SRCCOLORKEY | DDBLTFAST_DESTCOLORKEY)) {
|
||||
DWORD keylow, keyhigh;
|
||||
|
@ -878,9 +892,9 @@ DIB_DirectDrawSurface_BltFast(LPDIRECTDRAWSURFACE7 iface, DWORD dstx,
|
|||
}
|
||||
|
||||
#define COPYBOX_COLORKEY(type) { \
|
||||
type *d = (type *)dbuf, *s = (type *)sbuf, tmp; \
|
||||
s = (type *) ((BYTE *) sdesc.lpSurface + (rsrc->top * sdesc.u1.lPitch) + rsrc->left * bpp); \
|
||||
d = (type *) ((BYTE *) ddesc.lpSurface + (dsty * ddesc.u1.lPitch) + dstx * bpp); \
|
||||
type *d, *s, tmp; \
|
||||
s = (type *) sdesc.lpSurface; \
|
||||
d = (type *) ddesc.lpSurface; \
|
||||
for (y = 0; y < h; y++) { \
|
||||
for (x = 0; x < w; x++) { \
|
||||
tmp = s[x]; \
|
||||
|
@ -911,9 +925,10 @@ DIB_DirectDrawSurface_BltFast(LPDIRECTDRAWSURFACE7 iface, DWORD dstx,
|
|||
dbuf += ddesc.u1.lPitch;
|
||||
}
|
||||
}
|
||||
|
||||
error:
|
||||
IDirectDrawSurface7_Unlock(iface, NULL);
|
||||
IDirectDrawSurface7_Unlock(src, NULL);
|
||||
IDirectDrawSurface7_Unlock(iface, &lock_dst);
|
||||
IDirectDrawSurface7_Unlock(src, &lock_src);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -1015,7 +1015,7 @@ Main_DirectDrawSurface_Lock(LPDIRECTDRAWSURFACE7 iface, LPRECT prect,
|
|||
* (Not documented.) */
|
||||
if (prect != NULL) {
|
||||
TRACE(" lprect: %ldx%ld-%ldx%ld\n",
|
||||
prect->top,prect->left,prect->bottom,prect->right);
|
||||
prect->left,prect->top,prect->right,prect->bottom);
|
||||
/* First do some sanity checkings on the rectangle we receive.
|
||||
DungeonSiege seems to gives us once a very bad rectangle for example */
|
||||
if ((prect->top < 0) ||
|
||||
|
|
|
@ -107,6 +107,11 @@ void set_render_state(IDirect3DDeviceImpl* This,
|
|||
ICOM_INTERFACE(tex, IDirectDrawSurface7));
|
||||
} break;
|
||||
|
||||
case D3DRENDERSTATE_ANTIALIAS: /* 2 */
|
||||
if (dwRenderState)
|
||||
ERR("D3DRENDERSTATE_ANTIALIAS not supported yet !\n");
|
||||
break;
|
||||
|
||||
case D3DRENDERSTATE_TEXTUREADDRESSU: /* 44 */
|
||||
case D3DRENDERSTATE_TEXTUREADDRESSV: /* 45 */
|
||||
case D3DRENDERSTATE_TEXTUREADDRESS: { /* 3 */
|
||||
|
|
Loading…
Reference in New Issue