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];
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());
}
auto vec = std::vector<const char*>();
@@ -85,8 +85,8 @@ public:
VkSurfaceKHR create_surface(VkInstance instance, VkPhysicalDevice gpu) override {
VkSurfaceKHR vk_surface;
if (!SDL_Vulkan_CreateSurface(window, instance, &vk_surface)) {
util::panic("Failed to create Vulkan window surface: %s", SDL_GetError());
if (!SDL_Vulkan_CreateSurface(g_Window, instance, &vk_surface)) {
util::panic("Failed to create Vulkan window surface: {}", SDL_GetError());
}
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>());
LoadParallelRDP(rdram);
}
@@ -183,7 +184,7 @@ void DrawFullscreenTexturedQuad(Util::IntrusivePtr<Image> image, Util::Intrusive
*data++ = +1.0f;
int sdlWinWidth, sdlWinHeight;
SDL_GetWindowSize(window, &sdlWinWidth, &sdlWinHeight);
SDL_GetWindowSize(g_Window, &sdlWinWidth, &sdlWinHeight);
float zoom = std::min(
(float)sdlWinWidth / wsi->get_platform().get_surface_width(),

View File

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

View File

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

View File

@@ -2,16 +2,20 @@
#include <util.hpp>
#include <nfd.hpp>
#include <Core.hpp>
#include <parallel-rdp/parallel-rdp-standalone/volk/volk.h>
#include <parallel-rdp/ParallelRDPWrapper.hpp>
#include <utility>
Window::Window(const n64::Core& core) {
InitSDL();
InitParallelRDP(core.GetRDRAM());
InitParallelRDP(core.GetRDRAM(), window);
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() {
SDL_Init(SDL_INIT_EVERYTHING);
window = SDL_CreateWindow(

View File

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