Skip to content

Commit

Permalink
Fix crash in GenerateWorldMaterials()
Browse files Browse the repository at this point in the history
If the cgame sends some 2D rendering commands in the first frame before
calling RenderScene as described in
Unvanquished/Unvanquished#3305, it could cause
a crash. Fix this by not setting generatingWorldCommandBuffer
prematurely while those commands are executing.
  • Loading branch information
slipher committed Jan 27, 2025
1 parent 96bd021 commit e6a66e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/engine/renderer/Material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,8 @@ void MaterialSystem::ProcessStage( drawSurf_t* drawSurf, shaderStage_t* pStage,
* A material represents a distinct global OpenGL state (e. g. blend function, depth test, depth write etc.)
* Materials can have a dependency on other materials to make sure that consecutive stages are rendered in the proper order */
void MaterialSystem::GenerateWorldMaterials() {
R_SyncRenderThread();

const int current_r_nocull = r_nocull->integer;
const int current_r_drawworld = r_drawworld->integer;
r_nocull->integer = 1;
Expand All @@ -1494,8 +1496,6 @@ void MaterialSystem::GenerateWorldMaterials() {

Log::Debug( "Generating world materials" );

R_SyncRenderThread();

++tr.viewCountNoReset;
R_AddWorldSurfaces();

Expand Down

0 comments on commit e6a66e6

Please sign in to comment.