shadPS4/src/imgui/renderer/imgui_impl_vulkan.h
Vinicius Rangel 0f4bcd8c83
Rewrite Save Data & Impl Save Data Dialog (#824)
* core: Rewrite PSF parser & add encoder

add .sfo hex pattern to /scripts

* core/fs: allow to mount path as read-only

* common: Add CString wrapper to handle native null-terminated strings

* SaveData: rewrite to implement full functionality

* mock value for SYSTEM_VER

* SavaData: backup features

* SavaData: SaveDataMemory features

* imgui Ref-counted textures

- has a background thread to decode textures

* imgui: rework gamepad navigation

* PSF: fixed psf not using enum class for PSFEntryFmt (was a standard old ugly enum)

- Add null check to CString when itself is used in a nullable field

* SaveDataDialog implementation

- Fix Mounting/Unmounting check of SaveInstance
2024-09-20 12:34:19 +03:00

63 lines
No EOL
1.8 KiB
C++

// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
// Based on imgui_impl_vulkan.h from Dear ImGui repository
#pragma once
#define VULKAN_HPP_NO_EXCEPTIONS
#include "common/types.h"
#include "video_core/renderer_vulkan/vk_common.h"
struct ImDrawData;
namespace ImGui::Vulkan {
struct InitInfo {
vk::Instance instance;
vk::PhysicalDevice physical_device;
vk::Device device;
uint32_t queue_family;
vk::Queue queue;
uint32_t image_count; // >= 2
vk::DeviceSize min_allocation_size; // Minimum allocation size
vk::PipelineCache pipeline_cache;
uint32_t subpass;
vk::PipelineRenderingCreateInfoKHR pipeline_rendering_create_info;
// (Optional) Allocation, Logging
const vk::AllocationCallbacks* allocator{};
void (*check_vk_result_fn)(vk::Result err);
};
// Prepare all resources needed for uploading textures
// Caller should clean up the returned data.
struct UploadTextureData {
vk::Image image;
vk::ImageView image_view;
vk::DescriptorSet descriptor_set;
vk::DeviceMemory image_memory;
vk::CommandBuffer command_buffer; // Submit to the queue
vk::Buffer upload_buffer;
vk::DeviceMemory upload_buffer_memory;
void Upload();
void Destroy();
};
vk::DescriptorSet AddTexture(vk::ImageView image_view, vk::ImageLayout image_layout,
vk::Sampler sampler = VK_NULL_HANDLE);
UploadTextureData UploadTexture(const void* data, vk::Format format, u32 width, u32 height,
size_t size);
void RemoveTexture(vk::DescriptorSet descriptor_set);
bool Init(InitInfo info);
void Shutdown();
void RenderDrawData(ImDrawData& draw_data, vk::CommandBuffer command_buffer,
vk::Pipeline pipeline = VK_NULL_HANDLE);
} // namespace ImGui::Vulkan