DXGL r143 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r142‎ | r143 | r144 >
Date:01:06, 6 May 2012
Author:admin
Status:new
Tags:
Comment:
Set version 0.2.0
Fix EnumTextureFormats and add formats
Fix a couple of reference counts
Fix D3DTA_DIFFUSE and D3DTA_SPECULAR shader compilation
Modified paths:
  • /common/version.h (modified) (history)
  • /common/version.nsh (modified) (history)
  • /ddraw/glDirect3DDevice.cpp (modified) (history)
  • /ddraw/glDirectDrawSurface.cpp (modified) (history)
  • /ddraw/shadergen.cpp (modified) (history)

Diff [purge]

Index: common/version.h
@@ -3,13 +3,13 @@
44 #define __VERSION_H
55
66 #define DXGLMAJOR 0
7 -#define DXGLMINOR 1
8 -#define DXGLPOINT 6
 7+#define DXGLMINOR 2
 8+#define DXGLPOINT 0
99 #define DXGLBUILD 0
1010
1111 #define DXGLVERNUMBER DXGLMAJOR,DXGLMINOR,DXGLPOINT,DXGLBUILD
1212 #define DXGLVERQWORD (((unsigned __int64)DXGLMAJOR<<48)+((unsigned __int64)DXGLMINOR<<32)+((unsigned __int64)DXGLPOINT<<16)+(unsigned __int64)DXGLBUILD)
13 -#define DXGLVERSTRING "0.1.6.0"
 13+#define DXGLVERSTRING "0.2.0.0"
1414
1515
1616 #endif //__VERSION_H
Index: common/version.nsh
@@ -1 +1 @@
2 -!define PRODUCT_VERSION "0.1.6"
\ No newline at end of file
 2+!define PRODUCT_VERSION "0.2.0"
\ No newline at end of file
Index: ddraw/glDirect3DDevice.cpp
@@ -567,12 +567,15 @@
568568
569569 // Use EXACTLY one line per entry. Don't change layout of the list.
570570 const int TEXFMT_START = __LINE__;
571 -const DDPIXELFORMAT texformats[] =
 571+const DDPIXELFORMAT texpixelformats[] =
572572 {
573573 {sizeof(DDPIXELFORMAT),DDPF_RGB|DDPF_ALPHAPIXELS,0,16,0xF00,0xF0,0xF,0xF000},
574574 {sizeof(DDPIXELFORMAT),DDPF_RGB|DDPF_ALPHAPIXELS,0,16,0x7C00,0x3E0,0x1F,0x8000},
 575+ {sizeof(DDPIXELFORMAT),DDPF_RGB,0,16,0x7C00,0x3E0,0x1F,0},
575576 {sizeof(DDPIXELFORMAT),DDPF_RGB,0,16,0xF800,0x7E0,0x1F,0},
576 - {sizeof(DDPIXELFORMAT),DDPF_RGB|DDPF_ALPHAPIXELS,0,32,0xFF0000,0xFF00,0xFF,0xFF000000}
 577+ {sizeof(DDPIXELFORMAT),DDPF_RGB|DDPF_ALPHAPIXELS,0,32,0xFF0000,0xFF00,0xFF,0xFF000000},
 578+ {sizeof(DDPIXELFORMAT),DDPF_RGB,0,32,0xFF0000,0xFF00,0xFF,0},
 579+ {sizeof(DDPIXELFORMAT),DDPF_RGB,0,24,0xFF0000,0xFF00,0xFF,0}
577580 };
578581 const int TEXFMT_END = __LINE__ - 4;
579582 const int numtexfmt = TEXFMT_END-TEXFMT_START;
@@ -584,7 +587,7 @@
585588 DDPIXELFORMAT fmt;
586589 for(int i = 0; i < numtexfmt; i++)
587590 {
588 - memcpy(&fmt,&texformats[i],sizeof(DDPIXELFORMAT));
 591+ memcpy(&fmt,&texpixelformats[i],sizeof(DDPIXELFORMAT));
589592 result = lpd3dEnumPixelProc(&fmt,lpArg);
590593 if(result != D3DENUMRET_OK) return D3D_OK;
591594 }
@@ -664,6 +667,7 @@
665668 {
666669 if(!this) return DDERR_INVALIDPARAMS;
667670 if(!lplpRenderTarget) return DDERR_INVALIDPARAMS;
 671+ glDDS7->AddRef();
668672 *lplpRenderTarget = glDDS7;
669673 return D3D_OK;
670674 }
Index: ddraw/glDirectDrawSurface.cpp
@@ -1106,6 +1106,7 @@
11071107 HRESULT WINAPI glDirectDrawSurface7::GetDDInterface(LPVOID FAR *lplpDD)
11081108 {
11091109 if(!this) return DDERR_INVALIDPARAMS;
 1110+ ddInterface->AddRef();
11101111 *lplpDD = ddInterface;
11111112 return DD_OK;
11121113 }
Index: ddraw/shadergen.cpp
@@ -535,7 +535,7 @@
536536 int args[4];
537537 bool texfail;
538538 const string blendargs[] = {"color","gl_Color","texture2DProj(texX,gl_TexCoord[Y]).rgb",
539 - "texture2DProj(texX,gl_TexCoord[Y]).a","texfactor","gl_SecondaryColor","vec3(1,1,1)","1"};
 539+ "texture2DProj(texX,gl_TexCoord[Y]).a","texfactor","gl_SecondaryColor","vec3(1,1,1)","1",".rgb",".a"};
540540 for(i = 0; i < 8; i++)
541541 {
542542 if((texstate[i].shaderid & 31) == D3DTOP_DISABLE)break;
@@ -549,7 +549,7 @@
550550 arg1 = blendargs[0];
551551 break;
552552 case D3DTA_DIFFUSE:
553 - arg1 = blendargs[1];
 553+ arg1 = blendargs[1]+blendargs[8];
554554 break;
555555 case D3DTA_TEXTURE:
556556 if((texstate[i].shaderid >> 59)&1)
@@ -565,7 +565,7 @@
566566 arg1 = blendargs[4];
567567 break;
568568 case D3DTA_SPECULAR:
569 - arg1 = blendargs[5];
 569+ arg1 = blendargs[5]+blendargs[8];
570570 break;
571571 }
572572 args[1] = (texstate[i].shaderid>>11)&63;
@@ -576,7 +576,7 @@
577577 arg2 = blendargs[0];
578578 break;
579579 case D3DTA_DIFFUSE:
580 - arg2 = blendargs[1];
 580+ arg2 = blendargs[1]+blendargs[8];
581581 break;
582582 case D3DTA_TEXTURE:
583583 if((texstate[i].shaderid >> 59)&1)
@@ -592,7 +592,7 @@
593593 arg2 = blendargs[4];
594594 break;
595595 case D3DTA_SPECULAR:
596 - arg2 = blendargs[5];
 596+ arg2 = blendargs[5]+blendargs[8];
597597 break;
598598 }
599599 if(!texfail) switch(texstate[i].shaderid & 31)
@@ -610,10 +610,10 @@
611611 fsrc->append("color = " + arg1 + " * " + arg2 + ";\n");
612612 break;
613613 case D3DTOP_MODULATE2X:
614 - fsrc->append("color = (" + arg1 + " * " + arg2 + ") * 2;\n");
 614+ fsrc->append("color = (" + arg1 + " * " + arg2 + ") * 2.0;\n");
615615 break;
616616 case D3DTOP_MODULATE4X:
617 - fsrc->append("color = (" + arg1 + " * " + arg2 + ") * 4;\n");
 617+ fsrc->append("color = (" + arg1 + " * " + arg2 + ") * 4.0;\n");
618618 break;
619619 case D3DTOP_ADD:
620620 fsrc->append("color = " + arg1 + " + " + arg2 + ";\n");