DXGL r432 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r431‎ | r432 | r433 >
Date:02:05, 20 April 2014
Author:admin
Status:new
Tags:
Comment:
Move swap control and blt vertex list into glRenderer class.
Modified paths:
  • /ddraw/glRenderer.cpp (modified) (history)
  • /ddraw/glRenderer.h (modified) (history)

Diff [purge]

Index: ddraw/glRenderer.cpp
@@ -33,7 +33,6 @@
3434 #include "shadergen.h"
3535 #include "matrix.h"
3636
37 -BltVertex bltvertices[4];
3837 const GLushort bltindices[4] = {0,1,2,3};
3938
4039 /**
@@ -60,14 +59,12 @@
6160 return (number<<2)+(number>>4);
6261 }
6362
64 -int oldswap = 0;
65 -
6663 /**
6764 * Sets the Windows OpenGL swap interval
6865 * @param swap
6966 * Number of vertical retraces to wait per frame, 0 disable vsync
7067 */
71 -inline void SetSwap(int swap)
 68+inline void glRenderer::_SetSwap(int swap)
7269 {
7370 if(swap != oldswap)
7471 {
@@ -191,6 +188,7 @@
192189 */
193190 glRenderer::glRenderer(int width, int height, int bpp, bool fullscreen, unsigned int frequency, HWND hwnd, glDirectDraw7 *glDD7)
194191 {
 192+ oldswap = 0;
195193 fogcolor = 0;
196194 fogstart = 0.0f;
197195 fogend = 1.0f;
@@ -785,11 +783,11 @@
786784 }
787785 gllock = false;
788786 InitGLExt();
789 - SetSwap(1);
 787+ _SetSwap(1);
790788 SwapBuffers(hDC);
791789 glFinish();
792790 timer.Calibrate(height, frequency);
793 - SetSwap(0);
 791+ _SetSwap(0);
794792 SetViewport(0,0,width,height);
795793 glViewport(0,0,width,height);
796794 SetDepthRange(0.0,1.0);
@@ -1081,7 +1079,7 @@
10821080 }
10831081 DepthTest(false);
10841082 RECT *viewrect = &r2;
1085 - SetSwap(vsync);
 1083+ _SetSwap(vsync);
10861084 LONG sizes[6];
10871085 GLfloat view[4];
10881086 GLint viewport[4];
@@ -1319,10 +1317,10 @@
13201318 if(!wglMakeCurrent(hDC,hRC))
13211319 DEBUG("glRenderer::SetWnd: Can not activate GL context\n");
13221320 gllock = false;
1323 - SetSwap(1);
 1321+ _SetSwap(1);
13241322 SwapBuffers(hDC);
13251323 timer.Calibrate(height, frequency);
1326 - SetSwap(0);
 1324+ _SetSwap(0);
13271325 SetViewport(0,0,width,height);
13281326 }
13291327
Index: ddraw/glRenderer.h
@@ -69,8 +69,6 @@
7070 #define OP_DELETEFBO 13
7171
7272
73 -extern inline void SetSwap(int swap);
74 -
7573 class glDirectDraw7;
7674 class glDirect3DDevice7;
7775 class glDirectDrawSurface7;
@@ -126,6 +124,7 @@
127125 void _SetFogStart(GLfloat start);
128126 void _SetFogEnd(GLfloat end);
129127 void _SetFogDensity(GLfloat density);
 128+ inline void _SetSwap(int swap);
130129 int opcode;
131130 void* inputs[32];
132131 void* outputs[32];
@@ -148,6 +147,8 @@
149148 GLfloat fogstart;
150149 GLfloat fogend;
151150 GLfloat fogdensity;
 151+ BltVertex bltvertices[4];
 152+ int oldswap;
152153 };
153154
154155 #endif //_GLRENDERER_H
\ No newline at end of file