DXGL r306 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r305‎ | r306 | r307 >
Date:15:15, 13 January 2013
Author:admin
Status:new
Tags:
Comment:
Advertise fog in D3DDEVICEDESC7.
Assign fog color when fog is enabled but no fog type is selected.
Modified paths:
  • /ddraw/glDirect3D.cpp (modified) (history)
  • /ddraw/shadergen.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirect3D.cpp
@@ -35,7 +35,8 @@
3636 { //dpcLineCaps
3737 sizeof(D3DPRIMCAPS),
3838 D3DPMISCCAPS_CULLCCW | D3DPMISCCAPS_CULLCW | D3DPMISCCAPS_CULLNONE, // dwMiscCaps
39 - D3DPRASTERCAPS_SUBPIXEL | D3DPRASTERCAPS_ZTEST, //dwRasterCaps
 39+ D3DPRASTERCAPS_SUBPIXEL | D3DPRASTERCAPS_ZTEST | D3DPRASTERCAPS_FOGRANGE | D3DPRASTERCAPS_FOGTABLE |
 40+ D3DPRASTERCAPS_FOGVERTEX, //dwRasterCaps
4041 D3DPCMPCAPS_LESSEQUAL, //dwZCmpCaps
4142 D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR | D3DPBLENDCAPS_INVSRCCOLOR |
4243 D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA | D3DPBLENDCAPS_DESTALPHA |
@@ -47,7 +48,7 @@
4849 D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA | D3DPBLENDCAPS_BOTHINVSRCALPHA, //dwDestBlendCaps
4950 D3DPCMPCAPS_ALWAYS | D3DPCMPCAPS_EQUAL | D3DPCMPCAPS_GREATER | D3DPCMPCAPS_GREATEREQUAL |
5051 D3DPCMPCAPS_LESS | D3DPCMPCAPS_LESSEQUAL | D3DPCMPCAPS_NEVER | D3DPCMPCAPS_NOTEQUAL, //dwAlphaCmpCaps
51 - D3DPSHADECAPS_ALPHAGOURAUDBLEND | D3DPSHADECAPS_COLORGOURAUDRGB, //dwShadeCaps
 52+ D3DPSHADECAPS_ALPHAGOURAUDBLEND | D3DPSHADECAPS_COLORGOURAUDRGB | D3DPSHADECAPS_FOGGOURAUD, //dwShadeCaps
5253 D3DPTEXTURECAPS_ALPHA | D3DPTEXTURECAPS_PERSPECTIVE, //dwTextureCaps
5354 D3DPTFILTERCAPS_NEAREST | D3DPTFILTERCAPS_LINEAR | D3DPTFILTERCAPS_MIPNEAREST |
5455 D3DPTFILTERCAPS_MIPLINEAR | D3DPTFILTERCAPS_LINEARMIPNEAREST | D3DPTFILTERCAPS_LINEARMIPLINEAR |
@@ -63,7 +64,8 @@
6465 { //dpcTriCaps
6566 sizeof(D3DPRIMCAPS),
6667 D3DPMISCCAPS_CULLCCW | D3DPMISCCAPS_CULLCW | D3DPMISCCAPS_CULLNONE, // dwMiscCaps
67 - D3DPRASTERCAPS_SUBPIXEL | D3DPRASTERCAPS_ZTEST, //dwRasterCaps
 68+ D3DPRASTERCAPS_SUBPIXEL | D3DPRASTERCAPS_ZTEST | D3DPRASTERCAPS_FOGRANGE | D3DPRASTERCAPS_FOGTABLE |
 69+ D3DPRASTERCAPS_FOGVERTEX, //dwRasterCaps
6870 D3DPCMPCAPS_LESSEQUAL, //dwZCmpCaps
6971 D3DPBLENDCAPS_ZERO | D3DPBLENDCAPS_ONE | D3DPBLENDCAPS_SRCCOLOR | D3DPBLENDCAPS_INVSRCCOLOR |
7072 D3DPBLENDCAPS_SRCALPHA | D3DPBLENDCAPS_INVSRCALPHA | D3DPBLENDCAPS_DESTALPHA |
@@ -75,7 +77,7 @@
7678 D3DPBLENDCAPS_SRCALPHASAT | D3DPBLENDCAPS_BOTHSRCALPHA | D3DPBLENDCAPS_BOTHINVSRCALPHA, //dwDestBlendCaps
7779 D3DPCMPCAPS_ALWAYS | D3DPCMPCAPS_EQUAL | D3DPCMPCAPS_GREATER | D3DPCMPCAPS_GREATEREQUAL |
7880 D3DPCMPCAPS_LESS | D3DPCMPCAPS_LESSEQUAL | D3DPCMPCAPS_NEVER | D3DPCMPCAPS_NOTEQUAL, //dwAlphaCmpCaps
79 - D3DPSHADECAPS_ALPHAGOURAUDBLEND | D3DPSHADECAPS_COLORGOURAUDRGB, //dwShadeCaps
 81+ D3DPSHADECAPS_ALPHAGOURAUDBLEND | D3DPSHADECAPS_COLORGOURAUDRGB | D3DPSHADECAPS_FOGGOURAUD, //dwShadeCaps
8082 D3DPTEXTURECAPS_ALPHA | D3DPTEXTURECAPS_PERSPECTIVE, //dwTextureCaps
8183 D3DPTFILTERCAPS_NEAREST | D3DPTFILTERCAPS_LINEAR | D3DPTFILTERCAPS_MIPNEAREST |
8284 D3DPTFILTERCAPS_MIPLINEAR | D3DPTFILTERCAPS_LINEARMIPNEAREST | D3DPTFILTERCAPS_LINEARMIPLINEAR |
@@ -116,7 +118,7 @@
117119 IID_IDirect3DHALDevice, //deviceGUID
118120 0, //wMaxUserClipPlanes
119121 0, //wMaxVertexBlendMatrices
120 - D3DVTXPCAPS_DIRECTIONALLIGHTS|D3DVTXPCAPS_POSITIONALLIGHTS, //dwVertexProcessingCaps
 122+ D3DVTXPCAPS_DIRECTIONALLIGHTS|D3DVTXPCAPS_POSITIONALLIGHTS|D3DVTXPCAPS_VERTEXFOG, //dwVertexProcessingCaps
121123 0,0,0,0 //dwReserved1 through dwReserved4
122124 };
123125
Index: ddraw/shadergen.cpp
@@ -315,6 +315,7 @@
316316 gl_Fog.density * gl_Fog.density);\n";
317317 static const char op_fogclamp[] = "fogfactor = clamp(fogfactor,0.0,1.0);\n";
318318 static const char op_fogblend[] = "color = mix(gl_Fog.color,color,fogfactor);\n";
 319+static const char op_fogassign[] = "color = gl_Fog.color;\n";
319320
320321 // Functions
321322 static const char func_dirlight[] = "void DirLight(in Light light)\n\
@@ -1015,6 +1016,7 @@
10161017 fsrc->append(op_fogclamp);
10171018 fsrc->append(op_fogblend);
10181019 }
 1020+ if(((id>>61)&1) && !vertexfog && !pixelfog) fsrc->append(op_fogassign);
10191021 fsrc->append(op_colorfragout);
10201022 fsrc->append(mainend);
10211023 #ifdef _DEBUG