diff options
| author | 2015-08-17 18:25:21 -0300 | |
|---|---|---|
| committer | 2015-08-24 22:16:28 -0300 | |
| commit | 0fcabd2b11a5b1d4d16f6f6bdf1efd54d2c45237 (patch) | |
| tree | a1651d48113413e2de1e6e309362511b1ff7ffa8 /src/video_core | |
| parent | citra-qt: Add helper function to get a monospace QFont (diff) | |
| download | yuzu-0fcabd2b11a5b1d4d16f6f6bdf1efd54d2c45237.tar.gz yuzu-0fcabd2b11a5b1d4d16f6f6bdf1efd54d2c45237.tar.xz yuzu-0fcabd2b11a5b1d4d16f6f6bdf1efd54d2c45237.zip | |
Integrate the MicroProfile profiling library
This brings goodies such as a configurable user interface and
multi-threaded timeline view.
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/command_processor.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/rasterizer.cpp | 3 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 5 | ||||
| -rw-r--r-- | src/video_core/shader/shader.cpp | 3 |
5 files changed, 25 insertions, 0 deletions
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index d82e20f86..a78985510 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #include <boost/range/algorithm/fill.hpp> | 5 | #include <boost/range/algorithm/fill.hpp> |
| 6 | 6 | ||
| 7 | #include "common/microprofile.h" | ||
| 7 | #include "common/profiler.h" | 8 | #include "common/profiler.h" |
| 8 | 9 | ||
| 9 | #include "core/hle/service/gsp_gpu.h" | 10 | #include "core/hle/service/gsp_gpu.h" |
| @@ -43,6 +44,8 @@ static const u32 expand_bits_to_bytes[] = { | |||
| 43 | 0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff | 44 | 0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff |
| 44 | }; | 45 | }; |
| 45 | 46 | ||
| 47 | MICROPROFILE_DEFINE(GPU_Drawing, "GPU", "Drawing", MP_RGB(50, 50, 240)); | ||
| 48 | |||
| 46 | static void WritePicaReg(u32 id, u32 value, u32 mask) { | 49 | static void WritePicaReg(u32 id, u32 value, u32 mask) { |
| 47 | auto& regs = g_state.regs; | 50 | auto& regs = g_state.regs; |
| 48 | 51 | ||
| @@ -126,6 +129,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) { | |||
| 126 | case PICA_REG_INDEX(trigger_draw_indexed): | 129 | case PICA_REG_INDEX(trigger_draw_indexed): |
| 127 | { | 130 | { |
| 128 | Common::Profiling::ScopeTimer scope_timer(category_drawing); | 131 | Common::Profiling::ScopeTimer scope_timer(category_drawing); |
| 132 | MICROPROFILE_SCOPE(GPU_Drawing); | ||
| 129 | 133 | ||
| 130 | #if PICA_LOG_TEV | 134 | #if PICA_LOG_TEV |
| 131 | DebugUtils::DumpTevStageConfig(regs.GetTevStages()); | 135 | DebugUtils::DumpTevStageConfig(regs.GetTevStages()); |
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp index b83798b0f..4a159da8e 100644 --- a/src/video_core/rasterizer.cpp +++ b/src/video_core/rasterizer.cpp | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include "common/color.h" | 7 | #include "common/color.h" |
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "common/math_util.h" | 9 | #include "common/math_util.h" |
| 10 | #include "common/microprofile.h" | ||
| 10 | #include "common/profiler.h" | 11 | #include "common/profiler.h" |
| 11 | 12 | ||
| 12 | #include "core/hw/gpu.h" | 13 | #include "core/hw/gpu.h" |
| @@ -267,6 +268,7 @@ static int SignedArea (const Math::Vec2<Fix12P4>& vtx1, | |||
| 267 | }; | 268 | }; |
| 268 | 269 | ||
| 269 | static Common::Profiling::TimingCategory rasterization_category("Rasterization"); | 270 | static Common::Profiling::TimingCategory rasterization_category("Rasterization"); |
| 271 | MICROPROFILE_DEFINE(GPU_Rasterization, "GPU", "Rasterization", MP_RGB(50, 50, 240)); | ||
| 270 | 272 | ||
| 271 | /** | 273 | /** |
| 272 | * Helper function for ProcessTriangle with the "reversed" flag to allow for implementing | 274 | * Helper function for ProcessTriangle with the "reversed" flag to allow for implementing |
| @@ -279,6 +281,7 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, | |||
| 279 | { | 281 | { |
| 280 | const auto& regs = g_state.regs; | 282 | const auto& regs = g_state.regs; |
| 281 | Common::Profiling::ScopeTimer timer(rasterization_category); | 283 | Common::Profiling::ScopeTimer timer(rasterization_category); |
| 284 | MICROPROFILE_SCOPE(GPU_Rasterization); | ||
| 282 | 285 | ||
| 283 | // vertex positions in rasterizer coordinates | 286 | // vertex positions in rasterizer coordinates |
| 284 | static auto FloatToFix = [](float24 flt) { | 287 | static auto FloatToFix = [](float24 flt) { |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 9f1552adf..deb9971bb 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | #include "common/color.h" | 8 | #include "common/color.h" |
| 9 | #include "common/math_util.h" | 9 | #include "common/math_util.h" |
| 10 | #include "common/microprofile.h" | ||
| 10 | #include "common/profiler.h" | 11 | #include "common/profiler.h" |
| 11 | 12 | ||
| 12 | #include "core/hw/gpu.h" | 13 | #include "core/hw/gpu.h" |
| @@ -777,12 +778,16 @@ void RasterizerOpenGL::SyncDrawState() { | |||
| 777 | state.Apply(); | 778 | state.Apply(); |
| 778 | } | 779 | } |
| 779 | 780 | ||
| 781 | MICROPROFILE_DEFINE(OpenGL_FramebufferReload, "OpenGL", "FB Reload", MP_RGB(70, 70, 200)); | ||
| 782 | |||
| 780 | void RasterizerOpenGL::ReloadColorBuffer() { | 783 | void RasterizerOpenGL::ReloadColorBuffer() { |
| 781 | u8* color_buffer = Memory::GetPhysicalPointer(Pica::g_state.regs.framebuffer.GetColorBufferPhysicalAddress()); | 784 | u8* color_buffer = Memory::GetPhysicalPointer(Pica::g_state.regs.framebuffer.GetColorBufferPhysicalAddress()); |
| 782 | 785 | ||
| 783 | if (color_buffer == nullptr) | 786 | if (color_buffer == nullptr) |
| 784 | return; | 787 | return; |
| 785 | 788 | ||
| 789 | MICROPROFILE_SCOPE(OpenGL_FramebufferReload); | ||
| 790 | |||
| 786 | u32 bytes_per_pixel = Pica::Regs::BytesPerColorPixel(fb_color_texture.format); | 791 | u32 bytes_per_pixel = Pica::Regs::BytesPerColorPixel(fb_color_texture.format); |
| 787 | 792 | ||
| 788 | std::unique_ptr<u8[]> temp_fb_color_buffer(new u8[fb_color_texture.width * fb_color_texture.height * bytes_per_pixel]); | 793 | std::unique_ptr<u8[]> temp_fb_color_buffer(new u8[fb_color_texture.width * fb_color_texture.height * bytes_per_pixel]); |
| @@ -822,6 +827,8 @@ void RasterizerOpenGL::ReloadDepthBuffer() { | |||
| 822 | if (depth_buffer == nullptr) | 827 | if (depth_buffer == nullptr) |
| 823 | return; | 828 | return; |
| 824 | 829 | ||
| 830 | MICROPROFILE_SCOPE(OpenGL_FramebufferReload); | ||
| 831 | |||
| 825 | u32 bytes_per_pixel = Pica::Regs::BytesPerDepthPixel(fb_depth_texture.format); | 832 | u32 bytes_per_pixel = Pica::Regs::BytesPerDepthPixel(fb_depth_texture.format); |
| 826 | 833 | ||
| 827 | // OpenGL needs 4 bpp alignment for D24 | 834 | // OpenGL needs 4 bpp alignment for D24 |
| @@ -868,6 +875,7 @@ void RasterizerOpenGL::ReloadDepthBuffer() { | |||
| 868 | } | 875 | } |
| 869 | 876 | ||
| 870 | Common::Profiling::TimingCategory buffer_commit_category("Framebuffer Commit"); | 877 | Common::Profiling::TimingCategory buffer_commit_category("Framebuffer Commit"); |
| 878 | MICROPROFILE_DEFINE(OpenGL_FramebufferCommit, "OpenGL", "FB Commit", MP_RGB(70, 70, 200)); | ||
| 871 | 879 | ||
| 872 | void RasterizerOpenGL::CommitColorBuffer() { | 880 | void RasterizerOpenGL::CommitColorBuffer() { |
| 873 | if (last_fb_color_addr != 0) { | 881 | if (last_fb_color_addr != 0) { |
| @@ -875,6 +883,7 @@ void RasterizerOpenGL::CommitColorBuffer() { | |||
| 875 | 883 | ||
| 876 | if (color_buffer != nullptr) { | 884 | if (color_buffer != nullptr) { |
| 877 | Common::Profiling::ScopeTimer timer(buffer_commit_category); | 885 | Common::Profiling::ScopeTimer timer(buffer_commit_category); |
| 886 | MICROPROFILE_SCOPE(OpenGL_FramebufferCommit); | ||
| 878 | 887 | ||
| 879 | u32 bytes_per_pixel = Pica::Regs::BytesPerColorPixel(fb_color_texture.format); | 888 | u32 bytes_per_pixel = Pica::Regs::BytesPerColorPixel(fb_color_texture.format); |
| 880 | 889 | ||
| @@ -911,6 +920,7 @@ void RasterizerOpenGL::CommitDepthBuffer() { | |||
| 911 | 920 | ||
| 912 | if (depth_buffer != nullptr) { | 921 | if (depth_buffer != nullptr) { |
| 913 | Common::Profiling::ScopeTimer timer(buffer_commit_category); | 922 | Common::Profiling::ScopeTimer timer(buffer_commit_category); |
| 923 | MICROPROFILE_SCOPE(OpenGL_FramebufferCommit); | ||
| 914 | 924 | ||
| 915 | u32 bytes_per_pixel = Pica::Regs::BytesPerDepthPixel(fb_depth_texture.format); | 925 | u32 bytes_per_pixel = Pica::Regs::BytesPerDepthPixel(fb_depth_texture.format); |
| 916 | 926 | ||
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 70f0ba5f1..e4247051c 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #include "common/make_unique.h" | 5 | #include "common/make_unique.h" |
| 6 | #include "common/math_util.h" | 6 | #include "common/math_util.h" |
| 7 | #include "common/microprofile.h" | ||
| 7 | #include "common/vector_math.h" | 8 | #include "common/vector_math.h" |
| 8 | 9 | ||
| 9 | #include "core/memory.h" | 10 | #include "core/memory.h" |
| @@ -16,6 +17,8 @@ RasterizerCacheOpenGL::~RasterizerCacheOpenGL() { | |||
| 16 | FullFlush(); | 17 | FullFlush(); |
| 17 | } | 18 | } |
| 18 | 19 | ||
| 20 | MICROPROFILE_DEFINE(OpenGL_TextureUpload, "OpenGL", "Texture Upload", MP_RGB(128, 64, 192)); | ||
| 21 | |||
| 19 | void RasterizerCacheOpenGL::LoadAndBindTexture(OpenGLState &state, unsigned texture_unit, const Pica::Regs::FullTextureConfig& config) { | 22 | void RasterizerCacheOpenGL::LoadAndBindTexture(OpenGLState &state, unsigned texture_unit, const Pica::Regs::FullTextureConfig& config) { |
| 20 | PAddr texture_addr = config.config.GetPhysicalAddress(); | 23 | PAddr texture_addr = config.config.GetPhysicalAddress(); |
| 21 | 24 | ||
| @@ -25,6 +28,8 @@ void RasterizerCacheOpenGL::LoadAndBindTexture(OpenGLState &state, unsigned text | |||
| 25 | state.texture_units[texture_unit].texture_2d = cached_texture->second->texture.handle; | 28 | state.texture_units[texture_unit].texture_2d = cached_texture->second->texture.handle; |
| 26 | state.Apply(); | 29 | state.Apply(); |
| 27 | } else { | 30 | } else { |
| 31 | MICROPROFILE_SCOPE(OpenGL_TextureUpload); | ||
| 32 | |||
| 28 | std::unique_ptr<CachedTexture> new_texture = Common::make_unique<CachedTexture>(); | 33 | std::unique_ptr<CachedTexture> new_texture = Common::make_unique<CachedTexture>(); |
| 29 | 34 | ||
| 30 | new_texture->texture.Create(); | 35 | new_texture->texture.Create(); |
diff --git a/src/video_core/shader/shader.cpp b/src/video_core/shader/shader.cpp index 4e9836c80..be5588c00 100644 --- a/src/video_core/shader/shader.cpp +++ b/src/video_core/shader/shader.cpp | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | #include "common/hash.h" | 10 | #include "common/hash.h" |
| 11 | #include "common/make_unique.h" | 11 | #include "common/make_unique.h" |
| 12 | #include "common/microprofile.h" | ||
| 12 | #include "common/profiler.h" | 13 | #include "common/profiler.h" |
| 13 | 14 | ||
| 14 | #include "video_core/debug_utils/debug_utils.h" | 15 | #include "video_core/debug_utils/debug_utils.h" |
| @@ -55,11 +56,13 @@ void Shutdown() { | |||
| 55 | } | 56 | } |
| 56 | 57 | ||
| 57 | static Common::Profiling::TimingCategory shader_category("Vertex Shader"); | 58 | static Common::Profiling::TimingCategory shader_category("Vertex Shader"); |
| 59 | MICROPROFILE_DEFINE(GPU_VertexShader, "GPU", "Vertex Shader", MP_RGB(50, 50, 240)); | ||
| 58 | 60 | ||
| 59 | OutputVertex Run(UnitState<false>& state, const InputVertex& input, int num_attributes) { | 61 | OutputVertex Run(UnitState<false>& state, const InputVertex& input, int num_attributes) { |
| 60 | auto& config = g_state.regs.vs; | 62 | auto& config = g_state.regs.vs; |
| 61 | 63 | ||
| 62 | Common::Profiling::ScopeTimer timer(shader_category); | 64 | Common::Profiling::ScopeTimer timer(shader_category); |
| 65 | MICROPROFILE_SCOPE(GPU_VertexShader); | ||
| 63 | 66 | ||
| 64 | state.program_counter = config.main_offset; | 67 | state.program_counter = config.main_offset; |
| 65 | state.debug.max_offset = 0; | 68 | state.debug.max_offset = 0; |