#include "pipe/p_defines.h"
#include "util/u_memory.h"
-#include "os/os_time.h"
+#include "util/os_time.h"
#include "swr_context.h"
#include "swr_fence.h"
#include "swr_query.h"
#include "swr_screen.h"
#include "swr_state.h"
-
+#include "common/os.h"
static struct swr_query *
swr_query(struct pipe_query *p)
assert(type < PIPE_QUERY_TYPES);
assert(index < MAX_SO_STREAMS);
- pq = CALLOC_STRUCT(swr_query);
+ pq = (struct swr_query *) AlignedMalloc(sizeof(struct swr_query), 64);
+ memset(pq, 0, sizeof(*pq));
if (pq) {
pq->type = type;
swr_fence_reference(pipe->screen, &pq->fence, NULL);
}
- FREE(pq);
+ AlignedFree(pq);
}
-static boolean
+static bool
swr_get_query_result(struct pipe_context *pipe,
struct pipe_query *q,
- boolean wait,
+ bool wait,
union pipe_query_result *result)
{
struct swr_query *pq = swr_query(q);
if (pq->fence) {
if (!wait && !swr_is_fence_done(pq->fence))
- return FALSE;
+ return false;
swr_fence_finish(pipe->screen, NULL, pq->fence, 0);
swr_fence_reference(pipe->screen, &pq->fence, NULL);
switch (pq->type) {
/* Booleans */
case PIPE_QUERY_OCCLUSION_PREDICATE:
+ case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
result->b = pq->result.core.DepthPassCount != 0;
break;
case PIPE_QUERY_GPU_FINISHED:
- result->b = TRUE;
+ result->b = true;
break;
/* Counters */
case PIPE_QUERY_OCCLUSION_COUNTER:
break;
}
- return TRUE;
+ return true;
}
-static boolean
+static bool
swr_begin_query(struct pipe_context *pipe, struct pipe_query *q)
{
struct swr_context *ctx = swr_context(pipe);
/* Initialize Results */
memset(&pq->result, 0, sizeof(pq->result));
switch (pq->type) {
+ case PIPE_QUERY_GPU_FINISHED:
case PIPE_QUERY_TIMESTAMP:
- /* nothing to do */
+ /* nothing to do, but don't want the default */
break;
case PIPE_QUERY_TIME_ELAPSED:
pq->result.timestamp_start = swr_get_timestamp(pipe->screen);
/* Only change stat collection if there are no active queries */
if (ctx->active_queries == 0) {
- SwrEnableStatsFE(ctx->swrContext, TRUE);
- SwrEnableStatsBE(ctx->swrContext, TRUE);
+ ctx->api.pfnSwrEnableStatsFE(ctx->swrContext, TRUE);
+ ctx->api.pfnSwrEnableStatsBE(ctx->swrContext, TRUE);
}
+ ctx->active_queries++;
break;
}
- ctx->active_queries++;
return true;
}
struct swr_context *ctx = swr_context(pipe);
struct swr_query *pq = swr_query(q);
- assert(ctx->active_queries
- && "swr_end_query, there are no active queries!");
- ctx->active_queries--;
-
switch (pq->type) {
+ case PIPE_QUERY_GPU_FINISHED:
+ /* nothing to do, but don't want the default */
+ break;
case PIPE_QUERY_TIMESTAMP:
case PIPE_QUERY_TIME_ELAPSED:
pq->result.timestamp_end = swr_get_timestamp(pipe->screen);
swr_fence_submit(ctx, pq->fence);
/* Only change stat collection if there are no active queries */
+ ctx->active_queries--;
if (ctx->active_queries == 0) {
- SwrEnableStatsFE(ctx->swrContext, FALSE);
- SwrEnableStatsBE(ctx->swrContext, FALSE);
+ ctx->api.pfnSwrEnableStatsFE(ctx->swrContext, FALSE);
+ ctx->api.pfnSwrEnableStatsBE(ctx->swrContext, FALSE);
}
break;
}
-boolean
+bool
swr_check_render_cond(struct pipe_context *pipe)
{
struct swr_context *ctx = swr_context(pipe);
- boolean b, wait;
+ bool b, wait;
uint64_t result;
if (!ctx->render_cond_query)
- return TRUE; /* no query predicate, draw normally */
+ return true; /* no query predicate, draw normally */
wait = (ctx->render_cond_mode == PIPE_RENDER_COND_WAIT
|| ctx->render_cond_mode == PIPE_RENDER_COND_BY_REGION_WAIT);
if (b)
return ((!result) == ctx->render_cond_cond);
else
- return TRUE;
+ return true;
}
static void
-swr_set_active_query_state(struct pipe_context *pipe, boolean enable)
+swr_set_active_query_state(struct pipe_context *pipe, bool enable)
{
}