mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
add gl-swapbuffer-framelock option
This commit is contained in:
parent
c904bcfc31
commit
5f138be59a
@ -47,6 +47,9 @@ bool bResponsive_minimized_fullscreen_window = config_wgldisplay.GetBool("respon
|
||||
// will crab out WireGL.
|
||||
bool support_wiregl = config_wgldisplay.GetBool("support-wiregl", false);
|
||||
|
||||
// Set this true to enable HW swapbuffer frame-lock on 3dlabs cards
|
||||
bool gl_swapbuffer_framelock = config_wgldisplay.GetBool("gl-swapbuffer-framelock", false);
|
||||
|
||||
// if true, use ddraw's GetAvailVidMem to fail if driver says it has too little video mem
|
||||
bool gl_do_vidmemsize_check = config_wgldisplay.GetBool("do-vidmemsize-check", true);
|
||||
|
||||
|
@ -34,6 +34,7 @@ extern Filename get_mono_cursor_filename_2();
|
||||
extern bool gl_show_fps_meter;
|
||||
extern float gl_fps_meter_update_interval;
|
||||
extern bool gl_sync_video;
|
||||
extern bool gl_swapbuffer_framelock;
|
||||
extern int gl_forced_pixfmt;
|
||||
extern bool bResponsive_minimized_fullscreen_window;
|
||||
extern bool gl_do_vidmemsize_check;
|
||||
|
@ -620,6 +620,31 @@ void wglGraphicsWindow::config() {
|
||||
if (wgldisplay_cat.is_spam())
|
||||
wgldisplay_cat.spam() << "GL extensions: " << _extensions_str << endl;
|
||||
|
||||
if(gl_swapbuffer_framelock) {
|
||||
// utilize HW-assisted framelocking if available (3dLabs ext)
|
||||
WGLENABLEFRAMELOCKI3DFUNCPTR wglEnableFrameLock = (WGLENABLEFRAMELOCKI3DFUNCPTR) wglGetProcAddress("wglEnableFrameLockI3D");
|
||||
|
||||
if(wglEnableFrameLock==NULL) {
|
||||
wgldisplay_cat.fatal() << "wglEnableFrameLockI3D not found in OpenGL ICD, cannot implement gl-swapbuffer-framelock!\n";
|
||||
exit(1);
|
||||
} else {
|
||||
BOOL result = wglEnableFrameLock();
|
||||
if(!result) {
|
||||
wgldisplay_cat.fatal() << "wglEnableFrameLockI3D failed, error=" << GetLastError() << endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if(wgldisplay_cat.is_debug()) {
|
||||
WGLQUERYFRAMELOCKMASTERI3DFUNCPTR wglQueryFrameLockMasterI3D = (WGLQUERYFRAMELOCKMASTERI3DFUNCPTR) wglGetProcAddress("wglQueryFrameLockMasterI3D");
|
||||
BOOL bIsMaster;
|
||||
if((wglQueryFrameLockMasterI3D!=NULL) && wglQueryFrameLockMasterI3D(&bIsMaster))
|
||||
wgldisplay_cat.debug() << "SwapBuffer Frame-locking Enabled, HW wired as framelock " << (bIsMaster ? "Master" : "Slave") << endl;
|
||||
}
|
||||
|
||||
gl_sync_video=true; // you want gl_sync_video if you want framelock, right?
|
||||
}
|
||||
|
||||
if (gl_sync_video) {
|
||||
// set swapbuffers to swap no more than once per monitor refresh
|
||||
// note sometimes the ICD advertises this ext, but it still doesn't seem to work
|
||||
|
@ -391,6 +391,21 @@ typedef void * (APIENTRY * PFNWGLALLOCATEMEMORYNVPROC) (int size, float readfreq
|
||||
typedef void (APIENTRY * PFNWGLFREEMEMORYNVPROC) (void *pointer);
|
||||
#endif
|
||||
|
||||
// added from 3dlabs glext.h
|
||||
/*
|
||||
* Constants and typedefs for the WGL swap_frame_usage extension.
|
||||
*/
|
||||
typedef BOOL (APIENTRY *WGLGETFRAMEUSAGEI3DFUNCPTR)(float *);
|
||||
|
||||
|
||||
/*
|
||||
* Constants and typedefs for the WGL swap_frame_lock extension.
|
||||
*/
|
||||
typedef BOOL (APIENTRY *WGLENABLEFRAMELOCKI3DFUNCPTR)(VOID);
|
||||
typedef BOOL (APIENTRY *WGLDISABLEFRAMELOCKI3DFUNCPTR)(VOID);
|
||||
typedef BOOL (APIENTRY *WGLISENABLEDFRAMELOCKI3DFUNCPTR)(BOOL *);
|
||||
typedef BOOL (APIENTRY *WGLQUERYFRAMELOCKMASTERI3DFUNCPTR)(BOOL *);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user