can't use shared_ptr on SDL_Window
This commit is contained in:
13
external/parallel-rdp/ParallelRDPWrapper.cpp
vendored
13
external/parallel-rdp/ParallelRDPWrapper.cpp
vendored
@@ -23,8 +23,7 @@ Program *fullscreen_quad_program;
|
||||
|
||||
// Copied and modified from WSI::init_context_from_platform
|
||||
Util::IntrusivePtr<Context> InitVulkanContext(WSIPlatform *platform, unsigned num_thread_indices,
|
||||
const Context::SystemHandles &system_handles,
|
||||
InstanceFactory *instance_factory) {
|
||||
const Context::SystemHandles &system_handles) {
|
||||
VK_ASSERT(platform);
|
||||
auto instance_ext = platform->get_instance_extensions();
|
||||
auto device_ext = platform->get_device_extensions();
|
||||
@@ -33,9 +32,6 @@ Util::IntrusivePtr<Context> InitVulkanContext(WSIPlatform *platform, unsigned nu
|
||||
new_context->set_application_info(platform->get_application_info());
|
||||
new_context->set_num_thread_indices(num_thread_indices);
|
||||
new_context->set_system_handles(system_handles);
|
||||
if (instance_factory) {
|
||||
new_context->set_instance_factory(instance_factory);
|
||||
}
|
||||
|
||||
if (!new_context->init_instance(instance_ext.data(), instance_ext.size(), CONTEXT_CREATION_ENABLE_ADVANCED_WSI_BIT)) {
|
||||
Util::panic("Failed to create Vulkan instance.\n");
|
||||
@@ -57,8 +53,7 @@ Util::IntrusivePtr<Context> InitVulkanContext(WSIPlatform *platform, unsigned nu
|
||||
return new_context;
|
||||
}
|
||||
|
||||
void ParallelRDP::LoadWSIPlatform(const std::shared_ptr<InstanceFactory> &instanceFactory,
|
||||
const std::shared_ptr<WSIPlatform> &wsi_platform,
|
||||
void ParallelRDP::LoadWSIPlatform(const std::shared_ptr<WSIPlatform> &wsi_platform,
|
||||
const std::shared_ptr<WindowInfo> &newWindowInfo) {
|
||||
wsi = std::make_shared<WSI>();
|
||||
wsi->set_backbuffer_srgb(false);
|
||||
@@ -66,7 +61,7 @@ void ParallelRDP::LoadWSIPlatform(const std::shared_ptr<InstanceFactory> &instan
|
||||
wsi->set_present_mode(PresentMode::SyncToVBlank);
|
||||
Context::SystemHandles handles;
|
||||
|
||||
if (!wsi->init_from_existing_context(InitVulkanContext(wsi_platform.get(), 1, handles, instanceFactory.get()))) {
|
||||
if (!wsi->init_from_existing_context(InitVulkanContext(wsi_platform.get(), 1, handles))) {
|
||||
Util::panic("Failed to initialize WSI: init_from_existing_context() failed");
|
||||
}
|
||||
|
||||
@@ -83,7 +78,7 @@ void ParallelRDP::LoadWSIPlatform(const std::shared_ptr<InstanceFactory> &instan
|
||||
|
||||
void ParallelRDP::Init(const std::shared_ptr<WSIPlatform> &wsiPlatform,
|
||||
const std::shared_ptr<WindowInfo> &newWindowInfo, const u8 *rdram) {
|
||||
LoadWSIPlatform(nullptr, wsiPlatform, newWindowInfo);
|
||||
LoadWSIPlatform(wsiPlatform, newWindowInfo);
|
||||
|
||||
ResourceLayout vertLayout;
|
||||
ResourceLayout fragLayout;
|
||||
|
||||
3
external/parallel-rdp/ParallelRDPWrapper.hpp
vendored
3
external/parallel-rdp/ParallelRDPWrapper.hpp
vendored
@@ -34,8 +34,7 @@ public:
|
||||
std::shared_ptr<WindowInfo> windowInfo;
|
||||
|
||||
private:
|
||||
void LoadWSIPlatform(const std::shared_ptr<Vulkan::InstanceFactory> &, const std::shared_ptr<Vulkan::WSIPlatform> &,
|
||||
const std::shared_ptr<WindowInfo> &);
|
||||
void LoadWSIPlatform(const std::shared_ptr<Vulkan::WSIPlatform> &, const std::shared_ptr<WindowInfo> &);
|
||||
void DrawFullscreenTexturedQuad(Util::IntrusivePtr<Vulkan::Image>, Util::IntrusivePtr<Vulkan::CommandBuffer>) const;
|
||||
void UpdateScreen(Util::IntrusivePtr<Vulkan::Image>) const;
|
||||
};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include <Audio.hpp>
|
||||
#include <SDL3/SDL_audio.h>
|
||||
#include <SDL3/SDL_init.h>
|
||||
#include <log.hpp>
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
namespace n64 {
|
||||
#define AUDIO_SAMPLE_RATE 44100
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include <MemoryHelpers.hpp>
|
||||
#include <SDL3/SDL_audio.h>
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
namespace n64 {
|
||||
struct AudioDevice {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#include <InputSettings.hpp>
|
||||
#include <log.hpp>
|
||||
#include <SDL3/SDL_events.h>
|
||||
#include <SDL3/SDL_init.h>
|
||||
#include <SDL3/SDL_keycode.h>
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
InputSettings::InputSettings(nlohmann::json &settings) : settings(settings) {
|
||||
for(auto& kb : kbButtons) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <unordered_map>
|
||||
#include <ImGuiImpl/PushButton.hpp>
|
||||
#include <ImGuiImpl/Combobox.hpp>
|
||||
#include <SDL3/SDL_keycode.h>
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
class InputSettings final {
|
||||
bool grabbing = false;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
#include <NativeWindow.hpp>
|
||||
#include <RenderWidget.hpp>
|
||||
#include <Debugger.hpp>
|
||||
#include <ImGuiImpl/Menu.hpp>
|
||||
#include <ImGuiImpl/StatusBar.hpp>
|
||||
#include <NativeWindow.hpp>
|
||||
#include <EmuThread.hpp>
|
||||
#include <Discord.hpp>
|
||||
|
||||
@@ -14,10 +14,10 @@ public:
|
||||
double fpsCounter;
|
||||
gui::MenuBar<true> menuBar;
|
||||
gui::MenuItem actionPause{"Pause"}, actionStop{"Stop"}, actionReset{"Reset"};
|
||||
std::shared_ptr<n64::Core> core;
|
||||
EmuThread emuThread;
|
||||
SettingsWindow settingsWindow;
|
||||
std::shared_ptr<n64::Core> core;
|
||||
RenderWidget vulkanWidget;
|
||||
EmuThread emuThread;
|
||||
|
||||
int run();
|
||||
void LoadTAS(const std::string &path) const noexcept;
|
||||
@@ -28,5 +28,4 @@ private:
|
||||
std::function<void()> emuExitFunc;
|
||||
gui::PopupWindow about{"About Kaizen"};
|
||||
gui::StatusBar statusBar{};
|
||||
bool textPauseToggle = false;
|
||||
};
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
#pragma once
|
||||
#include <SDL3/SDL_video.h>
|
||||
#include <SDL3/SDL_init.h>
|
||||
#include <SDL3/SDL.h>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
namespace gui {
|
||||
struct NativeWindow {
|
||||
NativeWindow(const std::string& title, int w, int h, int posX = SDL_WINDOWPOS_CENTERED, int posY = SDL_WINDOWPOS_CENTERED) {
|
||||
SDL_Init(SDL_INIT_VIDEO);
|
||||
window = std::make_shared<SDL_Window>(SDL_CreateWindow(title.c_str(), w, h, SDL_WINDOW_VULKAN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY));
|
||||
window = SDL_CreateWindow(title.c_str(), w, h, SDL_WINDOW_VULKAN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY);
|
||||
}
|
||||
|
||||
~NativeWindow() {
|
||||
SDL_DestroyWindow(window);
|
||||
}
|
||||
void setTitle(const std::string& v) { title = v; }
|
||||
const std::shared_ptr<SDL_Window>& getHandle() { return window; }
|
||||
SDL_Window* getHandle() { return window; }
|
||||
private:
|
||||
std::shared_ptr<SDL_Window> window;
|
||||
SDL_Window* window;
|
||||
std::string title;
|
||||
};
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
#include <Core.hpp>
|
||||
#include <KaizenGui.hpp>
|
||||
#include <RenderWidget.hpp>
|
||||
#include <SDL3/SDL_events.h>
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
RenderWidget::RenderWidget(const std::shared_ptr<n64::Core> &core, const std::shared_ptr<SDL_Window>& window) {
|
||||
RenderWidget::RenderWidget(const std::shared_ptr<n64::Core> &core, SDL_Window* window) {
|
||||
if (!Vulkan::Context::init_loader(nullptr)) {
|
||||
Util::panic("Could not initialize Vulkan ICD");
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ private:
|
||||
|
||||
class ImGuiWSIPlatform final : public Vulkan::WSIPlatform {
|
||||
public:
|
||||
explicit ImGuiWSIPlatform(const std::shared_ptr<n64::Core> &core, const std::shared_ptr<SDL_Window> &window) : window(window), core(core) {}
|
||||
explicit ImGuiWSIPlatform(const std::shared_ptr<n64::Core> &core, SDL_Window* window) : window(window), core(core) {}
|
||||
|
||||
std::vector<const char *> get_instance_extensions() override {
|
||||
auto vec = std::vector<const char *>();
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
}
|
||||
|
||||
VkSurfaceKHR create_surface(VkInstance instance, VkPhysicalDevice pDevice) override {
|
||||
SDL_Vulkan_CreateSurface(window.get(), instance, nullptr, &surface);
|
||||
SDL_Vulkan_CreateSurface(window, instance, nullptr, &surface);
|
||||
return surface;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
|
||||
VkApplicationInfo appInfo{.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO, .apiVersion = VK_API_VERSION_1_3};
|
||||
|
||||
std::shared_ptr<SDL_Window> window{};
|
||||
SDL_Window* window{};
|
||||
VkSurfaceKHR surface;
|
||||
private:
|
||||
std::shared_ptr<n64::Core> core;
|
||||
@@ -73,7 +73,7 @@ private:
|
||||
|
||||
class RenderWidget final {
|
||||
public:
|
||||
explicit RenderWidget(const std::shared_ptr<n64::Core> &, const std::shared_ptr<SDL_Window>&);
|
||||
explicit RenderWidget(const std::shared_ptr<n64::Core> &, SDL_Window*);
|
||||
|
||||
std::shared_ptr<ParallelRDP::WindowInfo> windowInfo;
|
||||
std::shared_ptr<ImGuiWSIPlatform> wsiPlatform;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <InputSettings.hpp>
|
||||
#include <ImGuiImpl/TabBar.hpp>
|
||||
#include <ImGuiImpl/PopupWindow.hpp>
|
||||
#include <SDL3/SDL_keycode.h>
|
||||
#include <SDL3/SDL.h>
|
||||
#include <memory>
|
||||
|
||||
class SettingsWindow final {
|
||||
|
||||
Reference in New Issue
Block a user