19f464c52Smaya/*
29f464c52Smaya * Copyright (c) 2017-2019 Lima Project
39f464c52Smaya *
49f464c52Smaya * Permission is hereby granted, free of charge, to any person obtaining a
59f464c52Smaya * copy of this software and associated documentation files (the "Software"),
69f464c52Smaya * to deal in the Software without restriction, including without limitation
79f464c52Smaya * the rights to use, copy, modify, merge, publish, distribute, sub license,
89f464c52Smaya * and/or sell copies of the Software, and to permit persons to whom the
99f464c52Smaya * Software is furnished to do so, subject to the following conditions:
109f464c52Smaya *
119f464c52Smaya * The above copyright notice and this permission notice (including the
129f464c52Smaya * next paragraph) shall be included in all copies or substantial portions
139f464c52Smaya * of the Software.
149f464c52Smaya *
159f464c52Smaya * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
169f464c52Smaya * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
179f464c52Smaya * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
189f464c52Smaya * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
199f464c52Smaya * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
209f464c52Smaya * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
219f464c52Smaya * DEALINGS IN THE SOFTWARE.
229f464c52Smaya *
239f464c52Smaya */
249f464c52Smaya
259f464c52Smaya/**
269f464c52Smaya * Stub support for occlusion queries.
279f464c52Smaya *
289f464c52Smaya * Since we expose support for GL 2.0, we have to expose occlusion queries,
299f464c52Smaya * but the spec allows you to expose 0 query counter bits, so we just return 0
309f464c52Smaya * as the result of all our queries.
319f464c52Smaya */
329f464c52Smaya
339f464c52Smaya#include "util/u_debug.h"
349f464c52Smaya
359f464c52Smaya#include "lima_context.h"
369f464c52Smaya
379f464c52Smayastruct lima_query
389f464c52Smaya{
399f464c52Smaya   uint8_t pad;
409f464c52Smaya};
419f464c52Smaya
429f464c52Smayastatic struct pipe_query *
439f464c52Smayalima_create_query(struct pipe_context *ctx, unsigned query_type, unsigned index)
449f464c52Smaya{
459f464c52Smaya   struct lima_query *query = calloc(1, sizeof(*query));
469f464c52Smaya
479f464c52Smaya   /* Note that struct pipe_query isn't actually defined anywhere. */
489f464c52Smaya   return (struct pipe_query *)query;
499f464c52Smaya}
509f464c52Smaya
519f464c52Smayastatic void
529f464c52Smayalima_destroy_query(struct pipe_context *ctx, struct pipe_query *query)
539f464c52Smaya{
549f464c52Smaya   free(query);
559f464c52Smaya}
569f464c52Smaya
577ec681f3Smrgstatic bool
589f464c52Smayalima_begin_query(struct pipe_context *ctx, struct pipe_query *query)
599f464c52Smaya{
609f464c52Smaya   return true;
619f464c52Smaya}
629f464c52Smaya
639f464c52Smayastatic bool
649f464c52Smayalima_end_query(struct pipe_context *ctx, struct pipe_query *query)
659f464c52Smaya{
669f464c52Smaya   return true;
679f464c52Smaya}
689f464c52Smaya
697ec681f3Smrgstatic bool
709f464c52Smayalima_get_query_result(struct pipe_context *ctx, struct pipe_query *query,
717ec681f3Smrg                     bool wait, union pipe_query_result *vresult)
729f464c52Smaya{
739f464c52Smaya   uint64_t *result = &vresult->u64;
749f464c52Smaya
759f464c52Smaya   *result = 0;
769f464c52Smaya
779f464c52Smaya   return true;
789f464c52Smaya}
799f464c52Smaya
809f464c52Smayastatic void
817ec681f3Smrglima_set_active_query_state(struct pipe_context *pipe, bool enable)
829f464c52Smaya{
839f464c52Smaya
849f464c52Smaya}
859f464c52Smaya
869f464c52Smayavoid
879f464c52Smayalima_query_init(struct lima_context *pctx)
889f464c52Smaya{
899f464c52Smaya   pctx->base.create_query = lima_create_query;
909f464c52Smaya   pctx->base.destroy_query = lima_destroy_query;
919f464c52Smaya   pctx->base.begin_query = lima_begin_query;
929f464c52Smaya   pctx->base.end_query = lima_end_query;
939f464c52Smaya   pctx->base.get_query_result = lima_get_query_result;
949f464c52Smaya   pctx->base.set_active_query_state = lima_set_active_query_state;
959f464c52Smaya}
969f464c52Smaya
97