More vulkan profiling. (#3279)
This commit is contained in:
parent
0ddba0bcf4
commit
0ed3ac95aa
@ -2824,6 +2824,7 @@ VK_IMPORT_DEVICE
|
|||||||
|
|
||||||
void setFrameBuffer(FrameBufferHandle _fbh, bool _acquire = true)
|
void setFrameBuffer(FrameBufferHandle _fbh, bool _acquire = true)
|
||||||
{
|
{
|
||||||
|
BGFX_PROFILER_SCOPE("Vk::setFrameBuffer()", kColorFrame);
|
||||||
BX_ASSERT(false
|
BX_ASSERT(false
|
||||||
|| isValid(_fbh)
|
|| isValid(_fbh)
|
||||||
|| NULL != m_backBuffer.m_nwh
|
|| NULL != m_backBuffer.m_nwh
|
||||||
@ -4716,6 +4717,7 @@ VK_DESTROY
|
|||||||
|
|
||||||
void BufferVK::update(VkCommandBuffer _commandBuffer, uint32_t _offset, uint32_t _size, void* _data, bool _discard)
|
void BufferVK::update(VkCommandBuffer _commandBuffer, uint32_t _offset, uint32_t _size, void* _data, bool _discard)
|
||||||
{
|
{
|
||||||
|
BGFX_PROFILER_SCOPE("BufferVK::update", kColorFrame);
|
||||||
BX_UNUSED(_discard);
|
BX_UNUSED(_discard);
|
||||||
|
|
||||||
VkBuffer stagingBuffer;
|
VkBuffer stagingBuffer;
|
||||||
@ -5298,6 +5300,7 @@ VK_DESTROY
|
|||||||
|
|
||||||
VkResult TimerQueryVK::init()
|
VkResult TimerQueryVK::init()
|
||||||
{
|
{
|
||||||
|
BGFX_PROFILER_SCOPE("TimerQueryVK::init", kColorFrame);
|
||||||
VkResult result = VK_SUCCESS;
|
VkResult result = VK_SUCCESS;
|
||||||
|
|
||||||
const VkDevice device = s_renderVK->m_device;
|
const VkDevice device = s_renderVK->m_device;
|
||||||
@ -5361,6 +5364,7 @@ VK_DESTROY
|
|||||||
|
|
||||||
uint32_t TimerQueryVK::begin(uint32_t _resultIdx, uint32_t _frameNum)
|
uint32_t TimerQueryVK::begin(uint32_t _resultIdx, uint32_t _frameNum)
|
||||||
{
|
{
|
||||||
|
BGFX_PROFILER_SCOPE("TimerQueryVK::begin", kColorFrame);
|
||||||
while (0 == m_control.reserve(1) )
|
while (0 == m_control.reserve(1) )
|
||||||
{
|
{
|
||||||
m_control.consume(1);
|
m_control.consume(1);
|
||||||
@ -5388,6 +5392,7 @@ VK_DESTROY
|
|||||||
|
|
||||||
void TimerQueryVK::end(uint32_t _idx)
|
void TimerQueryVK::end(uint32_t _idx)
|
||||||
{
|
{
|
||||||
|
BGFX_PROFILER_SCOPE("TimerQueryVK::end", kColorFrame);
|
||||||
Query& query = m_query[_idx];
|
Query& query = m_query[_idx];
|
||||||
query.m_ready = true;
|
query.m_ready = true;
|
||||||
query.m_completed = s_renderVK->m_cmd.m_submitted + s_renderVK->m_cmd.m_numFramesInFlight;
|
query.m_completed = s_renderVK->m_cmd.m_submitted + s_renderVK->m_cmd.m_numFramesInFlight;
|
||||||
@ -5450,6 +5455,7 @@ VK_DESTROY
|
|||||||
|
|
||||||
VkResult OcclusionQueryVK::init()
|
VkResult OcclusionQueryVK::init()
|
||||||
{
|
{
|
||||||
|
BGFX_PROFILER_SCOPE("OcclusionQueryVK::init", kColorFrame);
|
||||||
VkResult result = VK_SUCCESS;
|
VkResult result = VK_SUCCESS;
|
||||||
|
|
||||||
const VkDevice device = s_renderVK->m_device;
|
const VkDevice device = s_renderVK->m_device;
|
||||||
@ -5506,6 +5512,7 @@ VK_DESTROY
|
|||||||
|
|
||||||
void OcclusionQueryVK::begin(OcclusionQueryHandle _handle)
|
void OcclusionQueryVK::begin(OcclusionQueryHandle _handle)
|
||||||
{
|
{
|
||||||
|
BGFX_PROFILER_SCOPE("OcclusionQueryVK::shutdown", kColorFrame);
|
||||||
m_control.reserve(1);
|
m_control.reserve(1);
|
||||||
|
|
||||||
const VkCommandBuffer commandBuffer = s_renderVK->m_commandBuffer;
|
const VkCommandBuffer commandBuffer = s_renderVK->m_commandBuffer;
|
||||||
@ -5516,6 +5523,7 @@ VK_DESTROY
|
|||||||
|
|
||||||
void OcclusionQueryVK::end()
|
void OcclusionQueryVK::end()
|
||||||
{
|
{
|
||||||
|
BGFX_PROFILER_SCOPE("OcclusionQueryVK::end", kColorFrame);
|
||||||
const VkCommandBuffer commandBuffer = s_renderVK->m_commandBuffer;
|
const VkCommandBuffer commandBuffer = s_renderVK->m_commandBuffer;
|
||||||
|
|
||||||
const OcclusionQueryHandle handle = m_handle[m_control.m_current];
|
const OcclusionQueryHandle handle = m_handle[m_control.m_current];
|
||||||
@ -5526,6 +5534,7 @@ VK_DESTROY
|
|||||||
|
|
||||||
void OcclusionQueryVK::flush(Frame* _render)
|
void OcclusionQueryVK::flush(Frame* _render)
|
||||||
{
|
{
|
||||||
|
BGFX_PROFILER_SCOPE("OcclusionQueryVK::flush", kColorFrame);
|
||||||
if (0 < m_control.available() )
|
if (0 < m_control.available() )
|
||||||
{
|
{
|
||||||
VkCommandBuffer commandBuffer = s_renderVK->m_commandBuffer;
|
VkCommandBuffer commandBuffer = s_renderVK->m_commandBuffer;
|
||||||
@ -5614,6 +5623,7 @@ VK_DESTROY
|
|||||||
|
|
||||||
void ReadbackVK::copyImageToBuffer(VkCommandBuffer _commandBuffer, VkBuffer _buffer, VkImageLayout _layout, VkImageAspectFlags _aspect, uint8_t _mip) const
|
void ReadbackVK::copyImageToBuffer(VkCommandBuffer _commandBuffer, VkBuffer _buffer, VkImageLayout _layout, VkImageAspectFlags _aspect, uint8_t _mip) const
|
||||||
{
|
{
|
||||||
|
BGFX_PROFILER_SCOPE("ReadbackVK::copyImageToBuffer", kColorFrame);
|
||||||
uint32_t mipWidth = bx::uint32_max(1, m_width >> _mip);
|
uint32_t mipWidth = bx::uint32_max(1, m_width >> _mip);
|
||||||
uint32_t mipHeight = bx::uint32_max(1, m_height >> _mip);
|
uint32_t mipHeight = bx::uint32_max(1, m_height >> _mip);
|
||||||
|
|
||||||
@ -6228,6 +6238,7 @@ VK_DESTROY
|
|||||||
|
|
||||||
void TextureVK::resolve(VkCommandBuffer _commandBuffer, uint8_t _resolve, uint32_t _layer, uint32_t _numLayers, uint32_t _mip)
|
void TextureVK::resolve(VkCommandBuffer _commandBuffer, uint8_t _resolve, uint32_t _layer, uint32_t _numLayers, uint32_t _mip)
|
||||||
{
|
{
|
||||||
|
BGFX_PROFILER_SCOPE("TextureVK::resolve", kColorResource);
|
||||||
const bool needResolve = VK_NULL_HANDLE != m_singleMsaaImage;
|
const bool needResolve = VK_NULL_HANDLE != m_singleMsaaImage;
|
||||||
|
|
||||||
const bool needMipGen = true
|
const bool needMipGen = true
|
||||||
@ -6303,6 +6314,7 @@ VK_DESTROY
|
|||||||
|
|
||||||
for (uint32_t i = _mip + 1; i < m_numMips; i++)
|
for (uint32_t i = _mip + 1; i < m_numMips; i++)
|
||||||
{
|
{
|
||||||
|
BGFX_PROFILER_SCOPE("mipmap", kColorResource);
|
||||||
blit.srcOffsets[1] = { mipWidth, mipHeight, 1 };
|
blit.srcOffsets[1] = { mipWidth, mipHeight, 1 };
|
||||||
blit.srcSubresource.mipLevel = i - 1;
|
blit.srcSubresource.mipLevel = i - 1;
|
||||||
|
|
||||||
@ -6355,6 +6367,7 @@ VK_DESTROY
|
|||||||
|
|
||||||
void TextureVK::copyBufferToTexture(VkCommandBuffer _commandBuffer, VkBuffer _stagingBuffer, uint32_t _bufferImageCopyCount, VkBufferImageCopy* _bufferImageCopy)
|
void TextureVK::copyBufferToTexture(VkCommandBuffer _commandBuffer, VkBuffer _stagingBuffer, uint32_t _bufferImageCopyCount, VkBufferImageCopy* _bufferImageCopy)
|
||||||
{
|
{
|
||||||
|
BGFX_PROFILER_SCOPE("TextureVK::copyBufferToTexture", kColorResource);
|
||||||
const VkImageLayout oldLayout = m_currentImageLayout == VK_IMAGE_LAYOUT_UNDEFINED
|
const VkImageLayout oldLayout = m_currentImageLayout == VK_IMAGE_LAYOUT_UNDEFINED
|
||||||
? m_sampledLayout
|
? m_sampledLayout
|
||||||
: m_currentImageLayout
|
: m_currentImageLayout
|
||||||
@ -7400,14 +7413,18 @@ VK_DESTROY
|
|||||||
m_lastImageRenderedSemaphore = m_renderDoneSemaphore[m_currentSemaphore];
|
m_lastImageRenderedSemaphore = m_renderDoneSemaphore[m_currentSemaphore];
|
||||||
m_currentSemaphore = (m_currentSemaphore + 1) % m_numSwapchainImages;
|
m_currentSemaphore = (m_currentSemaphore + 1) % m_numSwapchainImages;
|
||||||
|
|
||||||
VkResult result = vkAcquireNextImageKHR(
|
VkResult result;
|
||||||
device
|
{
|
||||||
, m_swapchain
|
BGFX_PROFILER_SCOPE("vkAcquireNextImageKHR", kColorFrame);
|
||||||
, UINT64_MAX
|
result = vkAcquireNextImageKHR(
|
||||||
, m_lastImageAcquiredSemaphore
|
device
|
||||||
, VK_NULL_HANDLE
|
, m_swapchain
|
||||||
, &m_backBufferColorIdx
|
, UINT64_MAX
|
||||||
);
|
, m_lastImageAcquiredSemaphore
|
||||||
|
, VK_NULL_HANDLE
|
||||||
|
, &m_backBufferColorIdx
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
@ -7430,6 +7447,7 @@ VK_DESTROY
|
|||||||
|
|
||||||
if (VK_NULL_HANDLE != m_backBufferFence[m_backBufferColorIdx])
|
if (VK_NULL_HANDLE != m_backBufferFence[m_backBufferColorIdx])
|
||||||
{
|
{
|
||||||
|
BGFX_PROFILER_SCOPE("vkWaitForFences", kColorFrame);
|
||||||
VK_CHECK(vkWaitForFences(
|
VK_CHECK(vkWaitForFences(
|
||||||
device
|
device
|
||||||
, 1
|
, 1
|
||||||
@ -7449,6 +7467,7 @@ VK_DESTROY
|
|||||||
|
|
||||||
void SwapChainVK::present()
|
void SwapChainVK::present()
|
||||||
{
|
{
|
||||||
|
BGFX_PROFILER_SCOPE("SwapChainVk::present", kColorFrame);
|
||||||
if (VK_NULL_HANDLE != m_swapchain
|
if (VK_NULL_HANDLE != m_swapchain
|
||||||
&& m_needPresent)
|
&& m_needPresent)
|
||||||
{
|
{
|
||||||
@ -7461,7 +7480,11 @@ VK_DESTROY
|
|||||||
pi.pSwapchains = &m_swapchain;
|
pi.pSwapchains = &m_swapchain;
|
||||||
pi.pImageIndices = &m_backBufferColorIdx;
|
pi.pImageIndices = &m_backBufferColorIdx;
|
||||||
pi.pResults = NULL;
|
pi.pResults = NULL;
|
||||||
VkResult result = vkQueuePresentKHR(m_queue, &pi);
|
VkResult result;
|
||||||
|
{
|
||||||
|
BGFX_PROFILER_SCOPE("vkQueuePresentHKR", kColorFrame);
|
||||||
|
result = vkQueuePresentKHR(m_queue, &pi);
|
||||||
|
}
|
||||||
|
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
@ -7835,7 +7858,10 @@ VK_DESTROY
|
|||||||
const VkDevice device = s_renderVK->m_device;
|
const VkDevice device = s_renderVK->m_device;
|
||||||
CommandList& commandList = m_commandList[m_currentFrameInFlight];
|
CommandList& commandList = m_commandList[m_currentFrameInFlight];
|
||||||
|
|
||||||
result = vkWaitForFences(device, 1, &commandList.m_fence, VK_TRUE, UINT64_MAX);
|
{
|
||||||
|
BGFX_PROFILER_SCOPE("vkWaitForFences", kColorFrame);
|
||||||
|
result = vkWaitForFences(device, 1, &commandList.m_fence, VK_TRUE, UINT64_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
if (VK_SUCCESS != result)
|
if (VK_SUCCESS != result)
|
||||||
{
|
{
|
||||||
@ -7931,6 +7957,7 @@ VK_DESTROY
|
|||||||
|
|
||||||
if (_wait)
|
if (_wait)
|
||||||
{
|
{
|
||||||
|
BGFX_PROFILER_SCOPE("vkWaitForFences", kColorFrame);
|
||||||
VK_CHECK(vkWaitForFences(device, 1, &m_completedFence, VK_TRUE, UINT64_MAX) );
|
VK_CHECK(vkWaitForFences(device, 1, &m_completedFence, VK_TRUE, UINT64_MAX) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7999,6 +8026,7 @@ VK_DESTROY
|
|||||||
|
|
||||||
void RendererContextVK::submitBlit(BlitState& _bs, uint16_t _view)
|
void RendererContextVK::submitBlit(BlitState& _bs, uint16_t _view)
|
||||||
{
|
{
|
||||||
|
BGFX_PROFILER_SCOPE("RendererContextVK::submitBlit", kColorFrame);
|
||||||
VkImageLayout srcLayouts[BGFX_CONFIG_MAX_BLIT_ITEMS];
|
VkImageLayout srcLayouts[BGFX_CONFIG_MAX_BLIT_ITEMS];
|
||||||
VkImageLayout dstLayouts[BGFX_CONFIG_MAX_BLIT_ITEMS];
|
VkImageLayout dstLayouts[BGFX_CONFIG_MAX_BLIT_ITEMS];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user