From 085efaa6050d1ebf2b164a07e3062105eaa4b86c Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 19 Dec 2023 18:57:47 +0100 Subject: [PATCH] test stuff very crude, console scream at me if those are botched most likely not the issue but whatever --- src/hardware/hw_cache.c | 17 +++++++++++++---- src/hardware/hw_draw.c | 5 +++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 8f272a297..061d3fcb7 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -702,12 +702,10 @@ static void HWR_LoadMappedPatch(GLMipmap_t *grmip, GLPatch_t *gpatch) { patch_t *patch = gpatch->rawpatch; if (!patch) - patch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC); + patch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC); HWR_MakePatch(patch, gpatch, grmip, true); // You can't free rawpatch for some reason? - // (Obviously I can't, sprite rotation needs that...) - if (!gpatch->rawpatch) Z_Free(patch); } @@ -726,7 +724,17 @@ void HWR_GetPatch(GLPatch_t *gpatch) { /*if (needpatchflush) W_FlushCachedPatches();*/ - + + if (!gpatch){ + CONS_Printf("braaaaaaaaaaap gpatch broke"); + return; + } + + if (!gpatch->mipmap){ + CONS_Printf("braaaaaaaaaaap gpatch mipmap broke"); + return; + } + // is it in hardware cache if (!gpatch->mipmap->downloaded && !gpatch->mipmap->grInfo.data) { @@ -739,6 +747,7 @@ void HWR_GetPatch(GLPatch_t *gpatch) // this is inefficient.. but the hardware patch in heap is purgeable so it should // not fragment memory, and besides the REAL cache here is the hardware memory + // You can't free rawpatch for some reason? if (!gpatch->rawpatch) Z_Free(ptr); } diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index cfb9fae2c..fde90758f 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -141,6 +141,11 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t if (alphalevel >= 10 && alphalevel < 13) return; + + if (!gpatch){ + CONS_Printf("braaaaaaaaaaap gpatch in stretchypatch broke"); + return; + } // make patch ready in hardware cache if (!colormap)