DXGL r138 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r137‎ | r138 | r139 >
Date:15:47, 16 April 2012
Author:admin
Status:new
Tags:
Comment:
Get textures working
Modified paths:
  • /ddraw/glDirect3DDevice.cpp (modified) (history)
  • /ddraw/shadergen.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirect3DDevice.cpp
@@ -372,7 +372,6 @@
373373 for(int i = 0; i < 8; i++)
374374 if(VertexType[i+10].data) numtextures++;
375375 shader |= (__int64)numtextures << 31;
376 - if(VertexType[1].data) shader |= (1i64 << 34);
377376 if(VertexType[8].data) shader |= (1i64<<35);
378377 if(VertexType[9].data) shader |= (1i64<<36);
379378 if(VertexType[7].data) shader |= (1i64 << 37);
@@ -391,6 +390,7 @@
392391 if(VertexType[i+2].data) blendweights++;
393392 shader |= (__int64)blendweights << 46;
394393 if(renderstate[D3DRENDERSTATE_NORMALIZENORMALS]) shader |= (1i64 << 49);
 394+ if(VertexType[1].data) shader |= (1i64 << 50);
395395 //TODO: Implement texture stages.
396396 for(i = 0; i < 8; i++)
397397 {
@@ -473,7 +473,7 @@
474474 int numtex = (dwVertexTypeDesc&D3DFVF_TEXCOUNT_MASK)>>D3DFVF_TEXCOUNT_SHIFT;
475475 for(i = 0; i < 8; i++)
476476 {
477 - vertdata[i+9].data = &vertptr[ptr];
 477+ vertdata[i+10].data = &vertptr[ptr];
478478 if(i >= numtex) texformats[i] = -1;
479479 else texformats[i] = (dwVertexTypeDesc>>(16+(2*i))&3);
480480 switch(texformats[i])
Index: ddraw/shadergen.cpp
@@ -55,7 +55,6 @@
5656 Bits 27-28 - Ambient material source VS
5757 Bits 29-30 - Emissive material source VS
5858 Bits 31-33 - Number of textures VS/FS
59 -Bit 34 - Use transformed vertices VS
6059 Bit 35 - Use diffuse color VS
6160 Bit 36 - Use specular color VS
6261 Bit 37 - Enable normals VS
@@ -62,6 +61,7 @@
6362 Bits 38-45 - Light types VS/FS
6463 Bits 46-48 - Number of blending weights VS
6564 Bit 49 - Normalize normals VS
 65+Bit 50 - Use transformed vertices VS
6666 */
6767
6868 /* Bits in Texture Stage ID:
@@ -320,7 +320,7 @@
321321 vsrc->append(idstring);
322322 // Attributes
323323 vsrc->append(attr_xyz);
324 - if((id>>34)&1) vsrc->append(attr_rhw);
 324+ if((id>>50)&1) vsrc->append(attr_rhw);
325325 tmp = attr_rgba;
326326 if((id>>35)&1)
327327 {
@@ -387,7 +387,7 @@
388388
389389 // Variables
390390 vsrc->append(var_common);
391 - if(!((id>>34)&1)) vsrc->append(var_xyzw);
 391+ if(!((id>>50)&1)) vsrc->append(var_xyzw);
392392
393393 // Functions
394394 if(numlights)
@@ -407,7 +407,7 @@
408408 }
409409 //Main
410410 vsrc->append(mainstart);
411 - if((id>>34)&1) vsrc->append(op_passthru);
 411+ if((id>>50)&1) vsrc->append(op_passthru);
412412 else vsrc->append(op_transform);
413413 vsrc->append(op_resetcolor);
414414 if((id>>49)&1) vsrc->append(op_normalize);