diff --git a/src/r_plane.cpp b/src/r_plane.cpp index 1792b78f5..93bc197e1 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -663,10 +663,12 @@ static void R_MakeSpans(void (*mapfunc)(drawspandata_t* ds, void(*spanfunc)(draw // static void R_DrawSkyPlane(visplane_t *pl, void(*colfunc)(drawcolumndata_t*), boolean allow_parallel) { + ZoneScoped; + INT32 x; drawcolumndata_t dc {0}; + const INT32 texture = texturetranslation[skytexture]; - ZoneScoped; if (mapnamespace == MNS_SRB2KART && !newview->sky) { @@ -696,17 +698,13 @@ static void R_DrawSkyPlane(visplane_t *pl, void(*colfunc)(drawcolumndata_t*), bo } dc.lightmap = colormaps; dc.texturemid = skytexturemid; - dc.texheight = textureheight[skytexture] - >>FRACBITS; + dc.texheight = textureheight[texture] >>FRACBITS; dc.sourcelength = dc.texheight; x = pl->minx; // Precache the texture so we don't corrupt the zoned heap off-main thread - if (!texturecache[texturetranslation[skytexture]]) - { - R_GenerateTexture(texturetranslation[skytexture]); - } + R_CheckTextureCache(texture); while (x <= pl->maxx) { @@ -731,8 +729,7 @@ static void R_DrawSkyPlane(visplane_t *pl, void(*colfunc)(drawcolumndata_t*), bo dc.iscale = FixedMul(skyscale[viewssnum], FINECOSINE(xtoviewangle[viewssnum][x + i]>>ANGLETOFINESHIFT)); dc.x = x + i; dc.source = - R_GetColumn(texturetranslation[skytexture], - -angle); // get negative of angle for each column to display sky correct way round! --Monster Iestyn 27/01/18 + R_GetColumn(texture, -angle); // get negative of angle for each column to display sky correct way round! --Monster Iestyn 27/01/18 dc.brightmap = NULL; colfunc(&dc); diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 7f0b03204..7d770d0dd 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -1353,6 +1353,13 @@ static void R_RenderSegLoop (drawcolumndata_t* dc) INT32 bottom; INT32 i; + if (midtexture) + R_CheckTextureCache(midtexture); + if (toptexture) + R_CheckTextureCache(toptexture); + if (bottomtexture) + R_CheckTextureCache(bottomtexture); + for (; rw_x < rw_stopx; rw_x++) { // mark floor / ceiling areas diff --git a/src/r_textures.c b/src/r_textures.c index d0150955f..a3bcf3973 100644 --- a/src/r_textures.c +++ b/src/r_textures.c @@ -937,9 +937,6 @@ static inline INT32 wrap_column(fixed_t tex, INT32 col) // UINT8 *R_GetColumn(fixed_t tex, INT32 col) { - if (!texturecache[tex]) - R_GenerateTexture(tex); - return texturecache[tex] + LONG(texturecolumnofs[tex][wrap_column(tex, col)]); }