summaryrefslogtreecommitdiff
path: root/tools/gfx/command-writer.h
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-06-10 00:30:19 -0700
committerGitHub <noreply@github.com>2021-06-10 00:30:19 -0700
commit0d9bd79e8fd4d57e1a723ca6b6a45efec2b42872 (patch)
treed9e23abd1b51044b12b556cd063916f0b44362c0 /tools/gfx/command-writer.h
parent86b0d74e58259c1a1c964acf18923303d9e93148 (diff)
Support timestamp queries in `gfx`. (#1880)
* Support timestamp queries in `gfx`. * Fix tab Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tools/gfx/command-writer.h')
-rw-r--r--tools/gfx/command-writer.h13
1 files changed, 12 insertions, 1 deletions
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<Command> m_commands;
Slang::List<Slang::ComPtr<ISlangUnknown>> m_objects;
Slang::List<uint8_t> 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;
+ }
};
}