review comments

This commit is contained in:
psucien 2024-05-15 20:54:45 +02:00 committed by georgemoralis
parent 3d5be23671
commit 8c4f72f404
4 changed files with 19 additions and 16 deletions

View File

@ -176,8 +176,8 @@ void VideoOutDriver::Flip(std::chrono::microseconds timeout) {
requests.pop(); requests.pop();
} }
if (!renderer->ShowSplash( // Whatever the game is rendering show splash if it is active
req.frame)) { // Whatever the game is rendering show splash if it is active if (!renderer->ShowSplash(req.frame)) {
// Present the frame. // Present the frame.
renderer->Present(req.frame); renderer->Present(req.frame);
} }

View File

@ -166,18 +166,20 @@ bool RendererVulkan::ShowSplash(Frame* frame /*= nullptr*/) {
} }
if (!frame) { if (!frame) {
const auto* splash = Common::Singleton<Splash>::Instance(); if (!splash_img.has_value()) {
const auto* splash = Common::Singleton<Splash>::Instance();
VideoCore::ImageInfo info{}; VideoCore::ImageInfo info{};
info.pixel_format = vk::Format::eR8G8B8A8Srgb; info.pixel_format = vk::Format::eR8G8B8A8Srgb;
info.type = vk::ImageType::e2D; info.type = vk::ImageType::e2D;
info.size = info.size =
VideoCore::Extent3D{splash->GetImageInfo().width, splash->GetImageInfo().height, 1}; VideoCore::Extent3D{splash->GetImageInfo().width, splash->GetImageInfo().height, 1};
info.pitch = splash->GetImageInfo().width * 4; info.pitch = splash->GetImageInfo().width * 4;
info.guest_size_bytes = splash->GetImageData().size(); info.guest_size_bytes = splash->GetImageData().size();
auto& image = texture_cache.FindImage(info, VAddr(splash->GetImageData().data())); splash_img.emplace(instance, scheduler, info, VAddr(splash->GetImageData().data()));
texture_cache.RefreshImage(*splash_img);
frame = PrepareFrameInternal(image); }
frame = PrepareFrameInternal(*splash_img);
} }
Present(frame); Present(frame);
return true; return true;

View File

@ -54,6 +54,7 @@ private:
std::mutex free_mutex; std::mutex free_mutex;
std::condition_variable free_cv; std::condition_variable free_cv;
std::condition_variable_any frame_cv; std::condition_variable_any frame_cv;
std::optional<VideoCore::Image> splash_img;
}; };
} // namespace Vulkan } // namespace Vulkan

View File

@ -35,6 +35,9 @@ public:
/// Retrieves the image handle of the image with the provided attributes and address. /// Retrieves the image handle of the image with the provided attributes and address.
Image& FindImage(const ImageInfo& info, VAddr cpu_address); Image& FindImage(const ImageInfo& info, VAddr cpu_address);
/// Reuploads image contents.
void RefreshImage(Image& image);
private: private:
/// Iterate over all page indices in a range /// Iterate over all page indices in a range
template <typename Func> template <typename Func>
@ -93,9 +96,6 @@ private:
/// Create an image from the given parameters /// Create an image from the given parameters
[[nodiscard]] ImageId InsertImage(const ImageInfo& info, VAddr cpu_addr); [[nodiscard]] ImageId InsertImage(const ImageInfo& info, VAddr cpu_addr);
/// Reuploads image contents.
void RefreshImage(Image& image);
/// Register image in the page table /// Register image in the page table
void RegisterImage(ImageId image); void RegisterImage(ImageId image);