mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-17 14:40:43 +01:00
glthread: generate errors for glGet functions between glBegin/End
Acked-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18223>
This commit is contained in:
parent
c716827f69
commit
6b6f862170
5 changed files with 29 additions and 2 deletions
|
|
@ -1155,7 +1155,8 @@
|
|||
<glx rop="3"/>
|
||||
</function>
|
||||
|
||||
<function name="Begin" deprecated="3.1" exec="vtxfmt">
|
||||
<function name="Begin" deprecated="3.1" exec="vtxfmt"
|
||||
marshal_call_after="ctx->GLThread.inside_begin_end = true;">
|
||||
<param name="mode" type="GLenum"/>
|
||||
<glx rop="4"/>
|
||||
</function>
|
||||
|
|
@ -1369,7 +1370,8 @@
|
|||
<glx rop="22"/>
|
||||
</function>
|
||||
|
||||
<function name="End" deprecated="3.1" exec="vtxfmt">
|
||||
<function name="End" deprecated="3.1" exec="vtxfmt"
|
||||
marshal_call_after="ctx->GLThread.inside_begin_end = false;">
|
||||
<glx rop="23"/>
|
||||
</function>
|
||||
|
||||
|
|
|
|||
|
|
@ -154,6 +154,7 @@ struct glthread_state
|
|||
|
||||
/** Whether GLThread is enabled. */
|
||||
bool enabled;
|
||||
bool inside_begin_end;
|
||||
|
||||
/** Display lists. */
|
||||
GLenum ListMode; /**< Zero if not inside display list, else list mode. */
|
||||
|
|
|
|||
|
|
@ -38,6 +38,10 @@ _mesa_marshal_GetIntegerv(GLenum pname, GLint *p)
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
/* This will generate GL_INVALID_OPERATION, as it should. */
|
||||
if (ctx->GLThread.inside_begin_end)
|
||||
goto sync;
|
||||
|
||||
/* TODO: Use get_hash_params.py to return values for items containing:
|
||||
* - CONST(
|
||||
* - CONTEXT_[A-Z]*(Const
|
||||
|
|
@ -127,6 +131,7 @@ _mesa_marshal_GetIntegerv(GLenum pname, GLint *p)
|
|||
return;
|
||||
}
|
||||
|
||||
sync:
|
||||
_mesa_glthread_finish_before(ctx, "GetIntegerv");
|
||||
CALL_GetIntegerv(ctx->CurrentServerDispatch, (pname, p));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -487,6 +487,10 @@ _mesa_glthread_Disable(struct gl_context *ctx, GLenum cap)
|
|||
static inline int
|
||||
_mesa_glthread_IsEnabled(struct gl_context *ctx, GLenum cap)
|
||||
{
|
||||
/* This will generate GL_INVALID_OPERATION, as it should. */
|
||||
if (ctx->GLThread.inside_begin_end)
|
||||
return -1;
|
||||
|
||||
switch (cap) {
|
||||
case GL_CULL_FACE:
|
||||
return ctx->GLThread.CullFace;
|
||||
|
|
|
|||
|
|
@ -155,6 +155,15 @@ _mesa_marshal_GetActiveUniform(GLuint program, GLuint index, GLsizei bufSize,
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
/* This will generate GL_INVALID_OPERATION, as it should. */
|
||||
if (ctx->GLThread.inside_begin_end) {
|
||||
_mesa_glthread_finish_before(ctx, "GetActiveUniform");
|
||||
CALL_GetActiveUniform(ctx->CurrentServerDispatch,
|
||||
(program, index, bufSize, length, size, type,
|
||||
name));
|
||||
return;
|
||||
}
|
||||
|
||||
wait_for_glLinkProgram(ctx);
|
||||
|
||||
/* We can execute glGetActiveUniform without syncing if we are sync'd to
|
||||
|
|
@ -182,6 +191,12 @@ _mesa_marshal_GetUniformLocation(GLuint program, const GLchar *name)
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
|
||||
/* This will generate GL_INVALID_OPERATION, as it should. */
|
||||
if (ctx->GLThread.inside_begin_end) {
|
||||
_mesa_glthread_finish_before(ctx, "GetUniformLocation");
|
||||
return CALL_GetUniformLocation(ctx->CurrentServerDispatch, (program, name));
|
||||
}
|
||||
|
||||
wait_for_glLinkProgram(ctx);
|
||||
|
||||
/* This is thread-safe. See the comment in _mesa_marshal_GetActiveUniform. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue