Esempio n. 1
0
static void r600_render_condition(struct pipe_context *ctx,
                                  struct pipe_query *query,
                                  uint mode)
{
    struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
    struct r600_query *rquery = (struct r600_query *)query;
    int wait_flag = 0;

    /* If we already have nonzero result, render unconditionally */
    if (query != NULL && rquery->result != 0)
        return;

    rctx->current_render_cond = query;
    rctx->current_render_cond_mode = mode;

    if (query == NULL) {
        if (rctx->ctx.predicate_drawing) {
            rctx->ctx.predicate_drawing = false;
            r600_query_predication(&rctx->ctx, NULL, PREDICATION_OP_CLEAR, 1);
        }
        return;
    }

    if (mode == PIPE_RENDER_COND_WAIT ||
            mode == PIPE_RENDER_COND_BY_REGION_WAIT) {
        wait_flag = 1;
    }

    rctx->ctx.predicate_drawing = true;
    r600_query_predication(&rctx->ctx, rquery, PREDICATION_OP_ZPASS, wait_flag);
}
Esempio n. 2
0
static void r600_render_condition(struct pipe_context *ctx,
                                  struct pipe_query *query,
                                  boolean condition,
                                  uint mode)
{
    struct r600_context *rctx = (struct r600_context *)ctx;
    struct r600_query *rquery = (struct r600_query *)query;
    int wait_flag = 0;

    /* If we already have nonzero result, render unconditionally */
    if (query != NULL && rquery->result.u64 != 0) {
        if (rctx->current_render_cond) {
            r600_render_condition(ctx, NULL, FALSE, 0);
        }
        return;
    }

    rctx->current_render_cond = query;
    rctx->current_render_cond_cond = condition;
    rctx->current_render_cond_mode = mode;

    if (query == NULL) {
        if (rctx->predicate_drawing) {
            rctx->predicate_drawing = false;
            r600_query_predication(rctx, NULL, PREDICATION_OP_CLEAR, 1);
        }
        return;
    }

    if (mode == PIPE_RENDER_COND_WAIT ||
            mode == PIPE_RENDER_COND_BY_REGION_WAIT) {
        wait_flag = 1;
    }

    rctx->predicate_drawing = true;

    switch (rquery->type) {
    case PIPE_QUERY_OCCLUSION_COUNTER:
    case PIPE_QUERY_OCCLUSION_PREDICATE:
        r600_query_predication(rctx, rquery, PREDICATION_OP_ZPASS, wait_flag);
        break;
    case PIPE_QUERY_PRIMITIVES_EMITTED:
    case PIPE_QUERY_PRIMITIVES_GENERATED:
    case PIPE_QUERY_SO_STATISTICS:
    case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
        r600_query_predication(rctx, rquery, PREDICATION_OP_PRIMCOUNT, wait_flag);
        break;
    default:
        assert(0);
    }
}