Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mipmapping doesnt work in doom 2 or later chapter 2 of doom #51

Open
Cavencruiser opened this issue Jun 29, 2024 · 4 comments
Open

Mipmapping doesnt work in doom 2 or later chapter 2 of doom #51

Cavencruiser opened this issue Jun 29, 2024 · 4 comments

Comments

@Cavencruiser
Copy link

Doom2 mipmapping doesnt work, only with a few select textures which are shared from doom 1. None of the doom2 exclusive textures seem to mip mapped. Everything from mid chapter 2 of doom and beyond doesnt work with mipmapping either.

@doomhack
Copy link
Owner

The 'mipmapping' is a performance hack for composite textures (I.e textures that are made of multiple patches) and only where the patches overlap. (Eg a decal drawn over a base texture)

For composite textures we store the column pixels in a 16kb cache. The mipmapping helps improve the hit rate on this cache.

Textures that are made up of one patch (or don't overlap) are drawn directly from ROM and so they are drawn at full horizontal resolution as there is no performance benefit to mipmapping them.

I'm guessing the Doom2 textures didn't use multipatches too much.

@FrenkelS
Copy link

Is that the reason for (c >> 1) in CACHE_HASH?

@doomhack
Copy link
Owner

Yes, that is part of it. We drop the low bit of the texture column when we compute the cache key. (Columns are stored in an associative cache)

The actual 'mipmapping' is done in R_ComposeColumn with the colmask. We drop low bits of the column number as it gets further away from the player by looking at the iscale var.

There is an exception for very narrow textures <= 8px so that stuff like the key colour door texture doesn't get destroyed.

@Cavencruiser
Copy link
Author

Cavencruiser commented Jul 3, 2024

does the multipatch textures benefit from the use of mipmaps? aren't they also drawn directly from rom too? I'm asking because I decided to remove the check to disable the mipmaps in high detail mode and I seemed to gain 2fps in large rooms that use giant multi patched textures for walls from doing this. Can you please check my work on my fork and verify if I properly did this? Are there other lines of code that also need to be voided or is the only check for high resolution textures in the whole source? I'm new to coding, so I dont know if what I did to the source directly negatively impacted the optimization as a result. Much appreciated if you have the time to check.

https://github.com/Cavencruiser/GBADoom-kippy-retail-gba-controls-merge-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants