mirror of
https://github.com/Takiiiiiiii/strato.git
synced 2025-07-17 08:46:39 +00:00
Implement Mipmapped Texture Support
Support for mipmapped textures was not implemented which is fairly crucial to proper rendering of games as the only level that would load is the first level (highest resolution), that might result in a lot more memory bandwidth being utilized. Mipmapping also has associated benefits regarding aliasing as it has a minor anti-aliasing effect on distant textures. This commit entirely implements mipmapping support but it does not extend to full support for views into specific mipmap levels due to the texture manager implemention being incomplete.
This commit is contained in:
@ -45,11 +45,12 @@ namespace skyline::gpu {
|
||||
if (firstHostMapping == hostMappings.begin() && firstHostMapping->begin() == guestMapping.begin() && mappingMatch && lastHostMapping == hostMappings.end() && lastGuestMapping.end() == std::prev(lastHostMapping)->end()) {
|
||||
// We've gotten a perfect 1:1 match for *all* mappings from the start to end, we just need to check for compatibility aside from this
|
||||
auto &matchGuestTexture{*hostMapping->texture->guest};
|
||||
if (matchGuestTexture.format->IsCompatible(*guestTexture.format) && matchGuestTexture.dimensions == guestTexture.dimensions && matchGuestTexture.tileConfig == guestTexture.tileConfig) {
|
||||
if (matchGuestTexture.format->IsCompatible(*guestTexture.format) && (matchGuestTexture.dimensions == guestTexture.dimensions || matchGuestTexture.viewMipBase > 0) && matchGuestTexture.tileConfig == guestTexture.tileConfig) {
|
||||
auto &texture{hostMapping->texture};
|
||||
return texture->GetView(static_cast<vk::ImageViewType>(guestTexture.type), vk::ImageSubresourceRange{
|
||||
.aspectMask = guestTexture.aspect,
|
||||
.levelCount = texture->mipLevels,
|
||||
.baseMipLevel = guestTexture.viewMipBase,
|
||||
.levelCount = guestTexture.viewMipCount,
|
||||
.layerCount = texture->layerCount,
|
||||
}, guestTexture.format, guestTexture.swizzle);
|
||||
}
|
||||
@ -81,7 +82,8 @@ namespace skyline::gpu {
|
||||
|
||||
return texture->GetView(static_cast<vk::ImageViewType>(guestTexture.type), vk::ImageSubresourceRange{
|
||||
.aspectMask = guestTexture.aspect,
|
||||
.levelCount = texture->mipLevels,
|
||||
.baseMipLevel = guestTexture.viewMipBase,
|
||||
.levelCount = guestTexture.viewMipCount,
|
||||
.layerCount = texture->layerCount,
|
||||
}, guestTexture.format, guestTexture.swizzle);
|
||||
}
|
||||
|
Reference in New Issue
Block a user