From 0d9bd79e8fd4d57e1a723ca6b6a45efec2b42872 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 10 Jun 2021 00:30:19 -0700 Subject: Support timestamp queries in `gfx`. (#1880) * Support timestamp queries in `gfx`. * Fix tab Co-authored-by: Yong He --- tools/gfx/command-writer.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tools/gfx/command-writer.h') diff --git a/tools/gfx/command-writer.h b/tools/gfx/command-writer.h index e93244ed1..adbb53d7a 100644 --- a/tools/gfx/command-writer.h +++ b/tools/gfx/command-writer.h @@ -23,7 +23,8 @@ enum class CommandName SetStencilReference, DispatchCompute, UploadBufferData, - CopyBuffer + CopyBuffer, + WriteTimestamp, }; const uint8_t kMaxCommandOperands = 5; @@ -82,6 +83,7 @@ public: Slang::List m_commands; Slang::List> m_objects; Slang::List m_data; + bool m_hasWriteTimestamps = false; public: void clear() @@ -91,6 +93,7 @@ public: obj = nullptr; m_objects.clear(); m_data.clear(); + m_hasWriteTimestamps = false; } // Copies user data into `m_data` buffer and returns the offset to retrieve the data. @@ -248,5 +251,13 @@ public: m_commands.add( Command(CommandName::DispatchCompute, (uint32_t)x, (uint32_t)y, (uint32_t)z)); } + + void writeTimestamp(IQueryPool* pool, SlangInt index) + { + auto poolOffset = encodeObject(pool); + m_commands.add( + Command(CommandName::WriteTimestamp, poolOffset, (uint32_t)index)); + m_hasWriteTimestamps = true; + } }; } -- cgit v1.2.3