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

VideoCommon: move all texture calculations to a "TextureInfo" class #9681

Merged
merged 1 commit into from May 13, 2021

Conversation

iwubcode
Copy link
Contributor

@iwubcode iwubcode commented May 1, 2021

More stuff can be moved over if desired later, I tried to stick to the basic information needed to calculate the texture id. This cleans up the code ever so slightly, the current TextureCacheBase code is hard to follow because it changes some of the parameters it passes in but not all. This centralizes the code and makes its members const, hopefully making it easier to read.

Additionally, and more importantly, texture data is currently loaded and bound in VertexManagerBase. By providing this class, the texture data can be leveraged in other areas of the code base, allowing us to provide new enhancements.

Source/Core/VideoCommon/TextureInfo.cpp Outdated Show resolved Hide resolved
Source/Core/VideoCommon/TextureInfo.cpp Outdated Show resolved Hide resolved
Source/Core/VideoCommon/TextureInfo.cpp Outdated Show resolved Hide resolved
Source/Core/VideoCommon/TextureInfo.h Show resolved Hide resolved
Source/Core/VideoCommon/TextureInfo.h Outdated Show resolved Hide resolved
Copy link
Contributor

@Pokechu22 Pokechu22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial thoughts; I haven't read through this in detail yet.

Source/Core/VideoCommon/TextureCacheBase.cpp Outdated Show resolved Hide resolved
Source/Core/VideoCommon/TextureInfo.cpp Outdated Show resolved Hide resolved
Source/Core/VideoCommon/TextureInfo.cpp Outdated Show resolved Hide resolved
TexDecoder_Decode(dst_buffer, mip_level->GetData(), mip_level->GetExpandedWidth(),
mip_level->GetExpandedHeight(), texture_info.GetTextureFormat(),
texture_info.GetTlutAddress(), texture_info.GetTlutFormat());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TexDecoder_Decode should probably take the texture_info and a mip-level. (future PR?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks phire. I think all 3 of these are great suggestions. However, yeah, I'd prefer to save this cleanup for a separate PR (maybe even separate them out, depending on how involved they are).

mip_level->GetExpandedHeight(), texture_info.GetTextureFormat(),
texture_info.GetTlutAddress(), texture_info.GetTlutFormat());
entry->texture->Load(level, mip_level->GetRawWidth(), mip_level->GetRawHeight(),
mip_level->GetExpandedWidth(), dst_buffer, decoded_mip_size);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe Load should take the texture_info instead of the three parameters here? (future PR?)

!DecodeTextureOnGPU(
entry, level, mip_level->GetData(), mip_level->GetTextureSize(),
texture_info.GetTextureFormat(), mip_level->GetRawWidth(), mip_level->GetRawHeight(),
mip_level->GetExpandedWidth(), mip_level->GetExpandedHeight(),
bytes_per_block * (mip_level->GetExpandedWidth() / texture_info.GetBlockWidth()),
texture_info.GetTlutAddress(), texture_info.GetTlutFormat()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DecodeTextureOnGPU should take a texture_info (future PR?)

Source/Core/VideoCommon/TextureInfo.h Show resolved Hide resolved
Source/Core/VideoCommon/TextureInfo.cpp Outdated Show resolved Hide resolved
Source/Core/VideoCommon/TextureInfo.cpp Outdated Show resolved Hide resolved
Source/Core/VideoCommon/TextureInfo.cpp Outdated Show resolved Hide resolved
Source/Core/VideoCommon/TextureInfo.cpp Outdated Show resolved Hide resolved
@iwubcode iwubcode marked this pull request as draft May 10, 2021 03:09
…This ever so slightly improves readability and allows for the full texture name to be generated outside of the hires texture cache
@iwubcode iwubcode marked this pull request as ready for review May 12, 2021 04:31
@lioncash lioncash merged commit d034c83 into dolphin-emu:master May 13, 2021
10 checks passed
@iwubcode iwubcode deleted the texture-info branch May 13, 2021 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants