DXGL r286 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r285‎ | r286 | r287 >
Date:01:42, 15 December 2012
Author:admin
Status:new
Tags:
Comment:
Adjust shader float-to-int calculation.
Fix DX5 blend state incorrectly enabled on DX6/DX7
Modified paths:
  • /ddraw/glDirect3DDevice.cpp (modified) (history)
  • /ddraw/shadergen.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirect3DDevice.cpp
@@ -57,7 +57,7 @@
5858 D3DFILTER_NEAREST, //texturemin
5959 D3DBLEND_ONE, //srcblend
6060 D3DBLEND_ZERO, //destblend 20
61 - D3DTBLEND_MODULATE, //texturemapblend
 61+ 0, //texturemapblend
6262 D3DCULL_CCW, //cullmode
6363 D3DCMP_LESSEQUAL, //zfunc
6464 0, //alpharef
@@ -1703,7 +1703,7 @@
17041704 SetRenderState(D3DRENDERSTATE_WRAPV,FALSE);
17051705 SetRenderState(D3DRENDERSTATE_TEXTUREMAG,D3DFILTER_NEAREST);
17061706 SetRenderState(D3DRENDERSTATE_TEXTUREMIN,D3DFILTER_NEAREST);
1707 - //SetRenderState(D3DRENDERSTATE_TEXTUREMAPBLEND,D3DTBLEND_MODULATE);
 1707+ SetRenderState(D3DRENDERSTATE_TEXTUREMAPBLEND,D3DTBLEND_MODULATE);
17081708 SetRenderState(D3DRENDERSTATE_SPECULARENABLE,TRUE);
17091709 }
17101710
Index: ddraw/shadergen.cpp
@@ -276,7 +276,7 @@
277277 static const char op_normalpassthru[] = "N = gl_NormalMatrix*nxyz;\n";
278278 static const char op_passthru[] = "gl_Position = vec4(((xyz.x/rhw)/(width/2.0))-1.0,((xyz.y/rhw)/(height/2.0))-1.0,(xyz.z/rhw),1.0/rhw);\n";
279279 static const char op_resetcolor[] = "diffuse = specular = vec4(0.0);\n\
280 -ambient = ambientcolor / 255.0;\n";
 280+ambient = ambientcolor / 255.5;\n";
281281 static const char op_dirlight[] = "DirLight(lightX);\n";
282282 static const char op_pointlight[] = "PointLight(lightX);\n";
283283 static const char op_spotlight[] = "SpotLight(lightX);\n";
@@ -899,22 +899,22 @@
900900 fsrc->append("discard;\n");
901901 break;
902902 case 1:
903 - fsrc->append("if(int(color.a * 255.0) >= alpharef) discard;");
 903+ fsrc->append("if(int(color.a * 255.5) >= alpharef) discard;");
904904 break;
905905 case 2:
906 - fsrc->append("if(int(color.a * 255.0) != alpharef) discard;");
 906+ fsrc->append("if(int(color.a * 255.5) != alpharef) discard;");
907907 break;
908908 case 3:
909 - fsrc->append("if(int(color.a * 255.0) > alpharef) discard;");
 909+ fsrc->append("if(int(color.a * 255.5) > alpharef) discard;");
910910 break;
911911 case 4:
912 - fsrc->append("if(int(color.a * 255.0) <= alpharef) discard;");
 912+ fsrc->append("if(int(color.a * 255.5) <= alpharef) discard;");
913913 break;
914914 case 5:
915 - fsrc->append("if(int(color.a * 255.0) == alpharef) discard;");
 915+ fsrc->append("if(int(color.a * 255.5) == alpharef) discard;");
916916 break;
917917 case 6:
918 - fsrc->append("if(int(color.a * 255.0) < alpharef) discard;");
 918+ fsrc->append("if(int(color.a * 255.5) < alpharef) discard;");
919919 break;
920920 case 7:
921921 default: