From 3db5f64b5ed98414899bc71d52030ae8a2cabff7 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 12 Dec 2024 18:09:17 +0100 Subject: [PATCH] Revert "kill "Use po2 patches to fix mipmaps "" This reverts commit 6b904b10f514641776156bce426dbc5532b085e4. --- src/hardware/hw_cache.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index a6ca20101..16b6b3735 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -172,13 +172,13 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap, palette = HWR_GetTexturePalette(); - ncols = (pwidth * pblockwidth) / pwidth; + ncols = pwidth; // source advance xfrac = 0; - xfracstep = (pwidth << FRACBITS) / pblockwidth; - yfracstep = (pheight << FRACBITS) / pblockheight; - scale_y = (pblockheight << FRACBITS) / pheight; + xfracstep = FRACUNIT; + yfracstep = FRACUNIT; + scale_y = FRACUNIT; bpp = format2bpp(mipmap->format); @@ -418,14 +418,19 @@ void HWR_MakePatch (patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, bo glPatch->leftoffset = SHORT(patch->leftoffset); glPatch->topoffset = SHORT(patch->topoffset); - glMipmap->width = (UINT16)SHORT(patch->width); - glMipmap->height = (UINT16)SHORT(patch->height); + glMipmap->width = glMipmap->height = 1; + while (glMipmap->width < glPatch->width) glMipmap->width <<= 1; + while (glMipmap->height < glPatch->height) glMipmap->height <<= 1; // no wrap around, no chroma key glMipmap->flags = 0; // setup the texture info glMipmap->format = patchformat; + + //glPatch->max_s = glPatch->max_t = 1.0f; + glPatch->max_s = (float)glPatch->width / (float)glMipmap->width; + glPatch->max_t = (float)glPatch->height / (float)glMipmap->height; } Z_Free(glMipmap->data); @@ -436,12 +441,10 @@ void HWR_MakePatch (patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, bo MakeBlock(glMipmap); HWR_DrawPatchInCache(glMipmap, - glPatch->width, glPatch->height, + glMipmap->width, glMipmap->height, glPatch->width, glPatch->height, patch); } - - glPatch->max_s = glPatch->max_t = 1.0f; } // =================================================