Welcome to mirror list, hosted at ThFree Co, Russian Federation.

mtl_query.hh « metal « gpu « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 03436fcd67d43ec6db7defa7432476f93598318a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* SPDX-License-Identifier: GPL-2.0-or-later */

/** \file
 * \ingroup gpu
 */

#pragma once

#include "BLI_vector.hh"

#include "gpu_query.hh"
#include "mtl_context.hh"

namespace blender::gpu {

class MTLQueryPool : public QueryPool {
 private:
  /** Number of queries that have been issued since last initialization.
   * Should be equal to query_ids_.size(). */
  uint32_t query_issued_;
  /** Type of this query pool. */
  GPUQueryType type_;
  /** Can only be initialized once. */
  bool initialized_ = false;
  MTLVisibilityResultMode mtl_type_;
  Vector<gpu::MTLBuffer *> buffer_;

  void allocate();

 public:
  MTLQueryPool();
  ~MTLQueryPool();

  void init(GPUQueryType type) override;

  void begin_query() override;
  void end_query() override;

  void get_occlusion_result(MutableSpan<uint32_t> r_values) override;
};
}  // namespace blender::gpu