videoout: register buffers in texture cache at VO creation time

This commit is contained in:
psucien 2024-06-15 21:18:48 +02:00
parent bdb235716a
commit e6f773f950
4 changed files with 18 additions and 18 deletions

View File

@ -134,6 +134,7 @@ int VideoOutDriver::RegisterBuffers(VideoOutPort* port, s32 startIndex, void* co
.address_right = 0, .address_right = 0,
}; };
renderer->RegisterVideoOutSurface(group, address);
LOG_INFO(Lib_VideoOut, "buffers[{}] = {:#x}", i + startIndex, address); LOG_INFO(Lib_VideoOut, "buffers[{}] = {:#x}", i + startIndex, address);
} }

View File

@ -192,19 +192,6 @@ bool RendererVulkan::ShowSplash(Frame* frame /*= nullptr*/) {
return true; return true;
} }
Frame* RendererVulkan::PrepareFrame(const Libraries::VideoOut::BufferAttributeGroup& attribute,
VAddr cpu_address) {
// Request presentation image from the texture cache.
const auto info = VideoCore::ImageInfo{attribute};
auto& image = texture_cache.FindImage(info, cpu_address);
return PrepareFrameInternal(image);
}
Frame* RendererVulkan::PrepareBlankFrame() {
auto& image = texture_cache.GetImage(VideoCore::NULL_IMAGE_ID);
return PrepareFrameInternal(image);
}
Frame* RendererVulkan::PrepareFrameInternal(VideoCore::Image& image) { Frame* RendererVulkan::PrepareFrameInternal(VideoCore::Image& image) {
// Request a free presentation frame. // Request a free presentation frame.
Frame* frame = GetRenderFrame(); Frame* frame = GetRenderFrame();

View File

@ -38,8 +38,21 @@ public:
~RendererVulkan(); ~RendererVulkan();
Frame* PrepareFrame(const Libraries::VideoOut::BufferAttributeGroup& attribute, Frame* PrepareFrame(const Libraries::VideoOut::BufferAttributeGroup& attribute,
VAddr cpu_address); VAddr cpu_address) {
Frame* PrepareBlankFrame(); auto& image = RegisterVideoOutSurface(attribute, cpu_address);
return PrepareFrameInternal(image);
}
Frame* PrepareBlankFrame() {
auto& image = texture_cache.GetImage(VideoCore::NULL_IMAGE_ID);
return PrepareFrameInternal(image);
}
VideoCore::Image& RegisterVideoOutSurface(
const Libraries::VideoOut::BufferAttributeGroup& attribute, VAddr cpu_address) {
const auto info = VideoCore::ImageInfo{attribute};
return texture_cache.FindImage(info, cpu_address);
}
bool ShowSplash(Frame* frame = nullptr); bool ShowSplash(Frame* frame = nullptr);
void Present(Frame* frame); void Present(Frame* frame);

View File

@ -22,7 +22,7 @@ static vk::Format ConvertPixelFormat(const VideoOutFormat format) {
case VideoOutFormat::A8R8G8B8Srgb: case VideoOutFormat::A8R8G8B8Srgb:
return vk::Format::eB8G8R8A8Srgb; return vk::Format::eB8G8R8A8Srgb;
case VideoOutFormat::A8B8G8R8Srgb: case VideoOutFormat::A8B8G8R8Srgb:
return vk::Format::eA8B8G8R8SrgbPack32; return vk::Format::eR8G8B8A8Srgb;
case VideoOutFormat::A2R10G10B10: case VideoOutFormat::A2R10G10B10:
case VideoOutFormat::A2R10G10B10Srgb: case VideoOutFormat::A2R10G10B10Srgb:
return vk::Format::eA2R10G10B10UnormPack32; return vk::Format::eA2R10G10B10UnormPack32;
@ -121,8 +121,7 @@ ImageInfo::ImageInfo(const Libraries::VideoOut::BufferAttributeGroup& group) noe
size.width = attrib.width; size.width = attrib.width;
size.height = attrib.height; size.height = attrib.height;
pitch = attrib.tiling_mode == TilingMode::Linear ? size.width : (size.width + 127) >> 7; pitch = attrib.tiling_mode == TilingMode::Linear ? size.width : (size.width + 127) >> 7;
const bool is_32bpp = pixel_format == vk::Format::eB8G8R8A8Srgb || const bool is_32bpp = attrib.pixel_format != VideoOutFormat::A16R16G16B16Float;
pixel_format == vk::Format::eA8B8G8R8SrgbPack32;
ASSERT(is_32bpp); ASSERT(is_32bpp);
if (!is_tiled) { if (!is_tiled) {
guest_size_bytes = pitch * size.height * 4; guest_size_bytes = pitch * size.height * 4;