View Issue Details

IDProjectCategoryView StatusLast Update
0004621The Dark ModCodingpublic20.09.2017 03:20
Reporternbohr1more Assigned Tonbohr1more  
PriorityurgentSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionSVN 
Target VersionTDM 2.06Fixed in VersionTDM 2.06 
Summary0004621: Lightgem does not initialize when installing a new mission or via vid_restart.
DescriptionSomewhere during the TDM 2.06 development cycle, the Lightgem developed a bug where it gets stuck at full-bright when you install a new mission. Performing a vid_restart does not cure it so it seems that it's not being initialized during vid_restart \ reloadengine.
Steps To Reproduce1) Start TDM
2) Play an installed mission
3) Exit mission
4) Install new mission
5) Note that the Lightgem is now stuck at fullbright
6) vid_restart in the console
7) Note that the Lightgem is still stuck at fullbright
8) Exit TDM
9) Start TDM
10) Play the installed mission
11) Lightgem now renders as expected
Additional Informationhttp://forums.thedarkmod.com/topic/18999-im-working-on-a-vr-version-early-alpha/page-10#entry411844
TagsNo tags attached.

Relationships

related to 0004395 resolvedduzenko Lightgem Pixel Pack Buffer Optimization 
related to 0004408 resolvedduzenko Find a way to run game tics on a background thread 

Activities

grayman

grayman

18.09.2017 13:38

viewer   ~0009288

Why am I monitoring this? Do I need to do something?
nbohr1more

nbohr1more

18.09.2017 13:42

developer   ~0009289

I'm just putting this out on alert as it's critical to 2.06.
All hands on deck, etc.

I'll remove you as a monitor.
nbohr1more

nbohr1more

18.09.2017 14:10

developer   ~0009290

Last edited: 18.09.2017 14:16

I believe it was this commit:

https://github.com/fholger/thedarkmod/commit/9159212ca808763d14e4b9677e48f0d58b24272e

but I'll have to retest old builds to be sure.

The fragility here is probably stemming from the fact that the PBO "initialization" is in Rendersystem rather than Rendersystem_init.

Another relevant commit. Where the lightgem render order was moved:

https://github.com/fholger/thedarkmodvr/commit/ae25e4d567fe2e4f97d6425d57d3c2ee166dc61e

nbohr1more

nbohr1more

18.09.2017 21:13

developer   ~0009293

Looks like we want it here:

===============
idRenderSystemLocal::Clear
===============
*/
void idRenderSystemLocal::Clear( void ) {
    registered = false;
    frameCount = 0;
    viewCount = 0;
    staticAllocCount = 0;
    frameShaderTime = 0.0f;
    viewportOffset[0] = 0;
    viewportOffset[1] = 0;
    tiledViewport[0] = 0;
    tiledViewport[1] = 0;
    ambientLightVector.Zero();
    sortOffset = 0;
    worlds.Clear();
    primaryWorld = NULL;
    memset( &primaryRenderView, 0, sizeof( primaryRenderView ) );
    primaryView = NULL;
    defaultMaterial = NULL;
    testImage = NULL;
    ambientCubeImage = NULL;
    viewDef = NULL;
    memset( &pc, 0, sizeof( pc ) );
    memset( &lockSurfacesCmd, 0, sizeof( lockSurfacesCmd ) );
    memset( &identitySpace, 0, sizeof( identitySpace ) );
    logFile = NULL;
    stencilIncr = 0;
    stencilDecr = 0;
    memset( renderCrops, 0, sizeof( renderCrops ) );
    currentRenderCrop = 0;
    guiRecursionLevel = 0;
    guiModel = NULL;
    demoGuiModel = NULL;
    memset( gammaTable, 0, sizeof( gammaTable ) );
    takingScreenshot = false;
}

/*
===============
idRenderSystemLocal::Init
===============
*/
void idRenderSystemLocal::Init( void ) {

    // clear all our internal state
    viewCount = 1; // so cleared structures never match viewCount
    // we used to memset tr, but now that it is a class, we can't, so
    // there may be other state we need to reset

    ambientLightVector[0] = 0.5f;
    ambientLightVector[1] = 0.5f - 0.385f;
    ambientLightVector[2] = 0.8925f;
    ambientLightVector[3] = 1.0f;

    memset( &backEnd, 0, sizeof( backEnd ) );

    R_InitCvars();

    R_InitCommands();

    guiModel = new idGuiModel;
    guiModel->Clear();

    demoGuiModel = new idGuiModel;
    demoGuiModel->Clear();

    R_InitTriSurfData();

    globalImages->Init();

    idCinematic::InitCinematic( );

    // build brightness translation tables
    R_SetColorMappings();

    R_InitMaterials();

    renderModelManager->Init();

    // set the identity space
    identitySpace.modelMatrix[0*4+0] = 1.0f;
    identitySpace.modelMatrix[1*4+1] = 1.0f;
    identitySpace.modelMatrix[2*4+2] = 1.0f;

    // determine which back end we will use
    // FIXME : ??? this is invalid here as there is not enough information to set it up correctly
    //SetBackEndRenderer();
}
nbohr1more

nbohr1more

18.09.2017 21:19

developer   ~0009294

Maybe get shutdown too:

===============
idRenderSystemLocal::Shutdown
===============
*/
void idRenderSystemLocal::Shutdown( void ) {
    common->Printf( "idRenderSystem::Shutdown()\n" );

    R_DoneFreeType( );

    if ( glConfig.isInitialized ) {
        globalImages->PurgeAllImages();
    }

    renderModelManager->Shutdown();

    idCinematic::ShutdownCinematic( );

    globalImages->Shutdown();

    // close the r_logFile
    if ( logFile ) {
        fprintf( logFile, "*** CLOSING LOG ***\n" );
        fclose( logFile );
        logFile = 0;
    }

    // free frame memory
    R_ShutdownFrameData();

    // free the vertex cache, which should have nothing allocated now
    vertexCache.Shutdown();

    R_ShutdownTriSurfData();

    RB_ShutdownDebugTools();

    delete guiModel;
    delete demoGuiModel;

    Clear();

    ShutdownOpenGL();
}
greebo

greebo

19.09.2017 07:08

administrator   ~0009296

Don't do that, please. Just putting everyone on the monitor list and have them receive emails out of nowhere is sort of rude.

Whoever did that commit should fix it, I definitely don't bother. I've had my share of doing other people's homework when I was actively working on TDM.
nbohr1more

nbohr1more

19.09.2017 13:11

developer   ~0009297

Last edited: 19.09.2017 13:12

Understood.

I'll try fiddling with this tonight.

Last night SVN wouldn't compile due to an uncommitted local file in "someone's" repo...

I'm not the best with coding standards\practices (etc) so I was hoping for some veteran to chime in.

I know orbweaver used to speak on this topic quite extensively.

duzenko

duzenko

19.09.2017 15:22

developer   ~0009300

What about vid_restart without mission change?
It works for me. I did not try the mission change though.
nbohr1more

nbohr1more

19.09.2017 15:36

developer   ~0009301

I was trying to use vid_restart as a workaround.
In those cases it wouldn't cure the problem.
I will test it in the scenario where the Lightgem works.
nbohr1more

nbohr1more

20.09.2017 02:27

developer   ~0009309

Invoking vid_restart (after mission load on a fresh executable start with an installed mission) breaks the lightgem too.

Even with safe defaults:

com_smp 0
com_fixedTic 0
nbohr1more

nbohr1more

20.09.2017 03:19

developer   ~0009310

Rev 7156
Binaries 14936

Issue History

Date Modified Username Field Change
18.09.2017 13:31 nbohr1more New Issue
18.09.2017 13:31 nbohr1more Status new => assigned
18.09.2017 13:31 nbohr1more Assigned To => duzenko
18.09.2017 13:32 nbohr1more Relationship added related to 0004395
18.09.2017 13:38 nbohr1more Relationship added related to 0004408
18.09.2017 13:38 grayman Note Added: 0009288
18.09.2017 13:42 nbohr1more Note Added: 0009289
18.09.2017 14:10 nbohr1more Note Added: 0009290
18.09.2017 14:16 nbohr1more Note Edited: 0009290
18.09.2017 21:13 nbohr1more Note Added: 0009293
18.09.2017 21:19 nbohr1more Note Added: 0009294
19.09.2017 07:08 greebo Note Added: 0009296
19.09.2017 13:11 nbohr1more Note Added: 0009297
19.09.2017 13:12 nbohr1more Note Edited: 0009297
19.09.2017 15:22 duzenko Note Added: 0009300
19.09.2017 15:36 nbohr1more Note Added: 0009301
20.09.2017 02:27 nbohr1more Note Added: 0009309
20.09.2017 03:19 nbohr1more Note Added: 0009310
20.09.2017 03:20 nbohr1more Assigned To duzenko => nbohr1more
20.09.2017 03:20 nbohr1more Status assigned => resolved
20.09.2017 03:20 nbohr1more Resolution open => fixed
20.09.2017 03:20 nbohr1more Fixed in Version => TDM 2.06