DXGL r133 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r132‎ | r133 | r134 >
Date:21:41, 9 April 2012
Author:admin
Status:new
Tags:
Comment:
Eliminate glGetAttribLocation and glGetUniformLocation in DrawPrimitives function
Fix multiple lights
Modified paths:
  • /ddraw/glDirect3DDevice.cpp (modified) (history)
  • /ddraw/glDirectDrawSurface.cpp (modified) (history)
  • /ddraw/glRenderer.cpp (modified) (history)
  • /ddraw/shadergen.cpp (modified) (history)
  • /ddraw/shadergen.h (modified) (history)
  • /ddraw/shaders.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirect3DDevice.cpp
@@ -22,6 +22,8 @@
2323 #include "glDirectDrawSurface.h"
2424 #include "glDirect3DDevice.h"
2525 #include "glDirect3DLight.h"
 26+#include <string>
 27+using namespace std;
2628 #include "shadergen.h"
2729 #include "glutil.h"
2830 #include "matrix.h"
Index: ddraw/glDirectDrawSurface.cpp
@@ -25,6 +25,8 @@
2626 #include "glDirectDrawPalette.h"
2727 #include "glDirectDrawClipper.h"
2828 #include "glRenderer.h"
 29+#include <string>
 30+using namespace std;
2931 #include "shadergen.h"
3032 #include "shaders.h"
3133 #include "glutil.h"
Index: ddraw/glRenderer.cpp
@@ -25,6 +25,8 @@
2626 #include "glutil.h"
2727 #include "ddraw.h"
2828 #include "scalers.h"
 29+#include <string>
 30+using namespace std;
2931 #include "shadergen.h"
3032 #include "matrix.h"
3133
@@ -1002,8 +1004,6 @@
10031005 DWORD indexcount, DWORD flags)
10041006 {
10051007 bool transformed;
1006 - char blendvar[] = "blendX";
1007 - char rgbavar[] = "rgbaX";
10081008 char svar[] = "sX";
10091009 char stvar[] = "stX";
10101010 char strvar[] = "strX";
@@ -1019,34 +1019,35 @@
10201020 }
10211021 __int64 shader = device->SelectShader(vertices);
10221022 SetShader(shader,device->texstages,texformats,0);
1023 - GLuint prog = GetProgram();
1024 - GLint xyzloc = glGetAttribLocation(prog,"xyz");
1025 - glEnableVertexAttribArray(xyzloc);
1026 - glVertexAttribPointer(xyzloc,3,GL_FLOAT,false,vertices[0].stride,vertices[0].data);
 1023+ _GENSHADER prog = genshaders[current_genshader].shader;
 1024+ glEnableVertexAttribArray(prog.attribs[0]);
 1025+ glVertexAttribPointer(prog.attribs[0],3,GL_FLOAT,false,vertices[0].stride,vertices[0].data);
10271026 if(transformed)
10281027 {
1029 - GLint xyzwloc = glGetAttribLocation(prog,"rhw");
1030 - if(xyzwloc != -1)
 1028+ if(prog.attribs[1] != -1)
10311029 {
1032 - glEnableVertexAttribArray(xyzwloc);
1033 - glVertexAttribPointer(xyzwloc,4,GL_FLOAT,false,vertices[1].stride,vertices[1].data);
 1030+ glEnableVertexAttribArray(prog.attribs[1]);
 1031+ glVertexAttribPointer(prog.attribs[1],4,GL_FLOAT,false,vertices[1].stride,vertices[1].data);
10341032 }
10351033 }
10361034 for(i = 0; i < 5; i++)
10371035 {
1038 - GLint blendloc;
10391036 if(vertices[i+2].data)
10401037 {
1041 - blendvar[5] = i+'0';
1042 - blendloc = glGetAttribLocation(prog,blendvar);
1043 - glVertexAttribPointer(blendloc,1,GL_FLOAT,false,vertices[i+2].stride,vertices[i+2].data);
 1038+ if(prog.attribs[i+2] != -1)
 1039+ {
 1040+ glEnableVertexAttribArray(prog.attribs[i+2]);
 1041+ glVertexAttribPointer(prog.attribs[i+2],1,GL_FLOAT,false,vertices[i+2].stride,vertices[i+2].data);
 1042+ }
10441043 }
10451044 }
10461045 if(vertices[7].data)
10471046 {
1048 - GLint normalloc = glGetAttribLocation(prog,"nxyz");
1049 - glEnableVertexAttribArray(normalloc);
1050 - glVertexAttribPointer(normalloc,3,GL_FLOAT,false,vertices[7].stride,vertices[7].data);
 1047+ if(prog.attribs[7] != -1)
 1048+ {
 1049+ glEnableVertexAttribArray(prog.attribs[7]);
 1050+ glVertexAttribPointer(prog.attribs[7],3,GL_FLOAT,false,vertices[7].stride,vertices[7].data);
 1051+ }
10511052 }
10521053 for(i = 0; i < 2; i++)
10531054 {
@@ -1053,9 +1054,11 @@
10541055 GLint colorloc;
10551056 if(vertices[i+8].data)
10561057 {
1057 - rgbavar[4] = i + '0';
1058 - colorloc = glGetAttribLocation(prog,rgbavar);
1059 - glVertexAttribPointer(colorloc,4,GL_UNSIGNED_BYTE,true,vertices[i+8].stride,vertices[i+8].data);
 1058+ if(prog.attribs[8+i] != -1)
 1059+ {
 1060+ glEnableVertexAttribArray(prog.attribs[8+i]);
 1061+ glVertexAttribPointer(prog.attribs[8+i],4,GL_UNSIGNED_BYTE,true,vertices[i+8].stride,vertices[i+8].data);
 1062+ }
10601063 }
10611064 }
10621065 for(i = 0; i < 8; i++)
@@ -1069,28 +1072,16 @@
10701073 }
10711074 }
10721075 if(device->normal_dirty) device->UpdateNormalMatrix();
1073 - GLint loc = glGetUniformLocation(prog,"world");
1074 - glUniformMatrix4fv(loc,1,false,device->matWorld);
1075 - loc = glGetUniformLocation(prog,"view");
1076 - glUniformMatrix4fv(loc,1,false,device->matView);
1077 - loc = glGetUniformLocation(prog,"projection");
1078 - glUniformMatrix4fv(loc,1,false,device->matProjection);
1079 - loc = glGetUniformLocation(prog,"normalmat");
1080 - glUniformMatrix3fv(loc,1,true,device->matNormal);
1081 - loc = glGetUniformLocation(prog,"material.diffuse");
1082 - glUniform4fv(loc,1,(GLfloat*)&device->material.diffuse);
1083 - loc = glGetUniformLocation(prog,"material.ambient");
1084 - glUniform4fv(loc,1,(GLfloat*)&device->material.ambient);
1085 - loc = glGetUniformLocation(prog,"material.specular");
1086 - glUniform4fv(loc,1,(GLfloat*)&device->material.specular);
1087 - loc = glGetUniformLocation(prog,"material.emissive");
1088 - glUniform4fv(loc,1,(GLfloat*)&device->material.emissive);
1089 - loc = glGetUniformLocation(prog,"material.power");
1090 - glUniform1f(loc,device->material.power);
1091 - loc = glGetUniformLocation(prog,"ambientcolor");
1092 - DWORD ambient = device->renderstate[D3DRENDERSTATE_AMBIENT];
1093 - glUniform4f(loc,RGBA_GETRED(ambient),RGBA_GETGREEN(ambient),
1094 - RGBA_GETBLUE(ambient),RGBA_GETALPHA(ambient));
 1076+ if(prog.uniforms[0] != -1) glUniformMatrix4fv(prog.uniforms[0],1,false,device->matWorld);
 1077+ if(prog.uniforms[1] != -1) glUniformMatrix4fv(prog.uniforms[1],1,false,device->matView);
 1078+ if(prog.uniforms[2] != -1) glUniformMatrix4fv(prog.uniforms[2],1,false,device->matProjection);
 1079+ if(prog.uniforms[3] != -1) glUniformMatrix3fv(prog.uniforms[3],1,true,device->matNormal);
 1080+
 1081+ if(prog.uniforms[15] != -1) glUniform4fv(prog.uniforms[15],1,(GLfloat*)&device->material.ambient);
 1082+ if(prog.uniforms[16] != -1) glUniform4fv(prog.uniforms[16],1,(GLfloat*)&device->material.diffuse);
 1083+ if(prog.uniforms[17] != -1) glUniform4fv(prog.uniforms[17],1,(GLfloat*)&device->material.specular);
 1084+ if(prog.uniforms[18] != -1) glUniform4fv(prog.uniforms[18],1,(GLfloat*)&device->material.emissive);
 1085+ if(prog.uniforms[19] != -1) glUniform1f(prog.uniforms[19],device->material.power);
10951086 int lightindex = 0;
10961087 char lightname[] = "lightX.xxxxxxxxxxxxxxxx";
10971088 for(i = 0; i < 8; i++)
@@ -1097,48 +1088,42 @@
10981089 {
10991090 if(device->gllights[i] != -1)
11001091 {
1101 - lightname[5] = lightindex+'0';
1102 - memcpy((void*)(lightname+7),"diffuse",8);
1103 - loc = glGetUniformLocation(prog,lightname);
1104 - glUniform4fv(loc,1,(GLfloat*)&device->lights[device->gllights[i]]->light.dcvDiffuse);
1105 - memcpy((void*)(lightname+7),"specular",9);
1106 - loc = glGetUniformLocation(prog,lightname);
1107 - glUniform4fv(loc,1,(GLfloat*)&device->lights[device->gllights[i]]->light.dcvSpecular);
1108 - memcpy((void*)(lightname+7),"ambient",8);
1109 - loc = glGetUniformLocation(prog,lightname);
1110 - glUniform4fv(loc,1,(GLfloat*)&device->lights[device->gllights[i]]->light.dcvAmbient);
1111 - memcpy((void*)(lightname+7),"direction",10);
1112 - loc = glGetUniformLocation(prog,lightname);
1113 - glUniform3fv(loc,1,(GLfloat*)&device->lights[device->gllights[i]]->light.dvDirection);
 1092+ if(prog.uniforms[20+(i*12)] != -1)
 1093+ glUniform4fv(prog.uniforms[20+(i*12)],1,(GLfloat*)&device->lights[device->gllights[i]]->light.dcvDiffuse);
 1094+ if(prog.uniforms[21+(i*12)] != -1)
 1095+ glUniform4fv(prog.uniforms[21+(i*12)],1,(GLfloat*)&device->lights[device->gllights[i]]->light.dcvSpecular);
 1096+ if(prog.uniforms[22+(i*12)] != -1)
 1097+ glUniform4fv(prog.uniforms[22+(i*12)],1,(GLfloat*)&device->lights[device->gllights[i]]->light.dcvAmbient);
 1098+ if(prog.uniforms[24+(i*12)] != -1)
 1099+ glUniform3fv(prog.uniforms[24+(i*12)],1,(GLfloat*)&device->lights[device->gllights[i]]->light.dvDirection);
11141100 if(device->lights[device->gllights[i]]->light.dltType != D3DLIGHT_DIRECTIONAL)
11151101 {
1116 - memcpy((void*)(lightname+7),"position",9);
1117 - loc = glGetUniformLocation(prog,lightname);
1118 - glUniform3fv(loc,1,(GLfloat*)&device->lights[device->gllights[i]]->light.dvPosition);
1119 - memcpy((void*)(lightname+7),"range",6);
1120 - loc = glGetUniformLocation(prog,lightname);
1121 - glUniform1f(loc,device->lights[device->gllights[i]]->light.dvRange);
1122 - memcpy((void*)(lightname+7),"falloff",8);
1123 - loc = glGetUniformLocation(prog,lightname);
1124 - glUniform1f(loc,device->lights[device->gllights[i]]->light.dvFalloff);
1125 - memcpy((void*)(lightname+7),"constant",9);
1126 - loc = glGetUniformLocation(prog,lightname);
1127 - glUniform1f(loc,device->lights[device->gllights[i]]->light.dvAttenuation0);
1128 - memcpy((void*)(lightname+7),"linear",7);
1129 - loc = glGetUniformLocation(prog,lightname);
1130 - glUniform1f(loc,device->lights[device->gllights[i]]->light.dvAttenuation1);
1131 - memcpy((void*)(lightname+7),"quad",5);
1132 - loc = glGetUniformLocation(prog,lightname);
1133 - glUniform1f(loc,device->lights[device->gllights[i]]->light.dvAttenuation2);
1134 - memcpy((void*)(lightname+7),"theta",6);
1135 - loc = glGetUniformLocation(prog,lightname);
1136 - glUniform1f(loc,device->lights[device->gllights[i]]->light.dvTheta);
1137 - memcpy((void*)(lightname+7),"Phi",4);
1138 - loc = glGetUniformLocation(prog,lightname);
1139 - glUniform1f(loc,device->lights[device->gllights[i]]->light.dvPhi);
 1102+ if(prog.uniforms[23+(i*12)] != -1)
 1103+ glUniform3fv(prog.uniforms[23+(i*12)],1,(GLfloat*)&device->lights[device->gllights[i]]->light.dvPosition);
 1104+ if(prog.uniforms[25+(i*12)] != -1)
 1105+ glUniform1f(prog.uniforms[25+(i*12)],device->lights[device->gllights[i]]->light.dvRange);
 1106+ if(prog.uniforms[26+(i*12)] != -1)
 1107+ glUniform1f(prog.uniforms[26+(i*12)],device->lights[device->gllights[i]]->light.dvFalloff);
 1108+ if(prog.uniforms[27+(i*12)] != -1)
 1109+ glUniform1f(prog.uniforms[27+(i*12)],device->lights[device->gllights[i]]->light.dvAttenuation0);
 1110+ if(prog.uniforms[28+(i*12)] != -1)
 1111+ glUniform1f(prog.uniforms[28+(i*12)],device->lights[device->gllights[i]]->light.dvAttenuation1);
 1112+ if(prog.uniforms[29+(i*12)] != -1)
 1113+ glUniform1f(prog.uniforms[29+(i*12)],device->lights[device->gllights[i]]->light.dvAttenuation2);
 1114+ if(prog.uniforms[30+(i*12)] != -1)
 1115+ glUniform1f(prog.uniforms[30+(i*12)],device->lights[device->gllights[i]]->light.dvTheta);
 1116+ if(prog.uniforms[31+(i*12)] != -1)
 1117+ glUniform1f(prog.uniforms[31+(i*12)],device->lights[device->gllights[i]]->light.dvPhi);
11401118 }
11411119 }
 1120+ lightindex++;
11421121 }
 1122+
 1123+ DWORD ambient = device->renderstate[D3DRENDERSTATE_AMBIENT];
 1124+ if(prog.uniforms[136] != -1)
 1125+ glUniform4f(prog.uniforms[136],RGBA_GETRED(ambient),RGBA_GETGREEN(ambient),
 1126+ RGBA_GETBLUE(ambient),RGBA_GETALPHA(ambient));
 1127+
11431128 if(device->glDDS7->zbuffer) SetFBO(device->glDDS7->texture,device->glDDS7->zbuffer->texture,device->glDDS7->zbuffer->hasstencil);
11441129 else SetFBO(device->glDDS7->texture,0,false);
11451130 glViewport(device->viewport.dwX,device->viewport.dwY,device->viewport.dwWidth,device->viewport.dwHeight);
Index: ddraw/shadergen.cpp
@@ -18,27 +18,11 @@
1919 #include "common.h"
2020 #include "glRenderer.h"
2121 #include "glDirect3DDevice.h"
 22+#include <string>
 23+using namespace std;
2224 #include "shadergen.h"
2325 #include "shaders.h"
24 -#include <string>
25 -using namespace std;
2626
27 -typedef struct
28 -{
29 - GLint vs;
30 - GLint fs;
31 - string *vsrc;
32 - string *fsrc;
33 - GLint prog;
34 -} _GENSHADER;
35 -
36 -struct GenShader
37 -{
38 - _GENSHADER shader;
39 - __int64 id;
40 - __int64 texids[8];
41 - int texcoords[8];
42 -};
4327 GenShader genshaders[256];
4428 static __int64 current_shader = 0;
4529 static __int64 current_texid[8];
@@ -47,6 +31,7 @@
4832 static bool initialized = false;
4933 static bool isbuiltin = true;
5034 GLuint current_prog;
 35+int current_genshader;
5136
5237 /* Bits in Shader ID:
5338 Bits 0-1 - Shading mode: 00=flat 01=gouraud 11=phong 10=flat per-pixel
@@ -119,6 +104,7 @@
120105 if(genshaders[i].shader.vsrc) delete genshaders[i].shader.vsrc;
121106 ZeroMemory(&genshaders[i].shader,sizeof(_GENSHADER));
122107 }
 108+ current_genshader = -1;
123109 shadercount = 0;
124110 genindex = 0;
125111 }
@@ -132,6 +118,7 @@
133119 glUseProgram(shaders[id].prog);
134120 current_shader = shaders[id].prog;
135121 isbuiltin=true;
 122+ current_genshader = -1;
136123 }
137124 else
138125 {
@@ -179,6 +166,7 @@
180167 memcpy(genshaders[shaderindex].texcoords,texcoords,8*sizeof(int));
181168 glUseProgram(genshaders[shaderindex].shader.prog);
182169 current_prog = genshaders[shaderindex].shader.prog;
 170+ current_genshader = shaderindex;
183171 }
184172 }
185173
@@ -476,4 +464,86 @@
477465 free(infolog);
478466 }
479467 #endif
 468+ // Attributes
 469+ genshaders[index].shader.attribs[0] = glGetAttribLocation(genshaders[index].shader.prog,"xyz");
 470+ genshaders[index].shader.attribs[1] = glGetAttribLocation(genshaders[index].shader.prog,"rhw");
 471+ genshaders[index].shader.attribs[2] = glGetAttribLocation(genshaders[index].shader.prog,"blend0");
 472+ genshaders[index].shader.attribs[3] = glGetAttribLocation(genshaders[index].shader.prog,"blend1");
 473+ genshaders[index].shader.attribs[4] = glGetAttribLocation(genshaders[index].shader.prog,"blend2");
 474+ genshaders[index].shader.attribs[5] = glGetAttribLocation(genshaders[index].shader.prog,"blend3");
 475+ genshaders[index].shader.attribs[6] = glGetAttribLocation(genshaders[index].shader.prog,"blend4");
 476+ genshaders[index].shader.attribs[7] = glGetAttribLocation(genshaders[index].shader.prog,"nxyz");
 477+ genshaders[index].shader.attribs[8] = glGetAttribLocation(genshaders[index].shader.prog,"rgba0");
 478+ genshaders[index].shader.attribs[9] = glGetAttribLocation(genshaders[index].shader.prog,"rgba1");
 479+ char attrS[] = "sX";
 480+ for(int i = 0; i < 8; i++)
 481+ {
 482+ attrS[1] = i + '0';
 483+ genshaders[index].shader.attribs[i+10] = glGetAttribLocation(genshaders[index].shader.prog,attrS);
 484+ }
 485+ char attrST[] = "stX";
 486+ for(int i = 0; i < 8; i++)
 487+ {
 488+ attrST[2] = i + '0';
 489+ genshaders[index].shader.attribs[i+18] = glGetAttribLocation(genshaders[index].shader.prog,attrST);
 490+ }
 491+ char attrSTR[] = "strX";
 492+ for(int i = 0; i < 8; i++)
 493+ {
 494+ attrSTR[3] = i + '0';
 495+ genshaders[index].shader.attribs[i+26] = glGetAttribLocation(genshaders[index].shader.prog,attrSTR);
 496+ }
 497+ char attrSTRQ[] = "strqX";
 498+ for(int i = 0; i < 8; i++)
 499+ {
 500+ attrSTRQ[4] = i + '0';
 501+ genshaders[index].shader.attribs[i+34] = glGetAttribLocation(genshaders[index].shader.prog,attrSTRQ);
 502+ }
 503+ // Uniforms
 504+ genshaders[index].shader.uniforms[0] = glGetUniformLocation(genshaders[index].shader.prog,"world");
 505+ genshaders[index].shader.uniforms[1] = glGetUniformLocation(genshaders[index].shader.prog,"view");
 506+ genshaders[index].shader.uniforms[2] = glGetUniformLocation(genshaders[index].shader.prog,"projection");
 507+ genshaders[index].shader.uniforms[3] = glGetUniformLocation(genshaders[index].shader.prog,"normalmat");
 508+ // TODO: 4-14 world1-3 and texture0-7
 509+ genshaders[index].shader.uniforms[15] = glGetUniformLocation(genshaders[index].shader.prog,"material.ambient");
 510+ genshaders[index].shader.uniforms[16] = glGetUniformLocation(genshaders[index].shader.prog,"material.diffuse");
 511+ genshaders[index].shader.uniforms[17] = glGetUniformLocation(genshaders[index].shader.prog,"material.specular");
 512+ genshaders[index].shader.uniforms[18] = glGetUniformLocation(genshaders[index].shader.prog,"material.emissive");
 513+ genshaders[index].shader.uniforms[19] = glGetUniformLocation(genshaders[index].shader.prog,"material.power");
 514+ char uniflight[] = "lightX. ";
 515+ for(int i = 0; i < 8; i++)
 516+ {
 517+ uniflight[5] = i + '0';
 518+ strcpy(uniflight+7,"diffuse");
 519+ genshaders[index].shader.uniforms[20+(i*12)] = glGetUniformLocation(genshaders[index].shader.prog,uniflight);
 520+ strcpy(uniflight+7,"specular");
 521+ genshaders[index].shader.uniforms[21+(i*12)] = glGetUniformLocation(genshaders[index].shader.prog,uniflight);
 522+ strcpy(uniflight+7,"ambient");
 523+ genshaders[index].shader.uniforms[22+(i*12)] = glGetUniformLocation(genshaders[index].shader.prog,uniflight);
 524+ strcpy(uniflight+7,"position");
 525+ genshaders[index].shader.uniforms[23+(i*12)] = glGetUniformLocation(genshaders[index].shader.prog,uniflight);
 526+ strcpy(uniflight+7,"direction");
 527+ genshaders[index].shader.uniforms[24+(i*12)] = glGetUniformLocation(genshaders[index].shader.prog,uniflight);
 528+ strcpy(uniflight+7,"range");
 529+ genshaders[index].shader.uniforms[25+(i*12)] = glGetUniformLocation(genshaders[index].shader.prog,uniflight);
 530+ strcpy(uniflight+7,"falloff");
 531+ genshaders[index].shader.uniforms[26+(i*12)] = glGetUniformLocation(genshaders[index].shader.prog,uniflight);
 532+ strcpy(uniflight+7,"constant");
 533+ genshaders[index].shader.uniforms[27+(i*12)] = glGetUniformLocation(genshaders[index].shader.prog,uniflight);
 534+ strcpy(uniflight+7,"linear");
 535+ genshaders[index].shader.uniforms[28+(i*12)] = glGetUniformLocation(genshaders[index].shader.prog,uniflight);
 536+ strcpy(uniflight+7,"quad");
 537+ genshaders[index].shader.uniforms[29+(i*12)] = glGetUniformLocation(genshaders[index].shader.prog,uniflight);
 538+ strcpy(uniflight+7,"theta");
 539+ genshaders[index].shader.uniforms[30+(i*12)] = glGetUniformLocation(genshaders[index].shader.prog,uniflight);
 540+ strcpy(uniflight+7,"phi");
 541+ genshaders[index].shader.uniforms[31+(i*12)] = glGetUniformLocation(genshaders[index].shader.prog,uniflight);
 542+ }
 543+ char uniftex[] = "texX";
 544+ for(int i = 0; i < 8; i++)
 545+ {
 546+ uniftex[3] = i + '0';
 547+ genshaders[index].shader.uniforms[128+i] = glGetUniformLocation(genshaders[index].shader.prog,uniftex);
 548+ }
 549+ genshaders[index].shader.uniforms[136] = glGetUniformLocation(genshaders[index].shader.prog,"ambientcolor");
480550 }
Index: ddraw/shadergen.h
@@ -18,10 +18,30 @@
1919 #ifndef _SHADERGEN_H
2020 #define _SHADERGEN_H
2121
 22+typedef struct
 23+{
 24+ GLint vs;
 25+ GLint fs;
 26+ string *vsrc;
 27+ string *fsrc;
 28+ GLint prog;
 29+ GLint attribs[42];
 30+ GLint uniforms[256];
 31+} _GENSHADER;
 32+
 33+struct GenShader
 34+{
 35+ _GENSHADER shader;
 36+ __int64 id;
 37+ __int64 texids[8];
 38+ int texcoords[8];
 39+};
 40+
2241 void ClearShaders();
2342 void SetShader(__int64 id, TEXTURESTAGE *texstate, int *texcoords, bool builtin);
2443 GLuint GetProgram();
2544 void ZeroShaderArray();
2645 void CreateShader(int index, __int64 id, TEXTURESTAGE *texstate, int *texcoords);
27 -
 46+extern GenShader genshaders[256];
 47+extern int current_genshader;
2848 #endif
\ No newline at end of file
Index: ddraw/shaders.cpp
@@ -18,6 +18,8 @@
1919 #include "common.h"
2020 #include "glRenderer.h"
2121 #include "glDirect3DDevice.h"
 22+#include <string>
 23+using namespace std;
2224 #include "shaders.h"
2325 #include "shadergen.h"
2426