DXGL r159 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r158‎ | r159 | r160 >
Date:17:42, 4 June 2012
Author:admin
Status:new
Tags:
Comment:
Fix render thread sync
Modified paths:
  • /ddraw/glRenderer.cpp (modified) (history)
  • /ddraw/glRenderer.h (modified) (history)

Diff [purge]

Index: ddraw/glRenderer.cpp
@@ -683,7 +683,7 @@
684684 break;
685685 case OP_CREATE:
686686 outputs[0] = (void*)_MakeTexture((GLint)inputs[0],(GLint)inputs[1],(GLint)inputs[2],(GLint)inputs[3],
687 - (DWORD)inputs[4],(DWORD)inputs[5],(GLint)inputs[6],(GLint)inputs[7],(GLint)inputs[8]);
 687+ (DWORD)inputs[4],(DWORD)inputs[5],(GLint)inputs[6],(GLint)inputs[7],(GLint)inputs[8],true);
688688 break;
689689 case OP_UPLOAD:
690690 _UploadTexture((char*)inputs[0],(char*)inputs[1],(GLuint)inputs[2],(int)inputs[3],
@@ -992,7 +992,7 @@
993993 return DD_OK;
994994 }
995995
996 -GLuint glRenderer::_MakeTexture(GLint min, GLint mag, GLint wraps, GLint wrapt, DWORD width, DWORD height, GLint texformat1, GLint texformat2, GLint texformat3)
 996+GLuint glRenderer::_MakeTexture(GLint min, GLint mag, GLint wraps, GLint wrapt, DWORD width, DWORD height, GLint texformat1, GLint texformat2, GLint texformat3, bool setsync)
997997 {
998998 GLuint texture;
999999 glGenTextures(1,&texture);
@@ -1002,7 +1002,7 @@
10031003 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,(GLfloat)wraps);
10041004 glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,(GLfloat)wrapt);
10051005 glTexImage2D(GL_TEXTURE_2D,0,texformat3,width,height,0,texformat1,texformat2,NULL);
1006 - SetEvent(busy);
 1006+ if(setsync) SetEvent(busy);
10071007 return texture;
10081008 }
10091009
@@ -1012,7 +1012,7 @@
10131013 SetActiveTexture(0);
10141014 if(!backbuffer)
10151015 {
1016 - backbuffer = _MakeTexture(GL_LINEAR,GL_LINEAR,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,x,y,GL_BGRA,GL_UNSIGNED_BYTE,GL_RGBA8);
 1016+ backbuffer = _MakeTexture(GL_LINEAR,GL_LINEAR,GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE,x,y,GL_BGRA,GL_UNSIGNED_BYTE,GL_RGBA8,false);
10171017 backx = x;
10181018 backy = y;
10191019 }
Index: ddraw/glRenderer.h
@@ -102,7 +102,7 @@
103103 void _DownloadTexture(char *buffer, char *bigbuffer, GLuint texture, int x, int y, int bigx, int bigy, int pitch, int bigpitch, int bpp, int texformat, int texformat2);
104104 HRESULT _Blt(LPRECT lpDestRect, glDirectDrawSurface7 *src,
105105 glDirectDrawSurface7 *dest, LPRECT lpSrcRect, DWORD dwFlags, LPDDBLTFX lpDDBltFx);
106 - GLuint _MakeTexture(GLint min, GLint mag, GLint wraps, GLint wrapt, DWORD width, DWORD height, GLint texformat1, GLint texformat2, GLint texformat3);
 106+ GLuint _MakeTexture(GLint min, GLint mag, GLint wraps, GLint wrapt, DWORD width, DWORD height, GLint texformat1, GLint texformat2, GLint texformat3, bool setsync);
107107 void _DrawScreen(GLuint texture, GLuint paltex, glDirectDrawSurface7 *dest, glDirectDrawSurface7 *src, bool setsync);
108108 void _DeleteTexture(GLuint texture);
109109 void _DrawBackbuffer(GLuint *texture, int x, int y);