2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2022-07-19 17:14:39 +02:00
|
|
|
|
2022-07-19 16:59:42 +02:00
|
|
|
/** \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_;
|
|
|
|
|
|
2022-09-01 21:42:47 +02:00
|
|
|
void allocate();
|
2022-07-19 16:59:42 +02:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
MTLQueryPool();
|
2024-11-01 20:23:18 +01:00
|
|
|
~MTLQueryPool() override;
|
2022-07-19 16:59:42 +02:00
|
|
|
|
|
|
|
|
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
|