glthread: don't execute Draw and BufferSubData calls if the context is lost

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20624>
This commit is contained in:
Marek Olšák
2022-12-26 03:58:37 -05:00
parent faf476ea4f
commit 8510814528
3 changed files with 4 additions and 0 deletions

View File

@@ -505,6 +505,7 @@ _mesa_marshal_BufferSubData_merged(GLuint target_or_name, GLintptr offset,
* the buffer storage, but we don't know the buffer size in glthread.
*/
if (ctx->Const.AllowGLThreadBufferSubDataOpt &&
ctx->CurrentServerDispatch != ctx->ContextLost &&
data && offset > 0 && size > 0) {
struct gl_buffer_object *upload_buffer = NULL;
unsigned upload_offset = 0;

View File

@@ -148,6 +148,7 @@ _mesa_glthread_update_draw_always_async(struct gl_context *ctx)
/* Executing erroneous cases will just generate GL_INVALID_OPERATION. */
ctx->GLThread.draw_always_async =
ctx->API == API_OPENGL_CORE ||
ctx->CurrentServerDispatch == ctx->ContextLost ||
ctx->GLThread.inside_begin_end ||
ctx->GLThread.ListMode;
}

View File

@@ -29,6 +29,7 @@
#include "macros.h"
#include "main/dispatch.h" /* for _gloffset_COUNT */
#include "api_exec_decl.h"
#include "glthread_marshal.h"
static void GLAPIENTRY
_context_lost_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize,
@@ -104,6 +105,7 @@ _mesa_set_context_lost_dispatch(struct gl_context *ctx)
ctx->CurrentServerDispatch = ctx->ContextLost;
_glapi_set_dispatch(ctx->CurrentServerDispatch);
_mesa_glthread_update_draw_always_async(ctx);
}
/**