Skip to content

Commit

Permalink
[WRAPPER] Display Box64 version in Vulkan driver info (#2385)
Browse files Browse the repository at this point in the history
  • Loading branch information
xctan authored Feb 18, 2025
1 parent 52a9443 commit fdd1509
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/build_info.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
#include "box64version.h"
#ifdef NOGIT
#define GITREV "nogit"
#else
#include "git_head.h"
#endif

#ifndef __BUILD_INFO_H__
#define __BUILD_INFO_H__

void PrintBox64Version(void);

#define BOX64_BUILD_INFO_STR_HELPER(x) #x
#define BOX64_BUILD_INFO_STR(x) BOX64_BUILD_INFO_STR_HELPER(x)

#define BOX64_BUILD_INFO_STRING \
"Box64" \
" v" BOX64_BUILD_INFO_STR(BOX64_MAJOR) "." BOX64_BUILD_INFO_STR(BOX64_MINOR) "." BOX64_BUILD_INFO_STR(BOX64_REVISION) \
" " GITREV

#endif //__BUILD_INFO_H__
1 change: 1 addition & 0 deletions src/wrapped/generated/functions_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6058,6 +6058,7 @@ wrappedvulkan:
- vkDestroyInstance
- vkGetPhysicalDeviceMemoryProperties
- vkGetPhysicalDeviceProperties
- vkGetPhysicalDeviceProperties2
- pFpp:
- vkGetDeviceProcAddr
- vkGetInstanceProcAddr
Expand Down
1 change: 1 addition & 0 deletions src/wrapped/generated/wrappedvulkantypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ typedef void (*vFpuuuupupup_t)(void*, uint32_t, uint32_t, uint32_t, uint32_t, vo
GO(vkDestroyInstance, vFpp_t) \
GO(vkGetPhysicalDeviceMemoryProperties, vFpp_t) \
GO(vkGetPhysicalDeviceProperties, vFpp_t) \
GO(vkGetPhysicalDeviceProperties2, vFpp_t) \
GO(vkGetDeviceProcAddr, pFpp_t) \
GO(vkGetInstanceProcAddr, pFpp_t) \
GO(vkDestroyAccelerationStructureKHR, vFpUp_t) \
Expand Down
29 changes: 29 additions & 0 deletions src/wrapped/wrappedvulkan.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "librarian.h"
#include "callback.h"
#include "myalign.h"
#include "build_info.h"

//extern char* libvulkan;

Expand Down Expand Up @@ -233,6 +234,18 @@ typedef struct my_VkXcbSurfaceCreateInfoKHR_s {
int window;
} my_VkXcbSurfaceCreateInfoKHR_t;

#define VK_MAX_DRIVER_NAME_SIZE 256
#define VK_MAX_DRIVER_INFO_SIZE 256

typedef struct my_VkPhysicalDeviceVulkan12Properties_s {
int sType;
void* pNext;
int driverID;
char driverName[VK_MAX_DRIVER_NAME_SIZE];
char driverInfo[VK_MAX_DRIVER_INFO_SIZE];
uint32_t __others[49];
} my_VkPhysicalDeviceVulkan12Properties_t;

typedef struct my_VkStruct_s {
int sType;
struct my_VkStruct_s* pNext;
Expand Down Expand Up @@ -799,3 +812,19 @@ EXPORT void my_vkDestroyDebugReportCallbackEXT(x64emu_t* emu, void* instance, vo
}

CREATE(vkCreateHeadlessSurfaceEXT)

EXPORT void my_vkGetPhysicalDeviceProperties2(x64emu_t* emu, void* device, void* pProps)
{
my->vkGetPhysicalDeviceProperties2(device, pProps);
my_VkStruct_t *p = pProps;
while (p != NULL) {
// find VkPhysicalDeviceVulkan12Properties
// VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES = 52
if(p->sType == 52) {
my_VkPhysicalDeviceVulkan12Properties_t *pp = (my_VkPhysicalDeviceVulkan12Properties_t*)p;
strncat(pp->driverInfo, " with " BOX64_BUILD_INFO_STRING, VK_MAX_DRIVER_INFO_SIZE - strlen(pp->driverInfo) - 1);
break;
}
p = p->pNext;
}
}
2 changes: 1 addition & 1 deletion src/wrapped/wrappedvulkan_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ GO(vkGetPhysicalDeviceFeatures2, vFpp)
GO(vkGetPhysicalDeviceFormatProperties2, vFpip)
GO(vkGetPhysicalDeviceImageFormatProperties2, iFppp)
GO(vkGetPhysicalDeviceMemoryProperties2, vFpp)
GO(vkGetPhysicalDeviceProperties2, vFpp)
GOM(vkGetPhysicalDeviceProperties2, vFEpp)
GO(vkGetPhysicalDeviceQueueFamilyProperties2, vFppp) //VkQueueFamilyProperties2 seems OK
GO(vkGetPhysicalDeviceSparseImageFormatProperties2, vFpppp) //VkSparseImageFormatProperties2 seems OK
GO(vkGetPhysicalDeviceToolProperties, iFppp)
Expand Down

0 comments on commit fdd1509

Please sign in to comment.