dxx-rebirth/common/include/ogl_sync.h
Kp d67a27df65 Fix SDL check_header_includes=1 build
Type `SyncGLMethod` was defined conditional on DXX_USE_OGL, but header
`common/include/ogl_sync.h` used `SyncGLMethod` unconditionally.  This
works fine in the normal build since SDL builds never include
`common/include/ogl_sync.h`, but broke the check_header_includes=1 test
since that compiles `common/include/ogl_sync.h` even for SDL builds.

Wrap type `ogl_sync` in `#if DXX_USE_OGL` to hide it from the
check_header_includes=1 test in SDL mode.
2017-03-11 19:56:21 +00:00

46 lines
912 B
C++

/*
* This file is part of the DXX-Rebirth project <http://www.dxx-rebirth.com/>.
* It is copyright by its individual contributors, as recorded in the
* project's Git history. See COPYING.txt at the top level for license
* terms and a link to the Git history.
*/
/* OpenGL Synchronization code:
* either use fence sync objects or glFinish() to prevent the GPU from
* lagging behind too much.
*/
#pragma once
#include <memory>
#include "maths.h"
#include "args.h"
#include "ogl_extensions.h"
namespace dcx {
#if DXX_USE_OGL
class ogl_sync {
class sync_deleter
{
public:
typedef GLsync pointer;
void operator()(pointer p) const;
};
private:
SyncGLMethod method;
fix wait_timeout;
std::unique_ptr<GLsync, sync_deleter> fence;
public:
ogl_sync();
~ogl_sync();
void before_swap();
void after_swap();
void init(SyncGLMethod sync_method, int wait);
void deinit();
};
#endif
}