Skip to content

Commit d87f06a

Browse files
DolceTriadeillwieckz
authored andcommitted
glsl_restart: Stop segfaulting
Using git bisect, e497a08 introduces a window where globalUBOProxy can be null after glsl_restart. Therefore, also return early, if glboalUBOProxy is null. It will be instantiated later. Further, only initialize world shaders *AFTER* all shader storage has been initialized.
1 parent ef2ae9e commit d87f06a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/engine/renderer/tr_backend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2830,7 +2830,7 @@ static void RB_RenderPostProcess()
28302830

28312831
static void SetFrameUniforms() {
28322832
// This can happen with glsl_restart/vid_restart in R_SyncRenderThread()
2833-
if ( !stagingBuffer.Active() ) {
2833+
if ( !stagingBuffer.Active() || globalUBOProxy == nullptr ) {
28342834
return;
28352835
}
28362836

src/engine/renderer/tr_shade.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,6 @@ static void GLSL_InitGPUShadersOrError()
256256
gl_depthReductionShader->MarkProgramForBuilding();
257257
}
258258

259-
if ( tr.world ) // this only happens with /glsl_restart
260-
{
261-
GLSL_InitWorldShaders();
262-
}
263-
264259
if ( glConfig.realtimeLighting )
265260
{
266261
gl_shaderManager.LoadShader( gl_depthtile1Shader );
@@ -384,6 +379,12 @@ static void GLSL_InitGPUShadersOrError()
384379
gl_shaderManager.PostProcessGlobalUniforms();
385380
gl_shaderManager.InitShaders();
386381

382+
// Init world shaders last so that everyhthing is already initialized.
383+
if ( tr.world ) // this only happens with /glsl_restart
384+
{
385+
GLSL_InitWorldShaders();
386+
}
387+
387388
if ( r_lazyShaders.Get() == 0 )
388389
{
389390
gl_shaderManager.BuildAll( false );

0 commit comments

Comments
 (0)