OGLShader: Only set shader name if supported

This commit is contained in:
OatmealDome 2022-01-30 21:46:17 -05:00
parent 390cc13834
commit ea1ac73c38
1 changed files with 4 additions and 2 deletions

View File

@ -5,6 +5,8 @@
#include "VideoBackends/OGL/ProgramShaderCache.h" #include "VideoBackends/OGL/ProgramShaderCache.h"
#include "VideoCommon/VideoConfig.h"
namespace OGL namespace OGL
{ {
static GLenum GetGLShaderTypeForStage(ShaderStage stage) static GLenum GetGLShaderTypeForStage(ShaderStage stage)
@ -29,7 +31,7 @@ OGLShader::OGLShader(ShaderStage stage, GLenum gl_type, GLuint gl_id, std::strin
: AbstractShader(stage), m_id(ProgramShaderCache::GenerateShaderID()), m_type(gl_type), : AbstractShader(stage), m_id(ProgramShaderCache::GenerateShaderID()), m_type(gl_type),
m_gl_id(gl_id), m_source(std::move(source)), m_name(std::move(name)) m_gl_id(gl_id), m_source(std::move(source)), m_name(std::move(name))
{ {
if (!m_name.empty()) if (!m_name.empty() && g_ActiveConfig.backend_info.bSupportsSettingObjectNames)
{ {
glObjectLabel(GetGLShaderTypeForStage(stage), m_gl_id, -1, m_name.c_str()); glObjectLabel(GetGLShaderTypeForStage(stage), m_gl_id, -1, m_name.c_str());
} }
@ -40,7 +42,7 @@ OGLShader::OGLShader(GLuint gl_compute_program_id, std::string source, std::stri
m_type(GL_COMPUTE_SHADER), m_gl_compute_program_id(gl_compute_program_id), m_type(GL_COMPUTE_SHADER), m_gl_compute_program_id(gl_compute_program_id),
m_source(std::move(source)), m_name(std::move(name)) m_source(std::move(source)), m_name(std::move(name))
{ {
if (!m_name.empty()) if (!m_name.empty() && g_ActiveConfig.backend_info.bSupportsSettingObjectNames)
{ {
glObjectLabel(GL_COMPUTE_SHADER, m_gl_compute_program_id, -1, m_name.c_str()); glObjectLabel(GL_COMPUTE_SHADER, m_gl_compute_program_id, -1, m_name.c_str());
} }