UWP build fix. Had to reshuffle some stuff and compile some Vulkan files.

This commit is contained in:
Henrik Rydgård 2022-11-06 15:50:47 +01:00
parent 0ef39d11d8
commit 162290147f
12 changed files with 85 additions and 50 deletions

View File

@ -1372,37 +1372,6 @@ void finalize_glslang() {
glslang::FinalizeProcess();
}
const char *VulkanResultToString(VkResult res) {
switch (res) {
case VK_NOT_READY: return "VK_NOT_READY";
case VK_TIMEOUT: return "VK_TIMEOUT";
case VK_EVENT_SET: return "VK_EVENT_SET";
case VK_EVENT_RESET: return "VK_EVENT_RESET";
case VK_INCOMPLETE: return "VK_INCOMPLETE";
case VK_ERROR_OUT_OF_HOST_MEMORY: return "VK_ERROR_OUT_OF_HOST_MEMORY";
case VK_ERROR_OUT_OF_DEVICE_MEMORY: return "VK_ERROR_OUT_OF_DEVICE_MEMORY";
case VK_ERROR_INITIALIZATION_FAILED: return "VK_ERROR_INITIALIZATION_FAILED";
case VK_ERROR_DEVICE_LOST: return "VK_ERROR_DEVICE_LOST";
case VK_ERROR_MEMORY_MAP_FAILED: return "VK_ERROR_MEMORY_MAP_FAILED";
case VK_ERROR_LAYER_NOT_PRESENT: return "VK_ERROR_LAYER_NOT_PRESENT";
case VK_ERROR_EXTENSION_NOT_PRESENT: return "VK_ERROR_EXTENSION_NOT_PRESENT";
case VK_ERROR_FEATURE_NOT_PRESENT: return "VK_ERROR_FEATURE_NOT_PRESENT";
case VK_ERROR_INCOMPATIBLE_DRIVER: return "VK_ERROR_INCOMPATIBLE_DRIVER";
case VK_ERROR_TOO_MANY_OBJECTS: return "VK_ERROR_TOO_MANY_OBJECTS";
case VK_ERROR_FORMAT_NOT_SUPPORTED: return "VK_ERROR_FORMAT_NOT_SUPPORTED";
case VK_ERROR_SURFACE_LOST_KHR: return "VK_ERROR_SURFACE_LOST_KHR";
case VK_SUBOPTIMAL_KHR: return "VK_SUBOPTIMAL_KHR";
case VK_ERROR_OUT_OF_DATE_KHR: return "VK_ERROR_OUT_OF_DATE_KHR";
case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR: return "VK_ERROR_INCOMPATIBLE_DISPLAY_KHR";
case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: return "VK_ERROR_NATIVE_WINDOW_IN_USE_KHR";
case VK_ERROR_OUT_OF_POOL_MEMORY_KHR: return "VK_ERROR_OUT_OF_POOL_MEMORY_KHR";
case VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR: return "VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR";
default:
return "VK_ERROR_...(unknown)";
}
}
void VulkanDeleteList::Take(VulkanDeleteList &del) {
_dbg_assert_(cmdPools_.empty());
_dbg_assert_(descPools_.empty());

View File

@ -461,7 +461,6 @@ enum class GLSLVariant {
bool GLSLtoSPV(const VkShaderStageFlagBits shader_type, const char *sourceCode, GLSLVariant variant, std::vector<uint32_t> &spirv, std::string *errorMessage);
const char *VulkanResultToString(VkResult res);
const char *VulkanColorSpaceToString(VkColorSpaceKHR colorSpace);
const char *VulkanFormatToString(VkFormat format);

View File

@ -239,7 +239,6 @@ static VulkanLibraryHandle vulkanLibrary;
typedef void *VulkanLibraryHandle;
static VulkanLibraryHandle vulkanLibrary;
#endif
const char *VulkanResultToString(VkResult res);
bool g_vulkanAvailabilityChecked = false;
bool g_vulkanMayBeAvailable = false;
@ -274,6 +273,8 @@ static VulkanLibraryHandle VulkanLoadLibrary(const char *logname) {
#if PPSSPP_PLATFORM(SWITCH)
// Always unavailable, for now.
return nullptr;
#elif PPSSPP_PLATFORM(UWP)
return nullptr;
#elif PPSSPP_PLATFORM(WINDOWS)
return LoadLibrary(L"vulkan-1.dll");
#else
@ -724,3 +725,34 @@ void VulkanLoadDeviceFunctions(VkDevice device, const VulkanExtensions &enabledE
void VulkanFree() {
VulkanFreeLibrary(vulkanLibrary);
}
const char *VulkanResultToString(VkResult res) {
switch (res) {
case VK_NOT_READY: return "VK_NOT_READY";
case VK_TIMEOUT: return "VK_TIMEOUT";
case VK_EVENT_SET: return "VK_EVENT_SET";
case VK_EVENT_RESET: return "VK_EVENT_RESET";
case VK_INCOMPLETE: return "VK_INCOMPLETE";
case VK_ERROR_OUT_OF_HOST_MEMORY: return "VK_ERROR_OUT_OF_HOST_MEMORY";
case VK_ERROR_OUT_OF_DEVICE_MEMORY: return "VK_ERROR_OUT_OF_DEVICE_MEMORY";
case VK_ERROR_INITIALIZATION_FAILED: return "VK_ERROR_INITIALIZATION_FAILED";
case VK_ERROR_DEVICE_LOST: return "VK_ERROR_DEVICE_LOST";
case VK_ERROR_MEMORY_MAP_FAILED: return "VK_ERROR_MEMORY_MAP_FAILED";
case VK_ERROR_LAYER_NOT_PRESENT: return "VK_ERROR_LAYER_NOT_PRESENT";
case VK_ERROR_EXTENSION_NOT_PRESENT: return "VK_ERROR_EXTENSION_NOT_PRESENT";
case VK_ERROR_FEATURE_NOT_PRESENT: return "VK_ERROR_FEATURE_NOT_PRESENT";
case VK_ERROR_INCOMPATIBLE_DRIVER: return "VK_ERROR_INCOMPATIBLE_DRIVER";
case VK_ERROR_TOO_MANY_OBJECTS: return "VK_ERROR_TOO_MANY_OBJECTS";
case VK_ERROR_FORMAT_NOT_SUPPORTED: return "VK_ERROR_FORMAT_NOT_SUPPORTED";
case VK_ERROR_SURFACE_LOST_KHR: return "VK_ERROR_SURFACE_LOST_KHR";
case VK_SUBOPTIMAL_KHR: return "VK_SUBOPTIMAL_KHR";
case VK_ERROR_OUT_OF_DATE_KHR: return "VK_ERROR_OUT_OF_DATE_KHR";
case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR: return "VK_ERROR_INCOMPATIBLE_DISPLAY_KHR";
case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: return "VK_ERROR_NATIVE_WINDOW_IN_USE_KHR";
case VK_ERROR_OUT_OF_POOL_MEMORY_KHR: return "VK_ERROR_OUT_OF_POOL_MEMORY_KHR";
case VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR: return "VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR";
default:
return "VK_ERROR_...(unknown)";
}
}

View File

@ -254,3 +254,5 @@ bool VulkanLoad();
void VulkanLoadInstanceFunctions(VkInstance instance, const VulkanExtensions &enabledExtensions);
void VulkanLoadDeviceFunctions(VkDevice device, const VulkanExtensions &enabledExtensions);
void VulkanFree();
const char *VulkanResultToString(VkResult res);

View File

@ -61,12 +61,12 @@ PFN_xrGetInputSourceLocalizedName xrGetInputSourceLocalizedName;
PFN_xrApplyHapticFeedback xrApplyHapticFeedback;
PFN_xrStopHapticFeedback xrStopHapticFeedback;
#ifdef _WIN32
#ifdef XR_USE_PLATFORM_WIN32
#define dlsym(x, y) GetProcAddress(x, y)
static HMODULE g_xrLibrary;
#else
#define dlsym(x, y) nullptr
void *xrLibrary;
void *g_xrLibrary;
#endif
#define LOAD_INSTANCE_FUNC(name) (PFN_ ## name)xrGetInstanceProcAddr(instance, #name, (PFN_xrVoidFunction *)(&name))
@ -78,13 +78,13 @@ bool XRLoad() {
return true;
}
#ifdef _WIN32
#ifdef XR_USE_PLATFORM_WIN32
g_xrLibrary = LoadLibrary(L"openxr_loader.dll");
if (!g_xrLibrary) {
return false;
}
#else
void *library = nullptr;
return false;
#endif
// Load the three basic functions.

View File

@ -18,12 +18,16 @@ using namespace PPSSPP_VK;
#include <jni.h>
#elif defined(_WIN32)
#include "Common/CommonWindows.h"
#if defined(WINAPI_FAMILY) && defined(WINAPI_FAMILY_PARTITION)
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP
#include "Common/GPU/OpenGL/GLCommon.h"
#define XR_USE_GRAPHICS_API_OPENGL 1
#define XR_USE_PLATFORM_WIN32 1
#endif
#endif
#define XR_USE_GRAPHICS_API_VULKAN 1
#include "Common/VR/OpenXRLoader.h"
#include <unknwn.h>
#define XR_USE_PLATFORM_WIN32 1
#define XR_USE_GRAPHICS_API_OPENGL 1
#define XR_USE_GRAPHICS_API_VULKAN 1
#define XR_NO_PROTOTYPES 1
#else
#define XR_USE_GRAPHICS_API_VULKAN 1

View File

@ -1,12 +1,14 @@
#include "Common/GPU/OpenGL/GLRenderManager.h"
#include "Common/GPU/Vulkan/VulkanContext.h"
#include "Common/VR/PPSSPPVR.h"
#include "Common/VR/VRBase.h"
#include "Common/VR/VRInput.h"
#include "Common/VR/VRMath.h"
#include "Common/VR/VRRenderer.h"
#if XR_USE_GRAPHICS_API_OPENGL
#include "Common/GPU/OpenGL/GLRenderManager.h"
#endif
#include "Common/GPU/Vulkan/VulkanContext.h"
#include "Core/HLE/sceDisplay.h"
#include "Core/Config.h"
#include "Core/KeyMap.h"
@ -337,6 +339,8 @@ void UpdateVRSpecialKeys(const KeyInput &key) {
================================================================================
*/
#if XR_USE_GRAPHICS_API_OPENGL
void PreprocessSkyplane(GLRStep* step) {
// Do not do anything if the scene is not in VR.
@ -378,6 +382,12 @@ void PreprocessStepVR(void* step) {
if (vrCompat[VR_COMPAT_SKYPLANE]) PreprocessSkyplane(glrStep);
}
#else
void PreprocessStepVR(void* step) {}
#endif
void SetVRCompat(VRCompatFlag flag, long value) {
vrCompat[flag] = value;
}

View File

@ -30,7 +30,7 @@ enum PxrTrackingDof {
typedef XrResult (XRAPI_PTR *PFN_xrSetEngineVersionPico)(XrInstance instance,const char* version);
typedef XrResult (XRAPI_PTR *PFN_xrStartCVControllerThreadPico)(XrInstance instance,int headSensorState, int handSensorState);
typedef XrResult (XRAPI_PTR *PFN_xrStopCVControllerThreadPico)(XrInstance instance,int headSensorState, int handSensorState);
typedef XrResult (XRAPI_PTR *PFN_xrSetConfigPICO) (XrSession instance, enum ConfigsSetEXT configIndex, char* configData);
typedef XrResult (XRAPI_PTR *PFN_xrSetConfigPICO) (XrSession instance, enum ConfigsSetEXT configIndex, const char *configData);
PFN_xrSetConfigPICO pfnXrSetConfigPICO = nullptr;
PFN_xrSetEngineVersionPico pfnXrSetEngineVersionPico = nullptr;
@ -218,7 +218,7 @@ void VR_EnterVR( engine_t* engine, XrGraphicsBindingVulkanKHR* graphicsBindingVu
XrSessionCreateInfo sessionCreateInfo = {};
#ifdef ANDROID
XrGraphicsBindingOpenGLESAndroidKHR graphicsBindingGL = {};
#else
#elif XR_USE_GRAPHICS_API_OPENGL
XrGraphicsBindingOpenGLWin32KHR graphicsBindingGL = {};
#endif
memset(&sessionCreateInfo, 0, sizeof(sessionCreateInfo));
@ -231,10 +231,10 @@ void VR_EnterVR( engine_t* engine, XrGraphicsBindingVulkanKHR* graphicsBindingVu
graphicsBindingGL.display = eglGetCurrentDisplay();
graphicsBindingGL.config = eglGetCurrentSurface(EGL_DRAW);
graphicsBindingGL.context = eglGetCurrentContext();
sessionCreateInfo.next = &graphicsBindingGL;
#else
//TODO:PCVR definition
#endif
sessionCreateInfo.next = &graphicsBindingGL;
}
sessionCreateInfo.type = XR_TYPE_SESSION_CREATE_INFO;
sessionCreateInfo.createFlags = 0;

View File

@ -137,6 +137,8 @@ static bool ovrFramebuffer_CreateGLES(XrSession session, ovrFramebuffer* frameBu
#endif
#if XR_USE_GRAPHICS_API_VULKAN
static bool ovrFramebuffer_CreateVK(XrSession session, ovrFramebuffer* frameBuffer, int width, int height,
bool multiview, void* context) {
@ -240,6 +242,8 @@ static bool ovrFramebuffer_CreateVK(XrSession session, ovrFramebuffer* frameBuff
return true;
}
#endif
void ovrFramebuffer_Destroy(ovrFramebuffer* frameBuffer) {
if (VR_GetPlatformFlag(VR_PLATFORM_RENDERER_VULKAN)) {
for (int i = 0; i < (int)frameBuffer->TextureSwapChainLength; i++) {

View File

@ -387,6 +387,7 @@
<ClInclude Include="..\..\Common\BitSet.h" />
<ClInclude Include="..\..\Common\Buffer.h" />
<ClInclude Include="..\..\Common\File\AndroidStorage.h" />
<ClInclude Include="..\..\Common\GPU\Vulkan\VulkanLoader.h" />
<ClInclude Include="..\..\Common\Math\Statistics.h" />
<ClInclude Include="..\..\Common\Net\NetBuffer.h" />
<ClInclude Include="..\..\Common\Data\Collections\ConstMap.h" />
@ -502,6 +503,7 @@
<ClInclude Include="..\..\Common\UI\UIScreen.h" />
<ClInclude Include="..\..\Common\UI\View.h" />
<ClInclude Include="..\..\Common\UI\ViewGroup.h" />
<ClInclude Include="..\..\Common\VR\OpenXRLoader.h" />
<ClInclude Include="..\..\Common\VR\PPSSPPVR.h" />
<ClInclude Include="..\..\Common\VR\VRBase.h" />
<ClInclude Include="..\..\Common\VR\VRFramebuffer.h" />
@ -526,6 +528,7 @@
<ClCompile Include="..\..\Common\ArmEmitter.cpp" />
<ClCompile Include="..\..\Common\Buffer.cpp" />
<ClCompile Include="..\..\Common\File\AndroidStorage.cpp" />
<ClCompile Include="..\..\Common\GPU\Vulkan\VulkanLoader.cpp" />
<ClCompile Include="..\..\Common\Math\Statistics.cpp" />
<ClCompile Include="..\..\Common\Net\NetBuffer.cpp" />
<ClCompile Include="..\..\Common\Data\Color\RGBAUtil.cpp" />
@ -618,6 +621,7 @@
<ClCompile Include="..\..\Common\UI\UIScreen.cpp" />
<ClCompile Include="..\..\Common\UI\View.cpp" />
<ClCompile Include="..\..\Common\UI\ViewGroup.cpp" />
<ClCompile Include="..\..\Common\VR\OpenXRLoader.cpp" />
<ClCompile Include="..\..\Common\VR\PPSSPPVR.cpp" />
<ClCompile Include="..\..\Common\VR\VRBase.cpp" />
<ClCompile Include="..\..\Common\VR\VRFramebuffer.cpp" />

View File

@ -88,6 +88,9 @@
<Filter Include="VR">
<UniqueIdentifier>{a5bfc343-9c3a-43ff-a033-7b0406e13816}</UniqueIdentifier>
</Filter>
<Filter Include="GPU\Vulkan">
<UniqueIdentifier>{096c3d00-fcfa-4877-8cf0-3b10d56b5d72}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\Common\ABI.cpp" />
@ -396,6 +399,12 @@
<ClCompile Include="..\..\Common\VR\VRRenderer.cpp">
<Filter>VR</Filter>
</ClCompile>
<ClCompile Include="..\..\Common\VR\OpenXRLoader.cpp">
<Filter>VR</Filter>
</ClCompile>
<ClCompile Include="..\..\Common\GPU\Vulkan\VulkanLoader.cpp">
<Filter>GPU\Vulkan</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="targetver.h" />
@ -733,6 +742,12 @@
<ClInclude Include="..\..\Common\VR\VRRenderer.h">
<Filter>VR</Filter>
</ClInclude>
<ClInclude Include="..\..\Common\VR\OpenXRLoader.h">
<Filter>VR</Filter>
</ClInclude>
<ClInclude Include="..\..\Common\GPU\Vulkan\VulkanLoader.h">
<Filter>GPU\Vulkan</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\Common\Math\fast\fast_matrix_neon.S">

View File

@ -406,10 +406,6 @@ float System_GetPropertyFloat(SystemProperty prop) {
}
}
bool VulkanMayBeAvailable() {
return false;
}
void System_Toast(const char *str) {}
bool System_GetPropertyBool(SystemProperty prop) {