@@ -3457,7 +3457,11 @@ static void R_SetConstantColorLightGrid( const byte color[3] )
34573457 imageParams.wrapType = wrapTypeEnum_t::WT_EDGE_CLAMP ;
34583458
34593459 tr.lightGrid1Image = R_Create3DImage (" <lightGrid1>" , (const byte *)w->lightGridData1 , w->lightGridBounds [ 0 ], w->lightGridBounds [ 1 ], w->lightGridBounds [ 2 ], imageParams );
3460- tr.lightGrid2Image = R_Create3DImage (" <lightGrid2>" , (const byte *)w->lightGridData2 , w->lightGridBounds [ 0 ], w->lightGridBounds [ 1 ], w->lightGridBounds [ 2 ], imageParams );
3460+
3461+ if ( glConfig.deluxeMapping )
3462+ {
3463+ tr.lightGrid2Image = R_Create3DImage (" <lightGrid2>" , (const byte *)w->lightGridData2 , w->lightGridBounds [ 0 ], w->lightGridBounds [ 1 ], w->lightGridBounds [ 2 ], imageParams );
3464+ }
34613465}
34623466
34633467/*
@@ -3702,7 +3706,11 @@ void R_LoadLightGrid( lump_t *l )
37023706 imageParams.wrapType = wrapTypeEnum_t::WT_EDGE_CLAMP ;
37033707
37043708 tr.lightGrid1Image = R_Create3DImage (" <lightGrid1>" , (const byte *)w->lightGridData1 , w->lightGridBounds [ 0 ], w->lightGridBounds [ 1 ], w->lightGridBounds [ 2 ], imageParams );
3705- tr.lightGrid2Image = R_Create3DImage (" <lightGrid2>" , (const byte *)w->lightGridData2 , w->lightGridBounds [ 0 ], w->lightGridBounds [ 1 ], w->lightGridBounds [ 2 ], imageParams );
3709+
3710+ if ( glConfig.deluxeMapping )
3711+ {
3712+ tr.lightGrid2Image = R_Create3DImage (" <lightGrid2>" , (const byte *)w->lightGridData2 , w->lightGridBounds [ 0 ], w->lightGridBounds [ 1 ], w->lightGridBounds [ 2 ], imageParams );
3713+ }
37063714
37073715 Log::Debug (" %i light grid points created" , w->numLightGridPoints );
37083716}
@@ -4663,14 +4671,13 @@ static void SetWorldLight() {
46634671 tr.modelLight = lightMode_t::GRID ;
46644672 }
46654673
4666- if ( glConfig. deluxeMapping ) {
4667- // Enable deluxe mapping emulation if light direction grid is there.
4668- if ( tr. lightGrid2Image ) {
4669- // Game model surfaces use grid lighting, they don't have vertex light colors.
4670- tr.modelDeluxe = deluxeMode_t::GRID ;
4674+ // Enable deluxe mapping emulation if light direction grid is there.
4675+ if ( tr. lightGrid2Image ) {
4676+ ASSERT ( glConfig. deluxeMapping );
4677+ // Game model surfaces use grid lighting, they don't have vertex light colors.
4678+ tr.modelDeluxe = deluxeMode_t::GRID ;
46714679
4672- // Only game models use emulated deluxe map from light direction grid.
4673- }
4680+ // Only game models use emulated deluxe map from light direction grid.
46744681 }
46754682 }
46764683
@@ -4723,7 +4730,11 @@ static void SetConstUniforms() {
47234730 }
47244731
47254732 globalUBOProxy->SetUniform_LightGrid1Bindless ( GL_BindToTMU ( BIND_LIGHTGRID1 , tr.lightGrid1Image ) );
4726- globalUBOProxy->SetUniform_LightGrid2Bindless ( GL_BindToTMU ( BIND_LIGHTGRID2 , tr.lightGrid2Image ) );
4733+
4734+ if ( tr.lightGrid2Image )
4735+ {
4736+ globalUBOProxy->SetUniform_LightGrid2Bindless ( GL_BindToTMU ( BIND_LIGHTGRID2 , tr.lightGrid2Image ) );
4737+ }
47274738 }
47284739
47294740 if ( glConfig.usingMaterialSystem ) {
0 commit comments