diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 5 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_cache.cpp | 5 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/utils.cpp | 38 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/utils.h | 15 | ||||
| -rw-r--r-- | src/video_core/utils.h | 26 |
6 files changed, 61 insertions, 30 deletions
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 09ecc5bad..c5f7128ec 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt | |||
| @@ -51,6 +51,8 @@ add_library(video_core STATIC | |||
| 51 | renderer_opengl/maxwell_to_gl.h | 51 | renderer_opengl/maxwell_to_gl.h |
| 52 | renderer_opengl/renderer_opengl.cpp | 52 | renderer_opengl/renderer_opengl.cpp |
| 53 | renderer_opengl/renderer_opengl.h | 53 | renderer_opengl/renderer_opengl.h |
| 54 | renderer_opengl/utils.cpp | ||
| 55 | renderer_opengl/utils.h | ||
| 54 | textures/astc.cpp | 56 | textures/astc.cpp |
| 55 | textures/astc.h | 57 | textures/astc.h |
| 56 | textures/decoders.cpp | 58 | textures/decoders.cpp |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index c3cf33eed..30c2803f5 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include "core/settings.h" | 16 | #include "core/settings.h" |
| 17 | #include "video_core/engines/maxwell_3d.h" | 17 | #include "video_core/engines/maxwell_3d.h" |
| 18 | #include "video_core/renderer_opengl/gl_rasterizer_cache.h" | 18 | #include "video_core/renderer_opengl/gl_rasterizer_cache.h" |
| 19 | #include "video_core/renderer_opengl/utils.h" | ||
| 19 | #include "video_core/textures/astc.h" | 20 | #include "video_core/textures/astc.h" |
| 20 | #include "video_core/textures/decoders.h" | 21 | #include "video_core/textures/decoders.h" |
| 21 | #include "video_core/utils.h" | 22 | #include "video_core/utils.h" |
| @@ -865,8 +866,8 @@ CachedSurface::CachedSurface(const SurfaceParams& params) | |||
| 865 | glTexParameteri(SurfaceTargetToGL(params.target), GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 866 | glTexParameteri(SurfaceTargetToGL(params.target), GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 866 | glTexParameteri(SurfaceTargetToGL(params.target), GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 867 | glTexParameteri(SurfaceTargetToGL(params.target), GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 867 | 868 | ||
| 868 | VideoCore::LabelGLObject(GL_TEXTURE, texture.handle, params.addr, | 869 | LabelGLObject(GL_TEXTURE, texture.handle, params.addr, |
| 869 | SurfaceParams::SurfaceTargetName(params.target)); | 870 | SurfaceParams::SurfaceTargetName(params.target)); |
| 870 | 871 | ||
| 871 | // Clamp size to mapped GPU memory region | 872 | // Clamp size to mapped GPU memory region |
| 872 | // TODO(bunnei): Super Mario Odyssey maps a 0x40000 byte region and then uses it for a 0x80000 | 873 | // TODO(bunnei): Super Mario Odyssey maps a 0x40000 byte region and then uses it for a 0x80000 |
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp index 1a03a677f..9522fd344 100644 --- a/src/video_core/renderer_opengl/gl_shader_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include "video_core/engines/maxwell_3d.h" | 8 | #include "video_core/engines/maxwell_3d.h" |
| 9 | #include "video_core/renderer_opengl/gl_shader_cache.h" | 9 | #include "video_core/renderer_opengl/gl_shader_cache.h" |
| 10 | #include "video_core/renderer_opengl/gl_shader_manager.h" | 10 | #include "video_core/renderer_opengl/gl_shader_manager.h" |
| 11 | #include "video_core/renderer_opengl/utils.h" | ||
| 11 | #include "video_core/utils.h" | 12 | #include "video_core/utils.h" |
| 12 | 13 | ||
| 13 | namespace OpenGL { | 14 | namespace OpenGL { |
| @@ -89,7 +90,7 @@ CachedShader::CachedShader(VAddr addr, Maxwell::ShaderProgram program_type) | |||
| 89 | shader.Create(program_result.first.c_str(), gl_type); | 90 | shader.Create(program_result.first.c_str(), gl_type); |
| 90 | program.Create(true, shader.handle); | 91 | program.Create(true, shader.handle); |
| 91 | SetShaderUniformBlockBindings(program.handle); | 92 | SetShaderUniformBlockBindings(program.handle); |
| 92 | VideoCore::LabelGLObject(GL_PROGRAM, program.handle, addr); | 93 | LabelGLObject(GL_PROGRAM, program.handle, addr); |
| 93 | } else { | 94 | } else { |
| 94 | // Store shader's code to lazily build it on draw | 95 | // Store shader's code to lazily build it on draw |
| 95 | geometry_programs.code = program_result.first; | 96 | geometry_programs.code = program_result.first; |
| @@ -130,7 +131,7 @@ GLuint CachedShader::LazyGeometryProgram(OGLProgram& target_program, | |||
| 130 | shader.Create(source.c_str(), GL_GEOMETRY_SHADER); | 131 | shader.Create(source.c_str(), GL_GEOMETRY_SHADER); |
| 131 | target_program.Create(true, shader.handle); | 132 | target_program.Create(true, shader.handle); |
| 132 | SetShaderUniformBlockBindings(target_program.handle); | 133 | SetShaderUniformBlockBindings(target_program.handle); |
| 133 | VideoCore::LabelGLObject(GL_PROGRAM, target_program.handle, addr, debug_name); | 134 | LabelGLObject(GL_PROGRAM, target_program.handle, addr, debug_name); |
| 134 | return target_program.handle; | 135 | return target_program.handle; |
| 135 | }; | 136 | }; |
| 136 | 137 | ||
diff --git a/src/video_core/renderer_opengl/utils.cpp b/src/video_core/renderer_opengl/utils.cpp new file mode 100644 index 000000000..d84634cb3 --- /dev/null +++ b/src/video_core/renderer_opengl/utils.cpp | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <string> | ||
| 6 | #include <fmt/format.h> | ||
| 7 | #include <glad/glad.h> | ||
| 8 | #include "common/common_types.h" | ||
| 9 | #include "video_core/renderer_opengl/utils.h" | ||
| 10 | |||
| 11 | namespace OpenGL { | ||
| 12 | |||
| 13 | void LabelGLObject(GLenum identifier, GLuint handle, VAddr addr, std::string extra_info) { | ||
| 14 | if (!GLAD_GL_KHR_debug) { | ||
| 15 | return; // We don't need to throw an error as this is just for debugging | ||
| 16 | } | ||
| 17 | const std::string nice_addr = fmt::format("0x{:016x}", addr); | ||
| 18 | std::string object_label; | ||
| 19 | |||
| 20 | if (extra_info.empty()) { | ||
| 21 | switch (identifier) { | ||
| 22 | case GL_TEXTURE: | ||
| 23 | object_label = "Texture@" + nice_addr; | ||
| 24 | break; | ||
| 25 | case GL_PROGRAM: | ||
| 26 | object_label = "Shader@" + nice_addr; | ||
| 27 | break; | ||
| 28 | default: | ||
| 29 | object_label = fmt::format("Object(0x{:x})@{}", identifier, nice_addr); | ||
| 30 | break; | ||
| 31 | } | ||
| 32 | } else { | ||
| 33 | object_label = extra_info + '@' + nice_addr; | ||
| 34 | } | ||
| 35 | glObjectLabel(identifier, handle, -1, static_cast<const GLchar*>(object_label.c_str())); | ||
| 36 | } | ||
| 37 | |||
| 38 | } // namespace OpenGL \ No newline at end of file | ||
diff --git a/src/video_core/renderer_opengl/utils.h b/src/video_core/renderer_opengl/utils.h new file mode 100644 index 000000000..1fcb6fc11 --- /dev/null +++ b/src/video_core/renderer_opengl/utils.h | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <string> | ||
| 8 | #include <glad/glad.h> | ||
| 9 | #include "common/common_types.h" | ||
| 10 | |||
| 11 | namespace OpenGL { | ||
| 12 | |||
| 13 | void LabelGLObject(GLenum identifier, GLuint handle, VAddr addr, std::string extra_info = ""); | ||
| 14 | |||
| 15 | } // namespace OpenGL \ No newline at end of file | ||
diff --git a/src/video_core/utils.h b/src/video_core/utils.h index 237cc1307..e0a14d48f 100644 --- a/src/video_core/utils.h +++ b/src/video_core/utils.h | |||
| @@ -161,30 +161,4 @@ static inline void MortonCopyPixels128(u32 width, u32 height, u32 bytes_per_pixe | |||
| 161 | } | 161 | } |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | static void LabelGLObject(GLenum identifier, GLuint handle, VAddr addr, | ||
| 165 | std::string extra_info = "") { | ||
| 166 | if (!GLAD_GL_KHR_debug) { | ||
| 167 | return; // We don't need to throw an error as this is just for debugging | ||
| 168 | } | ||
| 169 | const std::string nice_addr = fmt::format("0x{:016x}", addr); | ||
| 170 | std::string object_label; | ||
| 171 | |||
| 172 | if (extra_info.empty()) { | ||
| 173 | switch (identifier) { | ||
| 174 | case GL_TEXTURE: | ||
| 175 | object_label = "Texture@" + nice_addr; | ||
| 176 | break; | ||
| 177 | case GL_PROGRAM: | ||
| 178 | object_label = "Shader@" + nice_addr; | ||
| 179 | break; | ||
| 180 | default: | ||
| 181 | object_label = fmt::format("Object(0x{:x})@{}", identifier, nice_addr); | ||
| 182 | break; | ||
| 183 | } | ||
| 184 | } else { | ||
| 185 | object_label = extra_info + '@' + nice_addr; | ||
| 186 | } | ||
| 187 | glObjectLabel(identifier, handle, -1, static_cast<const GLchar*>(object_label.c_str())); | ||
| 188 | } | ||
| 189 | |||
| 190 | } // namespace VideoCore | 164 | } // namespace VideoCore |