mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 01:26:50 -04:00
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.
This commit is contained in:
parent
d38f3a67b8
commit
4fed6a6c7a
@ -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,7 +798,6 @@ static void OnContextLost(void* obj) {
|
||||
}
|
||||
|
||||
static void UpdateAll(void) {
|
||||
DeleteVbs();
|
||||
UpdateMapSides();
|
||||
UpdateMapEdges();
|
||||
UpdateClouds();
|
||||
@ -806,6 +805,7 @@ static void UpdateAll(void) {
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user