diff options
| -rw-r--r-- | src/video_core/renderer_opengl/utils.cpp | 16 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/utils.h | 4 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/video_core/renderer_opengl/utils.cpp b/src/video_core/renderer_opengl/utils.cpp index 84a987371..f23fc9f9d 100644 --- a/src/video_core/renderer_opengl/utils.cpp +++ b/src/video_core/renderer_opengl/utils.cpp | |||
| @@ -38,27 +38,27 @@ void BindBuffersRangePushBuffer::Bind() const { | |||
| 38 | sizes.data()); | 38 | sizes.data()); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | void LabelGLObject(GLenum identifier, GLuint handle, VAddr addr, std::string extra_info) { | 41 | void LabelGLObject(GLenum identifier, GLuint handle, VAddr addr, std::string_view extra_info) { |
| 42 | if (!GLAD_GL_KHR_debug) { | 42 | if (!GLAD_GL_KHR_debug) { |
| 43 | return; // We don't need to throw an error as this is just for debugging | 43 | // We don't need to throw an error as this is just for debugging |
| 44 | return; | ||
| 44 | } | 45 | } |
| 45 | const std::string nice_addr = fmt::format("0x{:016x}", addr); | ||
| 46 | std::string object_label; | ||
| 47 | 46 | ||
| 47 | std::string object_label; | ||
| 48 | if (extra_info.empty()) { | 48 | if (extra_info.empty()) { |
| 49 | switch (identifier) { | 49 | switch (identifier) { |
| 50 | case GL_TEXTURE: | 50 | case GL_TEXTURE: |
| 51 | object_label = "Texture@" + nice_addr; | 51 | object_label = fmt::format("Texture@0x{:016X}", addr); |
| 52 | break; | 52 | break; |
| 53 | case GL_PROGRAM: | 53 | case GL_PROGRAM: |
| 54 | object_label = "Shader@" + nice_addr; | 54 | object_label = fmt::format("Shader@0x{:016X}", addr); |
| 55 | break; | 55 | break; |
| 56 | default: | 56 | default: |
| 57 | object_label = fmt::format("Object(0x{:x})@{}", identifier, nice_addr); | 57 | object_label = fmt::format("Object(0x{:X})@0x{:016X}", identifier, addr); |
| 58 | break; | 58 | break; |
| 59 | } | 59 | } |
| 60 | } else { | 60 | } else { |
| 61 | object_label = extra_info + '@' + nice_addr; | 61 | object_label = fmt::format("{}@0x{:016X}", extra_info, addr); |
| 62 | } | 62 | } |
| 63 | glObjectLabel(identifier, handle, -1, static_cast<const GLchar*>(object_label.c_str())); | 63 | glObjectLabel(identifier, handle, -1, static_cast<const GLchar*>(object_label.c_str())); |
| 64 | } | 64 | } |
diff --git a/src/video_core/renderer_opengl/utils.h b/src/video_core/renderer_opengl/utils.h index aef45c9dc..b3e9fc499 100644 --- a/src/video_core/renderer_opengl/utils.h +++ b/src/video_core/renderer_opengl/utils.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <string> | 7 | #include <string_view> |
| 8 | #include <vector> | 8 | #include <vector> |
| 9 | #include <glad/glad.h> | 9 | #include <glad/glad.h> |
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| @@ -30,6 +30,6 @@ private: | |||
| 30 | std::vector<GLsizeiptr> sizes; | 30 | std::vector<GLsizeiptr> sizes; |
| 31 | }; | 31 | }; |
| 32 | 32 | ||
| 33 | void LabelGLObject(GLenum identifier, GLuint handle, VAddr addr, std::string extra_info = ""); | 33 | void LabelGLObject(GLenum identifier, GLuint handle, VAddr addr, std::string_view extra_info = {}); |
| 34 | 34 | ||
| 35 | } // namespace OpenGL \ No newline at end of file | 35 | } // namespace OpenGL \ No newline at end of file |