ShaderGen: Add UseGLSLInterfaceBlocks()

This commit is contained in:
Stenzek 2025-07-09 21:14:51 +10:00
parent f273dcff18
commit 601173b01e
No known key found for this signature in database
2 changed files with 17 additions and 4 deletions

View File

@ -32,11 +32,14 @@ ShaderGen::ShaderGen(RenderAPI render_api, GPUShaderLanguage shader_language, bo
{ {
m_glsl_version = GetGLSLVersion(render_api); m_glsl_version = GetGLSLVersion(render_api);
m_glsl_version_string = GetGLSLVersionString(m_render_api, m_glsl_version); m_glsl_version_string = GetGLSLVersionString(m_render_api, m_glsl_version);
m_use_glsl_interface_blocks = UseGLSLInterfaceBlocks();
m_use_glsl_binding_layout = UseGLSLBindingLayout();
}
else
{
m_use_glsl_interface_blocks = (shader_language == GPUShaderLanguage::GLSLVK);
m_use_glsl_binding_layout = (shader_language == GPUShaderLanguage::GLSLVK);
} }
m_use_glsl_interface_blocks =
(shader_language == GPUShaderLanguage::GLSLVK || GLAD_GL_ES_VERSION_3_2 || GLAD_GL_VERSION_3_2);
m_use_glsl_binding_layout = (shader_language == GPUShaderLanguage::GLSLVK || UseGLSLBindingLayout());
#ifdef _WIN32 #ifdef _WIN32
if (m_shader_language == GPUShaderLanguage::GLSL) if (m_shader_language == GPUShaderLanguage::GLSL)
@ -80,6 +83,15 @@ GPUShaderLanguage ShaderGen::GetShaderLanguageForAPI(RenderAPI api)
} }
} }
bool ShaderGen::UseGLSLInterfaceBlocks()
{
#ifdef ENABLE_OPENGL
return (GLAD_GL_ES_VERSION_3_2 || GLAD_GL_VERSION_3_2);
#else
return true;
#endif
}
bool ShaderGen::UseGLSLBindingLayout() bool ShaderGen::UseGLSLBindingLayout()
{ {
#ifdef ENABLE_OPENGL #ifdef ENABLE_OPENGL

View File

@ -18,6 +18,7 @@ public:
~ShaderGen(); ~ShaderGen();
static GPUShaderLanguage GetShaderLanguageForAPI(RenderAPI api); static GPUShaderLanguage GetShaderLanguageForAPI(RenderAPI api);
static bool UseGLSLInterfaceBlocks();
static bool UseGLSLBindingLayout(); static bool UseGLSLBindingLayout();
static u32 GetGLSLVersion(RenderAPI render_api); static u32 GetGLSLVersion(RenderAPI render_api);