get rid of #define VK_NO_PROTOTYPES

This commit is contained in:
CocoSimone
2022-08-08 09:45:15 +02:00
parent 8a450e110b
commit 325ef2a66b
5 changed files with 23 additions and 22 deletions

View File

@@ -71,7 +71,7 @@ public:
const char* extensions[64]; const char* extensions[64];
unsigned int num_extensions = 64; unsigned int num_extensions = 64;
if (!SDL_Vulkan_GetInstanceExtensions(window, &num_extensions, extensions)) { if (!SDL_Vulkan_GetInstanceExtensions(g_Window, &num_extensions, extensions)) {
util::panic("SDL_Vulkan_GetInstanceExtensions failed: %s", SDL_GetError()); util::panic("SDL_Vulkan_GetInstanceExtensions failed: %s", SDL_GetError());
} }
auto vec = std::vector<const char*>(); auto vec = std::vector<const char*>();
@@ -85,8 +85,8 @@ public:
VkSurfaceKHR create_surface(VkInstance instance, VkPhysicalDevice gpu) override { VkSurfaceKHR create_surface(VkInstance instance, VkPhysicalDevice gpu) override {
VkSurfaceKHR vk_surface; VkSurfaceKHR vk_surface;
if (!SDL_Vulkan_CreateSurface(window, instance, &vk_surface)) { if (!SDL_Vulkan_CreateSurface(g_Window, instance, &vk_surface)) {
util::panic("Failed to create Vulkan window surface: %s", SDL_GetError()); util::panic("Failed to create Vulkan window surface: {}", SDL_GetError());
} }
return vk_surface; return vk_surface;
} }
@@ -165,7 +165,8 @@ void LoadParallelRDP(const u8* rdram) {
} }
} }
void InitParallelRDP(const u8* rdram) { void InitParallelRDP(const u8* rdram, SDL_Window* window) {
g_Window = window;
LoadWSIPlatform(new SDLWSIPlatform(), std::make_unique<SDLParallelRdpWindowInfo>()); LoadWSIPlatform(new SDLWSIPlatform(), std::make_unique<SDLParallelRdpWindowInfo>());
LoadParallelRDP(rdram); LoadParallelRDP(rdram);
} }
@@ -183,7 +184,7 @@ void DrawFullscreenTexturedQuad(Util::IntrusivePtr<Image> image, Util::Intrusive
*data++ = +1.0f; *data++ = +1.0f;
int sdlWinWidth, sdlWinHeight; int sdlWinWidth, sdlWinHeight;
SDL_GetWindowSize(window, &sdlWinWidth, &sdlWinHeight); SDL_GetWindowSize(g_Window, &sdlWinWidth, &sdlWinHeight);
float zoom = std::min( float zoom = std::min(
(float)sdlWinWidth / wsi->get_platform().get_surface_width(), (float)sdlWinWidth / wsi->get_platform().get_surface_width(),

View File

@@ -5,7 +5,7 @@
#include <core/mmio/VI.hpp> #include <core/mmio/VI.hpp>
struct Window; struct Window;
static SDL_Window* window; static SDL_Window* g_Window;
class ParallelRdpWindowInfo { class ParallelRdpWindowInfo {
public: public:
@@ -20,7 +20,7 @@ public:
class SDLParallelRdpWindowInfo : public ParallelRdpWindowInfo { class SDLParallelRdpWindowInfo : public ParallelRdpWindowInfo {
CoordinatePair get_window_size() { CoordinatePair get_window_size() {
int width, height; int width, height;
SDL_GetWindowSize(window, &width, &height); SDL_GetWindowSize(g_Window, &width, &height);
return CoordinatePair{ width, height }; return CoordinatePair{ width, height };
} }
}; };
@@ -34,7 +34,7 @@ uint32_t GetVkGraphicsQueueFamily();
VkFormat GetVkFormat(); VkFormat GetVkFormat();
VkCommandBuffer GetVkCommandBuffer(); VkCommandBuffer GetVkCommandBuffer();
void SubmitRequestedVkCommandBuffer(); void SubmitRequestedVkCommandBuffer();
void InitParallelRDP(const u8* rdram); void InitParallelRDP(const u8* rdram, SDL_Window*);
void UpdateScreenParallelRdp(Window& imguiWindow, const n64::VI& vi); void UpdateScreenParallelRdp(Window& imguiWindow, const n64::VI& vi);
void ParallelRdpEnqueueCommand(int command_length, u32* buffer); void ParallelRdpEnqueueCommand(int command_length, u32* buffer);
void ParallelRdpOnFullSync(); void ParallelRdpOnFullSync();

View File

@@ -16,6 +16,7 @@ target_include_directories(frontend-imgui PUBLIC
../../n64/core/cpu ../../n64/core/cpu
../../n64/core/cpu/registers ../../n64/core/cpu/registers
../../../external ../../../external
../../../external/parallel-rdp/parallel-rdp-standalone
../../../external/parallel-rdp/parallel-rdp-standalone/vulkan ../../../external/parallel-rdp/parallel-rdp-standalone/vulkan
../../../external/parallel-rdp/parallel-rdp-standalone/util ../../../external/parallel-rdp/parallel-rdp-standalone/util
../../../external/parallel-rdp/parallel-rdp-standalone/volk) ../../../external/parallel-rdp/parallel-rdp-standalone/volk)

View File

@@ -2,16 +2,20 @@
#include <util.hpp> #include <util.hpp>
#include <nfd.hpp> #include <nfd.hpp>
#include <Core.hpp> #include <Core.hpp>
#include <parallel-rdp/parallel-rdp-standalone/volk/volk.h>
#include <parallel-rdp/ParallelRDPWrapper.hpp>
#include <utility> #include <utility>
Window::Window(const n64::Core& core) { Window::Window(const n64::Core& core) {
InitSDL(); InitSDL();
InitParallelRDP(core.GetRDRAM()); InitParallelRDP(core.GetRDRAM(), window);
InitImgui(); InitImgui();
} }
[[nodiscard]] bool Window::gotClosed(SDL_Event event) {
return event.type == SDL_WINDOWEVENT
&& event.window.event == SDL_WINDOWEVENT_CLOSE
&& event.window.windowID == SDL_GetWindowID(window);
}
void Window::InitSDL() { void Window::InitSDL() {
SDL_Init(SDL_INIT_EVERYTHING); SDL_Init(SDL_INIT_EVERYTHING);
window = SDL_CreateWindow( window = SDL_CreateWindow(

View File

@@ -1,11 +1,11 @@
#pragma once #pragma once
#include <parallel-rdp/ParallelRDPWrapper.hpp>
#include <volk.h>
#include <imgui.h> #include <imgui.h>
#include <imgui_impl_sdl.h> #include <imgui_impl_sdl.h>
#define VK_NO_PROTOTYPES #define VULKAN_DEBUG
#include <imgui_impl_vulkan.h> #include <imgui_impl_vulkan.h>
#include <SDL2/SDL.h> #include <SDL2/SDL_video.h>
#include <SDL2/SDL_vulkan.h>
#include <vulkan/vulkan.h>
#include <Core.hpp> #include <Core.hpp>
#include <vector> #include <vector>
@@ -14,19 +14,14 @@ struct Window {
~Window(); ~Window();
ImDrawData* Present(); ImDrawData* Present();
[[nodiscard]] bool gotClosed(SDL_Event event) { [[nodiscard]] bool gotClosed(SDL_Event event);
return event.type == SDL_WINDOWEVENT
&& event.window.event == SDL_WINDOWEVENT_CLOSE
&& event.window.windowID == SDL_GetWindowID(window);
}
private: private:
SDL_Window* window;
n64::Core core; n64::Core core;
void InitSDL(); void InitSDL();
void InitImgui(); void InitImgui();
void Render(); void Render();
SDL_Window* window{};
VkInstance instance{}; VkInstance instance{};
VkPhysicalDevice physicalDevice{}; VkPhysicalDevice physicalDevice{};
VkDevice device{}; VkDevice device{};