Skip to content
Permalink
Browse files

Fix if you change from normal to normalfast render mode, then move to…

… inside a block with fog of some sort like lava/water, then resize the game window, and you are using Direct3D9, your game crashes. (Thanks fam0r)

So for the 87th time, I have permanently fixed the issue of leaking GFX resources for good.
  • Loading branch information
UnknownShadow200 committed Jan 9, 2020
1 parent d38f3a6 commit 4fed6a6c7aab9626ddd24f1540c432fcb4e60cc9
Showing with 6 additions and 6 deletions.
  1. +6 −6 src/EnvRenderer.c
@@ -185,8 +185,8 @@ static void UpdateClouds(void) {
int extent;
int x1, z1, x2, z2;

if (!World.Blocks || Gfx.LostContext) return;
Gfx_DeleteVb(&clouds_vb);
if (!World.Blocks || Gfx.LostContext) return;
if (EnvRenderer_Minimal) return;

extent = Utils_AdjViewDist(Game_ViewDistance);
@@ -263,8 +263,8 @@ static void UpdateSky(void) {
int extent, height;
int x1, z1, x2, z2;

if (!World.Blocks || Gfx.LostContext) return;
Gfx_DeleteVb(&sky_vb);
if (!World.Blocks || Gfx.LostContext) return;
if (EnvRenderer_Minimal) return;

extent = Utils_AdjViewDist(Game_ViewDistance);
@@ -346,8 +346,8 @@ static void UpdateSkybox(void) {
};
int i;

if (Gfx.LostContext) return;
Gfx_DeleteVb(&skybox_vb);
if (Gfx.LostContext) return;
if (EnvRenderer_Minimal) return;

for (i = 0; i < SKYBOX_COUNT; i++) { vertices[i].Col = Env.SkyboxCol; }
@@ -685,8 +685,8 @@ static void UpdateMapSides(void) {
VertexP3fT2fC4b* ptr;
VertexP3fT2fC4b* cur;

if (!World.Blocks || Gfx.LostContext) return;
Gfx_DeleteVb(&sides_vb);
if (!World.Blocks || Gfx.LostContext) return;
block = Env.SidesBlock;

if (Blocks.Draw[block] == DRAW_GAS) return;
@@ -744,8 +744,8 @@ static void UpdateMapEdges(void) {
VertexP3fT2fC4b* ptr;
VertexP3fT2fC4b* cur;

if (!World.Blocks || Gfx.LostContext) return;
Gfx_DeleteVb(&edges_vb);
if (!World.Blocks || Gfx.LostContext) return;
block = Env.EdgeBlock;

if (Blocks.Draw[block] == DRAW_GAS) return;
@@ -798,14 +798,14 @@ static void OnContextLost(void* obj) {
}

static void UpdateAll(void) {
DeleteVbs();
UpdateMapSides();
UpdateMapEdges();
UpdateClouds();
UpdateSky();
UpdateSkybox();
EnvRenderer_UpdateFog();

Gfx_DeleteDynamicVb(&weather_vb);
if (Gfx.LostContext) return;
/* TODO: Don't allocate unless used? */
weather_vb = Gfx_CreateDynamicVb(VERTEX_FORMAT_P3FT2FC4B, WEATHER_VERTS_COUNT);

0 comments on commit 4fed6a6

Please sign in to comment.
You can’t perform that action at this time.