Skip to content

Commit

Permalink
Voodoo: Implement trilinear filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
Vort authored and stlintel committed Jan 2, 2025
1 parent e7f2a4a commit 6b47aaf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
15 changes: 13 additions & 2 deletions bochs/iodev/display/voodoo_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -2810,6 +2810,7 @@ while (0)
#define TEXTURE_PIPELINE(TT, XX, DITHER4, TEXMODE, COTHER, LOOKUP, LODBASE, ITERS, ITERT, ITERW, RESULT) \
do \
{ \
bool trilinear_reverse; \
Bit32s blendr, blendg, blendb, blenda; \
Bit32s tr, tg, tb, ta; \
Bit32s s, t, lod, ilod; \
Expand Down Expand Up @@ -2853,6 +2854,16 @@ do
lod += DITHER4[(XX) & 3] << 4; \
if (lod < (TT)->lodmin) \
lod = (TT)->lodmin; \
\
if (TEXMODE_TRILINEAR(TEXMODE)) \
{ \
trilinear_reverse = lod & 0x100; \
if (trilinear_reverse != TEXLOD_LOD_ODD((TT)->reg[tLOD].u)) \
lod += 0x100; \
} \
else \
trilinear_reverse = false; \
\
if (lod > (TT)->lodmax) \
lod = (TT)->lodmax; \
\
Expand Down Expand Up @@ -3094,15 +3105,15 @@ do
} \
\
/* reverse the RGB blend */ \
if (!TEXMODE_TC_REVERSE_BLEND(TEXMODE)) \
if (trilinear_reverse != !TEXMODE_TC_REVERSE_BLEND(TEXMODE)) \
{ \
blendr ^= 0xff; \
blendg ^= 0xff; \
blendb ^= 0xff; \
} \
\
/* reverse the alpha blend */ \
if (!TEXMODE_TCA_REVERSE_BLEND(TEXMODE)) \
if (trilinear_reverse != !TEXMODE_TCA_REVERSE_BLEND(TEXMODE)) \
blenda ^= 0xff; \
\
/* do the blend */ \
Expand Down
5 changes: 0 additions & 5 deletions bochs/iodev/display/voodoo_func.h
Original file line number Diff line number Diff line change
Expand Up @@ -1786,7 +1786,6 @@ void register_w(Bit32u offset, Bit32u data, bool log)
Bit32u regnum = (offset) & 0xff;
Bit32u chips = (offset>>8) & 0xf;
Bit64s data64;
static Bit32u count = 0;

if (chips == 0)
chips = 0xf;
Expand Down Expand Up @@ -2199,10 +2198,6 @@ void register_w(Bit32u offset, Bit32u data, bool log)

/* texture modifications cause us to recompute everything */
case textureMode:
if (((chips & 6) > 0) && TEXMODE_TRILINEAR(data)) {
if (count < 50) BX_INFO(("Trilinear textures not implemented yet"));
count++;
}
case tLOD:
case tDetail:
case texBaseAddr:
Expand Down

0 comments on commit 6b47aaf

Please sign in to comment.