From 12155d07431104e42bf5cb55b34c41845643be4d Mon Sep 17 00:00:00 2001 From: Bram Verweij Date: Wed, 18 Aug 2021 17:44:02 +0200 Subject: [PATCH] Prefix external Vulkan function pointers with ppsspp_ --- Common/GPU/Vulkan/VulkanContext.cpp | 140 ++++----- Common/GPU/Vulkan/VulkanImage.cpp | 16 +- Common/GPU/Vulkan/VulkanLoader.cpp | 342 +++++++++++----------- Common/GPU/Vulkan/VulkanLoader.h | 334 ++++++++++----------- Common/GPU/Vulkan/VulkanMemory.cpp | 22 +- Common/GPU/Vulkan/VulkanQueueRunner.cpp | 100 +++---- Common/GPU/Vulkan/VulkanRenderManager.cpp | 98 +++---- Common/GPU/Vulkan/thin3d_vulkan.cpp | 20 +- GPU/Vulkan/DrawEngineVulkan.cpp | 18 +- GPU/Vulkan/FramebufferManagerVulkan.cpp | 4 +- GPU/Vulkan/PipelineManagerVulkan.cpp | 14 +- GPU/Vulkan/TextureCacheVulkan.cpp | 16 +- GPU/Vulkan/VulkanUtil.cpp | 32 +- libretro/libretro_vulkan.cpp | 50 ++-- 14 files changed, 603 insertions(+), 603 deletions(-) diff --git a/Common/GPU/Vulkan/VulkanContext.cpp b/Common/GPU/Vulkan/VulkanContext.cpp index d9db09eed0e7..e38c0989103f 100644 --- a/Common/GPU/Vulkan/VulkanContext.cpp +++ b/Common/GPU/Vulkan/VulkanContext.cpp @@ -74,7 +74,7 @@ VulkanContext::VulkanContext() { } VkResult VulkanContext::CreateInstance(const CreateInfo &info) { - if (!vkCreateInstance) { + if (!ppsspp_vkCreateInstance) { init_error_ = "Vulkan not loaded - can't create instance"; return VK_ERROR_INITIALIZATION_FAILED; } @@ -176,7 +176,7 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) { #if SIMULATE_VULKAN_FAILURE == 2 VkResult res = VK_ERROR_INCOMPATIBLE_DRIVER; #else - VkResult res = vkCreateInstance(&inst_info, nullptr, &instance_); + VkResult res = ppsspp_vkCreateInstance(&inst_info, nullptr, &instance_); #endif if (res != VK_SUCCESS) { if (res == VK_ERROR_LAYER_NOT_PRESENT) { @@ -186,7 +186,7 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) { device_layer_names_.clear(); inst_info.enabledLayerCount = 0; inst_info.ppEnabledLayerNames = nullptr; - res = vkCreateInstance(&inst_info, nullptr, &instance_); + res = ppsspp_vkCreateInstance(&inst_info, nullptr, &instance_); if (res != VK_SUCCESS) ERROR_LOG(G3D, "Failed to create instance even without validation: %d", res); } else { @@ -209,12 +209,12 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) { #if SIMULATE_VULKAN_FAILURE == 3 gpu_count = 0; #else - res = vkEnumeratePhysicalDevices(instance_, &gpu_count, nullptr); + res = ppsspp_vkEnumeratePhysicalDevices(instance_, &gpu_count, nullptr); #endif if (gpu_count <= 0) { ERROR_LOG(G3D, "Vulkan driver found but no supported GPU is available"); init_error_ = "No Vulkan physical devices found"; - vkDestroyInstance(instance_, nullptr); + ppsspp_vkDestroyInstance(instance_, nullptr); instance_ = nullptr; return VK_ERROR_INITIALIZATION_FAILED; } @@ -222,10 +222,10 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) { _dbg_assert_(gpu_count > 0); physical_devices_.resize(gpu_count); physicalDeviceProperties_.resize(gpu_count); - res = vkEnumeratePhysicalDevices(instance_, &gpu_count, physical_devices_.data()); + res = ppsspp_vkEnumeratePhysicalDevices(instance_, &gpu_count, physical_devices_.data()); if (res != VK_SUCCESS) { init_error_ = "Failed to enumerate physical devices"; - vkDestroyInstance(instance_, nullptr); + ppsspp_vkDestroyInstance(instance_, nullptr); instance_ = nullptr; return res; } @@ -237,7 +237,7 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) { VkPhysicalDeviceExternalMemoryHostPropertiesEXT extHostMemProps{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT}; props2.pNext = &pushProps; pushProps.pNext = &extHostMemProps; - vkGetPhysicalDeviceProperties2KHR(physical_devices_[i], &props2); + ppsspp_vkGetPhysicalDeviceProperties2KHR(physical_devices_[i], &props2); // Don't want bad pointers sitting around. props2.pNext = nullptr; pushProps.pNext = nullptr; @@ -247,7 +247,7 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) { } } else { for (uint32_t i = 0; i < gpu_count; i++) { - vkGetPhysicalDeviceProperties(physical_devices_[i], &physicalDeviceProperties_[i].properties); + ppsspp_vkGetPhysicalDeviceProperties(physical_devices_[i], &physicalDeviceProperties_[i].properties); } } @@ -265,12 +265,12 @@ VulkanContext::~VulkanContext() { void VulkanContext::DestroyInstance() { if (extensionsLookup_.EXT_debug_utils) { while (utils_callbacks.size() > 0) { - vkDestroyDebugUtilsMessengerEXT(instance_, utils_callbacks.back(), nullptr); + ppsspp_vkDestroyDebugUtilsMessengerEXT(instance_, utils_callbacks.back(), nullptr); utils_callbacks.pop_back(); } } - vkDestroyInstance(instance_, nullptr); + ppsspp_vkDestroyInstance(instance_, nullptr); VulkanFree(); instance_ = VK_NULL_HANDLE; } @@ -299,7 +299,7 @@ void VulkanContext::UpdateInflightFrames(int n) { void VulkanContext::WaitUntilQueueIdle() { // Should almost never be used - vkQueueWaitIdle(gfx_queue_); + ppsspp_vkQueueWaitIdle(gfx_queue_); } bool VulkanContext::MemoryTypeFromProperties(uint32_t typeBits, VkFlags requirements_mask, uint32_t *typeIndex) { @@ -320,14 +320,14 @@ bool VulkanContext::MemoryTypeFromProperties(uint32_t typeBits, VkFlags requirem void VulkanContext::DestroySwapchain() { if (swapchain_ != VK_NULL_HANDLE) { - vkDestroySwapchainKHR(device_, swapchain_, nullptr); + ppsspp_vkDestroySwapchainKHR(device_, swapchain_, nullptr); swapchain_ = VK_NULL_HANDLE; } } void VulkanContext::DestroySurface() { if (surface_ != VK_NULL_HANDLE) { - vkDestroySurfaceKHR(instance_, surface_, nullptr); + ppsspp_vkDestroySurfaceKHR(instance_, surface_, nullptr); surface_ = VK_NULL_HANDLE; } } @@ -336,13 +336,13 @@ VkResult VulkanContext::GetInstanceLayerExtensionList(const char *layerName, std VkResult res; do { uint32_t instance_extension_count; - res = vkEnumerateInstanceExtensionProperties(layerName, &instance_extension_count, nullptr); + res = ppsspp_vkEnumerateInstanceExtensionProperties(layerName, &instance_extension_count, nullptr); if (res != VK_SUCCESS) return res; if (instance_extension_count == 0) return VK_SUCCESS; extensions.resize(instance_extension_count); - res = vkEnumerateInstanceExtensionProperties(layerName, &instance_extension_count, extensions.data()); + res = ppsspp_vkEnumerateInstanceExtensionProperties(layerName, &instance_extension_count, extensions.data()); } while (res == VK_INCOMPLETE); return res; } @@ -364,13 +364,13 @@ VkResult VulkanContext::GetInstanceLayerProperties() { std::vector vk_props; VkResult res; do { - res = vkEnumerateInstanceLayerProperties(&instance_layer_count, nullptr); + res = ppsspp_vkEnumerateInstanceLayerProperties(&instance_layer_count, nullptr); if (res != VK_SUCCESS) return res; if (!instance_layer_count) return VK_SUCCESS; vk_props.resize(instance_layer_count); - res = vkEnumerateInstanceLayerProperties(&instance_layer_count, vk_props.data()); + res = ppsspp_vkEnumerateInstanceLayerProperties(&instance_layer_count, vk_props.data()); } while (res == VK_INCOMPLETE); // Now gather the extension list for each instance layer. @@ -390,13 +390,13 @@ VkResult VulkanContext::GetDeviceLayerExtensionList(const char *layerName, std:: VkResult res; do { uint32_t device_extension_count; - res = vkEnumerateDeviceExtensionProperties(physical_devices_[physical_device_], layerName, &device_extension_count, nullptr); + res = ppsspp_vkEnumerateDeviceExtensionProperties(physical_devices_[physical_device_], layerName, &device_extension_count, nullptr); if (res != VK_SUCCESS) return res; if (!device_extension_count) return VK_SUCCESS; extensions.resize(device_extension_count); - res = vkEnumerateDeviceExtensionProperties(physical_devices_[physical_device_], layerName, &device_extension_count, extensions.data()); + res = ppsspp_vkEnumerateDeviceExtensionProperties(physical_devices_[physical_device_], layerName, &device_extension_count, extensions.data()); } while (res == VK_INCOMPLETE); return res; } @@ -418,13 +418,13 @@ VkResult VulkanContext::GetDeviceLayerProperties() { std::vector vk_props; VkResult res; do { - res = vkEnumerateDeviceLayerProperties(physical_devices_[physical_device_], &device_layer_count, nullptr); + res = ppsspp_vkEnumerateDeviceLayerProperties(physical_devices_[physical_device_], &device_layer_count, nullptr); if (res != VK_SUCCESS) return res; if (device_layer_count == 0) return VK_SUCCESS; vk_props.resize(device_layer_count); - res = vkEnumerateDeviceLayerProperties(physical_devices_[physical_device_], &device_layer_count, vk_props.data()); + res = ppsspp_vkEnumerateDeviceLayerProperties(physical_devices_[physical_device_], &device_layer_count, vk_props.data()); } while (res == VK_INCOMPLETE); // Gather the list of extensions for each device layer. @@ -476,7 +476,7 @@ int VulkanContext::GetBestPhysicalDevice() { for (size_t i = 0; i < physical_devices_.size(); i++) { int score = 0; VkPhysicalDeviceProperties props; - vkGetPhysicalDeviceProperties(physical_devices_[i], &props); + ppsspp_vkGetPhysicalDeviceProperties(physical_devices_[i], &props); switch (props.deviceType) { case VK_PHYSICAL_DEVICE_TYPE_CPU: score += 1; @@ -515,11 +515,11 @@ void VulkanContext::ChooseDevice(int physical_device) { WARN_LOG(G3D, "CheckLayers for device %d failed", physical_device); } - vkGetPhysicalDeviceQueueFamilyProperties(physical_devices_[physical_device_], &queue_count, nullptr); + ppsspp_vkGetPhysicalDeviceQueueFamilyProperties(physical_devices_[physical_device_], &queue_count, nullptr); _dbg_assert_(queue_count >= 1); queueFamilyProperties_.resize(queue_count); - vkGetPhysicalDeviceQueueFamilyProperties(physical_devices_[physical_device_], &queue_count, queueFamilyProperties_.data()); + ppsspp_vkGetPhysicalDeviceQueueFamilyProperties(physical_devices_[physical_device_], &queue_count, queueFamilyProperties_.data()); _dbg_assert_(queue_count >= 1); // Detect preferred formats, in this order. @@ -531,7 +531,7 @@ void VulkanContext::ChooseDevice(int physical_device) { deviceInfo_.preferredDepthStencilFormat = VK_FORMAT_UNDEFINED; for (size_t i = 0; i < ARRAY_SIZE(depthStencilFormats); i++) { VkFormatProperties props; - vkGetPhysicalDeviceFormatProperties(physical_devices_[physical_device_], depthStencilFormats[i], &props); + ppsspp_vkGetPhysicalDeviceFormatProperties(physical_devices_[physical_device_], depthStencilFormats[i], &props); if (props.optimalTilingFeatures & VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT) { deviceInfo_.preferredDepthStencilFormat = depthStencilFormats[i]; break; @@ -540,14 +540,14 @@ void VulkanContext::ChooseDevice(int physical_device) { _assert_msg_(deviceInfo_.preferredDepthStencilFormat != VK_FORMAT_UNDEFINED, "Could not find a usable depth stencil format."); VkFormatProperties preferredProps; - vkGetPhysicalDeviceFormatProperties(physical_devices_[physical_device_], deviceInfo_.preferredDepthStencilFormat, &preferredProps); + ppsspp_vkGetPhysicalDeviceFormatProperties(physical_devices_[physical_device_], deviceInfo_.preferredDepthStencilFormat, &preferredProps); if ((preferredProps.optimalTilingFeatures & VK_FORMAT_FEATURE_BLIT_SRC_BIT) && (preferredProps.optimalTilingFeatures & VK_FORMAT_FEATURE_BLIT_DST_BIT)) { deviceInfo_.canBlitToPreferredDepthStencilFormat = true; } // This is as good a place as any to do this. - vkGetPhysicalDeviceMemoryProperties(physical_devices_[physical_device_], &memory_properties); + ppsspp_vkGetPhysicalDeviceMemoryProperties(physical_devices_[physical_device_], &memory_properties); INFO_LOG(G3D, "Memory Types (%d):", memory_properties.memoryTypeCount); for (int i = 0; i < (int)memory_properties.memoryTypeCount; i++) { // Don't bother printing dummy memory types. @@ -563,10 +563,10 @@ void VulkanContext::ChooseDevice(int physical_device) { // Optional features if (extensionsLookup_.KHR_get_physical_device_properties2) { VkPhysicalDeviceFeatures2 features2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR}; - vkGetPhysicalDeviceFeatures2KHR(physical_devices_[physical_device_], &features2); + ppsspp_vkGetPhysicalDeviceFeatures2KHR(physical_devices_[physical_device_], &features2); deviceFeatures_.available = features2.features; } else { - vkGetPhysicalDeviceFeatures(physical_devices_[physical_device_], &deviceFeatures_.available); + ppsspp_vkGetPhysicalDeviceFeatures(physical_devices_[physical_device_], &deviceFeatures_.available); } deviceFeatures_.enabled = {}; @@ -645,7 +645,7 @@ VkResult VulkanContext::CreateDevice() { device_info.ppEnabledExtensionNames = device_info.enabledExtensionCount ? device_extensions_enabled_.data() : nullptr; device_info.pEnabledFeatures = &deviceFeatures_.enabled; - VkResult res = vkCreateDevice(physical_devices_[physical_device_], &device_info, nullptr, &device_); + VkResult res = ppsspp_vkCreateDevice(physical_devices_[physical_device_], &device_info, nullptr, &device_); if (res != VK_SUCCESS) { init_error_ = "Unable to create Vulkan device"; ERROR_LOG(G3D, "Unable to create Vulkan device"); @@ -670,7 +670,7 @@ VkResult VulkanContext::InitDebugUtilsCallback() { callback1.pfnUserCallback = &VulkanDebugUtilsCallback; callback1.pUserData = (void *)&g_LogOptions; VkDebugUtilsMessengerEXT messenger; - VkResult res = vkCreateDebugUtilsMessengerEXT(instance_, &callback1, nullptr, &messenger); + VkResult res = ppsspp_vkCreateDebugUtilsMessengerEXT(instance_, &callback1, nullptr, &messenger); if (res != VK_SUCCESS) { ERROR_LOG(G3D, "Failed to register debug callback with vkCreateDebugUtilsMessengerEXT"); // Do error handling for VK_ERROR_OUT_OF_MEMORY @@ -686,7 +686,7 @@ void VulkanContext::SetDebugNameImpl(uint64_t handle, VkObjectType type, const c info.pObjectName = name; info.objectHandle = handle; info.objectType = type; - vkSetDebugUtilsObjectNameEXT(device_, &info); + ppsspp_vkSetDebugUtilsObjectNameEXT(device_, &info); } VkResult VulkanContext::InitSurface(WindowSystem winsys, void *data1, void *data2) { @@ -699,7 +699,7 @@ VkResult VulkanContext::InitSurface(WindowSystem winsys, void *data1, void *data VkResult VulkanContext::ReinitSurface() { if (surface_ != VK_NULL_HANDLE) { INFO_LOG(G3D, "Destroying Vulkan surface (%d, %d)", swapChainExtent_.width, swapChainExtent_.height); - vkDestroySurfaceKHR(instance_, surface_, nullptr); + ppsspp_vkDestroySurfaceKHR(instance_, surface_, nullptr); surface_ = VK_NULL_HANDLE; } @@ -715,7 +715,7 @@ VkResult VulkanContext::ReinitSurface() { win32.flags = 0; win32.hwnd = (HWND)winsysData2_; win32.hinstance = (HINSTANCE)winsysData1_; - retval = vkCreateWin32SurfaceKHR(instance_, &win32, nullptr, &surface_); + retval = ppsspp_vkCreateWin32SurfaceKHR(instance_, &win32, nullptr, &surface_); break; } #endif @@ -726,7 +726,7 @@ VkResult VulkanContext::ReinitSurface() { VkAndroidSurfaceCreateInfoKHR android{ VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR }; android.flags = 0; android.window = wnd; - retval = vkCreateAndroidSurfaceKHR(instance_, &android, nullptr, &surface_); + retval = ppsspp_vkCreateAndroidSurfaceKHR(instance_, &android, nullptr, &surface_); break; } #endif @@ -737,7 +737,7 @@ VkResult VulkanContext::ReinitSurface() { metal.flags = 0; metal.pLayer = winsysData1_; metal.pNext = winsysData2_; - retval = vkCreateMetalSurfaceEXT(instance_, &metal, nullptr, &surface_); + retval = ppsspp_vkCreateMetalSurfaceEXT(instance_, &metal, nullptr, &surface_); break; } #endif @@ -748,7 +748,7 @@ VkResult VulkanContext::ReinitSurface() { xlib.flags = 0; xlib.dpy = (Display *)winsysData1_; xlib.window = (Window)winsysData2_; - retval = vkCreateXlibSurfaceKHR(instance_, &xlib, nullptr, &surface_); + retval = ppsspp_vkCreateXlibSurfaceKHR(instance_, &xlib, nullptr, &surface_); break; } #endif @@ -759,7 +759,7 @@ VkResult VulkanContext::ReinitSurface() { xcb.flags = 0; xcb.connection = (Connection *)winsysData1_; xcb.window = (Window)(uintptr_t)winsysData2_; - retval = vkCreateXcbSurfaceKHR(instance_, &xcb, nullptr, &surface_); + retval = ppsspp_vkCreateXcbSurfaceKHR(instance_, &xcb, nullptr, &surface_); break; } #endif @@ -770,7 +770,7 @@ VkResult VulkanContext::ReinitSurface() { wayland.flags = 0; wayland.display = (wl_display *)winsysData1_; wayland.surface = (wl_surface *)winsysData2_; - retval = vkCreateWaylandSurfaceKHR(instance_, &wayland, nullptr, &surface_); + retval = ppsspp_vkCreateWaylandSurfaceKHR(instance_, &wayland, nullptr, &surface_); break; } #endif @@ -779,7 +779,7 @@ VkResult VulkanContext::ReinitSurface() { { VkDisplaySurfaceCreateInfoKHR display{ VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR }; display.flags = 0; - retval = vkCreateDisplayPlaneSurfaceKHR(instance_, &display, nullptr, &surface_); + retval = ppsspp_vkCreateDisplayPlaneSurfaceKHR(instance_, &display, nullptr, &surface_); break; } #endif @@ -804,7 +804,7 @@ bool VulkanContext::ChooseQueue() { // Iterate over each queue to learn whether it supports presenting: VkBool32 *supportsPresent = new VkBool32[queue_count]; for (uint32_t i = 0; i < queue_count; i++) { - vkGetPhysicalDeviceSurfaceSupportKHR(physical_devices_[physical_device_], i, surface_, &supportsPresent[i]); + ppsspp_vkGetPhysicalDeviceSurfaceSupportKHR(physical_devices_[physical_device_], i, surface_, &supportsPresent[i]); } // Search for a graphics queue and a present queue in the array of queue @@ -846,14 +846,14 @@ bool VulkanContext::ChooseQueue() { // Get the list of VkFormats that are supported: uint32_t formatCount = 0; - VkResult res = vkGetPhysicalDeviceSurfaceFormatsKHR(physical_devices_[physical_device_], surface_, &formatCount, nullptr); + VkResult res = ppsspp_vkGetPhysicalDeviceSurfaceFormatsKHR(physical_devices_[physical_device_], surface_, &formatCount, nullptr); _assert_msg_(res == VK_SUCCESS, "Failed to get formats for device %d: %d", physical_device_, (int)res); if (res != VK_SUCCESS) { return false; } std::vector surfFormats(formatCount); - res = vkGetPhysicalDeviceSurfaceFormatsKHR(physical_devices_[physical_device_], surface_, &formatCount, surfFormats.data()); + res = ppsspp_vkGetPhysicalDeviceSurfaceFormatsKHR(physical_devices_[physical_device_], surface_, &formatCount, surfFormats.data()); _dbg_assert_(res == VK_SUCCESS); if (res != VK_SUCCESS) { return false; @@ -883,7 +883,7 @@ bool VulkanContext::ChooseQueue() { INFO_LOG(G3D, "swapchain_format: %d (/%d)", swapchainFormat_, formatCount); } - vkGetDeviceQueue(device_, graphics_queue_family_index_, 0, &gfx_queue_); + ppsspp_vkGetDeviceQueue(device_, graphics_queue_family_index_, 0, &gfx_queue_); return true; } @@ -910,7 +910,7 @@ static std::string surface_transforms_to_string(VkSurfaceTransformFlagsKHR trans } bool VulkanContext::InitSwapchain() { - VkResult res = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physical_devices_[physical_device_], surface_, &surfCapabilities_); + VkResult res = ppsspp_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physical_devices_[physical_device_], surface_, &surfCapabilities_); if (res == VK_ERROR_SURFACE_LOST_KHR) { // Not much to do. ERROR_LOG(G3D, "VK: Surface lost in InitSwapchain"); @@ -918,11 +918,11 @@ bool VulkanContext::InitSwapchain() { } _dbg_assert_(res == VK_SUCCESS); uint32_t presentModeCount; - res = vkGetPhysicalDeviceSurfacePresentModesKHR(physical_devices_[physical_device_], surface_, &presentModeCount, nullptr); + res = ppsspp_vkGetPhysicalDeviceSurfacePresentModesKHR(physical_devices_[physical_device_], surface_, &presentModeCount, nullptr); _dbg_assert_(res == VK_SUCCESS); VkPresentModeKHR *presentModes = new VkPresentModeKHR[presentModeCount]; _dbg_assert_(presentModes); - res = vkGetPhysicalDeviceSurfacePresentModesKHR(physical_devices_[physical_device_], surface_, &presentModeCount, presentModes); + res = ppsspp_vkGetPhysicalDeviceSurfacePresentModesKHR(physical_devices_[physical_device_], surface_, &presentModeCount, presentModes); _dbg_assert_(res == VK_SUCCESS); @@ -1066,7 +1066,7 @@ bool VulkanContext::InitSwapchain() { swap_chain_info.compositeAlpha = VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR; } - res = vkCreateSwapchainKHR(device_, &swap_chain_info, NULL, &swapchain_); + res = ppsspp_vkCreateSwapchainKHR(device_, &swap_chain_info, NULL, &swapchain_); if (res != VK_SUCCESS) { ERROR_LOG(G3D, "vkCreateSwapchainKHR failed!"); return false; @@ -1079,7 +1079,7 @@ VkFence VulkanContext::CreateFence(bool presignalled) { VkFence fence; VkFenceCreateInfo fenceInfo{ VK_STRUCTURE_TYPE_FENCE_CREATE_INFO }; fenceInfo.flags = presignalled ? VK_FENCE_CREATE_SIGNALED_BIT : 0; - vkCreateFence(device_, &fenceInfo, NULL, &fence); + ppsspp_vkCreateFence(device_, &fenceInfo, NULL, &fence); return fence; } @@ -1101,7 +1101,7 @@ void VulkanContext::DestroyDevice() { INFO_LOG(G3D, "VulkanContext::DestroyDevice (performing deletes)"); PerformPendingDeletes(); - vkDestroyDevice(device_, nullptr); + ppsspp_vkDestroyDevice(device_, nullptr); device_ = nullptr; } @@ -1110,7 +1110,7 @@ bool VulkanContext::CreateShaderModule(const std::vector &spirv, VkSha sm.pCode = spirv.data(); sm.codeSize = spirv.size() * sizeof(uint32_t); sm.flags = 0; - VkResult result = vkCreateShaderModule(device_, &sm, nullptr, shaderModule); + VkResult result = ppsspp_vkCreateShaderModule(device_, &sm, nullptr, shaderModule); if (result != VK_SUCCESS) { return false; } else { @@ -1134,7 +1134,7 @@ void TransitionImageLayout2(VkCommandBuffer cmd, VkImage image, int baseMip, int image_memory_barrier.subresourceRange.layerCount = 1; // We never use more than one layer, and old Mali drivers have problems with VK_REMAINING_ARRAY_LAYERS/VK_REMAINING_MIP_LEVELS. image_memory_barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; image_memory_barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - vkCmdPipelineBarrier(cmd, srcStageMask, dstStageMask, 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier); + ppsspp_vkCmdPipelineBarrier(cmd, srcStageMask, dstStageMask, 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier); } EShLanguage FindLanguage(const VkShaderStageFlagBits shader_type) { @@ -1330,63 +1330,63 @@ void VulkanDeleteList::PerformDeletes(VkDevice device) { } callbacks_.clear(); for (auto &cmdPool : cmdPools_) { - vkDestroyCommandPool(device, cmdPool, nullptr); + ppsspp_vkDestroyCommandPool(device, cmdPool, nullptr); } cmdPools_.clear(); for (auto &descPool : descPools_) { - vkDestroyDescriptorPool(device, descPool, nullptr); + ppsspp_vkDestroyDescriptorPool(device, descPool, nullptr); } descPools_.clear(); for (auto &module : modules_) { - vkDestroyShaderModule(device, module, nullptr); + ppsspp_vkDestroyShaderModule(device, module, nullptr); } modules_.clear(); for (auto &buf : buffers_) { - vkDestroyBuffer(device, buf, nullptr); + ppsspp_vkDestroyBuffer(device, buf, nullptr); } buffers_.clear(); for (auto &bufView : bufferViews_) { - vkDestroyBufferView(device, bufView, nullptr); + ppsspp_vkDestroyBufferView(device, bufView, nullptr); } bufferViews_.clear(); for (auto &image : images_) { - vkDestroyImage(device, image, nullptr); + ppsspp_vkDestroyImage(device, image, nullptr); } images_.clear(); for (auto &imageView : imageViews_) { - vkDestroyImageView(device, imageView, nullptr); + ppsspp_vkDestroyImageView(device, imageView, nullptr); } imageViews_.clear(); for (auto &mem : deviceMemory_) { - vkFreeMemory(device, mem, nullptr); + ppsspp_vkFreeMemory(device, mem, nullptr); } deviceMemory_.clear(); for (auto &sampler : samplers_) { - vkDestroySampler(device, sampler, nullptr); + ppsspp_vkDestroySampler(device, sampler, nullptr); } samplers_.clear(); for (auto &pipeline : pipelines_) { - vkDestroyPipeline(device, pipeline, nullptr); + ppsspp_vkDestroyPipeline(device, pipeline, nullptr); } pipelines_.clear(); for (auto &pcache : pipelineCaches_) { - vkDestroyPipelineCache(device, pcache, nullptr); + ppsspp_vkDestroyPipelineCache(device, pcache, nullptr); } pipelineCaches_.clear(); for (auto &renderPass : renderPasses_) { - vkDestroyRenderPass(device, renderPass, nullptr); + ppsspp_vkDestroyRenderPass(device, renderPass, nullptr); } renderPasses_.clear(); for (auto &framebuffer : framebuffers_) { - vkDestroyFramebuffer(device, framebuffer, nullptr); + ppsspp_vkDestroyFramebuffer(device, framebuffer, nullptr); } framebuffers_.clear(); for (auto &pipeLayout : pipelineLayouts_) { - vkDestroyPipelineLayout(device, pipeLayout, nullptr); + ppsspp_vkDestroyPipelineLayout(device, pipeLayout, nullptr); } pipelineLayouts_.clear(); for (auto &descSetLayout : descSetLayouts_) { - vkDestroyDescriptorSetLayout(device, descSetLayout, nullptr); + ppsspp_vkDestroyDescriptorSetLayout(device, descSetLayout, nullptr); } descSetLayouts_.clear(); } @@ -1400,14 +1400,14 @@ void VulkanContext::GetImageMemoryRequirements(VkImage image, VkMemoryRequiremen VkMemoryDedicatedRequirementsKHR memDedicatedReq{VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR}; memReq2.pNext = &memDedicatedReq; - vkGetImageMemoryRequirements2KHR(GetDevice(), &memReqInfo2, &memReq2); + ppsspp_vkGetImageMemoryRequirements2KHR(GetDevice(), &memReqInfo2, &memReq2); *mem_reqs = memReq2.memoryRequirements; *dedicatedAllocation = (memDedicatedReq.requiresDedicatedAllocation != VK_FALSE) || (memDedicatedReq.prefersDedicatedAllocation != VK_FALSE); } else { - vkGetImageMemoryRequirements(GetDevice(), image, mem_reqs); + ppsspp_vkGetImageMemoryRequirements(GetDevice(), image, mem_reqs); *dedicatedAllocation = false; } } diff --git a/Common/GPU/Vulkan/VulkanImage.cpp b/Common/GPU/Vulkan/VulkanImage.cpp index 564729a99af4..a8d9842c6dd6 100644 --- a/Common/GPU/Vulkan/VulkanImage.cpp +++ b/Common/GPU/Vulkan/VulkanImage.cpp @@ -69,7 +69,7 @@ bool VulkanTexture::CreateDirect(VkCommandBuffer cmd, VulkanDeviceAllocator *all image_create_info.usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT; } - VkResult res = vkCreateImage(vulkan_->GetDevice(), &image_create_info, NULL, &image_); + VkResult res = ppsspp_vkCreateImage(vulkan_->GetDevice(), &image_create_info, NULL, &image_); if (res != VK_SUCCESS) { _assert_(res == VK_ERROR_OUT_OF_HOST_MEMORY || res == VK_ERROR_OUT_OF_DEVICE_MEMORY || res == VK_ERROR_TOO_MANY_OBJECTS); ERROR_LOG(G3D, "vkCreateImage failed: %s", VulkanResultToString(res)); @@ -107,7 +107,7 @@ bool VulkanTexture::CreateDirect(VkCommandBuffer cmd, VulkanDeviceAllocator *all bool pass = vulkan_->MemoryTypeFromProperties(mem_reqs.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &mem_alloc.memoryTypeIndex); _assert_(pass); - res = vkAllocateMemory(vulkan_->GetDevice(), &mem_alloc, NULL, &mem_); + res = ppsspp_vkAllocateMemory(vulkan_->GetDevice(), &mem_alloc, NULL, &mem_); if (res != VK_SUCCESS) { ERROR_LOG(G3D, "vkAllocateMemory failed: %s", VulkanResultToString(res)); _assert_msg_(res != VK_ERROR_TOO_MANY_OBJECTS, "Too many Vulkan memory objects!"); @@ -118,7 +118,7 @@ bool VulkanTexture::CreateDirect(VkCommandBuffer cmd, VulkanDeviceAllocator *all offset_ = 0; } - res = vkBindImageMemory(vulkan_->GetDevice(), image_, mem_, offset_); + res = ppsspp_vkBindImageMemory(vulkan_->GetDevice(), image_, mem_, offset_); if (res != VK_SUCCESS) { ERROR_LOG(G3D, "vkBindImageMemory failed: %s", VulkanResultToString(res)); // This leaks the image and memory. Should not really happen though... @@ -160,7 +160,7 @@ bool VulkanTexture::CreateDirect(VkCommandBuffer cmd, VulkanDeviceAllocator *all view_info.subresourceRange.baseArrayLayer = 0; view_info.subresourceRange.layerCount = 1; - res = vkCreateImageView(vulkan_->GetDevice(), &view_info, NULL, &view_); + res = ppsspp_vkCreateImageView(vulkan_->GetDevice(), &view_info, NULL, &view_); if (res != VK_SUCCESS) { ERROR_LOG(G3D, "vkCreateImageView failed: %s", VulkanResultToString(res)); // This leaks the image. @@ -184,7 +184,7 @@ void VulkanTexture::UploadMip(VkCommandBuffer cmd, int mip, int mipWidth, int mi copy_region.imageSubresource.baseArrayLayer = 0; copy_region.imageSubresource.layerCount = 1; - vkCmdCopyBufferToImage(cmd, buffer, image_, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, ©_region); + ppsspp_vkCmdCopyBufferToImage(cmd, buffer, image_, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, ©_region); } void VulkanTexture::ClearMip(VkCommandBuffer cmd, int mip, uint32_t value) { @@ -198,7 +198,7 @@ void VulkanTexture::ClearMip(VkCommandBuffer cmd, int mip, uint32_t value) { range.layerCount = 1; range.baseMipLevel = mip; range.levelCount = 1; - vkCmdClearColorImage(cmd, image_, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &clearVal, 1, &range); + ppsspp_vkCmdClearColorImage(cmd, image_, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &clearVal, 1, &range); } // Low-quality mipmap generation by bilinear blit, but works okay. @@ -230,7 +230,7 @@ void VulkanTexture::GenerateMip(VkCommandBuffer cmd, int mip, VkImageLayout imag VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_TRANSFER_READ_BIT); - vkCmdBlitImage(cmd, image_, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, image_, imageLayout, 1, &blit, VK_FILTER_LINEAR); + ppsspp_vkCmdBlitImage(cmd, image_, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, image_, imageLayout, 1, &blit, VK_FILTER_LINEAR); TransitionImageLayout2(cmd, image_, mip - 1, 1, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, imageLayout, @@ -267,7 +267,7 @@ VkImageView VulkanTexture::CreateViewForMip(int mip) { view_info.subresourceRange.baseArrayLayer = 0; view_info.subresourceRange.layerCount = 1; VkImageView view; - VkResult res = vkCreateImageView(vulkan_->GetDevice(), &view_info, NULL, &view); + VkResult res = ppsspp_vkCreateImageView(vulkan_->GetDevice(), &view_info, NULL, &view); _assert_(res == VK_SUCCESS); return view; } diff --git a/Common/GPU/Vulkan/VulkanLoader.cpp b/Common/GPU/Vulkan/VulkanLoader.cpp index b9465f473ac7..2de7aa48631a 100644 --- a/Common/GPU/Vulkan/VulkanLoader.cpp +++ b/Common/GPU/Vulkan/VulkanLoader.cpp @@ -28,194 +28,194 @@ #include #endif -PFN_vkCreateInstance vkCreateInstance; -PFN_vkDestroyInstance vkDestroyInstance; -PFN_vkEnumeratePhysicalDevices vkEnumeratePhysicalDevices; -PFN_vkGetPhysicalDeviceFeatures vkGetPhysicalDeviceFeatures; -PFN_vkGetPhysicalDeviceFormatProperties vkGetPhysicalDeviceFormatProperties; -PFN_vkGetPhysicalDeviceImageFormatProperties vkGetPhysicalDeviceImageFormatProperties; -PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties; -PFN_vkGetPhysicalDeviceQueueFamilyProperties vkGetPhysicalDeviceQueueFamilyProperties; -PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties; -PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr; -PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr; -PFN_vkCreateDevice vkCreateDevice; -PFN_vkDestroyDevice vkDestroyDevice; -PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties; -PFN_vkEnumerateDeviceExtensionProperties vkEnumerateDeviceExtensionProperties; -PFN_vkEnumerateInstanceLayerProperties vkEnumerateInstanceLayerProperties; -PFN_vkEnumerateDeviceLayerProperties vkEnumerateDeviceLayerProperties; -PFN_vkGetDeviceQueue vkGetDeviceQueue; -PFN_vkQueueSubmit vkQueueSubmit; -PFN_vkQueueWaitIdle vkQueueWaitIdle; -PFN_vkDeviceWaitIdle vkDeviceWaitIdle; -PFN_vkAllocateMemory vkAllocateMemory; -PFN_vkFreeMemory vkFreeMemory; -PFN_vkMapMemory vkMapMemory; -PFN_vkUnmapMemory vkUnmapMemory; -PFN_vkFlushMappedMemoryRanges vkFlushMappedMemoryRanges; -PFN_vkInvalidateMappedMemoryRanges vkInvalidateMappedMemoryRanges; -PFN_vkGetDeviceMemoryCommitment vkGetDeviceMemoryCommitment; -PFN_vkBindBufferMemory vkBindBufferMemory; -PFN_vkBindImageMemory vkBindImageMemory; -PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements; -PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements; -PFN_vkGetImageSparseMemoryRequirements vkGetImageSparseMemoryRequirements; -PFN_vkGetPhysicalDeviceSparseImageFormatProperties vkGetPhysicalDeviceSparseImageFormatProperties; -PFN_vkQueueBindSparse vkQueueBindSparse; -PFN_vkCreateFence vkCreateFence; -PFN_vkDestroyFence vkDestroyFence; -PFN_vkGetFenceStatus vkGetFenceStatus; -PFN_vkCreateSemaphore vkCreateSemaphore; -PFN_vkDestroySemaphore vkDestroySemaphore; -PFN_vkCreateEvent vkCreateEvent; -PFN_vkDestroyEvent vkDestroyEvent; -PFN_vkGetEventStatus vkGetEventStatus; -PFN_vkSetEvent vkSetEvent; -PFN_vkResetEvent vkResetEvent; -PFN_vkCreateQueryPool vkCreateQueryPool; -PFN_vkDestroyQueryPool vkDestroyQueryPool; -PFN_vkGetQueryPoolResults vkGetQueryPoolResults; -PFN_vkCreateBuffer vkCreateBuffer; -PFN_vkDestroyBuffer vkDestroyBuffer; -PFN_vkCreateBufferView vkCreateBufferView; -PFN_vkDestroyBufferView vkDestroyBufferView; -PFN_vkCreateImage vkCreateImage; -PFN_vkDestroyImage vkDestroyImage; -PFN_vkGetImageSubresourceLayout vkGetImageSubresourceLayout; -PFN_vkCreateImageView vkCreateImageView; -PFN_vkDestroyImageView vkDestroyImageView; -PFN_vkCreateShaderModule vkCreateShaderModule; -PFN_vkDestroyShaderModule vkDestroyShaderModule; -PFN_vkCreatePipelineCache vkCreatePipelineCache; -PFN_vkDestroyPipelineCache vkDestroyPipelineCache; -PFN_vkGetPipelineCacheData vkGetPipelineCacheData; -PFN_vkMergePipelineCaches vkMergePipelineCaches; -PFN_vkCreateGraphicsPipelines vkCreateGraphicsPipelines; -PFN_vkCreateComputePipelines vkCreateComputePipelines; -PFN_vkDestroyPipeline vkDestroyPipeline; -PFN_vkCreatePipelineLayout vkCreatePipelineLayout; -PFN_vkDestroyPipelineLayout vkDestroyPipelineLayout; -PFN_vkCreateSampler vkCreateSampler; -PFN_vkDestroySampler vkDestroySampler; -PFN_vkCreateDescriptorSetLayout vkCreateDescriptorSetLayout; -PFN_vkDestroyDescriptorSetLayout vkDestroyDescriptorSetLayout; -PFN_vkCreateDescriptorPool vkCreateDescriptorPool; -PFN_vkDestroyDescriptorPool vkDestroyDescriptorPool; -PFN_vkResetDescriptorPool vkResetDescriptorPool; -PFN_vkAllocateDescriptorSets vkAllocateDescriptorSets; -PFN_vkFreeDescriptorSets vkFreeDescriptorSets; -PFN_vkUpdateDescriptorSets vkUpdateDescriptorSets; -PFN_vkCreateFramebuffer vkCreateFramebuffer; -PFN_vkDestroyFramebuffer vkDestroyFramebuffer; -PFN_vkCreateRenderPass vkCreateRenderPass; -PFN_vkDestroyRenderPass vkDestroyRenderPass; -PFN_vkGetRenderAreaGranularity vkGetRenderAreaGranularity; -PFN_vkCreateCommandPool vkCreateCommandPool; -PFN_vkDestroyCommandPool vkDestroyCommandPool; -PFN_vkResetCommandPool vkResetCommandPool; -PFN_vkAllocateCommandBuffers vkAllocateCommandBuffers; -PFN_vkFreeCommandBuffers vkFreeCommandBuffers; +PFN_vkCreateInstance ppsspp_vkCreateInstance; +PFN_vkDestroyInstance ppsspp_vkDestroyInstance; +PFN_vkEnumeratePhysicalDevices ppsspp_vkEnumeratePhysicalDevices; +PFN_vkGetPhysicalDeviceFeatures ppsspp_vkGetPhysicalDeviceFeatures; +PFN_vkGetPhysicalDeviceFormatProperties ppsspp_vkGetPhysicalDeviceFormatProperties; +PFN_vkGetPhysicalDeviceImageFormatProperties ppsspp_vkGetPhysicalDeviceImageFormatProperties; +PFN_vkGetPhysicalDeviceProperties ppsspp_vkGetPhysicalDeviceProperties; +PFN_vkGetPhysicalDeviceQueueFamilyProperties ppsspp_vkGetPhysicalDeviceQueueFamilyProperties; +PFN_vkGetPhysicalDeviceMemoryProperties ppsspp_vkGetPhysicalDeviceMemoryProperties; +PFN_vkGetInstanceProcAddr ppsspp_vkGetInstanceProcAddr; +PFN_vkGetDeviceProcAddr ppsspp_vkGetDeviceProcAddr; +PFN_vkCreateDevice ppsspp_vkCreateDevice; +PFN_vkDestroyDevice ppsspp_vkDestroyDevice; +PFN_vkEnumerateInstanceExtensionProperties ppsspp_vkEnumerateInstanceExtensionProperties; +PFN_vkEnumerateDeviceExtensionProperties ppsspp_vkEnumerateDeviceExtensionProperties; +PFN_vkEnumerateInstanceLayerProperties ppsspp_vkEnumerateInstanceLayerProperties; +PFN_vkEnumerateDeviceLayerProperties ppsspp_vkEnumerateDeviceLayerProperties; +PFN_vkGetDeviceQueue ppsspp_vkGetDeviceQueue; +PFN_vkQueueSubmit ppsspp_vkQueueSubmit; +PFN_vkQueueWaitIdle ppsspp_vkQueueWaitIdle; +PFN_vkDeviceWaitIdle ppsspp_vkDeviceWaitIdle; +PFN_vkAllocateMemory ppsspp_vkAllocateMemory; +PFN_vkFreeMemory ppsspp_vkFreeMemory; +PFN_vkMapMemory ppsspp_vkMapMemory; +PFN_vkUnmapMemory ppsspp_vkUnmapMemory; +PFN_vkFlushMappedMemoryRanges ppsspp_vkFlushMappedMemoryRanges; +PFN_vkInvalidateMappedMemoryRanges ppsspp_vkInvalidateMappedMemoryRanges; +PFN_vkGetDeviceMemoryCommitment ppsspp_vkGetDeviceMemoryCommitment; +PFN_vkBindBufferMemory ppsspp_vkBindBufferMemory; +PFN_vkBindImageMemory ppsspp_vkBindImageMemory; +PFN_vkGetBufferMemoryRequirements ppsspp_vkGetBufferMemoryRequirements; +PFN_vkGetImageMemoryRequirements ppsspp_vkGetImageMemoryRequirements; +PFN_vkGetImageSparseMemoryRequirements ppsspp_vkGetImageSparseMemoryRequirements; +PFN_vkGetPhysicalDeviceSparseImageFormatProperties ppsspp_vkGetPhysicalDeviceSparseImageFormatProperties; +PFN_vkQueueBindSparse ppsspp_vkQueueBindSparse; +PFN_vkCreateFence ppsspp_vkCreateFence; +PFN_vkDestroyFence ppsspp_vkDestroyFence; +PFN_vkGetFenceStatus ppsspp_vkGetFenceStatus; +PFN_vkCreateSemaphore ppsspp_vkCreateSemaphore; +PFN_vkDestroySemaphore ppsspp_vkDestroySemaphore; +PFN_vkCreateEvent ppsspp_vkCreateEvent; +PFN_vkDestroyEvent ppsspp_vkDestroyEvent; +PFN_vkGetEventStatus ppsspp_vkGetEventStatus; +PFN_vkSetEvent ppsspp_vkSetEvent; +PFN_vkResetEvent ppsspp_vkResetEvent; +PFN_vkCreateQueryPool ppsspp_vkCreateQueryPool; +PFN_vkDestroyQueryPool ppsspp_vkDestroyQueryPool; +PFN_vkGetQueryPoolResults ppsspp_vkGetQueryPoolResults; +PFN_vkCreateBuffer ppsspp_vkCreateBuffer; +PFN_vkDestroyBuffer ppsspp_vkDestroyBuffer; +PFN_vkCreateBufferView ppsspp_vkCreateBufferView; +PFN_vkDestroyBufferView ppsspp_vkDestroyBufferView; +PFN_vkCreateImage ppsspp_vkCreateImage; +PFN_vkDestroyImage ppsspp_vkDestroyImage; +PFN_vkGetImageSubresourceLayout ppsspp_vkGetImageSubresourceLayout; +PFN_vkCreateImageView ppsspp_vkCreateImageView; +PFN_vkDestroyImageView ppsspp_vkDestroyImageView; +PFN_vkCreateShaderModule ppsspp_vkCreateShaderModule; +PFN_vkDestroyShaderModule ppsspp_vkDestroyShaderModule; +PFN_vkCreatePipelineCache ppsspp_vkCreatePipelineCache; +PFN_vkDestroyPipelineCache ppsspp_vkDestroyPipelineCache; +PFN_vkGetPipelineCacheData ppsspp_vkGetPipelineCacheData; +PFN_vkMergePipelineCaches ppsspp_vkMergePipelineCaches; +PFN_vkCreateGraphicsPipelines ppsspp_vkCreateGraphicsPipelines; +PFN_vkCreateComputePipelines ppsspp_vkCreateComputePipelines; +PFN_vkDestroyPipeline ppsspp_vkDestroyPipeline; +PFN_vkCreatePipelineLayout ppsspp_vkCreatePipelineLayout; +PFN_vkDestroyPipelineLayout ppsspp_vkDestroyPipelineLayout; +PFN_vkCreateSampler ppsspp_vkCreateSampler; +PFN_vkDestroySampler ppsspp_vkDestroySampler; +PFN_vkCreateDescriptorSetLayout ppsspp_vkCreateDescriptorSetLayout; +PFN_vkDestroyDescriptorSetLayout ppsspp_vkDestroyDescriptorSetLayout; +PFN_vkCreateDescriptorPool ppsspp_vkCreateDescriptorPool; +PFN_vkDestroyDescriptorPool ppsspp_vkDestroyDescriptorPool; +PFN_vkResetDescriptorPool ppsspp_vkResetDescriptorPool; +PFN_vkAllocateDescriptorSets ppsspp_vkAllocateDescriptorSets; +PFN_vkFreeDescriptorSets ppsspp_vkFreeDescriptorSets; +PFN_vkUpdateDescriptorSets ppsspp_vkUpdateDescriptorSets; +PFN_vkCreateFramebuffer ppsspp_vkCreateFramebuffer; +PFN_vkDestroyFramebuffer ppsspp_vkDestroyFramebuffer; +PFN_vkCreateRenderPass ppsspp_vkCreateRenderPass; +PFN_vkDestroyRenderPass ppsspp_vkDestroyRenderPass; +PFN_vkGetRenderAreaGranularity ppsspp_vkGetRenderAreaGranularity; +PFN_vkCreateCommandPool ppsspp_vkCreateCommandPool; +PFN_vkDestroyCommandPool ppsspp_vkDestroyCommandPool; +PFN_vkResetCommandPool ppsspp_vkResetCommandPool; +PFN_vkAllocateCommandBuffers ppsspp_vkAllocateCommandBuffers; +PFN_vkFreeCommandBuffers ppsspp_vkFreeCommandBuffers; // Used frequently together -PFN_vkCmdBindPipeline vkCmdBindPipeline; -PFN_vkCmdSetViewport vkCmdSetViewport; -PFN_vkCmdSetScissor vkCmdSetScissor; -PFN_vkCmdSetBlendConstants vkCmdSetBlendConstants; -PFN_vkCmdSetStencilCompareMask vkCmdSetStencilCompareMask; -PFN_vkCmdSetStencilWriteMask vkCmdSetStencilWriteMask; -PFN_vkCmdSetStencilReference vkCmdSetStencilReference; -PFN_vkCmdBindDescriptorSets vkCmdBindDescriptorSets; -PFN_vkCmdBindIndexBuffer vkCmdBindIndexBuffer; -PFN_vkCmdBindVertexBuffers vkCmdBindVertexBuffers; -PFN_vkCmdDraw vkCmdDraw; -PFN_vkCmdDrawIndexed vkCmdDrawIndexed; -PFN_vkCmdPipelineBarrier vkCmdPipelineBarrier; -PFN_vkCmdPushConstants vkCmdPushConstants; +PFN_vkCmdBindPipeline ppsspp_vkCmdBindPipeline; +PFN_vkCmdSetViewport ppsspp_vkCmdSetViewport; +PFN_vkCmdSetScissor ppsspp_vkCmdSetScissor; +PFN_vkCmdSetBlendConstants ppsspp_vkCmdSetBlendConstants; +PFN_vkCmdSetStencilCompareMask ppsspp_vkCmdSetStencilCompareMask; +PFN_vkCmdSetStencilWriteMask ppsspp_vkCmdSetStencilWriteMask; +PFN_vkCmdSetStencilReference ppsspp_vkCmdSetStencilReference; +PFN_vkCmdBindDescriptorSets ppsspp_vkCmdBindDescriptorSets; +PFN_vkCmdBindIndexBuffer ppsspp_vkCmdBindIndexBuffer; +PFN_vkCmdBindVertexBuffers ppsspp_vkCmdBindVertexBuffers; +PFN_vkCmdDraw ppsspp_vkCmdDraw; +PFN_vkCmdDrawIndexed ppsspp_vkCmdDrawIndexed; +PFN_vkCmdPipelineBarrier ppsspp_vkCmdPipelineBarrier; +PFN_vkCmdPushConstants ppsspp_vkCmdPushConstants; // Every frame to a few times per frame -PFN_vkWaitForFences vkWaitForFences; -PFN_vkResetFences vkResetFences; -PFN_vkBeginCommandBuffer vkBeginCommandBuffer; -PFN_vkEndCommandBuffer vkEndCommandBuffer; -PFN_vkResetCommandBuffer vkResetCommandBuffer; -PFN_vkCmdClearAttachments vkCmdClearAttachments; -PFN_vkCmdSetEvent vkCmdSetEvent; -PFN_vkCmdResetEvent vkCmdResetEvent; -PFN_vkCmdWaitEvents vkCmdWaitEvents; -PFN_vkCmdBeginRenderPass vkCmdBeginRenderPass; -PFN_vkCmdEndRenderPass vkCmdEndRenderPass; -PFN_vkCmdCopyBuffer vkCmdCopyBuffer; -PFN_vkCmdCopyImage vkCmdCopyImage; -PFN_vkCmdBlitImage vkCmdBlitImage; -PFN_vkCmdCopyBufferToImage vkCmdCopyBufferToImage; -PFN_vkCmdCopyImageToBuffer vkCmdCopyImageToBuffer; +PFN_vkWaitForFences ppsspp_vkWaitForFences; +PFN_vkResetFences ppsspp_vkResetFences; +PFN_vkBeginCommandBuffer ppsspp_vkBeginCommandBuffer; +PFN_vkEndCommandBuffer ppsspp_vkEndCommandBuffer; +PFN_vkResetCommandBuffer ppsspp_vkResetCommandBuffer; +PFN_vkCmdClearAttachments ppsspp_vkCmdClearAttachments; +PFN_vkCmdSetEvent ppsspp_vkCmdSetEvent; +PFN_vkCmdResetEvent ppsspp_vkCmdResetEvent; +PFN_vkCmdWaitEvents ppsspp_vkCmdWaitEvents; +PFN_vkCmdBeginRenderPass ppsspp_vkCmdBeginRenderPass; +PFN_vkCmdEndRenderPass ppsspp_vkCmdEndRenderPass; +PFN_vkCmdCopyBuffer ppsspp_vkCmdCopyBuffer; +PFN_vkCmdCopyImage ppsspp_vkCmdCopyImage; +PFN_vkCmdBlitImage ppsspp_vkCmdBlitImage; +PFN_vkCmdCopyBufferToImage ppsspp_vkCmdCopyBufferToImage; +PFN_vkCmdCopyImageToBuffer ppsspp_vkCmdCopyImageToBuffer; // Rare or not used -PFN_vkCmdSetDepthBounds vkCmdSetDepthBounds; -PFN_vkCmdSetLineWidth vkCmdSetLineWidth; -PFN_vkCmdSetDepthBias vkCmdSetDepthBias; -PFN_vkCmdDrawIndirect vkCmdDrawIndirect; -PFN_vkCmdDrawIndexedIndirect vkCmdDrawIndexedIndirect; -PFN_vkCmdDispatch vkCmdDispatch; -PFN_vkCmdDispatchIndirect vkCmdDispatchIndirect; -PFN_vkCmdUpdateBuffer vkCmdUpdateBuffer; -PFN_vkCmdFillBuffer vkCmdFillBuffer; -PFN_vkCmdClearColorImage vkCmdClearColorImage; -PFN_vkCmdClearDepthStencilImage vkCmdClearDepthStencilImage; -PFN_vkCmdResolveImage vkCmdResolveImage; -PFN_vkCmdBeginQuery vkCmdBeginQuery; -PFN_vkCmdEndQuery vkCmdEndQuery; -PFN_vkCmdResetQueryPool vkCmdResetQueryPool; -PFN_vkCmdWriteTimestamp vkCmdWriteTimestamp; -PFN_vkCmdCopyQueryPoolResults vkCmdCopyQueryPoolResults; -PFN_vkCmdNextSubpass vkCmdNextSubpass; -PFN_vkCmdExecuteCommands vkCmdExecuteCommands; +PFN_vkCmdSetDepthBounds ppsspp_vkCmdSetDepthBounds; +PFN_vkCmdSetLineWidth ppsspp_vkCmdSetLineWidth; +PFN_vkCmdSetDepthBias ppsspp_vkCmdSetDepthBias; +PFN_vkCmdDrawIndirect ppsspp_vkCmdDrawIndirect; +PFN_vkCmdDrawIndexedIndirect ppsspp_vkCmdDrawIndexedIndirect; +PFN_vkCmdDispatch ppsspp_vkCmdDispatch; +PFN_vkCmdDispatchIndirect ppsspp_vkCmdDispatchIndirect; +PFN_vkCmdUpdateBuffer ppsspp_vkCmdUpdateBuffer; +PFN_vkCmdFillBuffer ppsspp_vkCmdFillBuffer; +PFN_vkCmdClearColorImage ppsspp_vkCmdClearColorImage; +PFN_vkCmdClearDepthStencilImage ppsspp_vkCmdClearDepthStencilImage; +PFN_vkCmdResolveImage ppsspp_vkCmdResolveImage; +PFN_vkCmdBeginQuery ppsspp_vkCmdBeginQuery; +PFN_vkCmdEndQuery ppsspp_vkCmdEndQuery; +PFN_vkCmdResetQueryPool ppsspp_vkCmdResetQueryPool; +PFN_vkCmdWriteTimestamp ppsspp_vkCmdWriteTimestamp; +PFN_vkCmdCopyQueryPoolResults ppsspp_vkCmdCopyQueryPoolResults; +PFN_vkCmdNextSubpass ppsspp_vkCmdNextSubpass; +PFN_vkCmdExecuteCommands ppsspp_vkCmdExecuteCommands; #ifdef __ANDROID__ -PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR; +PFN_vkCreateAndroidSurfaceKHR ppsspp_vkCreateAndroidSurfaceKHR; #elif defined(_WIN32) -PFN_vkCreateWin32SurfaceKHR vkCreateWin32SurfaceKHR; +PFN_vkCreateWin32SurfaceKHR ppsspp_vkCreateWin32SurfaceKHR; #endif #if defined(VK_USE_PLATFORM_METAL_EXT) -PFN_vkCreateMetalSurfaceEXT vkCreateMetalSurfaceEXT; +PFN_vkCreateMetalSurfaceEXT ppsspp_vkCreateMetalSurfaceEXT; #endif #if defined(VK_USE_PLATFORM_XLIB_KHR) -PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR; +PFN_vkCreateXlibSurfaceKHR ppsspp_vkCreateXlibSurfaceKHR; #endif #if defined(VK_USE_PLATFORM_WAYLAND_KHR) -PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR; +PFN_vkCreateWaylandSurfaceKHR ppsspp_vkCreateWaylandSurfaceKHR; #endif #if defined(VK_USE_PLATFORM_DISPLAY_KHR) -PFN_vkCreateDisplayPlaneSurfaceKHR vkCreateDisplayPlaneSurfaceKHR; +PFN_vkCreateDisplayPlaneSurfaceKHR ppsspp_vkCreateDisplayPlaneSurfaceKHR; #endif -PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR; +PFN_vkDestroySurfaceKHR ppsspp_vkDestroySurfaceKHR; // WSI extension. -PFN_vkGetPhysicalDeviceSurfaceSupportKHR vkGetPhysicalDeviceSurfaceSupportKHR; -PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceCapabilitiesKHR; -PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vkGetPhysicalDeviceSurfaceFormatsKHR; -PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vkGetPhysicalDeviceSurfacePresentModesKHR; -PFN_vkCreateSwapchainKHR vkCreateSwapchainKHR; -PFN_vkDestroySwapchainKHR vkDestroySwapchainKHR; -PFN_vkGetSwapchainImagesKHR vkGetSwapchainImagesKHR; -PFN_vkAcquireNextImageKHR vkAcquireNextImageKHR; -PFN_vkQueuePresentKHR vkQueuePresentKHR; - -PFN_vkCreateDebugUtilsMessengerEXT vkCreateDebugUtilsMessengerEXT; -PFN_vkDestroyDebugUtilsMessengerEXT vkDestroyDebugUtilsMessengerEXT; -PFN_vkCmdBeginDebugUtilsLabelEXT vkCmdBeginDebugUtilsLabelEXT; -PFN_vkCmdEndDebugUtilsLabelEXT vkCmdEndDebugUtilsLabelEXT; -PFN_vkCmdInsertDebugUtilsLabelEXT vkCmdInsertDebugUtilsLabelEXT; -PFN_vkSetDebugUtilsObjectNameEXT vkSetDebugUtilsObjectNameEXT; -PFN_vkSetDebugUtilsObjectTagEXT vkSetDebugUtilsObjectTagEXT; - -PFN_vkGetMemoryHostPointerPropertiesEXT vkGetMemoryHostPointerPropertiesEXT; -PFN_vkGetBufferMemoryRequirements2KHR vkGetBufferMemoryRequirements2KHR; -PFN_vkGetImageMemoryRequirements2KHR vkGetImageMemoryRequirements2KHR; -PFN_vkGetPhysicalDeviceProperties2KHR vkGetPhysicalDeviceProperties2KHR; -PFN_vkGetPhysicalDeviceFeatures2KHR vkGetPhysicalDeviceFeatures2KHR; +PFN_vkGetPhysicalDeviceSurfaceSupportKHR ppsspp_vkGetPhysicalDeviceSurfaceSupportKHR; +PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR ppsspp_vkGetPhysicalDeviceSurfaceCapabilitiesKHR; +PFN_vkGetPhysicalDeviceSurfaceFormatsKHR ppsspp_vkGetPhysicalDeviceSurfaceFormatsKHR; +PFN_vkGetPhysicalDeviceSurfacePresentModesKHR ppsspp_vkGetPhysicalDeviceSurfacePresentModesKHR; +PFN_vkCreateSwapchainKHR ppsspp_vkCreateSwapchainKHR; +PFN_vkDestroySwapchainKHR ppsspp_vkDestroySwapchainKHR; +PFN_vkGetSwapchainImagesKHR ppsspp_vkGetSwapchainImagesKHR; +PFN_vkAcquireNextImageKHR ppsspp_vkAcquireNextImageKHR; +PFN_vkQueuePresentKHR ppsspp_vkQueuePresentKHR; + +PFN_vkCreateDebugUtilsMessengerEXT ppsspp_vkCreateDebugUtilsMessengerEXT; +PFN_vkDestroyDebugUtilsMessengerEXT ppsspp_vkDestroyDebugUtilsMessengerEXT; +PFN_vkCmdBeginDebugUtilsLabelEXT ppsspp_vkCmdBeginDebugUtilsLabelEXT; +PFN_vkCmdEndDebugUtilsLabelEXT ppsspp_vkCmdEndDebugUtilsLabelEXT; +PFN_vkCmdInsertDebugUtilsLabelEXT ppsspp_vkCmdInsertDebugUtilsLabelEXT; +PFN_vkSetDebugUtilsObjectNameEXT ppsspp_vkSetDebugUtilsObjectNameEXT; +PFN_vkSetDebugUtilsObjectTagEXT ppsspp_vkSetDebugUtilsObjectTagEXT; + +PFN_vkGetMemoryHostPointerPropertiesEXT ppsspp_vkGetMemoryHostPointerPropertiesEXT; +PFN_vkGetBufferMemoryRequirements2KHR ppsspp_vkGetBufferMemoryRequirements2KHR; +PFN_vkGetImageMemoryRequirements2KHR ppsspp_vkGetImageMemoryRequirements2KHR; +PFN_vkGetPhysicalDeviceProperties2KHR ppsspp_vkGetPhysicalDeviceProperties2KHR; +PFN_vkGetPhysicalDeviceFeatures2KHR ppsspp_vkGetPhysicalDeviceFeatures2KHR; #ifdef _WIN32 static HINSTANCE vulkanLibrary; @@ -228,9 +228,9 @@ const char *VulkanResultToString(VkResult res); bool g_vulkanAvailabilityChecked = false; bool g_vulkanMayBeAvailable = false; -#define LOAD_INSTANCE_FUNC(instance, x) x = (PFN_ ## x)vkGetInstanceProcAddr(instance, #x); if (!x) {INFO_LOG(G3D, "Missing (instance): %s", #x);} -#define LOAD_DEVICE_FUNC(instance, x) x = (PFN_ ## x)vkGetDeviceProcAddr(instance, #x); if (!x) {INFO_LOG(G3D, "Missing (device): %s", #x);} -#define LOAD_GLOBAL_FUNC(x) x = (PFN_ ## x)dlsym(vulkanLibrary, #x); if (!x) {INFO_LOG(G3D,"Missing (global): %s", #x);} +#define LOAD_INSTANCE_FUNC(instance, x) ppsspp_ ## x = (PFN_ ## x)ppsspp_vkGetInstanceProcAddr(instance, #x); if (!ppsspp_ ## x) {INFO_LOG(G3D, "Missing (instance): %s", #x);} +#define LOAD_DEVICE_FUNC(instance, x) ppsspp_ ## x = (PFN_ ## x)ppsspp_vkGetDeviceProcAddr(instance, #x); if (!ppsspp_ ## x) {INFO_LOG(G3D, "Missing (device): %s", #x);} +#define LOAD_GLOBAL_FUNC(x) ppsspp_##x = (PFN_ ## x)dlsym(vulkanLibrary, #x); if (!ppsspp_ ## x) {INFO_LOG(G3D,"Missing (global): %s", #x);} #define LOAD_GLOBAL_FUNC_LOCAL(lib, x) (PFN_ ## x)dlsym(lib, #x); @@ -482,7 +482,7 @@ bool VulkanLoad() { LOAD_GLOBAL_FUNC(vkEnumerateInstanceExtensionProperties); LOAD_GLOBAL_FUNC(vkEnumerateInstanceLayerProperties); - if (vkCreateInstance && vkGetInstanceProcAddr && vkGetDeviceProcAddr && vkEnumerateInstanceExtensionProperties && vkEnumerateInstanceLayerProperties) { + if (ppsspp_vkCreateInstance && ppsspp_vkGetInstanceProcAddr && ppsspp_vkGetDeviceProcAddr && ppsspp_vkEnumerateInstanceExtensionProperties && ppsspp_vkEnumerateInstanceLayerProperties) { INFO_LOG(G3D, "VulkanLoad: Base functions loaded."); return true; } else { diff --git a/Common/GPU/Vulkan/VulkanLoader.h b/Common/GPU/Vulkan/VulkanLoader.h index 02a2b947f072..5e832ae86137 100644 --- a/Common/GPU/Vulkan/VulkanLoader.h +++ b/Common/GPU/Vulkan/VulkanLoader.h @@ -33,189 +33,189 @@ #include "ext/vulkan/vulkan.h" -extern PFN_vkCreateInstance vkCreateInstance; -extern PFN_vkDestroyInstance vkDestroyInstance; -extern PFN_vkEnumeratePhysicalDevices vkEnumeratePhysicalDevices; -extern PFN_vkGetPhysicalDeviceFeatures vkGetPhysicalDeviceFeatures; -extern PFN_vkGetPhysicalDeviceFormatProperties vkGetPhysicalDeviceFormatProperties; -extern PFN_vkGetPhysicalDeviceImageFormatProperties vkGetPhysicalDeviceImageFormatProperties; -extern PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties; -extern PFN_vkGetPhysicalDeviceQueueFamilyProperties vkGetPhysicalDeviceQueueFamilyProperties; -extern PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties; -extern PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr; -extern PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr; -extern PFN_vkCreateDevice vkCreateDevice; -extern PFN_vkDestroyDevice vkDestroyDevice; -extern PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties; -extern PFN_vkEnumerateDeviceExtensionProperties vkEnumerateDeviceExtensionProperties; -extern PFN_vkEnumerateInstanceLayerProperties vkEnumerateInstanceLayerProperties; -extern PFN_vkEnumerateDeviceLayerProperties vkEnumerateDeviceLayerProperties; -extern PFN_vkGetDeviceQueue vkGetDeviceQueue; -extern PFN_vkQueueSubmit vkQueueSubmit; -extern PFN_vkQueueWaitIdle vkQueueWaitIdle; -extern PFN_vkDeviceWaitIdle vkDeviceWaitIdle; -extern PFN_vkAllocateMemory vkAllocateMemory; -extern PFN_vkFreeMemory vkFreeMemory; -extern PFN_vkMapMemory vkMapMemory; -extern PFN_vkUnmapMemory vkUnmapMemory; -extern PFN_vkFlushMappedMemoryRanges vkFlushMappedMemoryRanges; -extern PFN_vkInvalidateMappedMemoryRanges vkInvalidateMappedMemoryRanges; -extern PFN_vkGetDeviceMemoryCommitment vkGetDeviceMemoryCommitment; -extern PFN_vkBindBufferMemory vkBindBufferMemory; -extern PFN_vkBindImageMemory vkBindImageMemory; -extern PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements; -extern PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements; -extern PFN_vkGetImageSparseMemoryRequirements vkGetImageSparseMemoryRequirements; -extern PFN_vkGetPhysicalDeviceSparseImageFormatProperties vkGetPhysicalDeviceSparseImageFormatProperties; -extern PFN_vkQueueBindSparse vkQueueBindSparse; -extern PFN_vkCreateFence vkCreateFence; -extern PFN_vkDestroyFence vkDestroyFence; -extern PFN_vkResetFences vkResetFences; -extern PFN_vkGetFenceStatus vkGetFenceStatus; -extern PFN_vkWaitForFences vkWaitForFences; -extern PFN_vkCreateSemaphore vkCreateSemaphore; -extern PFN_vkDestroySemaphore vkDestroySemaphore; -extern PFN_vkCreateEvent vkCreateEvent; -extern PFN_vkDestroyEvent vkDestroyEvent; -extern PFN_vkGetEventStatus vkGetEventStatus; -extern PFN_vkSetEvent vkSetEvent; -extern PFN_vkResetEvent vkResetEvent; -extern PFN_vkCreateQueryPool vkCreateQueryPool; -extern PFN_vkDestroyQueryPool vkDestroyQueryPool; -extern PFN_vkGetQueryPoolResults vkGetQueryPoolResults; -extern PFN_vkCreateBuffer vkCreateBuffer; -extern PFN_vkDestroyBuffer vkDestroyBuffer; -extern PFN_vkCreateBufferView vkCreateBufferView; -extern PFN_vkDestroyBufferView vkDestroyBufferView; -extern PFN_vkCreateImage vkCreateImage; -extern PFN_vkDestroyImage vkDestroyImage; -extern PFN_vkGetImageSubresourceLayout vkGetImageSubresourceLayout; -extern PFN_vkCreateImageView vkCreateImageView; -extern PFN_vkDestroyImageView vkDestroyImageView; -extern PFN_vkCreateShaderModule vkCreateShaderModule; -extern PFN_vkDestroyShaderModule vkDestroyShaderModule; -extern PFN_vkCreatePipelineCache vkCreatePipelineCache; -extern PFN_vkDestroyPipelineCache vkDestroyPipelineCache; -extern PFN_vkGetPipelineCacheData vkGetPipelineCacheData; -extern PFN_vkMergePipelineCaches vkMergePipelineCaches; -extern PFN_vkCreateGraphicsPipelines vkCreateGraphicsPipelines; -extern PFN_vkCreateComputePipelines vkCreateComputePipelines; -extern PFN_vkDestroyPipeline vkDestroyPipeline; -extern PFN_vkCreatePipelineLayout vkCreatePipelineLayout; -extern PFN_vkDestroyPipelineLayout vkDestroyPipelineLayout; -extern PFN_vkCreateSampler vkCreateSampler; -extern PFN_vkDestroySampler vkDestroySampler; -extern PFN_vkCreateDescriptorSetLayout vkCreateDescriptorSetLayout; -extern PFN_vkDestroyDescriptorSetLayout vkDestroyDescriptorSetLayout; -extern PFN_vkCreateDescriptorPool vkCreateDescriptorPool; -extern PFN_vkDestroyDescriptorPool vkDestroyDescriptorPool; -extern PFN_vkResetDescriptorPool vkResetDescriptorPool; -extern PFN_vkAllocateDescriptorSets vkAllocateDescriptorSets; -extern PFN_vkFreeDescriptorSets vkFreeDescriptorSets; -extern PFN_vkUpdateDescriptorSets vkUpdateDescriptorSets; -extern PFN_vkCreateFramebuffer vkCreateFramebuffer; -extern PFN_vkDestroyFramebuffer vkDestroyFramebuffer; -extern PFN_vkCreateRenderPass vkCreateRenderPass; -extern PFN_vkDestroyRenderPass vkDestroyRenderPass; -extern PFN_vkGetRenderAreaGranularity vkGetRenderAreaGranularity; -extern PFN_vkCreateCommandPool vkCreateCommandPool; -extern PFN_vkDestroyCommandPool vkDestroyCommandPool; -extern PFN_vkResetCommandPool vkResetCommandPool; -extern PFN_vkAllocateCommandBuffers vkAllocateCommandBuffers; -extern PFN_vkFreeCommandBuffers vkFreeCommandBuffers; -extern PFN_vkBeginCommandBuffer vkBeginCommandBuffer; -extern PFN_vkEndCommandBuffer vkEndCommandBuffer; -extern PFN_vkResetCommandBuffer vkResetCommandBuffer; -extern PFN_vkCmdBindPipeline vkCmdBindPipeline; -extern PFN_vkCmdSetViewport vkCmdSetViewport; -extern PFN_vkCmdSetScissor vkCmdSetScissor; -extern PFN_vkCmdSetLineWidth vkCmdSetLineWidth; -extern PFN_vkCmdSetDepthBias vkCmdSetDepthBias; -extern PFN_vkCmdSetBlendConstants vkCmdSetBlendConstants; -extern PFN_vkCmdSetDepthBounds vkCmdSetDepthBounds; -extern PFN_vkCmdSetStencilCompareMask vkCmdSetStencilCompareMask; -extern PFN_vkCmdSetStencilWriteMask vkCmdSetStencilWriteMask; -extern PFN_vkCmdSetStencilReference vkCmdSetStencilReference; -extern PFN_vkCmdBindDescriptorSets vkCmdBindDescriptorSets; -extern PFN_vkCmdBindIndexBuffer vkCmdBindIndexBuffer; -extern PFN_vkCmdBindVertexBuffers vkCmdBindVertexBuffers; -extern PFN_vkCmdDraw vkCmdDraw; -extern PFN_vkCmdDrawIndexed vkCmdDrawIndexed; -extern PFN_vkCmdDrawIndirect vkCmdDrawIndirect; -extern PFN_vkCmdDrawIndexedIndirect vkCmdDrawIndexedIndirect; -extern PFN_vkCmdDispatch vkCmdDispatch; -extern PFN_vkCmdDispatchIndirect vkCmdDispatchIndirect; -extern PFN_vkCmdCopyBuffer vkCmdCopyBuffer; -extern PFN_vkCmdCopyImage vkCmdCopyImage; -extern PFN_vkCmdBlitImage vkCmdBlitImage; -extern PFN_vkCmdCopyBufferToImage vkCmdCopyBufferToImage; -extern PFN_vkCmdCopyImageToBuffer vkCmdCopyImageToBuffer; -extern PFN_vkCmdUpdateBuffer vkCmdUpdateBuffer; -extern PFN_vkCmdFillBuffer vkCmdFillBuffer; -extern PFN_vkCmdClearColorImage vkCmdClearColorImage; -extern PFN_vkCmdClearDepthStencilImage vkCmdClearDepthStencilImage; -extern PFN_vkCmdClearAttachments vkCmdClearAttachments; -extern PFN_vkCmdResolveImage vkCmdResolveImage; -extern PFN_vkCmdSetEvent vkCmdSetEvent; -extern PFN_vkCmdResetEvent vkCmdResetEvent; -extern PFN_vkCmdWaitEvents vkCmdWaitEvents; -extern PFN_vkCmdPipelineBarrier vkCmdPipelineBarrier; -extern PFN_vkCmdBeginQuery vkCmdBeginQuery; -extern PFN_vkCmdEndQuery vkCmdEndQuery; -extern PFN_vkCmdResetQueryPool vkCmdResetQueryPool; -extern PFN_vkCmdWriteTimestamp vkCmdWriteTimestamp; -extern PFN_vkCmdCopyQueryPoolResults vkCmdCopyQueryPoolResults; -extern PFN_vkCmdPushConstants vkCmdPushConstants; -extern PFN_vkCmdBeginRenderPass vkCmdBeginRenderPass; -extern PFN_vkCmdNextSubpass vkCmdNextSubpass; -extern PFN_vkCmdEndRenderPass vkCmdEndRenderPass; -extern PFN_vkCmdExecuteCommands vkCmdExecuteCommands; +extern PFN_vkCreateInstance ppsspp_vkCreateInstance; +extern PFN_vkDestroyInstance ppsspp_vkDestroyInstance; +extern PFN_vkEnumeratePhysicalDevices ppsspp_vkEnumeratePhysicalDevices; +extern PFN_vkGetPhysicalDeviceFeatures ppsspp_vkGetPhysicalDeviceFeatures; +extern PFN_vkGetPhysicalDeviceFormatProperties ppsspp_vkGetPhysicalDeviceFormatProperties; +extern PFN_vkGetPhysicalDeviceImageFormatProperties ppsspp_vkGetPhysicalDeviceImageFormatProperties; +extern PFN_vkGetPhysicalDeviceProperties ppsspp_vkGetPhysicalDeviceProperties; +extern PFN_vkGetPhysicalDeviceQueueFamilyProperties ppsspp_vkGetPhysicalDeviceQueueFamilyProperties; +extern PFN_vkGetPhysicalDeviceMemoryProperties ppsspp_vkGetPhysicalDeviceMemoryProperties; +extern PFN_vkGetInstanceProcAddr ppsspp_vkGetInstanceProcAddr; +extern PFN_vkGetDeviceProcAddr ppsspp_vkGetDeviceProcAddr; +extern PFN_vkCreateDevice ppsspp_vkCreateDevice; +extern PFN_vkDestroyDevice ppsspp_vkDestroyDevice; +extern PFN_vkEnumerateInstanceExtensionProperties ppsspp_vkEnumerateInstanceExtensionProperties; +extern PFN_vkEnumerateDeviceExtensionProperties ppsspp_vkEnumerateDeviceExtensionProperties; +extern PFN_vkEnumerateInstanceLayerProperties ppsspp_vkEnumerateInstanceLayerProperties; +extern PFN_vkEnumerateDeviceLayerProperties ppsspp_vkEnumerateDeviceLayerProperties; +extern PFN_vkGetDeviceQueue ppsspp_vkGetDeviceQueue; +extern PFN_vkQueueSubmit ppsspp_vkQueueSubmit; +extern PFN_vkQueueWaitIdle ppsspp_vkQueueWaitIdle; +extern PFN_vkDeviceWaitIdle ppsspp_vkDeviceWaitIdle; +extern PFN_vkAllocateMemory ppsspp_vkAllocateMemory; +extern PFN_vkFreeMemory ppsspp_vkFreeMemory; +extern PFN_vkMapMemory ppsspp_vkMapMemory; +extern PFN_vkUnmapMemory ppsspp_vkUnmapMemory; +extern PFN_vkFlushMappedMemoryRanges ppsspp_vkFlushMappedMemoryRanges; +extern PFN_vkInvalidateMappedMemoryRanges ppsspp_vkInvalidateMappedMemoryRanges; +extern PFN_vkGetDeviceMemoryCommitment ppsspp_vkGetDeviceMemoryCommitment; +extern PFN_vkBindBufferMemory ppsspp_vkBindBufferMemory; +extern PFN_vkBindImageMemory ppsspp_vkBindImageMemory; +extern PFN_vkGetBufferMemoryRequirements ppsspp_vkGetBufferMemoryRequirements; +extern PFN_vkGetImageMemoryRequirements ppsspp_vkGetImageMemoryRequirements; +extern PFN_vkGetImageSparseMemoryRequirements ppsspp_vkGetImageSparseMemoryRequirements; +extern PFN_vkGetPhysicalDeviceSparseImageFormatProperties ppsspp_vkGetPhysicalDeviceSparseImageFormatProperties; +extern PFN_vkQueueBindSparse ppsspp_vkQueueBindSparse; +extern PFN_vkCreateFence ppsspp_vkCreateFence; +extern PFN_vkDestroyFence ppsspp_vkDestroyFence; +extern PFN_vkResetFences ppsspp_vkResetFences; +extern PFN_vkGetFenceStatus ppsspp_vkGetFenceStatus; +extern PFN_vkWaitForFences ppsspp_vkWaitForFences; +extern PFN_vkCreateSemaphore ppsspp_vkCreateSemaphore; +extern PFN_vkDestroySemaphore ppsspp_vkDestroySemaphore; +extern PFN_vkCreateEvent ppsspp_vkCreateEvent; +extern PFN_vkDestroyEvent ppsspp_vkDestroyEvent; +extern PFN_vkGetEventStatus ppsspp_vkGetEventStatus; +extern PFN_vkSetEvent ppsspp_vkSetEvent; +extern PFN_vkResetEvent ppsspp_vkResetEvent; +extern PFN_vkCreateQueryPool ppsspp_vkCreateQueryPool; +extern PFN_vkDestroyQueryPool ppsspp_vkDestroyQueryPool; +extern PFN_vkGetQueryPoolResults ppsspp_vkGetQueryPoolResults; +extern PFN_vkCreateBuffer ppsspp_vkCreateBuffer; +extern PFN_vkDestroyBuffer ppsspp_vkDestroyBuffer; +extern PFN_vkCreateBufferView ppsspp_vkCreateBufferView; +extern PFN_vkDestroyBufferView ppsspp_vkDestroyBufferView; +extern PFN_vkCreateImage ppsspp_vkCreateImage; +extern PFN_vkDestroyImage ppsspp_vkDestroyImage; +extern PFN_vkGetImageSubresourceLayout ppsspp_vkGetImageSubresourceLayout; +extern PFN_vkCreateImageView ppsspp_vkCreateImageView; +extern PFN_vkDestroyImageView ppsspp_vkDestroyImageView; +extern PFN_vkCreateShaderModule ppsspp_vkCreateShaderModule; +extern PFN_vkDestroyShaderModule ppsspp_vkDestroyShaderModule; +extern PFN_vkCreatePipelineCache ppsspp_vkCreatePipelineCache; +extern PFN_vkDestroyPipelineCache ppsspp_vkDestroyPipelineCache; +extern PFN_vkGetPipelineCacheData ppsspp_vkGetPipelineCacheData; +extern PFN_vkMergePipelineCaches ppsspp_vkMergePipelineCaches; +extern PFN_vkCreateGraphicsPipelines ppsspp_vkCreateGraphicsPipelines; +extern PFN_vkCreateComputePipelines ppsspp_vkCreateComputePipelines; +extern PFN_vkDestroyPipeline ppsspp_vkDestroyPipeline; +extern PFN_vkCreatePipelineLayout ppsspp_vkCreatePipelineLayout; +extern PFN_vkDestroyPipelineLayout ppsspp_vkDestroyPipelineLayout; +extern PFN_vkCreateSampler ppsspp_vkCreateSampler; +extern PFN_vkDestroySampler ppsspp_vkDestroySampler; +extern PFN_vkCreateDescriptorSetLayout ppsspp_vkCreateDescriptorSetLayout; +extern PFN_vkDestroyDescriptorSetLayout ppsspp_vkDestroyDescriptorSetLayout; +extern PFN_vkCreateDescriptorPool ppsspp_vkCreateDescriptorPool; +extern PFN_vkDestroyDescriptorPool ppsspp_vkDestroyDescriptorPool; +extern PFN_vkResetDescriptorPool ppsspp_vkResetDescriptorPool; +extern PFN_vkAllocateDescriptorSets ppsspp_vkAllocateDescriptorSets; +extern PFN_vkFreeDescriptorSets ppsspp_vkFreeDescriptorSets; +extern PFN_vkUpdateDescriptorSets ppsspp_vkUpdateDescriptorSets; +extern PFN_vkCreateFramebuffer ppsspp_vkCreateFramebuffer; +extern PFN_vkDestroyFramebuffer ppsspp_vkDestroyFramebuffer; +extern PFN_vkCreateRenderPass ppsspp_vkCreateRenderPass; +extern PFN_vkDestroyRenderPass ppsspp_vkDestroyRenderPass; +extern PFN_vkGetRenderAreaGranularity ppsspp_vkGetRenderAreaGranularity; +extern PFN_vkCreateCommandPool ppsspp_vkCreateCommandPool; +extern PFN_vkDestroyCommandPool ppsspp_vkDestroyCommandPool; +extern PFN_vkResetCommandPool ppsspp_vkResetCommandPool; +extern PFN_vkAllocateCommandBuffers ppsspp_vkAllocateCommandBuffers; +extern PFN_vkFreeCommandBuffers ppsspp_vkFreeCommandBuffers; +extern PFN_vkBeginCommandBuffer ppsspp_vkBeginCommandBuffer; +extern PFN_vkEndCommandBuffer ppsspp_vkEndCommandBuffer; +extern PFN_vkResetCommandBuffer ppsspp_vkResetCommandBuffer; +extern PFN_vkCmdBindPipeline ppsspp_vkCmdBindPipeline; +extern PFN_vkCmdSetViewport ppsspp_vkCmdSetViewport; +extern PFN_vkCmdSetScissor ppsspp_vkCmdSetScissor; +extern PFN_vkCmdSetLineWidth ppsspp_vkCmdSetLineWidth; +extern PFN_vkCmdSetDepthBias ppsspp_vkCmdSetDepthBias; +extern PFN_vkCmdSetBlendConstants ppsspp_vkCmdSetBlendConstants; +extern PFN_vkCmdSetDepthBounds ppsspp_vkCmdSetDepthBounds; +extern PFN_vkCmdSetStencilCompareMask ppsspp_vkCmdSetStencilCompareMask; +extern PFN_vkCmdSetStencilWriteMask ppsspp_vkCmdSetStencilWriteMask; +extern PFN_vkCmdSetStencilReference ppsspp_vkCmdSetStencilReference; +extern PFN_vkCmdBindDescriptorSets ppsspp_vkCmdBindDescriptorSets; +extern PFN_vkCmdBindIndexBuffer ppsspp_vkCmdBindIndexBuffer; +extern PFN_vkCmdBindVertexBuffers ppsspp_vkCmdBindVertexBuffers; +extern PFN_vkCmdDraw ppsspp_vkCmdDraw; +extern PFN_vkCmdDrawIndexed ppsspp_vkCmdDrawIndexed; +extern PFN_vkCmdDrawIndirect ppsspp_vkCmdDrawIndirect; +extern PFN_vkCmdDrawIndexedIndirect ppsspp_vkCmdDrawIndexedIndirect; +extern PFN_vkCmdDispatch ppsspp_vkCmdDispatch; +extern PFN_vkCmdDispatchIndirect ppsspp_vkCmdDispatchIndirect; +extern PFN_vkCmdCopyBuffer ppsspp_vkCmdCopyBuffer; +extern PFN_vkCmdCopyImage ppsspp_vkCmdCopyImage; +extern PFN_vkCmdBlitImage ppsspp_vkCmdBlitImage; +extern PFN_vkCmdCopyBufferToImage ppsspp_vkCmdCopyBufferToImage; +extern PFN_vkCmdCopyImageToBuffer ppsspp_vkCmdCopyImageToBuffer; +extern PFN_vkCmdUpdateBuffer ppsspp_vkCmdUpdateBuffer; +extern PFN_vkCmdFillBuffer ppsspp_vkCmdFillBuffer; +extern PFN_vkCmdClearColorImage ppsspp_vkCmdClearColorImage; +extern PFN_vkCmdClearDepthStencilImage ppsspp_vkCmdClearDepthStencilImage; +extern PFN_vkCmdClearAttachments ppsspp_vkCmdClearAttachments; +extern PFN_vkCmdResolveImage ppsspp_vkCmdResolveImage; +extern PFN_vkCmdSetEvent ppsspp_vkCmdSetEvent; +extern PFN_vkCmdResetEvent ppsspp_vkCmdResetEvent; +extern PFN_vkCmdWaitEvents ppsspp_vkCmdWaitEvents; +extern PFN_vkCmdPipelineBarrier ppsspp_vkCmdPipelineBarrier; +extern PFN_vkCmdBeginQuery ppsspp_vkCmdBeginQuery; +extern PFN_vkCmdEndQuery ppsspp_vkCmdEndQuery; +extern PFN_vkCmdResetQueryPool ppsspp_vkCmdResetQueryPool; +extern PFN_vkCmdWriteTimestamp ppsspp_vkCmdWriteTimestamp; +extern PFN_vkCmdCopyQueryPoolResults ppsspp_vkCmdCopyQueryPoolResults; +extern PFN_vkCmdPushConstants ppsspp_vkCmdPushConstants; +extern PFN_vkCmdBeginRenderPass ppsspp_vkCmdBeginRenderPass; +extern PFN_vkCmdNextSubpass ppsspp_vkCmdNextSubpass; +extern PFN_vkCmdEndRenderPass ppsspp_vkCmdEndRenderPass; +extern PFN_vkCmdExecuteCommands ppsspp_vkCmdExecuteCommands; #ifdef __ANDROID__ -extern PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR; +extern PFN_vkCreateAndroidSurfaceKHR ppsspp_vkCreateAndroidSurfaceKHR; #elif defined(_WIN32) -extern PFN_vkCreateWin32SurfaceKHR vkCreateWin32SurfaceKHR; +extern PFN_vkCreateWin32SurfaceKHR ppsspp_vkCreateWin32SurfaceKHR; #elif defined(VK_USE_PLATFORM_METAL_EXT) -extern PFN_vkCreateMetalSurfaceEXT vkCreateMetalSurfaceEXT; +extern PFN_vkCreateMetalSurfaceEXT ppsspp_vkCreateMetalSurfaceEXT; #endif #if defined(VK_USE_PLATFORM_XLIB_KHR) -extern PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR; +extern PFN_vkCreateXlibSurfaceKHR ppsspp_vkCreateXlibSurfaceKHR; #endif #if defined(VK_USE_PLATFORM_WAYLAND_KHR) -extern PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR; +extern PFN_vkCreateWaylandSurfaceKHR ppsspp_vkCreateWaylandSurfaceKHR; #endif #if defined(VK_USE_PLATFORM_DISPLAY_KHR) -extern PFN_vkCreateDisplayPlaneSurfaceKHR vkCreateDisplayPlaneSurfaceKHR; +extern PFN_vkCreateDisplayPlaneSurfaceKHR ppsspp_vkCreateDisplayPlaneSurfaceKHR; #endif -extern PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR; +extern PFN_vkDestroySurfaceKHR ppsspp_vkDestroySurfaceKHR; // Simple loader for the WSI extension. -extern PFN_vkGetPhysicalDeviceSurfaceSupportKHR vkGetPhysicalDeviceSurfaceSupportKHR; -extern PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceCapabilitiesKHR; -extern PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vkGetPhysicalDeviceSurfaceFormatsKHR; -extern PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vkGetPhysicalDeviceSurfacePresentModesKHR; - -extern PFN_vkCreateSwapchainKHR vkCreateSwapchainKHR; -extern PFN_vkDestroySwapchainKHR vkDestroySwapchainKHR; -extern PFN_vkGetSwapchainImagesKHR vkGetSwapchainImagesKHR; -extern PFN_vkAcquireNextImageKHR vkAcquireNextImageKHR; -extern PFN_vkQueuePresentKHR vkQueuePresentKHR; - -extern PFN_vkCreateDebugUtilsMessengerEXT vkCreateDebugUtilsMessengerEXT; -extern PFN_vkDestroyDebugUtilsMessengerEXT vkDestroyDebugUtilsMessengerEXT; -extern PFN_vkCmdBeginDebugUtilsLabelEXT vkCmdBeginDebugUtilsLabelEXT; -extern PFN_vkCmdEndDebugUtilsLabelEXT vkCmdEndDebugUtilsLabelEXT; -extern PFN_vkCmdInsertDebugUtilsLabelEXT vkCmdInsertDebugUtilsLabelEXT; -extern PFN_vkSetDebugUtilsObjectNameEXT vkSetDebugUtilsObjectNameEXT; -extern PFN_vkSetDebugUtilsObjectTagEXT vkSetDebugUtilsObjectTagEXT; +extern PFN_vkGetPhysicalDeviceSurfaceSupportKHR ppsspp_vkGetPhysicalDeviceSurfaceSupportKHR; +extern PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR ppsspp_vkGetPhysicalDeviceSurfaceCapabilitiesKHR; +extern PFN_vkGetPhysicalDeviceSurfaceFormatsKHR ppsspp_vkGetPhysicalDeviceSurfaceFormatsKHR; +extern PFN_vkGetPhysicalDeviceSurfacePresentModesKHR ppsspp_vkGetPhysicalDeviceSurfacePresentModesKHR; + +extern PFN_vkCreateSwapchainKHR ppsspp_vkCreateSwapchainKHR; +extern PFN_vkDestroySwapchainKHR ppsspp_vkDestroySwapchainKHR; +extern PFN_vkGetSwapchainImagesKHR ppsspp_vkGetSwapchainImagesKHR; +extern PFN_vkAcquireNextImageKHR ppsspp_vkAcquireNextImageKHR; +extern PFN_vkQueuePresentKHR ppsspp_vkQueuePresentKHR; + +extern PFN_vkCreateDebugUtilsMessengerEXT ppsspp_vkCreateDebugUtilsMessengerEXT; +extern PFN_vkDestroyDebugUtilsMessengerEXT ppsspp_vkDestroyDebugUtilsMessengerEXT; +extern PFN_vkCmdBeginDebugUtilsLabelEXT ppsspp_vkCmdBeginDebugUtilsLabelEXT; +extern PFN_vkCmdEndDebugUtilsLabelEXT ppsspp_vkCmdEndDebugUtilsLabelEXT; +extern PFN_vkCmdInsertDebugUtilsLabelEXT ppsspp_vkCmdInsertDebugUtilsLabelEXT; +extern PFN_vkSetDebugUtilsObjectNameEXT ppsspp_vkSetDebugUtilsObjectNameEXT; +extern PFN_vkSetDebugUtilsObjectTagEXT ppsspp_vkSetDebugUtilsObjectTagEXT; // Assorted other extensions. -extern PFN_vkGetBufferMemoryRequirements2KHR vkGetBufferMemoryRequirements2KHR; -extern PFN_vkGetImageMemoryRequirements2KHR vkGetImageMemoryRequirements2KHR; -extern PFN_vkGetMemoryHostPointerPropertiesEXT vkGetMemoryHostPointerPropertiesEXT; -extern PFN_vkGetPhysicalDeviceProperties2KHR vkGetPhysicalDeviceProperties2KHR; -extern PFN_vkGetPhysicalDeviceFeatures2KHR vkGetPhysicalDeviceFeatures2KHR; +extern PFN_vkGetBufferMemoryRequirements2KHR ppsspp_vkGetBufferMemoryRequirements2KHR; +extern PFN_vkGetImageMemoryRequirements2KHR ppsspp_vkGetImageMemoryRequirements2KHR; +extern PFN_vkGetMemoryHostPointerPropertiesEXT ppsspp_vkGetMemoryHostPointerPropertiesEXT; +extern PFN_vkGetPhysicalDeviceProperties2KHR ppsspp_vkGetPhysicalDeviceProperties2KHR; +extern PFN_vkGetPhysicalDeviceFeatures2KHR ppsspp_vkGetPhysicalDeviceFeatures2KHR; // For fast extension-enabled checks. struct VulkanExtensions { diff --git a/Common/GPU/Vulkan/VulkanMemory.cpp b/Common/GPU/Vulkan/VulkanMemory.cpp index 77f41732cc2f..fa5454b61a4c 100644 --- a/Common/GPU/Vulkan/VulkanMemory.cpp +++ b/Common/GPU/Vulkan/VulkanMemory.cpp @@ -46,7 +46,7 @@ bool VulkanPushBuffer::AddBuffer() { b.queueFamilyIndexCount = 0; b.pQueueFamilyIndices = nullptr; - VkResult res = vkCreateBuffer(device, &b, nullptr, &info.buffer); + VkResult res = ppsspp_vkCreateBuffer(device, &b, nullptr, &info.buffer); if (VK_SUCCESS != res) { _assert_msg_(false, "vkCreateBuffer failed! result=%d", (int)res); return false; @@ -54,24 +54,24 @@ bool VulkanPushBuffer::AddBuffer() { // Get the buffer memory requirements. None of this can be cached! VkMemoryRequirements reqs; - vkGetBufferMemoryRequirements(device, info.buffer, &reqs); + ppsspp_vkGetBufferMemoryRequirements(device, info.buffer, &reqs); // Okay, that's the buffer. Now let's allocate some memory for it. VkMemoryAllocateInfo alloc{ VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO }; alloc.allocationSize = reqs.size; vulkan_->MemoryTypeFromProperties(reqs.memoryTypeBits, memoryPropertyMask_, &alloc.memoryTypeIndex); - res = vkAllocateMemory(device, &alloc, nullptr, &info.deviceMemory); + res = ppsspp_vkAllocateMemory(device, &alloc, nullptr, &info.deviceMemory); if (VK_SUCCESS != res) { _assert_msg_(false, "vkAllocateMemory failed! size=%d result=%d", (int)reqs.size, (int)res); - vkDestroyBuffer(device, info.buffer, nullptr); + ppsspp_vkDestroyBuffer(device, info.buffer, nullptr); return false; } - res = vkBindBufferMemory(device, info.buffer, info.deviceMemory, 0); + res = ppsspp_vkBindBufferMemory(device, info.buffer, info.deviceMemory, 0); if (VK_SUCCESS != res) { ERROR_LOG(G3D, "vkBindBufferMemory failed! result=%d", (int)res); - vkFreeMemory(device, info.deviceMemory, nullptr); - vkDestroyBuffer(device, info.buffer, nullptr); + ppsspp_vkFreeMemory(device, info.deviceMemory, nullptr); + ppsspp_vkDestroyBuffer(device, info.buffer, nullptr); return false; } @@ -138,7 +138,7 @@ size_t VulkanPushBuffer::GetTotalSize() const { void VulkanPushBuffer::Map() { _dbg_assert_(!writePtr_); - VkResult res = vkMapMemory(vulkan_->GetDevice(), buffers_[buf_].deviceMemory, 0, size_, 0, (void **)(&writePtr_)); + VkResult res = ppsspp_vkMapMemory(vulkan_->GetDevice(), buffers_[buf_].deviceMemory, 0, size_, 0, (void **)(&writePtr_)); _dbg_assert_(writePtr_); _assert_(VK_SUCCESS == res); } @@ -153,10 +153,10 @@ void VulkanPushBuffer::Unmap() { range.offset = 0; range.size = offset_; range.memory = buffers_[buf_].deviceMemory; - vkFlushMappedMemoryRanges(vulkan_->GetDevice(), 1, &range); + ppsspp_vkFlushMappedMemoryRanges(vulkan_->GetDevice(), 1, &range); } - vkUnmapMemory(vulkan_->GetDevice(), buffers_[buf_].deviceMemory); + ppsspp_vkUnmapMemory(vulkan_->GetDevice(), buffers_[buf_].deviceMemory); writePtr_ = nullptr; } @@ -417,7 +417,7 @@ bool VulkanDeviceAllocator::AllocateSlab(VkDeviceSize minBytes, int memoryTypeIn } VkDeviceMemory deviceMemory; - VkResult res = vkAllocateMemory(vulkan_->GetDevice(), &alloc, NULL, &deviceMemory); + VkResult res = ppsspp_vkAllocateMemory(vulkan_->GetDevice(), &alloc, NULL, &deviceMemory); if (res != VK_SUCCESS) { // If it's something else, we used it wrong? _assert_(res == VK_ERROR_OUT_OF_HOST_MEMORY || res == VK_ERROR_OUT_OF_DEVICE_MEMORY || res == VK_ERROR_TOO_MANY_OBJECTS); diff --git a/Common/GPU/Vulkan/VulkanQueueRunner.cpp b/Common/GPU/Vulkan/VulkanQueueRunner.cpp index 56fb09dea2cc..34dabcde877b 100644 --- a/Common/GPU/Vulkan/VulkanQueueRunner.cpp +++ b/Common/GPU/Vulkan/VulkanQueueRunner.cpp @@ -65,11 +65,11 @@ void VulkanQueueRunner::ResizeReadbackBuffer(VkDeviceSize requiredSize) { buf.size = readbackBufferSize_; buf.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT; - VkResult res = vkCreateBuffer(device, &buf, nullptr, &readbackBuffer_); + VkResult res = ppsspp_vkCreateBuffer(device, &buf, nullptr, &readbackBuffer_); _assert_(res == VK_SUCCESS); VkMemoryRequirements reqs{}; - vkGetBufferMemoryRequirements(device, readbackBuffer_, &reqs); + ppsspp_vkGetBufferMemoryRequirements(device, readbackBuffer_, &reqs); VkMemoryAllocateInfo allocInfo{ VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO }; allocInfo.allocationSize = reqs.size; @@ -92,15 +92,15 @@ void VulkanQueueRunner::ResizeReadbackBuffer(VkDeviceSize requiredSize) { _assert_(successTypeReqs != 0); readbackBufferIsCoherent_ = (successTypeReqs & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) != 0; - res = vkAllocateMemory(device, &allocInfo, nullptr, &readbackMemory_); + res = ppsspp_vkAllocateMemory(device, &allocInfo, nullptr, &readbackMemory_); if (res != VK_SUCCESS) { readbackMemory_ = VK_NULL_HANDLE; - vkDestroyBuffer(device, readbackBuffer_, nullptr); + ppsspp_vkDestroyBuffer(device, readbackBuffer_, nullptr); readbackBuffer_ = VK_NULL_HANDLE; return; } uint32_t offset = 0; - vkBindBufferMemory(device, readbackBuffer_, readbackMemory_, offset); + ppsspp_vkBindBufferMemory(device, readbackBuffer_, readbackMemory_, offset); } void VulkanQueueRunner::DestroyDeviceObjects() { @@ -183,7 +183,7 @@ void VulkanQueueRunner::InitBackbufferRenderPass() { rp_info.dependencyCount = 1; rp_info.pDependencies = &dep; - VkResult res = vkCreateRenderPass(vulkan_->GetDevice(), &rp_info, nullptr, &backbufferRenderPass_); + VkResult res = ppsspp_vkCreateRenderPass(vulkan_->GetDevice(), &rp_info, nullptr, &backbufferRenderPass_); _assert_(res == VK_SUCCESS); } @@ -271,7 +271,7 @@ VkRenderPass VulkanQueueRunner::GetRenderPass(const RPKey &key) { rp.subpassCount = 1; rp.pSubpasses = &subpass; - VkResult res = vkCreateRenderPass(vulkan_->GetDevice(), &rp, nullptr, &pass); + VkResult res = ppsspp_vkCreateRenderPass(vulkan_->GetDevice(), &rp, nullptr, &pass); _assert_(res == VK_SUCCESS); _assert_(pass != VK_NULL_HANDLE); renderPasses_.Insert(key, pass); @@ -363,7 +363,7 @@ void VulkanQueueRunner::RunSteps(VkCommandBuffer cmd, std::vector &st if (emitLabels) { VkDebugUtilsLabelEXT labelInfo{ VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT }; labelInfo.pLabelName = step.tag; - vkCmdBeginDebugUtilsLabelEXT(cmd, &labelInfo); + ppsspp_vkCmdBeginDebugUtilsLabelEXT(cmd, &labelInfo); } switch (step.stepType) { @@ -387,12 +387,12 @@ void VulkanQueueRunner::RunSteps(VkCommandBuffer cmd, std::vector &st } if (profile && profile->timestampDescriptions.size() + 1 < MAX_TIMESTAMP_QUERIES) { - vkCmdWriteTimestamp(cmd, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, profile->queryPool, (uint32_t)profile->timestampDescriptions.size()); + ppsspp_vkCmdWriteTimestamp(cmd, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, profile->queryPool, (uint32_t)profile->timestampDescriptions.size()); profile->timestampDescriptions.push_back(StepToString(step)); } if (emitLabels) { - vkCmdEndDebugUtilsLabelEXT(cmd); + ppsspp_vkCmdEndDebugUtilsLabelEXT(cmd); } } @@ -987,7 +987,7 @@ void TransitionToOptimal(VkCommandBuffer cmd, VkImage colorImage, VkImageLayout } if (barrierCount) { - vkCmdPipelineBarrier(cmd, srcStageMask, dstStageMask, VK_DEPENDENCY_BY_REGION_BIT, 0, nullptr, 0, nullptr, barrierCount, barrier); + ppsspp_vkCmdPipelineBarrier(cmd, srcStageMask, dstStageMask, VK_DEPENDENCY_BY_REGION_BIT, 0, nullptr, 0, nullptr, barrierCount, barrier); } } @@ -1078,7 +1078,7 @@ void TransitionFromOptimal(VkCommandBuffer cmd, VkImage colorImage, VkImageLayou barrierCount++; } if (barrierCount) { - vkCmdPipelineBarrier(cmd, srcStageMask, dstStageMask, VK_DEPENDENCY_BY_REGION_BIT, 0, nullptr, 0, nullptr, barrierCount, barrier); + ppsspp_vkCmdPipelineBarrier(cmd, srcStageMask, dstStageMask, VK_DEPENDENCY_BY_REGION_BIT, 0, nullptr, 0, nullptr, barrierCount, barrier); } } @@ -1128,7 +1128,7 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - vkCmdPipelineBarrier(cmd, srcStage, dstStage, 0, 0, nullptr, 0, nullptr, 1, &barrier); + ppsspp_vkCmdPipelineBarrier(cmd, srcStage, dstStage, 0, 0, nullptr, 0, nullptr, 1, &barrier); iter.fb->color.layout = barrier.newLayout; } else if ((iter.aspect & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) && iter.fb->depth.layout != iter.targetLayout) { VkImageMemoryBarrier barrier{ VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER }; @@ -1169,7 +1169,7 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT; barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; - vkCmdPipelineBarrier(cmd, srcStage, dstStage, 0, 0, nullptr, 0, nullptr, 1, &barrier); + ppsspp_vkCmdPipelineBarrier(cmd, srcStage, dstStage, 0, 0, nullptr, 0, nullptr, 1, &barrier); iter.fb->depth.layout = barrier.newLayout; } } @@ -1220,7 +1220,7 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c n++; } if (stage) { - vkCmdPipelineBarrier(cmd, stage, stage, 0, 0, nullptr, 0, nullptr, n, barriers); + ppsspp_vkCmdPipelineBarrier(cmd, stage, stage, 0, 0, nullptr, 0, nullptr, n, barriers); // No need to modify the image layouts here - it's just an execution barrier. } } @@ -1251,7 +1251,7 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c case VKRRenderCommand::BIND_PIPELINE: if (c.pipeline.pipeline != lastPipeline) { - vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, c.pipeline.pipeline); + ppsspp_vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, c.pipeline.pipeline); lastPipeline = c.pipeline.pipeline; // Reset dynamic state so it gets refreshed with the new pipeline. lastStencilWriteMask = -1; @@ -1262,7 +1262,7 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c case VKRRenderCommand::VIEWPORT: if (fb != nullptr) { - vkCmdSetViewport(cmd, 0, 1, &c.viewport.vp); + ppsspp_vkCmdSetViewport(cmd, 0, 1, &c.viewport.vp); } else { const VkViewport &vp = c.viewport.vp; DisplayRect rc{ vp.x, vp.y, vp.width, vp.height }; @@ -1274,14 +1274,14 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c final_vp.height = rc.h; final_vp.maxDepth = vp.maxDepth; final_vp.minDepth = vp.minDepth; - vkCmdSetViewport(cmd, 0, 1, &final_vp); + ppsspp_vkCmdSetViewport(cmd, 0, 1, &final_vp); } break; case VKRRenderCommand::SCISSOR: { if (fb != nullptr) { - vkCmdSetScissor(cmd, 0, 1, &c.scissor.scissor); + ppsspp_vkCmdSetScissor(cmd, 0, 1, &c.scissor.scissor); } else { // Rendering to backbuffer. Might need to rotate. const VkRect2D &rc = c.scissor.scissor; @@ -1290,7 +1290,7 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c _dbg_assert_(rotated_rc.x >= 0); _dbg_assert_(rotated_rc.y >= 0); VkRect2D finalRect = VkRect2D{ { rotated_rc.x, rotated_rc.y }, { (uint32_t)rotated_rc.w, (uint32_t)rotated_rc.h} }; - vkCmdSetScissor(cmd, 0, 1, &finalRect); + ppsspp_vkCmdSetScissor(cmd, 0, 1, &finalRect); } break; } @@ -1299,42 +1299,42 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c { float bc[4]; Uint8x4ToFloat4(bc, c.blendColor.color); - vkCmdSetBlendConstants(cmd, bc); + ppsspp_vkCmdSetBlendConstants(cmd, bc); break; } case VKRRenderCommand::PUSH_CONSTANTS: - vkCmdPushConstants(cmd, c.push.pipelineLayout, c.push.stages, c.push.offset, c.push.size, c.push.data); + ppsspp_vkCmdPushConstants(cmd, c.push.pipelineLayout, c.push.stages, c.push.offset, c.push.size, c.push.data); break; case VKRRenderCommand::STENCIL: if (lastStencilWriteMask != c.stencil.stencilWriteMask) { lastStencilWriteMask = (int)c.stencil.stencilWriteMask; - vkCmdSetStencilWriteMask(cmd, VK_STENCIL_FRONT_AND_BACK, c.stencil.stencilWriteMask); + ppsspp_vkCmdSetStencilWriteMask(cmd, VK_STENCIL_FRONT_AND_BACK, c.stencil.stencilWriteMask); } if (lastStencilCompareMask != c.stencil.stencilCompareMask) { lastStencilCompareMask = c.stencil.stencilCompareMask; - vkCmdSetStencilCompareMask(cmd, VK_STENCIL_FRONT_AND_BACK, c.stencil.stencilCompareMask); + ppsspp_vkCmdSetStencilCompareMask(cmd, VK_STENCIL_FRONT_AND_BACK, c.stencil.stencilCompareMask); } if (lastStencilReference != c.stencil.stencilRef) { lastStencilReference = c.stencil.stencilRef; - vkCmdSetStencilReference(cmd, VK_STENCIL_FRONT_AND_BACK, c.stencil.stencilRef); + ppsspp_vkCmdSetStencilReference(cmd, VK_STENCIL_FRONT_AND_BACK, c.stencil.stencilRef); } break; case VKRRenderCommand::DRAW_INDEXED: - vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, c.drawIndexed.pipelineLayout, 0, 1, &c.drawIndexed.ds, c.drawIndexed.numUboOffsets, c.drawIndexed.uboOffsets); - vkCmdBindIndexBuffer(cmd, c.drawIndexed.ibuffer, c.drawIndexed.ioffset, c.drawIndexed.indexType); - vkCmdBindVertexBuffers(cmd, 0, 1, &c.drawIndexed.vbuffer, &c.drawIndexed.voffset); - vkCmdDrawIndexed(cmd, c.drawIndexed.count, c.drawIndexed.instances, 0, 0, 0); + ppsspp_vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, c.drawIndexed.pipelineLayout, 0, 1, &c.drawIndexed.ds, c.drawIndexed.numUboOffsets, c.drawIndexed.uboOffsets); + ppsspp_vkCmdBindIndexBuffer(cmd, c.drawIndexed.ibuffer, c.drawIndexed.ioffset, c.drawIndexed.indexType); + ppsspp_vkCmdBindVertexBuffers(cmd, 0, 1, &c.drawIndexed.vbuffer, &c.drawIndexed.voffset); + ppsspp_vkCmdDrawIndexed(cmd, c.drawIndexed.count, c.drawIndexed.instances, 0, 0, 0); break; case VKRRenderCommand::DRAW: - vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, c.draw.pipelineLayout, 0, 1, &c.draw.ds, c.draw.numUboOffsets, c.draw.uboOffsets); + ppsspp_vkCmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, c.draw.pipelineLayout, 0, 1, &c.draw.ds, c.draw.numUboOffsets, c.draw.uboOffsets); if (c.draw.vbuffer) { - vkCmdBindVertexBuffers(cmd, 0, 1, &c.draw.vbuffer, &c.draw.voffset); + ppsspp_vkCmdBindVertexBuffers(cmd, 0, 1, &c.draw.vbuffer, &c.draw.voffset); } - vkCmdDraw(cmd, c.draw.count, 1, c.draw.offset, 0); + ppsspp_vkCmdDraw(cmd, c.draw.count, 1, c.draw.offset, 0); break; case VKRRenderCommand::CLEAR: @@ -1366,7 +1366,7 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c } } if (numAttachments) { - vkCmdClearAttachments(cmd, numAttachments, attachments, 1, &rc); + ppsspp_vkCmdClearAttachments(cmd, numAttachments, attachments, 1, &rc); } break; } @@ -1375,7 +1375,7 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c ; } } - vkCmdEndRenderPass(cmd); + ppsspp_vkCmdEndRenderPass(cmd); if (fb) { // If the desired final layout aren't the optimal layout for rendering, transition. @@ -1466,7 +1466,7 @@ void VulkanQueueRunner::PerformBindFramebufferAsRenderTarget(const VKRStep &step rp_begin.renderArea = rc; rp_begin.clearValueCount = numClearVals; rp_begin.pClearValues = numClearVals ? clearVal : nullptr; - vkCmdBeginRenderPass(cmd, &rp_begin, VK_SUBPASS_CONTENTS_INLINE); + ppsspp_vkCmdBeginRenderPass(cmd, &rp_begin, VK_SUBPASS_CONTENTS_INLINE); } void VulkanQueueRunner::PerformCopy(const VKRStep &step, VkCommandBuffer cmd) { @@ -1517,21 +1517,21 @@ void VulkanQueueRunner::PerformCopy(const VKRStep &step, VkCommandBuffer cmd) { } if (srcCount) { - vkCmdPipelineBarrier(cmd, srcStage, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, srcCount, srcBarriers); + ppsspp_vkCmdPipelineBarrier(cmd, srcStage, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, srcCount, srcBarriers); } if (dstCount) { - vkCmdPipelineBarrier(cmd, dstStage, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, dstCount, dstBarriers); + ppsspp_vkCmdPipelineBarrier(cmd, dstStage, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, dstCount, dstBarriers); } if (step.copy.aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) { copy.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; copy.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - vkCmdCopyImage(cmd, src->color.image, src->color.layout, dst->color.image, dst->color.layout, 1, ©); + ppsspp_vkCmdCopyImage(cmd, src->color.image, src->color.layout, dst->color.image, dst->color.layout, 1, ©); } if (step.copy.aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) { copy.srcSubresource.aspectMask = step.copy.aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT); copy.dstSubresource.aspectMask = step.copy.aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT); - vkCmdCopyImage(cmd, src->depth.image, src->depth.layout, dst->depth.image, dst->depth.layout, 1, ©); + ppsspp_vkCmdCopyImage(cmd, src->depth.image, src->depth.layout, dst->depth.image, dst->depth.layout, 1, ©); } } @@ -1589,16 +1589,16 @@ void VulkanQueueRunner::PerformBlit(const VKRStep &step, VkCommandBuffer cmd) { } if (srcCount) { - vkCmdPipelineBarrier(cmd, srcStage, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, srcCount, srcBarriers); + ppsspp_vkCmdPipelineBarrier(cmd, srcStage, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, srcCount, srcBarriers); } if (dstCount) { - vkCmdPipelineBarrier(cmd, dstStage, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, dstCount, dstBarriers); + ppsspp_vkCmdPipelineBarrier(cmd, dstStage, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, dstCount, dstBarriers); } if (step.blit.aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) { blit.srcSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; blit.dstSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - vkCmdBlitImage(cmd, src->color.image, src->color.layout, dst->color.image, dst->color.layout, 1, &blit, step.blit.filter); + ppsspp_vkCmdBlitImage(cmd, src->color.image, src->color.layout, dst->color.image, dst->color.layout, 1, &blit, step.blit.filter); } // TODO: Need to check if the depth format is blittable. @@ -1614,7 +1614,7 @@ void VulkanQueueRunner::PerformBlit(const VKRStep &step, VkCommandBuffer cmd) { blit.srcSubresource.aspectMask |= VK_IMAGE_ASPECT_STENCIL_BIT; blit.dstSubresource.aspectMask |= VK_IMAGE_ASPECT_STENCIL_BIT; } - vkCmdBlitImage(cmd, src->depth.image, src->depth.layout, dst->depth.image, dst->depth.layout, 1, &blit, step.blit.filter); + ppsspp_vkCmdBlitImage(cmd, src->depth.image, src->depth.layout, dst->depth.image, dst->depth.layout, 1, &blit, step.blit.filter); } } @@ -1739,13 +1739,13 @@ void VulkanQueueRunner::PerformReadback(const VKRStep &step, VkCommandBuffer cmd VkPipelineStageFlags stage = 0; if (srcImage->layout != VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL) { SetupTransitionToTransferSrc(*srcImage, barrier, stage, step.readback.aspectMask); - vkCmdPipelineBarrier(cmd, stage, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &barrier); + ppsspp_vkCmdPipelineBarrier(cmd, stage, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &barrier); } image = srcImage->image; copyLayout = srcImage->layout; } - vkCmdCopyImageToBuffer(cmd, image, copyLayout, readbackBuffer_, 1, ®ion); + ppsspp_vkCmdCopyImageToBuffer(cmd, image, copyLayout, readbackBuffer_, 1, ®ion); // NOTE: Can't read the buffer using the CPU here - need to sync first. @@ -1770,7 +1770,7 @@ void VulkanQueueRunner::PerformReadbackImage(const VKRStep &step, VkCommandBuffe VkImageMemoryBarrier barrier{ VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER }; VkPipelineStageFlags stage = 0; SetupTransitionToTransferSrc(srcImage, barrier, stage, VK_IMAGE_ASPECT_COLOR_BIT); - vkCmdPipelineBarrier(cmd, stage, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &barrier); + ppsspp_vkCmdPipelineBarrier(cmd, stage, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, nullptr, 1, &barrier); ResizeReadbackBuffer(sizeof(uint32_t) * step.readback_image.srcRect.extent.width * step.readback_image.srcRect.extent.height); @@ -1783,7 +1783,7 @@ void VulkanQueueRunner::PerformReadbackImage(const VKRStep &step, VkCommandBuffe region.bufferOffset = 0; region.bufferRowLength = step.readback_image.srcRect.extent.width; region.bufferImageHeight = step.readback_image.srcRect.extent.height; - vkCmdCopyImageToBuffer(cmd, step.readback_image.image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, readbackBuffer_, 1, ®ion); + ppsspp_vkCmdCopyImageToBuffer(cmd, step.readback_image.image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, readbackBuffer_, 1, ®ion); // Now transfer it back to a texture. TransitionImageLayout2(cmd, step.readback_image.image, 0, 1, @@ -1804,13 +1804,13 @@ void VulkanQueueRunner::CopyReadbackBuffer(int width, int height, Draw::DataForm void *mappedData; const size_t srcPixelSize = DataFormatSizeInBytes(srcFormat); - VkResult res = vkMapMemory(vulkan_->GetDevice(), readbackMemory_, 0, width * height * srcPixelSize, 0, &mappedData); + VkResult res = ppsspp_vkMapMemory(vulkan_->GetDevice(), readbackMemory_, 0, width * height * srcPixelSize, 0, &mappedData); if (!readbackBufferIsCoherent_) { VkMappedMemoryRange range{}; range.memory = readbackMemory_; range.offset = 0; range.size = width * height * srcPixelSize; - vkInvalidateMappedMemoryRanges(vulkan_->GetDevice(), 1, &range); + ppsspp_vkInvalidateMappedMemoryRanges(vulkan_->GetDevice(), 1, &range); } if (res != VK_SUCCESS) { @@ -1839,5 +1839,5 @@ void VulkanQueueRunner::CopyReadbackBuffer(int width, int height, Draw::DataForm ERROR_LOG(G3D, "CopyReadbackBuffer: Unknown format"); _assert_msg_(false, "CopyReadbackBuffer: Unknown src format %d", (int)srcFormat); } - vkUnmapMemory(vulkan_->GetDevice(), readbackMemory_); + ppsspp_vkUnmapMemory(vulkan_->GetDevice(), readbackMemory_); } diff --git a/Common/GPU/Vulkan/VulkanRenderManager.cpp b/Common/GPU/Vulkan/VulkanRenderManager.cpp index 523e88805ff5..4cdcd425f4fd 100644 --- a/Common/GPU/Vulkan/VulkanRenderManager.cpp +++ b/Common/GPU/Vulkan/VulkanRenderManager.cpp @@ -39,7 +39,7 @@ VKRFramebuffer::VKRFramebuffer(VulkanContext *vk, VkCommandBuffer initCmd, VkRen fbci.height = height; fbci.layers = 1; - VkResult res = vkCreateFramebuffer(vulkan_->GetDevice(), &fbci, nullptr, &framebuf); + VkResult res = ppsspp_vkCreateFramebuffer(vulkan_->GetDevice(), &fbci, nullptr, &framebuf); _assert_(res == VK_SUCCESS); if (tag && vk->Extensions().EXT_debug_utils) { @@ -89,7 +89,7 @@ void CreateImage(VulkanContext *vulkan, VkCommandBuffer cmd, VKRImage &img, int ici.usage |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT; } - VkResult res = vkCreateImage(vulkan->GetDevice(), &ici, nullptr, &img.image); + VkResult res = ppsspp_vkCreateImage(vulkan->GetDevice(), &ici, nullptr, &img.image); _dbg_assert_(res == VK_SUCCESS); VkMemoryRequirements memreq; @@ -106,10 +106,10 @@ void CreateImage(VulkanContext *vulkan, VkCommandBuffer cmd, VKRImage &img, int vulkan->MemoryTypeFromProperties(memreq.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &alloc.memoryTypeIndex); - res = vkAllocateMemory(vulkan->GetDevice(), &alloc, nullptr, &img.memory); + res = ppsspp_vkAllocateMemory(vulkan->GetDevice(), &alloc, nullptr, &img.memory); _dbg_assert_(res == VK_SUCCESS); - res = vkBindImageMemory(vulkan->GetDevice(), img.image, img.memory, 0); + res = ppsspp_vkBindImageMemory(vulkan->GetDevice(), img.image, img.memory, 0); _dbg_assert_(res == VK_SUCCESS); VkImageAspectFlags aspects = color ? VK_IMAGE_ASPECT_COLOR_BIT : (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT); @@ -122,13 +122,13 @@ void CreateImage(VulkanContext *vulkan, VkCommandBuffer cmd, VKRImage &img, int ivci.subresourceRange.aspectMask = aspects; ivci.subresourceRange.layerCount = 1; ivci.subresourceRange.levelCount = 1; - res = vkCreateImageView(vulkan->GetDevice(), &ivci, nullptr, &img.imageView); + res = ppsspp_vkCreateImageView(vulkan->GetDevice(), &ivci, nullptr, &img.imageView); _dbg_assert_(res == VK_SUCCESS); // Separate view for texture sampling that only exposes depth. if (!color) { ivci.subresourceRange.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT; - res = vkCreateImageView(vulkan->GetDevice(), &ivci, nullptr, &img.depthSampleView); + res = ppsspp_vkCreateImageView(vulkan->GetDevice(), &ivci, nullptr, &img.depthSampleView); _dbg_assert_(res == VK_SUCCESS); } else { img.depthSampleView = VK_NULL_HANDLE; @@ -167,9 +167,9 @@ void CreateImage(VulkanContext *vulkan, VkCommandBuffer cmd, VKRImage &img, int VulkanRenderManager::VulkanRenderManager(VulkanContext *vulkan) : vulkan_(vulkan), queueRunner_(vulkan) { VkSemaphoreCreateInfo semaphoreCreateInfo = { VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO }; semaphoreCreateInfo.flags = 0; - VkResult res = vkCreateSemaphore(vulkan_->GetDevice(), &semaphoreCreateInfo, nullptr, &acquireSemaphore_); + VkResult res = ppsspp_vkCreateSemaphore(vulkan_->GetDevice(), &semaphoreCreateInfo, nullptr, &acquireSemaphore_); _dbg_assert_(res == VK_SUCCESS); - res = vkCreateSemaphore(vulkan_->GetDevice(), &semaphoreCreateInfo, nullptr, &renderingCompleteSemaphore_); + res = ppsspp_vkCreateSemaphore(vulkan_->GetDevice(), &semaphoreCreateInfo, nullptr, &renderingCompleteSemaphore_); _dbg_assert_(res == VK_SUCCESS); inflightFramesAtStart_ = vulkan_->GetInflightFrames(); @@ -177,9 +177,9 @@ VulkanRenderManager::VulkanRenderManager(VulkanContext *vulkan) : vulkan_(vulkan VkCommandPoolCreateInfo cmd_pool_info = { VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO }; cmd_pool_info.queueFamilyIndex = vulkan_->GetGraphicsQueueFamilyIndex(); cmd_pool_info.flags = VK_COMMAND_POOL_CREATE_TRANSIENT_BIT | VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT; - VkResult res = vkCreateCommandPool(vulkan_->GetDevice(), &cmd_pool_info, nullptr, &frameData_[i].cmdPoolInit); + VkResult res = ppsspp_vkCreateCommandPool(vulkan_->GetDevice(), &cmd_pool_info, nullptr, &frameData_[i].cmdPoolInit); _dbg_assert_(res == VK_SUCCESS); - res = vkCreateCommandPool(vulkan_->GetDevice(), &cmd_pool_info, nullptr, &frameData_[i].cmdPoolMain); + res = ppsspp_vkCreateCommandPool(vulkan_->GetDevice(), &cmd_pool_info, nullptr, &frameData_[i].cmdPoolMain); _dbg_assert_(res == VK_SUCCESS); VkCommandBufferAllocateInfo cmd_alloc = { VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO }; @@ -187,10 +187,10 @@ VulkanRenderManager::VulkanRenderManager(VulkanContext *vulkan) : vulkan_(vulkan cmd_alloc.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; cmd_alloc.commandBufferCount = 1; - res = vkAllocateCommandBuffers(vulkan_->GetDevice(), &cmd_alloc, &frameData_[i].initCmd); + res = ppsspp_vkAllocateCommandBuffers(vulkan_->GetDevice(), &cmd_alloc, &frameData_[i].initCmd); _dbg_assert_(res == VK_SUCCESS); cmd_alloc.commandPool = frameData_[i].cmdPoolMain; - res = vkAllocateCommandBuffers(vulkan_->GetDevice(), &cmd_alloc, &frameData_[i].mainCmd); + res = ppsspp_vkAllocateCommandBuffers(vulkan_->GetDevice(), &cmd_alloc, &frameData_[i].mainCmd); _dbg_assert_(res == VK_SUCCESS); // Creating the frame fence with true so they can be instantly waited on the first frame @@ -202,7 +202,7 @@ VulkanRenderManager::VulkanRenderManager(VulkanContext *vulkan) : vulkan_(vulkan VkQueryPoolCreateInfo query_ci{ VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO }; query_ci.queryCount = MAX_TIMESTAMP_QUERIES; query_ci.queryType = VK_QUERY_TYPE_TIMESTAMP; - res = vkCreateQueryPool(vulkan_->GetDevice(), &query_ci, nullptr, &frameData_[i].profile.queryPool); + res = ppsspp_vkCreateQueryPool(vulkan_->GetDevice(), &query_ci, nullptr, &frameData_[i].profile.queryPool); } queueRunner_.CreateDeviceObjects(); @@ -219,11 +219,11 @@ bool VulkanRenderManager::CreateBackbuffers() { ERROR_LOG(G3D, "No swapchain - can't create backbuffers"); return false; } - VkResult res = vkGetSwapchainImagesKHR(vulkan_->GetDevice(), vulkan_->GetSwapchain(), &swapchainImageCount_, nullptr); + VkResult res = ppsspp_vkGetSwapchainImagesKHR(vulkan_->GetDevice(), vulkan_->GetSwapchain(), &swapchainImageCount_, nullptr); _dbg_assert_(res == VK_SUCCESS); VkImage *swapchainImages = new VkImage[swapchainImageCount_]; - res = vkGetSwapchainImagesKHR(vulkan_->GetDevice(), vulkan_->GetSwapchain(), &swapchainImageCount_, swapchainImages); + res = ppsspp_vkGetSwapchainImagesKHR(vulkan_->GetDevice(), vulkan_->GetSwapchain(), &swapchainImageCount_, swapchainImages); if (res != VK_SUCCESS) { ERROR_LOG(G3D, "vkGetSwapchainImagesKHR failed"); delete[] swapchainImages; @@ -255,7 +255,7 @@ bool VulkanRenderManager::CreateBackbuffers() { // the backbuffer renderpass starts out with them being auto-transitioned from UNDEFINED anyway. // Also, turns out it's illegal to transition un-acquired images, thanks Hans-Kristian. See #11417. - res = vkCreateImageView(vulkan_->GetDevice(), &color_image_view, nullptr, &sc_buffer.view); + res = ppsspp_vkCreateImageView(vulkan_->GetDevice(), &color_image_view, nullptr, &sc_buffer.view); swapchainImages_.push_back(sc_buffer); _dbg_assert_(res == VK_SUCCESS); } @@ -323,7 +323,7 @@ void VulkanRenderManager::StopThread() { _assert_(frameData.steps.empty()); if (frameData.hasInitCommands) { // Clear 'em out. This can happen on restart sometimes. - vkEndCommandBuffer(frameData.initCmd); + ppsspp_vkEndCommandBuffer(frameData.initCmd); frameData.hasInitCommands = false; } frameData.readyForRun = false; @@ -377,16 +377,16 @@ VulkanRenderManager::~VulkanRenderManager() { vulkan_->WaitUntilQueueIdle(); VkDevice device = vulkan_->GetDevice(); - vkDestroySemaphore(device, acquireSemaphore_, nullptr); - vkDestroySemaphore(device, renderingCompleteSemaphore_, nullptr); + ppsspp_vkDestroySemaphore(device, acquireSemaphore_, nullptr); + ppsspp_vkDestroySemaphore(device, renderingCompleteSemaphore_, nullptr); for (int i = 0; i < inflightFramesAtStart_; i++) { - vkFreeCommandBuffers(device, frameData_[i].cmdPoolInit, 1, &frameData_[i].initCmd); - vkFreeCommandBuffers(device, frameData_[i].cmdPoolMain, 1, &frameData_[i].mainCmd); - vkDestroyCommandPool(device, frameData_[i].cmdPoolInit, nullptr); - vkDestroyCommandPool(device, frameData_[i].cmdPoolMain, nullptr); - vkDestroyFence(device, frameData_[i].fence, nullptr); - vkDestroyFence(device, frameData_[i].readbackFence, nullptr); - vkDestroyQueryPool(device, frameData_[i].profile.queryPool, nullptr); + ppsspp_vkFreeCommandBuffers(device, frameData_[i].cmdPoolInit, 1, &frameData_[i].initCmd); + ppsspp_vkFreeCommandBuffers(device, frameData_[i].cmdPoolMain, 1, &frameData_[i].mainCmd); + ppsspp_vkDestroyCommandPool(device, frameData_[i].cmdPoolInit, nullptr); + ppsspp_vkDestroyCommandPool(device, frameData_[i].cmdPoolMain, nullptr); + ppsspp_vkDestroyFence(device, frameData_[i].fence, nullptr); + ppsspp_vkDestroyFence(device, frameData_[i].readbackFence, nullptr); + ppsspp_vkDestroyQueryPool(device, frameData_[i].profile.queryPool, nullptr); } queueRunner_.DestroyDeviceObjects(); } @@ -432,7 +432,7 @@ void VulkanRenderManager::ThreadFunc() { } // Wait for the device to be done with everything, before tearing stuff down. - vkDeviceWaitIdle(vulkan_->GetDevice()); + ppsspp_vkDeviceWaitIdle(vulkan_->GetDevice()); VLOG("PULL: Quitting"); } @@ -456,8 +456,8 @@ void VulkanRenderManager::BeginFrame(bool enableProfiling) { VLOG("PUSH: Fencing %d", curFrame); - vkWaitForFences(device, 1, &frameData.fence, true, UINT64_MAX); - vkResetFences(device, 1, &frameData.fence); + ppsspp_vkWaitForFences(device, 1, &frameData.fence, true, UINT64_MAX); + ppsspp_vkResetFences(device, 1, &frameData.fence); // Can't set this until after the fence. frameData.profilingEnabled_ = enableProfiling; @@ -469,7 +469,7 @@ void VulkanRenderManager::BeginFrame(bool enableProfiling) { // Pull the profiling results from last time and produce a summary! if (!frameData.profile.timestampDescriptions.empty()) { int numQueries = (int)frameData.profile.timestampDescriptions.size(); - VkResult res = vkGetQueryPoolResults( + VkResult res = ppsspp_vkGetQueryPoolResults( vulkan_->GetDevice(), frameData.profile.queryPool, 0, numQueries, sizeof(uint64_t) * numQueries, &queryResults[0], sizeof(uint64_t), VK_QUERY_RESULT_64_BIT); @@ -518,8 +518,8 @@ void VulkanRenderManager::BeginFrame(bool enableProfiling) { frameData.profile.timestampDescriptions.push_back("initCmd Begin"); frameData.profile.timestampDescriptions.push_back("initCmd"); VkCommandBuffer initCmd = GetInitCmd(); - vkCmdResetQueryPool(initCmd, frameData.profile.queryPool, 0, MAX_TIMESTAMP_QUERIES); - vkCmdWriteTimestamp(initCmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, frameData.profile.queryPool, 0); + ppsspp_vkCmdResetQueryPool(initCmd, frameData.profile.queryPool, 0, MAX_TIMESTAMP_QUERIES); + ppsspp_vkCmdWriteTimestamp(initCmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, frameData.profile.queryPool, 0); } } @@ -532,7 +532,7 @@ VkCommandBuffer VulkanRenderManager::GetInitCmd() { nullptr, VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT }; - VkResult res = vkBeginCommandBuffer(frameData.initCmd, &begin); + VkResult res = ppsspp_vkBeginCommandBuffer(frameData.initCmd, &begin); if (res != VK_SUCCESS) { return VK_NULL_HANDLE; } @@ -794,7 +794,7 @@ bool VulkanRenderManager::InitBackbufferFramebuffers(int width, int height) { for (uint32_t i = 0; i < swapchainImageCount_; i++) { attachments[0] = swapchainImages_[i].view; - res = vkCreateFramebuffer(vulkan_->GetDevice(), &fb_info, nullptr, &framebuffers_[i]); + res = ppsspp_vkCreateFramebuffer(vulkan_->GetDevice(), &fb_info, nullptr, &framebuffers_[i]); _dbg_assert_(res == VK_SUCCESS); if (res != VK_SUCCESS) { framebuffers_.clear(); @@ -829,7 +829,7 @@ bool VulkanRenderManager::InitDepthStencilBuffer(VkCommandBuffer cmd) { depth_.format = depth_format; VkDevice device = vulkan_->GetDevice(); - res = vkCreateImage(device, &image_info, nullptr, &depth_.image); + res = ppsspp_vkCreateImage(device, &image_info, nullptr, &depth_.image); _dbg_assert_(res == VK_SUCCESS); if (res != VK_SUCCESS) return false; @@ -858,12 +858,12 @@ bool VulkanRenderManager::InitDepthStencilBuffer(VkCommandBuffer cmd) { if (!pass) return false; - res = vkAllocateMemory(device, &mem_alloc, NULL, &depth_.mem); + res = ppsspp_vkAllocateMemory(device, &mem_alloc, NULL, &depth_.mem); _dbg_assert_(res == VK_SUCCESS); if (res != VK_SUCCESS) return false; - res = vkBindImageMemory(device, depth_.image, depth_.mem, 0); + res = ppsspp_vkBindImageMemory(device, depth_.image, depth_.mem, 0); _dbg_assert_(res == VK_SUCCESS); if (res != VK_SUCCESS) return false; @@ -889,7 +889,7 @@ bool VulkanRenderManager::InitDepthStencilBuffer(VkCommandBuffer cmd) { depth_view_info.viewType = VK_IMAGE_VIEW_TYPE_2D; depth_view_info.flags = 0; - res = vkCreateImageView(device, &depth_view_info, NULL, &depth_.view); + res = ppsspp_vkCreateImageView(device, &depth_view_info, NULL, &depth_.view); _dbg_assert_(res == VK_SUCCESS); if (res != VK_SUCCESS) return false; @@ -1183,7 +1183,7 @@ void VulkanRenderManager::BeginSubmitFrame(int frame) { if (!frameData.hasBegun) { // Get the index of the next available swapchain image, and a semaphore to block command buffer execution on. // Now, I wonder if we should do this early in the frame or late? Right now we do it early, which should be fine. - VkResult res = vkAcquireNextImageKHR(vulkan_->GetDevice(), vulkan_->GetSwapchain(), UINT64_MAX, acquireSemaphore_, (VkFence)VK_NULL_HANDLE, &frameData.curSwapchainImage); + VkResult res = ppsspp_vkAcquireNextImageKHR(vulkan_->GetDevice(), vulkan_->GetSwapchain(), UINT64_MAX, acquireSemaphore_, (VkFence)VK_NULL_HANDLE, &frameData.curSwapchainImage); if (res == VK_SUBOPTIMAL_KHR) { // Hopefully the resize will happen shortly. Ignore - one frame might look bad or something. WARN_LOG(G3D, "VK_SUBOPTIMAL_KHR returned - ignoring"); @@ -1196,7 +1196,7 @@ void VulkanRenderManager::BeginSubmitFrame(int frame) { VkCommandBufferBeginInfo begin{ VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO }; begin.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT; - res = vkBeginCommandBuffer(frameData.mainCmd, &begin); + res = ppsspp_vkBeginCommandBuffer(frameData.mainCmd, &begin); _assert_msg_(res == VK_SUCCESS, "vkBeginCommandBuffer failed! result=%s", VulkanResultToString(res)); @@ -1211,13 +1211,13 @@ void VulkanRenderManager::Submit(int frame, bool triggerFrameFence) { if (frameData.hasInitCommands) { if (frameData.profilingEnabled_ && triggerFrameFence) { // Pre-allocated query ID 1. - vkCmdWriteTimestamp(frameData.initCmd, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, frameData.profile.queryPool, 1); + ppsspp_vkCmdWriteTimestamp(frameData.initCmd, VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, frameData.profile.queryPool, 1); } - VkResult res = vkEndCommandBuffer(frameData.initCmd); + VkResult res = ppsspp_vkEndCommandBuffer(frameData.initCmd); _assert_msg_(res == VK_SUCCESS, "vkEndCommandBuffer failed (init)! result=%s", VulkanResultToString(res)); } - VkResult res = vkEndCommandBuffer(frameData.mainCmd); + VkResult res = ppsspp_vkEndCommandBuffer(frameData.mainCmd); _assert_msg_(res == VK_SUCCESS, "vkEndCommandBuffer failed (main)! result=%s", VulkanResultToString(res)); VkCommandBuffer cmdBufs[2]; @@ -1229,7 +1229,7 @@ void VulkanRenderManager::Submit(int frame, bool triggerFrameFence) { VkSubmitInfo submit_info{ VK_STRUCTURE_TYPE_SUBMIT_INFO }; submit_info.commandBufferCount = (uint32_t)numCmdBufs; submit_info.pCommandBuffers = cmdBufs; - res = vkQueueSubmit(vulkan_->GetGraphicsQueue(), 1, &submit_info, VK_NULL_HANDLE); + res = ppsspp_vkQueueSubmit(vulkan_->GetGraphicsQueue(), 1, &submit_info, VK_NULL_HANDLE); if (res == VK_ERROR_DEVICE_LOST) { _assert_msg_(false, "Lost the Vulkan device in split submit! If this happens again, switch Graphics Backend away from Vulkan"); } else { @@ -1253,7 +1253,7 @@ void VulkanRenderManager::Submit(int frame, bool triggerFrameFence) { submit_info.signalSemaphoreCount = 1; submit_info.pSignalSemaphores = &renderingCompleteSemaphore_; } - res = vkQueueSubmit(vulkan_->GetGraphicsQueue(), 1, &submit_info, triggerFrameFence ? frameData.fence : frameData.readbackFence); + res = ppsspp_vkQueueSubmit(vulkan_->GetGraphicsQueue(), 1, &submit_info, triggerFrameFence ? frameData.fence : frameData.readbackFence); if (res == VK_ERROR_DEVICE_LOST) { _assert_msg_(false, "Lost the Vulkan device in vkQueueSubmit! If this happens again, switch Graphics Backend away from Vulkan"); } else { @@ -1286,7 +1286,7 @@ void VulkanRenderManager::EndSubmitFrame(int frame) { present.pWaitSemaphores = &renderingCompleteSemaphore_; present.waitSemaphoreCount = 1; - VkResult res = vkQueuePresentKHR(vulkan_->GetGraphicsQueue(), &present); + VkResult res = ppsspp_vkQueuePresentKHR(vulkan_->GetGraphicsQueue(), &present); if (res == VK_ERROR_OUT_OF_DATE_KHR) { // We clearly didn't get this in vkAcquireNextImageKHR because of the skipSwap check above. // Do the increment. @@ -1342,8 +1342,8 @@ void VulkanRenderManager::EndSyncFrame(int frame) { Submit(frame, false); // Hard stall of the GPU, not ideal, but necessary so the CPU has the contents of the readback. - vkWaitForFences(vulkan_->GetDevice(), 1, &frameData.readbackFence, true, UINT64_MAX); - vkResetFences(vulkan_->GetDevice(), 1, &frameData.readbackFence); + ppsspp_vkWaitForFences(vulkan_->GetDevice(), 1, &frameData.readbackFence, true, UINT64_MAX); + ppsspp_vkResetFences(vulkan_->GetDevice(), 1, &frameData.readbackFence); // At this point we can resume filling the command buffers for the current frame since // we know the device is idle - and thus all previously enqueued command buffers have been processed. @@ -1353,7 +1353,7 @@ void VulkanRenderManager::EndSyncFrame(int frame) { nullptr, VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT }; - VkResult res = vkBeginCommandBuffer(frameData.mainCmd, &begin); + VkResult res = ppsspp_vkBeginCommandBuffer(frameData.mainCmd, &begin); _assert_(res == VK_SUCCESS); if (useThread_) { diff --git a/Common/GPU/Vulkan/thin3d_vulkan.cpp b/Common/GPU/Vulkan/thin3d_vulkan.cpp index 5946ef0e14cc..9003b059d78c 100644 --- a/Common/GPU/Vulkan/thin3d_vulkan.cpp +++ b/Common/GPU/Vulkan/thin3d_vulkan.cpp @@ -667,7 +667,7 @@ class VKSamplerState : public SamplerState { s.minFilter = desc.minFilter == TextureFilter::LINEAR ? VK_FILTER_LINEAR : VK_FILTER_NEAREST; s.mipmapMode = desc.mipFilter == TextureFilter::LINEAR ? VK_SAMPLER_MIPMAP_MODE_LINEAR : VK_SAMPLER_MIPMAP_MODE_NEAREST; s.maxLod = desc.maxLod; - VkResult res = vkCreateSampler(vulkan_->GetDevice(), &s, nullptr, &sampler_); + VkResult res = ppsspp_vkCreateSampler(vulkan_->GetDevice(), &s, nullptr, &sampler_); _assert_(VK_SUCCESS == res); } ~VKSamplerState() { @@ -837,7 +837,7 @@ VKContext::VKContext(VulkanContext *vulkan, bool splitSubmit) for (int i = 0; i < VulkanContext::MAX_INFLIGHT_FRAMES; i++) { VkBufferUsageFlags usage = VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT; frame_[i].pushBuffer = new VulkanPushBuffer(vulkan_, 1024 * 1024, usage); - VkResult res = vkCreateDescriptorPool(device_, &dp, nullptr, &frame_[i].descriptorPool); + VkResult res = ppsspp_vkCreateDescriptorPool(device_, &dp, nullptr, &frame_[i].descriptorPool); _assert_(res == VK_SUCCESS); } @@ -861,7 +861,7 @@ VKContext::VKContext(VulkanContext *vulkan, bool splitSubmit) VkDescriptorSetLayoutCreateInfo dsl = { VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO }; dsl.bindingCount = ARRAY_SIZE(bindings); dsl.pBindings = bindings; - VkResult res = vkCreateDescriptorSetLayout(device_, &dsl, nullptr, &descriptorSetLayout_); + VkResult res = ppsspp_vkCreateDescriptorSetLayout(device_, &dsl, nullptr, &descriptorSetLayout_); _assert_(VK_SUCCESS == res); VkPipelineLayoutCreateInfo pl = { VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO }; @@ -869,11 +869,11 @@ VKContext::VKContext(VulkanContext *vulkan, bool splitSubmit) pl.pushConstantRangeCount = 0; pl.setLayoutCount = 1; pl.pSetLayouts = &descriptorSetLayout_; - res = vkCreatePipelineLayout(device_, &pl, nullptr, &pipelineLayout_); + res = ppsspp_vkCreatePipelineLayout(device_, &pl, nullptr, &pipelineLayout_); _assert_(VK_SUCCESS == res); VkPipelineCacheCreateInfo pc{ VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO }; - res = vkCreatePipelineCache(vulkan_->GetDevice(), &pc, nullptr, &pipelineCache_); + res = ppsspp_vkCreatePipelineCache(vulkan_->GetDevice(), &pc, nullptr, &pipelineCache_); _assert_(VK_SUCCESS == res); renderManager_.SetSplitSubmit(splitSubmit); @@ -914,7 +914,7 @@ void VKContext::BeginFrame() { allocator_->Begin(); frame.descSets_.clear(); - VkResult result = vkResetDescriptorPool(device_, frame.descriptorPool, 0); + VkResult result = ppsspp_vkResetDescriptorPool(device_, frame.descriptorPool, 0); _assert_(result == VK_SUCCESS); } @@ -970,7 +970,7 @@ VkDescriptorSet VKContext::GetOrCreateDescriptorSet(VkBuffer buf) { alloc.descriptorPool = frame->descriptorPool; alloc.pSetLayouts = &descriptorSetLayout_; alloc.descriptorSetCount = 1; - VkResult res = vkAllocateDescriptorSets(device_, &alloc, &descSet); + VkResult res = ppsspp_vkAllocateDescriptorSets(device_, &alloc, &descSet); _assert_(VK_SUCCESS == res); VkDescriptorBufferInfo bufferDesc; @@ -1016,7 +1016,7 @@ VkDescriptorSet VKContext::GetOrCreateDescriptorSet(VkBuffer buf) { } } - vkUpdateDescriptorSets(device_, numWrites, writes, 0, nullptr); + ppsspp_vkUpdateDescriptorSets(device_, numWrites, writes, 0, nullptr); frame->descSets_[key] = descSet; return descSet; @@ -1111,7 +1111,7 @@ Pipeline *VKContext::CreateGraphicsPipeline(const PipelineDesc &desc) { // OK, need to create new pipelines. VkPipeline pipelines[2]{}; - VkResult result = vkCreateGraphicsPipelines(device_, pipelineCache_, 2, createInfo, nullptr, pipelines); + VkResult result = ppsspp_vkCreateGraphicsPipelines(device_, pipelineCache_, 2, createInfo, nullptr, pipelines); if (result != VK_SUCCESS) { ERROR_LOG(G3D, "Failed to create graphics pipeline"); delete pipeline; @@ -1439,7 +1439,7 @@ std::vector VKContext::GetExtensionList() const { uint32_t VKContext::GetDataFormatSupport(DataFormat fmt) const { VkFormat vulkan_format = DataFormatToVulkan(fmt); VkFormatProperties properties; - vkGetPhysicalDeviceFormatProperties(vulkan_->GetCurrentPhysicalDevice(), vulkan_format, &properties); + ppsspp_vkGetPhysicalDeviceFormatProperties(vulkan_->GetCurrentPhysicalDevice(), vulkan_format, &properties); uint32_t flags = 0; if (properties.optimalTilingFeatures & VkFormatFeatureFlagBits::VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) { flags |= FMT_RENDERTARGET; diff --git a/GPU/Vulkan/DrawEngineVulkan.cpp b/GPU/Vulkan/DrawEngineVulkan.cpp index 54ebc209cae4..92330244ba3b 100644 --- a/GPU/Vulkan/DrawEngineVulkan.cpp +++ b/GPU/Vulkan/DrawEngineVulkan.cpp @@ -139,7 +139,7 @@ void DrawEngineVulkan::InitDeviceObjects() { VkDescriptorSetLayoutCreateInfo dsl{ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO }; dsl.bindingCount = ARRAY_SIZE(bindings); dsl.pBindings = bindings; - VkResult res = vkCreateDescriptorSetLayout(device, &dsl, nullptr, &descriptorSetLayout_); + VkResult res = ppsspp_vkCreateDescriptorSetLayout(device, &dsl, nullptr, &descriptorSetLayout_); _dbg_assert_(VK_SUCCESS == res); // We are going to use one-shot descriptors in the initial implementation. Might look into caching them @@ -161,7 +161,7 @@ void DrawEngineVulkan::InitDeviceObjects() { pl.setLayoutCount = 1; pl.pSetLayouts = &descriptorSetLayout_; pl.flags = 0; - res = vkCreatePipelineLayout(device, &pl, nullptr, &pipelineLayout_); + res = ppsspp_vkCreatePipelineLayout(device, &pl, nullptr, &pipelineLayout_); _dbg_assert_(VK_SUCCESS == res); VkSamplerCreateInfo samp{ VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO }; @@ -172,9 +172,9 @@ void DrawEngineVulkan::InitDeviceObjects() { samp.flags = 0; samp.magFilter = VK_FILTER_NEAREST; samp.minFilter = VK_FILTER_NEAREST; - res = vkCreateSampler(device, &samp, nullptr, &samplerSecondary_); + res = ppsspp_vkCreateSampler(device, &samp, nullptr, &samplerSecondary_); _dbg_assert_(VK_SUCCESS == res); - res = vkCreateSampler(device, &samp, nullptr, &nullSampler_); + res = ppsspp_vkCreateSampler(device, &samp, nullptr, &nullSampler_); _dbg_assert_(VK_SUCCESS == res); vertexCache_ = new VulkanPushBuffer(vulkan_, VERTEX_CACHE_SIZE, VK_BUFFER_USAGE_INDEX_BUFFER_BIT | VK_BUFFER_USAGE_VERTEX_BUFFER_BIT); @@ -299,7 +299,7 @@ void DrawEngineVulkan::BeginFrame() { if (--descDecimationCounter_ <= 0) { if (frame->descPool != VK_NULL_HANDLE) - vkResetDescriptorPool(vulkan_->GetDevice(), frame->descPool, 0); + ppsspp_vkResetDescriptorPool(vulkan_->GetDevice(), frame->descPool, 0); frame->descSets.Clear(); frame->descCount = 0; descDecimationCounter_ = DESCRIPTORSET_DECIMATION_INTERVAL; @@ -382,7 +382,7 @@ VkResult DrawEngineVulkan::RecreateDescriptorPool(FrameData &frame, int newSize) dp.pPoolSizes = dpTypes; dp.poolSizeCount = ARRAY_SIZE(dpTypes); - VkResult res = vkCreateDescriptorPool(vulkan_->GetDevice(), &dp, nullptr, &frame.descPool); + VkResult res = ppsspp_vkCreateDescriptorPool(vulkan_->GetDevice(), &dp, nullptr, &frame.descPool); return res; } @@ -421,7 +421,7 @@ VkDescriptorSet DrawEngineVulkan::GetOrCreateDescriptorSet(VkImageView imageView descAlloc.pSetLayouts = &descriptorSetLayout_; descAlloc.descriptorPool = frame.descPool; descAlloc.descriptorSetCount = 1; - VkResult result = vkAllocateDescriptorSets(vulkan_->GetDevice(), &descAlloc, &desc); + VkResult result = ppsspp_vkAllocateDescriptorSets(vulkan_->GetDevice(), &descAlloc, &desc); if (result == VK_ERROR_FRAGMENTED_POOL || result < 0) { // There seems to have been a spec revision. Here we should apparently recreate the descriptor pool, @@ -430,7 +430,7 @@ VkDescriptorSet DrawEngineVulkan::GetOrCreateDescriptorSet(VkImageView imageView VkResult res = RecreateDescriptorPool(frame, frame.descPoolSize); _assert_msg_(res == VK_SUCCESS, "Ran out of descriptor space (frag?) and failed to recreate a descriptor pool. sz=%d res=%d", (int)frame.descSets.size(), (int)res); descAlloc.descriptorPool = frame.descPool; // Need to update this pointer since we have allocated a new one. - result = vkAllocateDescriptorSets(vulkan_->GetDevice(), &descAlloc, &desc); + result = ppsspp_vkAllocateDescriptorSets(vulkan_->GetDevice(), &descAlloc, &desc); _assert_msg_(result == VK_SUCCESS, "Ran out of descriptor space (frag?) and failed to allocate after recreating a descriptor pool. res=%d", (int)result); } @@ -545,7 +545,7 @@ VkDescriptorSet DrawEngineVulkan::GetOrCreateDescriptorSet(VkImageView imageView n++; } - vkUpdateDescriptorSets(vulkan_->GetDevice(), n, writes, 0, nullptr); + ppsspp_vkUpdateDescriptorSets(vulkan_->GetDevice(), n, writes, 0, nullptr); if (!tess) // Again, avoid caching when HW tessellation. frame.descSets.Insert(key, desc); diff --git a/GPU/Vulkan/FramebufferManagerVulkan.cpp b/GPU/Vulkan/FramebufferManagerVulkan.cpp index ac60198cb96b..24fc74fe1f8f 100644 --- a/GPU/Vulkan/FramebufferManagerVulkan.cpp +++ b/GPU/Vulkan/FramebufferManagerVulkan.cpp @@ -115,11 +115,11 @@ void FramebufferManagerVulkan::InitDeviceObjects() { samp.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; samp.magFilter = VK_FILTER_NEAREST; samp.minFilter = VK_FILTER_NEAREST; - VkResult res = vkCreateSampler(vulkan_->GetDevice(), &samp, nullptr, &nearestSampler_); + VkResult res = ppsspp_vkCreateSampler(vulkan_->GetDevice(), &samp, nullptr, &nearestSampler_); _assert_(res == VK_SUCCESS); samp.magFilter = VK_FILTER_LINEAR; samp.minFilter = VK_FILTER_LINEAR; - res = vkCreateSampler(vulkan_->GetDevice(), &samp, nullptr, &linearSampler_); + res = ppsspp_vkCreateSampler(vulkan_->GetDevice(), &samp, nullptr, &linearSampler_); _assert_(res == VK_SUCCESS); } diff --git a/GPU/Vulkan/PipelineManagerVulkan.cpp b/GPU/Vulkan/PipelineManagerVulkan.cpp index 5c707baa9f03..4683e237757f 100644 --- a/GPU/Vulkan/PipelineManagerVulkan.cpp +++ b/GPU/Vulkan/PipelineManagerVulkan.cpp @@ -321,7 +321,7 @@ static VulkanPipeline *CreateVulkanPipeline(VkDevice device, VkPipelineCache pip pipe.subpass = 0; VkPipeline pipeline; - VkResult result = vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipe, nullptr, &pipeline); + VkResult result = ppsspp_vkCreateGraphicsPipelines(device, pipelineCache, 1, &pipe, nullptr, &pipeline); if (result != VK_SUCCESS) { ERROR_LOG(G3D, "Failed creating graphics pipeline! result='%s'", VulkanResultToString(result)); if (result == VK_INCOMPLETE) { @@ -355,7 +355,7 @@ static VulkanPipeline *CreateVulkanPipeline(VkDevice device, VkPipelineCache pip VulkanPipeline *PipelineManagerVulkan::GetOrCreatePipeline(VkPipelineLayout layout, VkRenderPass renderPass, const VulkanPipelineRasterStateKey &rasterKey, const DecVtxFormat *decFmt, VulkanVertexShader *vs, VulkanFragmentShader *fs, bool useHwTransform) { if (!pipelineCache_) { VkPipelineCacheCreateInfo pc{ VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO }; - VkResult res = vkCreatePipelineCache(vulkan_->GetDevice(), &pc, nullptr, &pipelineCache_); + VkResult res = ppsspp_vkCreatePipelineCache(vulkan_->GetDevice(), &pc, nullptr, &pipelineCache_); _assert_(VK_SUCCESS == res); } @@ -618,7 +618,7 @@ void PipelineManagerVulkan::SaveCache(FILE *file, bool saveRawPipelineCache, Sha if (saveRawPipelineCache) { // WARNING: See comment in LoadCache before using this path. - VkResult result = vkGetPipelineCacheData(vulkan_->GetDevice(), pipelineCache_, &dataSize, nullptr); + VkResult result = ppsspp_vkGetPipelineCacheData(vulkan_->GetDevice(), pipelineCache_, &dataSize, nullptr); uint32_t size = (uint32_t)dataSize; if (result != VK_SUCCESS) { size = 0; @@ -626,7 +626,7 @@ void PipelineManagerVulkan::SaveCache(FILE *file, bool saveRawPipelineCache, Sha return; } std::unique_ptr buffer(new uint8_t[dataSize]); - vkGetPipelineCacheData(vulkan_->GetDevice(), pipelineCache_, &dataSize, buffer.get()); + ppsspp_vkGetPipelineCacheData(vulkan_->GetDevice(), pipelineCache_, &dataSize, buffer.get()); size = (uint32_t)dataSize; fwrite(&size, sizeof(size), 1, file); fwrite(buffer.get(), 1, size, file); @@ -730,20 +730,20 @@ bool PipelineManagerVulkan::LoadCache(FILE *file, bool loadRawPipelineCache, Sha pc.initialDataSize = size; pc.flags = 0; VkPipelineCache cache; - VkResult res = vkCreatePipelineCache(vulkan_->GetDevice(), &pc, nullptr, &cache); + VkResult res = ppsspp_vkCreatePipelineCache(vulkan_->GetDevice(), &pc, nullptr, &cache); if (res != VK_SUCCESS) { return false; } if (!pipelineCache_) { pipelineCache_ = cache; } else { - vkMergePipelineCaches(vulkan_->GetDevice(), pipelineCache_, 1, &cache); + ppsspp_vkMergePipelineCaches(vulkan_->GetDevice(), pipelineCache_, 1, &cache); } NOTICE_LOG(G3D, "Loaded Vulkan pipeline cache (%d bytes).", (int)size); } else { if (!pipelineCache_) { VkPipelineCacheCreateInfo pc{ VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO }; - VkResult res = vkCreatePipelineCache(vulkan_->GetDevice(), &pc, nullptr, &pipelineCache_); + VkResult res = ppsspp_vkCreatePipelineCache(vulkan_->GetDevice(), &pc, nullptr, &pipelineCache_); if (res != VK_SUCCESS) { return false; } diff --git a/GPU/Vulkan/TextureCacheVulkan.cpp b/GPU/Vulkan/TextureCacheVulkan.cpp index 4158b99c2182..1b0068c6b0b6 100644 --- a/GPU/Vulkan/TextureCacheVulkan.cpp +++ b/GPU/Vulkan/TextureCacheVulkan.cpp @@ -243,7 +243,7 @@ VkSampler SamplerCache::GetOrCreateSampler(const SamplerCacheKey &key) { samp.minLod = (float)(int32_t)key.minLevel * (1.0f / 256.0f); samp.mipLodBias = (float)(int32_t)key.lodBias * (1.0f / 256.0f); - VkResult res = vkCreateSampler(vulkan_->GetDevice(), &samp, nullptr, &sampler); + VkResult res = ppsspp_vkCreateSampler(vulkan_->GetDevice(), &samp, nullptr, &sampler); _assert_(res == VK_SUCCESS); cache_.Insert(key, sampler); return sampler; @@ -352,7 +352,7 @@ void TextureCacheVulkan::DeviceRestore(VulkanContext *vulkan, Draw::DrawContext samp.magFilter = VK_FILTER_NEAREST; samp.minFilter = VK_FILTER_NEAREST; samp.mipmapMode = VK_SAMPLER_MIPMAP_MODE_NEAREST; - VkResult res = vkCreateSampler(vulkan_->GetDevice(), &samp, nullptr, &samplerNearest_); + VkResult res = ppsspp_vkCreateSampler(vulkan_->GetDevice(), &samp, nullptr, &samplerNearest_); _assert_(res == VK_SUCCESS); CompileScalingShader(); @@ -933,9 +933,9 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) { } else if (dstFmt == VULKAN_565_FORMAT) { params.fmt = 6; } - vkCmdBindDescriptorSets(cmdInit, VK_PIPELINE_BIND_POINT_COMPUTE, computeShaderManager_.GetPipelineLayout(), 0, 1, &descSet, 0, nullptr); - vkCmdPushConstants(cmdInit, computeShaderManager_.GetPipelineLayout(), VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(params), ¶ms); - vkCmdDispatch(cmdInit, (mipWidth + 15) / 16, (mipHeight + 15) / 16, 1); + ppsspp_vkCmdBindDescriptorSets(cmdInit, VK_PIPELINE_BIND_POINT_COMPUTE, computeShaderManager_.GetPipelineLayout(), 0, 1, &descSet, 0, nullptr); + ppsspp_vkCmdPushConstants(cmdInit, computeShaderManager_.GetPipelineLayout(), VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(params), ¶ms); + ppsspp_vkCmdDispatch(cmdInit, (mipWidth + 15) / 16, (mipHeight + 15) / 16, 1); }; if (fakeMipmap) { @@ -951,7 +951,7 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) { // This format can be used with storage images. VkImageView view = entry->vkTex->CreateViewForMip(i); VkDescriptorSet descSet = computeShaderManager_.GetDescriptorSet(view, texBuf, bufferOffset, srcSize); - vkCmdBindPipeline(cmdInit, VK_PIPELINE_BIND_POINT_COMPUTE, computeShaderManager_.GetPipeline(uploadCS_)); + ppsspp_vkCmdBindPipeline(cmdInit, VK_PIPELINE_BIND_POINT_COMPUTE, computeShaderManager_.GetPipeline(uploadCS_)); dispatchCompute(descSet); vulkan_->Delete().QueueDeleteImageView(view); } else if (computeCopy) { @@ -967,7 +967,7 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) { localOffset = (uint32_t)drawEngine_->GetPushBufferLocal()->Allocate(localSize, &localBuf); VkDescriptorSet descSet = computeShaderManager_.GetDescriptorSet(VK_NULL_HANDLE, texBuf, bufferOffset, srcSize, localBuf, localOffset, localSize); - vkCmdBindPipeline(cmdInit, VK_PIPELINE_BIND_POINT_COMPUTE, computeShaderManager_.GetPipeline(copyCS_)); + ppsspp_vkCmdBindPipeline(cmdInit, VK_PIPELINE_BIND_POINT_COMPUTE, computeShaderManager_.GetPipeline(copyCS_)); dispatchCompute(descSet); // After the compute, before the copy, we need a memory barrier. @@ -979,7 +979,7 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) { barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; barrier.offset = localOffset; barrier.size = localSize; - vkCmdPipelineBarrier(cmdInit, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, + ppsspp_vkCmdPipelineBarrier(cmdInit, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 1, &barrier, 0, nullptr); entry->vkTex->UploadMip(cmdInit, i, mipWidth, mipHeight, localBuf, localOffset, stride / bpp); diff --git a/GPU/Vulkan/VulkanUtil.cpp b/GPU/Vulkan/VulkanUtil.cpp index e54c7c4840f6..d74df3d302e2 100644 --- a/GPU/Vulkan/VulkanUtil.cpp +++ b/GPU/Vulkan/VulkanUtil.cpp @@ -67,7 +67,7 @@ void Vulkan2D::DestroyDeviceObjects() { void Vulkan2D::InitDeviceObjects() { VkPipelineCacheCreateInfo pc{ VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO }; - VkResult res = vkCreatePipelineCache(vulkan_->GetDevice(), &pc, nullptr, &pipelineCache_); + VkResult res = ppsspp_vkCreatePipelineCache(vulkan_->GetDevice(), &pc, nullptr, &pipelineCache_); _assert_(VK_SUCCESS == res); VkDescriptorSetLayoutBinding bindings[2] = {}; @@ -87,7 +87,7 @@ void Vulkan2D::InitDeviceObjects() { VkDescriptorSetLayoutCreateInfo dsl = { VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO }; dsl.bindingCount = 2; dsl.pBindings = bindings; - res = vkCreateDescriptorSetLayout(device, &dsl, nullptr, &descriptorSetLayout_); + res = ppsspp_vkCreateDescriptorSetLayout(device, &dsl, nullptr, &descriptorSetLayout_); _assert_(VK_SUCCESS == res); VkDescriptorPoolSize dpTypes[1]; @@ -100,7 +100,7 @@ void Vulkan2D::InitDeviceObjects() { dp.pPoolSizes = dpTypes; dp.poolSizeCount = ARRAY_SIZE(dpTypes); for (int i = 0; i < vulkan_->GetInflightFrames(); i++) { - VkResult res = vkCreateDescriptorPool(vulkan_->GetDevice(), &dp, nullptr, &frameData_[i].descPool); + VkResult res = ppsspp_vkCreateDescriptorPool(vulkan_->GetDevice(), &dp, nullptr, &frameData_[i].descPool); _assert_(VK_SUCCESS == res); } @@ -115,7 +115,7 @@ void Vulkan2D::InitDeviceObjects() { pl.setLayoutCount = 1; pl.pSetLayouts = &descriptorSetLayout_; pl.flags = 0; - res = vkCreatePipelineLayout(device, &pl, nullptr, &pipelineLayout_); + res = ppsspp_vkCreatePipelineLayout(device, &pl, nullptr, &pipelineLayout_); _assert_(VK_SUCCESS == res); } @@ -132,7 +132,7 @@ void Vulkan2D::BeginFrame() { int curFrame = vulkan_->GetCurFrame(); FrameData &frame = frameData_[curFrame]; frame.descSets.clear(); - vkResetDescriptorPool(vulkan_->GetDevice(), frame.descPool, 0); + ppsspp_vkResetDescriptorPool(vulkan_->GetDevice(), frame.descPool, 0); } void Vulkan2D::EndFrame() { @@ -190,7 +190,7 @@ VkDescriptorSet Vulkan2D::GetDescriptorSet(VkImageView tex1, VkSampler sampler1, descAlloc.pSetLayouts = &descriptorSetLayout_; descAlloc.descriptorPool = frame->descPool; descAlloc.descriptorSetCount = 1; - VkResult result = vkAllocateDescriptorSets(vulkan_->GetDevice(), &descAlloc, &desc); + VkResult result = ppsspp_vkAllocateDescriptorSets(vulkan_->GetDevice(), &descAlloc, &desc); _assert_(result == VK_SUCCESS); // We just don't write to the slots we don't care about. @@ -225,7 +225,7 @@ VkDescriptorSet Vulkan2D::GetDescriptorSet(VkImageView tex1, VkSampler sampler1, n++; } - vkUpdateDescriptorSets(vulkan_->GetDevice(), n, writes, 0, nullptr); + ppsspp_vkUpdateDescriptorSets(vulkan_->GetDevice(), n, writes, 0, nullptr); frame->descSets[key] = desc; return desc; @@ -361,7 +361,7 @@ VkPipeline Vulkan2D::GetPipeline(VkRenderPass rp, VkShaderModule vs, VkShaderMod pipe.subpass = 0; VkPipeline pipeline; - VkResult result = vkCreateGraphicsPipelines(vulkan_->GetDevice(), pipelineCache_, 1, &pipe, nullptr, &pipeline); + VkResult result = ppsspp_vkCreateGraphicsPipelines(vulkan_->GetDevice(), pipelineCache_, 1, &pipe, nullptr, &pipeline); if (result == VK_SUCCESS) { pipelines_[key] = pipeline; return pipeline; @@ -400,7 +400,7 @@ VulkanComputeShaderManager::~VulkanComputeShaderManager() {} void VulkanComputeShaderManager::InitDeviceObjects() { VkPipelineCacheCreateInfo pc{ VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO }; - VkResult res = vkCreatePipelineCache(vulkan_->GetDevice(), &pc, nullptr, &pipelineCache_); + VkResult res = ppsspp_vkCreatePipelineCache(vulkan_->GetDevice(), &pc, nullptr, &pipelineCache_); _assert_(VK_SUCCESS == res); VkDescriptorSetLayoutBinding bindings[3] = {}; @@ -422,7 +422,7 @@ void VulkanComputeShaderManager::InitDeviceObjects() { VkDescriptorSetLayoutCreateInfo dsl = { VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO }; dsl.bindingCount = ARRAY_SIZE(bindings); dsl.pBindings = bindings; - res = vkCreateDescriptorSetLayout(device, &dsl, nullptr, &descriptorSetLayout_); + res = ppsspp_vkCreateDescriptorSetLayout(device, &dsl, nullptr, &descriptorSetLayout_); _assert_(VK_SUCCESS == res); VkDescriptorPoolSize dpTypes[2]; @@ -437,7 +437,7 @@ void VulkanComputeShaderManager::InitDeviceObjects() { dp.pPoolSizes = dpTypes; dp.poolSizeCount = ARRAY_SIZE(dpTypes); for (int i = 0; i < ARRAY_SIZE(frameData_); i++) { - VkResult res = vkCreateDescriptorPool(vulkan_->GetDevice(), &dp, nullptr, &frameData_[i].descPool); + VkResult res = ppsspp_vkCreateDescriptorPool(vulkan_->GetDevice(), &dp, nullptr, &frameData_[i].descPool); _assert_(VK_SUCCESS == res); } @@ -452,7 +452,7 @@ void VulkanComputeShaderManager::InitDeviceObjects() { pl.setLayoutCount = 1; pl.pSetLayouts = &descriptorSetLayout_; pl.flags = 0; - res = vkCreatePipelineLayout(device, &pl, nullptr, &pipelineLayout_); + res = ppsspp_vkCreatePipelineLayout(device, &pl, nullptr, &pipelineLayout_); _assert_(VK_SUCCESS == res); } @@ -487,7 +487,7 @@ VkDescriptorSet VulkanComputeShaderManager::GetDescriptorSet(VkImageView image, descAlloc.pSetLayouts = &descriptorSetLayout_; descAlloc.descriptorPool = frameData.descPool; descAlloc.descriptorSetCount = 1; - VkResult result = vkAllocateDescriptorSets(vulkan_->GetDevice(), &descAlloc, &desc); + VkResult result = ppsspp_vkAllocateDescriptorSets(vulkan_->GetDevice(), &descAlloc, &desc); _assert_(result == VK_SUCCESS); VkWriteDescriptorSet writes[2]{}; @@ -528,7 +528,7 @@ VkDescriptorSet VulkanComputeShaderManager::GetDescriptorSet(VkImageView image, writes[n].dstSet = desc; n++; } - vkUpdateDescriptorSets(vulkan_->GetDevice(), n, writes, 0, nullptr); + ppsspp_vkUpdateDescriptorSets(vulkan_->GetDevice(), n, writes, 0, nullptr); return desc; } @@ -546,7 +546,7 @@ VkPipeline VulkanComputeShaderManager::GetPipeline(VkShaderModule cs) { pci.layout = pipelineLayout_; pci.flags = 0; - VkResult res = vkCreateComputePipelines(vulkan_->GetDevice(), pipelineCache_, 1, &pci, nullptr, &pipeline); + VkResult res = ppsspp_vkCreateComputePipelines(vulkan_->GetDevice(), pipelineCache_, 1, &pci, nullptr, &pipeline); _assert_(res == VK_SUCCESS); pipelines_.Insert(key, pipeline); @@ -557,7 +557,7 @@ void VulkanComputeShaderManager::BeginFrame() { int curFrame = vulkan_->GetCurFrame(); FrameData &frame = frameData_[curFrame]; frameData_[curFrame].numDescriptors = 0; - vkResetDescriptorPool(vulkan_->GetDevice(), frame.descPool, 0); + ppsspp_vkResetDescriptorPool(vulkan_->GetDevice(), frame.descPool, 0); } void VulkanComputeShaderManager::EndFrame() { diff --git a/libretro/libretro_vulkan.cpp b/libretro/libretro_vulkan.cpp index 8007d31d3ffb..9a1bfcb1a19e 100644 --- a/libretro/libretro_vulkan.cpp +++ b/libretro/libretro_vulkan.cpp @@ -33,16 +33,16 @@ static struct { } vk_init_info; static bool DEDICATED_ALLOCATION; -extern PFN_vkCreateInstance vkCreateInstance; -extern PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties; -extern PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements; -extern PFN_vkAllocateMemory vkAllocateMemory; -extern PFN_vkBindImageMemory vkBindImageMemory; -extern PFN_vkCreateImage vkCreateImage; -extern PFN_vkDestroyImage vkDestroyImage; -extern PFN_vkCreateImageView vkCreateImageView; -extern PFN_vkDestroyImageView vkDestroyImageView; -extern PFN_vkFreeMemory vkFreeMemory; +extern PFN_vkCreateInstance ppsspp_vkCreateInstance; +extern PFN_vkGetPhysicalDeviceMemoryProperties ppsspp_vkGetPhysicalDeviceMemoryProperties; +extern PFN_vkGetImageMemoryRequirements ppsspp_vkGetImageMemoryRequirements; +extern PFN_vkAllocateMemory ppsspp_vkAllocateMemory; +extern PFN_vkBindImageMemory ppsspp_vkBindImageMemory; +extern PFN_vkCreateImage ppsspp_vkCreateImage; +extern PFN_vkDestroyImage ppsspp_vkDestroyImage; +extern PFN_vkCreateImageView ppsspp_vkCreateImageView; +extern PFN_vkDestroyImageView ppsspp_vkDestroyImageView; +extern PFN_vkFreeMemory ppsspp_vkFreeMemory; #define VULKAN_MAX_SWAPCHAIN_IMAGES 8 struct VkSwapchainKHR_T { @@ -76,7 +76,7 @@ static VkSwapchainKHR_T chain; LIBRETRO_VK_WARP_FUNC(vkCreateRenderPass); #define LIBRETRO_VK_WARP_FUNC(x) \ - extern PFN_##x x; \ + extern PFN_##x ppsspp_##x; \ PFN_##x x##_org LIBRETRO_VK_WARP_FUNC(vkGetInstanceProcAddr); @@ -150,7 +150,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR_libretr static bool MemoryTypeFromProperties(uint32_t typeBits, VkFlags requirements_mask, uint32_t *typeIndex) { VkPhysicalDeviceMemoryProperties memory_properties; - vkGetPhysicalDeviceMemoryProperties(vulkan->gpu, &memory_properties); + ppsspp_vkGetPhysicalDeviceMemoryProperties(vulkan->gpu, &memory_properties); // Search memtypes to find first index with those properties for (uint32_t i = 0; i < 32; i++) { if ((typeBits & 1) == 1) { @@ -192,11 +192,11 @@ static VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR_libretro(VkDevice dev info.usage = VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; info.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; - vkCreateImage(device, &info, pAllocator, &chain.images[i].handle); + ppsspp_vkCreateImage(device, &info, pAllocator, &chain.images[i].handle); } VkMemoryRequirements memreq; - vkGetImageMemoryRequirements(device, chain.images[i].handle, &memreq); + ppsspp_vkGetImageMemoryRequirements(device, chain.images[i].handle, &memreq); VkMemoryAllocateInfo alloc{ VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO }; alloc.allocationSize = memreq.size; @@ -208,9 +208,9 @@ static VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR_libretro(VkDevice dev } MemoryTypeFromProperties(memreq.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &alloc.memoryTypeIndex); - VkResult res = vkAllocateMemory(device, &alloc, pAllocator, &chain.images[i].memory); + VkResult res = ppsspp_vkAllocateMemory(device, &alloc, pAllocator, &chain.images[i].memory); assert(res == VK_SUCCESS); - res = vkBindImageMemory(device, chain.images[i].handle, chain.images[i].memory, 0); + res = ppsspp_vkBindImageMemory(device, chain.images[i].handle, chain.images[i].memory, 0); assert(res == VK_SUCCESS); chain.images[i].retro_image.create_info.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; @@ -221,7 +221,7 @@ static VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR_libretro(VkDevice dev chain.images[i].retro_image.create_info.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; chain.images[i].retro_image.create_info.subresourceRange.layerCount = 1; chain.images[i].retro_image.create_info.subresourceRange.levelCount = 1; - res = vkCreateImageView(device, &chain.images[i].retro_image.create_info, pAllocator, &chain.images[i].retro_image.image_view); + res = ppsspp_vkCreateImageView(device, &chain.images[i].retro_image.create_info, pAllocator, &chain.images[i].retro_image.image_view); assert(res == VK_SUCCESS); chain.images[i].retro_image.image_layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; @@ -287,9 +287,9 @@ static VKAPI_ATTR void VKAPI_CALL vkDestroyDevice_libretro(VkDevice device, cons static VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR_libretro(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks *pAllocator) {} static VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR_libretro(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks *pAllocator) { for (int i = 0; i < chain.count; i++) { - vkDestroyImage(device, chain.images[i].handle, pAllocator); - vkDestroyImageView(device, chain.images[i].retro_image.image_view, pAllocator); - vkFreeMemory(device, chain.images[i].memory, pAllocator); + ppsspp_vkDestroyImage(device, chain.images[i].handle, pAllocator); + ppsspp_vkDestroyImageView(device, chain.images[i].retro_image.image_view, pAllocator); + ppsspp_vkFreeMemory(device, chain.images[i].memory, pAllocator); } memset(&chain.images, 0x00, sizeof(chain.images)); @@ -414,11 +414,11 @@ void vk_libretro_init(VkInstance instance, VkPhysicalDevice gpu, VkSurfaceKHR su vk_init_info.num_required_device_layers = num_required_device_layers; vk_init_info.required_features = required_features; - vkGetInstanceProcAddr_org = vkGetInstanceProcAddr; - vkGetInstanceProcAddr = vkGetInstanceProcAddr_libretro; - vkGetDeviceProcAddr_org = vkGetDeviceProcAddr; - vkGetDeviceProcAddr = vkGetDeviceProcAddr_libretro; - vkCreateInstance = vkCreateInstance_libretro; + vkGetInstanceProcAddr_org = ppsspp_vkGetInstanceProcAddr; + ppsspp_vkGetInstanceProcAddr = vkGetInstanceProcAddr_libretro; + vkGetDeviceProcAddr_org = ppsspp_vkGetDeviceProcAddr; + ppsspp_vkGetDeviceProcAddr = vkGetDeviceProcAddr_libretro; + ppsspp_vkCreateInstance = vkCreateInstance_libretro; } void vk_libretro_set_hwrender_interface(retro_hw_render_interface *hw_render_interface) {