mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-12-10 05:38:49 +00:00
show title splash while the game is loading
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/config.h"
|
||||
#include "common/singleton.h"
|
||||
#include "core/file_format/splash.h"
|
||||
#include "core/libraries/system/systemservice.h"
|
||||
#include "sdl_window.h"
|
||||
#include "video_core/renderer_vulkan/renderer_vulkan.h"
|
||||
|
||||
@@ -157,10 +160,38 @@ void RendererVulkan::RecreateFrame(Frame* frame, u32 width, u32 height) {
|
||||
frame->height = height;
|
||||
}
|
||||
|
||||
bool RendererVulkan::ShowSplash(Frame* frame /*= nullptr*/) {
|
||||
if (!Libraries::SystemService::IsSplashVisible()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!frame) {
|
||||
const auto* splash = Common::Singleton<Splash>::Instance();
|
||||
|
||||
VideoCore::ImageInfo info{};
|
||||
info.pixel_format = vk::Format::eR8G8B8A8Srgb;
|
||||
info.type = vk::ImageType::e2D;
|
||||
info.size =
|
||||
VideoCore::Extent3D{splash->GetImageInfo().width, splash->GetImageInfo().height, 1};
|
||||
info.pitch = splash->GetImageInfo().width * 4;
|
||||
info.guest_size_bytes = splash->GetImageData().size();
|
||||
auto& image = texture_cache.FindImage(info, VAddr(splash->GetImageData().data()));
|
||||
|
||||
frame = PrepareFrameInternal(image);
|
||||
}
|
||||
Present(frame);
|
||||
return true;
|
||||
}
|
||||
|
||||
Frame* RendererVulkan::PrepareFrame(const Libraries::VideoOut::BufferAttributeGroup& attribute,
|
||||
VAddr cpu_address) {
|
||||
// Request presentation image from the texture cache.
|
||||
auto& image = texture_cache.FindDisplayBuffer(attribute, cpu_address);
|
||||
const auto info = VideoCore::ImageInfo{attribute};
|
||||
auto& image = texture_cache.FindImage(info, cpu_address);
|
||||
return PrepareFrameInternal(image);
|
||||
}
|
||||
|
||||
Frame* RendererVulkan::PrepareFrameInternal(VideoCore::Image& image) {
|
||||
|
||||
// Request a free presentation frame.
|
||||
Frame* frame = GetRenderFrame();
|
||||
|
||||
@@ -34,10 +34,12 @@ public:
|
||||
Frame* PrepareFrame(const Libraries::VideoOut::BufferAttributeGroup& attribute,
|
||||
VAddr cpu_address);
|
||||
|
||||
bool ShowSplash(Frame* frame = nullptr);
|
||||
void Present(Frame* frame);
|
||||
void RecreateFrame(Frame* frame, u32 width, u32 height);
|
||||
|
||||
private:
|
||||
Frame* PrepareFrameInternal(VideoCore::Image& image);
|
||||
Frame* GetRenderFrame();
|
||||
|
||||
private:
|
||||
|
||||
@@ -101,20 +101,19 @@ void TextureCache::OnCpuWrite(VAddr address) {
|
||||
});
|
||||
}
|
||||
|
||||
Image& TextureCache::FindDisplayBuffer(const Libraries::VideoOut::BufferAttributeGroup& group,
|
||||
VAddr cpu_address) {
|
||||
Image& TextureCache::FindImage(const ImageInfo& info, VAddr cpu_address) {
|
||||
boost::container::small_vector<ImageId, 2> image_ids;
|
||||
ForEachImageInRegion(cpu_address, group.size_in_bytes, [&](ImageId image_id, Image& image) {
|
||||
ForEachImageInRegion(cpu_address, info.guest_size_bytes, [&](ImageId image_id, Image& image) {
|
||||
if (image.cpu_addr == cpu_address) {
|
||||
image_ids.push_back(image_id);
|
||||
}
|
||||
});
|
||||
|
||||
ASSERT_MSG(image_ids.size() <= 1, "Overlapping framebuffers not allowed!");
|
||||
ASSERT_MSG(image_ids.size() <= 1, "Overlapping images not allowed!");
|
||||
|
||||
ImageId image_id{};
|
||||
if (image_ids.empty()) {
|
||||
image_id = slot_images.insert(instance, scheduler, ImageInfo{group}, cpu_address);
|
||||
image_id = slot_images.insert(instance, scheduler, info, cpu_address);
|
||||
RegisterImage(image_id);
|
||||
} else {
|
||||
image_id = image_ids[0];
|
||||
|
||||
@@ -33,8 +33,7 @@ public:
|
||||
void OnCpuWrite(VAddr address);
|
||||
|
||||
/// Retrieves the image handle of the image with the provided attributes and address.
|
||||
Image& FindDisplayBuffer(const Libraries::VideoOut::BufferAttributeGroup& attribute,
|
||||
VAddr cpu_address);
|
||||
Image& FindImage(const ImageInfo& info, VAddr cpu_address);
|
||||
|
||||
private:
|
||||
/// Iterate over all page indices in a range
|
||||
|
||||
Reference in New Issue
Block a user