mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
mesa: move ctx->Table -> ctx->Dispatch.Table except Client & MarshalExec
There is a new struct gl_dispatch, which I'd like to reuse in glthread. This allows building code around gl_dispatch that can be shared between mesa and glthread. This is only refactoring. Acked-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21777>
This commit is contained in:
parent
ef0e327d9f
commit
6b22642e21
21 changed files with 1038 additions and 1010 deletions
|
|
@ -63,7 +63,7 @@ header = """/**
|
|||
void
|
||||
_mesa_init_dispatch(struct gl_context *ctx)
|
||||
{
|
||||
struct _glapi_table *table = ctx->OutsideBeginEnd;
|
||||
struct _glapi_table *table = ctx->Dispatch.OutsideBeginEnd;
|
||||
|
||||
assert(table != NULL);
|
||||
assert(ctx->Version > 0);
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class PrintCode(gl_XML.gl_print_base):
|
|||
|
||||
def print_call(self, func, unmarshal=0):
|
||||
ret = 'return ' if func.return_type != 'void' and not unmarshal else '';
|
||||
call = 'CALL_{0}(ctx->CurrentServerDispatch, ({1}))'.format(
|
||||
call = 'CALL_{0}(ctx->Dispatch.Current, ({1}))'.format(
|
||||
func.name, func.get_called_parameter_string())
|
||||
out('{0}{1};'.format(ret, call))
|
||||
if func.marshal_call_after and ret == '' and not unmarshal:
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ static struct _glapi_table *
|
|||
get_dispatch(void)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
return ctx->CurrentServerDispatch;
|
||||
return ctx->Dispatch.Current;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1487,7 +1487,7 @@ _mesa_ArrayElement(GLint elt)
|
|||
* then we call PrimitiveRestartNV and return.
|
||||
*/
|
||||
if (ctx->Array.PrimitiveRestart && (elt == ctx->Array.RestartIndex)) {
|
||||
CALL_PrimitiveRestartNV(ctx->CurrentServerDispatch, ());
|
||||
CALL_PrimitiveRestartNV(ctx->Dispatch.Current, ());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -909,7 +909,7 @@ _mesa_initialize_dispatch_tables(struct gl_context *ctx)
|
|||
/* Do the code-generated setup of the exec table in api_exec_init.c. */
|
||||
_mesa_init_dispatch(ctx);
|
||||
|
||||
if (ctx->Save)
|
||||
if (ctx->Dispatch.Save)
|
||||
_mesa_init_dispatch_save(ctx);
|
||||
|
||||
vbo_init_dispatch_begin_end(ctx);
|
||||
|
|
@ -1005,11 +1005,11 @@ _mesa_initialize_context(struct gl_context *ctx,
|
|||
ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR;
|
||||
|
||||
/* setup the API dispatch tables with all nop functions */
|
||||
ctx->OutsideBeginEnd = _mesa_alloc_dispatch_table(false);
|
||||
if (!ctx->OutsideBeginEnd)
|
||||
ctx->Dispatch.OutsideBeginEnd = _mesa_alloc_dispatch_table(false);
|
||||
if (!ctx->Dispatch.OutsideBeginEnd)
|
||||
goto fail;
|
||||
ctx->Exec = ctx->OutsideBeginEnd;
|
||||
ctx->CurrentClientDispatch = ctx->CurrentServerDispatch = ctx->OutsideBeginEnd;
|
||||
ctx->Dispatch.Exec = ctx->Dispatch.OutsideBeginEnd;
|
||||
ctx->CurrentClientDispatch = ctx->Dispatch.Current = ctx->Dispatch.OutsideBeginEnd;
|
||||
|
||||
_mesa_reset_vertex_processing_mode(ctx);
|
||||
|
||||
|
|
@ -1022,9 +1022,9 @@ _mesa_initialize_context(struct gl_context *ctx,
|
|||
|
||||
switch (ctx->API) {
|
||||
case API_OPENGL_COMPAT:
|
||||
ctx->BeginEnd = _mesa_alloc_dispatch_table(false);
|
||||
ctx->Save = _mesa_alloc_dispatch_table(false);
|
||||
if (!ctx->BeginEnd || !ctx->Save)
|
||||
ctx->Dispatch.BeginEnd = _mesa_alloc_dispatch_table(false);
|
||||
ctx->Dispatch.Save = _mesa_alloc_dispatch_table(false);
|
||||
if (!ctx->Dispatch.BeginEnd || !ctx->Dispatch.Save)
|
||||
goto fail;
|
||||
|
||||
FALLTHROUGH;
|
||||
|
|
@ -1058,9 +1058,9 @@ _mesa_initialize_context(struct gl_context *ctx,
|
|||
|
||||
fail:
|
||||
_mesa_reference_shared_state(ctx, &ctx->Shared, NULL);
|
||||
free(ctx->BeginEnd);
|
||||
free(ctx->OutsideBeginEnd);
|
||||
free(ctx->Save);
|
||||
free(ctx->Dispatch.BeginEnd);
|
||||
free(ctx->Dispatch.OutsideBeginEnd);
|
||||
free(ctx->Dispatch.Save);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -1135,12 +1135,12 @@ _mesa_free_context_data(struct gl_context *ctx, bool destroy_debug_output)
|
|||
_mesa_free_buffer_objects(ctx);
|
||||
|
||||
/* free dispatch tables */
|
||||
free(ctx->BeginEnd);
|
||||
free(ctx->OutsideBeginEnd);
|
||||
free(ctx->Save);
|
||||
free(ctx->ContextLost);
|
||||
free(ctx->Dispatch.BeginEnd);
|
||||
free(ctx->Dispatch.OutsideBeginEnd);
|
||||
free(ctx->Dispatch.Save);
|
||||
free(ctx->Dispatch.ContextLost);
|
||||
free(ctx->MarshalExec);
|
||||
free(ctx->HWSelectModeBeginEnd);
|
||||
free(ctx->Dispatch.HWSelectModeBeginEnd);
|
||||
|
||||
/* Shared context state (display lists, textures, etc) */
|
||||
_mesa_reference_shared_state(ctx, &ctx->Shared, NULL);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1216,9 +1216,9 @@ _mesa_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
|
|||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
CALL_Begin(ctx->CurrentServerDispatch, (GL_QUADS));
|
||||
/* Begin can change CurrentServerDispatch. */
|
||||
struct _glapi_table *dispatch = ctx->CurrentServerDispatch;
|
||||
CALL_Begin(ctx->Dispatch.Current, (GL_QUADS));
|
||||
/* Begin can change Dispatch.Current. */
|
||||
struct _glapi_table *dispatch = ctx->Dispatch.Current;
|
||||
CALL_Vertex2f(dispatch, (x1, y1));
|
||||
CALL_Vertex2f(dispatch, (x2, y1));
|
||||
CALL_Vertex2f(dispatch, (x2, y2));
|
||||
|
|
@ -1299,9 +1299,9 @@ _mesa_EvalMesh1(GLenum mode, GLint i1, GLint i2)
|
|||
u = ctx->Eval.MapGrid1u1 + i1 * du;
|
||||
|
||||
|
||||
CALL_Begin(ctx->CurrentServerDispatch, (prim));
|
||||
/* Begin can change CurrentServerDispatch. */
|
||||
struct _glapi_table *dispatch = ctx->CurrentServerDispatch;
|
||||
CALL_Begin(ctx->Dispatch.Current, (prim));
|
||||
/* Begin can change Dispatch.Current. */
|
||||
struct _glapi_table *dispatch = ctx->Dispatch.Current;
|
||||
for (i = i1; i <= i2; i++, u += du) {
|
||||
CALL_EvalCoord1f(dispatch, (u));
|
||||
}
|
||||
|
|
@ -1340,9 +1340,9 @@ _mesa_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
|
|||
|
||||
switch (mode) {
|
||||
case GL_POINT:
|
||||
CALL_Begin(ctx->CurrentServerDispatch, (GL_POINTS));
|
||||
/* Begin can change CurrentServerDispatch. */
|
||||
dispatch = ctx->CurrentServerDispatch;
|
||||
CALL_Begin(ctx->Dispatch.Current, (GL_POINTS));
|
||||
/* Begin can change Dispatch.Current. */
|
||||
dispatch = ctx->Dispatch.Current;
|
||||
for (v = v1, j = j1; j <= j2; j++, v += dv) {
|
||||
for (u = u1, i = i1; i <= i2; i++, u += du) {
|
||||
CALL_EvalCoord2f(dispatch, (u, v));
|
||||
|
|
@ -1352,18 +1352,18 @@ _mesa_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
|
|||
break;
|
||||
case GL_LINE:
|
||||
for (v = v1, j = j1; j <= j2; j++, v += dv) {
|
||||
CALL_Begin(ctx->CurrentServerDispatch, (GL_LINE_STRIP));
|
||||
/* Begin can change CurrentServerDispatch. */
|
||||
dispatch = ctx->CurrentServerDispatch;
|
||||
CALL_Begin(ctx->Dispatch.Current, (GL_LINE_STRIP));
|
||||
/* Begin can change Dispatch.Current. */
|
||||
dispatch = ctx->Dispatch.Current;
|
||||
for (u = u1, i = i1; i <= i2; i++, u += du) {
|
||||
CALL_EvalCoord2f(dispatch, (u, v));
|
||||
}
|
||||
CALL_End(dispatch, ());
|
||||
}
|
||||
for (u = u1, i = i1; i <= i2; i++, u += du) {
|
||||
CALL_Begin(ctx->CurrentServerDispatch, (GL_LINE_STRIP));
|
||||
/* Begin can change CurrentServerDispatch. */
|
||||
dispatch = ctx->CurrentServerDispatch;
|
||||
CALL_Begin(ctx->Dispatch.Current, (GL_LINE_STRIP));
|
||||
/* Begin can change Dispatch.Current. */
|
||||
dispatch = ctx->Dispatch.Current;
|
||||
for (v = v1, j = j1; j <= j2; j++, v += dv) {
|
||||
CALL_EvalCoord2f(dispatch, (u, v));
|
||||
}
|
||||
|
|
@ -1372,9 +1372,9 @@ _mesa_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)
|
|||
break;
|
||||
case GL_FILL:
|
||||
for (v = v1, j = j1; j < j2; j++, v += dv) {
|
||||
CALL_Begin(ctx->CurrentServerDispatch, (GL_TRIANGLE_STRIP));
|
||||
/* Begin can change CurrentServerDispatch. */
|
||||
dispatch = ctx->CurrentServerDispatch;
|
||||
CALL_Begin(ctx->Dispatch.Current, (GL_TRIANGLE_STRIP));
|
||||
/* Begin can change Dispatch.Current. */
|
||||
dispatch = ctx->Dispatch.Current;
|
||||
for (u = u1, i = i1; i <= i2; i++, u += du) {
|
||||
CALL_EvalCoord2f(dispatch, (u, v));
|
||||
CALL_EvalCoord2f(dispatch, (u, v + dv));
|
||||
|
|
@ -2636,7 +2636,7 @@ _mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first,
|
|||
for ( i = 0 ; i < primcount ; i++ ) {
|
||||
if ( count[i] > 0 ) {
|
||||
GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride));
|
||||
CALL_DrawArrays(ctx->CurrentServerDispatch, ( m, first[i], count[i] ));
|
||||
CALL_DrawArrays(ctx->Dispatch.Current, ( m, first[i], count[i] ));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2654,7 +2654,7 @@ _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count,
|
|||
for ( i = 0 ; i < primcount ; i++ ) {
|
||||
if ( count[i] > 0 ) {
|
||||
GLenum m = *((GLenum *) ((GLubyte *) mode + i * modestride));
|
||||
CALL_DrawElements(ctx->CurrentServerDispatch, ( m, count[i], type,
|
||||
CALL_DrawElements(ctx->Dispatch.Current, ( m, count[i], type,
|
||||
indices[i] ));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -231,9 +231,9 @@ alloc_select_resource(struct gl_context *ctx)
|
|||
if (!ctx->Const.HardwareAcceleratedSelect)
|
||||
return;
|
||||
|
||||
if (!ctx->HWSelectModeBeginEnd) {
|
||||
ctx->HWSelectModeBeginEnd = _mesa_alloc_dispatch_table(false);
|
||||
if (!ctx->HWSelectModeBeginEnd) {
|
||||
if (!ctx->Dispatch.HWSelectModeBeginEnd) {
|
||||
ctx->Dispatch.HWSelectModeBeginEnd = _mesa_alloc_dispatch_table(false);
|
||||
if (!ctx->Dispatch.HWSelectModeBeginEnd) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "Cannot allocate HWSelectModeBeginEnd");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ glthread_unmarshal_batch(void *job, void *gdata, int thread_index)
|
|||
simple_mtx_unlock(&shared->Mutex);
|
||||
|
||||
/* Execute the GL calls. */
|
||||
_glapi_set_dispatch(ctx->CurrentServerDispatch);
|
||||
_glapi_set_dispatch(ctx->Dispatch.Current);
|
||||
|
||||
/* Here we lock the mutexes once globally if possible. If not, we just
|
||||
* fallback to the individual API calls doing it.
|
||||
|
|
@ -249,7 +249,7 @@ _mesa_glthread_destroy(struct gl_context *ctx)
|
|||
void _mesa_glthread_enable(struct gl_context *ctx)
|
||||
{
|
||||
if (ctx->GLThread.enabled ||
|
||||
ctx->CurrentServerDispatch == ctx->ContextLost ||
|
||||
ctx->Dispatch.Current == ctx->Dispatch.ContextLost ||
|
||||
ctx->GLThread.DebugOutputSynchronous)
|
||||
return;
|
||||
|
||||
|
|
@ -257,7 +257,7 @@ void _mesa_glthread_enable(struct gl_context *ctx)
|
|||
ctx->CurrentClientDispatch = ctx->MarshalExec;
|
||||
|
||||
/* Update the dispatch only if the dispatch is current. */
|
||||
if (_glapi_get_dispatch() == ctx->CurrentServerDispatch) {
|
||||
if (_glapi_get_dispatch() == ctx->Dispatch.Current) {
|
||||
_glapi_set_dispatch(ctx->CurrentClientDispatch);
|
||||
}
|
||||
}
|
||||
|
|
@ -270,7 +270,7 @@ void _mesa_glthread_disable(struct gl_context *ctx)
|
|||
_mesa_glthread_finish(ctx);
|
||||
|
||||
ctx->GLThread.enabled = false;
|
||||
ctx->CurrentClientDispatch = ctx->CurrentServerDispatch;
|
||||
ctx->CurrentClientDispatch = ctx->Dispatch.Current;
|
||||
|
||||
/* Update the dispatch only if the dispatch is current. */
|
||||
if (_glapi_get_dispatch() == ctx->MarshalExec) {
|
||||
|
|
@ -291,7 +291,7 @@ _mesa_glthread_flush_batch(struct gl_context *ctx)
|
|||
if (!glthread->enabled)
|
||||
return;
|
||||
|
||||
if (ctx->CurrentServerDispatch == ctx->ContextLost) {
|
||||
if (ctx->Dispatch.Current == ctx->Dispatch.ContextLost) {
|
||||
_mesa_glthread_disable(ctx);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -234,10 +234,10 @@ uint32_t
|
|||
_mesa_unmarshal_BindBuffer(struct gl_context *ctx,
|
||||
const struct marshal_cmd_BindBuffer *cmd)
|
||||
{
|
||||
CALL_BindBuffer(ctx->CurrentServerDispatch, (cmd->target[0], cmd->buffer[0]));
|
||||
CALL_BindBuffer(ctx->Dispatch.Current, (cmd->target[0], cmd->buffer[0]));
|
||||
|
||||
if (cmd->target[1])
|
||||
CALL_BindBuffer(ctx->CurrentServerDispatch, (cmd->target[1], cmd->buffer[1]));
|
||||
CALL_BindBuffer(ctx->Dispatch.Current, (cmd->target[1], cmd->buffer[1]));
|
||||
|
||||
const unsigned cmd_size = (align(sizeof(struct marshal_cmd_BindBuffer), 8) / 8);
|
||||
assert (cmd_size == cmd->cmd_base.cmd_size);
|
||||
|
|
@ -345,13 +345,13 @@ _mesa_unmarshal_BufferData(struct gl_context *ctx,
|
|||
data = (const void *) (cmd + 1);
|
||||
|
||||
if (cmd->ext_dsa) {
|
||||
CALL_NamedBufferDataEXT(ctx->CurrentServerDispatch,
|
||||
CALL_NamedBufferDataEXT(ctx->Dispatch.Current,
|
||||
(target_or_name, size, data, usage));
|
||||
} else if (cmd->named) {
|
||||
CALL_NamedBufferData(ctx->CurrentServerDispatch,
|
||||
CALL_NamedBufferData(ctx->Dispatch.Current,
|
||||
(target_or_name, size, data, usage));
|
||||
} else {
|
||||
CALL_BufferData(ctx->CurrentServerDispatch,
|
||||
CALL_BufferData(ctx->Dispatch.Current,
|
||||
(target_or_name, size, data, usage));
|
||||
}
|
||||
return cmd->cmd_base.cmd_size;
|
||||
|
|
@ -388,10 +388,10 @@ _mesa_marshal_BufferData_merged(GLuint target_or_name, GLsizeiptr size,
|
|||
(named && target_or_name == 0))) {
|
||||
_mesa_glthread_finish_before(ctx, func);
|
||||
if (named) {
|
||||
CALL_NamedBufferData(ctx->CurrentServerDispatch,
|
||||
CALL_NamedBufferData(ctx->Dispatch.Current,
|
||||
(target_or_name, size, data, usage));
|
||||
} else {
|
||||
CALL_BufferData(ctx->CurrentServerDispatch,
|
||||
CALL_BufferData(ctx->Dispatch.Current,
|
||||
(target_or_name, size, data, usage));
|
||||
}
|
||||
return;
|
||||
|
|
@ -462,13 +462,13 @@ _mesa_unmarshal_BufferSubData(struct gl_context *ctx,
|
|||
const void *data = (const void *) (cmd + 1);
|
||||
|
||||
if (cmd->ext_dsa) {
|
||||
CALL_NamedBufferSubDataEXT(ctx->CurrentServerDispatch,
|
||||
CALL_NamedBufferSubDataEXT(ctx->Dispatch.Current,
|
||||
(target_or_name, offset, size, data));
|
||||
} else if (cmd->named) {
|
||||
CALL_NamedBufferSubData(ctx->CurrentServerDispatch,
|
||||
CALL_NamedBufferSubData(ctx->Dispatch.Current,
|
||||
(target_or_name, offset, size, data));
|
||||
} else {
|
||||
CALL_BufferSubData(ctx->CurrentServerDispatch,
|
||||
CALL_BufferSubData(ctx->Dispatch.Current,
|
||||
(target_or_name, offset, size, data));
|
||||
}
|
||||
return cmd->cmd_base.cmd_size;
|
||||
|
|
@ -506,7 +506,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 &&
|
||||
ctx->Dispatch.Current != ctx->Dispatch.ContextLost &&
|
||||
data && offset > 0 && size > 0) {
|
||||
struct gl_buffer_object *upload_buffer = NULL;
|
||||
unsigned upload_offset = 0;
|
||||
|
|
@ -529,10 +529,10 @@ _mesa_marshal_BufferSubData_merged(GLuint target_or_name, GLintptr offset,
|
|||
(named && target_or_name == 0))) {
|
||||
_mesa_glthread_finish_before(ctx, func);
|
||||
if (named) {
|
||||
CALL_NamedBufferSubData(ctx->CurrentServerDispatch,
|
||||
CALL_NamedBufferSubData(ctx->Dispatch.Current,
|
||||
(target_or_name, offset, size, data));
|
||||
} else {
|
||||
CALL_BufferSubData(ctx->CurrentServerDispatch,
|
||||
CALL_BufferSubData(ctx->Dispatch.Current,
|
||||
(target_or_name, offset, size, data));
|
||||
}
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ _mesa_unmarshal_DrawArrays(struct gl_context *ctx,
|
|||
const GLint first = cmd->first;
|
||||
const GLsizei count = cmd->count;
|
||||
|
||||
CALL_DrawArrays(ctx->CurrentServerDispatch, (mode, first, count));
|
||||
CALL_DrawArrays(ctx->Dispatch.Current, (mode, first, count));
|
||||
const unsigned cmd_size = align(sizeof(*cmd), 8) / 8;
|
||||
assert(cmd_size == cmd->cmd_base.cmd_size);
|
||||
return cmd_size;
|
||||
|
|
@ -325,7 +325,7 @@ _mesa_unmarshal_DrawArraysInstancedBaseInstance(struct gl_context *ctx,
|
|||
const GLsizei instance_count = cmd->instance_count;
|
||||
const GLuint baseinstance = cmd->baseinstance;
|
||||
|
||||
CALL_DrawArraysInstancedBaseInstance(ctx->CurrentServerDispatch,
|
||||
CALL_DrawArraysInstancedBaseInstance(ctx->Dispatch.Current,
|
||||
(mode, first, count, instance_count,
|
||||
baseinstance));
|
||||
const unsigned cmd_size = align(sizeof(*cmd), 8) / 8;
|
||||
|
|
@ -355,7 +355,7 @@ _mesa_unmarshal_DrawArraysInstancedBaseInstanceDrawID(struct gl_context *ctx,
|
|||
const GLuint baseinstance = cmd->baseinstance;
|
||||
|
||||
ctx->DrawID = cmd->drawid;
|
||||
CALL_DrawArraysInstancedBaseInstance(ctx->CurrentServerDispatch,
|
||||
CALL_DrawArraysInstancedBaseInstance(ctx->Dispatch.Current,
|
||||
(mode, first, count, instance_count,
|
||||
baseinstance));
|
||||
ctx->DrawID = 0;
|
||||
|
|
@ -397,7 +397,7 @@ _mesa_unmarshal_DrawArraysUserBuf(struct gl_context *ctx,
|
|||
const GLuint baseinstance = cmd->baseinstance;
|
||||
|
||||
ctx->DrawID = cmd->drawid;
|
||||
CALL_DrawArraysInstancedBaseInstance(ctx->CurrentServerDispatch,
|
||||
CALL_DrawArraysInstancedBaseInstance(ctx->Dispatch.Current,
|
||||
(mode, first, count, instance_count,
|
||||
baseinstance));
|
||||
ctx->DrawID = 0;
|
||||
|
|
@ -431,7 +431,7 @@ draw_arrays(GLuint drawid, GLenum mode, GLint first, GLsizei count,
|
|||
if (unlikely(compiled_into_dlist && ctx->GLThread.ListMode)) {
|
||||
_mesa_glthread_finish_before(ctx, "DrawArrays");
|
||||
/* Use the function that's compiled into a display list. */
|
||||
CALL_DrawArrays(ctx->CurrentServerDispatch, (mode, first, count));
|
||||
CALL_DrawArrays(ctx->Dispatch.Current, (mode, first, count));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -446,7 +446,7 @@ draw_arrays(GLuint drawid, GLenum mode, GLint first, GLsizei count,
|
|||
if (!user_buffer_mask || count <= 0 || instance_count <= 0 ||
|
||||
/* This will just generate GL_INVALID_OPERATION, as it should. */
|
||||
ctx->GLThread.inside_begin_end ||
|
||||
ctx->CurrentServerDispatch == ctx->ContextLost ||
|
||||
ctx->Dispatch.Current == ctx->Dispatch.ContextLost ||
|
||||
ctx->GLThread.ListMode) {
|
||||
if (instance_count == 1 && baseinstance == 0 && drawid == 0) {
|
||||
int cmd_size = sizeof(struct marshal_cmd_DrawArrays);
|
||||
|
|
@ -536,7 +536,7 @@ _mesa_unmarshal_MultiDrawArraysUserBuf(struct gl_context *ctx,
|
|||
if (user_buffer_mask)
|
||||
_mesa_InternalBindVertexBuffers(ctx, buffers, user_buffer_mask);
|
||||
|
||||
CALL_MultiDrawArrays(ctx->CurrentServerDispatch,
|
||||
CALL_MultiDrawArrays(ctx->Dispatch.Current,
|
||||
(mode, first, count, draw_count));
|
||||
return cmd->cmd_base.cmd_size;
|
||||
}
|
||||
|
|
@ -549,7 +549,7 @@ _mesa_marshal_MultiDrawArrays(GLenum mode, const GLint *first,
|
|||
|
||||
if (unlikely(ctx->GLThread.ListMode)) {
|
||||
_mesa_glthread_finish_before(ctx, "MultiDrawArrays");
|
||||
CALL_MultiDrawArrays(ctx->CurrentServerDispatch,
|
||||
CALL_MultiDrawArrays(ctx->Dispatch.Current,
|
||||
(mode, first, count, draw_count));
|
||||
return;
|
||||
}
|
||||
|
|
@ -557,7 +557,7 @@ _mesa_marshal_MultiDrawArrays(GLenum mode, const GLint *first,
|
|||
struct glthread_attrib_binding buffers[VERT_ATTRIB_MAX];
|
||||
unsigned user_buffer_mask =
|
||||
ctx->API == API_OPENGL_CORE || draw_count <= 0 ||
|
||||
ctx->CurrentServerDispatch == ctx->ContextLost ||
|
||||
ctx->Dispatch.Current == ctx->Dispatch.ContextLost ||
|
||||
ctx->GLThread.inside_begin_end ? 0 : get_user_buffer_mask(ctx);
|
||||
|
||||
if (user_buffer_mask) {
|
||||
|
|
@ -625,7 +625,7 @@ _mesa_marshal_MultiDrawArrays(GLenum mode, const GLint *first,
|
|||
if (user_buffer_mask)
|
||||
_mesa_InternalBindVertexBuffers(ctx, buffers, user_buffer_mask);
|
||||
|
||||
CALL_MultiDrawArrays(ctx->CurrentServerDispatch,
|
||||
CALL_MultiDrawArrays(ctx->Dispatch.Current,
|
||||
(mode, first, count, draw_count));
|
||||
}
|
||||
}
|
||||
|
|
@ -651,7 +651,7 @@ _mesa_unmarshal_DrawElementsInstanced(struct gl_context *ctx,
|
|||
const GLvoid *indices = cmd->indices;
|
||||
const GLsizei instance_count = cmd->instance_count;
|
||||
|
||||
CALL_DrawElementsInstanced(ctx->CurrentServerDispatch,
|
||||
CALL_DrawElementsInstanced(ctx->Dispatch.Current,
|
||||
(mode, count, type, indices, instance_count));
|
||||
const unsigned cmd_size = align(sizeof(*cmd), 8) / 8;
|
||||
assert(cmd_size == cmd->cmd_base.cmd_size);
|
||||
|
|
@ -679,7 +679,7 @@ _mesa_unmarshal_DrawElementsBaseVertex(struct gl_context *ctx,
|
|||
const GLvoid *indices = cmd->indices;
|
||||
const GLint basevertex = cmd->basevertex;
|
||||
|
||||
CALL_DrawElementsBaseVertex(ctx->CurrentServerDispatch,
|
||||
CALL_DrawElementsBaseVertex(ctx->Dispatch.Current,
|
||||
(mode, count, type, indices, basevertex));
|
||||
const unsigned cmd_size = align(sizeof(*cmd), 8) / 8;
|
||||
assert(cmd_size == cmd->cmd_base.cmd_size);
|
||||
|
|
@ -711,7 +711,7 @@ _mesa_unmarshal_DrawElementsInstancedBaseVertexBaseInstance(struct gl_context *c
|
|||
const GLint basevertex = cmd->basevertex;
|
||||
const GLuint baseinstance = cmd->baseinstance;
|
||||
|
||||
CALL_DrawElementsInstancedBaseVertexBaseInstance(ctx->CurrentServerDispatch,
|
||||
CALL_DrawElementsInstancedBaseVertexBaseInstance(ctx->Dispatch.Current,
|
||||
(mode, count, type, indices,
|
||||
instance_count, basevertex,
|
||||
baseinstance));
|
||||
|
|
@ -746,7 +746,7 @@ _mesa_unmarshal_DrawElementsInstancedBaseVertexBaseInstanceDrawID(struct gl_cont
|
|||
const GLuint baseinstance = cmd->baseinstance;
|
||||
|
||||
ctx->DrawID = cmd->drawid;
|
||||
CALL_DrawElementsInstancedBaseVertexBaseInstance(ctx->CurrentServerDispatch,
|
||||
CALL_DrawElementsInstancedBaseVertexBaseInstance(ctx->Dispatch.Current,
|
||||
(mode, count, type, indices,
|
||||
instance_count, basevertex,
|
||||
baseinstance));
|
||||
|
|
@ -795,7 +795,7 @@ _mesa_unmarshal_DrawElementsUserBuf(struct gl_context *ctx,
|
|||
struct gl_buffer_object *index_buffer = cmd->index_buffer;
|
||||
|
||||
ctx->DrawID = cmd->drawid;
|
||||
CALL_DrawElementsUserBuf(ctx->CurrentServerDispatch,
|
||||
CALL_DrawElementsUserBuf(ctx->Dispatch.Current,
|
||||
((GLintptr)index_buffer, mode, count, type,
|
||||
indices, instance_count, basevertex,
|
||||
baseinstance));
|
||||
|
|
@ -834,13 +834,13 @@ draw_elements(GLuint drawid, GLenum mode, GLsizei count, GLenum type,
|
|||
|
||||
/* Only use the ones that are compiled into display lists. */
|
||||
if (basevertex) {
|
||||
CALL_DrawElementsBaseVertex(ctx->CurrentServerDispatch,
|
||||
CALL_DrawElementsBaseVertex(ctx->Dispatch.Current,
|
||||
(mode, count, type, indices, basevertex));
|
||||
} else if (index_bounds_valid) {
|
||||
CALL_DrawRangeElements(ctx->CurrentServerDispatch,
|
||||
CALL_DrawRangeElements(ctx->Dispatch.Current,
|
||||
(mode, min_index, max_index, count, type, indices));
|
||||
} else {
|
||||
CALL_DrawElements(ctx->CurrentServerDispatch, (mode, count, type, indices));
|
||||
CALL_DrawElements(ctx->Dispatch.Current, (mode, count, type, indices));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -863,7 +863,7 @@ draw_elements(GLuint drawid, GLenum mode, GLsizei count, GLenum type,
|
|||
if (count <= 0 || instance_count <= 0 ||
|
||||
!is_index_type_valid(type) ||
|
||||
(!user_buffer_mask && !has_user_indices) ||
|
||||
ctx->CurrentServerDispatch == ctx->ContextLost ||
|
||||
ctx->Dispatch.Current == ctx->Dispatch.ContextLost ||
|
||||
/* This will just generate GL_INVALID_OPERATION, as it should. */
|
||||
ctx->GLThread.inside_begin_end ||
|
||||
ctx->GLThread.ListMode) {
|
||||
|
|
@ -1038,7 +1038,7 @@ _mesa_unmarshal_MultiDrawElementsUserBuf(struct gl_context *ctx,
|
|||
const GLenum type = cmd->type;
|
||||
struct gl_buffer_object *index_buffer = cmd->index_buffer;
|
||||
|
||||
CALL_MultiDrawElementsUserBuf(ctx->CurrentServerDispatch,
|
||||
CALL_MultiDrawElementsUserBuf(ctx->Dispatch.Current,
|
||||
((GLintptr)index_buffer, mode, count, type,
|
||||
indices, draw_count, basevertex));
|
||||
_mesa_reference_buffer_object(ctx, &index_buffer, NULL);
|
||||
|
|
@ -1095,7 +1095,7 @@ multi_draw_elements_async(struct gl_context *ctx, GLenum mode,
|
|||
_mesa_InternalBindVertexBuffers(ctx, buffers, user_buffer_mask);
|
||||
|
||||
/* Draw. */
|
||||
CALL_MultiDrawElementsUserBuf(ctx->CurrentServerDispatch,
|
||||
CALL_MultiDrawElementsUserBuf(ctx->Dispatch.Current,
|
||||
((GLintptr)index_buffer, mode, count,
|
||||
type, indices, draw_count, basevertex));
|
||||
_mesa_reference_buffer_object(ctx, &index_buffer, NULL);
|
||||
|
|
@ -1115,11 +1115,11 @@ _mesa_marshal_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
|
|||
_mesa_glthread_finish_before(ctx, "MultiDrawElements");
|
||||
|
||||
if (basevertex) {
|
||||
CALL_MultiDrawElementsBaseVertex(ctx->CurrentServerDispatch,
|
||||
CALL_MultiDrawElementsBaseVertex(ctx->Dispatch.Current,
|
||||
(mode, count, type, indices, draw_count,
|
||||
basevertex));
|
||||
} else {
|
||||
CALL_MultiDrawElements(ctx->CurrentServerDispatch,
|
||||
CALL_MultiDrawElements(ctx->Dispatch.Current,
|
||||
(mode, count, type, indices, draw_count));
|
||||
}
|
||||
return;
|
||||
|
|
@ -1134,7 +1134,7 @@ _mesa_marshal_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
|
|||
* a GL error, we don't upload anything.
|
||||
*/
|
||||
if (draw_count > 0 && is_index_type_valid(type) &&
|
||||
ctx->CurrentServerDispatch != ctx->ContextLost &&
|
||||
ctx->Dispatch.Current != ctx->Dispatch.ContextLost &&
|
||||
!ctx->GLThread.inside_begin_end) {
|
||||
user_buffer_mask = ctx->API == API_OPENGL_CORE ? 0 : get_user_buffer_mask(ctx);
|
||||
has_user_indices = vao->CurrentElementBufferName == 0;
|
||||
|
|
@ -1377,7 +1377,7 @@ draw_indirect_async_allowed(struct gl_context *ctx, unsigned user_buffer_mask)
|
|||
/* This will just generate GL_INVALID_OPERATION, as it should. */
|
||||
ctx->GLThread.inside_begin_end ||
|
||||
ctx->GLThread.ListMode ||
|
||||
ctx->CurrentServerDispatch == ctx->ContextLost ||
|
||||
ctx->Dispatch.Current == ctx->Dispatch.ContextLost ||
|
||||
/* If the DrawIndirect buffer is bound, it behaves like profile != compat
|
||||
* if there are no user VBOs. */
|
||||
(ctx->GLThread.CurrentDrawIndirectBufferName && !user_buffer_mask);
|
||||
|
|
@ -1397,7 +1397,7 @@ _mesa_unmarshal_DrawArraysIndirect(struct gl_context *ctx,
|
|||
GLenum mode = cmd->mode;
|
||||
const GLvoid * indirect = cmd->indirect;
|
||||
|
||||
CALL_DrawArraysIndirect(ctx->CurrentServerDispatch, (mode, indirect));
|
||||
CALL_DrawArraysIndirect(ctx->Dispatch.Current, (mode, indirect));
|
||||
|
||||
const unsigned cmd_size =
|
||||
(align(sizeof(struct marshal_cmd_DrawArraysIndirect), 8) / 8);
|
||||
|
|
@ -1443,7 +1443,7 @@ _mesa_unmarshal_DrawElementsIndirect(struct gl_context *ctx,
|
|||
GLenum type = cmd->type;
|
||||
const GLvoid * indirect = cmd->indirect;
|
||||
|
||||
CALL_DrawElementsIndirect(ctx->CurrentServerDispatch, (mode, type, indirect));
|
||||
CALL_DrawElementsIndirect(ctx->Dispatch.Current, (mode, type, indirect));
|
||||
|
||||
const unsigned cmd_size =
|
||||
(align(sizeof(struct marshal_cmd_DrawElementsIndirect), 8) / 8);
|
||||
|
|
@ -1493,7 +1493,7 @@ _mesa_unmarshal_MultiDrawArraysIndirect(struct gl_context *ctx,
|
|||
GLsizei primcount = cmd->primcount;
|
||||
GLsizei stride = cmd->stride;
|
||||
|
||||
CALL_MultiDrawArraysIndirect(ctx->CurrentServerDispatch,
|
||||
CALL_MultiDrawArraysIndirect(ctx->Dispatch.Current,
|
||||
(mode, indirect, primcount, stride));
|
||||
|
||||
const unsigned cmd_size =
|
||||
|
|
@ -1550,7 +1550,7 @@ _mesa_unmarshal_MultiDrawElementsIndirect(struct gl_context *ctx,
|
|||
GLsizei primcount = cmd->primcount;
|
||||
GLsizei stride = cmd->stride;
|
||||
|
||||
CALL_MultiDrawElementsIndirect(ctx->CurrentServerDispatch,
|
||||
CALL_MultiDrawElementsIndirect(ctx->Dispatch.Current,
|
||||
(mode, type, indirect, primcount, stride));
|
||||
|
||||
const unsigned cmd_size =
|
||||
|
|
@ -1611,7 +1611,7 @@ _mesa_unmarshal_MultiDrawArraysIndirectCountARB(struct gl_context *ctx,
|
|||
GLsizei maxdrawcount = cmd->maxdrawcount;
|
||||
GLsizei stride = cmd->stride;
|
||||
|
||||
CALL_MultiDrawArraysIndirectCountARB(ctx->CurrentServerDispatch,
|
||||
CALL_MultiDrawArraysIndirectCountARB(ctx->Dispatch.Current,
|
||||
(mode, indirect, drawcount,
|
||||
maxdrawcount, stride));
|
||||
|
||||
|
|
@ -1678,7 +1678,7 @@ _mesa_unmarshal_MultiDrawElementsIndirectCountARB(struct gl_context *ctx,
|
|||
GLsizei maxdrawcount = cmd->maxdrawcount;
|
||||
GLsizei stride = cmd->stride;
|
||||
|
||||
CALL_MultiDrawElementsIndirectCountARB(ctx->CurrentServerDispatch, (mode, type, indirect, drawcount, maxdrawcount, stride));
|
||||
CALL_MultiDrawElementsIndirectCountARB(ctx->Dispatch.Current, (mode, type, indirect, drawcount, maxdrawcount, stride));
|
||||
|
||||
const unsigned cmd_size = (align(sizeof(struct marshal_cmd_MultiDrawElementsIndirectCountARB), 8) / 8);
|
||||
assert(cmd_size == cmd->cmd_base.cmd_size);
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ _mesa_marshal_GetIntegerv(GLenum pname, GLint *p)
|
|||
|
||||
sync:
|
||||
_mesa_glthread_finish_before(ctx, "GetIntegerv");
|
||||
CALL_GetIntegerv(ctx->CurrentServerDispatch, (pname, p));
|
||||
CALL_GetIntegerv(ctx->Dispatch.Current, (pname, p));
|
||||
}
|
||||
|
||||
/* TODO: Implement glGetBooleanv, glGetFloatv, etc. if needed */
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ _mesa_unmarshal_CallList(struct gl_context *ctx, const struct marshal_cmd_CallLi
|
|||
const GLuint num = cmd->num;
|
||||
|
||||
if (cmd->cmd_base.cmd_size == sizeof(*cmd) / 8) {
|
||||
CALL_CallList(ctx->CurrentServerDispatch, (num));
|
||||
CALL_CallList(ctx->Dispatch.Current, (num));
|
||||
} else {
|
||||
CALL_CallLists(ctx->CurrentServerDispatch, (num, GL_UNSIGNED_INT, cmd->list));
|
||||
CALL_CallLists(ctx->Dispatch.Current, (num, GL_UNSIGNED_INT, cmd->list));
|
||||
}
|
||||
|
||||
return cmd->cmd_base.cmd_size;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ _mesa_marshal_GetActiveUniform(GLuint program, GLuint index, GLsizei bufSize,
|
|||
/* 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,
|
||||
CALL_GetActiveUniform(ctx->Dispatch.Current,
|
||||
(program, index, bufSize, length, size, type,
|
||||
name));
|
||||
return;
|
||||
|
|
@ -100,7 +100,7 @@ _mesa_marshal_GetUniformLocation(GLuint program, const GLchar *name)
|
|||
/* 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));
|
||||
return CALL_GetUniformLocation(ctx->Dispatch.Current, (program, name));
|
||||
}
|
||||
|
||||
wait_for_glLinkProgram(ctx);
|
||||
|
|
|
|||
|
|
@ -3211,6 +3211,57 @@ struct gl_attrib_node
|
|||
} Viewport;
|
||||
};
|
||||
|
||||
/**
|
||||
* Dispatch tables.
|
||||
*/
|
||||
struct gl_dispatch
|
||||
{
|
||||
/**
|
||||
* For non-displaylist-saving, non-begin/end.
|
||||
*/
|
||||
struct _glapi_table *OutsideBeginEnd;
|
||||
|
||||
/**
|
||||
* The dispatch table used between glBegin() and glEnd() (outside of a
|
||||
* display list). Only valid functions between those two are set.
|
||||
*/
|
||||
struct _glapi_table *BeginEnd;
|
||||
|
||||
/**
|
||||
* Same as BeginEnd except glVertex{Attrib} functions. Used when
|
||||
* HW GL_SELECT mode instead of BeginEnd to insert extra code
|
||||
* for GL_SELECT.
|
||||
*/
|
||||
struct _glapi_table *HWSelectModeBeginEnd;
|
||||
|
||||
/**
|
||||
* The dispatch table used between glNewList() and glEndList().
|
||||
*/
|
||||
struct _glapi_table *Save;
|
||||
|
||||
/**
|
||||
* Dispatch table for when a graphics reset has happened.
|
||||
*/
|
||||
struct _glapi_table *ContextLost;
|
||||
|
||||
/**
|
||||
* The current dispatch table for non-displaylist-saving execution.
|
||||
* It can be equal to one of these:
|
||||
* - OutsideBeginEnd
|
||||
* - BeginEnd
|
||||
* - HWSelectModeBeginEnd
|
||||
*/
|
||||
struct _glapi_table *Exec;
|
||||
|
||||
/**
|
||||
* The current dispatch table overall. It can be equal to one of these:
|
||||
* - Exec
|
||||
* - Save
|
||||
* - ContextLost
|
||||
*/
|
||||
struct _glapi_table *Current;
|
||||
};
|
||||
|
||||
/**
|
||||
* Mesa rendering context.
|
||||
*
|
||||
|
|
@ -3234,48 +3285,24 @@ struct gl_context
|
|||
gl_api API;
|
||||
|
||||
/**
|
||||
* The current dispatch table for non-displaylist-saving execution, either
|
||||
* BeginEnd or OutsideBeginEnd
|
||||
* Dispatch tables implementing OpenGL functions. GLThread has no effect
|
||||
* on this.
|
||||
*/
|
||||
struct _glapi_table *Exec;
|
||||
struct gl_dispatch Dispatch;
|
||||
|
||||
/**
|
||||
* The normal dispatch table for non-displaylist-saving, non-begin/end
|
||||
*/
|
||||
struct _glapi_table *OutsideBeginEnd;
|
||||
/** The dispatch table used between glNewList() and glEndList() */
|
||||
struct _glapi_table *Save;
|
||||
/**
|
||||
* The dispatch table used between glBegin() and glEnd() (outside of a
|
||||
* display list). Only valid functions between those two are set.
|
||||
*/
|
||||
struct _glapi_table *BeginEnd;
|
||||
/**
|
||||
* Same as BeginEnd except vertex postion set functions. Used when
|
||||
* HW GL_SELECT mode instead of BeginEnd.
|
||||
*/
|
||||
struct _glapi_table *HWSelectModeBeginEnd;
|
||||
/**
|
||||
* Dispatch table for when a graphics reset has happened.
|
||||
*/
|
||||
struct _glapi_table *ContextLost;
|
||||
/**
|
||||
* Dispatch table used to marshal API calls from the client program to a
|
||||
* separate server thread.
|
||||
* Dispatch table used by GLThread, a component used to marshal API
|
||||
* calls from an application to a separate thread.
|
||||
*/
|
||||
struct _glapi_table *MarshalExec;
|
||||
|
||||
/**
|
||||
* Dispatch table currently in use for fielding API calls from the client
|
||||
* program. If API calls are being marshalled to another thread, this ==
|
||||
* MarshalExec. Otherwise it == CurrentServerDispatch.
|
||||
* MarshalExec. Otherwise it == Dispatch.Current.
|
||||
*/
|
||||
struct _glapi_table *CurrentClientDispatch;
|
||||
|
||||
/**
|
||||
* Dispatch table currently in use for performing API calls. == Save or
|
||||
* Exec.
|
||||
*/
|
||||
struct _glapi_table *CurrentServerDispatch;
|
||||
|
||||
/*@}*/
|
||||
|
||||
struct glthread_state GLThread;
|
||||
|
|
|
|||
|
|
@ -67,14 +67,14 @@ context_lost_nop_handler(void)
|
|||
void
|
||||
_mesa_set_context_lost_dispatch(struct gl_context *ctx)
|
||||
{
|
||||
if (ctx->ContextLost == NULL) {
|
||||
if (ctx->Dispatch.ContextLost == NULL) {
|
||||
int numEntries = MAX2(_glapi_get_dispatch_table_size(), _gloffset_COUNT);
|
||||
|
||||
ctx->ContextLost = malloc(numEntries * sizeof(_glapi_proc));
|
||||
if (!ctx->ContextLost)
|
||||
ctx->Dispatch.ContextLost = malloc(numEntries * sizeof(_glapi_proc));
|
||||
if (!ctx->Dispatch.ContextLost)
|
||||
return;
|
||||
|
||||
_glapi_proc *entry = (_glapi_proc *) ctx->ContextLost;
|
||||
_glapi_proc *entry = (_glapi_proc *) ctx->Dispatch.ContextLost;
|
||||
unsigned i;
|
||||
for (i = 0; i < numEntries; i++)
|
||||
entry[i] = (_glapi_proc) context_lost_nop_handler;
|
||||
|
|
@ -97,14 +97,14 @@ _mesa_set_context_lost_dispatch(struct gl_context *ctx)
|
|||
* + GetQueryObjectuiv with <pname> QUERY_RESULT_AVAILABLE
|
||||
* ignores the other parameters and returns TRUE in <params>."
|
||||
*/
|
||||
SET_GetError(ctx->ContextLost, _mesa_GetError);
|
||||
SET_GetGraphicsResetStatusARB(ctx->ContextLost, _mesa_GetGraphicsResetStatusARB);
|
||||
SET_GetSynciv(ctx->ContextLost, _context_lost_GetSynciv);
|
||||
SET_GetQueryObjectuiv(ctx->ContextLost, _context_lost_GetQueryObjectuiv);
|
||||
SET_GetError(ctx->Dispatch.ContextLost, _mesa_GetError);
|
||||
SET_GetGraphicsResetStatusARB(ctx->Dispatch.ContextLost, _mesa_GetGraphicsResetStatusARB);
|
||||
SET_GetSynciv(ctx->Dispatch.ContextLost, _context_lost_GetSynciv);
|
||||
SET_GetQueryObjectuiv(ctx->Dispatch.ContextLost, _context_lost_GetQueryObjectuiv);
|
||||
}
|
||||
|
||||
ctx->CurrentServerDispatch = ctx->ContextLost;
|
||||
_glapi_set_dispatch(ctx->CurrentServerDispatch);
|
||||
ctx->Dispatch.Current = ctx->Dispatch.ContextLost;
|
||||
_glapi_set_dispatch(ctx->Dispatch.Current);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -851,20 +851,20 @@ _mesa_Begin(GLenum mode)
|
|||
|
||||
ctx->Driver.CurrentExecPrimitive = mode;
|
||||
|
||||
ctx->Exec = _mesa_hw_select_enabled(ctx) ?
|
||||
ctx->HWSelectModeBeginEnd : ctx->BeginEnd;
|
||||
ctx->Dispatch.Exec = _mesa_hw_select_enabled(ctx) ?
|
||||
ctx->Dispatch.HWSelectModeBeginEnd : ctx->Dispatch.BeginEnd;
|
||||
|
||||
/* We may have been called from a display list, in which case we should
|
||||
* leave dlist.c's dispatch table in place.
|
||||
*/
|
||||
if (ctx->GLThread.enabled) {
|
||||
if (ctx->CurrentServerDispatch == ctx->OutsideBeginEnd)
|
||||
ctx->CurrentServerDispatch = ctx->Exec;
|
||||
} else if (ctx->CurrentClientDispatch == ctx->OutsideBeginEnd) {
|
||||
ctx->CurrentClientDispatch = ctx->CurrentServerDispatch = ctx->Exec;
|
||||
if (ctx->Dispatch.Current == ctx->Dispatch.OutsideBeginEnd)
|
||||
ctx->Dispatch.Current = ctx->Dispatch.Exec;
|
||||
} else if (ctx->CurrentClientDispatch == ctx->Dispatch.OutsideBeginEnd) {
|
||||
ctx->CurrentClientDispatch = ctx->Dispatch.Current = ctx->Dispatch.Exec;
|
||||
_glapi_set_dispatch(ctx->CurrentClientDispatch);
|
||||
} else {
|
||||
assert(ctx->CurrentClientDispatch == ctx->Save);
|
||||
assert(ctx->CurrentClientDispatch == ctx->Dispatch.Save);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -915,16 +915,16 @@ _mesa_End(void)
|
|||
return;
|
||||
}
|
||||
|
||||
ctx->Exec = ctx->OutsideBeginEnd;
|
||||
ctx->Dispatch.Exec = ctx->Dispatch.OutsideBeginEnd;
|
||||
|
||||
if (ctx->GLThread.enabled) {
|
||||
if (ctx->CurrentServerDispatch == ctx->BeginEnd ||
|
||||
ctx->CurrentServerDispatch == ctx->HWSelectModeBeginEnd) {
|
||||
ctx->CurrentServerDispatch = ctx->Exec;
|
||||
if (ctx->Dispatch.Current == ctx->Dispatch.BeginEnd ||
|
||||
ctx->Dispatch.Current == ctx->Dispatch.HWSelectModeBeginEnd) {
|
||||
ctx->Dispatch.Current = ctx->Dispatch.Exec;
|
||||
}
|
||||
} else if (ctx->CurrentClientDispatch == ctx->BeginEnd ||
|
||||
ctx->CurrentClientDispatch == ctx->HWSelectModeBeginEnd) {
|
||||
ctx->CurrentClientDispatch = ctx->CurrentServerDispatch = ctx->Exec;
|
||||
} else if (ctx->CurrentClientDispatch == ctx->Dispatch.BeginEnd ||
|
||||
ctx->CurrentClientDispatch == ctx->Dispatch.HWSelectModeBeginEnd) {
|
||||
ctx->CurrentClientDispatch = ctx->Dispatch.Current = ctx->Dispatch.Exec;
|
||||
_glapi_set_dispatch(ctx->CurrentClientDispatch);
|
||||
}
|
||||
|
||||
|
|
@ -1083,11 +1083,11 @@ vbo_init_dispatch_begin_end(struct gl_context *ctx)
|
|||
#define NAME(x) _mesa_##x
|
||||
#define NAME_ES(x) _es_##x
|
||||
|
||||
struct _glapi_table *tab = ctx->OutsideBeginEnd;
|
||||
struct _glapi_table *tab = ctx->Dispatch.OutsideBeginEnd;
|
||||
#include "api_beginend_init.h"
|
||||
|
||||
if (ctx->BeginEnd) {
|
||||
tab = ctx->BeginEnd;
|
||||
if (ctx->Dispatch.BeginEnd) {
|
||||
tab = ctx->Dispatch.BeginEnd;
|
||||
#include "api_beginend_init.h"
|
||||
}
|
||||
}
|
||||
|
|
@ -1253,10 +1253,10 @@ void
|
|||
vbo_init_dispatch_hw_select_begin_end(struct gl_context *ctx)
|
||||
{
|
||||
int numEntries = MAX2(_gloffset_COUNT, _glapi_get_dispatch_table_size());
|
||||
memcpy(ctx->HWSelectModeBeginEnd, ctx->BeginEnd, numEntries * sizeof(_glapi_proc));
|
||||
memcpy(ctx->Dispatch.HWSelectModeBeginEnd, ctx->Dispatch.BeginEnd, numEntries * sizeof(_glapi_proc));
|
||||
|
||||
#undef NAME
|
||||
#define NAME(x) _hw_select_##x
|
||||
struct _glapi_table *tab = ctx->HWSelectModeBeginEnd;
|
||||
struct _glapi_table *tab = ctx->Dispatch.HWSelectModeBeginEnd;
|
||||
#include "api_hw_select_init.h"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ vbo_exec_vtx_map(struct vbo_exec_context *exec)
|
|||
vbo_install_exec_vtxfmt_noop(ctx);
|
||||
}
|
||||
else {
|
||||
if (_mesa_using_noop_vtxfmt(ctx->Exec)) {
|
||||
if (_mesa_using_noop_vtxfmt(ctx->Dispatch.Exec)) {
|
||||
/* The no-op functions are installed so switch back to regular
|
||||
* functions. We do this test just to avoid frequent and needless
|
||||
* calls to vbo_install_exec_vtxfmt().
|
||||
|
|
|
|||
|
|
@ -161,9 +161,9 @@ void vbo_exec_do_EvalCoord1f(struct vbo_exec_context *exec, GLfloat u)
|
|||
map->Order);
|
||||
|
||||
if (exec->eval.map1[0].sz == 4)
|
||||
CALL_Vertex4fv(ctx->CurrentServerDispatch, ( vertex ));
|
||||
CALL_Vertex4fv(ctx->Dispatch.Current, ( vertex ));
|
||||
else
|
||||
CALL_Vertex3fv(ctx->CurrentServerDispatch, ( vertex ));
|
||||
CALL_Vertex3fv(ctx->Dispatch.Current, ( vertex ));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -242,9 +242,9 @@ void vbo_exec_do_EvalCoord2f( struct vbo_exec_context *exec,
|
|||
}
|
||||
|
||||
if (exec->vtx.attr[VBO_ATTRIB_POS].size == 4)
|
||||
CALL_Vertex4fv(ctx->CurrentServerDispatch, ( vertex ));
|
||||
CALL_Vertex4fv(ctx->Dispatch.Current, ( vertex ));
|
||||
else
|
||||
CALL_Vertex3fv(ctx->CurrentServerDispatch, ( vertex ));
|
||||
CALL_Vertex3fv(ctx->Dispatch.Current, ( vertex ));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -127,16 +127,16 @@ vbo_install_exec_vtxfmt_noop(struct gl_context *ctx)
|
|||
#define NAME(x) _mesa_noop_##x
|
||||
#define NAME_ES(x) _mesa_noop_##x
|
||||
|
||||
struct _glapi_table *tab = ctx->Exec;
|
||||
struct _glapi_table *tab = ctx->Dispatch.Exec;
|
||||
#include "api_beginend_init.h"
|
||||
|
||||
if (ctx->BeginEnd) {
|
||||
tab = ctx->BeginEnd;
|
||||
if (ctx->Dispatch.BeginEnd) {
|
||||
tab = ctx->Dispatch.BeginEnd;
|
||||
#include "api_beginend_init.h"
|
||||
}
|
||||
|
||||
if (ctx->HWSelectModeBeginEnd) {
|
||||
tab = ctx->HWSelectModeBeginEnd;
|
||||
if (ctx->Dispatch.HWSelectModeBeginEnd) {
|
||||
tab = ctx->Dispatch.HWSelectModeBeginEnd;
|
||||
#include "api_beginend_init.h"
|
||||
}
|
||||
}
|
||||
|
|
@ -145,7 +145,7 @@ vbo_install_exec_vtxfmt_noop(struct gl_context *ctx)
|
|||
void
|
||||
vbo_install_save_vtxfmt_noop(struct gl_context *ctx)
|
||||
{
|
||||
struct _glapi_table *tab = ctx->Save;
|
||||
struct _glapi_table *tab = ctx->Dispatch.Save;
|
||||
#include "api_beginend_init.h"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1481,7 +1481,7 @@ _save_EvalCoord1f(GLfloat u)
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
dlist_fallback(ctx);
|
||||
CALL_EvalCoord1f(ctx->Save, (u));
|
||||
CALL_EvalCoord1f(ctx->Dispatch.Save, (u));
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
|
|
@ -1489,7 +1489,7 @@ _save_EvalCoord1fv(const GLfloat * v)
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
dlist_fallback(ctx);
|
||||
CALL_EvalCoord1fv(ctx->Save, (v));
|
||||
CALL_EvalCoord1fv(ctx->Dispatch.Save, (v));
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
|
|
@ -1497,7 +1497,7 @@ _save_EvalCoord2f(GLfloat u, GLfloat v)
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
dlist_fallback(ctx);
|
||||
CALL_EvalCoord2f(ctx->Save, (u, v));
|
||||
CALL_EvalCoord2f(ctx->Dispatch.Save, (u, v));
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
|
|
@ -1505,7 +1505,7 @@ _save_EvalCoord2fv(const GLfloat * v)
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
dlist_fallback(ctx);
|
||||
CALL_EvalCoord2fv(ctx->Save, (v));
|
||||
CALL_EvalCoord2fv(ctx->Dispatch.Save, (v));
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
|
|
@ -1513,7 +1513,7 @@ _save_EvalPoint1(GLint i)
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
dlist_fallback(ctx);
|
||||
CALL_EvalPoint1(ctx->Save, (i));
|
||||
CALL_EvalPoint1(ctx->Dispatch.Save, (i));
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
|
|
@ -1521,7 +1521,7 @@ _save_EvalPoint2(GLint i, GLint j)
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
dlist_fallback(ctx);
|
||||
CALL_EvalPoint2(ctx->Save, (i, j));
|
||||
CALL_EvalPoint2(ctx->Dispatch.Save, (i, j));
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
|
|
@ -1529,7 +1529,7 @@ _save_CallList(GLuint l)
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
dlist_fallback(ctx);
|
||||
CALL_CallList(ctx->Save, (l));
|
||||
CALL_CallList(ctx->Dispatch.Save, (l));
|
||||
}
|
||||
|
||||
static void GLAPIENTRY
|
||||
|
|
@ -1537,7 +1537,7 @@ _save_CallLists(GLsizei n, GLenum type, const GLvoid * v)
|
|||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
dlist_fallback(ctx);
|
||||
CALL_CallLists(ctx->Save, (n, type, v));
|
||||
CALL_CallLists(ctx->Dispatch.Save, (n, type, v));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1624,7 +1624,7 @@ _save_PrimitiveRestartNV(void)
|
|||
bool no_current_update = save->no_current_update;
|
||||
|
||||
/* restart primitive */
|
||||
CALL_End(ctx->CurrentServerDispatch, ());
|
||||
CALL_End(ctx->Dispatch.Current, ());
|
||||
vbo_save_NotifyBegin(ctx, curPrim, no_current_update);
|
||||
}
|
||||
}
|
||||
|
|
@ -1634,7 +1634,7 @@ void GLAPIENTRY
|
|||
save_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
struct _glapi_table *dispatch = ctx->CurrentServerDispatch;
|
||||
struct _glapi_table *dispatch = ctx->Dispatch.Current;
|
||||
|
||||
vbo_save_NotifyBegin(ctx, GL_QUADS, false);
|
||||
CALL_Vertex2f(dispatch, (x1, y1));
|
||||
|
|
@ -1712,7 +1712,7 @@ save_DrawArrays(GLenum mode, GLint start, GLsizei count)
|
|||
|
||||
for (i = 0; i < count; i++)
|
||||
_mesa_array_element(ctx, start + i);
|
||||
CALL_End(ctx->CurrentServerDispatch, ());
|
||||
CALL_End(ctx->Dispatch.Current, ());
|
||||
|
||||
_mesa_vao_unmap_arrays(ctx, vao);
|
||||
}
|
||||
|
|
@ -1771,7 +1771,7 @@ array_element(struct gl_context *ctx,
|
|||
*/
|
||||
if (ctx->Array._PrimitiveRestart[index_size_shift] &&
|
||||
elt == ctx->Array._RestartIndex[index_size_shift]) {
|
||||
CALL_PrimitiveRestartNV(ctx->CurrentServerDispatch, ());
|
||||
CALL_PrimitiveRestartNV(ctx->Dispatch.Current, ());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1841,7 +1841,7 @@ save_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
|
|||
break;
|
||||
}
|
||||
|
||||
CALL_End(ctx->CurrentServerDispatch, ());
|
||||
CALL_End(ctx->Dispatch.Current, ());
|
||||
|
||||
_mesa_vao_unmap(ctx, vao);
|
||||
}
|
||||
|
|
@ -1910,7 +1910,7 @@ save_MultiDrawElements(GLenum mode, const GLsizei *count, GLenum type,
|
|||
const GLvoid * const *indices, GLsizei primcount)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
struct _glapi_table *dispatch = ctx->CurrentServerDispatch;
|
||||
struct _glapi_table *dispatch = ctx->Dispatch.Current;
|
||||
GLsizei i;
|
||||
|
||||
int vertcount = 0;
|
||||
|
|
@ -1935,7 +1935,7 @@ save_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count,
|
|||
const GLint *basevertex)
|
||||
{
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
struct _glapi_table *dispatch = ctx->CurrentServerDispatch;
|
||||
struct _glapi_table *dispatch = ctx->Dispatch.Current;
|
||||
GLsizei i;
|
||||
|
||||
int vertcount = 0;
|
||||
|
|
@ -1962,7 +1962,7 @@ vbo_init_dispatch_save_begin_end(struct gl_context *ctx)
|
|||
#define NAME(x) _save_##x
|
||||
#define NAME_ES(x) _save_##x
|
||||
|
||||
struct _glapi_table *tab = ctx->Save;
|
||||
struct _glapi_table *tab = ctx->Dispatch.Save;
|
||||
#include "api_beginend_init.h"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,28 +46,28 @@ typedef void (*attr_func)(struct gl_context *ctx, GLint index, const GLfloat *);
|
|||
static void
|
||||
VertexAttrib1fvNV(struct gl_context *ctx, GLint index, const GLfloat *v)
|
||||
{
|
||||
CALL_VertexAttrib1fvNV(ctx->Exec, (index, v));
|
||||
CALL_VertexAttrib1fvNV(ctx->Dispatch.Exec, (index, v));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
VertexAttrib2fvNV(struct gl_context *ctx, GLint index, const GLfloat *v)
|
||||
{
|
||||
CALL_VertexAttrib2fvNV(ctx->Exec, (index, v));
|
||||
CALL_VertexAttrib2fvNV(ctx->Dispatch.Exec, (index, v));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
VertexAttrib3fvNV(struct gl_context *ctx, GLint index, const GLfloat *v)
|
||||
{
|
||||
CALL_VertexAttrib3fvNV(ctx->Exec, (index, v));
|
||||
CALL_VertexAttrib3fvNV(ctx->Dispatch.Exec, (index, v));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
VertexAttrib4fvNV(struct gl_context *ctx, GLint index, const GLfloat *v)
|
||||
{
|
||||
CALL_VertexAttrib4fvNV(ctx->Exec, (index, v));
|
||||
CALL_VertexAttrib4fvNV(ctx->Dispatch.Exec, (index, v));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ loopback_prim(struct gl_context *ctx,
|
|||
stride);
|
||||
|
||||
if (prim->begin) {
|
||||
CALL_Begin(ctx->Exec, (prim->mode));
|
||||
CALL_Begin(ctx->Dispatch.Exec, (prim->mode));
|
||||
}
|
||||
else {
|
||||
start += wrap_count;
|
||||
|
|
@ -128,7 +128,7 @@ loopback_prim(struct gl_context *ctx,
|
|||
}
|
||||
|
||||
if (prim->end) {
|
||||
CALL_End(ctx->Exec, ());
|
||||
CALL_End(ctx->Dispatch.Exec, ());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue