Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * Copyright © 2014 Broadcom
  3.  *
  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:
  10.  *
  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
  13.  * Software.
  14.  *
  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
  21.  * IN THE SOFTWARE.
  22.  */
  23.  
  24. /**
  25.  * Stub support for occlusion queries.
  26.  *
  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.
  30.  */
  31. #include "vc4_context.h"
  32.  
  33. struct vc4_query
  34. {
  35.         uint8_t pad;
  36. };
  37.  
  38. static struct pipe_query *
  39. vc4_create_query(struct pipe_context *ctx, unsigned query_type, unsigned index)
  40. {
  41.         struct vc4_query *query = calloc(1, sizeof(*query));
  42.  
  43.         /* Note that struct pipe_query isn't actually defined anywhere. */
  44.         return (struct pipe_query *)query;
  45. }
  46.  
  47. static void
  48. vc4_destroy_query(struct pipe_context *ctx, struct pipe_query *query)
  49. {
  50.         free(query);
  51. }
  52.  
  53. static void
  54. vc4_begin_query(struct pipe_context *ctx, struct pipe_query *query)
  55. {
  56. }
  57.  
  58. static void
  59. vc4_end_query(struct pipe_context *ctx, struct pipe_query *query)
  60. {
  61. }
  62.  
  63. static boolean
  64. vc4_get_query_result(struct pipe_context *ctx, struct pipe_query *query,
  65.                      boolean wait, union pipe_query_result *vresult)
  66. {
  67.         uint64_t *result = &vresult->u64;
  68.  
  69.         *result = 0;
  70.  
  71.         return true;
  72. }
  73.  
  74. void
  75. vc4_query_init(struct pipe_context *pctx)
  76. {
  77.         pctx->create_query = vc4_create_query;
  78.         pctx->destroy_query = vc4_destroy_query;
  79.         pctx->begin_query = vc4_begin_query;
  80.         pctx->end_query = vc4_end_query;
  81.         pctx->get_query_result = vc4_get_query_result;
  82. }
  83.  
  84.