DXGL r252 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r251‎ | r252 | r253 >
Date:15:15, 2 September 2012
Author:admin
Status:new
Tags:
Comment:
Tweak D3DTLVERTEX vertex shader, still somewhat broken.
Add locking of rects within DDraw surfaces.
Modified paths:
  • /ddraw/glDirectDrawSurface.cpp (modified) (history)
  • /ddraw/shadergen.cpp (modified) (history)

Diff [purge]

Index: ddraw/glDirectDrawSurface.cpp
@@ -841,6 +841,13 @@
842842 surfacetype = 0;
843843 goto retry;
844844 }
 845+ if(lpDestRect)
 846+ {
 847+ ULONG_PTR ptr = (ULONG_PTR)ddsd.lpSurface;
 848+ ptr += (lpDestRect->left * (ddsd.ddpfPixelFormat.dwRGBBitCount/8));
 849+ ptr += (lpDestRect->top * (ddsd.lPitch));
 850+ ddsd.lpSurface = (LPVOID)ptr;
 851+ }
845852 memcpy(lpDDSurfaceDesc,&ddsd,lpDDSurfaceDesc->dwSize);
846853 locked++;
847854 return DD_OK;
Index: ddraw/shadergen.cpp
@@ -271,7 +271,7 @@
272272 gl_Position = vec4(pos.x,-pos.y,pos.z,pos.w);\n";
273273 static const char op_normalize[] = "N = normalize(gl_NormalMatrix*nxyz);\n";
274274 static const char op_normalpassthru[] = "N = gl_NormalMatrix*nxyz;\n";
275 -static const char op_passthru[] = "gl_Position = vec4((xyz.x/(width/2.0))-1.0,(xyz.y/(height/2.0))-1.0,xyz.z,1.0/rhw);\n";
 275+static const char op_passthru[] = "gl_Position = vec4(((xyz.x/rhw)/(width/2.0))-1.0,((xyz.y/rhw)/(height/2.0))-1.0,(xyz.z/rhw),1.0/rhw);\n";
276276 static const char op_resetcolor[] = "diffuse = specular = vec4(0.0);\n\
277277 ambient = ambientcolor / 255.0;\n";
278278 static const char op_dirlight[] = "DirLight(lightX);\n";