2 * Copyright (c) 2017-2019 Lima Project
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, sub license,
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
12 * next paragraph) shall be included in all copies or substantial portions
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 NON-INFRINGEMENT. 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
21 * DEALINGS IN THE SOFTWARE.
26 * Stub support for occlusion queries.
28 * Since we expose support for GL 2.0, we have to expose occlusion queries,
29 * but the spec allows you to expose 0 query counter bits, so we just return 0
30 * as the result of all our queries.
33 #include "util/u_debug.h"
35 #include "lima_context.h"
42 static struct pipe_query
*
43 lima_create_query(struct pipe_context
*ctx
, unsigned query_type
, unsigned index
)
45 struct lima_query
*query
= calloc(1, sizeof(*query
));
47 /* Note that struct pipe_query isn't actually defined anywhere. */
48 return (struct pipe_query
*)query
;
52 lima_destroy_query(struct pipe_context
*ctx
, struct pipe_query
*query
)
58 lima_begin_query(struct pipe_context
*ctx
, struct pipe_query
*query
)
64 lima_end_query(struct pipe_context
*ctx
, struct pipe_query
*query
)
70 lima_get_query_result(struct pipe_context
*ctx
, struct pipe_query
*query
,
71 bool wait
, union pipe_query_result
*vresult
)
73 uint64_t *result
= &vresult
->u64
;
81 lima_set_active_query_state(struct pipe_context
*pipe
, bool enable
)
87 lima_query_init(struct lima_context
*pctx
)
89 pctx
->base
.create_query
= lima_create_query
;
90 pctx
->base
.destroy_query
= lima_destroy_query
;
91 pctx
->base
.begin_query
= lima_begin_query
;
92 pctx
->base
.end_query
= lima_end_query
;
93 pctx
->base
.get_query_result
= lima_get_query_result
;
94 pctx
->base
.set_active_query_state
= lima_set_active_query_state
;