Merge pull request #10422 from OatmealDome/opengl-shader-crash

VideoConfig: Add flag for whether the system supports setting object names
This commit is contained in:
JMC47
2022-01-31 01:25:46 -05:00
committed by GitHub
12 changed files with 28 additions and 9 deletions

View File

@ -583,6 +583,7 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
g_ogl_config.bSupports3DTextureStorageMultisample = true;
g_Config.backend_info.bSupportsBitfield = true;
g_Config.backend_info.bSupportsDynamicSamplerIndexing = true;
g_Config.backend_info.bSupportsSettingObjectNames = true;
}
}
else
@ -628,6 +629,7 @@ Renderer::Renderer(std::unique_ptr<GLContext> main_gl_context, float backbuffer_
g_ogl_config.bSupportsTextureStorage = true;
g_ogl_config.bSupportsImageLoadStore = true;
g_Config.backend_info.bSupportsSSAA = true;
g_Config.backend_info.bSupportsSettingObjectNames = true;
// Compute shaders are core in GL4.3.
g_Config.backend_info.bSupportsComputeShaders = true;

View File

@ -5,6 +5,8 @@
#include "VideoBackends/OGL/ProgramShaderCache.h"
#include "VideoCommon/VideoConfig.h"
namespace OGL
{
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),
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());
}
@ -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_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());
}

View File

@ -9,6 +9,8 @@
#include "VideoBackends/OGL/SamplerCache.h"
#include "VideoCommon/VideoConfig.h"
namespace OGL
{
namespace
@ -116,7 +118,7 @@ OGLTexture::OGLTexture(const TextureConfig& tex_config, std::string_view name)
glActiveTexture(GL_MUTABLE_TEXTURE_INDEX);
glBindTexture(target, m_texId);
if (!m_name.empty())
if (!m_name.empty() && g_ActiveConfig.backend_info.bSupportsSettingObjectNames)
{
glObjectLabel(GL_TEXTURE, m_texId, -1, m_name.c_str());
}