Thunks: Annotate pointer parameters throughout all thunked libraries

This commit is contained in:
Tony Wasserka 2023-10-25 12:01:25 +02:00
parent 0f3d14e7c0
commit 7149da387a
29 changed files with 470 additions and 6 deletions

View File

@ -7,6 +7,10 @@ struct fex_gen_config {
unsigned version = 1;
};
// Function, parameter index, parameter type [optional]
template<auto, int, typename = void>
struct fex_gen_param {};
template<> struct fex_gen_config<eglBindAPI> {};
template<> struct fex_gen_config<eglChooseConfig> {};
template<> struct fex_gen_config<eglDestroyContext> {};
@ -23,4 +27,7 @@ template<> struct fex_gen_config<eglCreateWindowSurface> {};
template<> struct fex_gen_config<eglGetCurrentContext> {};
template<> struct fex_gen_config<eglGetCurrentDisplay> {};
template<> struct fex_gen_config<eglGetCurrentSurface> {};
// EGLNativeDisplayType is a pointer to opaque data (wl_display/(X)Display/...)
template<> struct fex_gen_config<eglGetDisplay> {};
template<> struct fex_gen_param<eglGetDisplay, 0, EGLNativeDisplayType> : fexgen::assume_compatible_data_layout {};

View File

@ -11,6 +11,8 @@
#undef GL_ARB_viewport_array
#include "glcorearb.h"
#include <type_traits>
template<auto>
struct fex_gen_config {
unsigned version = 1;
@ -18,6 +20,25 @@ struct fex_gen_config {
template<> struct fex_gen_config<glXGetProcAddress> : fexgen::custom_guest_entrypoint, fexgen::returns_guest_pointer {};
template<typename>
struct fex_gen_type {};
template<> struct fex_gen_type<std::remove_pointer_t<GLXContext>> : fexgen::opaque_type {};
template<> struct fex_gen_type<std::remove_pointer_t<GLXFBConfig>> : fexgen::opaque_type {};
template<> struct fex_gen_type<std::remove_pointer_t<GLsync>> : fexgen::opaque_type {};
// NOTE: These should be opaque, but actually aren't because the respective libraries aren't thunked
template<> struct fex_gen_type<_cl_context> : fexgen::opaque_type {};
template<> struct fex_gen_type<_cl_event> : fexgen::opaque_type {};
// Opaque for the purpose of libGL
template<> struct fex_gen_type<_XDisplay> : fexgen::opaque_type {};
#ifndef IS_32BIT_THUNK
// TODO: These are largely compatible, *but* contain function pointer members that need adjustment!
template<> struct fex_gen_type<XExtData> : fexgen::assume_compatible_data_layout {};
#endif
// Symbols queryable through glXGetProcAddr
namespace internal {
template<auto>

View File

@ -14,6 +14,8 @@ extern "C" {
#include <X11/Xproto.h>
#include <X11/XKBlib.h>
#include <X11/extensions/extutil.h>
// Include Xlibint.h and undefine some of its macros that clash with the standard library
#include <X11/Xlibint.h>
#undef min

View File

@ -20,12 +20,20 @@ extern "C" {
#undef min
#undef max
#define XTRANS_SEND_FDS 1
#include <X11/Xtrans/Xtransint.h>
#include <X11/Xutil.h>
#include <X11/Xregion.h>
#include <X11/Xresource.h>
#include <X11/Xproto.h>
#include <X11/extensions/extutil.h>
#include <X11/extensions/XKBstr.h>
#include <X11/extensions/XKBgeom.h>
#include <X11/Xtrans/Xtransint.h>
}
#include "common/Host.h"

View File

@ -10,11 +10,15 @@ extern "C" {
#include <X11/ImUtil.h>
#include <X11/extensions/extutil.h>
#include <X11/extensions/Xext.h>
#include <X11/extensions/XKBgeom.h>
#include <X11/Xlibint.h>
#include <X11/XKBlib.h>
#include <X11/Xtrans/Xtransint.h>
#include <X11/Xutil.h>
}
@ -28,6 +32,10 @@ struct fex_gen_config {
template<typename>
struct fex_gen_type {};
// Function, parameter index, parameter type [optional]
template<auto, int, typename = void>
struct fex_gen_param {};
template<> struct fex_gen_type<XID(Display*)> {}; // XDisplay::resource_alloc
// NOTE: only indirect calls to this are allowed
@ -54,6 +62,61 @@ template<> struct fex_gen_type<unsigned long(XImage*, int, int)> {}; // XIm
template<> struct fex_gen_type<int(XImage*, int, int, unsigned long)> {}; // XImage::f.put_pixel
template<> struct fex_gen_type<int(XImage*, long)> {}; // XImage::f.add_pixel
template<> struct fex_gen_type<std::remove_pointer_t<XIC>> : fexgen::opaque_type {};
template<> struct fex_gen_type<std::remove_pointer_t<XIM>> : fexgen::opaque_type {};
template<> struct fex_gen_type<std::remove_pointer_t<XOC>> : fexgen::opaque_type {};
template<> struct fex_gen_type<std::remove_pointer_t<XOM>> : fexgen::opaque_type {};
template<> struct fex_gen_type<_XrmHashBucketRec> : fexgen::opaque_type {};
template<> struct fex_gen_type<_XkbInfoRec> : fexgen::opaque_type {};
template<> struct fex_gen_type<_XContextDB> : fexgen::opaque_type {};
template<> struct fex_gen_type<_XDisplayAtoms> : fexgen::opaque_type {};
template<> struct fex_gen_type<_XLockInfo> : fexgen::opaque_type {};
template<> struct fex_gen_type<_XIMFilter> : fexgen::opaque_type {};
template<> struct fex_gen_type<_XErrorThreadInfo> : fexgen::opaque_type {};
template<> struct fex_gen_type<_XKeytrans> : fexgen::opaque_type {};
template<> struct fex_gen_type<_X11XCBPrivate> : fexgen::opaque_type {};
#ifndef IS_32BIT_THUNK
// This has a public definition but is used as an opaque type in most APIs
template<> struct fex_gen_type<std::remove_pointer_t<Region>> : fexgen::assume_compatible_data_layout {};
// Union types
template<> struct fex_gen_type<XEvent> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<xEvent> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<XkbDoodadRec> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<xReply> : fexgen::assume_compatible_data_layout {};
// Union type of all sorts of different X objects... Further, XEHeadOfExtensionList casts this to XExtData**.
// This is likely highly unsafe to assume compatible.
template<> struct fex_gen_type<XEDataObject> : fexgen::assume_compatible_data_layout {};
// Linked-list types
template<> struct fex_gen_type<_XtransConnFd> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<_XkbDeviceLedChanges> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<_XQEvent> : fexgen::assume_compatible_data_layout {};
// Contains nontrivial circular pointer relationships
template<> struct fex_gen_type<XkbOverlayRec> : fexgen::assume_compatible_data_layout {};
// TODO: These are largely compatible, *but* contain function pointer members that need adjustment!
template<> struct fex_gen_type<_XConnWatchInfo> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<XExtData> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<_XLockPtrs> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<_XFreeFuncRec> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<_XExtension> : fexgen::assume_compatible_data_layout {}; // Also contains linked-list pointers
template<> struct fex_gen_type<_XConnectionInfo> : fexgen::assume_compatible_data_layout {}; // Also contains linked-list pointers
template<> struct fex_gen_type<_XInternalAsync> : fexgen::assume_compatible_data_layout {}; // Also contains linked-list pointers
template<> struct fex_gen_type<_XDisplay> : fexgen::assume_compatible_data_layout {};
// TODO: This contains a nested struct type of function pointer members
template<> struct fex_gen_type<XImage> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<XExtensionHooks> : fexgen::assume_compatible_data_layout {};
#endif
// Union type (each member is defined in terms of char members)
template<> struct fex_gen_type<XkbAction> : fexgen::assume_compatible_data_layout {};
// Xlibint
template<> struct fex_gen_config<_XGetRequest> {};
template<> struct fex_gen_config<_XFlushGCCache> {};

View File

@ -35,6 +35,8 @@ extern "C" {
#include <X11/extensions/syncconst.h>
#include <X11/extensions/syncproto.h>
//#include <X11/extensions/XTest.h>
#undef min
#undef max
#include "common/Guest.h"

View File

@ -8,6 +8,7 @@ $end_info$
#include <X11/Xlib.h>
#include <X11/Xlibint.h>
#include <X11/Xregion.h>
#include <X11/Xutil.h>
#include <X11/Xproto.h>
#include <X11/extensions/Xext.h>
@ -38,6 +39,12 @@ extern "C" {
#include <X11/extensions/syncproto.h>
//#include <X11/extensions/XTest.h>
#define XTRANS_SEND_FDS 1
#include <X11/Xtrans/Xtransint.h>
#undef min
#undef max
#include "common/Host.h"
#include <dlfcn.h>

View File

@ -2,6 +2,7 @@
#include <X11/Xlib.h>
#include <X11/Xlibint.h>
#include <X11/Xregion.h>
#include <X11/extensions/Xext.h>
#include <X11/extensions/dpms.h>
#include <X11/extensions/XEVI.h>
@ -16,12 +17,52 @@
extern "C" {
#include <X11/extensions/extutil.h>
}
#include <X11/Xtrans/Xtransint.h>
template<auto>
struct fex_gen_config {
unsigned version = 6;
};
template<typename>
struct fex_gen_type {};
template<> struct fex_gen_type<_X11XCBPrivate> : fexgen::opaque_type {};
template<> struct fex_gen_type<_XContextDB> : fexgen::opaque_type {};
template<> struct fex_gen_type<_XDisplayAtoms> : fexgen::opaque_type {};
template<> struct fex_gen_type<_XErrorThreadInfo> : fexgen::opaque_type {};
template<> struct fex_gen_type<_XIMFilter> : fexgen::opaque_type {};
template<> struct fex_gen_type<_XkbInfoRec> : fexgen::opaque_type {};
template<> struct fex_gen_type<_XKeytrans> : fexgen::opaque_type {};
template<> struct fex_gen_type<_XLockInfo> : fexgen::opaque_type {};
template<> struct fex_gen_type<_XrmHashBucketRec> : fexgen::opaque_type {};
#ifndef IS_32BIT_THUNK
// Union types
template<> struct fex_gen_type<XEvent> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<xEvent> : fexgen::assume_compatible_data_layout {};
// Linked-list types
template<> struct fex_gen_type<_XtransConnFd> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<_XQEvent> : fexgen::assume_compatible_data_layout {};
// TODO: These are largely compatible, *but* contain function pointer members that need adjustment!
template<> struct fex_gen_type<_XConnectionInfo> : fexgen::assume_compatible_data_layout {}; // Also contains linked-list pointers
template<> struct fex_gen_type<_XConnWatchInfo> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<_XDisplay> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<XExtData> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<XExtDisplayInfo> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<_XExtension> : fexgen::assume_compatible_data_layout {}; // Also contains linked-list pointers
template<> struct fex_gen_type<_XInternalAsync> : fexgen::assume_compatible_data_layout {}; // Also contains linked-list pointers
// Contains nontrivial circular pointer relationships
template<> struct fex_gen_type<Screen> : fexgen::assume_compatible_data_layout {};
// TODO: This contains a nested struct type of function pointer members
template<> struct fex_gen_type<XImage> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<XExtensionHooks> : fexgen::assume_compatible_data_layout {};
#endif
template<> struct fex_gen_config<DPMSCapable> {};
template<> struct fex_gen_config<DPMSDisable> {};
template<> struct fex_gen_config<DPMSEnable> {};

View File

@ -6,9 +6,14 @@ $end_info$
#include <stdio.h>
extern "C" {
#include <X11/Xlib.h>
#include <X11/Xlibint.h>
#include <X11/Xutil.h>
#include <X11/extensions/Xfixes.h>
}
#undef min
#undef max
#include "common/Host.h"
#include <dlfcn.h>

View File

@ -1,12 +1,24 @@
#include <common/GeneratorInterface.h>
extern "C" {
#include <X11/extensions/Xfixes.h>
#include <X11/Xlibint.h>
}
template<auto>
struct fex_gen_config {
unsigned version = 3;
};
template<typename>
struct fex_gen_type {};
#ifndef IS_32BIT_THUNK
// TODO: These are largely compatible, *but* contain function pointer members that need adjustment!
template<> struct fex_gen_type<XExtData> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<_XDisplay> : fexgen::assume_compatible_data_layout {};
#endif
template<> struct fex_gen_config<XFixesGetCursorName> {};
template<> struct fex_gen_config<XFixesQueryExtension> {};
template<> struct fex_gen_config<XFixesQueryVersion> {};

View File

@ -6,9 +6,15 @@ $end_info$
#include <stdio.h>
extern "C" {
#include <X11/Xlib.h>
#include <X11/Xlibint.h>
#include <X11/Xregion.h>
#include <X11/Xutil.h>
#include <X11/extensions/Xrender.h>
}
#undef min
#undef max
#include "common/Host.h"
#include <dlfcn.h>

View File

@ -2,11 +2,28 @@
#include <X11/extensions/Xrender.h>
#include <type_traits>
template<auto>
struct fex_gen_config {
unsigned version = 1;
};
template<typename>
struct fex_gen_type {};
// Struct with multi-dimensional array member. Compatible data layout across all architectures
template<> struct fex_gen_type<_XTransform> : fexgen::assume_compatible_data_layout {};
#ifndef IS_32BIT_THUNK
// This has a public definition but is used as an opaque type in most APIs
template<> struct fex_gen_type<std::remove_pointer_t<Region>> : fexgen::assume_compatible_data_layout {};
// TODO: These are largely compatible, *but* contain function pointer members that need adjustment!
template<> struct fex_gen_type<XExtData> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<_XDisplay> : fexgen::assume_compatible_data_layout {};
#endif
template<> struct fex_gen_config<XRenderCreateAnimCursor> {};
template<> struct fex_gen_config<XRenderCreateCursor> {};
template<> struct fex_gen_config<XRenderCreateGlyphSet> {};

View File

@ -3,11 +3,99 @@
#include <alsa/asoundlib.h>
#include <alsa/version.h>
#include <type_traits>
template<auto>
struct fex_gen_config {
unsigned version = 2;
};
// Function, parameter index, parameter type [optional]
template<auto, int, typename = void>
struct fex_gen_param {};
template<typename>
struct fex_gen_type {};
template<> struct fex_gen_type<snd_pcm_status_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_shm_area> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_async_handler_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<std::remove_pointer_t<snd_config_iterator_t>> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_config_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_config_update_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_ctl_card_info_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_ctl_elem_id_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_ctl_elem_info_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_ctl_elem_list_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_ctl_elem_value_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_ctl_event_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_ctl_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_devname_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_hctl_elem_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_hctl_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_hwdep_dsp_image_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_hwdep_dsp_status_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_hwdep_info_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_hwdep_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_input_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_midi_event_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_mixer_class_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_mixer_elem_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_mixer_selem_id_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_mixer_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_output_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_pcm_access_mask_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_pcm_format_mask_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_pcm_hook_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_pcm_hw_params_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_pcm_info_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_pcm_scope_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_pcm_subformat_mask_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_pcm_sw_params_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_pcm_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_rawmidi_info_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_rawmidi_params_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_rawmidi_status_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_rawmidi_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_sctl_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_seq_client_info_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_seq_client_pool_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_seq_ev_ext_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_seq_port_info_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_seq_port_subscribe_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_seq_query_subscribe_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_seq_queue_info_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_seq_queue_status_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_seq_queue_tempo_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_seq_queue_timer_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_seq_remove_events_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_seq_system_info_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_seq_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_timer_ginfo_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_timer_gparams_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_timer_gstatus_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_timer_id_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_timer_info_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_timer_params_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_timer_query_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_timer_status_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_timer_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<snd_timestamp_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<FILE> : fexgen::opaque_type {};
// Union types with compatible data layout
template<> struct fex_gen_type<snd_pcm_sync_id_t> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<snd_seq_timestamp> : fexgen::assume_compatible_data_layout {};
// Has anonymous union member
template<> struct fex_gen_type<snd_seq_event> : fexgen::assume_compatible_data_layout {};
#ifndef IS_32BIT_THUNK
// TODO: Convert vtable
template<> struct fex_gen_type<snd_pcm_scope_ops_t> : fexgen::assume_compatible_data_layout {};
#endif
template<> struct fex_gen_config<snd_asoundlib_version> {};
#if SND_LIB_VERSION < ((1 << 16) | (2 << 8) | (6))
// Exists on 1.2.6

View File

@ -7,6 +7,21 @@ struct fex_gen_config {
unsigned version = 2;
};
template<typename>
struct fex_gen_type {};
#ifndef IS_32BIT_THUNK
// Union types with compatible data layout
template<> struct fex_gen_type<drmDevice> : fexgen::assume_compatible_data_layout {};
// Anonymous sub-structs
template<> struct fex_gen_type<drmStatsT> : fexgen::assume_compatible_data_layout {};
// TODO: Convert vtable
template<> struct fex_gen_type<drmServerInfo> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<drmEventContext> : fexgen::assume_compatible_data_layout {};
#endif
size_t FEX_usable_size(void*);
void FEX_free_on_host(void*);

View File

@ -4,6 +4,8 @@ tags: thunklibs|Vulkan
$end_info$
*/
#define VK_USE_64_BIT_PTR_DEFINES 0
#define VK_USE_PLATFORM_XLIB_XRANDR_EXT
#define VK_USE_PLATFORM_XLIB_KHR
#define VK_USE_PLATFORM_XCB_KHR

View File

@ -4,6 +4,8 @@ tags: thunklibs|Vulkan
$end_info$
*/
#define VK_USE_64_BIT_PTR_DEFINES 0
#define VK_USE_PLATFORM_XLIB_XRANDR_EXT
#define VK_USE_PLATFORM_XLIB_KHR
#define VK_USE_PLATFORM_XCB_KHR
@ -91,8 +93,8 @@ static void FEXFN_IMPL(vkFreeMemory)(VkDevice a_0, VkDeviceMemory a_1, const VkA
LDR_PTR(vkFreeMemory)(a_0, a_1, nullptr);
}
static VkResult FEXFN_IMPL(vkCreateDebugReportCallbackEXT)(VkInstance a_0, const VkDebugReportCallbackCreateInfoEXT* a_1, const VkAllocationCallbacks* a_2, VkDebugReportCallbackEXT* a_3) {
VkDebugReportCallbackCreateInfoEXT overridden_callback = *a_1;
static VkResult FEXFN_IMPL(vkCreateDebugReportCallbackEXT)(VkInstance a_0, guest_layout<const VkDebugReportCallbackCreateInfoEXT*> a_1, const VkAllocationCallbacks* a_2, VkDebugReportCallbackEXT* a_3) {
VkDebugReportCallbackCreateInfoEXT overridden_callback = *a_1.data;
overridden_callback.pfnCallback = DummyVkDebugReportCallback;
(void*&)LDR_PTR(vkCreateDebugReportCallbackEXT) = (void*)LDR_PTR(vkGetInstanceProcAddr)(a_0, "vkCreateDebugReportCallbackEXT");
return LDR_PTR(vkCreateDebugReportCallbackEXT)(a_0, &overridden_callback, nullptr, a_3);
@ -103,6 +105,21 @@ static void FEXFN_IMPL(vkDestroyDebugReportCallbackEXT)(VkInstance a_0, VkDebugR
LDR_PTR(vkDestroyDebugReportCallbackEXT)(a_0, a_1, nullptr);
}
extern "C" VkBool32 DummyVkDebugUtilsMessengerCallback(
VkDebugUtilsMessageSeverityFlagBitsEXT, VkDebugUtilsMessageTypeFlagsEXT,
const VkDebugUtilsMessengerCallbackDataEXT*, void*) {
return VK_FALSE;
}
static VkResult FEXFN_IMPL(vkCreateDebugUtilsMessengerEXT)(
VkInstance_T* a_0, guest_layout<const VkDebugUtilsMessengerCreateInfoEXT*> a_1,
const VkAllocationCallbacks* a_2, VkDebugUtilsMessengerEXT* a_3) {
VkDebugUtilsMessengerCreateInfoEXT overridden_callback = *a_1.data;
overridden_callback.pfnUserCallback = DummyVkDebugUtilsMessengerCallback;
(void*&)LDR_PTR(vkCreateDebugUtilsMessengerEXT) = (void*)LDR_PTR(vkGetInstanceProcAddr)(a_0, "vkCreateDebugUtilsMessengerEXT");
return LDR_PTR(vkCreateDebugUtilsMessengerEXT)(a_0, &overridden_callback, nullptr, a_3);
}
static PFN_vkVoidFunction FEXFN_IMPL(vkGetDeviceProcAddr)(VkDevice a_0, const char* a_1) {
// Just return the host facing function pointer
// The guest will handle mapping if this exists

View File

@ -1,10 +1,19 @@
#include <common/GeneratorInterface.h>
#include <type_traits>
template<auto>
struct fex_gen_config {
unsigned version = 1;
};
// Some of Vulkan's handle types are so-called "non-dispatchable handles".
// On 64-bit, these are defined as dedicated types by default, which makes
// annotating these handle types unnecessarily complicated. Instead, setting
// the following define will make the Vulkan headers alias all handle types
// to uint64_t.
#define VK_USE_64_BIT_PTR_DEFINES 0
#define VK_USE_PLATFORM_XLIB_XRANDR_EXT
#define VK_USE_PLATFORM_XLIB_KHR
#define VK_USE_PLATFORM_XCB_KHR
@ -14,6 +23,52 @@ struct fex_gen_config {
template<> struct fex_gen_config<vkGetDeviceProcAddr> : fexgen::custom_host_impl, fexgen::custom_guest_entrypoint, fexgen::returns_guest_pointer {};
template<> struct fex_gen_config<vkGetInstanceProcAddr> : fexgen::custom_host_impl, fexgen::custom_guest_entrypoint, fexgen::returns_guest_pointer {};
template<typename>
struct fex_gen_type {};
// So-called "dispatchable" handles are represented as opaque pointers.
// In addition to marking them as such, API functions that create these objects
// need special care since they wrap these handles in another pointer, which
// the thunk generator can't automatically handle.
//
// So-called "non-dispatchable" handles don't need this extra treatment, since
// they are uint64_t IDs on both 32-bit and 64-bit systems.
template<> struct fex_gen_type<VkCommandBuffer_T> : fexgen::opaque_type {};
template<> struct fex_gen_type<VkDevice_T> : fexgen::opaque_type {};
template<> struct fex_gen_type<VkInstance_T> : fexgen::opaque_type {};
template<> struct fex_gen_type<VkPhysicalDevice_T> : fexgen::opaque_type {};
template<> struct fex_gen_type<VkQueue_T> : fexgen::opaque_type {};
// Mark union types with compatible layout as such
// TODO: These may still have different alignment requirements!
template<> struct fex_gen_type<VkClearValue> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<VkClearColorValue> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<VkPipelineExecutableStatisticValueKHR> : fexgen::assume_compatible_data_layout {};
#ifndef IS_32BIT_THUNK
template<> struct fex_gen_type<VkAccelerationStructureGeometryDataKHR> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<VkDescriptorDataEXT> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<VkDeviceOrHostAddressKHR> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<VkDeviceOrHostAddressConstKHR> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_type<VkPerformanceValueDataINTEL> : fexgen::assume_compatible_data_layout {};
#endif
#ifndef IS_32BIT_THUNK
// The pNext member of this is a pointer to another VkBaseOutStructure, so data layout compatibility can't be inferred automatically
template<> struct fex_gen_type<VkBaseOutStructure> : fexgen::assume_compatible_data_layout {};
#endif
// TODO: Should not be opaque, but it's usually NULL anyway. Supporting the contained function pointers will need more work.
template<> struct fex_gen_type<VkAllocationCallbacks> : fexgen::opaque_type {};
// X11 interop
template<> struct fex_gen_type<Display> : fexgen::opaque_type {};
template<> struct fex_gen_type<xcb_connection_t> : fexgen::opaque_type {};
// Wayland interop
template<> struct fex_gen_type<wl_display> : fexgen::opaque_type {};
template<> struct fex_gen_type<wl_surface> : fexgen::opaque_type {};
namespace internal {
// Function, parameter index, parameter type [optional]
@ -31,6 +86,7 @@ template<> struct fex_gen_config<vkEnumeratePhysicalDevices> {};
template<> struct fex_gen_config<vkGetPhysicalDeviceFeatures> {};
template<> struct fex_gen_config<vkGetPhysicalDeviceFormatProperties> {};
template<> struct fex_gen_config<vkGetPhysicalDeviceImageFormatProperties> {};
// TODO: Output parameter must repack on exit!
template<> struct fex_gen_config<vkGetPhysicalDeviceProperties> {};
template<> struct fex_gen_config<vkGetPhysicalDeviceQueueFamilyProperties> {};
template<> struct fex_gen_config<vkGetPhysicalDeviceMemoryProperties> {};
@ -74,6 +130,7 @@ template<> struct fex_gen_config<vkResetEvent> {};
template<> struct fex_gen_config<vkCreateQueryPool> {};
template<> struct fex_gen_config<vkDestroyQueryPool> {};
template<> struct fex_gen_config<vkGetQueryPoolResults> {};
template<> struct fex_gen_param<vkGetQueryPoolResults, 5, void*> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_config<vkCreateBuffer> {};
template<> struct fex_gen_config<vkDestroyBuffer> {};
template<> struct fex_gen_config<vkCreateBufferView> {};
@ -185,6 +242,7 @@ template<> struct fex_gen_config<vkDestroySamplerYcbcrConversion> {};
template<> struct fex_gen_config<vkCreateDescriptorUpdateTemplate> {};
template<> struct fex_gen_config<vkDestroyDescriptorUpdateTemplate> {};
template<> struct fex_gen_config<vkUpdateDescriptorSetWithTemplate> {};
template<> struct fex_gen_param<vkUpdateDescriptorSetWithTemplate, 3, const void*> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_config<vkGetPhysicalDeviceExternalBufferProperties> {};
template<> struct fex_gen_config<vkGetPhysicalDeviceExternalFenceProperties> {};
template<> struct fex_gen_config<vkGetPhysicalDeviceExternalSemaphoreProperties> {};
@ -296,9 +354,11 @@ template<> struct fex_gen_config<vkImportSemaphoreFdKHR> {};
template<> struct fex_gen_config<vkGetSemaphoreFdKHR> {};
template<> struct fex_gen_config<vkCmdPushDescriptorSetKHR> {};
template<> struct fex_gen_config<vkCmdPushDescriptorSetWithTemplateKHR> {};
template<> struct fex_gen_param<vkCmdPushDescriptorSetWithTemplateKHR, 4, const void*> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_config<vkCreateDescriptorUpdateTemplateKHR> {};
template<> struct fex_gen_config<vkDestroyDescriptorUpdateTemplateKHR> {};
template<> struct fex_gen_config<vkUpdateDescriptorSetWithTemplateKHR> {};
template<> struct fex_gen_param<vkUpdateDescriptorSetWithTemplateKHR, 3, const void*> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_config<vkCreateRenderPass2KHR> {};
template<> struct fex_gen_config<vkCmdBeginRenderPass2KHR> {};
template<> struct fex_gen_config<vkCmdNextSubpass2KHR> {};
@ -370,6 +430,7 @@ template<> struct fex_gen_config<vkGetDeviceImageSubresourceLayoutKHR> {};
template<> struct fex_gen_config<vkGetImageSubresourceLayout2KHR> {};
template<> struct fex_gen_config<vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR> {};
template<> struct fex_gen_config<vkCreateDebugReportCallbackEXT> : fexgen::custom_host_impl {};
template<> struct fex_gen_param<vkCreateDebugReportCallbackEXT, 1, const VkDebugReportCallbackCreateInfoEXT*> : fexgen::ptr_passthrough {};
template<> struct fex_gen_config<vkDestroyDebugReportCallbackEXT> : fexgen::custom_host_impl {};
template<> struct fex_gen_config<vkDebugReportMessageEXT> {};
template<> struct fex_gen_config<vkDebugMarkerSetObjectTagEXT> {};
@ -393,6 +454,7 @@ template<> struct fex_gen_config<vkGetImageViewAddressNVX> {};
template<> struct fex_gen_config<vkCmdDrawIndirectCountAMD> {};
template<> struct fex_gen_config<vkCmdDrawIndexedIndirectCountAMD> {};
template<> struct fex_gen_config<vkGetShaderInfoAMD> {};
template<> struct fex_gen_param<vkGetShaderInfoAMD, 5, void*> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_config<vkGetPhysicalDeviceExternalImageFormatPropertiesNV> {};
template<> struct fex_gen_config<vkCmdBeginConditionalRenderingEXT> {};
template<> struct fex_gen_config<vkCmdEndConditionalRenderingEXT> {};
@ -417,7 +479,8 @@ template<> struct fex_gen_config<vkQueueInsertDebugUtilsLabelEXT> {};
template<> struct fex_gen_config<vkCmdBeginDebugUtilsLabelEXT> {};
template<> struct fex_gen_config<vkCmdEndDebugUtilsLabelEXT> {};
template<> struct fex_gen_config<vkCmdInsertDebugUtilsLabelEXT> {};
template<> struct fex_gen_config<vkCreateDebugUtilsMessengerEXT> {};
template<> struct fex_gen_config<vkCreateDebugUtilsMessengerEXT> : fexgen::custom_host_impl {};
template<> struct fex_gen_param<vkCreateDebugUtilsMessengerEXT, 1, const VkDebugUtilsMessengerCreateInfoEXT*> : fexgen::ptr_passthrough {};
template<> struct fex_gen_config<vkDestroyDebugUtilsMessengerEXT> {};
template<> struct fex_gen_config<vkSubmitDebugUtilsMessageEXT> {};
template<> struct fex_gen_config<vkCmdSetSampleLocationsEXT> {};
@ -427,6 +490,7 @@ template<> struct fex_gen_config<vkCreateValidationCacheEXT> {};
template<> struct fex_gen_config<vkDestroyValidationCacheEXT> {};
template<> struct fex_gen_config<vkMergeValidationCachesEXT> {};
template<> struct fex_gen_config<vkGetValidationCacheDataEXT> {};
template<> struct fex_gen_param<vkGetValidationCacheDataEXT, 3, void*> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_config<vkCmdBindShadingRateImageNV> {};
template<> struct fex_gen_config<vkCmdSetViewportShadingRatePaletteNV> {};
template<> struct fex_gen_config<vkCmdSetCoarseSampleOrderNV> {};
@ -439,11 +503,15 @@ template<> struct fex_gen_config<vkCmdCopyAccelerationStructureNV> {};
template<> struct fex_gen_config<vkCmdTraceRaysNV> {};
template<> struct fex_gen_config<vkCreateRayTracingPipelinesNV> {};
template<> struct fex_gen_config<vkGetRayTracingShaderGroupHandlesKHR> {};
template<> struct fex_gen_param<vkGetRayTracingShaderGroupHandlesKHR, 5, void*> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_config<vkGetRayTracingShaderGroupHandlesNV> {};
template<> struct fex_gen_param<vkGetRayTracingShaderGroupHandlesNV, 5, void*> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_config<vkGetAccelerationStructureHandleNV> {};
template<> struct fex_gen_param<vkGetAccelerationStructureHandleNV, 3, void*> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_config<vkCmdWriteAccelerationStructuresPropertiesNV> {};
template<> struct fex_gen_config<vkCompileDeferredNV> {};
template<> struct fex_gen_config<vkGetMemoryHostPointerPropertiesEXT> {};
template<> struct fex_gen_param<vkGetMemoryHostPointerPropertiesEXT, 2, const void*> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_config<vkCmdWriteBufferMarkerAMD> {};
template<> struct fex_gen_config<vkGetPhysicalDeviceCalibrateableTimeDomainsEXT> {};
template<> struct fex_gen_config<vkGetCalibratedTimestampsEXT> {};
@ -453,6 +521,7 @@ template<> struct fex_gen_config<vkCmdDrawMeshTasksIndirectCountNV> {};
template<> struct fex_gen_config<vkCmdSetExclusiveScissorEnableNV> {};
template<> struct fex_gen_config<vkCmdSetExclusiveScissorNV> {};
template<> struct fex_gen_config<vkCmdSetCheckpointNV> {};
template<> struct fex_gen_param<vkCmdSetCheckpointNV, 1, const void*> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_config<vkGetQueueCheckpointDataNV> {};
template<> struct fex_gen_config<vkInitializePerformanceApiINTEL> {};
template<> struct fex_gen_config<vkUninitializePerformanceApiINTEL> {};
@ -537,6 +606,7 @@ template<> struct fex_gen_config<vkCopyMicromapEXT> {};
template<> struct fex_gen_config<vkCopyMicromapToMemoryEXT> {};
template<> struct fex_gen_config<vkCopyMemoryToMicromapEXT> {};
template<> struct fex_gen_config<vkWriteMicromapsPropertiesEXT> {};
template<> struct fex_gen_param<vkWriteMicromapsPropertiesEXT, 5, void*> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_config<vkCmdCopyMicromapEXT> {};
template<> struct fex_gen_config<vkCmdCopyMicromapToMemoryEXT> {};
template<> struct fex_gen_config<vkCmdCopyMemoryToMicromapEXT> {};
@ -609,6 +679,7 @@ template<> struct fex_gen_config<vkCopyAccelerationStructureKHR> {};
template<> struct fex_gen_config<vkCopyAccelerationStructureToMemoryKHR> {};
template<> struct fex_gen_config<vkCopyMemoryToAccelerationStructureKHR> {};
template<> struct fex_gen_config<vkWriteAccelerationStructuresPropertiesKHR> {};
template<> struct fex_gen_param<vkWriteAccelerationStructuresPropertiesKHR, 5, void*> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_config<vkCmdCopyAccelerationStructureKHR> {};
template<> struct fex_gen_config<vkCmdCopyAccelerationStructureToMemoryKHR> {};
template<> struct fex_gen_config<vkCmdCopyMemoryToAccelerationStructureKHR> {};
@ -619,6 +690,7 @@ template<> struct fex_gen_config<vkGetAccelerationStructureBuildSizesKHR> {};
template<> struct fex_gen_config<vkCmdTraceRaysKHR> {};
template<> struct fex_gen_config<vkCreateRayTracingPipelinesKHR> {};
template<> struct fex_gen_config<vkGetRayTracingCaptureReplayShaderGroupHandlesKHR> {};
template<> struct fex_gen_param<vkGetRayTracingCaptureReplayShaderGroupHandlesKHR, 5, void*> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_config<vkCmdTraceRaysIndirectKHR> {};
template<> struct fex_gen_config<vkGetRayTracingShaderGroupStackSizeKHR> {};
template<> struct fex_gen_config<vkCmdSetRayTracingPipelineStackSizeKHR> {};

View File

@ -46,7 +46,7 @@ static void WaylandFinalizeHostTrampolineForGuestListener(void (*callback)()) {
}
extern "C" int fexfn_impl_libwayland_client_wl_proxy_add_listener(struct wl_proxy *proxy,
guest_layout<void (**)(void)> callback_raw, guest_layout<void*> data) {
guest_layout<void (**)(void)> callback_raw, void* data) {
auto guest_interface = ((wl_proxy_private*)proxy)->interface;
for (int i = 0; i < guest_interface->event_count; ++i) {
@ -162,7 +162,7 @@ extern "C" int fexfn_impl_libwayland_client_wl_proxy_add_listener(struct wl_prox
}
// Pass the original function pointer table to the host wayland library. This ensures the table is valid until the listener is unregistered.
return fexldr_ptr_libwayland_client_wl_proxy_add_listener(proxy, callback_raw.data, data.data);
return fexldr_ptr_libwayland_client_wl_proxy_add_listener(proxy, callback_raw.data, data);
}
wl_interface* fexfn_impl_libwayland_client_fex_wl_exchange_interface_pointer(wl_interface* guest_interface, char const* name) {

View File

@ -14,6 +14,15 @@ struct fex_gen_type {};
template<auto, int, typename = void>
struct fex_gen_param {};
template<> struct fex_gen_type<wl_display> : fexgen::opaque_type {};
template<> struct fex_gen_type<wl_proxy> : fexgen::opaque_type {};
template<> struct fex_gen_type<wl_interface> : fexgen::opaque_type {};
template<> struct fex_gen_type<wl_event_queue> : fexgen::opaque_type {};
// Passed over Wayland's wire protocol for some functions
template<> struct fex_gen_type<wl_array> {};
template<> struct fex_gen_config<wl_proxy_destroy> : fexgen::custom_guest_entrypoint {};
@ -36,8 +45,10 @@ template<> struct fex_gen_config<wl_display_get_fd> {};
template<> struct fex_gen_config<wl_event_queue_destroy> {};
template<> struct fex_gen_config<wl_proxy_add_listener> : fexgen::custom_host_impl, fexgen::custom_guest_entrypoint {};
// Callback table
template<> struct fex_gen_param<wl_proxy_add_listener, 1, void(**)()> : fexgen::ptr_passthrough {};
template<> struct fex_gen_param<wl_proxy_add_listener, 2, void*> : fexgen::ptr_passthrough {};
// User-provided data pointer (not used in caller-provided callback)
template<> struct fex_gen_param<wl_proxy_add_listener, 2, void*> : fexgen::assume_compatible_data_layout {};
template<> struct fex_gen_config<wl_proxy_create> {};
template<> struct fex_gen_config<wl_proxy_create_wrapper> {};
template<> struct fex_gen_config<wl_proxy_get_tag> {};
@ -45,6 +56,7 @@ template<> struct fex_gen_config<wl_proxy_get_user_data> {};
template<> struct fex_gen_config<wl_proxy_get_version> {};
template<> struct fex_gen_config<wl_proxy_set_queue> {};
template<> struct fex_gen_config<wl_proxy_set_tag> {};
// TODO: This has a void* parameter. Why does 32-bit accept this without annotations?
template<> struct fex_gen_config<wl_proxy_set_user_data> {};
template<> struct fex_gen_config<wl_proxy_wrapper_destroy> {};

View File

@ -1,12 +1,18 @@
#include <common/GeneratorInterface.h>
#include <xcb/dri2.h>
#include <xcb/xcbext.h>
template<auto>
struct fex_gen_config {
unsigned version = 0;
};
template<typename>
struct fex_gen_type {};
template<> struct fex_gen_type<xcb_connection_t> : fexgen::opaque_type {};
void FEX_xcb_dri2_init_extension(xcb_connection_t*, xcb_extension_t*);
size_t FEX_usable_size(void*);
void FEX_free_on_host(void*);

View File

@ -1,12 +1,18 @@
#include <common/GeneratorInterface.h>
#include <xcb/dri3.h>
#include <xcb/xcbext.h>
template<auto>
struct fex_gen_config {
unsigned version = 0;
};
template<typename>
struct fex_gen_type {};
template<> struct fex_gen_type<xcb_connection_t> : fexgen::opaque_type {};
void FEX_xcb_dri3_init_extension(xcb_connection_t*, xcb_extension_t*);
size_t FEX_usable_size(void*);
void FEX_free_on_host(void*);

View File

@ -1,12 +1,18 @@
#include <common/GeneratorInterface.h>
#include <xcb/glx.h>
#include <xcb/xcbext.h>
template<auto>
struct fex_gen_config {
unsigned version = 0;
};
template<typename>
struct fex_gen_type {};
template<> struct fex_gen_type<xcb_connection_t> : fexgen::opaque_type {};
void FEX_xcb_glx_init_extension(xcb_connection_t*, xcb_extension_t*);
size_t FEX_usable_size(void*);
void FEX_free_on_host(void*);

View File

@ -1,12 +1,18 @@
#include <common/GeneratorInterface.h>
#include <xcb/present.h>
#include <xcb/xcbext.h>
template<auto>
struct fex_gen_config {
unsigned version = 0;
};
template<typename>
struct fex_gen_type {};
template<> struct fex_gen_type<xcb_connection_t> : fexgen::opaque_type {};
void FEX_xcb_present_init_extension(xcb_connection_t*, xcb_extension_t*);
size_t FEX_usable_size(void*);
void FEX_free_on_host(void*);

View File

@ -1,12 +1,23 @@
#include <common/GeneratorInterface.h>
#include <xcb/randr.h>
#include <xcb/xcbext.h>
template<auto>
struct fex_gen_config {
unsigned version = 0;
};
template<typename>
struct fex_gen_type {};
template<> struct fex_gen_type<xcb_connection_t> : fexgen::opaque_type {};
// Union type (includes pointers, so only compatible across 64-bit architectures)
#ifndef IS_32BIT_THUNK
template<> struct fex_gen_type<xcb_randr_notify_data_t> : fexgen::assume_compatible_data_layout {};
#endif
void FEX_xcb_randr_init_extension(xcb_connection_t*, xcb_extension_t*);
size_t FEX_usable_size(void*);
void FEX_free_on_host(void*);

View File

@ -1,12 +1,18 @@
#include <common/GeneratorInterface.h>
#include <xcb/shm.h>
#include <xcb/xcbext.h>
template<auto>
struct fex_gen_config {
unsigned version = 0;
};
template<typename>
struct fex_gen_type {};
template<> struct fex_gen_type<xcb_connection_t> : fexgen::opaque_type {};
void FEX_xcb_shm_init_extension(xcb_connection_t*, xcb_extension_t*);
size_t FEX_usable_size(void*);
void FEX_free_on_host(void*);

View File

@ -1,12 +1,18 @@
#include <common/GeneratorInterface.h>
#include <xcb/sync.h>
#include <xcb/xcbext.h>
template<auto>
struct fex_gen_config {
unsigned version = 1;
};
template<typename>
struct fex_gen_type {};
template<> struct fex_gen_type<xcb_connection_t> : fexgen::opaque_type {};
void FEX_xcb_sync_init_extension(xcb_connection_t*, xcb_extension_t*);
size_t FEX_usable_size(void*);
void FEX_free_on_host(void*);

View File

@ -1,12 +1,18 @@
#include <common/GeneratorInterface.h>
#include <xcb/xfixes.h>
#include <xcb/xcbext.h>
template<auto>
struct fex_gen_config {
unsigned version = 0;
};
template<typename>
struct fex_gen_type {};
template<> struct fex_gen_type<xcb_connection_t> : fexgen::opaque_type {};
void FEX_xcb_xfixes_init_extension(xcb_connection_t*, xcb_extension_t*);
size_t FEX_usable_size(void*);
void FEX_free_on_host(void*);

View File

@ -11,6 +11,15 @@ struct fex_gen_config {
unsigned version = 1;
};
template<typename>
struct fex_gen_type {};
template<> struct fex_gen_type<xcb_connection_t> : fexgen::opaque_type {};
template<> struct fex_gen_type<xcb_special_event> : fexgen::opaque_type {};
// Union type with consistent data layout across host/x86/x86-64
template<> struct fex_gen_type<xcb_client_message_data_t> : fexgen::assume_compatible_data_layout {};
void FEX_xcb_init_extension(xcb_connection_t*, xcb_extension_t*);
size_t FEX_usable_size(void*);
void FEX_free_on_host(void*);

View File

@ -9,6 +9,11 @@ struct fex_gen_config {
unsigned version = 1;
};
template<typename>
struct fex_gen_type {};
template<> struct fex_gen_type<xshmfence> : fexgen::opaque_type {};
template<> struct fex_gen_config<xshmfence_trigger> {};
template<> struct fex_gen_config<xshmfence_await> {};
template<> struct fex_gen_config<xshmfence_query> {};