Index: ddraw/ShaderGen3D.cpp |
— | — | @@ -316,7 +316,7 @@ |
317 | 317 | uniform float xoffset;\n\
|
318 | 318 | uniform float yoffset;\n";
|
319 | 319 | static const char unif_alpharef[] = "uniform int alpharef;\n";
|
320 | | -static const char unif_key[] = "uniform ivec4 keyX;\n";
|
| 320 | +static const char unif_key[] = "uniform ivec3 keyX;\n";
|
321 | 321 | static const char unif_world[] = "uniform mat4 matWorld;\n";
|
322 | 322 | // Variables
|
323 | 323 | static const char var_common[] = "vec4 diffuse;\n\
|
— | — | @@ -333,7 +333,9 @@ |
334 | 334 | gl_Position = vec4(pos.x,-pos.y,pos.z,pos.w);\n";
|
335 | 335 | static const char op_normalize[] = "N = normalize(gl_NormalMatrix*nxyz);\n";
|
336 | 336 | static const char op_normalpassthru[] = "N = gl_NormalMatrix*nxyz;\n";
|
337 | | -static const char op_tlvertex[] = "gl_Position = vec4((((xyz.x-xoffset)+.5)/(width/2.0))-1.0,(((xyz.y-yoffset)+.5)/(height/2.0))-1.0,(xyz.z),1.0);\n";
|
| 337 | +static const char op_tlvertex[] = "xyzw = vec4(xyz.x/rhw,xyz.y/rhw,xyz.z/rhw,1.0/rhw);\n\
|
| 338 | +vec4 pos = gl_ModelViewProjectionMatrix*xyzw;\n\
|
| 339 | +gl_Position = vec4(pos.x,-pos.y,pos.z,pos.w);\n";
|
338 | 340 | static const char op_resetcolor[] = "diffuse = specular = vec4(0.0);\n\
|
339 | 341 | ambient = ambientcolor / 255.0;\n";
|
340 | 342 | static const char op_dirlight[] = "DirLight(lightX);\n";
|
— | — | @@ -347,7 +349,7 @@ |
348 | 350 | static const char op_colorwhite[] = "gl_FrontColor = vec4(1.0,1.0,1.0,1.0);\n";
|
349 | 351 | static const char op_colorfragout[] = "gl_FragColor = color;\n";
|
350 | 352 | static const char op_colorfragin[] = "color = gl_Color;\n";
|
351 | | -static const char op_colorkey[] = "if(ivec4(texture2DProj(texX,gl_TexCoord[Y])*255.5) == keyZ) discard;\n";
|
| 353 | +static const char op_colorkey[] = "if(ivec3(texture2DProj(texX,gl_TexCoord[Y])*255.5).rgb == keyZ) discard;\n";
|
352 | 354 | static const char op_texpassthru1[] = "gl_TexCoord[x] = ";
|
353 | 355 | static const char op_texpassthru2s[] = "vec4(sX,0,0,1);\n";
|
354 | 356 | static const char op_texpassthru2st[] = "vec4(stX,0,1);\n";
|
— | — | @@ -547,7 +549,7 @@ |
548 | 550 |
|
549 | 551 | // Variables
|
550 | 552 | String_Append(vsrc, var_common);
|
551 | | - if(!((id>>50)&1)) String_Append(vsrc, var_xyzw);
|
| 553 | + String_Append(vsrc, var_xyzw);
|
552 | 554 | if(vertexfog && !pixelfog) String_Append(vsrc, var_fogfactorvertex);
|
553 | 555 |
|
554 | 556 | // Functions
|
— | — | @@ -794,7 +796,7 @@ |
795 | 797 | String_Assign(&arg1, op_colorkey);
|
796 | 798 | arg1.ptr[26] = *(_itoa(i,idstring,10));
|
797 | 799 | arg1.ptr[40] = *(_itoa((texstate[i].shaderid>>54)&7,idstring,10));
|
798 | | - arg1.ptr[57] = *(_itoa(i,idstring,10));
|
| 800 | + arg1.ptr[61] = *(_itoa(i,idstring,10));
|
799 | 801 | String_Append(fsrc, arg1.ptr);
|
800 | 802 | }
|
801 | 803 | }
|
Index: ddraw/glDirectDrawSurface.cpp |
— | — | @@ -1715,7 +1715,10 @@ |
1716 | 1716 | TRACE_ENTER(2,14,this,14,src);
|
1717 | 1717 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
1718 | 1718 | if(!src) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
| 1719 | + if (src == this) TRACE_RET(HRESULT, 23, DD_OK);
|
1719 | 1720 | this->Blt(NULL,src,NULL,DDBLT_WAIT,NULL);
|
| 1721 | + if (src->ddsd.dwFlags & DDSD_CKSRCBLT)
|
| 1722 | + this->SetColorKey(DDCKEY_SRCBLT, &src->colorkey[0].key);
|
1720 | 1723 | ddsd.ddsCaps.dwCaps &= ~DDSCAPS_ALLOCONLOAD;
|
1721 | 1724 | TRACE_EXIT(23,D3D_OK);
|
1722 | 1725 | return D3D_OK;
|
Index: ddraw/glExtensions.c |
— | — | @@ -66,6 +66,7 @@ |
67 | 67 | ext->glUniform2i = (PFNGLUNIFORM2IPROC)wglGetProcAddress("glUniform2i");
|
68 | 68 | ext->glUniform3i = (PFNGLUNIFORM3IPROC)wglGetProcAddress("glUniform3i");
|
69 | 69 | ext->glUniform4i = (PFNGLUNIFORM4IPROC)wglGetProcAddress("glUniform4i");
|
| 70 | + ext->glUniform3iv = (PFNGLUNIFORM3IVPROC)wglGetProcAddress("glUniform3iv");
|
70 | 71 | ext->glUniform4iv = (PFNGLUNIFORM4IVPROC)wglGetProcAddress("glUniform4iv");
|
71 | 72 | ext->glUniform1f = (PFNGLUNIFORM1FPROC)wglGetProcAddress("glUniform1f");
|
72 | 73 | ext->glUniform2f = (PFNGLUNIFORM2FPROC)wglGetProcAddress("glUniform2f");
|
Index: ddraw/glExtensions.h |
— | — | @@ -77,6 +77,7 @@ |
78 | 78 | void (APIENTRY *glUniform2i) (GLint location, GLint v0, GLint v1);
|
79 | 79 | void (APIENTRY *glUniform3i) (GLint location, GLint v0, GLint v1, GLint v2);
|
80 | 80 | void (APIENTRY *glUniform4i) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
| 81 | + void (APIENTRY *glUniform3iv) (GLint location, GLsizei count, const GLint* value);
|
81 | 82 | void (APIENTRY *glUniform4iv) (GLint location, GLsizei count, const GLint* value);
|
82 | 83 | void (APIENTRY *glUniform1f) (GLint location, GLfloat v0);
|
83 | 84 | void (APIENTRY *glUniform2f) (GLint location, GLfloat v0, GLfloat v1);
|
Index: ddraw/glRenderer.cpp |
— | — | @@ -1846,6 +1846,14 @@ |
1847 | 1847 | This->util->EnableArray(prog.attribs[1],true);
|
1848 | 1848 | This->ext->glVertexAttribPointer(prog.attribs[1],4,GL_FLOAT,false,vertices[1].stride,vertices[1].data);
|
1849 | 1849 | }
|
| 1850 | + device->modelview_dirty = true;
|
| 1851 | + device->projection_dirty = true;
|
| 1852 | + glMatrixMode(GL_MODELVIEW);
|
| 1853 | + glLoadIdentity();
|
| 1854 | + glMatrixMode(GL_PROJECTION);
|
| 1855 | + glLoadIdentity();
|
| 1856 | + glOrtho(0.0, device->viewport.dwWidth, device->viewport.dwHeight, 0.0,
|
| 1857 | + -device->viewport.dvMinZ, device->viewport.dvMaxZ);
|
1850 | 1858 | }
|
1851 | 1859 | for(i = 0; i < 5; i++)
|
1852 | 1860 | {
|
— | — | @@ -1916,8 +1924,11 @@ |
1917 | 1925 |
|
1918 | 1926 | }
|
1919 | 1927 | }
|
1920 | | - if(device->modelview_dirty) This->util->SetMatrix(GL_MODELVIEW,device->matView,device->matWorld,&device->modelview_dirty);
|
1921 | | - if(device->projection_dirty) This->util->SetMatrix(GL_PROJECTION,device->matProjection,NULL,&device->projection_dirty);
|
| 1928 | + if (!transformed)
|
| 1929 | + {
|
| 1930 | + if (device->modelview_dirty) This->util->SetMatrix(GL_MODELVIEW, device->matView, device->matWorld, &device->modelview_dirty);
|
| 1931 | + if (device->projection_dirty) This->util->SetMatrix(GL_PROJECTION, device->matProjection, NULL, &device->projection_dirty);
|
| 1932 | + }
|
1922 | 1933 |
|
1923 | 1934 | This->util->SetMaterial((GLfloat*)&device->material.ambient,(GLfloat*)&device->material.diffuse,(GLfloat*)&device->material.specular,
|
1924 | 1935 | (GLfloat*)&device->material.emissive,device->material.power);
|
— | — | @@ -1993,7 +2004,7 @@ |
1994 | 2005 | if(device->texstages[i].texture->ddsd.dwFlags & DDSD_CKSRCBLT)
|
1995 | 2006 | {
|
1996 | 2007 | dwordto4int(device->texstages[i].texture->colorkey[0].key.dwColorSpaceLowValue,keycolor);
|
1997 | | - This->ext->glUniform4iv(prog.uniforms[142+i],1,keycolor);
|
| 2008 | + This->ext->glUniform3iv(prog.uniforms[142+i],1,keycolor);
|
1998 | 2009 | }
|
1999 | 2010 | }
|
2000 | 2011 | }
|