DXGL r42 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r41‎ | r42 | r43 >
Date:21:44, 24 December 2011
Author:admin
Status:new
Tags:
Comment:
Another attempt at vsync fixes.
Modified paths:
  • /ddraw/glDirectDraw.cpp (modified) (history)
  • /ddraw/glDirectDrawSurface.cpp (modified) (history)
  • /ddraw/glExtensions.cpp (modified) (history)
  • /ddraw/glExtensions.h (modified) (history)

Diff [purge]

Index: ddraw/glDirectDraw.cpp
@@ -1347,6 +1347,8 @@
13481348 }
13491349 gllock = false;
13501350 InitGLExt();
 1351+ SetSwap(1);
 1352+ SetSwap(0);
13511353 glViewport(0,0,width,height);
13521354 glMatrixMode(GL_PROJECTION);
13531355 glLoadIdentity();
Index: ddraw/glDirectDrawSurface.cpp
@@ -24,12 +24,13 @@
2525 #include "glDirectDrawPalette.h"
2626 #include "glDirectDrawClipper.h"
2727
28 -int swapinterval;
 28+int swapinterval = 0;
2929 inline void SetSwap(int swap)
3030 {
3131 if(swap != swapinterval)
3232 {
3333 wglSwapIntervalEXT(swap);
 34+ swapinterval = wglGetSwapIntervalEXT();
3435 swapinterval = swap;
3536 }
3637 }
@@ -734,7 +735,6 @@
735736 else if(dwFlags & DDFLIP_INTERVAL4) SetSwap(4);
736737 else SetSwap(1);
737738 }
738 -
739739 int flips = 1;
740740 if(lpDDSurfaceTargetOverride) ERR(DDERR_GENERIC);
741741 if(ddsd.ddsCaps.dwCaps & DDSCAPS_FLIP)
@@ -777,7 +777,7 @@
778778 RenderScreen(textures[0],this);
779779 delete textures;
780780 }
781 - else ERR(DDERR_NOTFLIPPABLE);
 781+ else return DDERR_NOTFLIPPABLE;
782782 flipcount+=flips;
783783 if(flipcount > ddsd.dwBackBufferCount) flipcount -= (ddsd.dwBackBufferCount+1);
784784 return DD_OK;
Index: ddraw/glExtensions.cpp
@@ -50,6 +50,7 @@
5151 void (APIENTRY *glActiveTexture)(GLenum texture) = NULL;
5252
5353 BOOL (APIENTRY *wglSwapIntervalEXT)(int interval) = NULL;
 54+int (APIENTRY *wglGetSwapIntervalEXT)() = NULL;
5455
5556 int GLEXT_ARB_framebuffer_object = 0;
5657 int GLEXT_EXT_framebuffer_object = 0;
@@ -99,4 +100,5 @@
100101 glCheckFramebufferStatusEXT = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)wglGetProcAddress("glCheckFramebufferStatusEXT");
101102 }
102103 wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
 104+ wglGetSwapIntervalEXT = (PFNWGLGETSWAPINTERVALEXTPROC)wglGetProcAddress("wglGetSwapIntervalEXT");
103105 }
Index: ddraw/glExtensions.h
@@ -57,6 +57,7 @@
5858 GLAPI void (APIENTRY *glActiveTexture)(GLenum texture);
5959
6060 GLAPI BOOL (APIENTRY *wglSwapIntervalEXT)(int interval);
 61+GLAPI int (APIENTRY *wglGetSwapIntervalEXT)();
6162
6263 void InitGLExt();
6364