1b8e80941Smrg/*
2b8e80941Smrg * Copyright (c) 2017-2019 Lima Project
3b8e80941Smrg *
4b8e80941Smrg * Permission is hereby granted, free of charge, to any person obtaining a
5b8e80941Smrg * copy of this software and associated documentation files (the "Software"),
6b8e80941Smrg * to deal in the Software without restriction, including without limitation
7b8e80941Smrg * the rights to use, copy, modify, merge, publish, distribute, sub license,
8b8e80941Smrg * and/or sell copies of the Software, and to permit persons to whom the
9b8e80941Smrg * Software is furnished to do so, subject to the following conditions:
10b8e80941Smrg *
11b8e80941Smrg * The above copyright notice and this permission notice (including the
12b8e80941Smrg * next paragraph) shall be included in all copies or substantial portions
13b8e80941Smrg * of the Software.
14b8e80941Smrg *
15b8e80941Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16b8e80941Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17b8e80941Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18b8e80941Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19b8e80941Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20b8e80941Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21b8e80941Smrg * DEALINGS IN THE SOFTWARE.
22b8e80941Smrg *
23b8e80941Smrg */
24b8e80941Smrg
25b8e80941Smrg/**
26b8e80941Smrg * Stub support for occlusion queries.
27b8e80941Smrg *
28b8e80941Smrg * Since we expose support for GL 2.0, we have to expose occlusion queries,
29b8e80941Smrg * but the spec allows you to expose 0 query counter bits, so we just return 0
30b8e80941Smrg * as the result of all our queries.
31b8e80941Smrg */
32b8e80941Smrg
33b8e80941Smrg#include "util/u_debug.h"
34b8e80941Smrg
35b8e80941Smrg#include "lima_context.h"
36b8e80941Smrg
37b8e80941Smrgstruct lima_query
38b8e80941Smrg{
39b8e80941Smrg   uint8_t pad;
40b8e80941Smrg};
41b8e80941Smrg
42b8e80941Smrgstatic struct pipe_query *
43b8e80941Smrglima_create_query(struct pipe_context *ctx, unsigned query_type, unsigned index)
44b8e80941Smrg{
45b8e80941Smrg   struct lima_query *query = calloc(1, sizeof(*query));
46b8e80941Smrg
47b8e80941Smrg   /* Note that struct pipe_query isn't actually defined anywhere. */
48b8e80941Smrg   return (struct pipe_query *)query;
49b8e80941Smrg}
50b8e80941Smrg
51b8e80941Smrgstatic void
52b8e80941Smrglima_destroy_query(struct pipe_context *ctx, struct pipe_query *query)
53b8e80941Smrg{
54b8e80941Smrg   free(query);
55b8e80941Smrg}
56b8e80941Smrg
57b8e80941Smrgstatic boolean
58b8e80941Smrglima_begin_query(struct pipe_context *ctx, struct pipe_query *query)
59b8e80941Smrg{
60b8e80941Smrg   return true;
61b8e80941Smrg}
62b8e80941Smrg
63b8e80941Smrgstatic bool
64b8e80941Smrglima_end_query(struct pipe_context *ctx, struct pipe_query *query)
65b8e80941Smrg{
66b8e80941Smrg   return true;
67b8e80941Smrg}
68b8e80941Smrg
69b8e80941Smrgstatic boolean
70b8e80941Smrglima_get_query_result(struct pipe_context *ctx, struct pipe_query *query,
71b8e80941Smrg                     boolean wait, union pipe_query_result *vresult)
72b8e80941Smrg{
73b8e80941Smrg   uint64_t *result = &vresult->u64;
74b8e80941Smrg
75b8e80941Smrg   *result = 0;
76b8e80941Smrg
77b8e80941Smrg   return true;
78b8e80941Smrg}
79b8e80941Smrg
80b8e80941Smrgstatic void
81b8e80941Smrglima_set_active_query_state(struct pipe_context *pipe, boolean enable)
82b8e80941Smrg{
83b8e80941Smrg
84b8e80941Smrg}
85b8e80941Smrg
86b8e80941Smrgvoid
87b8e80941Smrglima_query_init(struct lima_context *pctx)
88b8e80941Smrg{
89b8e80941Smrg   pctx->base.create_query = lima_create_query;
90b8e80941Smrg   pctx->base.destroy_query = lima_destroy_query;
91b8e80941Smrg   pctx->base.begin_query = lima_begin_query;
92b8e80941Smrg   pctx->base.end_query = lima_end_query;
93b8e80941Smrg   pctx->base.get_query_result = lima_get_query_result;
94b8e80941Smrg   pctx->base.set_active_query_state = lima_set_active_query_state;
95b8e80941Smrg}
96b8e80941Smrg
97