Skip to content

Commit

Permalink
Material system: load GLSL extension needed for Intel
Browse files Browse the repository at this point in the history
Intel's driver won't compile the material system GLSL shaders without
this extension, GL_ARB_enhanced_layouts.

I haven't attemped to determine which "enhanced" syntactic construct we
depend on. Just tried it and it works.

Fixes DaemonEngine#1260.
  • Loading branch information
slipher committed Aug 27, 2024
1 parent 5c15f16 commit 814fdd9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/engine/renderer/tr_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ struct glconfig2_t
bool explicitUniformLocationAvailable;
bool shaderImageLoadStoreAvailable;
bool shaderAtomicCountersAvailable;
bool enhancedLayoutsAvailable;
bool materialSystemAvailable;
bool gpuShader4Available;
bool gpuShader5Available;
Expand Down
6 changes: 6 additions & 0 deletions src/engine/sys/sdl_glimp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ static Cvar::Cvar<bool> r_arb_debug_output( "r_arb_debug_output",
"Use GL_ARB_debug_output if available", Cvar::NONE, true );
static Cvar::Cvar<bool> r_arb_depth_clamp( "r_arb_depth_clamp",
"Use GL_ARB_depth_clamp if available", Cvar::NONE, true );
static Cvar::Cvar<bool> r_arb_enhanced_layouts( "r_arb_enhanced_layouts",
"Use GL_ARB_enhanced_layouts if available", Cvar::NONE, true );
static Cvar::Cvar<bool> r_arb_explicit_uniform_location( "r_arb_explicit_uniform_location",
"Use GL_ARB_explicit_uniform_location if available", Cvar::NONE, true );
static Cvar::Cvar<bool> r_arb_gpu_shader5( "r_arb_gpu_shader5",
Expand Down Expand Up @@ -2111,6 +2113,9 @@ static void GLimp_InitExtensions()
// made required in OpenGL 4.2
glConfig2.shaderAtomicCountersAvailable = LOAD_EXTENSION_WITH_TEST( ExtFlag_NONE, ARB_shader_atomic_counters, r_arb_shader_atomic_counters.Get() );

// made required in OpenGL 4.4
glConfig2.enhancedLayoutsAvailable = LOAD_EXTENSION_WITH_TEST( ExtFlag_NONE, ARB_enhanced_layouts, r_arb_enhanced_layouts.Get() );

// not required by any OpenGL version
glConfig2.indirectParametersAvailable = LOAD_EXTENSION_WITH_TEST( ExtFlag_NONE, ARB_indirect_parameters, r_arb_indirect_parameters.Get() );

Expand All @@ -2119,6 +2124,7 @@ static void GLimp_InitExtensions()
&& glConfig2.computeShaderAvailable && glConfig2.shadingLanguage420PackAvailable
&& glConfig2.explicitUniformLocationAvailable && glConfig2.shaderImageLoadStoreAvailable
&& glConfig2.shaderAtomicCountersAvailable && glConfig2.indirectParametersAvailable
&& glConfig2.enhancedLayoutsAvailable
&& r_materialSystem.Get(); // Allow disabling it without disabling any extensions

GL_CheckErrors();
Expand Down

0 comments on commit 814fdd9

Please sign in to comment.