mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 14:52:45 +01:00
Merge pull request #11751 from Kelebek1/transition_msaa_image
Transition MSAA images to general layout without uploading data
This commit is contained in:
commit
7b2ac196d2
4 changed files with 33 additions and 0 deletions
|
@ -118,6 +118,8 @@ public:
|
||||||
|
|
||||||
void InsertUploadMemoryBarrier();
|
void InsertUploadMemoryBarrier();
|
||||||
|
|
||||||
|
void TransitionImageLayout(Image& image) {}
|
||||||
|
|
||||||
FormatProperties FormatInfo(VideoCommon::ImageType type, GLenum internal_format) const;
|
FormatProperties FormatInfo(VideoCommon::ImageType type, GLenum internal_format) const;
|
||||||
|
|
||||||
bool HasNativeBgr() const noexcept {
|
bool HasNativeBgr() const noexcept {
|
||||||
|
|
|
@ -2013,4 +2013,32 @@ void TextureCacheRuntime::AccelerateImageUpload(
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextureCacheRuntime::TransitionImageLayout(Image& image) {
|
||||||
|
if (!image.ExchangeInitialization()) {
|
||||||
|
VkImageMemoryBarrier barrier{
|
||||||
|
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
|
||||||
|
.pNext = nullptr,
|
||||||
|
.srcAccessMask = VK_ACCESS_NONE,
|
||||||
|
.dstAccessMask = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT,
|
||||||
|
.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED,
|
||||||
|
.newLayout = VK_IMAGE_LAYOUT_GENERAL,
|
||||||
|
.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
||||||
|
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
|
||||||
|
.image = image.Handle(),
|
||||||
|
.subresourceRange{
|
||||||
|
.aspectMask = image.AspectMask(),
|
||||||
|
.baseMipLevel = 0,
|
||||||
|
.levelCount = VK_REMAINING_MIP_LEVELS,
|
||||||
|
.baseArrayLayer = 0,
|
||||||
|
.layerCount = VK_REMAINING_ARRAY_LAYERS,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
scheduler.RequestOutsideRenderPassOperationContext();
|
||||||
|
scheduler.Record([barrier = barrier](vk::CommandBuffer cmdbuf) {
|
||||||
|
cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
|
||||||
|
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, 0, barrier);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Vulkan
|
} // namespace Vulkan
|
||||||
|
|
|
@ -92,6 +92,8 @@ public:
|
||||||
|
|
||||||
void InsertUploadMemoryBarrier() {}
|
void InsertUploadMemoryBarrier() {}
|
||||||
|
|
||||||
|
void TransitionImageLayout(Image& image);
|
||||||
|
|
||||||
bool HasBrokenTextureViewFormats() const noexcept {
|
bool HasBrokenTextureViewFormats() const noexcept {
|
||||||
// No known Vulkan driver has broken image views
|
// No known Vulkan driver has broken image views
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1016,6 +1016,7 @@ void TextureCache<P>::RefreshContents(Image& image, ImageId image_id) {
|
||||||
|
|
||||||
if (image.info.num_samples > 1 && !runtime.CanUploadMSAA()) {
|
if (image.info.num_samples > 1 && !runtime.CanUploadMSAA()) {
|
||||||
LOG_WARNING(HW_GPU, "MSAA image uploads are not implemented");
|
LOG_WARNING(HW_GPU, "MSAA image uploads are not implemented");
|
||||||
|
runtime.TransitionImageLayout(image);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (True(image.flags & ImageFlagBits::AsynchronousDecode)) {
|
if (True(image.flags & ImageFlagBits::AsynchronousDecode)) {
|
||||||
|
|
Loading…
Reference in a new issue