diff options
| author | Yong He <yonghe@outlook.com> | 2021-06-10 00:30:19 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-10 00:30:19 -0700 |
| commit | 0d9bd79e8fd4d57e1a723ca6b6a45efec2b42872 (patch) | |
| tree | d9e23abd1b51044b12b556cd063916f0b44362c0 /tools/gfx/debug-layer.cpp | |
| parent | 86b0d74e58259c1a1c964acf18923303d9e93148 (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/debug-layer.cpp')
| -rw-r--r-- | tools/gfx/debug-layer.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tools/gfx/debug-layer.cpp b/tools/gfx/debug-layer.cpp index 26e55ca7e..13875d6ec 100644 --- a/tools/gfx/debug-layer.cpp +++ b/tools/gfx/debug-layer.cpp @@ -140,6 +140,8 @@ SLANG_GFX_DEBUG_GET_INTERFACE_IMPL(ShaderObject) SLANG_GFX_DEBUG_GET_INTERFACE_IMPL(ShaderProgram) SLANG_GFX_DEBUG_GET_INTERFACE_IMPL(Swapchain) SLANG_GFX_DEBUG_GET_INTERFACE_IMPL(TransientResourceHeap) +SLANG_GFX_DEBUG_GET_INTERFACE_IMPL(QueryPool) + #undef SLANG_GFX_DEBUG_GET_INTERFACE_IMPL #undef SLANG_GFX_DEBUG_GET_INTERFACE_IMPL_PARENT @@ -477,6 +479,16 @@ const DeviceInfo& DebugDevice::getDeviceInfo() const return baseObject->getDeviceInfo(); } +Result DebugDevice::createQueryPool(const IQueryPool::Desc& desc, IQueryPool** outPool) +{ + SLANG_GFX_API_FUNC; + RefPtr<DebugQueryPool> result = new DebugQueryPool(); + result->desc = desc; + SLANG_RETURN_ON_FAIL(baseObject->createQueryPool(desc, result->baseObject.writeRef())); + returnComPtr(outPool, result); + return SLANG_OK; +} + IResource::Type DebugBufferResource::getType() { SLANG_GFX_API_FUNC; @@ -624,6 +636,12 @@ void DebugComputeCommandEncoder::dispatchCompute(int x, int y, int z) baseObject->dispatchCompute(x, y, z); } +void DebugComputeCommandEncoder::writeTimestamp(IQueryPool* pool, SlangInt index) +{ + SLANG_GFX_API_FUNC; + baseObject->writeTimestamp(static_cast<DebugQueryPool*>(pool)->baseObject, index); +} + void DebugRenderCommandEncoder::endEncoding() { SLANG_GFX_API_FUNC; @@ -706,12 +724,24 @@ void DebugRenderCommandEncoder::setStencilReference(uint32_t referenceValue) return baseObject->setStencilReference(referenceValue); } +void DebugRenderCommandEncoder::writeTimestamp(IQueryPool* pool, SlangInt index) +{ + SLANG_GFX_API_FUNC; + baseObject->writeTimestamp(static_cast<DebugQueryPool*>(pool)->baseObject, index); +} + void DebugResourceCommandEncoder::endEncoding() { SLANG_GFX_API_FUNC; baseObject->endEncoding(); } +void DebugResourceCommandEncoder::writeTimestamp(IQueryPool* pool, SlangInt index) +{ + SLANG_GFX_API_FUNC; + baseObject->writeTimestamp(static_cast<DebugQueryPool*>(pool)->baseObject, index); +} + void DebugResourceCommandEncoder::copyBuffer( IBufferResource* dst, size_t dstOffset, @@ -977,4 +1007,11 @@ Result DebugRootShaderObject::setSpecializationArgs( return baseObject->setSpecializationArgs(offset, args, count); } +Result DebugQueryPool::getResult(SlangInt index, SlangInt count, uint64_t* data) +{ + if (index < 0 || index + count >= desc.count) + GFX_DIAGNOSE_ERROR("index is out of bounds."); + return baseObject->getResult(index, count, data); +} + } // namespace gfx |
