mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-06-11 03:43:46 -04:00
pipeline statistics
This commit is contained in:
parent
201495db80
commit
557e02c28e
7 changed files with 37 additions and 40 deletions
|
|
@ -31,14 +31,13 @@ static u64 GetUint64(const VkPipelineExecutableStatisticKHR& statistic) {
|
|||
}
|
||||
}
|
||||
|
||||
PipelineStatistics::PipelineStatistics(const Device& device_) : device{device_} {}
|
||||
PipelineStatistics::PipelineStatistics(const Device& device_) {}
|
||||
|
||||
void PipelineStatistics::Collect(VkPipeline pipeline) {
|
||||
const auto& dev{device.GetLogical()};
|
||||
const std::vector properties{dev.GetPipelineExecutablePropertiesKHR(pipeline)};
|
||||
void PipelineStatistics::Collect(const Device& device, VkPipeline pipeline) {
|
||||
const std::vector properties{device.GetLogical().GetPipelineExecutablePropertiesKHR(pipeline)};
|
||||
const u32 num_executables{static_cast<u32>(properties.size())};
|
||||
for (u32 executable = 0; executable < num_executables; ++executable) {
|
||||
const auto statistics{dev.GetPipelineExecutableStatisticsKHR(pipeline, executable)};
|
||||
const auto statistics{device.GetLogical().GetPipelineExecutableStatisticsKHR(pipeline, executable)};
|
||||
if (statistics.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,9 +16,7 @@ class Device;
|
|||
class PipelineStatistics {
|
||||
public:
|
||||
explicit PipelineStatistics(const Device& device_);
|
||||
|
||||
void Collect(VkPipeline pipeline);
|
||||
|
||||
void Collect(const Device& device, VkPipeline pipeline);
|
||||
void Report() const;
|
||||
|
||||
private:
|
||||
|
|
@ -30,8 +28,6 @@ private:
|
|||
u64 branches_count{};
|
||||
u64 basic_block_count{};
|
||||
};
|
||||
|
||||
const Device& device;
|
||||
mutable std::mutex mutex;
|
||||
std::vector<Stats> collected_stats;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ void RendererVulkan::Composite(std::span<const Tegra::FramebufferConfig> framebu
|
|||
Frame* frame = present_manager.GetRenderFrame();
|
||||
|
||||
scheduler.RequestOutsideRenderPassOperationContext();
|
||||
blit_swapchain.DrawToFrame(rasterizer, frame, framebuffers,
|
||||
blit_swapchain.DrawToFrame(device, rasterizer, frame, framebuffers,
|
||||
render_window.GetFramebufferLayout(), swapchain.GetImageCount(),
|
||||
swapchain.GetImageViewFormat());
|
||||
scheduler.Flush(*frame->render_ready);
|
||||
|
|
@ -227,12 +227,12 @@ vk::Buffer RendererVulkan::RenderToBuffer(std::span<const Tegra::FramebufferConf
|
|||
f.image =
|
||||
CreateWrappedImage(memory_allocator, VkExtent2D{layout.width, layout.height}, format);
|
||||
f.image_view = CreateWrappedImageView(device, f.image, format);
|
||||
f.framebuffer = blit_capture.CreateFramebuffer(layout, *f.image_view, format);
|
||||
f.framebuffer = blit_capture.CreateFramebuffer(device, layout, *f.image_view, format);
|
||||
return f;
|
||||
}();
|
||||
|
||||
auto dst_buffer = CreateWrappedBuffer(memory_allocator, buffer_size, MemoryUsage::Download);
|
||||
blit_capture.DrawToFrame(rasterizer, &frame, framebuffers, layout, 1, format);
|
||||
blit_capture.DrawToFrame(device, rasterizer, &frame, framebuffers, layout, 1, format);
|
||||
|
||||
scheduler.RequestOutsideRenderPassOperationContext();
|
||||
scheduler.Record([&](vk::CommandBuffer cmdbuf) {
|
||||
|
|
@ -296,12 +296,12 @@ void RendererVulkan::RenderAppletCaptureLayer(
|
|||
if (!applet_frame.image) {
|
||||
applet_frame.image = CreateWrappedImage(memory_allocator, CaptureImageSize, CaptureFormat);
|
||||
applet_frame.image_view = CreateWrappedImageView(device, applet_frame.image, CaptureFormat);
|
||||
applet_frame.framebuffer = blit_applet.CreateFramebuffer(
|
||||
applet_frame.framebuffer = blit_applet.CreateFramebuffer(device,
|
||||
VideoCore::Capture::Layout, *applet_frame.image_view, CaptureFormat);
|
||||
}
|
||||
|
||||
scheduler.RequestOutsideRenderPassOperationContext();
|
||||
blit_applet.DrawToFrame(rasterizer, &applet_frame, framebuffers, VideoCore::Capture::Layout, 1,
|
||||
blit_applet.DrawToFrame(device, rasterizer, &applet_frame, framebuffers, VideoCore::Capture::Layout, 1,
|
||||
CaptureFormat);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,23 +18,26 @@
|
|||
|
||||
namespace Vulkan {
|
||||
|
||||
BlitScreen::BlitScreen(Tegra::MaxwellDeviceMemoryManager& device_memory_, const Device& device_,
|
||||
MemoryAllocator& memory_allocator_, PresentManager& present_manager_,
|
||||
Scheduler& scheduler_, const PresentFilters& filters_)
|
||||
: device_memory{device_memory_}, device{device_}, memory_allocator{memory_allocator_},
|
||||
present_manager{present_manager_}, scheduler{scheduler_}, filters{filters_},
|
||||
image_count{1}, image_index{0},
|
||||
swapchain_view_format{VK_FORMAT_B8G8R8A8_UNORM} {}
|
||||
BlitScreen::BlitScreen(Tegra::MaxwellDeviceMemoryManager& device_memory_, const Device& device_, MemoryAllocator& memory_allocator_, PresentManager& present_manager_, Scheduler& scheduler_, const PresentFilters& filters_)
|
||||
: device_memory{device_memory_}
|
||||
, memory_allocator{memory_allocator_}
|
||||
, present_manager{present_manager_}
|
||||
, scheduler{scheduler_}
|
||||
, filters{filters_}
|
||||
, image_count{1}
|
||||
, image_index{0}
|
||||
, swapchain_view_format{VK_FORMAT_B8G8R8A8_UNORM}
|
||||
{}
|
||||
|
||||
BlitScreen::~BlitScreen() = default;
|
||||
|
||||
void BlitScreen::WaitIdle() {
|
||||
void BlitScreen::WaitIdle(const Device& device) {
|
||||
present_manager.WaitPresent();
|
||||
scheduler.Finish();
|
||||
device.GetLogical().WaitIdle();
|
||||
}
|
||||
|
||||
void BlitScreen::SetWindowAdaptPass() {
|
||||
void BlitScreen::SetWindowAdaptPass(const Device& device) {
|
||||
layers.clear();
|
||||
scaling_filter = filters.get_scaling_filter();
|
||||
|
||||
|
|
@ -82,7 +85,7 @@ void BlitScreen::SetWindowAdaptPass() {
|
|||
}
|
||||
}
|
||||
|
||||
void BlitScreen::DrawToFrame(RasterizerVulkan& rasterizer, Frame* frame,
|
||||
void BlitScreen::DrawToFrame(const Device& device, RasterizerVulkan& rasterizer, Frame* frame,
|
||||
std::span<const Tegra::FramebufferConfig> framebuffers,
|
||||
const Layout::FramebufferLayout& layout,
|
||||
size_t current_swapchain_image_count,
|
||||
|
|
@ -107,8 +110,8 @@ void BlitScreen::DrawToFrame(RasterizerVulkan& rasterizer, Frame* frame,
|
|||
}
|
||||
|
||||
if (resource_update_required) {
|
||||
WaitIdle();
|
||||
SetWindowAdaptPass();
|
||||
WaitIdle(device);
|
||||
SetWindowAdaptPass(device);
|
||||
|
||||
if (presentation_recreate_required) {
|
||||
present_manager.RecreateFrame(frame, layout.width, layout.height, swapchain_view_format,
|
||||
|
|
@ -138,15 +141,15 @@ void BlitScreen::DrawToFrame(RasterizerVulkan& rasterizer, Frame* frame,
|
|||
}
|
||||
}
|
||||
|
||||
vk::Framebuffer BlitScreen::CreateFramebuffer(const Layout::FramebufferLayout& layout,
|
||||
vk::Framebuffer BlitScreen::CreateFramebuffer(const Device& device, const Layout::FramebufferLayout& layout,
|
||||
VkImageView image_view,
|
||||
VkFormat current_view_format) {
|
||||
bool format_updated = swapchain_view_format != current_view_format;
|
||||
swapchain_view_format = current_view_format;
|
||||
|
||||
if (!window_adapt || scaling_filter != filters.get_scaling_filter() || format_updated) {
|
||||
WaitIdle();
|
||||
SetWindowAdaptPass();
|
||||
WaitIdle(device);
|
||||
SetWindowAdaptPass(device);
|
||||
image_index = 0;
|
||||
}
|
||||
|
||||
|
|
@ -155,10 +158,10 @@ vk::Framebuffer BlitScreen::CreateFramebuffer(const Layout::FramebufferLayout& l
|
|||
.height = layout.height,
|
||||
};
|
||||
|
||||
return CreateFramebuffer(image_view, extent, window_adapt->GetRenderPass());
|
||||
return CreateFramebuffer(device, image_view, extent, window_adapt->GetRenderPass());
|
||||
}
|
||||
|
||||
vk::Framebuffer BlitScreen::CreateFramebuffer(const VkImageView& image_view, VkExtent2D extent,
|
||||
vk::Framebuffer BlitScreen::CreateFramebuffer(const Device& device, const VkImageView& image_view, VkExtent2D extent,
|
||||
VkRenderPass render_pass) {
|
||||
return device.GetLogical().CreateFramebuffer(VkFramebufferCreateInfo{
|
||||
.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO,
|
||||
|
|
|
|||
|
|
@ -52,23 +52,22 @@ public:
|
|||
Scheduler& scheduler, const PresentFilters& filters);
|
||||
~BlitScreen();
|
||||
|
||||
void DrawToFrame(RasterizerVulkan& rasterizer, Frame* frame,
|
||||
void DrawToFrame(const Device& device, RasterizerVulkan& rasterizer, Frame* frame,
|
||||
std::span<const Tegra::FramebufferConfig> framebuffers,
|
||||
const Layout::FramebufferLayout& layout, size_t current_swapchain_image_count,
|
||||
VkFormat current_swapchain_view_format);
|
||||
|
||||
[[nodiscard]] vk::Framebuffer CreateFramebuffer(const Layout::FramebufferLayout& layout,
|
||||
[[nodiscard]] vk::Framebuffer CreateFramebuffer(const Device& device, const Layout::FramebufferLayout& layout,
|
||||
VkImageView image_view,
|
||||
VkFormat current_view_format);
|
||||
|
||||
private:
|
||||
void WaitIdle();
|
||||
void SetWindowAdaptPass();
|
||||
vk::Framebuffer CreateFramebuffer(const VkImageView& image_view, VkExtent2D extent,
|
||||
void WaitIdle(const Device& device);
|
||||
void SetWindowAdaptPass(const Device& device);
|
||||
vk::Framebuffer CreateFramebuffer(const Device& device, const VkImageView& image_view, VkExtent2D extent,
|
||||
VkRenderPass render_pass);
|
||||
|
||||
Tegra::MaxwellDeviceMemoryManager& device_memory;
|
||||
const Device& device;
|
||||
MemoryAllocator& memory_allocator;
|
||||
PresentManager& present_manager;
|
||||
Scheduler& scheduler;
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ ComputePipeline::ComputePipeline(const Device& device_, vk::PipelineCache& pipel
|
|||
}
|
||||
|
||||
if (pipeline_statistics) {
|
||||
pipeline_statistics->Collect(*pipeline);
|
||||
pipeline_statistics->Collect(device, *pipeline);
|
||||
}
|
||||
std::scoped_lock lock{build_mutex};
|
||||
is_built = true;
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ GraphicsPipeline::GraphicsPipeline(
|
|||
Validate();
|
||||
MakePipeline(render_pass);
|
||||
if (pipeline_statistics) {
|
||||
pipeline_statistics->Collect(*pipeline);
|
||||
pipeline_statistics->Collect(device, *pipeline);
|
||||
}
|
||||
|
||||
std::scoped_lock lock{build_mutex};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue