DXGL r261 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r260‎ | r261 | r262 >
Date:13:19, 8 September 2012
Author:admin
Status:new
Tags:
Comment:
Add cull caps.
Fix texture stage alpha shader.
Modified paths:
  • /ddraw/glDirect3D.cpp (modified) (history)
  • /ddraw/glDirectDraw.cpp (modified) (history)
  • /ddraw/shadergen.cpp (modified) (history)
  • /ddraw/texture.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirect3D.cpp
@@ -34,7 +34,7 @@
3535 D3DDEVCAPS_TEXTUREVIDEOMEMORY | D3DDEVCAPS_TLVERTEXSYSTEMMEMORY | D3DDEVCAPS_TLVERTEXVIDEOMEMORY, // dwDevCaps
3636 { //dpcLineCaps
3737 sizeof(D3DPRIMCAPS),
38 - 0, // dwMiscCaps
 38+ D3DPMISCCAPS_CULLCCW | D3DPMISCCAPS_CULLCW | D3DPMISCCAPS_CULLNONE, // dwMiscCaps
3939 D3DPRASTERCAPS_SUBPIXEL | D3DPRASTERCAPS_ZTEST, //dwRasterCaps
4040 D3DPCMPCAPS_LESSEQUAL, //dwZCmpCaps
4141 D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR | D3DPBLENDCAPS_INVSRCCOLOR |
@@ -61,7 +61,7 @@
6262 },
6363 { //dpcTriCaps
6464 sizeof(D3DPRIMCAPS),
65 - 0, // dwMiscCaps
 65+ D3DPMISCCAPS_CULLCCW | D3DPMISCCAPS_CULLCW | D3DPMISCCAPS_CULLNONE, // dwMiscCaps
6666 D3DPRASTERCAPS_SUBPIXEL | D3DPRASTERCAPS_ZTEST, //dwRasterCaps
6767 D3DPCMPCAPS_LESSEQUAL, //dwZCmpCaps
6868 D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR | D3DPBLENDCAPS_INVSRCCOLOR |
@@ -102,7 +102,7 @@
103103 0.0f, //dvExtentsAdjust
104104 0, //dwStencilCaps
105105 8, //dwFVFCaps
106 - D3DTEXOPCAPS_SELECTARG1 | D3DTEXOPCAPS_SELECTARG2 | D3DTEXOPCAPS_MODULATE |
 106+ D3DTEXOPCAPS_DISABLE | D3DTEXOPCAPS_SELECTARG1 | D3DTEXOPCAPS_SELECTARG2 | D3DTEXOPCAPS_MODULATE |
107107 D3DTEXOPCAPS_MODULATE2X | D3DTEXOPCAPS_MODULATE4X | D3DTEXOPCAPS_ADD |
108108 D3DTEXOPCAPS_ADDSIGNED | D3DTEXOPCAPS_ADDSIGNED2X | D3DTEXOPCAPS_SUBTRACT |
109109 D3DTEXOPCAPS_ADDSMOOTH | D3DTEXOPCAPS_BLENDDIFFUSEALPHA | D3DTEXOPCAPS_BLENDTEXTUREALPHA |
Index: ddraw/glDirectDraw.cpp
@@ -695,7 +695,7 @@
696696 }
697697 if(riid == IID_IDirectDrawGammaControl)
698698 {
699 - FIXME("Add IDirect3D Interfaces\n");
 699+ FIXME("Add gamma control\n");
700700 ERR(DDERR_GENERIC);
701701 }
702702 /*if(riid == IID_IDDVideoPortContainer)
@@ -836,7 +836,7 @@
837837 ddCaps.dwCaps |= DDCAPS_3D;
838838 #endif
839839 ddCaps.dwCaps2 = DDCAPS2_CANRENDERWINDOWED | DDCAPS2_WIDESURFACES | DDCAPS2_NOPAGELOCKREQUIRED |
840 - DDCAPS2_FLIPINTERVAL | DDCAPS2_FLIPNOVSYNC;
 840+ DDCAPS2_FLIPINTERVAL | DDCAPS2_FLIPNOVSYNC | DDCAPS2_NONLOCALVIDMEM;
841841 ddCaps.dwFXCaps = DDFXCAPS_BLTSHRINKX | DDFXCAPS_BLTSHRINKY |
842842 DDFXCAPS_BLTSTRETCHX | DDFXCAPS_BLTSTRETCHY;
843843 ddCaps.dwPalCaps = DDPCAPS_8BIT | DDPCAPS_PRIMARYSURFACE;
Index: ddraw/shadergen.cpp
@@ -608,6 +608,7 @@
609609 string texarg;
610610 int args[4];
611611 bool texfail;
 612+ bool alphadisabled = false;
612613 const string blendargs[] = {"color","gl_Color","texture2DProj(texX,gl_TexCoord[Y])",
613614 "","texfactor","gl_SecondaryColor","vec3(1,1,1)","1",".rgb",".a",".aaa"};
614615 for(i = 0; i < 8; i++)
@@ -733,7 +734,8 @@
734735 fsrc->append("color.rgb = " + arg1 + " * color.a + " + arg2 + " * (1.0-color.a);\n");
735736 break;
736737 }
737 - if(((texstate[i].shaderid>>17) & 31) == D3DTOP_DISABLE)break;
 738+ if(((texstate[i].shaderid>>17) & 31) == D3DTOP_DISABLE)alphadisabled = true;
 739+ if(alphadisabled) continue;
738740 // Alpha stage
739741 texfail = false;
740742 args[2] = (texstate[i].shaderid>>22)&63;
@@ -794,7 +796,7 @@
795797 }
796798 if(args[3] & D3DTA_COMPLEMENT)
797799 arg2 = "(1.0 - " + arg2 + ")";
798 - if(!texfail) switch(texstate[i].shaderid & 31)
 800+ if(!texfail) switch((texstate[i].shaderid>>17) & 31)
799801 {
800802 case D3DTOP_DISABLE:
801803 default:
Index: ddraw/texture.cpp
@@ -110,8 +110,8 @@
111111 texture->format = GL_RGBA;
112112 texture->type = GL_UNSIGNED_INT_8_8_8_8_REV;
113113 break;
114 - case 7: // 16-bit RGBA3328
115 - FIXME("Unusual texture format RGBA3328 not supported");
 114+ case 7: // 16-bit RGBA8332
 115+ FIXME("Unusual texture format RGBA8332 not supported");
116116 break;
117117 case 8: // 16-bit RGBA4444
118118 texture->internalformat = GL_RGBA4;
@@ -118,7 +118,7 @@
119119 texture->format = GL_BGRA;
120120 texture->type = GL_UNSIGNED_SHORT_4_4_4_4_REV;
121121 break;
122 - case 9: // 16-bit RGBA5551
 122+ case 9: // 16-bit RGBA1555
123123 texture->internalformat = GL_RGB5_A1;
124124 texture->format = GL_BGRA;
125125 texture->type = GL_UNSIGNED_SHORT_1_5_5_5_REV;