Index: cfgmgr/ReadMe.txt |
— | — | @@ -155,8 +155,9 @@ |
156 | 156 | Valid settings:
|
157 | 157 | 0 - Nearest-neighbor stretching
|
158 | 158 | 1 - Bilinear interpolation
|
159 | | -2 - Bilinear interpolation, sharp color key
|
160 | | -3 - Bilinear interpolation, soft color key
|
| 159 | +2 - Bilinear interpolation, nearest-neighbor color key
|
| 160 | +3 - Bilinear interpolation, sharp color key
|
| 161 | +4 - Bilinear interpolation, soft color key
|
161 | 162 |
|
162 | 163 | Member BltThreshold
|
163 | 164 | INI Entry BltThreshold
|
— | — | @@ -428,6 +429,13 @@ |
429 | 430 | If nonzero, disables use of GLSL version 1.30. When combined with
|
430 | 431 | DebugNoGpuShader4 this will disable raster operations in DirectDraw.
|
431 | 432 |
|
| 433 | +Member DebugBlendDestColorKey
|
| 434 | +INI Entry DebugBlendDestColorKey
|
| 435 | +INI Group debug
|
| 436 | +REG_DWORD HKCU\DXGL\Profiles\<app>\DebugBlendDestColorKey
|
| 437 | +If nonzero, blends the texture used for destination color keying with the
|
| 438 | +source. For testing purposes only.
|
| 439 | +
|
432 | 440 | Member DebugMaxGLVersionMajor
|
433 | 441 | INI Entry DebugMaxGLVersionMajor
|
434 | 442 | INI Group debug
|
Index: cfgmgr/cfgmgr.c |
— | — | @@ -578,6 +578,7 @@ |
579 | 579 | cfg->DebugNoSamplerObjects = ReadBool(hKey, cfg->DebugNoSamplerObjects, &cfgmask->DebugNoSamplerObjects, _T("DebugNoSamplerObjects"));
|
580 | 580 | cfg->DebugNoGpuShader4 = ReadBool(hKey, cfg->DebugNoGpuShader4, &cfgmask->DebugNoGpuShader4, _T("DebugNoGpuShader4"));
|
581 | 581 | cfg->DebugNoGLSL130 = ReadBool(hKey, cfg->DebugNoGLSL130, &cfgmask->DebugNoGLSL130, _T("DebugNoGLSL130"));
|
| 582 | + cfg->DebugBlendDestColorKey = ReadBool(hKey, cfg->DebugBlendDestColorKey, &cfgmask->DebugBlendDestColorKey, _T("DebugBlendDestColorKey"));
|
582 | 583 | cfg->DebugMaxGLVersionMajor = ReadDWORD(hKey, cfg->DebugMaxGLVersionMajor, &cfgmask->DebugMaxGLVersionMajor, _T("DebugMaxGLVersionMajor"));
|
583 | 584 | cfg->DebugMaxGLVersionMinor = ReadDWORD(hKey, cfg->DebugMaxGLVersionMinor, &cfgmask->DebugMaxGLVersionMinor, _T("DebugMaxGLVersionMinor"));
|
584 | 585 | cfg->HackCrop640480to640400 = ReadBool(hKey, cfg->HackCrop640480to640400, &cfgmask->HackCrop640480to640400, _T("HackCrop640480to640400"));
|
— | — | @@ -716,6 +717,7 @@ |
717 | 718 | WriteBool(hKey, cfg->DebugNoSamplerObjects, cfgmask->DebugNoSamplerObjects, _T("DebugNoSamplerObjects"));
|
718 | 719 | WriteBool(hKey, cfg->DebugNoGpuShader4, cfgmask->DebugNoGpuShader4, _T("DebugNoGpuShader4"));
|
719 | 720 | WriteBool(hKey, cfg->DebugNoGLSL130, cfgmask->DebugNoGLSL130, _T("DebugNoGLSL130"));
|
| 721 | + WriteBool(hKey, cfg->DebugBlendDestColorKey, cfgmask->DebugBlendDestColorKey, _T("DebugBlendDestColorKey"));
|
720 | 722 | WriteDWORD(hKey, cfg->DebugMaxGLVersionMajor, cfgmask->DebugMaxGLVersionMajor, _T("DebugMaxGLVersionMajor"));
|
721 | 723 | WriteDWORD(hKey, cfg->DebugMaxGLVersionMinor, cfgmask->DebugMaxGLVersionMinor, _T("DebugMaxGLVersionMinor"));
|
722 | 724 | WriteBool(hKey, cfg->HackCrop640480to640400, cfgmask->HackCrop640480to640400, _T("HackCrop640480to640400"));
|
— | — | @@ -967,6 +969,7 @@ |
968 | 970 | if (!stricmp(name, "DebugNoSamplerObjects")) cfg->DebugNoSamplerObjects = INIBoolValue(value);
|
969 | 971 | if (!stricmp(name, "DebugNoGpuShader4")) cfg->DebugNoGpuShader4 = INIBoolValue(value);
|
970 | 972 | if (!stricmp(name, "DebugNoGLSL130")) cfg->DebugNoGLSL130 = INIBoolValue(value);
|
| 973 | + if (!stricmp(name, "DebugBlendDestColorKey")) cfg->DebugBlendDestColorKey = INIBoolValue(value);
|
971 | 974 | if (!stricmp(name, "DebugMaxGLVersionMajor")) cfg->DebugMaxGLVersionMajor = INIIntValue(value);
|
972 | 975 | if (!stricmp(name, "DebugMaxGLVersionMinor")) cfg->DebugMaxGLVersionMinor = INIIntValue(value);
|
973 | 976 | }
|
Index: cfgmgr/cfgmgr.h |
— | — | @@ -76,6 +76,7 @@ |
77 | 77 | BOOL DebugNoSamplerObjects;
|
78 | 78 | BOOL DebugNoGpuShader4;
|
79 | 79 | BOOL DebugNoGLSL130;
|
| 80 | + BOOL DebugBlendDestColorKey;
|
80 | 81 | DWORD DebugMaxGLVersionMajor;
|
81 | 82 | DWORD DebugMaxGLVersionMinor;
|
82 | 83 | // [hacks]
|
Index: ddraw/ShaderGen2D.cpp |
— | — | @@ -107,6 +107,7 @@ |
108 | 108 | static const char op_pattern[] = "patternst = vec2(mod(gl_FragCoord.x,float(patternsize.x))/float(patternsize.x),\n\
|
109 | 109 | mod(gl_FragCoord.y, float(patternsize.y)) / float(patternsize.y));\n\
|
110 | 110 | pattern = ivec4(texture2D(patterntex,patternst)*vec4(colorsizedest)+.5);\n";
|
| 111 | +static const char op_destoutdestblend[] = "gl_FragColor = (vec4(pixel)/vec4(colorsizedest)) * texture2D(desttex,gl_TexCoord[1].st);\n";
|
111 | 112 | static const char op_destout[] = "gl_FragColor = vec4(pixel)/vec4(colorsizedest);\n";
|
112 | 113 | static const char op_vertex[] = "vec4 xyzw = vec4(xy[0],xy[1],0,1);\n\
|
113 | 114 | mat4 proj = mat4(\n\
|
— | — | @@ -870,8 +871,11 @@ |
871 | 872 | }
|
872 | 873 | if (id & DDBLT_KEYDEST)
|
873 | 874 | {
|
874 | | - if (id & 0x40000000) String_Append(fsrc, op_ckeydestrange);
|
875 | | - else String_Append(fsrc, op_ckeydest);
|
| 875 | + if (!dxglcfg.DebugBlendDestColorKey)
|
| 876 | + {
|
| 877 | + if (id & 0x40000000) String_Append(fsrc, op_ckeydestrange);
|
| 878 | + else String_Append(fsrc, op_ckeydest);
|
| 879 | + }
|
876 | 880 | }
|
877 | 881 | if (id & DDBLT_ROP)
|
878 | 882 | {
|
— | — | @@ -879,8 +883,9 @@ |
880 | 884 | if (intproc) String_Append(fsrc, op_ROP[rop]);
|
881 | 885 | else String_Append(fsrc, op_ROP_float[rop]);
|
882 | 886 | }
|
883 | | -
|
884 | | - String_Append(fsrc, op_destout);
|
| 887 | + if (dxglcfg.DebugBlendDestColorKey && (id & DDBLT_KEYDEST))
|
| 888 | + String_Append(fsrc, op_destoutdestblend);
|
| 889 | + else String_Append(fsrc, op_destout);
|
885 | 890 | String_Append(fsrc, mainend);
|
886 | 891 | #ifdef _DEBUG
|
887 | 892 | OutputDebugStringA("2D blitter fragment shader:\n");
|
Index: ddraw/ShaderManager.cpp |
— | — | @@ -30,30 +30,58 @@ |
31 | 31 | const char frag_Texture[] = "\
|
32 | 32 | #version 110\n\
|
33 | 33 | uniform sampler2D tex0;\n\
|
34 | | -void main() \n\
|
35 | | -{ \n\
|
36 | | - gl_FragColor = texture2D( tex0, gl_TexCoord[0].st ); \n\
|
37 | | -} ";
|
| 34 | +void main()\n\
|
| 35 | +{\n\
|
| 36 | + gl_FragColor = texture2D( tex0, gl_TexCoord[0].st);\n\
|
| 37 | +}";
|
38 | 38 |
|
39 | 39 | const char frag_Pal256[] = "\
|
40 | 40 | #version 110\n\
|
41 | | -uniform sampler2D pal; \n\
|
42 | | -uniform sampler2D tex0; \n\
|
43 | | -void main() \n\
|
44 | | -{ \n\
|
45 | | - vec4 myindex = texture2D(tex0, gl_TexCoord[0].xy); \n\
|
| 41 | +uniform sampler2D pal;\n\
|
| 42 | +uniform sampler2D tex0;\n\
|
| 43 | +void main()\n\
|
| 44 | +{\n\
|
| 45 | + vec4 myindex = texture2D(tex0, gl_TexCoord[0].xy);\n\
|
46 | 46 | vec2 index = vec2(((myindex.x*(255.0/256.0))+(0.5/256.0)),0.5);\n\
|
47 | | - vec4 texel = texture2D(pal, index); \n\
|
48 | | - gl_FragColor = texel; \n\
|
49 | | -} ";
|
| 47 | + vec4 texel = texture2D(pal, index);\n\
|
| 48 | + gl_FragColor = texel;\n\
|
| 49 | +}";
|
50 | 50 |
|
51 | 51 | const char frag_clipstencil[] = "\
|
52 | 52 | #version 110\n\
|
53 | | -void main (void)\n\
|
| 53 | +void main ()\n\
|
54 | 54 | {\n\
|
55 | | - gl_FragColor = vec4(1.0,0.0,0.0,0.0);\n\
|
56 | | -} ";
|
| 55 | + gl_FragColor = vec4(1.0,0.0,0.0,0.0);\n\
|
| 56 | +}";
|
57 | 57 |
|
| 58 | +const char frag_prepsrckey[] = "\
|
| 59 | +#version 110\n\
|
| 60 | +uniform sampler2D tex0;\n\
|
| 61 | +uniform ivec3 ckey;\n\
|
| 62 | +uniform ivec4 colorsize;\n\
|
| 63 | +ivec4 pixel;\n\
|
| 64 | +void main()\n\
|
| 65 | +{\n\
|
| 66 | + pixel = ivec4(texture2D(tex0, gl_TexCoord[0].st)*vec4(colorsize) + .5);\n\
|
| 67 | + if (pixel.rgb == ckey) pixel.a = 0;\n\
|
| 68 | + else pixel.a = colorsize.a;\n\
|
| 69 | + gl_FragColor = vec4(pixel) / vec4(colorsize);\n\
|
| 70 | +}";
|
| 71 | +
|
| 72 | +const char frag_prepdestkey[] = "\
|
| 73 | +#version 110\n\
|
| 74 | +uniform sampler2D tex0;\n\
|
| 75 | +uniform ivec4 colorsize;\n\
|
| 76 | +uniform ivec3 ckey;\n\
|
| 77 | +ivec4 pixel;\n\
|
| 78 | +void main()\n\
|
| 79 | +{\n\
|
| 80 | + pixel = ivec4(texture2D(tex0, gl_TexCoord[0].st)*vec4(colorsize) + .5);\n\
|
| 81 | + if (pixel.rgb != ckey) pixel.a = 0;\n\
|
| 82 | + else pixel.a = colorsize.a;\n\
|
| 83 | + gl_FragColor = vec4(pixel) / vec4(colorsize);\n\
|
| 84 | +}";
|
| 85 | +
|
58 | 86 | const char vert_ortho[] = "\
|
59 | 87 | #version 110\n\
|
60 | 88 | uniform vec4 view;\n\
|
— | — | @@ -78,9 +106,11 @@ |
79 | 107 | const int SHADER_START = __LINE__;
|
80 | 108 | const SHADER shader_template[] =
|
81 | 109 | {
|
82 | | - {0,0, vert_ortho, frag_Texture, 0,-1,-1,-1},
|
83 | | - {0,0, vert_ortho, frag_Pal256, 0,-1,-1,-1},
|
84 | | - {0,0, vert_ortho, frag_clipstencil, 0,-1,-1,-1}
|
| 110 | + {0,0, vert_ortho, frag_Texture, 0,-1,-1,-1,-1,-1,-1,-1,-1},
|
| 111 | + {0,0, vert_ortho, frag_Pal256, 0,-1,-1,-1,-1,-1,-1,-1,-1},
|
| 112 | + {0,0, vert_ortho, frag_clipstencil, 0,-1,-1,-1,-1,-1,-1,-1,-1},
|
| 113 | + {0,0, vert_ortho, frag_prepsrckey, 0,-1,-1,-1,-1,-1,-1,-1,-1},
|
| 114 | + {0,0, vert_ortho, frag_prepdestkey, 0,-1,-1,-1,-1,-1,-1,-1,-1}
|
85 | 115 | };
|
86 | 116 | const int SHADER_END = __LINE__ - 4;
|
87 | 117 | const int NumberOfShaders = SHADER_END - SHADER_START;
|
— | — | @@ -120,6 +150,7 @@ |
121 | 151 | shaderman->shaders[i].tex0 = shaderman->ext->glGetUniformLocation(shaderman->shaders[i].prog,"tex0");
|
122 | 152 | shaderman->shaders[i].tex1 = shaderman->ext->glGetUniformLocation(shaderman->shaders[i].prog,"tex1");
|
123 | 153 | shaderman->shaders[i].ckey = shaderman->ext->glGetUniformLocation(shaderman->shaders[i].prog,"ckey");
|
| 154 | + shaderman->shaders[i].colorsize = shaderman->ext->glGetUniformLocation(shaderman->shaders[i].prog, "colorsize");
|
124 | 155 | shaderman->shaders[i].pal = shaderman->ext->glGetUniformLocation(shaderman->shaders[i].prog,"pal");
|
125 | 156 | shaderman->shaders[i].view = shaderman->ext->glGetUniformLocation(shaderman->shaders[i].prog,"view");
|
126 | 157 | }
|
Index: ddraw/glRenderer.cpp |
— | — | @@ -3035,7 +3035,7 @@ |
3036 | 3036 | BOOL usepattern = FALSE;
|
3037 | 3037 | LONG sizes[6];
|
3038 | 3038 | RECT srcrect;
|
3039 | | - RECT destrect;
|
| 3039 | + RECT destrect, destrect2;
|
3040 | 3040 | This->ddInterface->GetSizes(sizes);
|
3041 | 3041 | DWORD shaderid;
|
3042 | 3042 | DDSURFACEDESC2 ddsd;
|
— | — | @@ -3046,8 +3046,16 @@ |
3047 | 3047 | destrect.top = 0;
|
3048 | 3048 | destrect.right = ddsd.dwWidth;
|
3049 | 3049 | destrect.bottom = ddsd.dwHeight;
|
| 3050 | + destrect2 = destrect;
|
3050 | 3051 | }
|
3051 | | - else destrect = cmd->destrect;
|
| 3052 | + else
|
| 3053 | + {
|
| 3054 | + destrect = cmd->destrect;
|
| 3055 | + destrect2.left = 0;
|
| 3056 | + destrect2.top = 0;
|
| 3057 | + destrect2.right = destrect.right - destrect.left;
|
| 3058 | + destrect2.bottom = destrect.bottom - destrect.top;
|
| 3059 | + }
|
3052 | 3060 | if ((cmd->bltfx.dwSize == sizeof(DDBLTFX)) && (cmd->flags & DDBLT_ROP))
|
3053 | 3061 | {
|
3054 | 3062 | shaderid = PackROPBits(cmd->bltfx.dwROP, cmd->flags);
|
— | — | @@ -3056,14 +3064,19 @@ |
3057 | 3065 | }
|
3058 | 3066 | else shaderid = cmd->flags & 0xF2FAADFF;
|
3059 | 3067 | if (cmd->flags & DDBLT_KEYDEST) usedest = TRUE;
|
3060 | | - if (usedest)
|
| 3068 | + if (IsAlphaCKey())
|
3061 | 3069 | {
|
| 3070 | +
|
| 3071 | + }
|
| 3072 | + else if (usedest)
|
| 3073 | + {
|
| 3074 | + if (This->ext->GLEXT_GREMEDY_frame_terminator) This->ext->glFrameTerminatorGREMEDY();
|
3062 | 3075 | ShaderManager_SetShader(This->shaders, PROG_TEXTURE, NULL, 0);
|
3063 | | - glRenderer__DrawBackbufferRect(This, cmd->dest, destrect, PROG_TEXTURE);
|
| 3076 | + glRenderer__DrawBackbufferRect(This, cmd->dest, destrect, destrect2, PROG_TEXTURE);
|
3064 | 3077 | This->bltvertices[1].dests = This->bltvertices[3].dests = 0.;
|
3065 | 3078 | This->bltvertices[0].dests = This->bltvertices[2].dests = (GLfloat)(destrect.right - destrect.left) / (GLfloat)This->backbuffer->levels[0].ddsd.dwWidth;
|
3066 | 3079 | This->bltvertices[0].destt = This->bltvertices[1].destt = 1.;
|
3067 | | - This->bltvertices[2].destt = This->bltvertices[3].destt = 1.0-((GLfloat)(destrect.bottom - destrect.top) / (GLfloat)This->backbuffer->levels[0].ddsd.dwHeight);
|
| 3080 | + This->bltvertices[2].destt = This->bltvertices[3].destt = 1.0 - ((GLfloat)(destrect.bottom - destrect.top) / (GLfloat)This->backbuffer->levels[0].ddsd.dwHeight);
|
3068 | 3081 | }
|
3069 | 3082 | ShaderManager_SetShader(This->shaders, shaderid, NULL, 1);
|
3070 | 3083 | GenShader2D *shader = (GenShader2D*)This->shaders->gen3d->current_genshader;
|
— | — | @@ -3287,32 +3300,36 @@ |
3288 | 3301 | glUtil_SetFBO(This->util, NULL);
|
3289 | 3302 | }
|
3290 | 3303 |
|
3291 | | -void glRenderer__DrawBackbufferRect(glRenderer *This, glTexture *texture, RECT srcrect, int progtype)
|
| 3304 | +void glRenderer__DrawBackbufferRect(glRenderer *This, glTexture *texture, RECT srcrect, RECT destrect, int progtype)
|
3292 | 3305 | {
|
3293 | 3306 | GLfloat view[4];
|
3294 | 3307 | DDSURFACEDESC2 ddsd;
|
3295 | | - int x = srcrect.right - srcrect.left;
|
3296 | | - int y = srcrect.bottom - srcrect.top;
|
| 3308 | + int x1 = destrect.left;
|
| 3309 | + int x2 = destrect.right;
|
| 3310 | + int y1 = destrect.top;
|
| 3311 | + int y2 = destrect.bottom;
|
3297 | 3312 | glUtil_SetActiveTexture(This->util, 0);
|
3298 | 3313 | if (!This->backbuffer)
|
3299 | 3314 | {
|
3300 | 3315 | ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
|
3301 | 3316 | memcpy(&ddsd, &ddsdbackbuffer, sizeof(DDSURFACEDESC2));
|
3302 | | - ddsd.dwWidth = x;
|
3303 | | - ddsd.lPitch = x * 4;
|
3304 | | - ddsd.dwHeight = y;
|
3305 | | - glTexture_Create(&ddsd, &This->backbuffer, This, x, y, FALSE, TRUE);
|
| 3317 | + ddsd.dwWidth = x2;
|
| 3318 | + ddsd.lPitch = x2 * 4;
|
| 3319 | + ddsd.dwHeight = y2;
|
| 3320 | + glTexture_Create(&ddsd, &This->backbuffer, This, x2, y2, FALSE, TRUE);
|
3306 | 3321 | }
|
3307 | | - if ((This->backbuffer->levels[0].ddsd.dwWidth < x) || (This->backbuffer->levels[0].ddsd.dwHeight < y))
|
| 3322 | + if ((This->backbuffer->levels[0].ddsd.dwWidth < x2) || (This->backbuffer->levels[0].ddsd.dwHeight < y2))
|
3308 | 3323 | {
|
3309 | | - if (This->backbuffer->levels[0].ddsd.dwWidth > x) x = This->backbuffer->levels[0].ddsd.dwWidth;
|
3310 | | - if (This->backbuffer->levels[0].ddsd.dwHeight > y) y = This->backbuffer->levels[0].ddsd.dwHeight;
|
| 3324 | + if (This->backbuffer->levels[0].ddsd.dwWidth > x2) x2 = This->backbuffer->levels[0].ddsd.dwWidth;
|
| 3325 | + if (This->backbuffer->levels[0].ddsd.dwHeight > y2) y2 = This->backbuffer->levels[0].ddsd.dwHeight;
|
3311 | 3326 | ZeroMemory(&ddsd, sizeof(DDSURFACEDESC2));
|
3312 | 3327 | ddsd.dwSize = sizeof(DDSURFACEDESC2);
|
3313 | | - ddsd.dwWidth = x;
|
3314 | | - ddsd.dwHeight = y;
|
| 3328 | + ddsd.dwWidth = x2;
|
| 3329 | + ddsd.dwHeight = y2;
|
3315 | 3330 | ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT;
|
3316 | 3331 | glTexture__SetSurfaceDesc(This->backbuffer, &ddsd);
|
| 3332 | + x2 = destrect.right;
|
| 3333 | + y2 = destrect.bottom;
|
3317 | 3334 | }
|
3318 | 3335 | glUtil_SetFBOTextures(This->util, &This->fbo, This->backbuffer, NULL, 0, 0, FALSE);
|
3319 | 3336 | view[0] = view[2] = 0;
|
— | — | @@ -3328,10 +3345,10 @@ |
3329 | 3346 | This->bltvertices[0].s = This->bltvertices[2].s = (GLfloat)srcrect.right / (GLfloat)texture->levels[0].ddsd.dwWidth;
|
3330 | 3347 | This->bltvertices[0].t = This->bltvertices[1].t = (GLfloat)srcrect.top / (GLfloat)texture->levels[0].ddsd.dwHeight;
|
3331 | 3348 | This->bltvertices[2].t = This->bltvertices[3].t = (GLfloat)srcrect.bottom / (GLfloat)texture->levels[0].ddsd.dwHeight;
|
3332 | | - This->bltvertices[1].x = This->bltvertices[3].x = 0.;
|
3333 | | - This->bltvertices[0].x = This->bltvertices[2].x = (float)x;
|
3334 | | - This->bltvertices[0].y = This->bltvertices[1].y = 0.;
|
3335 | | - This->bltvertices[2].y = This->bltvertices[3].y = (float)y;
|
| 3349 | + This->bltvertices[1].x = This->bltvertices[3].x = (float)x1;
|
| 3350 | + This->bltvertices[0].x = This->bltvertices[2].x = (float)x2;
|
| 3351 | + This->bltvertices[0].y = This->bltvertices[1].y = (float)y1;
|
| 3352 | + This->bltvertices[2].y = This->bltvertices[3].y = (float)y2;
|
3336 | 3353 | glUtil_EnableArray(This->util, This->shaders->shaders[progtype].pos, TRUE);
|
3337 | 3354 | This->ext->glVertexAttribPointer(This->shaders->shaders[progtype].pos, 2, GL_FLOAT, GL_FALSE, sizeof(BltVertex), &This->bltvertices[0].x);
|
3338 | 3355 | glUtil_EnableArray(This->util, This->shaders->shaders[progtype].texcoord, TRUE);
|
Index: ddraw/glRenderer.h |
— | — | @@ -208,7 +208,7 @@ |
209 | 209 | void glRenderer__DrawScreen(glRenderer *This, glTexture *texture, glTexture *paltex, GLint vsync, glTexture *previous, BOOL setsync);
|
210 | 210 | void glRenderer__DeleteTexture(glRenderer *This, glTexture *texture);
|
211 | 211 | void glRenderer__DrawBackbuffer(glRenderer *This, glTexture **texture, int x, int y, int progtype, BOOL paletted, BOOL firstpass);
|
212 | | -void glRenderer__DrawBackbufferRect(glRenderer *This, glTexture *texture, RECT srcrect, int progtype);
|
| 212 | +void glRenderer__DrawBackbufferRect(glRenderer *This, glTexture *texture, RECT srcrect, RECT destrect, int progtype);
|
213 | 213 | void glRenderer__InitD3D(glRenderer *This, int zbuffer, int x, int y);
|
214 | 214 | void glRenderer__Clear(glRenderer *This, ClearCommand *cmd);
|
215 | 215 | void glRenderer__UpdateFVF(glRenderer *This, DWORD fvf);
|
Index: ddraw/struct.h |
— | — | @@ -337,6 +337,7 @@ |
338 | 338 | GLint tex0;
|
339 | 339 | GLint tex1;
|
340 | 340 | GLint ckey;
|
| 341 | + GLint colorsize;
|
341 | 342 | GLint pal;
|
342 | 343 | GLint view;
|
343 | 344 | } SHADER;
|
Index: ddraw/util.c |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | // DXGL
|
3 | | -// Copyright (C) 2013-2016 William Feely
|
| 3 | +// Copyright (C) 2013-2017 William Feely
|
4 | 4 |
|
5 | 5 | // This library is free software; you can redistribute it and/or
|
6 | 6 | // modify it under the terms of the GNU Lesser General Public
|
— | — | @@ -15,8 +15,6 @@ |
16 | 16 | // License along with this library; if not, write to the Free Software
|
17 | 17 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18 | 18 |
|
19 | | -// Note: Requires a SSE2 and AVX compatible compiler.
|
20 | | -
|
21 | 19 | #include "common.h"
|
22 | 20 | #include "util.h"
|
23 | 21 | #include "const.h"
|
— | — | @@ -137,6 +135,7 @@ |
138 | 136 | {0,0}, // ddckDestColorkey
|
139 | 137 | {0,0} // ddckSrcColorkey
|
140 | 138 | };
|
| 139 | +
|
141 | 140 | BOOL comp_bltfx(DDBLTFX *a, DDBLTFX *b, DWORD flags)
|
142 | 141 | {
|
143 | 142 | DDBLTFX comp_mask;
|
— | — | @@ -158,4 +157,11 @@ |
159 | 158 | AndMem(&comp_b, b, &comp_mask, sizeof(DDBLTFX));
|
160 | 159 | if (!memcmp(&comp_a, &comp_b, sizeof(DDBLTFX))) return FALSE;
|
161 | 160 | else return TRUE;
|
| 161 | +}
|
| 162 | +
|
| 163 | +BOOL IsAlphaCKey()
|
| 164 | +{
|
| 165 | + if ((dxglcfg.BltScale == 2) || (dxglcfg.BltScale == 3) || (dxglcfg.BltScale == 4))
|
| 166 | + return TRUE;
|
| 167 | + else return FALSE;
|
162 | 168 | } |
\ No newline at end of file |
Index: ddraw/util.h |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | // DXGL
|
3 | | -// Copyright (C) 2013-2016 William Feely
|
| 3 | +// Copyright (C) 2013-2017 William Feely
|
4 | 4 |
|
5 | 5 | // This library is free software; you can redistribute it and/or
|
6 | 6 | // modify it under the terms of the GNU Lesser General Public
|
— | — | @@ -27,6 +27,7 @@ |
28 | 28 | char IsWritablePointer(void *ptr, LONG_PTR size, BOOL preserve);
|
29 | 29 | void AndMem(void *dest, const void *a, const void *b, size_t size);
|
30 | 30 | BOOL comp_bltfx(DDBLTFX *a, DDBLTFX *b, DWORD flags);
|
| 31 | +BOOL IsAlphaCKey();
|
31 | 32 |
|
32 | 33 | #ifdef __cplusplus
|
33 | 34 | }
|
Index: dxgl-example.ini |
— | — | @@ -193,8 +193,9 @@ |
194 | 194 | ; The following values are valid:
|
195 | 195 | ; 0 - Nearest-neighbor stretching
|
196 | 196 | ; 1 - Bilinear interpolation
|
197 | | -; 2 - Bilinear interpolation, sharp color key
|
198 | | -; 3 - Bilinear interpolation, soft color key
|
| 197 | +; 2 - Bilinear interpolation, nearest-neighbor color key
|
| 198 | +; 3 - Bilinear interpolation, sharp color key
|
| 199 | +; 4 - Bilinear interpolation, soft color key
|
199 | 200 | BltScale = 0
|
200 | 201 |
|
201 | 202 | ; BltThreshold - Integer
|
— | — | @@ -482,6 +483,14 @@ |
483 | 484 | ; Default is false
|
484 | 485 | DebugNoGLSL130 = false
|
485 | 486 |
|
| 487 | +; DebugBlendDestColorKey - Boolean
|
| 488 | +; Blends the temporary texture used for destination color keying with the
|
| 489 | +; source. This can reveal if the temporary texture is aligning correctly
|
| 490 | +; with the destination coordinates being used for a Blt operation. This
|
| 491 | +; should only be enabled for development and regression testing purposes.
|
| 492 | +; Default is false
|
| 493 | +DebugBlendDestColorKey = false
|
| 494 | +
|
486 | 495 | ; DebugMaxGLVersionMajor - Integer
|
487 | 496 | ; Determines the maximum OpenGL major version available to DXGL.
|
488 | 497 | ; If the system has a lower OpenGL version that will take precedence.
|
Index: dxgl.sln |
— | — | @@ -1,6 +1,8 @@ |
2 | 2 |
|
3 | | -Microsoft Visual Studio Solution File, Format Version 11.00
|
4 | | -# Visual C++ Express 2010
|
| 3 | +Microsoft Visual Studio Solution File, Format Version 12.00
|
| 4 | +# Visual Studio 15
|
| 5 | +VisualStudioVersion = 15.0.27130.2010
|
| 6 | +MinimumVisualStudioVersion = 10.0.40219.1
|
5 | 7 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ddraw", "ddraw\ddraw.vcxproj", "{9F051466-EA2C-4195-80B1-1B7C5B3F4AC2}"
|
6 | 8 | ProjectSection(ProjectDependencies) = postProject
|
7 | 9 | {F142A341-5EE0-442D-A15F-98AE9B48DBAE} = {F142A341-5EE0-442D-A15F-98AE9B48DBAE}
|
— | — | @@ -38,11 +40,11 @@ |
39 | 41 | EndProject
|
40 | 42 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Installer", "Installer\Installer.vcxproj", "{4DC98095-5F42-4A44-962C-346ABEE2C9B6}"
|
41 | 43 | ProjectSection(ProjectDependencies) = postProject
|
| 44 | + {C59AC409-F7D0-4153-9874-184CA00D537B} = {C59AC409-F7D0-4153-9874-184CA00D537B}
|
42 | 45 | {8041FD11-3A2E-4EE9-A3FF-A9755803B7FB} = {8041FD11-3A2E-4EE9-A3FF-A9755803B7FB}
|
43 | 46 | {9F051466-EA2C-4195-80B1-1B7C5B3F4AC2} = {9F051466-EA2C-4195-80B1-1B7C5B3F4AC2}
|
44 | 47 | {3A14A469-504B-4E32-8F23-063F8A2A8B5D} = {3A14A469-504B-4E32-8F23-063F8A2A8B5D}
|
45 | 48 | {34883A93-DFE4-42EF-9DAE-BEE4D3FC87D0} = {34883A93-DFE4-42EF-9DAE-BEE4D3FC87D0}
|
46 | | - {DF380DA1-90DE-4174-9A1F-EEC16C5B5879} = {DF380DA1-90DE-4174-9A1F-EEC16C5B5879}
|
47 | 49 | {F822EDB0-63E2-4EB8-B80D-F72481CDE3E1} = {F822EDB0-63E2-4EB8-B80D-F72481CDE3E1}
|
48 | 50 | EndProjectSection
|
49 | 51 | EndProject
|
— | — | @@ -211,4 +213,7 @@ |
212 | 214 | GlobalSection(SolutionProperties) = preSolution
|
213 | 215 | HideSolutionNode = FALSE
|
214 | 216 | EndGlobalSection
|
| 217 | + GlobalSection(ExtensibilityGlobals) = postSolution
|
| 218 | + SolutionGuid = {8D61F2B9-4A44-441A-AE4C-9C589C9290B8}
|
| 219 | + EndGlobalSection
|
215 | 220 | EndGlobal
|
Index: dxglcfg/dxglcfg.cpp |
— | — | @@ -2006,7 +2006,11 @@ |
2007 | 2007 | *value = cfg->DebugNoGLSL130;
|
2008 | 2008 | *mask = cfgmask->DebugNoGLSL130;
|
2009 | 2009 | break;
|
2010 | | - /*case 8:
|
| 2010 | + case 8:
|
| 2011 | + *value = cfg->DebugBlendDestColorKey;
|
| 2012 | + *mask = cfgmask->DebugBlendDestColorKey;
|
| 2013 | + break;
|
| 2014 | + /*case 9:
|
2011 | 2015 | *value = cfg->DebugDisableErrors;
|
2012 | 2016 | *mask = cfgmask->DebugDisableErrors;
|
2013 | 2017 | break;*/
|
— | — | @@ -2053,7 +2057,11 @@ |
2054 | 2058 | cfg->DebugNoGLSL130 = value;
|
2055 | 2059 | cfgmask->DebugNoGLSL130 = mask;
|
2056 | 2060 | break;
|
2057 | | - /*case 8:
|
| 2061 | + case 8:
|
| 2062 | + cfg->DebugBlendDestColorKey = value;
|
| 2063 | + cfgmask->DebugBlendDestColorKey = mask;
|
| 2064 | + break;
|
| 2065 | + /*case 9:
|
2058 | 2066 | cfg->DebugDisableErrors = value;
|
2059 | 2067 | cfgmask->DebugDisableErrors = mask;
|
2060 | 2068 | break;*/
|
— | — | @@ -2679,10 +2687,12 @@ |
2680 | 2688 | SendDlgItemMessage(hTabs[1], IDC_BLTFILTER, CB_ADDSTRING, 0, (LPARAM)buffer);
|
2681 | 2689 | _tcscpy(buffer, _T("Bilinear"));
|
2682 | 2690 | SendDlgItemMessage(hTabs[1], IDC_BLTFILTER, CB_ADDSTRING, 1, (LPARAM)buffer);
|
| 2691 | + _tcscpy(buffer, _T("Bilinear, nearest colorkey"));
|
| 2692 | + SendDlgItemMessage(hTabs[1], IDC_BLTFILTER, CB_ADDSTRING, 2, (LPARAM)buffer);
|
2683 | 2693 | _tcscpy(buffer, _T("Bilinear, sharp colorkey"));
|
2684 | | - SendDlgItemMessage(hTabs[1], IDC_BLTFILTER, CB_ADDSTRING, 2, (LPARAM)buffer);
|
| 2694 | + SendDlgItemMessage(hTabs[1], IDC_BLTFILTER, CB_ADDSTRING, 3, (LPARAM)buffer);
|
2685 | 2695 | _tcscpy(buffer, _T("Bilinear, soft colorkey"));
|
2686 | | - SendDlgItemMessage(hTabs[1], IDC_BLTFILTER, CB_ADDSTRING, 3, (LPARAM)buffer);
|
| 2696 | + SendDlgItemMessage(hTabs[1], IDC_BLTFILTER, CB_ADDSTRING, 4, (LPARAM)buffer);
|
2687 | 2697 | SendDlgItemMessage(hTabs[1], IDC_BLTFILTER, CB_SETCURSEL, cfg->BltScale, 0);
|
2688 | 2698 | // Blt scaling threshold
|
2689 | 2699 | SendDlgItemMessage(hTabs[1], IDC_BLTTHRESHOLDSLIDER, TBM_SETRANGE, 0, 0xFE0000);
|
— | — | @@ -2909,6 +2919,8 @@ |
2910 | 2920 | SendDlgItemMessage(hTabs[4], IDC_DEBUGLIST, LB_ADDSTRING, 0, (LPARAM)buffer);
|
2911 | 2921 | _tcscpy(buffer, _T("Disable GLSL 1.30 support"));
|
2912 | 2922 | SendDlgItemMessage(hTabs[4], IDC_DEBUGLIST, LB_ADDSTRING, 0, (LPARAM)buffer);
|
| 2923 | + _tcscpy(buffer, _T("DEBUG: Blend destination color key texture with source"));
|
| 2924 | + SendDlgItemMessage(hTabs[4], IDC_DEBUGLIST, LB_ADDSTRING, 0, (LPARAM)buffer);
|
2913 | 2925 | /*_tcscpy(buffer, _T("Disable OpenGL errors (OpenGL 4.6+)"));
|
2914 | 2926 | SendDlgItemMessage(hTabs[4], IDC_DEBUGLIST, LB_ADDSTRING, 0, (LPARAM)buffer);*/
|
2915 | 2927 | // Max OpenGL
|