]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Reset r_shadow_occlusion_buf on vid_restart. Fixes query buffer dangling pointer
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 19 May 2020 18:52:55 +0000 (18:52 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 19 May 2020 18:52:55 +0000 (18:52 +0000)
Basically, when coronas appear when r_coronas_occlusionquery is 1, the engine
binds to a query buffer and stores a pointer to it in r_shadow_occlusion_buf.
Upon vid_restart, somewhere along the way, the buffer is cleared but the
original pointer is kept, resulting in a crash next time a corona appears.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12541 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index 2897c78f8e43f7997cc1c5627c4539c50ba25c2a..5d5f29c41e21acc50929eaeb21b574e06558ad55 100644 (file)
@@ -3085,6 +3085,8 @@ static void gl_main_start(void)
 #endif
 }
 
+extern unsigned int r_shadow_occlusion_buf;
+
 static void gl_main_shutdown(void)
 {
        R_RenderTarget_FreeUnused(true);
@@ -3105,7 +3107,7 @@ static void gl_main_shutdown(void)
 #endif
                break;
        }
-
+       r_shadow_occlusion_buf = 0;
        r_numqueries = 0;
        r_maxqueries = 0;
        memset(r_queries, 0, sizeof(r_queries));