Home | History | Annotate | Download | only in main

Lines Matching refs:ctx

42  * ctx->Driver.NewQueryObject().
43 * \param ctx - rendering context
48 _mesa_new_query_object(struct gl_context *ctx, GLuint id)
51 (void) ctx;
64 * Called via ctx->Driver.BeginQuery().
67 _mesa_begin_query(struct gl_context *ctx, struct gl_query_object *q)
75 * Called via ctx->Driver.EndQuery().
78 _mesa_end_query(struct gl_context *ctx, struct gl_query_object *q)
86 * Called via ctx->Driver.WaitQuery().
89 _mesa_wait_query(struct gl_context *ctx, struct gl_query_object *q)
101 * Called via ctx->Driver.CheckQuery().
104 _mesa_check_query(struct gl_context *ctx, struct gl_query_object *q)
113 * Delete a query object. Called via ctx->Driver.DeleteQuery().
117 _mesa_delete_query(struct gl_context *ctx, struct gl_query_object *q)
140 get_query_binding_point(struct gl_context *ctx, GLenum target)
144 if (ctx->Extensions.ARB_occlusion_query)
145 return &ctx->Query.CurrentOcclusionObject;
149 if (ctx->Extensions.ARB_occlusion_query2)
150 return &ctx->Query.CurrentOcclusionObject;
154 if (ctx->Extensions.EXT_timer_query)
155 return &ctx->Query.CurrentTimerObject;
160 if (ctx->Extensions.EXT_transform_feedback)
161 return &ctx->Query.PrimitivesGenerated;
165 if (ctx->Extensions.EXT_transform_feedback)
166 return &ctx->Query.PrimitivesWritten;
180 GET_CURRENT_CONTEXT(ctx);
181 ASSERT_OUTSIDE_BEGIN_END(ctx);
184 _mesa_debug(ctx, "glGenQueries(%d)\n", n);
187 _mesa_error(ctx, GL_INVALID_VALUE, "glGenQueriesARB(n < 0)");
192 if (ctx->Query.CurrentOcclusionObject ||
193 ctx->Query.CurrentTimerObject) {
194 _mesa_error(ctx, GL_INVALID_OPERATION, "glGenQueriesARB");
198 first = _mesa_HashFindFreeKeyBlock(ctx->Query.QueryObjects, n);
203 = ctx->Driver.NewQueryObject(ctx, first + i);
205 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenQueriesARB");
209 _mesa_HashInsert(ctx->Query.QueryObjects, first + i, q);
219 GET_CURRENT_CONTEXT(ctx);
220 ASSERT_OUTSIDE_BEGIN_END(ctx);
221 FLUSH_VERTICES(ctx, 0);
224 _mesa_debug(ctx, "glDeleeteQueries(%d)\n", n);
227 _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteQueriesARB(n < 0)");
232 if (ctx->Query.CurrentOcclusionObject ||
233 ctx->Query.CurrentTimerObject) {
234 _mesa_error(ctx, GL_INVALID_OPERATION, "glDeleteQueriesARB");
240 struct gl_query_object *q = _mesa_lookup_query_object(ctx, ids[i]);
243 _mesa_HashRemove(ctx->Query.QueryObjects, ids[i]);
244 ctx->Driver.DeleteQuery(ctx, q);
254 GET_CURRENT_CONTEXT(ctx);
255 ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
258 _mesa_debug(ctx, "glIsQuery(%u)\n", id);
260 if (id && _mesa_lookup_query_object(ctx, id))
267 query_error_check_index(struct gl_context *ctx, GLenum target, GLuint index)
272 if (index >= ctx->Const.MaxVertexStreams) {
273 _mesa_error(ctx, GL_INVALID_VALUE,
280 _mesa_error(ctx, GL_INVALID_VALUE, "glBeginQueryIndexed(index>0)");
291 GET_CURRENT_CONTEXT(ctx);
292 ASSERT_OUTSIDE_BEGIN_END(ctx);
295 _mesa_debug(ctx, "glBeginQueryIndexed(%s, %u, %u)\n",
298 if (!query_error_check_index(ctx, target, index))
301 FLUSH_VERTICES(ctx, _NEW_DEPTH);
303 bindpt = get_query_binding_point(ctx, target);
305 _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQuery{Indexed}(target)");
310 _mesa_error(ctx, GL_INVALID_OPERATION, "glBeginQuery{Indexed}(id==0)");
314 q = _mesa_lookup_query_object(ctx, id);
316 if (ctx->API == API_OPENGL_CORE) {
317 _mesa_error(ctx, GL_INVALID_OPERATION,
322 q = ctx->Driver.NewQueryObject(ctx, id);
324 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBeginQuery{Indexed}");
327 _mesa_HashInsert(ctx->Query.QueryObjects, id, q);
333 _mesa_error(ctx, GL_INVALID_OPERATION,
347 ctx->Driver.BeginQuery(ctx, q);
355 GET_CURRENT_CONTEXT(ctx);
356 ASSERT_OUTSIDE_BEGIN_END(ctx);
359 _mesa_debug(ctx, "glEndQueryIndexed(%s, %u)\n",
362 if (!query_error_check_index(ctx, target, index))
365 FLUSH_VERTICES(ctx, _NEW_DEPTH);
367 bindpt = get_query_binding_point(ctx, target);
369 _mesa_error(ctx, GL_INVALID_ENUM, "glEndQuery{Indexed}(target)");
378 _mesa_error(ctx, GL_INVALID_OPERATION,
384 ctx->Driver.EndQuery(ctx, q);
403 GET_CURRENT_CONTEXT(ctx);
404 ASSERT_OUTSIDE_BEGIN_END(ctx);
407 _mesa_debug(ctx, "glQueryCounter(%u, %s)\n", id,
412 _mesa_error(ctx, GL_INVALID_ENUM, "glQueryCounter(target)");
417 _mesa_error(ctx, GL_INVALID_OPERATION, "glQueryCounter(id==0)");
421 q = _mesa_lookup_query_object(ctx, id);
426 q = ctx->Driver.NewQueryObject(ctx, id);
428 _mesa_error(ctx, GL_OUT_OF_MEMORY, "glQueryCounter");
431 _mesa_HashInsert(ctx->Query.QueryObjects, id, q);
435 _mesa_error(ctx, GL_INVALID_OPERATION,
442 _mesa_error(ctx, GL_INVALID_OPERATION, "glQueryCounter(id is active)");
452 ctx->Driver.EndQuery(ctx, q);
461 GET_CURRENT_CONTEXT(ctx);
462 ASSERT_OUTSIDE_BEGIN_END(ctx);
465 _mesa_debug(ctx, "glGetQueryIndexediv(%s, %u, %s)\n",
470 if (!query_error_check_index(ctx, target, index))
474 if (!ctx->Extensions.ARB_timer_query) {
475 _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryARB(target)");
480 bindpt = get_query_binding_point(ctx, target);
482 _mesa_error(ctx, GL_INVALID_ENUM, "glGetQuery{Indexed}iv(target)");
493 *params = ctx->Const.QueryCounterBits.SamplesPassed;
503 *params = ctx->Const.QueryCounterBits.TimeElapsed;
506 *params = ctx->Const.QueryCounterBits.Timestamp;
509 *params = ctx->Const.QueryCounterBits.PrimitivesGenerated;
512 *params = ctx->Const.QueryCounterBits.PrimitivesWritten;
515 _mesa_problem(ctx,
526 _mesa_error(ctx, GL_INVALID_ENUM, "glGetQuery{Indexed}iv(pname)");
541 GET_CURRENT_CONTEXT(ctx);
542 ASSERT_OUTSIDE_BEGIN_END(ctx);
545 _mesa_debug(ctx, "glGetQueryObjectiv(%u, %s)\n", id,
549 q = _mesa_lookup_query_object(ctx, id);
552 _mesa_error(ctx, GL_INVALID_OPERATION,
560 ctx->Driver.WaitQuery(ctx, q);
578 ctx->Driver.CheckQuery( ctx, q );
582 _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryObjectivARB(pname)");
592 GET_CURRENT_CONTEXT(ctx);
593 ASSERT_OUTSIDE_BEGIN_END(ctx);
596 _mesa_debug(ctx, "glGetQueryObjectuiv(%u, %s)\n", id,
600 q = _mesa_lookup_query_object(ctx, id);
603 _mesa_error(ctx, GL_INVALID_OPERATION,
611 ctx->Driver.WaitQuery(ctx, q);
629 ctx->Driver.CheckQuery( ctx, q );
633 _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryObjectuivARB(pname)");
646 GET_CURRENT_CONTEXT(ctx);
647 ASSERT_OUTSIDE_BEGIN_END(ctx);
650 _mesa_debug(ctx, "glGetQueryObjecti64v(%u, %s)\n", id,
654 q = _mesa_lookup_query_object(ctx, id);
657 _mesa_error(ctx, GL_INVALID_OPERATION,
665 ctx->Driver.WaitQuery(ctx, q);
670 ctx->Driver.CheckQuery( ctx, q );
674 _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryObjecti64vARB(pname)");
687 GET_CURRENT_CONTEXT(ctx);
688 ASSERT_OUTSIDE_BEGIN_END(ctx);
691 _mesa_debug(ctx, "glGetQueryObjectui64v(%u, %s)\n", id,
695 q = _mesa_lookup_query_object(ctx, id);
698 _mesa_error(ctx, GL_INVALID_OPERATION,
706 ctx->Driver.WaitQuery(ctx, q);
711 ctx->Driver.CheckQuery( ctx, q );
715 _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryObjectui64vARB(pname)");
750 _mesa_init_queryobj(struct gl_context *ctx)
752 ctx->Query.QueryObjects = _mesa_NewHashTable();
753 ctx->Query.CurrentOcclusionObject = NULL;
755 ctx->Const.QueryCounterBits.SamplesPassed = 64;
756 ctx->Const.QueryCounterBits.TimeElapsed = 64;
757 ctx->Const.QueryCounterBits.Timestamp = 64;
758 ctx->Const.QueryCounterBits.PrimitivesGenerated = 64;
759 ctx->Const.QueryCounterBits.PrimitivesWritten = 64;
770 struct gl_context *ctx = (struct gl_context *)userData;
771 ctx->Driver.DeleteQuery(ctx, q);
779 _mesa_free_queryobj_data(struct gl_context *ctx)
781 _mesa_HashDeleteAll(ctx->Query.QueryObjects, delete_queryobj_cb, ctx);
782 _mesa_DeleteHashTable(ctx->Query.QueryObjects);