Blender V4.3
gl_query.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2020 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#pragma once
10
11#include "BLI_vector.hh"
12
13#include "gpu_query.hh"
14
15#include <epoxy/gl.h>
16
17namespace blender::gpu {
18
19class GLQueryPool : public QueryPool {
20 private:
24 GPUQueryType type_;
26 GLenum gl_type_;
29 uint32_t query_issued_;
31 bool initialized_ = false;
32
33 public:
35
36 void init(GPUQueryType type) override;
37
38 void begin_query() override;
39 void end_query() override;
40
41 void get_occlusion_result(MutableSpan<uint32_t> r_values) override;
42};
43
44static inline GLenum to_gl(GPUQueryType type)
45{
46 if (type == GPU_QUERY_OCCLUSION) {
47 /* TODO(fclem): try with GL_ANY_SAMPLES_PASSED​. */
48 return GL_SAMPLES_PASSED;
49 }
50 BLI_assert(0);
51 return GL_SAMPLES_PASSED;
52}
53
54} // namespace blender::gpu
#define BLI_assert(a)
Definition BLI_assert.h:50
void init()
void get_occlusion_result(MutableSpan< uint32_t > r_values) override
Definition gl_query.cc:54
void end_query() override
Definition gl_query.cc:48
void begin_query() override
Definition gl_query.cc:36
@ GPU_QUERY_OCCLUSION
Definition gpu_query.hh:18
static GLenum to_gl(const GPUAttachmentType type)
unsigned int uint32_t
Definition stdint.h:80