DXGL r280 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r279‎ | r280 | r281 >
Date:01:00, 7 December 2012
Author:admin
Status:new
Tags:
Comment:
Fix enabling/disabling lighting in shader generator.
Add D3DRENDERTSTATE_LIGHTING and D3DRENDERSTATE_COLORVERTEX to shader ID.
Modified paths:
  • /ddraw/glDirect3DDevice.cpp (modified) (history)
  • /ddraw/shadergen.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirect3DDevice.cpp
@@ -498,6 +498,8 @@
499499 if(noalpha) texstages[0].alphaop = D3DTOP_SELECTARG2;
500500 else texstages[0].alphaop = D3DTOP_MODULATE;
501501 }
 502+ if(renderstate[D3DRENDERSTATE_LIGHTING]) shader |= (1i64 << 59);
 503+ if(renderstate[D3DRENDERSTATE_COLORVERTEX]) shader |= (1i64 << 60);
502504 for(i = 0; i < 8; i++)
503505 {
504506 if(!texstages[i].dirty) continue;
Index: ddraw/shadergen.cpp
@@ -64,6 +64,8 @@
6565 Bit 49 - Normalize normals VS
6666 Bit 50 - Use transformed vertices VS
6767 Bits 51-58 - Point or spot light VS/FS
 68+Bit 59 - Enable lights VS/FS
 69+Bit 60 - Use vertex colors VS
6870 */
6971
7072 /* Bits in Texture Stage ID:
@@ -440,7 +442,8 @@
441443 // Uniforms
442444 vsrc->append(unif_ambient);
443445 if((id>>50)&1) vsrc->append(unif_size);
444 - numlights = (id>>18)&7;
 446+ if((id>>59)&1) numlights = (id>>18)&7;
 447+ else numlights = 0;
445448 if(numlights) // Lighting
446449 {
447450 vsrc->append(lightstruct);