Use a shorter/simpler license convention, stops the header taking so much space. Follow the SPDX license specification: https://spdx.org/licenses - C/C++/objc/objc++ - Python - Shell Scripts - CMake, GNUmakefile While most of the source tree has been included - `./extern/` was left out. - `./intern/cycles` & `./intern/atomic` are also excluded because they use different header conventions. doc/license/SPDX-license-identifiers.txt has been added to list SPDX all used identifiers. See P2788 for the script that automated these edits. Reviewed By: brecht, mont29, sergey Ref D14069
54 lines
1.1 KiB
C++
54 lines
1.1 KiB
C++
/* SPDX-License-Identifier: GPL-2.0-or-later
|
||
* Copyright 2020 Blender Foundation. All rights reserved. */
|
||
|
||
/** \file
|
||
* \ingroup gpu
|
||
*/
|
||
|
||
#pragma once
|
||
|
||
#include "BLI_vector.hh"
|
||
|
||
#include "gpu_query.hh"
|
||
|
||
#include "glew-mx.h"
|
||
|
||
namespace blender::gpu {
|
||
|
||
class GLQueryPool : public QueryPool {
|
||
private:
|
||
/** Contains queries object handles. */
|
||
Vector<GLuint> query_ids_;
|
||
/** Type of this query pool. */
|
||
GPUQueryType type_;
|
||
/** Associated GL type. */
|
||
GLenum gl_type_;
|
||
/** Number of queries that have been issued since last initialization.
|
||
* Should be equal to query_ids_.size(). */
|
||
uint32_t query_issued_;
|
||
/** Can only be initialized once. */
|
||
bool initialized_ = false;
|
||
|
||
public:
|
||
~GLQueryPool();
|
||
|
||
void init(GPUQueryType type) override;
|
||
|
||
void begin_query() override;
|
||
void end_query() override;
|
||
|
||
void get_occlusion_result(MutableSpan<uint32_t> r_values) override;
|
||
};
|
||
|
||
static inline GLenum to_gl(GPUQueryType type)
|
||
{
|
||
if (type == GPU_QUERY_OCCLUSION) {
|
||
/* TODO(fclem): try with GL_ANY_SAMPLES_PASSED. */
|
||
return GL_SAMPLES_PASSED;
|
||
}
|
||
BLI_assert(0);
|
||
return GL_SAMPLES_PASSED;
|
||
}
|
||
|
||
} // namespace blender::gpu
|