From df97021f55b873c6e7c251277e72c2c8fd9e6d9f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 1 May 2020 05:54:47 -0400 Subject: [PATCH] gl_rasterizer: Make use of std::string_view in IsVendorAmd() Same behavior, no heap allocation. strings returned from glGetString() are guaranteed to be static strings, so this is safe to do. They're also guaranteed to be null-terminated. --- src/video_core/renderer_opengl/gl_rasterizer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index d6200c4d0..44ca9d4b1 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -40,7 +40,7 @@ MICROPROFILE_DEFINE(OpenGL_Blits, "OpenGL", "Blits", MP_RGB(100, 100, 255)); MICROPROFILE_DEFINE(OpenGL_CacheManagement, "OpenGL", "Cache Mgmt", MP_RGB(100, 255, 100)); static bool IsVendorAmd() { - std::string gpu_vendor{reinterpret_cast(glGetString(GL_VENDOR))}; + const std::string_view gpu_vendor{reinterpret_cast(glGetString(GL_VENDOR))}; return gpu_vendor == "ATI Technologies Inc." || gpu_vendor == "Advanced Micro Devices, Inc."; }