Adding basic timestamps
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
#pragma once
|
||||
#include "Buffer.h"
|
||||
#include "Graphics.h"
|
||||
#include "Graphics/Query.h"
|
||||
#include "Buffer.h"
|
||||
|
||||
namespace Seele {
|
||||
namespace Vulkan {
|
||||
class QueryPool {
|
||||
public:
|
||||
QueryPool(PGraphics graphics, VkQueryType type, VkQueryPipelineStatisticFlags flags, uint32 resultsStride, uint32 numBuffered);
|
||||
QueryPool(PGraphics graphics, VkQueryType type, VkQueryPipelineStatisticFlags flags, uint32 resultsStride, uint32 numBuffered,
|
||||
const std::string& name);
|
||||
virtual ~QueryPool();
|
||||
void begin();
|
||||
void end();
|
||||
@@ -18,10 +19,9 @@ class QueryPool {
|
||||
PGraphics graphics;
|
||||
VkQueryPool handle;
|
||||
VkQueryPipelineStatisticFlags flags;
|
||||
OBufferAllocation resultsAlloc;
|
||||
uint64* resultsPtr;
|
||||
uint32 pendingQuery = 0;
|
||||
uint32 currentQuery = 0;
|
||||
// ring buffer
|
||||
uint64 head = 0;
|
||||
uint64 tail = 0;
|
||||
uint32 numQueries;
|
||||
uint32 resultsStride;
|
||||
std::mutex queryMutex;
|
||||
@@ -29,7 +29,7 @@ class QueryPool {
|
||||
};
|
||||
class OcclusionQuery : public Gfx::OcclusionQuery, public QueryPool {
|
||||
public:
|
||||
OcclusionQuery(PGraphics graphics);
|
||||
OcclusionQuery(PGraphics graphics, const std::string& name);
|
||||
virtual ~OcclusionQuery();
|
||||
virtual void beginQuery() override;
|
||||
virtual void endQuery() override;
|
||||
@@ -38,7 +38,7 @@ class OcclusionQuery : public Gfx::OcclusionQuery, public QueryPool {
|
||||
DEFINE_REF(OcclusionQuery)
|
||||
class PipelineStatisticsQuery : public Gfx::PipelineStatisticsQuery, public QueryPool {
|
||||
public:
|
||||
PipelineStatisticsQuery(PGraphics graphics);
|
||||
PipelineStatisticsQuery(PGraphics graphics, const std::string& name);
|
||||
virtual ~PipelineStatisticsQuery();
|
||||
virtual void beginQuery() override;
|
||||
virtual void endQuery() override;
|
||||
@@ -46,5 +46,22 @@ class PipelineStatisticsQuery : public Gfx::PipelineStatisticsQuery, public Quer
|
||||
};
|
||||
DEFINE_REF(PipelineStatisticsQuery)
|
||||
|
||||
class TimestampQuery : public Gfx::TimestampQuery, public QueryPool {
|
||||
public:
|
||||
TimestampQuery(PGraphics graphics, const std::string& name, uint32 numTimestamps);
|
||||
virtual ~TimestampQuery();
|
||||
virtual void begin() override;
|
||||
virtual void write(Gfx::SePipelineStageFlagBits stage, const std::string& name = "") override;
|
||||
virtual void end() override;
|
||||
virtual Array<Gfx::Timestamp> getResults() override;
|
||||
|
||||
private:
|
||||
uint64 wrapping = 0;
|
||||
uint64 lastMeasure = 0;
|
||||
uint32 numTimestamps = 0;
|
||||
uint32 currentTimestamp = 0;
|
||||
Array<std::string> pendingTimestamps;
|
||||
};
|
||||
DEFINE_REF(TimestampQuery)
|
||||
} // namespace Vulkan
|
||||
} // namespace Seele
|
||||
Reference in New Issue
Block a user