2 * Copyright © 2014 Broadcom
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25 * Stub support for occlusion queries.
27 * Since we expose support for GL 2.0, we have to expose occlusion queries,
28 * but the spec allows you to expose 0 query counter bits, so we just return 0
29 * as the result of all our queries.
31 #include "vc4_context.h"
38 static struct pipe_query
*
39 vc4_create_query(struct pipe_context
*ctx
, unsigned query_type
, unsigned index
)
41 struct vc4_query
*query
= calloc(1, sizeof(*query
));
43 /* Note that struct pipe_query isn't actually defined anywhere. */
44 return (struct pipe_query
*)query
;
48 vc4_destroy_query(struct pipe_context
*ctx
, struct pipe_query
*query
)
54 vc4_begin_query(struct pipe_context
*ctx
, struct pipe_query
*query
)
60 vc4_end_query(struct pipe_context
*ctx
, struct pipe_query
*query
)
66 vc4_get_query_result(struct pipe_context
*ctx
, struct pipe_query
*query
,
67 boolean wait
, union pipe_query_result
*vresult
)
69 uint64_t *result
= &vresult
->u64
;
77 vc4_set_active_query_state(struct pipe_context
*pipe
, boolean enable
)
82 vc4_query_init(struct pipe_context
*pctx
)
84 pctx
->create_query
= vc4_create_query
;
85 pctx
->destroy_query
= vc4_destroy_query
;
86 pctx
->begin_query
= vc4_begin_query
;
87 pctx
->end_query
= vc4_end_query
;
88 pctx
->get_query_result
= vc4_get_query_result
;
89 pctx
->set_active_query_state
= vc4_set_active_query_state
;