Add function to check if any guest texture mappings are unmapped

This commit is contained in:
Billy Laws 2022-09-29 21:22:13 +01:00
parent 98cb94ca6c
commit 849184452c
3 changed files with 14 additions and 2 deletions

View File

@ -145,7 +145,10 @@ namespace skyline::gpu::interconnect::maxwell3d {
auto mappings{ctx.channelCtx.asCtx->gmmu.TranslateRange(target.offset, guest.GetSize())};
guest.mappings.assign(mappings.begin(), mappings.end());
view = ctx.executor.AcquireTextureManager().FindOrCreate(guest, ctx.executor.tag);
if (guest.MappingsValid())
view = ctx.executor.AcquireTextureManager().FindOrCreate(guest, ctx.executor.tag);
else
view = {};
}
/* Depth Render Target */
@ -209,7 +212,10 @@ namespace skyline::gpu::interconnect::maxwell3d {
auto mappings{ctx.channelCtx.asCtx->gmmu.TranslateRange(engine->ztOffset, guest.GetSize())};
guest.mappings.assign(mappings.begin(), mappings.end());
view = ctx.executor.AcquireTextureManager().FindOrCreate(guest, ctx.executor.tag);
if (guest.MappingsValid())
view = ctx.executor.AcquireTextureManager().FindOrCreate(guest, ctx.executor.tag);
else
view = {};
}
/* Pipeline Stages */

View File

@ -66,6 +66,10 @@ namespace skyline::gpu {
return GetLayerStride() * (layerCount - baseArrayLayer);
}
bool GuestTexture::MappingsValid() const {
return ranges::all_of(mappings, [](const auto &mapping) { return mapping.valid(); });
}
TextureView::TextureView(std::shared_ptr<Texture> texture, vk::ImageViewType type, vk::ImageSubresourceRange range, texture::Format format, vk::ComponentMapping mapping) : texture(std::move(texture)), type(type), format(format), mapping(mapping), range(range) {}
Texture::TextureViewStorage::TextureViewStorage(vk::ImageViewType type, texture::Format format, vk::ComponentMapping mapping, vk::ImageSubresourceRange range, vk::raii::ImageView &&vkView) : type(type), format(format), mapping(mapping), range(range), vkView(std::move(vkView)) {}

View File

@ -285,6 +285,8 @@ namespace skyline::gpu {
u32 GetViewDepth() const;
size_t GetSize();
bool MappingsValid() const;
};
class TextureManager;