Vulkan: Add more detailed counters.

This commit is contained in:
Hans-Kristian Arntzen 2016-03-06 12:11:44 +01:00
parent e6fb3c3a1c
commit 6cde59a8ad
1 changed files with 14 additions and 1 deletions

View File

@ -1355,9 +1355,13 @@ static bool vulkan_frame(void *data, const void *frame,
VkClearValue clear_value;
vk_t *vk = (vk_t*)data;
static struct retro_perf_counter frame_run = {0};
static struct retro_perf_counter begin_cmd = {0};
static struct retro_perf_counter build_cmd = {0};
static struct retro_perf_counter end_cmd = {0};
static struct retro_perf_counter copy_frame = {0};
static struct retro_perf_counter swapbuffers = {0};
static struct retro_perf_counter queue_submit = {0};
VkCommandBufferBeginInfo begin_info = {
VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO };
VkRenderPassBeginInfo rp_info = {
@ -1371,6 +1375,9 @@ static bool vulkan_frame(void *data, const void *frame,
rarch_perf_init(&copy_frame, "copy_frame");
rarch_perf_init(&swapbuffers, "swapbuffers");
rarch_perf_init(&queue_submit, "queue_submit");
rarch_perf_init(&begin_cmd, "begin_command");
rarch_perf_init(&build_cmd, "build_command");
rarch_perf_init(&end_cmd, "end_command");
retro_perf_start(&frame_run);
video_driver_get_size(&width, &height);
@ -1383,12 +1390,15 @@ static bool vulkan_frame(void *data, const void *frame,
vulkan_buffer_chain_discard(&chain->vbo);
vulkan_buffer_chain_discard(&chain->ubo);
retro_perf_start(&begin_cmd);
/* Start recording the command buffer. */
vk->cmd = chain->cmd;
begin_info.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
VKFUNC(vkResetCommandBuffer)(vk->cmd, 0);
VKFUNC(vkBeginCommandBuffer)(vk->cmd, &begin_info);
retro_perf_stop(&begin_cmd);
memset(&vk->tracker, 0, sizeof(vk->tracker));
/* Upload texture */
@ -1446,6 +1456,7 @@ static bool vulkan_frame(void *data, const void *frame,
/* Notify filter chain about the new sync index. */
vulkan_filter_chain_notify_sync_index(vk->filter_chain, frame_index);
retro_perf_start(&build_cmd);
/* Render offscreen filter chain passes. */
{
/* Set the source texture in the filter chain */
@ -1498,7 +1509,6 @@ static bool vulkan_frame(void *data, const void *frame,
vulkan_filter_chain_build_offscreen_passes(
vk->filter_chain, vk->cmd, &vk->vk_vp);
/* Render to backbuffer. */
clear_value.color.float32[0] = 0.0f;
clear_value.color.float32[1] = 0.0f;
@ -1568,6 +1578,7 @@ static bool vulkan_frame(void *data, const void *frame,
if (vk->overlay.enable)
vulkan_render_overlay(vk);
#endif
retro_perf_stop(&build_cmd);
/* End the render pass. We're done rendering to backbuffer now. */
VKFUNC(vkCmdEndRenderPass)(vk->cmd);
@ -1616,7 +1627,9 @@ static bool vulkan_frame(void *data, const void *frame,
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT);
}
retro_perf_start(&end_cmd);
VKFUNC(vkEndCommandBuffer)(vk->cmd);
retro_perf_stop(&end_cmd);
/* Submit command buffers to GPU. */