diff options
author | Brian Paul <[email protected]> | 2004-06-28 22:01:12 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2004-06-28 22:01:12 +0000 |
commit | d322dc1469587d4dc9274c803561f6074c21ed42 (patch) | |
tree | 5e85c8114a5a5123b3e872cc6ddeb335aaaa19b2 /src | |
parent | 625a339a8ac0bef20285877d27eadff97fc2333a (diff) |
glBegin/EndQueryARB didn't work inside display lists
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/main/dlist.c | 65 |
1 files changed, 63 insertions, 2 deletions
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 01d1f94572b..ea1a6ae1215 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -65,6 +65,7 @@ #include "dlist.h" #include "macros.h" #include "matrix.h" +#include "occlude.h" #include "pixel.h" #include "points.h" #include "polygon.h" @@ -309,7 +310,9 @@ typedef enum { /* GL_ARB_vertex/fragment_program */ OPCODE_PROGRAM_STRING_ARB, OPCODE_PROGRAM_ENV_PARAMETER_ARB, - + /* GL_ARB_occlusion_query */ + OPCODE_BEGIN_QUERY_ARB, + OPCODE_END_QUERY_ARB, /* Vertex attributes -- fallback for when optimized display * list build isn't active. @@ -774,6 +777,10 @@ _mesa_init_lists( void ) InstSize[OPCODE_PROGRAM_STRING_ARB] = 5; InstSize[OPCODE_PROGRAM_ENV_PARAMETER_ARB] = 7; #endif +#if FEATURE_ARB_occlusion_query + InstSize[OPCODE_BEGIN_QUERY_ARB] = 3; + InstSize[OPCODE_END_QUERY_ARB] = 2; +#endif InstSize[OPCODE_ATTR_1F] = 3; InstSize[OPCODE_ATTR_2F] = 4; InstSize[OPCODE_ATTR_3F] = 5; @@ -4638,6 +4645,42 @@ save_ProgramEnvParameter4dvARB(GLenum target, GLuint index, #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */ +#ifdef FEATURE_ARB_occlusion_query + +static void GLAPIENTRY +save_BeginQueryARB(GLenum target, GLuint id) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = ALLOC_INSTRUCTION( ctx, OPCODE_BEGIN_QUERY_ARB, 2 ); + if (n) { + n[1].e = target; + n[2].ui = id; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->BeginQueryARB)( target, id ); + } +} + + +static void GLAPIENTRY +save_EndQueryARB(GLenum target) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = ALLOC_INSTRUCTION( ctx, OPCODE_END_QUERY_ARB, 1 ); + if (n) { + n[1].e = target; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->EndQueryARB)( target ); + } +} + +#endif /* FEATURE_ARB_occlusion_query */ + static void save_Attr1f( GLenum attr, GLfloat x ) @@ -5991,7 +6034,14 @@ execute_list( GLcontext *ctx, GLuint list ) n[4].f, n[5].f, n[6].f); break; #endif - +#if FEATURE_ARB_occlusion_query + case OPCODE_BEGIN_QUERY_ARB: + ctx->Exec->BeginQueryARB(n[1].e, n[2].ui); + break; + case OPCODE_END_QUERY_ARB: + ctx->Exec->EndQueryARB(n[1].e); + break; +#endif case OPCODE_ATTR_1F: (*ctx->Exec->VertexAttrib1fNV)(n[1].e, n[2].f); break; @@ -7574,6 +7624,17 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) table->UnmapBufferARB = _mesa_UnmapBufferARB; #endif +#if FEATURE_ARB_occlusion_query + table->BeginQueryARB = save_BeginQueryARB; + table->EndQueryARB = save_EndQueryARB; + table->GenQueriesARB = _mesa_GenQueriesARB; + table->DeleteQueriesARB = _mesa_DeleteQueriesARB; + table->IsQueryARB = _mesa_IsQueryARB; + table->GetQueryivARB = _mesa_GetQueryivARB; + table->GetQueryObjectivARB = _mesa_GetQueryObjectivARB; + table->GetQueryObjectuivARB = _mesa_GetQueryObjectuivARB; +#endif + /* 299. GL_EXT_blend_equation_separate */ table->BlendEquationSeparateEXT = save_BlendEquationSeparateEXT; } |