mirror of
https://github.com/Takiiiiiiii/strato.git
synced 2025-07-17 08:46:39 +00:00
Move image type logic to GuestTexture, allowing 2D array views for 3D RTs
We can't render to a 3D texture through a 3D view, we instead have to create a 2D array view into it and render to that. The texture manager previously didn't support having a different view type/layer count between a guest texture view and the underlying storage texture that is required to support this so that was also implemented by reading the view layer count from the dimensions depth instead if the underlying texture is 3D (and the view type is 2D array). Additionally move away from our own view type enum to Vulkan, inline with other guest texture member types.
This commit is contained in:
@ -45,13 +45,18 @@ 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.viewMipBase > 0) && matchGuestTexture.tileConfig == guestTexture.tileConfig) {
|
||||
if (matchGuestTexture.format->IsCompatible(*guestTexture.format) &&
|
||||
((matchGuestTexture.dimensions.width == guestTexture.dimensions.width &&
|
||||
matchGuestTexture.dimensions.height == guestTexture.dimensions.height &&
|
||||
matchGuestTexture.dimensions.depth == guestTexture.GetViewDepth())
|
||||
|| matchGuestTexture.viewMipBase > 0)
|
||||
&& matchGuestTexture.tileConfig == guestTexture.tileConfig) {
|
||||
auto &texture{hostMapping->texture};
|
||||
return texture->GetView(static_cast<vk::ImageViewType>(guestTexture.type), vk::ImageSubresourceRange{
|
||||
return texture->GetView(guestTexture.viewType, vk::ImageSubresourceRange{
|
||||
.aspectMask = guestTexture.aspect,
|
||||
.baseMipLevel = guestTexture.viewMipBase,
|
||||
.levelCount = guestTexture.viewMipCount,
|
||||
.layerCount = texture->layerCount,
|
||||
.layerCount = guestTexture.GetViewLayerCount(),
|
||||
}, guestTexture.format, guestTexture.swizzle);
|
||||
}
|
||||
} /* else if (mappingMatch) {
|
||||
@ -80,11 +85,11 @@ namespace skyline::gpu {
|
||||
textures.emplace(mapping, TextureMapping{texture, it, guestMapping});
|
||||
}
|
||||
|
||||
return texture->GetView(static_cast<vk::ImageViewType>(guestTexture.type), vk::ImageSubresourceRange{
|
||||
return texture->GetView(guestTexture.viewType, vk::ImageSubresourceRange{
|
||||
.aspectMask = guestTexture.aspect,
|
||||
.baseMipLevel = guestTexture.viewMipBase,
|
||||
.levelCount = guestTexture.viewMipCount,
|
||||
.layerCount = texture->layerCount,
|
||||
.layerCount = guestTexture.GetViewLayerCount(),
|
||||
}, guestTexture.format, guestTexture.swizzle);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user