Skip to content

Commit 5753a7d

Browse files
committed
gl_shader: make possible to never compile a shader, do it for “proxy”
1 parent ac7b48e commit 5753a7d

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/engine/renderer/gl_shader.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,10 @@ bool GLShaderManager::BuildPermutation( GLShader* shader, int index, const bool
10651065
return false;
10661066
}
10671067

1068+
if ( shader->SkipCompilation() ) {
1069+
return false;
1070+
}
1071+
10681072
if ( IsUnusedPermutation( compileMacros.c_str() ) ) {
10691073
return false;
10701074
}
@@ -3013,7 +3017,7 @@ GlobalUBOProxy::GlobalUBOProxy() :
30133017
/* HACK: A GLShader* is required to initialise uniforms,
30143018
but we don't need the GLSL shader itself, so we won't actually build it */
30153019
GLShader( "proxy", 0,
3016-
false, "screenSpace", "generic", true ),
3020+
false, "screenSpace", "generic", true, true ),
30173021
// CONST
30183022
u_ColorMap3D( this ),
30193023
u_DepthMap( this ),

src/engine/renderer/gl_shader.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ class GLShader {
188188

189189
const bool worldShader;
190190
const bool pushSkip;
191+
const bool compileSkip;
191192
protected:
192193
int _activeMacros = 0;
193194
int _deformIndex = 0;
@@ -212,7 +213,7 @@ class GLShader {
212213
GLShader( const std::string& name, uint32_t vertexAttribsRequired,
213214
const bool useMaterialSystem,
214215
const std::string newVertexShaderName, const std::string newFragmentShaderName,
215-
const bool newPushSkip = false ) :
216+
const bool newPushSkip = false, const bool compileSkip = false ) :
216217
_name( name ),
217218
_vertexAttribsRequired( vertexAttribsRequired ),
218219
_useMaterialSystem( useMaterialSystem ),
@@ -222,7 +223,8 @@ class GLShader {
222223
hasFragmentShader( true ),
223224
hasComputeShader( false ),
224225
worldShader( false ),
225-
pushSkip( newPushSkip ) {
226+
pushSkip( newPushSkip ),
227+
compileSkip( compileSkip ) {
226228
}
227229

228230
GLShader( const std::string& name,
@@ -236,7 +238,8 @@ class GLShader {
236238
hasFragmentShader( false ),
237239
hasComputeShader( true ),
238240
worldShader( newWorldShader ),
239-
pushSkip( false ) {
241+
pushSkip( false ),
242+
compileSkip( false ) {
240243
}
241244

242245
public:
@@ -268,6 +271,10 @@ class GLShader {
268271
return currentProgram;
269272
}
270273

274+
bool SkipCompilation() const {
275+
return compileSkip;
276+
}
277+
271278
protected:
272279
void PostProcessUniforms();
273280
uint32_t GetUniqueCompileMacros( size_t permutation, const int type ) const;

0 commit comments

Comments
 (0)