Index: ddraw/glDirectDraw.cpp |
— | — | @@ -1442,7 +1442,7 @@ |
1443 | 1443 | glDD7->internalx = glDD7->screenx = dwWidth;
|
1444 | 1444 | glDD7->internaly = glDD7->screeny = dwHeight;
|
1445 | 1445 | if (glDD7->renderer && glDD7->primary) glRenderer_DrawScreen(glDD7->renderer, glDD7->primary->texture,
|
1446 | | - glDD7->primary->texture->palette, 0);
|
| 1446 | + glDD7->primary->texture->palette, 0, NULL);
|
1447 | 1447 | }
|
1448 | 1448 |
|
1449 | 1449 |
|
— | — | @@ -1952,7 +1952,7 @@ |
1953 | 1953 | if(dwFlags & 0xFFFFFFFA) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
1954 | 1954 | if(dwFlags == 5) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
1955 | 1955 | if(!lastsync) lastsync = true;
|
1956 | | - else if(primary) primary->RenderScreen(primary->texture,1);
|
| 1956 | + else if(primary) primary->RenderScreen(primary->texture,1,NULL);
|
1957 | 1957 | TRACE_EXIT(23,DD_OK);
|
1958 | 1958 | return DD_OK;
|
1959 | 1959 | }
|
Index: ddraw/glDirectDrawSurface.cpp |
— | — | @@ -833,7 +833,8 @@ |
834 | 834 | {
|
835 | 835 | TRACE_ENTER(3,14,this,14,lpDDSurfaceTargetOverride,9,dwFlags);
|
836 | 836 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
837 | | - HRESULT ret = Flip2(lpDDSurfaceTargetOverride,dwFlags);
|
| 837 | + glTexture *previous;
|
| 838 | + HRESULT ret = Flip2(lpDDSurfaceTargetOverride,dwFlags,&previous);
|
838 | 839 | if (ret != DD_OK) TRACE_RET(HRESULT, 23, ret);
|
839 | 840 | if(ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
|
840 | 841 | {
|
— | — | @@ -842,12 +843,12 @@ |
843 | 844 | swapinterval++;
|
844 | 845 | ddInterface->lastsync = false;
|
845 | 846 | }
|
846 | | - RenderScreen(texture,swapinterval);
|
| 847 | + RenderScreen(texture,swapinterval,previous);
|
847 | 848 | }
|
848 | 849 | TRACE_EXIT(23,ret);
|
849 | 850 | return ret;
|
850 | 851 | }
|
851 | | -HRESULT glDirectDrawSurface7::Flip2(LPDIRECTDRAWSURFACE7 lpDDSurfaceTargetOverride, DWORD dwFlags)
|
| 852 | +HRESULT glDirectDrawSurface7::Flip2(LPDIRECTDRAWSURFACE7 lpDDSurfaceTargetOverride, DWORD dwFlags, glTexture **previous)
|
852 | 853 | {
|
853 | 854 | TRACE_ENTER(3,14,this,14,lpDDSurfaceTargetOverride,9,dwFlags);
|
854 | 855 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
— | — | @@ -856,6 +857,7 @@ |
857 | 858 | if(!overlay && ((dwFlags & DDFLIP_ODD) || (dwFlags & DDFLIP_EVEN))) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
858 | 859 | DWORD i;
|
859 | 860 | glDirectDrawSurface7 *tmp;
|
| 861 | + if(previous) *previous = this->texture;
|
860 | 862 | if(dwFlags & DDFLIP_NOVSYNC) swapinterval=0;
|
861 | 863 | else
|
862 | 864 | {
|
— | — | @@ -883,8 +885,8 @@ |
884 | 886 | if(!success) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
885 | 887 | for(DWORD x = 0; x < i; x++)
|
886 | 888 | {
|
887 | | - if(x == i-1) {TRACE_RET(HRESULT,23,Flip2(NULL,dwFlags));}
|
888 | | - else Flip2(NULL,0);
|
| 889 | + if(x == i-1) {TRACE_RET(HRESULT,23,Flip2(NULL,dwFlags,NULL));}
|
| 890 | + else Flip2(NULL,0,NULL);
|
889 | 891 | }
|
890 | 892 | }
|
891 | 893 | if(ddsd.ddsCaps.dwCaps & DDSCAPS_FLIP)
|
— | — | @@ -1188,10 +1190,10 @@ |
1189 | 1191 | {
|
1190 | 1192 | if (ddInterface->lastsync)
|
1191 | 1193 | {
|
1192 | | - RenderScreen(texture, 1);
|
| 1194 | + RenderScreen(texture, 1, NULL);
|
1193 | 1195 | ddInterface->lastsync = false;
|
1194 | 1196 | }
|
1195 | | - else RenderScreen(texture, 0);
|
| 1197 | + else RenderScreen(texture, 0, NULL);
|
1196 | 1198 | }
|
1197 | 1199 | TRACE_EXIT(23,error);
|
1198 | 1200 | return error;
|
— | — | @@ -1391,10 +1393,10 @@ |
1392 | 1394 | {
|
1393 | 1395 | if(ddInterface->lastsync)
|
1394 | 1396 | {
|
1395 | | - RenderScreen(texture,1);
|
| 1397 | + RenderScreen(texture,1,NULL);
|
1396 | 1398 | ddInterface->lastsync = false;
|
1397 | 1399 | }
|
1398 | | - else RenderScreen(texture,0);
|
| 1400 | + else RenderScreen(texture,0,NULL);
|
1399 | 1401 | }
|
1400 | 1402 | TRACE_EXIT(23, DD_OK);
|
1401 | 1403 | return DD_OK;
|
— | — | @@ -1424,10 +1426,10 @@ |
1425 | 1427 | ERR(DDERR_GENERIC);
|
1426 | 1428 | }
|
1427 | 1429 |
|
1428 | | -void glDirectDrawSurface7::RenderScreen(glTexture *texture, int vsync)
|
| 1430 | +void glDirectDrawSurface7::RenderScreen(glTexture *texture, int vsync, glTexture *previous)
|
1429 | 1431 | {
|
1430 | 1432 | TRACE_ENTER(3,14,this,14,texture,14,vsync);
|
1431 | | - glRenderer_DrawScreen(ddInterface->renderer,texture, texture->palette, vsync);
|
| 1433 | + glRenderer_DrawScreen(ddInterface->renderer,texture, texture->palette, vsync, previous);
|
1432 | 1434 | TRACE_EXIT(0,0);
|
1433 | 1435 | }
|
1434 | 1436 | // ddraw 2+ api
|
Index: ddraw/glDirectDrawSurface.h |
— | — | @@ -112,12 +112,12 @@ |
113 | 113 | ULONG WINAPI ReleaseColor();
|
114 | 114 | //void SetFilter(int level, GLint mag, GLint min, glExtensions *ext, glUtil *util);
|
115 | 115 | void Restore2();
|
116 | | - HRESULT Flip2(LPDIRECTDRAWSURFACE7 lpDDSurfaceTargetOverride, DWORD dwFlags);
|
| 116 | + HRESULT Flip2(LPDIRECTDRAWSURFACE7 lpDDSurfaceTargetOverride, DWORD dwFlags, glTexture **previous);
|
117 | 117 | HRESULT AddAttachedSurface2(LPDIRECTDRAWSURFACE7 lpDDSAttachedSurface, IUnknown *iface);
|
118 | 118 | void SetTexture(glTexture *newtexture){ texture = newtexture; };
|
119 | 119 | glDirectDrawSurface7 *GetBackbuffer(){return backbuffer;};
|
120 | 120 | glDirectDrawSurface7 *GetZBuffer(){return zbuffer;};
|
121 | | - void RenderScreen(glTexture *texture, int vsync);
|
| 121 | + void RenderScreen(glTexture *texture, int vsync, glTexture *previous);
|
122 | 122 | // Special ddraw2->ddraw7 api
|
123 | 123 | HRESULT WINAPI Unlock2(LPVOID lpSurfaceData);
|
124 | 124 | HRESULT GetHandle(glDirect3DDevice7 *glD3DDev7, LPD3DTEXTUREHANDLE lpHandle);
|
Index: ddraw/glRenderer.cpp |
— | — | @@ -388,12 +388,13 @@ |
389 | 389 | * @param vsync
|
390 | 390 | * Vertical sync count
|
391 | 391 | */
|
392 | | -void glRenderer_DrawScreen(glRenderer *This, glTexture *texture, glTexture *paltex, GLint vsync)
|
| 392 | +void glRenderer_DrawScreen(glRenderer *This, glTexture *texture, glTexture *paltex, GLint vsync, glTexture *previous)
|
393 | 393 | {
|
394 | 394 | EnterCriticalSection(&This->cs);
|
395 | 395 | This->inputs[0] = texture;
|
396 | 396 | This->inputs[1] = paltex;
|
397 | 397 | This->inputs[2] = (void*)vsync;
|
| 398 | + This->inputs[3] = previous;
|
398 | 399 | This->opcode = OP_DRAWSCREEN;
|
399 | 400 | SetEvent(This->start);
|
400 | 401 | WaitForSingleObject(This->busy,INFINITE);
|
— | — | @@ -940,7 +941,7 @@ |
941 | 942 | break;
|
942 | 943 | case OP_DRAWSCREEN:
|
943 | 944 | glRenderer__DrawScreen(This,(glTexture*)This->inputs[0],(glTexture*)This->inputs[1],
|
944 | | - (GLint)This->inputs[2],true);
|
| 945 | + (GLint)This->inputs[2],(glTexture*)This->inputs[3],true);
|
945 | 946 | break;
|
946 | 947 | case OP_INITD3D:
|
947 | 948 | glRenderer__InitD3D(This,(int)This->inputs[0],(int)This->inputs[1],(int)This->inputs[2]);
|
— | — | @@ -1534,7 +1535,7 @@ |
1535 | 1536 | (ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)) ||
|
1536 | 1537 | ((ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) &&
|
1537 | 1538 | !(ddsd.ddsCaps.dwCaps & DDSCAPS_FLIP)))
|
1538 | | - glRenderer__DrawScreen(This,cmd->dest,cmd->dest->palette,0,false);
|
| 1539 | + glRenderer__DrawScreen(This,cmd->dest,cmd->dest->palette,0,NULL,false);
|
1539 | 1540 | This->outputs[0] = DD_OK;
|
1540 | 1541 | SetEvent(This->busy);
|
1541 | 1542 | }
|
— | — | @@ -1653,11 +1654,13 @@ |
1654 | 1655 | glUtil_SetFBO(This->util, NULL);
|
1655 | 1656 | }
|
1656 | 1657 |
|
1657 | | -void glRenderer__DrawScreen(glRenderer *This, glTexture *texture, glTexture *paltex, GLint vsync, BOOL setsync)
|
| 1658 | +void glRenderer__DrawScreen(glRenderer *This, glTexture *texture, glTexture *paltex, GLint vsync, glTexture *previous, BOOL setsync)
|
1658 | 1659 | {
|
1659 | 1660 | int progtype;
|
1660 | | - RECT r,r2;
|
| 1661 | + RECT r, r2;
|
1661 | 1662 | glUtil_BlendEnable(This->util, FALSE);
|
| 1663 | + if (previous) previous->levels[0].ddsd.ddsCaps.dwCaps &= ~DDSCAPS_FRONTBUFFER;
|
| 1664 | + texture->levels[0].ddsd.ddsCaps.dwCaps |= DDSCAPS_FRONTBUFFER;
|
1662 | 1665 | if((texture->levels[0].ddsd.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE))
|
1663 | 1666 | {
|
1664 | 1667 | GetClientRect(This->hWnd,&r);
|
Index: ddraw/glRenderer.h |
— | — | @@ -162,7 +162,7 @@ |
163 | 163 | void glRenderer_DownloadTexture(glRenderer *This, glTexture *texture, GLint level);
|
164 | 164 | HRESULT glRenderer_Blt(glRenderer *This, BltCommand *cmd);
|
165 | 165 | void glRenderer_MakeTexture(glRenderer *This, glTexture *texture);
|
166 | | -void glRenderer_DrawScreen(glRenderer *This, glTexture *texture, glTexture *paltex, GLint vsync);
|
| 166 | +void glRenderer_DrawScreen(glRenderer *This, glTexture *texture, glTexture *paltex, GLint vsync, glTexture *previous);
|
167 | 167 | void glRenderer_DeleteTexture(glRenderer *This, glTexture *texture);
|
168 | 168 | void glRenderer_InitD3D(glRenderer *This, int zbuffer, int x, int y);
|
169 | 169 | void glRenderer_Flush(glRenderer *This);
|
— | — | @@ -190,7 +190,7 @@ |
191 | 191 | void glRenderer__DownloadTexture(glRenderer *This, glTexture *texture, GLint level);
|
192 | 192 | void glRenderer__Blt(glRenderer *This, BltCommand *cmd);
|
193 | 193 | void glRenderer__MakeTexture(glRenderer *This, glTexture *texture);
|
194 | | -void glRenderer__DrawScreen(glRenderer *This, glTexture *texture, glTexture *paltex, GLint vsync, BOOL setsync);
|
| 194 | +void glRenderer__DrawScreen(glRenderer *This, glTexture *texture, glTexture *paltex, GLint vsync, glTexture *previous, BOOL setsync);
|
195 | 195 | void glRenderer__DeleteTexture(glRenderer *This, glTexture *texture);
|
196 | 196 | void glRenderer__DrawBackbuffer(glRenderer *This, glTexture **texture, int x, int y, int progtype);
|
197 | 197 | void glRenderer__DrawBackbufferRect(glRenderer *This, glTexture *texture, RECT srcrect, int progtype);
|