static void llvmpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q) { struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe ); struct llvmpipe_query *pq = llvmpipe_query(q); /* Check if the query is already in the scene. If so, we need to * flush the scene now. Real apps shouldn't re-use a query in a * frame of rendering. */ if (pq->fence && !lp_fence_issued(pq->fence)) { llvmpipe_finish(pipe, __FUNCTION__); } memset(pq->count, 0, sizeof(pq->count)); lp_setup_begin_query(llvmpipe->setup, pq); if (pq->type == PIPE_QUERY_PRIMITIVES_EMITTED) { pq->num_primitives_written = 0; llvmpipe->so_stats.num_primitives_written = 0; } if (pq->type == PIPE_QUERY_PRIMITIVES_GENERATED) { pq->num_primitives_generated = 0; llvmpipe->num_primitives_generated = 0; } if (pq->type == PIPE_QUERY_OCCLUSION_COUNTER) { llvmpipe->active_occlusion_query = TRUE; llvmpipe->dirty |= LP_NEW_OCCLUSION_QUERY; } }
static void llvmpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q) { struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe ); struct llvmpipe_query *pq = llvmpipe_query(q); /* Check if the query is already in the scene. If so, we need to * flush the scene now. Real apps shouldn't re-use a query in a * frame of rendering. */ if (pq->fence && !lp_fence_issued(pq->fence)) { llvmpipe_finish(pipe, __FUNCTION__); } memset(pq->start, 0, sizeof(pq->start)); memset(pq->end, 0, sizeof(pq->end)); lp_setup_begin_query(llvmpipe->setup, pq); switch (pq->type) { case PIPE_QUERY_PRIMITIVES_EMITTED: pq->num_primitives_written = llvmpipe->so_stats.num_primitives_written; break; case PIPE_QUERY_PRIMITIVES_GENERATED: pq->num_primitives_generated = llvmpipe->so_stats.primitives_storage_needed; break; case PIPE_QUERY_SO_STATISTICS: pq->num_primitives_written = llvmpipe->so_stats.num_primitives_written; pq->num_primitives_generated = llvmpipe->so_stats.primitives_storage_needed; break; case PIPE_QUERY_SO_OVERFLOW_PREDICATE: pq->num_primitives_written = llvmpipe->so_stats.num_primitives_written; pq->num_primitives_generated = llvmpipe->so_stats.primitives_storage_needed; break; case PIPE_QUERY_PIPELINE_STATISTICS: /* reset our cache */ if (llvmpipe->active_statistics_queries == 0) { memset(&llvmpipe->pipeline_statistics, 0, sizeof(llvmpipe->pipeline_statistics)); } memcpy(&pq->stats, &llvmpipe->pipeline_statistics, sizeof(pq->stats)); llvmpipe->active_statistics_queries++; break; case PIPE_QUERY_OCCLUSION_COUNTER: case PIPE_QUERY_OCCLUSION_PREDICATE: llvmpipe->active_occlusion_queries++; llvmpipe->dirty |= LP_NEW_OCCLUSION_QUERY; break; default: break; } }