Index: ddraw/glDirectDrawSurface.cpp |
— | — | @@ -1976,6 +1976,12 @@ |
1977 | 1977 | if (overlay->flags & DDOVER_HIDE) overlays[i].enabled = FALSE;
|
1978 | 1978 | memcpy(&overlays[i], overlay, sizeof(OVERLAY));
|
1979 | 1979 | glTexture_AddRef(overlays[i].texture);
|
| 1980 | + if (ddInterface->lastsync)
|
| 1981 | + {
|
| 1982 | + RenderScreen(ddInterface->primary->texture, 1, NULL, TRUE, overlays, overlaycount);
|
| 1983 | + ddInterface->lastsync = false;
|
| 1984 | + }
|
| 1985 | + else RenderScreen(ddInterface->primary->texture, 0, NULL, TRUE, overlays, overlaycount);
|
1980 | 1986 | return DD_OK;
|
1981 | 1987 | }
|
1982 | 1988 | }
|
Index: ddraw/glRenderer.cpp |
— | — | @@ -3631,6 +3631,7 @@ |
3632 | 3632 | ddsd.lPitch = x2 * 4;
|
3633 | 3633 | ddsd.dwHeight = y2;
|
3634 | 3634 | glTexture_Create(&ddsd, &This->backbuffers[index], This, x2, y2, FALSE, TRUE, 0);
|
| 3635 | + glUtil_InitFBO(This->util, &This->backbuffers[index]->levels[0].fbo);
|
3635 | 3636 | }
|
3636 | 3637 | if((This->backbuffers[index]->levels[0].ddsd.dwWidth != x2) || (This->backbuffers[index]->levels[0].ddsd.dwHeight != y2))
|
3637 | 3638 | {
|
— | — | @@ -3641,32 +3642,35 @@ |
3642 | 3643 | ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT;
|
3643 | 3644 | glTexture__SetSurfaceDesc(This->backbuffers[index], &ddsd);
|
3644 | 3645 | }
|
3645 | | - glUtil_SetFBOTextures(This->util,&This->fbo,This->backbuffers[index],NULL,0,0,FALSE);
|
3646 | | - view[0] = view[2] = 0;
|
3647 | | - view[1] = (GLfloat)x2;
|
3648 | | - view[3] = (GLfloat)y2;
|
3649 | | - glUtil_SetViewport(This->util,0,0,x2,y2);
|
3650 | | - glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
3651 | | - glUtil_SetTexture(This->util,8,*texture);
|
3652 | | - *texture = This->backbuffers[index];
|
3653 | | - if (!paletted && firstpass && (dxglcfg.postfilter == 1))
|
3654 | | - glTexture__SetFilter(*texture, 8, GL_LINEAR, GL_LINEAR, This);
|
3655 | | - else glTexture__SetFilter(*texture, 8, GL_NEAREST, GL_NEAREST, This);
|
3656 | | - This->ext->glUniform1i(This->shaders->shaders[progtype].tex0, 8);
|
3657 | | - This->ext->glUniform4f(This->shaders->shaders[progtype].view,view[0],view[1],view[2],view[3]);
|
3658 | | - This->bltvertices[0].s = This->bltvertices[0].t = This->bltvertices[1].t = This->bltvertices[2].s = 1.;
|
3659 | | - This->bltvertices[1].s = This->bltvertices[2].t = This->bltvertices[3].s = This->bltvertices[3].t = 0.;
|
3660 | | - This->bltvertices[0].y = This->bltvertices[1].y = This->bltvertices[1].x = This->bltvertices[3].x = 0.;
|
3661 | | - This->bltvertices[0].x = This->bltvertices[2].x = (float)x2;
|
3662 | | - This->bltvertices[2].y = This->bltvertices[3].y = (float)y2;
|
3663 | | - glUtil_EnableArray(This->util,This->shaders->shaders[progtype].pos,TRUE);
|
3664 | | - This->ext->glVertexAttribPointer(This->shaders->shaders[progtype].pos,2,GL_FLOAT,GL_FALSE,sizeof(BltVertex),&This->bltvertices[0].x);
|
3665 | | - glUtil_EnableArray(This->util,This->shaders->shaders[progtype].texcoord,TRUE);
|
3666 | | - This->ext->glVertexAttribPointer(This->shaders->shaders[progtype].texcoord,2,GL_FLOAT,GL_FALSE,sizeof(BltVertex),&This->bltvertices[0].s);
|
3667 | | - glUtil_SetCull(This->util,D3DCULL_NONE);
|
3668 | | - glUtil_SetPolyMode(This->util,D3DFILL_SOLID);
|
3669 | | - This->ext->glDrawRangeElements(GL_TRIANGLE_STRIP,0,3,4,GL_UNSIGNED_SHORT,bltindices);
|
3670 | | - glUtil_SetFBO(This->util, NULL);
|
| 3646 | + if (texture)
|
| 3647 | + {
|
| 3648 | + glUtil_SetFBOTextures(This->util, &This->fbo, This->backbuffers[index], NULL, 0, 0, FALSE);
|
| 3649 | + view[0] = view[2] = 0;
|
| 3650 | + view[1] = (GLfloat)x2;
|
| 3651 | + view[3] = (GLfloat)y2;
|
| 3652 | + glUtil_SetViewport(This->util, 0, 0, x2, y2);
|
| 3653 | + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
| 3654 | + glUtil_SetTexture(This->util, 8, *texture);
|
| 3655 | + *texture = This->backbuffers[index];
|
| 3656 | + if (!paletted && firstpass && (dxglcfg.postfilter == 1))
|
| 3657 | + glTexture__SetFilter(*texture, 8, GL_LINEAR, GL_LINEAR, This);
|
| 3658 | + else glTexture__SetFilter(*texture, 8, GL_NEAREST, GL_NEAREST, This);
|
| 3659 | + This->ext->glUniform1i(This->shaders->shaders[progtype].tex0, 8);
|
| 3660 | + This->ext->glUniform4f(This->shaders->shaders[progtype].view, view[0], view[1], view[2], view[3]);
|
| 3661 | + This->bltvertices[0].s = This->bltvertices[0].t = This->bltvertices[1].t = This->bltvertices[2].s = 1.;
|
| 3662 | + This->bltvertices[1].s = This->bltvertices[2].t = This->bltvertices[3].s = This->bltvertices[3].t = 0.;
|
| 3663 | + This->bltvertices[0].y = This->bltvertices[1].y = This->bltvertices[1].x = This->bltvertices[3].x = 0.;
|
| 3664 | + This->bltvertices[0].x = This->bltvertices[2].x = (float)x2;
|
| 3665 | + This->bltvertices[2].y = This->bltvertices[3].y = (float)y2;
|
| 3666 | + glUtil_EnableArray(This->util, This->shaders->shaders[progtype].pos, TRUE);
|
| 3667 | + This->ext->glVertexAttribPointer(This->shaders->shaders[progtype].pos, 2, GL_FLOAT, GL_FALSE, sizeof(BltVertex), &This->bltvertices[0].x);
|
| 3668 | + glUtil_EnableArray(This->util, This->shaders->shaders[progtype].texcoord, TRUE);
|
| 3669 | + This->ext->glVertexAttribPointer(This->shaders->shaders[progtype].texcoord, 2, GL_FLOAT, GL_FALSE, sizeof(BltVertex), &This->bltvertices[0].s);
|
| 3670 | + glUtil_SetCull(This->util, D3DCULL_NONE);
|
| 3671 | + glUtil_SetPolyMode(This->util, D3DFILL_SOLID);
|
| 3672 | + This->ext->glDrawRangeElements(GL_TRIANGLE_STRIP, 0, 3, 4, GL_UNSIGNED_SHORT, bltindices);
|
| 3673 | + glUtil_SetFBO(This->util, NULL);
|
| 3674 | + }
|
3671 | 3675 | }
|
3672 | 3676 |
|
3673 | 3677 | void glRenderer__DrawBackbufferRect(glRenderer *This, glTexture *texture, RECT srcrect, RECT destrect, int progtype, int index)
|
— | — | @@ -4072,7 +4076,12 @@ |
4073 | 4077 | view[2] = 0;
|
4074 | 4078 | view[3] = (GLfloat)texture->bigheight;
|
4075 | 4079 | }
|
4076 | | - glUtil_SetFBO(This->util, NULL);
|
| 4080 | + if (This->overlays)
|
| 4081 | + {
|
| 4082 | + glRenderer__DrawBackbuffer(This, NULL, viewport[2], viewport[3], 0, FALSE, FALSE, 1);
|
| 4083 | + glUtil_SetFBOTexture(This->util, &This->backbuffers[1]->levels[0].fbo, This->backbuffers[1], NULL, 0, 0, FALSE);
|
| 4084 | + }
|
| 4085 | + else glUtil_SetFBO(This->util, NULL);
|
4077 | 4086 | glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
4078 | 4087 | if(This->ddInterface->GetBPP() == 8)
|
4079 | 4088 | {
|
— | — | @@ -4182,8 +4191,20 @@ |
4183 | 4192 | glRenderer__Blt(This, &bltcmd, TRUE);
|
4184 | 4193 | }
|
4185 | 4194 | }
|
| 4195 | + glUtil_SetFBO(This->util, NULL);
|
| 4196 | + ShaderManager_SetShader(This->shaders, PROG_TEXTURE, NULL, 0);
|
| 4197 | + progtype = PROG_TEXTURE;
|
| 4198 | + glUtil_SetTexture(This->util, 8, texture);
|
| 4199 | + This->ext->glUniform1i(This->shaders->shaders[progtype].tex0, 8);
|
| 4200 | + glUtil_EnableArray(This->util, This->shaders->shaders[progtype].pos, TRUE);
|
| 4201 | + This->ext->glVertexAttribPointer(This->shaders->shaders[progtype].pos, 2, GL_FLOAT, GL_FALSE, sizeof(BltVertex), &This->bltvertices[0].x);
|
| 4202 | + glUtil_EnableArray(This->util, This->shaders->shaders[progtype].texcoord, TRUE);
|
| 4203 | + This->ext->glVertexAttribPointer(This->shaders->shaders[progtype].texcoord, 2, GL_FLOAT, GL_FALSE, sizeof(BltVertex), &This->bltvertices[0].s);
|
| 4204 | + glUtil_SetCull(This->util, D3DCULL_NONE);
|
| 4205 | + glUtil_SetPolyMode(This->util, D3DFILL_SOLID);
|
| 4206 | + This->ext->glDrawRangeElements(GL_TRIANGLE_STRIP, 0, 3, 4, GL_UNSIGNED_SHORT, bltindices);
|
4186 | 4207 | }
|
4187 | | - glFlush();
|
| 4208 | + if(dxglcfg.SingleBufferDevice) glFlush();
|
4188 | 4209 | if(This->hWnd) SwapBuffers(This->hDC);
|
4189 | 4210 | else
|
4190 | 4211 | {
|