Skip to content

Commit

Permalink
GL: Vsync and FSAA are now toggled using cvars
Browse files Browse the repository at this point in the history
Disabled the old native GL code for this purpose.
  • Loading branch information
skyjake committed Apr 13, 2012
1 parent 80789fb commit 966d4c3
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion doomsday/engine/portable/include/gl_defer.h
Expand Up @@ -72,7 +72,7 @@ void GL_ReleaseReservedNames(void);
*/
void GL_DeferTextureUpload(const struct texturecontent_s* content);

void GL_DeferSetVSync(boolean enableVSync);
//void GL_DeferSetVSync(boolean enableVSync);

// Deferring functions for various function signatures.
#define LIBDENG_GL_DEFER1(form, x) void GL_Defer_##form(void (GL_CALL *ptr)(x), x)
Expand Down
10 changes: 9 additions & 1 deletion doomsday/engine/portable/src/dgl_common.c
Expand Up @@ -346,6 +346,9 @@ boolean GL_Grab(int x, int y, int width, int height, dgltexformat_t format, void

void GL_SetVSync(boolean on)
{
Con_SetInteger("vid-vsync", on? 1 : 0);

/*
// Outside the main thread we'll need to defer the call.
if(!Sys_InMainThread())
{
Expand Down Expand Up @@ -374,11 +377,15 @@ void GL_SetVSync(boolean on)
CGLSetParameter(context, kCGLCPSwapInterval, params);
}
}
#endif
#endif*/

}

void GL_SetMultisample(boolean on)
{
Con_SetInteger("vid-fsaa", on? 1 : 0);

/*
if(!GL_state.features.multisample) return;
LIBDENG_ASSERT_IN_MAIN_THREAD();
Expand All @@ -387,6 +394,7 @@ void GL_SetMultisample(boolean on)
if(on) glEnable(GL_MULTISAMPLE_ARB);
else glDisable(GL_MULTISAMPLE_ARB);
#endif
*/
}

void DGL_SetScissor(const RectRaw* rect)
Expand Down
9 changes: 7 additions & 2 deletions doomsday/engine/portable/src/gl_defer.c
Expand Up @@ -41,7 +41,7 @@ typedef enum {

// Higher-level or non-OpenGL operations:
DTT_UPLOAD_TEXTURECONTENT = DEFERREDTASK_TYPES_FIRST,
DTT_SET_VSYNC,
//DTT_SET_VSYNC,

// OpenGL API calls:
DTT_FUNC_PTR_BEGIN,
Expand Down Expand Up @@ -208,9 +208,10 @@ static void processTask(deferredtask_t* task)
GL_UploadTextureContent(task->data);
break;

/*
case DTT_SET_VSYNC:
GL_SetVSync(*(boolean*)task->data);
break;
break;*/

case DTT_FUNC_PTR_E:
api->func.ptr_e(api->param.e);
Expand Down Expand Up @@ -251,9 +252,11 @@ static void destroyTaskData(deferredtask_t* d)
GL_DestroyTextureContent(d->data);
break;

/*
case DTT_SET_VSYNC:
M_Free(d->data);
break;
*/

case DTT_FUNC_PTR_UINT_ARRAY:
M_Free(api->param.uintArray.values);
Expand Down Expand Up @@ -435,7 +438,9 @@ void GL_DeferTextureUpload(const struct texturecontent_s* content)
enqueueTask(DTT_UPLOAD_TEXTURECONTENT, GL_ConstructTextureContentCopy(content));
}

/*
void GL_DeferSetVSync(boolean enableVSync)
{
enqueueTask(DTT_SET_VSYNC, M_MemDup(&enableVSync, sizeof(enableVSync)));
}
*/
4 changes: 2 additions & 2 deletions doomsday/engine/portable/src/rend_main.c
Expand Up @@ -3364,7 +3364,7 @@ void Rend_RenderMap(void)
// Set to true if dynlights are inited for this frame.
loInited = false;

GL_SetMultisample(true);
//GL_SetMultisample(true);

// Setup the modelview matrix.
Rend_ModelViewMatrix(true);
Expand Down Expand Up @@ -3441,7 +3441,7 @@ void Rend_RenderMap(void)
// Draw the Source Bias Editor's draw that identifies the current light.
SBE_DrawCursor();

GL_SetMultisample(false);
//GL_SetMultisample(false);
}

/**
Expand Down
4 changes: 0 additions & 4 deletions doomsday/engine/portable/src/sys_opengl.c
Expand Up @@ -510,10 +510,6 @@ boolean Sys_GLInitialize(void)
if(GL_state.features.genMipmap && GL_state.extensions.genMipmapSGIS)
glHint(GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST);

// Always use vsync if available.
/// @fixme Should be determined by cvar.
GL_SetVSync(true);

assert(!Sys_GLCheckError());

return true;
Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/portable/src/ui2_main.c
Expand Up @@ -589,7 +589,7 @@ void FIPage_Drawer(fi_page_t* p)
glPushMatrix();
//glLoadIdentity();

GL_SetMultisample(true);
//GL_SetMultisample(true);

// The 3D projection matrix.
// We're assuming pixels are squares.
Expand Down Expand Up @@ -648,7 +648,7 @@ void FIPage_Drawer(fi_page_t* p)
GL_DrawRectf2Color(0, 0, SCREENWIDTH, SCREENHEIGHT, p->_filter[0].value, p->_filter[1].value, p->_filter[2].value, p->_filter[3].value);
}

GL_SetMultisample(false);
//GL_SetMultisample(false);

glMatrixMode(GL_MODELVIEW);
glPopMatrix();
Expand Down

0 comments on commit 966d4c3

Please sign in to comment.