summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audio_core/stream.cpp4
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp8
-rw-r--r--src/video_core/renderer_opengl/gl_resource_manager.cpp42
-rw-r--r--src/video_core/renderer_opengl/gl_stream_buffer.cpp5
4 files changed, 53 insertions, 6 deletions
diff --git a/src/audio_core/stream.cpp b/src/audio_core/stream.cpp
index 742a5e0a0..f35628e45 100644
--- a/src/audio_core/stream.cpp
+++ b/src/audio_core/stream.cpp
@@ -11,7 +11,6 @@
11#include "audio_core/stream.h" 11#include "audio_core/stream.h"
12#include "common/assert.h" 12#include "common/assert.h"
13#include "common/logging/log.h" 13#include "common/logging/log.h"
14#include "common/microprofile.h"
15#include "core/core_timing.h" 14#include "core/core_timing.h"
16#include "core/core_timing_util.h" 15#include "core/core_timing_util.h"
17#include "core/settings.h" 16#include "core/settings.h"
@@ -104,10 +103,7 @@ void Stream::PlayNextBuffer() {
104 CoreTiming::ScheduleEventThreadsafe(GetBufferReleaseCycles(*active_buffer), release_event, {}); 103 CoreTiming::ScheduleEventThreadsafe(GetBufferReleaseCycles(*active_buffer), release_event, {});
105} 104}
106 105
107MICROPROFILE_DEFINE(AudioOutput, "Audio", "ReleaseActiveBuffer", MP_RGB(100, 100, 255));
108
109void Stream::ReleaseActiveBuffer() { 106void Stream::ReleaseActiveBuffer() {
110 MICROPROFILE_SCOPE(AudioOutput);
111 ASSERT(active_buffer); 107 ASSERT(active_buffer);
112 released_buffers.push(std::move(active_buffer)); 108 released_buffers.push(std::move(active_buffer));
113 release_callback(); 109 release_callback();
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 7d970efa0..49d63e6f3 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -562,9 +562,11 @@ void SwizzleFunc(const GLConversionArray& functions, const SurfaceParams& params
562 } 562 }
563} 563}
564 564
565MICROPROFILE_DEFINE(OpenGL_BlitSurface, "OpenGL", "BlitSurface", MP_RGB(128, 192, 64));
565static bool BlitSurface(const Surface& src_surface, const Surface& dst_surface, 566static bool BlitSurface(const Surface& src_surface, const Surface& dst_surface,
566 GLuint read_fb_handle, GLuint draw_fb_handle, GLenum src_attachment = 0, 567 GLuint read_fb_handle, GLuint draw_fb_handle, GLenum src_attachment = 0,
567 GLenum dst_attachment = 0, std::size_t cubemap_face = 0) { 568 GLenum dst_attachment = 0, std::size_t cubemap_face = 0) {
569 MICROPROFILE_SCOPE(OpenGL_BlitSurface);
568 570
569 const auto& src_params{src_surface->GetSurfaceParams()}; 571 const auto& src_params{src_surface->GetSurfaceParams()};
570 const auto& dst_params{dst_surface->GetSurfaceParams()}; 572 const auto& dst_params{dst_surface->GetSurfaceParams()};
@@ -704,9 +706,11 @@ static void FastCopySurface(const Surface& src_surface, const Surface& dst_surfa
704 0, 0, width, height, 1); 706 0, 0, width, height, 1);
705} 707}
706 708
709MICROPROFILE_DEFINE(OpenGL_CopySurface, "OpenGL", "CopySurface", MP_RGB(128, 192, 64));
707static void CopySurface(const Surface& src_surface, const Surface& dst_surface, 710static void CopySurface(const Surface& src_surface, const Surface& dst_surface,
708 GLuint copy_pbo_handle, GLenum src_attachment = 0, 711 GLuint copy_pbo_handle, GLenum src_attachment = 0,
709 GLenum dst_attachment = 0, std::size_t cubemap_face = 0) { 712 GLenum dst_attachment = 0, std::size_t cubemap_face = 0) {
713 MICROPROFILE_SCOPE(OpenGL_CopySurface);
710 ASSERT_MSG(dst_attachment == 0, "Unimplemented"); 714 ASSERT_MSG(dst_attachment == 0, "Unimplemented");
711 715
712 const auto& src_params{src_surface->GetSurfaceParams()}; 716 const auto& src_params{src_surface->GetSurfaceParams()};
@@ -975,7 +979,7 @@ static void ConvertFormatAsNeeded_FlushGLBuffer(std::vector<u8>& data, PixelForm
975 } 979 }
976} 980}
977 981
978MICROPROFILE_DEFINE(OpenGL_SurfaceLoad, "OpenGL", "Surface Load", MP_RGB(128, 64, 192)); 982MICROPROFILE_DEFINE(OpenGL_SurfaceLoad, "OpenGL", "Surface Load", MP_RGB(128, 192, 64));
979void CachedSurface::LoadGLBuffer() { 983void CachedSurface::LoadGLBuffer() {
980 MICROPROFILE_SCOPE(OpenGL_SurfaceLoad); 984 MICROPROFILE_SCOPE(OpenGL_SurfaceLoad);
981 gl_buffer.resize(params.max_mip_level); 985 gl_buffer.resize(params.max_mip_level);
@@ -1157,7 +1161,7 @@ void CachedSurface::UploadGLMipmapTexture(u32 mip_map, GLuint read_fb_handle,
1157 glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); 1161 glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
1158} 1162}
1159 1163
1160MICROPROFILE_DEFINE(OpenGL_TextureUL, "OpenGL", "Texture Upload", MP_RGB(128, 64, 192)); 1164MICROPROFILE_DEFINE(OpenGL_TextureUL, "OpenGL", "Texture Upload", MP_RGB(128, 192, 64));
1161void CachedSurface::UploadGLTexture(GLuint read_fb_handle, GLuint draw_fb_handle) { 1165void CachedSurface::UploadGLTexture(GLuint read_fb_handle, GLuint draw_fb_handle) {
1162 if (params.type == SurfaceType::Fill) 1166 if (params.type == SurfaceType::Fill)
1163 return; 1167 return;
diff --git a/src/video_core/renderer_opengl/gl_resource_manager.cpp b/src/video_core/renderer_opengl/gl_resource_manager.cpp
index c10863337..161318c5f 100644
--- a/src/video_core/renderer_opengl/gl_resource_manager.cpp
+++ b/src/video_core/renderer_opengl/gl_resource_manager.cpp
@@ -5,21 +5,31 @@
5#include <utility> 5#include <utility>
6#include <glad/glad.h> 6#include <glad/glad.h>
7#include "common/common_types.h" 7#include "common/common_types.h"
8#include "common/microprofile.h"
8#include "video_core/renderer_opengl/gl_resource_manager.h" 9#include "video_core/renderer_opengl/gl_resource_manager.h"
9#include "video_core/renderer_opengl/gl_shader_util.h" 10#include "video_core/renderer_opengl/gl_shader_util.h"
10#include "video_core/renderer_opengl/gl_state.h" 11#include "video_core/renderer_opengl/gl_state.h"
11 12
13MICROPROFILE_DEFINE(OpenGL_ResourceCreation, "OpenGL", "Resource Creation",
14 MP_RGB(128, 128, 192));
15MICROPROFILE_DEFINE(OpenGL_ResourceDeletion, "OpenGL", "Resource Deletion",
16 MP_RGB(128, 128, 192));
17
12namespace OpenGL { 18namespace OpenGL {
13 19
14void OGLTexture::Create() { 20void OGLTexture::Create() {
15 if (handle != 0) 21 if (handle != 0)
16 return; 22 return;
23
24 MICROPROFILE_SCOPE(OpenGL_ResourceCreation);
17 glGenTextures(1, &handle); 25 glGenTextures(1, &handle);
18} 26}
19 27
20void OGLTexture::Release() { 28void OGLTexture::Release() {
21 if (handle == 0) 29 if (handle == 0)
22 return; 30 return;
31
32 MICROPROFILE_SCOPE(OpenGL_ResourceDeletion);
23 glDeleteTextures(1, &handle); 33 glDeleteTextures(1, &handle);
24 OpenGLState::GetCurState().UnbindTexture(handle).Apply(); 34 OpenGLState::GetCurState().UnbindTexture(handle).Apply();
25 handle = 0; 35 handle = 0;
@@ -28,12 +38,16 @@ void OGLTexture::Release() {
28void OGLSampler::Create() { 38void OGLSampler::Create() {
29 if (handle != 0) 39 if (handle != 0)
30 return; 40 return;
41
42 MICROPROFILE_SCOPE(OpenGL_ResourceCreation);
31 glGenSamplers(1, &handle); 43 glGenSamplers(1, &handle);
32} 44}
33 45
34void OGLSampler::Release() { 46void OGLSampler::Release() {
35 if (handle == 0) 47 if (handle == 0)
36 return; 48 return;
49
50 MICROPROFILE_SCOPE(OpenGL_ResourceDeletion);
37 glDeleteSamplers(1, &handle); 51 glDeleteSamplers(1, &handle);
38 OpenGLState::GetCurState().ResetSampler(handle).Apply(); 52 OpenGLState::GetCurState().ResetSampler(handle).Apply();
39 handle = 0; 53 handle = 0;
@@ -44,12 +58,16 @@ void OGLShader::Create(const char* source, GLenum type) {
44 return; 58 return;
45 if (source == nullptr) 59 if (source == nullptr)
46 return; 60 return;
61
62 MICROPROFILE_SCOPE(OpenGL_ResourceCreation);
47 handle = GLShader::LoadShader(source, type); 63 handle = GLShader::LoadShader(source, type);
48} 64}
49 65
50void OGLShader::Release() { 66void OGLShader::Release() {
51 if (handle == 0) 67 if (handle == 0)
52 return; 68 return;
69
70 MICROPROFILE_SCOPE(OpenGL_ResourceDeletion);
53 glDeleteShader(handle); 71 glDeleteShader(handle);
54 handle = 0; 72 handle = 0;
55} 73}
@@ -63,12 +81,16 @@ void OGLProgram::CreateFromSource(const char* vert_shader, const char* geo_shade
63 geo.Create(geo_shader, GL_GEOMETRY_SHADER); 81 geo.Create(geo_shader, GL_GEOMETRY_SHADER);
64 if (frag_shader) 82 if (frag_shader)
65 frag.Create(frag_shader, GL_FRAGMENT_SHADER); 83 frag.Create(frag_shader, GL_FRAGMENT_SHADER);
84
85 MICROPROFILE_SCOPE(OpenGL_ResourceCreation);
66 Create(separable_program, vert.handle, geo.handle, frag.handle); 86 Create(separable_program, vert.handle, geo.handle, frag.handle);
67} 87}
68 88
69void OGLProgram::Release() { 89void OGLProgram::Release() {
70 if (handle == 0) 90 if (handle == 0)
71 return; 91 return;
92
93 MICROPROFILE_SCOPE(OpenGL_ResourceDeletion);
72 glDeleteProgram(handle); 94 glDeleteProgram(handle);
73 OpenGLState::GetCurState().ResetProgram(handle).Apply(); 95 OpenGLState::GetCurState().ResetProgram(handle).Apply();
74 handle = 0; 96 handle = 0;
@@ -77,12 +99,16 @@ void OGLProgram::Release() {
77void OGLPipeline::Create() { 99void OGLPipeline::Create() {
78 if (handle != 0) 100 if (handle != 0)
79 return; 101 return;
102
103 MICROPROFILE_SCOPE(OpenGL_ResourceCreation);
80 glGenProgramPipelines(1, &handle); 104 glGenProgramPipelines(1, &handle);
81} 105}
82 106
83void OGLPipeline::Release() { 107void OGLPipeline::Release() {
84 if (handle == 0) 108 if (handle == 0)
85 return; 109 return;
110
111 MICROPROFILE_SCOPE(OpenGL_ResourceDeletion);
86 glDeleteProgramPipelines(1, &handle); 112 glDeleteProgramPipelines(1, &handle);
87 OpenGLState::GetCurState().ResetPipeline(handle).Apply(); 113 OpenGLState::GetCurState().ResetPipeline(handle).Apply();
88 handle = 0; 114 handle = 0;
@@ -91,12 +117,16 @@ void OGLPipeline::Release() {
91void OGLBuffer::Create() { 117void OGLBuffer::Create() {
92 if (handle != 0) 118 if (handle != 0)
93 return; 119 return;
120
121 MICROPROFILE_SCOPE(OpenGL_ResourceCreation);
94 glGenBuffers(1, &handle); 122 glGenBuffers(1, &handle);
95} 123}
96 124
97void OGLBuffer::Release() { 125void OGLBuffer::Release() {
98 if (handle == 0) 126 if (handle == 0)
99 return; 127 return;
128
129 MICROPROFILE_SCOPE(OpenGL_ResourceDeletion);
100 glDeleteBuffers(1, &handle); 130 glDeleteBuffers(1, &handle);
101 OpenGLState::GetCurState().ResetBuffer(handle).Apply(); 131 OpenGLState::GetCurState().ResetBuffer(handle).Apply();
102 handle = 0; 132 handle = 0;
@@ -105,12 +135,16 @@ void OGLBuffer::Release() {
105void OGLSync::Create() { 135void OGLSync::Create() {
106 if (handle != 0) 136 if (handle != 0)
107 return; 137 return;
138
139 // Don't profile here, this one is expected to happen ingame.
108 handle = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); 140 handle = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
109} 141}
110 142
111void OGLSync::Release() { 143void OGLSync::Release() {
112 if (handle == 0) 144 if (handle == 0)
113 return; 145 return;
146
147 // Don't profile here, this one is expected to happen ingame.
114 glDeleteSync(handle); 148 glDeleteSync(handle);
115 handle = 0; 149 handle = 0;
116} 150}
@@ -118,12 +152,16 @@ void OGLSync::Release() {
118void OGLVertexArray::Create() { 152void OGLVertexArray::Create() {
119 if (handle != 0) 153 if (handle != 0)
120 return; 154 return;
155
156 MICROPROFILE_SCOPE(OpenGL_ResourceCreation);
121 glGenVertexArrays(1, &handle); 157 glGenVertexArrays(1, &handle);
122} 158}
123 159
124void OGLVertexArray::Release() { 160void OGLVertexArray::Release() {
125 if (handle == 0) 161 if (handle == 0)
126 return; 162 return;
163
164 MICROPROFILE_SCOPE(OpenGL_ResourceDeletion);
127 glDeleteVertexArrays(1, &handle); 165 glDeleteVertexArrays(1, &handle);
128 OpenGLState::GetCurState().ResetVertexArray(handle).Apply(); 166 OpenGLState::GetCurState().ResetVertexArray(handle).Apply();
129 handle = 0; 167 handle = 0;
@@ -132,12 +170,16 @@ void OGLVertexArray::Release() {
132void OGLFramebuffer::Create() { 170void OGLFramebuffer::Create() {
133 if (handle != 0) 171 if (handle != 0)
134 return; 172 return;
173
174 MICROPROFILE_SCOPE(OpenGL_ResourceCreation);
135 glGenFramebuffers(1, &handle); 175 glGenFramebuffers(1, &handle);
136} 176}
137 177
138void OGLFramebuffer::Release() { 178void OGLFramebuffer::Release() {
139 if (handle == 0) 179 if (handle == 0)
140 return; 180 return;
181
182 MICROPROFILE_SCOPE(OpenGL_ResourceDeletion);
141 glDeleteFramebuffers(1, &handle); 183 glDeleteFramebuffers(1, &handle);
142 OpenGLState::GetCurState().ResetFramebuffer(handle).Apply(); 184 OpenGLState::GetCurState().ResetFramebuffer(handle).Apply();
143 handle = 0; 185 handle = 0;
diff --git a/src/video_core/renderer_opengl/gl_stream_buffer.cpp b/src/video_core/renderer_opengl/gl_stream_buffer.cpp
index e409228cc..b97b895a4 100644
--- a/src/video_core/renderer_opengl/gl_stream_buffer.cpp
+++ b/src/video_core/renderer_opengl/gl_stream_buffer.cpp
@@ -6,9 +6,13 @@
6#include <vector> 6#include <vector>
7#include "common/alignment.h" 7#include "common/alignment.h"
8#include "common/assert.h" 8#include "common/assert.h"
9#include "common/microprofile.h"
9#include "video_core/renderer_opengl/gl_state.h" 10#include "video_core/renderer_opengl/gl_state.h"
10#include "video_core/renderer_opengl/gl_stream_buffer.h" 11#include "video_core/renderer_opengl/gl_stream_buffer.h"
11 12
13MICROPROFILE_DEFINE(OpenGL_StreamBuffer, "OpenGL", "Stream Buffer Orphaning",
14 MP_RGB(128, 128, 192));
15
12namespace OpenGL { 16namespace OpenGL {
13 17
14OGLStreamBuffer::OGLStreamBuffer(GLenum target, GLsizeiptr size, bool prefer_coherent) 18OGLStreamBuffer::OGLStreamBuffer(GLenum target, GLsizeiptr size, bool prefer_coherent)
@@ -75,6 +79,7 @@ std::tuple<u8*, GLintptr, bool> OGLStreamBuffer::Map(GLsizeiptr size, GLintptr a
75 } 79 }
76 80
77 if (invalidate || !persistent) { 81 if (invalidate || !persistent) {
82 MICROPROFILE_SCOPE(OpenGL_StreamBuffer);
78 GLbitfield flags = GL_MAP_WRITE_BIT | (persistent ? GL_MAP_PERSISTENT_BIT : 0) | 83 GLbitfield flags = GL_MAP_WRITE_BIT | (persistent ? GL_MAP_PERSISTENT_BIT : 0) |
79 (coherent ? GL_MAP_COHERENT_BIT : GL_MAP_FLUSH_EXPLICIT_BIT) | 84 (coherent ? GL_MAP_COHERENT_BIT : GL_MAP_FLUSH_EXPLICIT_BIT) |
80 (invalidate ? GL_MAP_INVALIDATE_BUFFER_BIT : GL_MAP_UNSYNCHRONIZED_BIT); 85 (invalidate ? GL_MAP_INVALIDATE_BUFFER_BIT : GL_MAP_UNSYNCHRONIZED_BIT);