Skip to content

Commit

Permalink
Prevent dlopen collisions between ppsspp_libretro.so and libvulkan.so
Browse files Browse the repository at this point in the history
  • Loading branch information
amverweij committed Aug 20, 2021
1 parent 3c62fbc commit cc00a41
Show file tree
Hide file tree
Showing 14 changed files with 378 additions and 359 deletions.
2 changes: 2 additions & 0 deletions Common/GPU/Vulkan/VulkanContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#define new DBG_NEW
#endif

using namespace PPSSPP;

VulkanLogOptions g_LogOptions;

static const char *validationLayers[] = {
Expand Down
2 changes: 2 additions & 0 deletions Common/GPU/Vulkan/VulkanImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include "Common/GPU/Vulkan/VulkanMemory.h"
#include "Common/Log.h"

using namespace PPSSPP;

void VulkanTexture::Wipe() {
if (image_) {
vulkan_->Delete().QueueDeleteImage(image_);
Expand Down
356 changes: 180 additions & 176 deletions Common/GPU/Vulkan/VulkanLoader.cpp

Large diffs are not rendered by default.

345 changes: 174 additions & 171 deletions Common/GPU/Vulkan/VulkanLoader.h

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Common/GPU/Vulkan/VulkanMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include "Common/TimeUtil.h"
#include "Common/GPU/Vulkan/VulkanMemory.h"

using namespace PPSSPP;

VulkanPushBuffer::VulkanPushBuffer(VulkanContext *vulkan, size_t size, VkBufferUsageFlags usage, VkMemoryPropertyFlags memoryPropertyMask)
: vulkan_(vulkan), memoryPropertyMask_(memoryPropertyMask), size_(size), usage_(usage) {
bool res = AddBuffer();
Expand Down
2 changes: 2 additions & 0 deletions Common/GPU/Vulkan/VulkanQueueRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include "VulkanQueueRunner.h"
#include "VulkanRenderManager.h"

using namespace PPSSPP;

// Debug help: adb logcat -s DEBUG PPSSPPNativeActivity PPSSPP NativeGLView NativeRenderer NativeSurfaceView PowerSaveModeReceiver InputDeviceState

static void MergeRenderAreaRectInto(VkRect2D *dest, VkRect2D &src) {
Expand Down
2 changes: 2 additions & 0 deletions Common/GPU/Vulkan/VulkanRenderManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#define UINT64_MAX 0xFFFFFFFFFFFFFFFFULL
#endif

using namespace PPSSPP;

VKRFramebuffer::VKRFramebuffer(VulkanContext *vk, VkCommandBuffer initCmd, VkRenderPass renderPass, int _width, int _height, const char *tag) : vulkan_(vk) {
width = _width;
height = _height;
Expand Down
2 changes: 2 additions & 0 deletions Common/GPU/Vulkan/thin3d_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@

#include "Common/GPU/Vulkan/VulkanLoader.h"

using namespace PPSSPP;

namespace Draw {

// This can actually be replaced with a cast as the values are in the right order.
Expand Down
1 change: 1 addition & 0 deletions GPU/Vulkan/DrawEngineVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include "GPU/Vulkan/FramebufferManagerVulkan.h"
#include "GPU/Vulkan/GPU_Vulkan.h"

using namespace PPSSPP;

enum {
VERTEX_CACHE_SIZE = 8192 * 1024
Expand Down
2 changes: 2 additions & 0 deletions GPU/Vulkan/FramebufferManagerVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
#include "GPU/Vulkan/ShaderManagerVulkan.h"
#include "GPU/Vulkan/VulkanUtil.h"

using namespace PPSSPP;

static const char tex_fs[] = R"(#version 450
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable
Expand Down
2 changes: 2 additions & 0 deletions GPU/Vulkan/PipelineManagerVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "Common/GPU/Vulkan/VulkanRenderManager.h"
#include "Common/GPU/Vulkan/VulkanQueueRunner.h"

using namespace PPSSPP;

PipelineManagerVulkan::PipelineManagerVulkan(VulkanContext *vulkan) : pipelines_(256), vulkan_(vulkan) {
// The pipeline cache is created on demand (or explicitly through Load).
}
Expand Down
2 changes: 2 additions & 0 deletions GPU/Vulkan/TextureCacheVulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
#include "GPU/Vulkan/ShaderManagerVulkan.h"
#include "GPU/Vulkan/DrawEngineVulkan.h"

using namespace PPSSPP;

#define TEXCACHE_MIN_SLAB_SIZE (8 * 1024 * 1024)
#define TEXCACHE_MAX_SLAB_SIZE (32 * 1024 * 1024)
#define TEXCACHE_SLAB_PRESSURE 4
Expand Down
2 changes: 2 additions & 0 deletions GPU/Vulkan/VulkanUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include "Common/GPU/Vulkan/VulkanContext.h"
#include "GPU/Vulkan/VulkanUtil.h"

using namespace PPSSPP;

const VkComponentMapping VULKAN_4444_SWIZZLE = { VK_COMPONENT_SWIZZLE_A, VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B };
const VkComponentMapping VULKAN_1555_SWIZZLE = { VK_COMPONENT_SWIZZLE_B, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_A };
const VkComponentMapping VULKAN_565_SWIZZLE = { VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY };
Expand Down
15 changes: 3 additions & 12 deletions libretro/libretro_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@
#include <mutex>
#include <condition_variable>

#include "Common/GPU/Vulkan/VulkanLoader.h"
#include "Common/Log.h"
#include "Core/Config.h"

#define VK_NO_PROTOTYPES
#include "libretro/libretro_vulkan.h"

using namespace PPSSPP;

static retro_hw_render_interface_vulkan *vulkan;

static struct {
Expand All @@ -33,17 +36,6 @@ 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;

#define VULKAN_MAX_SWAPCHAIN_IMAGES 8
struct VkSwapchainKHR_T {
uint32_t count;
Expand Down Expand Up @@ -76,7 +68,6 @@ static VkSwapchainKHR_T chain;
LIBRETRO_VK_WARP_FUNC(vkCreateRenderPass);

#define LIBRETRO_VK_WARP_FUNC(x) \
extern PFN_##x x; \
PFN_##x x##_org

LIBRETRO_VK_WARP_FUNC(vkGetInstanceProcAddr);
Expand Down

0 comments on commit cc00a41

Please sign in to comment.