DXGL r919 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r918‎ | r919 | r920 >
Date:14:31, 5 May 2019
Author:admin
Status:new
Tags:
Comment:
More progress towards drawing overlays.
Modified paths:
  • /ddraw/glRenderer.cpp (modified) (history)

Diff [purge]

Index: ddraw/glRenderer.cpp
@@ -3395,7 +3395,8 @@
33963396 else if (usedest)
33973397 {
33983398 ShaderManager_SetShader(This->shaders, PROG_TEXTURE, NULL, 0);
3399 - glRenderer__DrawBackbufferRect(This, cmd->dest, destrect, destrect2, PROG_TEXTURE);
 3399+ if(!(cmd->flags & 0x80000000))
 3400+ (This, cmd->dest, destrect, destrect2, PROG_TEXTURE);
34003401 This->bltvertices[1].dests = This->bltvertices[3].dests = 0.0f;
34013402 This->bltvertices[0].dests = This->bltvertices[2].dests = (GLfloat)(destrect.right - destrect.left) / (GLfloat)This->backbuffer->levels[0].ddsd.dwWidth;
34023403 This->bltvertices[0].destt = This->bltvertices[1].destt = 1.0f;
@@ -3404,15 +3405,19 @@
34053406 ShaderManager_SetShader(This->shaders, shaderid, NULL, 1);
34063407 GenShader2D *shader = (GenShader2D*)This->shaders->gen3d->current_genshader;
34073408 glUtil_BlendEnable(This->util, FALSE);
3408 - do
 3409+ if (cmd->flags & 0x80000000) glUtil_SetFBO(This->util, NULL);
 3410+ else
34093411 {
3410 - if (glUtil_SetFBOSurface(This->util, cmd->dest, NULL, cmd->destlevel, 0, TRUE) == GL_FRAMEBUFFER_COMPLETE) break;
3411 - if (!cmd->dest->internalformats[1]) break;
3412 - glTexture__Repair(cmd->dest, TRUE);
3413 - glUtil_SetFBO(This->util, NULL);
3414 - cmd->dest->levels[cmd->destlevel].fbo.fbcolor = NULL;
3415 - cmd->dest->levels[cmd->destlevel].fbo.fbz = NULL;
3416 - } while (1);
 3412+ do
 3413+ {
 3414+ if (glUtil_SetFBOSurface(This->util, cmd->dest, NULL, cmd->destlevel, 0, TRUE) == GL_FRAMEBUFFER_COMPLETE) break;
 3415+ if (!cmd->dest->internalformats[1]) break;
 3416+ glTexture__Repair(cmd->dest, TRUE);
 3417+ glUtil_SetFBO(This->util, NULL);
 3418+ cmd->dest->levels[cmd->destlevel].fbo.fbcolor = NULL;
 3419+ cmd->dest->levels[cmd->destlevel].fbo.fbz = NULL;
 3420+ } while (1);
 3421+ }
34173422 glUtil_SetViewport(This->util,0,0,cmd->dest->bigwidth,cmd->dest->bigheight);
34183423 glUtil_DepthTest(This->util, FALSE);
34193424 DDSURFACEDESC2 ddsdSrc;
@@ -3435,8 +3440,16 @@
34363441 else srcrect = cmd->srcrect;
34373442 This->bltvertices[1].x = This->bltvertices[3].x = (GLfloat)destrect.left;
34383443 This->bltvertices[0].x = This->bltvertices[2].x = (GLfloat)destrect.right;
3439 - This->bltvertices[0].y = This->bltvertices[1].y = (GLfloat)ddsd.dwHeight - (GLfloat)destrect.top;
3440 - This->bltvertices[2].y = This->bltvertices[3].y = (GLfloat)ddsd.dwHeight - (GLfloat)destrect.bottom;
 3444+ if (cmd->flags & 0x80000000)
 3445+ {
 3446+ This->bltvertices[0].y = This->bltvertices[1].y = (GLfloat)ddsd.dwHeight;
 3447+ This->bltvertices[2].y = This->bltvertices[3].y = (GLfloat)ddsd.dwHeight;
 3448+ }
 3449+ else
 3450+ {
 3451+ This->bltvertices[0].y = This->bltvertices[1].y = (GLfloat)ddsd.dwHeight - (GLfloat)destrect.top;
 3452+ This->bltvertices[2].y = This->bltvertices[3].y = (GLfloat)ddsd.dwHeight - (GLfloat)destrect.bottom;
 3453+ }
34413454 if (cmd->src && (cmd->src->target == GL_TEXTURE_RECTANGLE))
34423455 {
34433456 This->bltvertices[1].s = This->bltvertices[3].s = (GLfloat)srcrect.left;
@@ -3515,7 +3528,8 @@
35163529 }
35173530 if (usedest && (shader->shader.uniforms[2] != -1))
35183531 {
3519 - glUtil_SetTexture(This->util, 9, This->backbuffer);
 3532+ if(cmd->flags & 0x80000000) glUtil_SetTexture(This->util, 9, cmd->dest);
 3533+ else glUtil_SetTexture(This->util, 9, This->backbuffer);
35203534 This->ext->glUniform1i(shader->shader.uniforms[2], 9);
35213535 }
35223536 if (usepattern && (shader->shader.uniforms[3] != -1))
@@ -4133,24 +4147,25 @@
41344148 This->ext->glDrawRangeElements(GL_TRIANGLE_STRIP,0,3,4,GL_UNSIGNED_SHORT,bltindices);
41354149 if (This->overlays)
41364150 {
 4151+ ZeroMemory(&bltcmd, sizeof(BltCommand));
41374152 for (i = 0; i < overlaycount; i++)
41384153 {
41394154 if (This->overlays[i].enabled)
41404155 {
41414156 bltcmd.flags = 0x80000000;
4142 - if (overlays[i].flags & DDOVER_DDFX)
 4157+ if (This->overlays[i].flags & DDOVER_DDFX)
41434158 {
4144 - if (overlays[i].flags & DDOVER_KEYDEST) bltcmd.flags |= DDBLT_KEYDEST;
4145 - if (overlays[i].flags & DDOVER_KEYDESTOVERRIDE)
 4159+ if (This->overlays[i].flags & DDOVER_KEYDEST) bltcmd.flags |= DDBLT_KEYDEST;
 4160+ if (This->overlays[i].flags & DDOVER_KEYDESTOVERRIDE)
41464161 {
41474162 bltcmd.flags |= DDBLT_KEYDESTOVERRIDE;
4148 - bltcmd.destkey = overlays[i].fx.dckDestColorkey;
 4163+ bltcmd.destkey = This->overlays[i].fx.dckDestColorkey;
41494164 }
4150 - if (overlays[i].flags & DDOVER_KEYSRC) bltcmd.flags |= DDBLT_KEYSRC;
4151 - if (overlays[i].flags & DDOVER_KEYSRCOVERRIDE)
 4165+ if (This->overlays[i].flags & DDOVER_KEYSRC) bltcmd.flags |= DDBLT_KEYSRC;
 4166+ if (This->overlays[i].flags & DDOVER_KEYSRCOVERRIDE)
41524167 {
41534168 bltcmd.flags |= DDBLT_KEYSRCOVERRIDE;
4154 - bltcmd.srckey = overlays[i].fx.dckSrcColorkey;
 4169+ bltcmd.srckey = This->overlays[i].fx.dckSrcColorkey;
41554170 }
41564171 }
41574172 bltcmd.src = This->overlays[i].texture;
@@ -4159,7 +4174,7 @@
41604175 bltcmd.dest = primary;
41614176 bltcmd.destlevel = 0;
41624177 bltcmd.destrect = This->overlays[i].destrect;
4163 - //FIXME: Finish Blt
 4178+ glRenderer__Blt(This, &bltcmd);
41644179 }
41654180 }
41664181 }