Blender  V3.3
gl_query.hh
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2020 Blender Foundation. All rights reserved. */
3 
8 #pragma once
9 
10 #include "BLI_vector.hh"
11 
12 #include "gpu_query.hh"
13 
14 #include "glew-mx.h"
15 
16 namespace blender::gpu {
17 
18 class GLQueryPool : public QueryPool {
19  private:
23  GPUQueryType type_;
25  GLenum gl_type_;
28  uint32_t query_issued_;
30  bool initialized_ = false;
31 
32  public:
33  ~GLQueryPool();
34 
35  void init(GPUQueryType type) override;
36 
37  void begin_query() override;
38  void end_query() override;
39 
40  void get_occlusion_result(MutableSpan<uint32_t> r_values) override;
41 };
42 
43 static inline GLenum to_gl(GPUQueryType type)
44 {
45  if (type == GPU_QUERY_OCCLUSION) {
46  /* TODO(fclem): try with GL_ANY_SAMPLES_PASSED​. */
47  return GL_SAMPLES_PASSED;
48  }
49  BLI_assert(0);
50  return GL_SAMPLES_PASSED;
51 }
52 
53 } // namespace blender::gpu
#define BLI_assert(a)
Definition: BLI_assert.h:46
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
void get_occlusion_result(MutableSpan< uint32_t > r_values) override
Definition: gl_query.cc:53
void end_query() override
Definition: gl_query.cc:47
void begin_query() override
Definition: gl_query.cc:35
void init(GPUQueryType type) override
Definition: gl_query.cc:19
@ GPU_QUERY_OCCLUSION
Definition: gpu_query.hh:17
static GLenum to_gl(const GPUAttachmentType type)
unsigned int uint32_t
Definition: stdint.h:80