Index: ddraw/glDirectDrawSurface.cpp |
— | — | @@ -699,12 +699,12 @@ |
700 | 700 | if (dwFlags & DDBLT_KEYSRCOVERRIDE)
|
701 | 701 | {
|
702 | 702 | if(!lpDDBltFx) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
703 | | - if(dwFlags) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 703 | + if(dwFlags & DDBLT_KEYSRC) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
704 | 704 | }
|
705 | 705 | if (dwFlags & DDBLT_KEYDESTOVERRIDE)
|
706 | 706 | {
|
707 | 707 | if (!lpDDBltFx) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
708 | | - if (dwFlags) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 708 | + if (dwFlags & DDBLT_KEYDEST) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
709 | 709 | }
|
710 | 710 | if (dwFlags & DDBLT_KEYSRC)
|
711 | 711 | {
|
— | — | @@ -714,15 +714,27 @@ |
715 | 715 | if (((glDirectDrawSurface7*)lpDDSrcSurface)->ddsd.ddckCKSrcBlt.dwColorSpaceHighValue !=
|
716 | 716 | ((glDirectDrawSurface7*)lpDDSrcSurface)->ddsd.ddckCKSrcBlt.dwColorSpaceLowValue)
|
717 | 717 | cmd.flags |= 0x20000000;
|
718 | | - if(dwFlags & DDBLT_KEYSRCOVERRIDE) cmd.flags |= 0x20000000;
|
719 | 718 | }
|
| 719 | + if (dwFlags & DDBLT_KEYSRCOVERRIDE)
|
| 720 | + {
|
| 721 | + if (lpDDBltFx->ddckSrcColorkey.dwColorSpaceHighValue !=
|
| 722 | + lpDDBltFx->ddckSrcColorkey.dwColorSpaceLowValue) cmd.flags |= 0x20000000;
|
| 723 | + cmd.flags |= DDBLT_KEYSRC;
|
| 724 | + memcpy(&cmd.srckey, &lpDDBltFx->ddckSrcColorkey, sizeof(DDCOLORKEY));
|
| 725 | + }
|
720 | 726 | if (dwFlags & DDBLT_KEYDEST)
|
721 | 727 | {
|
722 | 728 | if (!(this->ddsd.dwFlags & DDSD_CKDESTBLT)) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
723 | 729 | if (this->ddsd.ddckCKDestBlt.dwColorSpaceHighValue != this->ddsd.ddckCKDestBlt.dwColorSpaceLowValue)
|
724 | 730 | cmd.flags |= 0x40000000;
|
725 | | - if(dwFlags & DDBLT_KEYDESTOVERRIDE) cmd.flags |= 0x40000000;
|
726 | 731 | }
|
| 732 | + if (dwFlags & DDBLT_KEYDESTOVERRIDE)
|
| 733 | + {
|
| 734 | + if (lpDDBltFx->ddckDestColorkey.dwColorSpaceHighValue !=
|
| 735 | + lpDDBltFx->ddckDestColorkey.dwColorSpaceLowValue) cmd.flags |= 0x40000000;
|
| 736 | + cmd.flags |= DDBLT_KEYDEST;
|
| 737 | + memcpy(&cmd.destkey, &lpDDBltFx->ddckDestColorkey, sizeof(DDCOLORKEY));
|
| 738 | + }
|
727 | 739 | glDirectDrawSurface7 *src = (glDirectDrawSurface7 *)lpDDSrcSurface;
|
728 | 740 | if (clipper)
|
729 | 741 | {
|
Index: ddraw/glRenderer.cpp |
— | — | @@ -3125,20 +3125,42 @@ |
3126 | 3126 | if (cmd->dest->levels[cmd->destlevel].fbo.fbz) glClear(GL_DEPTH_BUFFER_BIT);
|
3127 | 3127 | if (cmd->flags & DDBLT_COLORFILL) SetColorFillUniform(cmd->bltfx.dwFillColor, cmd->dest->colorsizes,
|
3128 | 3128 | cmd->dest->colororder, cmd->dest->colorbits, shader->shader.uniforms[12], This->ext);
|
3129 | | - if ((cmd->flags & DDBLT_KEYSRC) && (cmd->src && (cmd->src->levels[cmd->srclevel].ddsd.dwFlags & DDSD_CKSRCBLT)) && !(cmd->flags & DDBLT_COLORFILL))
|
| 3129 | + if ((cmd->flags & DDBLT_KEYSRC) && (cmd->src && ((cmd->src->levels[cmd->srclevel].ddsd.dwFlags & DDSD_CKSRCBLT))
|
| 3130 | + || (cmd->flags & DDBLT_KEYSRCOVERRIDE)) && !(cmd->flags & DDBLT_COLORFILL))
|
3130 | 3131 | {
|
3131 | | - SetColorKeyUniform(cmd->src->levels[cmd->srclevel].ddsd.ddckCKSrcBlt.dwColorSpaceLowValue, cmd->src->colorsizes,
|
3132 | | - cmd->src->colororder, shader->shader.uniforms[5], cmd->src->colorbits, This->ext);
|
3133 | | - if (cmd->flags & 0x20000000) SetColorKeyUniform(cmd->src->levels[cmd->srclevel].ddsd.ddckCKSrcBlt.dwColorSpaceHighValue, cmd->src->colorsizes,
|
3134 | | - cmd->src->colororder, shader->shader.uniforms[7], cmd->src->colorbits, This->ext);
|
| 3132 | + if (cmd->flags & DDBLT_KEYSRCOVERRIDE)
|
| 3133 | + {
|
| 3134 | + SetColorKeyUniform(cmd->bltfx.ddckSrcColorkey.dwColorSpaceLowValue, cmd->src->colorsizes,
|
| 3135 | + cmd->src->colororder, shader->shader.uniforms[5], cmd->src->colorbits, This->ext);
|
| 3136 | + if (cmd->flags & 0x20000000) SetColorKeyUniform(cmd->bltfx.ddckSrcColorkey.dwColorSpaceHighValue, cmd->src->colorsizes,
|
| 3137 | + cmd->src->colororder, shader->shader.uniforms[7], cmd->src->colorbits, This->ext);
|
| 3138 | + }
|
| 3139 | + else
|
| 3140 | + {
|
| 3141 | + SetColorKeyUniform(cmd->src->levels[cmd->srclevel].ddsd.ddckCKSrcBlt.dwColorSpaceLowValue, cmd->src->colorsizes,
|
| 3142 | + cmd->src->colororder, shader->shader.uniforms[5], cmd->src->colorbits, This->ext);
|
| 3143 | + if (cmd->flags & 0x20000000) SetColorKeyUniform(cmd->src->levels[cmd->srclevel].ddsd.ddckCKSrcBlt.dwColorSpaceHighValue, cmd->src->colorsizes,
|
| 3144 | + cmd->src->colororder, shader->shader.uniforms[7], cmd->src->colorbits, This->ext);
|
| 3145 | + }
|
3135 | 3146 | }
|
3136 | 3147 | if (!(cmd->flags & DDBLT_COLORFILL)) This->ext->glUniform1i(shader->shader.uniforms[1], 8);
|
3137 | | - if ((cmd->flags & DDBLT_KEYDEST) && (This && (cmd->dest->levels[cmd->destlevel].ddsd.dwFlags & DDSD_CKDESTBLT)))
|
| 3148 | + if ((cmd->flags & DDBLT_KEYDEST) && (This && ((cmd->dest->levels[cmd->destlevel].ddsd.dwFlags & DDSD_CKDESTBLT)
|
| 3149 | + || (cmd->flags & DDBLT_KEYDESTOVERRIDE))))
|
3138 | 3150 | {
|
3139 | | - SetColorKeyUniform(cmd->dest->levels[cmd->destlevel].ddsd.ddckCKDestBlt.dwColorSpaceLowValue, cmd->dest->colorsizes,
|
3140 | | - cmd->dest->colororder, shader->shader.uniforms[6], cmd->dest->colorbits, This->ext);
|
3141 | | - if (cmd->flags & 0x40000000) SetColorKeyUniform(cmd->dest->levels[cmd->destlevel].ddsd.ddckCKDestBlt.dwColorSpaceHighValue, cmd->dest->colorsizes,
|
3142 | | - cmd->dest->colororder, shader->shader.uniforms[8], cmd->dest->colorbits, This->ext);
|
| 3151 | + if (cmd->flags & DDBLT_KEYDESTOVERRIDE)
|
| 3152 | + {
|
| 3153 | + SetColorKeyUniform(cmd->bltfx.ddckDestColorkey.dwColorSpaceLowValue, cmd->dest->colorsizes,
|
| 3154 | + cmd->dest->colororder, shader->shader.uniforms[6], cmd->dest->colorbits, This->ext);
|
| 3155 | + if (cmd->flags & 0x40000000) SetColorKeyUniform(cmd->bltfx.ddckDestColorkey.dwColorSpaceHighValue, cmd->dest->colorsizes,
|
| 3156 | + cmd->dest->colororder, shader->shader.uniforms[8], cmd->dest->colorbits, This->ext);
|
| 3157 | + }
|
| 3158 | + else
|
| 3159 | + {
|
| 3160 | + SetColorKeyUniform(cmd->dest->levels[cmd->destlevel].ddsd.ddckCKDestBlt.dwColorSpaceLowValue, cmd->dest->colorsizes,
|
| 3161 | + cmd->dest->colororder, shader->shader.uniforms[6], cmd->dest->colorbits, This->ext);
|
| 3162 | + if (cmd->flags & 0x40000000) SetColorKeyUniform(cmd->dest->levels[cmd->destlevel].ddsd.ddckCKDestBlt.dwColorSpaceHighValue, cmd->dest->colorsizes,
|
| 3163 | + cmd->dest->colororder, shader->shader.uniforms[8], cmd->dest->colorbits, This->ext);
|
| 3164 | + }
|
3143 | 3165 | }
|
3144 | 3166 | if (usedest && (shader->shader.uniforms[2] != -1))
|
3145 | 3167 | {
|
Index: ddraw/struct.h |
— | — | @@ -385,6 +385,8 @@ |
386 | 386 | GLint alphadestlevel;
|
387 | 387 | GLint alphasrclevel;
|
388 | 388 | GLint patternlevel;
|
| 389 | + DDCOLORKEY srckey;
|
| 390 | + DDCOLORKEY destkey;
|
389 | 391 | }BltCommand;
|
390 | 392 |
|
391 | 393 | typedef struct ClearCommand
|
Index: dxgltest/surfacegen.cpp |
— | — | @@ -1456,7 +1456,7 @@ |
1457 | 1457 | {
|
1458 | 1458 | for (int x = 0; x < 16; x++)
|
1459 | 1459 | {
|
1460 | | - i = ((x + ((15 - y) << 4)) + 128) & 255;
|
| 1460 | + i = 255 - (x + ((15 - y) << 4));
|
1461 | 1461 | buffer[x + (ddsd.lPitch*y)] = i;
|
1462 | 1462 | }
|
1463 | 1463 | }
|