Index: ddraw/common.h |
— | — | @@ -90,6 +90,14 @@ |
91 | 91 | out[3] = (GLfloat)((in>>24) & 0xff) / 255.0f;
|
92 | 92 | }
|
93 | 93 |
|
| 94 | +static inline void dwordto4int(DWORD in, GLint *out)
|
| 95 | +{
|
| 96 | + out[0] = (GLint)((in>>16) & 0xff);
|
| 97 | + out[1] = (GLint)((in>>8) & 0xff);
|
| 98 | + out[2] = (GLint)(in& 0xff);
|
| 99 | + out[3] = (GLint)((in>>24) & 0xff);
|
| 100 | +}
|
| 101 | +
|
94 | 102 | #ifdef _M_X64
|
95 | 103 | #define NextMultipleOfWord NextMultipleOf8
|
96 | 104 | #else
|
Index: ddraw/glExtensions.cpp |
— | — | @@ -59,6 +59,7 @@ |
60 | 60 | void (APIENTRY *glUniform2i) (GLint location, GLint v0, GLint v1) = NULL;
|
61 | 61 | void (APIENTRY *glUniform3i) (GLint location, GLint v0, GLint v1, GLint v2) = NULL;
|
62 | 62 | void (APIENTRY *glUniform4i) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3) = NULL;
|
| 63 | +void (APIENTRY *glUniform4iv) (GLint location, GLsizei count, const GLint* value) = NULL;
|
63 | 64 | void (APIENTRY *glUniform1f) (GLint location, GLfloat v0) = NULL;
|
64 | 65 | void (APIENTRY *glUniform2f) (GLint location, GLfloat v0, GLfloat v1) = NULL;
|
65 | 66 | void (APIENTRY *glUniform3f) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2) = NULL;
|
— | — | @@ -136,6 +137,7 @@ |
137 | 138 | glUniform2i = (PFNGLUNIFORM2IPROC)wglGetProcAddress("glUniform2i");
|
138 | 139 | glUniform3i = (PFNGLUNIFORM3IPROC)wglGetProcAddress("glUniform3i");
|
139 | 140 | glUniform4i = (PFNGLUNIFORM4IPROC)wglGetProcAddress("glUniform4i");
|
| 141 | + glUniform4iv = (PFNGLUNIFORM4IVPROC)wglGetProcAddress("glUniform4iv");
|
140 | 142 | glUniform1f = (PFNGLUNIFORM1FPROC)wglGetProcAddress("glUniform1f");
|
141 | 143 | glUniform2f = (PFNGLUNIFORM2FPROC)wglGetProcAddress("glUniform2f");
|
142 | 144 | glUniform3f = (PFNGLUNIFORM3FPROC)wglGetProcAddress("glUniform3f");
|
Index: ddraw/glExtensions.h |
— | — | @@ -87,6 +87,7 @@ |
88 | 88 | GLAPI void (APIENTRY *glUniform2i) (GLint location, GLint v0, GLint v1);
|
89 | 89 | GLAPI void (APIENTRY *glUniform3i) (GLint location, GLint v0, GLint v1, GLint v2);
|
90 | 90 | GLAPI void (APIENTRY *glUniform4i) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
| 91 | +GLAPI void (APIENTRY *glUniform4iv) (GLint location, GLsizei count, const GLint* value);
|
91 | 92 | GLAPI void (APIENTRY *glUniform1f) (GLint location, GLfloat v0);
|
92 | 93 | GLAPI void (APIENTRY *glUniform2f) (GLint location, GLfloat v0, GLfloat v1);
|
93 | 94 | GLAPI void (APIENTRY *glUniform3f) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
Index: ddraw/glRenderer.cpp |
— | — | @@ -1517,7 +1517,7 @@ |
1518 | 1518 | if(prog.uniforms[136] != -1)
|
1519 | 1519 | glUniform4f(prog.uniforms[136],RGBA_GETRED(ambient),RGBA_GETGREEN(ambient),
|
1520 | 1520 | RGBA_GETBLUE(ambient),RGBA_GETALPHA(ambient));
|
1521 | | -
|
| 1521 | + GLint keycolor[4];
|
1522 | 1522 | for(i = 0; i < 8; i++)
|
1523 | 1523 | {
|
1524 | 1524 | if(device->texstages[i].colorop == D3DTOP_DISABLE) break;
|
— | — | @@ -1541,6 +1541,14 @@ |
1542 | 1542 | }
|
1543 | 1543 | else SetTexture(i,0);
|
1544 | 1544 | glUniform1i(prog.uniforms[128+i],i);
|
| 1545 | + if(device->renderstate[D3DRENDERSTATE_COLORKEYENABLE] && device->texstages[i].texture && (prog.uniforms[140+i] != -1))
|
| 1546 | + {
|
| 1547 | + if(device->texstages[i].texture->ddsd.dwFlags & DDSD_CKSRCBLT)
|
| 1548 | + {
|
| 1549 | + dwordto4int(device->texstages[i].texture->colorkey[0].key.dwColorSpaceLowValue,keycolor);
|
| 1550 | + glUniform4iv(prog.uniforms[140+i],1,keycolor);
|
| 1551 | + }
|
| 1552 | + }
|
1545 | 1553 | }
|
1546 | 1554 | if(prog.uniforms[137]!= -1) glUniform1f(prog.uniforms[137],device->glDDS7->fakex);
|
1547 | 1555 | if(prog.uniforms[138]!= -1) glUniform1f(prog.uniforms[138],device->glDDS7->fakey);
|
Index: ddraw/shadergen.cpp |
— | — | @@ -636,6 +636,18 @@ |
637 | 637 | tmp.replace(21,1,_itoa(i,idstring,10));
|
638 | 638 | fsrc->append(tmp);
|
639 | 639 | }
|
| 640 | + if((id>>13)&1)
|
| 641 | + {
|
| 642 | + for(i = 0; i < 8; i++)
|
| 643 | + {
|
| 644 | + if((texstate[i].shaderid>>60)&1)
|
| 645 | + {
|
| 646 | + tmp = unif_key;
|
| 647 | + tmp.replace(17,1,_itoa(i,idstring,10));
|
| 648 | + fsrc->append(tmp);
|
| 649 | + }
|
| 650 | + }
|
| 651 | + }
|
640 | 652 | if((id>>2)&1) fsrc->append(unif_alpharef);
|
641 | 653 | // Variables
|
642 | 654 | fsrc->append(var_color);
|