mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-23 14:21:57 +00:00
[client] opengl: add splitmouse option
This feature was previously hardcoded enabled, it is now optional as some hardware pipelines stall with the excessive flushes resulting in a jumpy cursor. Default is disabled and may be re-enabled with `-o opengl:splitmouse=1` or `-o opengl-basic:splitmouse=1` depending on the renderer selected.
This commit is contained in:
parent
1f004472cc
commit
c38e38d43d
2 changed files with 86 additions and 47 deletions
|
@ -45,12 +45,14 @@ struct Options
|
||||||
{
|
{
|
||||||
bool mipmap;
|
bool mipmap;
|
||||||
bool vsync;
|
bool vsync;
|
||||||
|
bool splitMouse;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct Options defaultOptions =
|
static struct Options defaultOptions =
|
||||||
{
|
{
|
||||||
.mipmap = true,
|
.mipmap = true,
|
||||||
.vsync = true
|
.vsync = true,
|
||||||
|
.splitMouse = false
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LGR_OpenGLBasic
|
struct LGR_OpenGLBasic
|
||||||
|
@ -659,6 +661,8 @@ bool lgr_opengl_basic_render(void * opaque)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (this->opt.splitMouse)
|
||||||
|
{
|
||||||
if (!this->frameUpdate)
|
if (!this->frameUpdate)
|
||||||
{
|
{
|
||||||
if (!this->mouseUpdate)
|
if (!this->mouseUpdate)
|
||||||
|
@ -685,6 +689,7 @@ bool lgr_opengl_basic_render(void * opaque)
|
||||||
this->lastMouseDraw = nanotime();
|
this->lastMouseDraw = nanotime();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
@ -733,6 +738,15 @@ static void handle_opt_vsync(void * opaque, const char *value)
|
||||||
this->opt.vsync = LG_RendererValueToBool(value);
|
this->opt.vsync = LG_RendererValueToBool(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void handle_opt_split_mouse(void * opaque, const char *value)
|
||||||
|
{
|
||||||
|
struct LGR_OpenGLBasic * this = (struct LGR_OpenGLBasic *)opaque;
|
||||||
|
if (!this)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this->opt.splitMouse = LG_RendererValueToBool(value);
|
||||||
|
}
|
||||||
|
|
||||||
static LG_RendererOpt lgr_opengl_basic_options[] =
|
static LG_RendererOpt lgr_opengl_basic_options[] =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
@ -746,6 +760,12 @@ static LG_RendererOpt lgr_opengl_basic_options[] =
|
||||||
.desc ="Enable or disable vsync [default: enabled]",
|
.desc ="Enable or disable vsync [default: enabled]",
|
||||||
.validator = LG_RendererValidatorBool,
|
.validator = LG_RendererValidatorBool,
|
||||||
.handler = handle_opt_vsync
|
.handler = handle_opt_vsync
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "splitMouse",
|
||||||
|
.desc = "Draw mouse updates directly to the front buffer [default: disabled]",
|
||||||
|
.validator = LG_RendererValidatorBool,
|
||||||
|
.handler = handle_opt_split_mouse
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -47,12 +47,14 @@ struct Options
|
||||||
{
|
{
|
||||||
bool mipmap;
|
bool mipmap;
|
||||||
bool vsync;
|
bool vsync;
|
||||||
|
bool splitMouse;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct Options defaultOptions =
|
static struct Options defaultOptions =
|
||||||
{
|
{
|
||||||
.mipmap = true,
|
.mipmap = true,
|
||||||
.vsync = true
|
.vsync = true,
|
||||||
|
.splitMouse = false
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LGR_OpenGL
|
struct LGR_OpenGL
|
||||||
|
@ -723,7 +725,8 @@ bool lgr_opengl_render(void * opaque)
|
||||||
this->resizeWindow = false;
|
this->resizeWindow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this->opt.splitMouse)
|
||||||
|
{
|
||||||
if (!this->frameUpdate)
|
if (!this->frameUpdate)
|
||||||
{
|
{
|
||||||
if (!this->mouseUpdate)
|
if (!this->mouseUpdate)
|
||||||
|
@ -750,6 +753,7 @@ bool lgr_opengl_render(void * opaque)
|
||||||
this->lastMouseDraw = nanotime();
|
this->lastMouseDraw = nanotime();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
@ -798,6 +802,15 @@ static void handle_opt_vsync(void * opaque, const char *value)
|
||||||
this->opt.vsync = LG_RendererValueToBool(value);
|
this->opt.vsync = LG_RendererValueToBool(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void handle_opt_split_mouse(void * opaque, const char *value)
|
||||||
|
{
|
||||||
|
struct LGR_OpenGL * this = (struct LGR_OpenGL *)opaque;
|
||||||
|
if (!this)
|
||||||
|
return;
|
||||||
|
|
||||||
|
this->opt.splitMouse = LG_RendererValueToBool(value);
|
||||||
|
}
|
||||||
|
|
||||||
static LG_RendererOpt lgr_opengl_options[] =
|
static LG_RendererOpt lgr_opengl_options[] =
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
@ -811,6 +824,12 @@ static LG_RendererOpt lgr_opengl_options[] =
|
||||||
.desc ="Enable or disable vsync [default: enabled]",
|
.desc ="Enable or disable vsync [default: enabled]",
|
||||||
.validator = LG_RendererValidatorBool,
|
.validator = LG_RendererValidatorBool,
|
||||||
.handler = handle_opt_vsync
|
.handler = handle_opt_vsync
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "splitMouse",
|
||||||
|
.desc = "Draw mouse updates directly to the front buffer [default: disabled]",
|
||||||
|
.validator = LG_RendererValidatorBool,
|
||||||
|
.handler = handle_opt_split_mouse
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue