From f84be846ca6c9ce9f8dc6c9bdd9ca5815e9a8e2e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 25 May 2011 20:45:48 -0600 Subject: [PATCH] mesa: plug in sync object display list functions Most just dispatch through to the immediate mode functions, except for glWaitSync(), per the extension spec. --- src/mesa/main/dlist.c | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 2532e166d16..deb30ed5cc0 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -59,6 +59,7 @@ #include "queryobj.h" #include "samplerobj.h" #include "shaderapi.h" +#include "syncobj.h" #include "teximage.h" #include "mtypes.h" #include "varray.h" @@ -450,6 +451,9 @@ typedef enum /* GL_ARB_geometry_shader4 */ OPCODE_PROGRAM_PARAMETERI, + /* GL_ARB_sync */ + OPCODE_WAIT_SYNC, + /* The following three are meta instructions */ OPCODE_ERROR, /* raise compiled-in error */ OPCODE_CONTINUE, @@ -490,6 +494,17 @@ union gl_dlist_node typedef union gl_dlist_node Node; +/** + * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit + * environment. In 64-bit env, sizeof(Node)==8 anyway. + */ +union uint64_pair +{ + GLuint64 uint64; + GLuint uint32[2]; +}; + + /** * How many nodes to allocate at a time. * @@ -7227,6 +7242,27 @@ save_ProgramParameteri(GLuint program, GLenum pname, GLint value) } +static void GLAPIENTRY +save_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) +{ + Node *n; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_WAIT_SYNC, 4); + if (n) { + union uint64_pair p; + p.uint64 = timeout; + n[1].data = sync; + n[2].e = flags; + n[3].ui = p.uint32[0]; + n[4].ui = p.uint32[1]; + } + if (ctx->ExecuteFlag) { + CALL_WaitSync(ctx->Exec, (sync, flags, timeout)); + } +} + + /** * Save an error-generating command into display list. * @@ -8459,6 +8495,16 @@ execute_list(struct gl_context *ctx, GLuint list) CALL_ProgramParameteriARB(ctx->Exec, (n[1].ui, n[2].e, n[3].i)); break; + /* GL_ARB_sync */ + case OPCODE_WAIT_SYNC: + { + union uint64_pair p; + p.uint32[0] = n[3].ui; + p.uint32[1] = n[4].ui; + CALL_WaitSync(ctx->Exec, (n[1].data, n[2].bf, p.uint64)); + } + break; + case OPCODE_CONTINUE: n = (Node *) n[1].next; break; @@ -10156,6 +10202,10 @@ _mesa_create_save_table(void) /* GL_ARB_geometry_shader4 */ SET_ProgramParameteriARB(table, save_ProgramParameteri); + /* GL_ARB_sync */ + _mesa_init_sync_dispatch(table); + SET_WaitSync(table, save_WaitSync); + return table; } -- 2.30.2