Skip to content

Commit ed8da40

Browse files
committed
Don't create lightGrid2 image if deluxe disabled
Don't create the light grid direction image if deluxe mapping is disabled.
1 parent a18dee7 commit ed8da40

1 file changed

Lines changed: 21 additions & 10 deletions

File tree

src/engine/renderer/tr_bsp.cpp

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3411,7 +3411,11 @@ static void R_SetConstantColorLightGrid( const byte color[3] )
34113411
imageParams.wrapType = wrapTypeEnum_t::WT_EDGE_CLAMP;
34123412

34133413
tr.lightGrid1Image = R_Create3DImage("<lightGrid1>", (const byte *)w->lightGridData1, w->lightGridBounds[ 0 ], w->lightGridBounds[ 1 ], w->lightGridBounds[ 2 ], imageParams );
3414-
tr.lightGrid2Image = R_Create3DImage("<lightGrid2>", (const byte *)w->lightGridData2, w->lightGridBounds[ 0 ], w->lightGridBounds[ 1 ], w->lightGridBounds[ 2 ], imageParams );
3414+
3415+
if ( glConfig.deluxeMapping )
3416+
{
3417+
tr.lightGrid2Image = R_Create3DImage("<lightGrid2>", (const byte *)w->lightGridData2, w->lightGridBounds[ 0 ], w->lightGridBounds[ 1 ], w->lightGridBounds[ 2 ], imageParams );
3418+
}
34153419
}
34163420

34173421
/*
@@ -3656,7 +3660,11 @@ void R_LoadLightGrid( lump_t *l )
36563660
imageParams.wrapType = wrapTypeEnum_t::WT_EDGE_CLAMP;
36573661

36583662
tr.lightGrid1Image = R_Create3DImage("<lightGrid1>", (const byte *)w->lightGridData1, w->lightGridBounds[ 0 ], w->lightGridBounds[ 1 ], w->lightGridBounds[ 2 ], imageParams );
3659-
tr.lightGrid2Image = R_Create3DImage("<lightGrid2>", (const byte *)w->lightGridData2, w->lightGridBounds[ 0 ], w->lightGridBounds[ 1 ], w->lightGridBounds[ 2 ], imageParams );
3663+
3664+
if ( glConfig.deluxeMapping )
3665+
{
3666+
tr.lightGrid2Image = R_Create3DImage("<lightGrid2>", (const byte *)w->lightGridData2, w->lightGridBounds[ 0 ], w->lightGridBounds[ 1 ], w->lightGridBounds[ 2 ], imageParams );
3667+
}
36603668

36613669
Log::Debug("%i light grid points created", w->numLightGridPoints );
36623670
}
@@ -4617,14 +4625,13 @@ static void SetWorldLight() {
46174625
tr.modelLight = lightMode_t::GRID;
46184626
}
46194627

4620-
if ( glConfig.deluxeMapping ) {
4621-
// Enable deluxe mapping emulation if light direction grid is there.
4622-
if ( tr.lightGrid2Image ) {
4623-
// Game model surfaces use grid lighting, they don't have vertex light colors.
4624-
tr.modelDeluxe = deluxeMode_t::GRID;
4628+
// Enable deluxe mapping emulation if light direction grid is there.
4629+
if ( tr.lightGrid2Image ) {
4630+
ASSERT( glConfig.deluxeMapping );
4631+
// Game model surfaces use grid lighting, they don't have vertex light colors.
4632+
tr.modelDeluxe = deluxeMode_t::GRID;
46254633

4626-
// Only game models use emulated deluxe map from light direction grid.
4627-
}
4634+
// Only game models use emulated deluxe map from light direction grid.
46284635
}
46294636
}
46304637

@@ -4677,7 +4684,11 @@ static void SetConstUniforms() {
46774684
}
46784685

46794686
globalUBOProxy->SetUniform_LightGrid1Bindless( GL_BindToTMU( BIND_LIGHTGRID1, tr.lightGrid1Image ) );
4680-
globalUBOProxy->SetUniform_LightGrid2Bindless( GL_BindToTMU( BIND_LIGHTGRID2, tr.lightGrid2Image ) );
4687+
4688+
if ( tr.lightGrid2Image )
4689+
{
4690+
globalUBOProxy->SetUniform_LightGrid2Bindless( GL_BindToTMU( BIND_LIGHTGRID2, tr.lightGrid2Image ) );
4691+
}
46814692
}
46824693

46834694
if ( glConfig.usingMaterialSystem ) {

0 commit comments

Comments
 (0)