gl_rasterizer: Use std::string_view instead of std::string when checking for extensions
We can avoid heap allocations here by just using a std::string_view instead of performing unnecessary copying of the string data.
This commit is contained in:
parent
b5eb3905cd
commit
16139ed53b
|
@ -5,6 +5,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
|
@ -54,7 +55,8 @@ RasterizerOpenGL::RasterizerOpenGL() {
|
||||||
GLint ext_num;
|
GLint ext_num;
|
||||||
glGetIntegerv(GL_NUM_EXTENSIONS, &ext_num);
|
glGetIntegerv(GL_NUM_EXTENSIONS, &ext_num);
|
||||||
for (GLint i = 0; i < ext_num; i++) {
|
for (GLint i = 0; i < ext_num; i++) {
|
||||||
std::string extension{reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, i))};
|
const std::string_view extension{
|
||||||
|
reinterpret_cast<const char*>(glGetStringi(GL_EXTENSIONS, i))};
|
||||||
|
|
||||||
if (extension == "GL_ARB_buffer_storage") {
|
if (extension == "GL_ARB_buffer_storage") {
|
||||||
has_ARB_buffer_storage = true;
|
has_ARB_buffer_storage = true;
|
||||||
|
|
Loading…
Reference in New Issue