1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <dlfcn.h>
#include "wrappedlibs.h"
#include "debug.h"
#include "wrapper.h"
#include "bridge.h"
#include "librarian/library_private.h"
#include "x64emu.h"
#include "emu/x64emu_private.h"
#include "box64context.h"
#include "librarian.h"
#include "callback.h"
//extern char* libvulkan;
const char* vulkanName = "libvulkan.so.1";
#define LIBNAME vulkan
typedef void(*vFpUp_t) (void*, uint64_t, void*);
#define ADDED_FUNCTIONS() \
GO(vkDestroySamplerYcbcrConversion, vFpUp_t) \
#include "generated/wrappedvulkantypes.h"
#define ADDED_STRUCT() \
void* currentInstance; // track current instance. If using multiple instance, that will be a mess!
#define ADDED_SUPER 1
#include "wrappercallback.h"
void updateInstance(vulkan_my_t* my)
{
void* p;
#define GO(A, W) p = my_context->vkprocaddress(my->currentInstance, #A); if(p) my->A = p;
SUPER()
#undef GO
}
void fillVulkanProcWrapper(box64context_t*);
void freeVulkanProcWrapper(box64context_t*);
static void* resolveSymbol(x64emu_t* emu, void* symbol, const char* rname)
{
// check if alread bridged
uintptr_t ret = CheckBridged(emu->context->system, symbol);
if(ret) {
printf_dlsym(LOG_DEBUG, "%p\n", (void*)ret);
return (void*)ret; // already bridged
}
// get wrapper
khint_t k = kh_get(symbolmap, emu->context->vkwrappers, rname);
if(k==kh_end(emu->context->vkwrappers) && strstr(rname, "KHR")==NULL) {
// try again, adding KHR at the end if not present
char tmp[200];
strcpy(tmp, rname);
strcat(tmp, "KHR");
k = kh_get(symbolmap, emu->context->vkwrappers, tmp);
}
if(k==kh_end(emu->context->vkwrappers)) {
printf_dlsym(LOG_DEBUG, "%p\n", NULL);
printf_dlsym(LOG_INFO, "Warning, no wrapper for %s\n", rname);
return NULL;
}
const char* constname = kh_key(emu->context->vkwrappers, k);
AddOffsetSymbol(emu->context->maplib, symbol, constname);
ret = AddBridge(emu->context->system, kh_value(emu->context->vkwrappers, k), symbol, 0, constname);
printf_dlsym(LOG_DEBUG, "%p (%p)\n", (void*)ret, symbol);
return (void*)ret;
}
EXPORT void* my_vkGetDeviceProcAddr(x64emu_t* emu, void* device, void* name)
{
khint_t k;
const char* rname = (const char*)name;
printf_dlsym(LOG_DEBUG, "Calling my_vkGetDeviceProcAddr(%p, \"%s\") => ", device, rname);
if(!emu->context->vkwrappers)
fillVulkanProcWrapper(emu->context);
k = kh_get(symbolmap, emu->context->vkmymap, rname);
int is_my = (k==kh_end(emu->context->vkmymap))?0:1;
void* symbol = my->vkGetDeviceProcAddr(device, name);
if(symbol && is_my) { // only wrap if symbol exist
// try again, by using custom "my_" now...
char tmp[200];
strcpy(tmp, "my_");
strcat(tmp, rname);
symbol = dlsym(emu->context->box64lib, tmp);
// need to update symbol link maybe
#define GO(A, W) if(!strcmp(rname, #A)) my->A = (W)my->vkGetDeviceProcAddr(device, name);
SUPER()
#undef GO
}
if(!symbol) {
printf_dlsym(LOG_DEBUG, "%p\n", NULL);
return NULL; // easy
}
return resolveSymbol(emu, symbol, rname);
}
EXPORT void* my_vkGetInstanceProcAddr(x64emu_t* emu, void* instance, void* name)
{
khint_t k;
const char* rname = (const char*)name;
printf_dlsym(LOG_DEBUG, "Calling my_vkGetInstanceProcAddr(%p, \"%s\") => ", instance, rname);
if(!emu->context->vkwrappers)
fillVulkanProcWrapper(emu->context);
if(instance!=my->currentInstance) {
my->currentInstance = instance;
updateInstance(my);
}
// check if vkprocaddress is filled, and search for lib and fill it if needed
// get proc adress using actual glXGetProcAddress
k = kh_get(symbolmap, emu->context->vkmymap, rname);
int is_my = (k==kh_end(emu->context->vkmymap))?0:1;
void* symbol = my_context->vkprocaddress(instance, rname);
if(!symbol) {
printf_dlsym(LOG_DEBUG, "%p\n", NULL);
return NULL; // easy
}
if(is_my) {
// try again, by using custom "my_" now...
char tmp[200];
strcpy(tmp, "my_");
strcat(tmp, rname);
symbol = dlsym(emu->context->box64lib, tmp);
// need to update symbol link maybe
#define GO(A, W) if(!strcmp(rname, #A)) my->A = (W)my_context->vkprocaddress(instance, rname);;
SUPER()
#undef GO
}
return resolveSymbol(emu, symbol, rname);
}
void* my_GetVkProcAddr(x64emu_t* emu, void* name, void*(*getaddr)(const char*))
{
khint_t k;
const char* rname = (const char*)name;
printf_dlsym(LOG_DEBUG, "Calling my_GetVkProcAddr(\"%s\", %p) => ", rname, getaddr);
if(!emu->context->vkwrappers)
fillVulkanProcWrapper(emu->context);
// check if vkprocaddress is filled, and search for lib and fill it if needed
// get proc adress using actual glXGetProcAddress
k = kh_get(symbolmap, emu->context->vkmymap, rname);
int is_my = (k==kh_end(emu->context->vkmymap))?0:1;
void* symbol = getaddr(rname);
if(!symbol) {
printf_dlsym(LOG_DEBUG, "%p\n", NULL);
return NULL; // easy
}
if(is_my) {
// try again, by using custom "my_" now...
char tmp[200];
strcpy(tmp, "my_");
strcat(tmp, rname);
symbol = dlsym(emu->context->box64lib, tmp);
// need to update symbol link maybe
#define GO(A, W) if(!strcmp(rname, #A)) my->A = (W)getaddr(rname);
SUPER()
#undef GO
}
return resolveSymbol(emu, symbol, rname);
}
#undef SUPER
typedef struct my_VkAllocationCallbacks_s {
void* pUserData;
void* pfnAllocation;
void* pfnReallocation;
void* pfnFree;
void* pfnInternalAllocation;
void* pfnInternalFree;
} my_VkAllocationCallbacks_t;
#define SUPER() \
GO(0) \
GO(1) \
GO(2) \
GO(3) \
GO(4)
// Allocation ...
#define GO(A) \
static uintptr_t my_Allocation_fct_##A = 0; \
static void* my_Allocation_##A(void* a, size_t b, size_t c, int d) \
{ \
return (void*)RunFunctionFmt(my_Allocation_fct_##A, "pLLi", a, b, c, d); \
}
SUPER()
#undef GO
static void* find_Allocation_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_Allocation_fct_##A == (uintptr_t)fct) return my_Allocation_##A;
SUPER()
#undef GO
#define GO(A) if(my_Allocation_fct_##A == 0) {my_Allocation_fct_##A = (uintptr_t)fct; return my_Allocation_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for Vulkan Allocation callback\n");
return NULL;
}
// Reallocation ...
#define GO(A) \
static uintptr_t my_Reallocation_fct_##A = 0; \
static void* my_Reallocation_##A(void* a, void* b, size_t c, size_t d, int e) \
{ \
return (void*)RunFunctionFmt(my_Reallocation_fct_##A, "ppLLi", a, b, c, d, e); \
}
SUPER()
#undef GO
static void* find_Reallocation_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_Reallocation_fct_##A == (uintptr_t)fct) return my_Reallocation_##A;
SUPER()
#undef GO
#define GO(A) if(my_Reallocation_fct_##A == 0) {my_Reallocation_fct_##A = (uintptr_t)fct; return my_Reallocation_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for Vulkan Reallocation callback\n");
return NULL;
}
// Free ...
#define GO(A) \
static uintptr_t my_Free_fct_##A = 0; \
static void my_Free_##A(void* a, void* b) \
{ \
RunFunctionFmt(my_Free_fct_##A, "pp", a, b); \
}
SUPER()
#undef GO
static void* find_Free_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_Free_fct_##A == (uintptr_t)fct) return my_Free_##A;
SUPER()
#undef GO
#define GO(A) if(my_Free_fct_##A == 0) {my_Free_fct_##A = (uintptr_t)fct; return my_Free_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for Vulkan Free callback\n");
return NULL;
}
// InternalAllocNotification ...
#define GO(A) \
static uintptr_t my_InternalAllocNotification_fct_##A = 0; \
static void my_InternalAllocNotification_##A(void* a, size_t b, int c, int d) \
{ \
RunFunctionFmt(my_InternalAllocNotification_fct_##A, "pLii", a, b, c, d); \
}
SUPER()
#undef GO
static void* find_InternalAllocNotification_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_InternalAllocNotification_fct_##A == (uintptr_t)fct) return my_InternalAllocNotification_##A;
SUPER()
#undef GO
#define GO(A) if(my_InternalAllocNotification_fct_##A == 0) {my_InternalAllocNotification_fct_##A = (uintptr_t)fct; return my_InternalAllocNotification_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for Vulkan InternalAllocNotification callback\n");
return NULL;
}
// InternalFreeNotification ...
#define GO(A) \
static uintptr_t my_InternalFreeNotification_fct_##A = 0; \
static void my_InternalFreeNotification_##A(void* a, size_t b, int c, int d) \
{ \
RunFunctionFmt(my_InternalFreeNotification_fct_##A, "pLii", a, b, c, d); \
}
SUPER()
#undef GO
static void* find_InternalFreeNotification_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_InternalFreeNotification_fct_##A == (uintptr_t)fct) return my_InternalFreeNotification_##A;
SUPER()
#undef GO
#define GO(A) if(my_InternalFreeNotification_fct_##A == 0) {my_InternalFreeNotification_fct_##A = (uintptr_t)fct; return my_InternalFreeNotification_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for Vulkan InternalFreeNotification callback\n");
return NULL;
}
// DebugReportCallbackEXT ...
#define GO(A) \
static uintptr_t my_DebugReportCallbackEXT_fct_##A = 0; \
static int my_DebugReportCallbackEXT_##A(int a, int b, uint64_t c, size_t d, int e, void* f, void* g, void* h) \
{ \
return RunFunctionFmt(my_DebugReportCallbackEXT_fct_##A, "iiULippp", a, b, c, d, e, f, g, h); \
}
SUPER()
#undef GO
static void* find_DebugReportCallbackEXT_Fct(void* fct)
{
if(!fct) return fct;
if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct);
#define GO(A) if(my_DebugReportCallbackEXT_fct_##A == (uintptr_t)fct) return my_DebugReportCallbackEXT_##A;
SUPER()
#undef GO
#define GO(A) if(my_DebugReportCallbackEXT_fct_##A == 0) {my_DebugReportCallbackEXT_fct_##A = (uintptr_t)fct; return my_DebugReportCallbackEXT_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for Vulkan DebugReportCallbackEXT callback\n");
return NULL;
}
#undef SUPER
//#define PRE_INIT if(libGL) {lib->w.lib = dlopen(libGL, RTLD_LAZY | RTLD_GLOBAL); lib->path = box_strdup(libGL);} else
#define PRE_INIT \
if(box64_novulkan) \
return -1;
#define CUSTOM_INIT \
getMy(lib); \
lib->w.priv = dlsym(lib->w.lib, "vkGetInstanceProcAddr"); \
box64->vkprocaddress = lib->w.priv;
#define CUSTOM_FINI \
freeMy();
#include "wrappedlib_init.h"
void fillVulkanProcWrapper(box64context_t* context)
{
int cnt, ret;
khint_t k;
kh_symbolmap_t * symbolmap = kh_init(symbolmap);
// populates maps...
cnt = sizeof(vulkansymbolmap)/sizeof(map_onesymbol_t);
for (int i=0; i<cnt; ++i) {
k = kh_put(symbolmap, symbolmap, vulkansymbolmap[i].name, &ret);
kh_value(symbolmap, k) = vulkansymbolmap[i].w;
}
// and the my_ symbols map
cnt = sizeof(MAPNAME(mysymbolmap))/sizeof(map_onesymbol_t);
for (int i=0; i<cnt; ++i) {
k = kh_put(symbolmap, symbolmap, vulkanmysymbolmap[i].name, &ret);
kh_value(symbolmap, k) = vulkanmysymbolmap[i].w;
}
context->vkwrappers = symbolmap;
// my_* map
symbolmap = kh_init(symbolmap);
cnt = sizeof(MAPNAME(mysymbolmap))/sizeof(map_onesymbol_t);
for (int i=0; i<cnt; ++i) {
k = kh_put(symbolmap, symbolmap, vulkanmysymbolmap[i].name, &ret);
kh_value(symbolmap, k) = vulkanmysymbolmap[i].w;
}
context->vkmymap = symbolmap;
}
void freeVulkanProcWrapper(box64context_t* context)
{
if(!context)
return;
if(context->vkwrappers)
kh_destroy(symbolmap, context->vkwrappers);
if(context->vkmymap)
kh_destroy(symbolmap, context->vkmymap);
context->vkwrappers = NULL;
context->vkmymap = NULL;
}
my_VkAllocationCallbacks_t* find_VkAllocationCallbacks(my_VkAllocationCallbacks_t* dest, my_VkAllocationCallbacks_t* src)
{
if(!src) return src;
dest->pUserData = src->pUserData;
dest->pfnAllocation = find_Allocation_Fct(src->pfnAllocation);
dest->pfnReallocation = find_Reallocation_Fct(src->pfnReallocation);
dest->pfnFree = find_Free_Fct(src->pfnFree);
dest->pfnInternalAllocation = find_InternalAllocNotification_Fct(src->pfnInternalAllocation);
dest->pfnInternalFree = find_InternalFreeNotification_Fct(src->pfnInternalFree);
return dest;
}
// functions....
#define CREATE(A) \
EXPORT int my_##A(x64emu_t* emu, void* device, void* pAllocateInfo, my_VkAllocationCallbacks_t* pAllocator, void* p) \
{ \
my_VkAllocationCallbacks_t my_alloc; \
return my->A(device, pAllocateInfo, find_VkAllocationCallbacks(&my_alloc, pAllocator), p); \
}
#define DESTROY(A) \
EXPORT void my_##A(x64emu_t* emu, void* device, void* p, my_VkAllocationCallbacks_t* pAllocator) \
{ \
my_VkAllocationCallbacks_t my_alloc; \
my->A(device, p, find_VkAllocationCallbacks(&my_alloc, pAllocator)); \
}
#define DESTROY64(A) \
EXPORT void my_##A(x64emu_t* emu, void* device, uint64_t p, my_VkAllocationCallbacks_t* pAllocator) \
{ \
my_VkAllocationCallbacks_t my_alloc; \
my->A(device, p, find_VkAllocationCallbacks(&my_alloc, pAllocator)); \
}
CREATE(vkAllocateMemory)
CREATE(vkCreateBuffer)
CREATE(vkCreateBufferView)
CREATE(vkCreateCommandPool)
EXPORT int my_vkCreateComputePipelines(x64emu_t* emu, void* device, uint64_t pipelineCache, uint32_t count, void* pCreateInfos, my_VkAllocationCallbacks_t* pAllocator, void* pPipelines)
{
my_VkAllocationCallbacks_t my_alloc;
int ret = my->vkCreateComputePipelines(device, pipelineCache, count, pCreateInfos, find_VkAllocationCallbacks(&my_alloc, pAllocator), pPipelines);
return ret;
}
CREATE(vkCreateDescriptorPool)
CREATE(vkCreateDescriptorSetLayout)
CREATE(vkCreateDescriptorUpdateTemplate)
CREATE(vkCreateDescriptorUpdateTemplateKHR)
CREATE(vkCreateDevice)
EXPORT int my_vkCreateDisplayModeKHR(x64emu_t* emu, void* physical, uint64_t display, void* pCreateInfo, my_VkAllocationCallbacks_t* pAllocator, void* pMode)
{
my_VkAllocationCallbacks_t my_alloc;
return my->vkCreateDisplayModeKHR(physical, display, pCreateInfo, find_VkAllocationCallbacks(&my_alloc, pAllocator), pMode);
}
CREATE(vkCreateDisplayPlaneSurfaceKHR)
CREATE(vkCreateEvent)
CREATE(vkCreateFence)
CREATE(vkCreateFramebuffer)
EXPORT int my_vkCreateGraphicsPipelines(x64emu_t* emu, void* device, uint64_t pipelineCache, uint32_t count, void* pCreateInfos, my_VkAllocationCallbacks_t* pAllocator, void* pPipelines)
{
my_VkAllocationCallbacks_t my_alloc;
int ret = my->vkCreateGraphicsPipelines(device, pipelineCache, count, pCreateInfos, find_VkAllocationCallbacks(&my_alloc, pAllocator), pPipelines);
return ret;
}
CREATE(vkCreateImage)
CREATE(vkCreateImageView)
EXPORT int my_vkCreateInstance(x64emu_t* emu, void* pCreateInfos, my_VkAllocationCallbacks_t* pAllocator, void* pInstance)
{
my_VkAllocationCallbacks_t my_alloc;
return my->vkCreateInstance(pCreateInfos, find_VkAllocationCallbacks(&my_alloc, pAllocator), pInstance);
}
CREATE(vkCreatePipelineCache)
CREATE(vkCreatePipelineLayout)
CREATE(vkCreateQueryPool)
CREATE(vkCreateRenderPass)
CREATE(vkCreateSampler)
CREATE(vkCreateSamplerYcbcrConversion)
CREATE(vkCreateSemaphore)
CREATE(vkCreateShaderModule)
EXPORT int my_vkCreateSharedSwapchainsKHR(x64emu_t* emu, void* device, uint32_t count, void** pCreateInfos, my_VkAllocationCallbacks_t* pAllocator, void* pSwapchains)
{
my_VkAllocationCallbacks_t my_alloc;
int ret = my->vkCreateSharedSwapchainsKHR(device, count, pCreateInfos, find_VkAllocationCallbacks(&my_alloc, pAllocator), pSwapchains);
return ret;
}
CREATE(vkCreateSwapchainKHR)
CREATE(vkCreateWaylandSurfaceKHR)
CREATE(vkCreateXcbSurfaceKHR)
CREATE(vkCreateXlibSurfaceKHR)
CREATE(vkCreateRenderPass2)
CREATE(vkCreateRenderPass2KHR)
EXPORT int my_vkRegisterDeviceEventEXT(x64emu_t* emu, void* device, void* info, my_VkAllocationCallbacks_t* pAllocator, void* pFence)
{
my_VkAllocationCallbacks_t my_alloc;
return my->vkRegisterDeviceEventEXT(device, info, find_VkAllocationCallbacks(&my_alloc, pAllocator), pFence);
}
EXPORT int my_vkRegisterDisplayEventEXT(x64emu_t* emu, void* device, uint64_t disp, void* info, my_VkAllocationCallbacks_t* pAllocator, void* pFence)
{
my_VkAllocationCallbacks_t my_alloc;
return my->vkRegisterDisplayEventEXT(device, disp, info, find_VkAllocationCallbacks(&my_alloc, pAllocator), pFence);
}
CREATE(vkCreateValidationCacheEXT)
DESTROY64(vkDestroyBuffer)
DESTROY64(vkDestroyBufferView)
DESTROY64(vkDestroyCommandPool)
DESTROY64(vkDestroyDescriptorPool)
DESTROY64(vkDestroyDescriptorSetLayout)
DESTROY64(vkDestroyDescriptorUpdateTemplate)
DESTROY64(vkDestroyDescriptorUpdateTemplateKHR)
EXPORT void my_vkDestroyDevice(x64emu_t* emu, void* pDevice, my_VkAllocationCallbacks_t* pAllocator)
{
my_VkAllocationCallbacks_t my_alloc;
my->vkDestroyDevice(pDevice, find_VkAllocationCallbacks(&my_alloc, pAllocator));
}
DESTROY64(vkDestroyEvent)
DESTROY64(vkDestroyFence)
DESTROY64(vkDestroyFramebuffer)
DESTROY64(vkDestroyImage)
DESTROY64(vkDestroyImageView)
EXPORT void my_vkDestroyInstance(x64emu_t* emu, void* instance, my_VkAllocationCallbacks_t* pAllocator)
{
my_VkAllocationCallbacks_t my_alloc;
my->vkDestroyInstance(instance, find_VkAllocationCallbacks(&my_alloc, pAllocator));
}
DESTROY64(vkDestroyPipeline)
DESTROY64(vkDestroyPipelineCache)
DESTROY64(vkDestroyPipelineLayout)
DESTROY64(vkDestroyQueryPool)
DESTROY64(vkDestroyRenderPass)
DESTROY64(vkDestroySampler)
DESTROY64(vkDestroySamplerYcbcrConversion)
DESTROY64(vkDestroySemaphore)
DESTROY64(vkDestroyShaderModule)
DESTROY64(vkDestroySwapchainKHR)
DESTROY64(vkFreeMemory)
CREATE(vkCreateDebugUtilsMessengerEXT)
DESTROY(vkDestroyDebugUtilsMessengerEXT)
DESTROY64(vkDestroySurfaceKHR)
DESTROY64(vkDestroySamplerYcbcrConversionKHR)
DESTROY64(vkDestroyValidationCacheEXT)
CREATE(vkCreateVideoSessionKHR)
CREATE(vkCreateVideoSessionParametersKHR)
DESTROY64(vkDestroyVideoSessionKHR)
DESTROY64(vkDestroyVideoSessionParametersKHR)
CREATE(vkCreatePrivateDataSlot)
CREATE(vkCreatePrivateDataSlotEXT)
DESTROY64(vkDestroyPrivateDataSlot)
DESTROY64(vkDestroyPrivateDataSlotEXT)
CREATE(vkCreateAccelerationStructureKHR)
DESTROY64(vkDestroyAccelerationStructureKHR)
EXPORT int my_vkCreateDeferredOperationKHR(x64emu_t* emu, void* device, my_VkAllocationCallbacks_t* pAllocator, void* p)
{
my_VkAllocationCallbacks_t my_alloc;
return my->vkCreateDeferredOperationKHR(device, find_VkAllocationCallbacks(&my_alloc, pAllocator), p);
}
DESTROY64(vkDestroyDeferredOperationKHR)
EXPORT int my_vkCreateRayTracingPipelinesKHR(x64emu_t* emu, void* device, uint64_t op, uint64_t pipeline, uint32_t count, void* infos, my_VkAllocationCallbacks_t* pAllocator, void* p)
{
my_VkAllocationCallbacks_t my_alloc;
return my->vkCreateRayTracingPipelinesKHR(device, op, pipeline, count, infos, find_VkAllocationCallbacks(&my_alloc, pAllocator), p);
}
CREATE(vkCreateCuFunctionNVX)
CREATE(vkCreateCuModuleNVX)
DESTROY64(vkDestroyCuFunctionNVX)
DESTROY64(vkDestroyCuModuleNVX)
CREATE(vkCreateIndirectCommandsLayoutNV)
DESTROY64(vkDestroyIndirectCommandsLayoutNV)
CREATE(vkCreateAccelerationStructureNV)
EXPORT int my_vkCreateRayTracingPipelinesNV(x64emu_t* emu, void* device, uint64_t pipeline, uint32_t count, void* infos, my_VkAllocationCallbacks_t* pAllocator, void* p)
{
my_VkAllocationCallbacks_t my_alloc;
return my->vkCreateRayTracingPipelinesNV(device, pipeline, count, infos, find_VkAllocationCallbacks(&my_alloc, pAllocator), p);
}
DESTROY64(vkDestroyAccelerationStructureNV)
CREATE(vkCreateOpticalFlowSessionNV)
DESTROY64(vkDestroyOpticalFlowSessionNV)
EXPORT void my_vkGetPhysicalDeviceProperties(x64emu_t* emu, void* device, void* pProps)
{
my->vkGetPhysicalDeviceProperties(device, pProps);
}
EXPORT void my_vkGetPhysicalDeviceSparseImageFormatProperties(x64emu_t* emu, void* device, int format, int type, int samples, int usage, int tiling, uint32_t* count, void** pProps)
{
my->vkGetPhysicalDeviceSparseImageFormatProperties(device, format, type, samples, usage, tiling, count, pProps);
}
EXPORT void my_vkUpdateDescriptorSets(x64emu_t* emu, void* device, uint32_t writeCount, void* writeSet, uint32_t copyCount, void* copySet)
{
my->vkUpdateDescriptorSets(device, writeCount, writeSet, copyCount, copySet);
}
EXPORT int my_vkGetDisplayPlaneCapabilitiesKHR(x64emu_t* emu, void* device, uint64_t mode, uint32_t index, void* pCap)
{
int ret = my->vkGetDisplayPlaneCapabilitiesKHR(device, mode, index, pCap);
return ret;
}
EXPORT int my_vkGetPhysicalDeviceDisplayPropertiesKHR(x64emu_t* emu, void* device, uint32_t* count, void* pProp)
{
int ret = my->vkGetPhysicalDeviceDisplayPropertiesKHR(device, count, pProp);
return ret;
}
EXPORT void my_vkGetPhysicalDeviceMemoryProperties(x64emu_t* emu, void* device, void* pProps)
{
my->vkGetPhysicalDeviceMemoryProperties(device, pProps);
}
EXPORT void my_vkCmdPipelineBarrier(x64emu_t* emu, void* device, int src, int dst, int dep,
uint32_t barrierCount, void* pBarriers, uint32_t bufferCount, void* pBuffers, uint32_t imageCount, void* pImages)
{
my->vkCmdPipelineBarrier(device, src, dst, dep, barrierCount, pBarriers, bufferCount, pBuffers, imageCount, pImages);
}
typedef struct my_VkDebugReportCallbackCreateInfoEXT_s {
int sType;
void* pNext;
uint32_t flags;
void* pfnCallback;
void* pUserData;
} my_VkDebugReportCallbackCreateInfoEXT_t;
EXPORT int my_vkCreateDebugReportCallbackEXT(x64emu_t* emu, void* instance,
my_VkDebugReportCallbackCreateInfoEXT_t* create,
my_VkAllocationCallbacks_t* alloc, void* callback)
{
my_VkDebugReportCallbackCreateInfoEXT_t dbg = *create;
my_VkAllocationCallbacks_t my_alloc;
dbg.pfnCallback = find_DebugReportCallbackEXT_Fct(dbg.pfnCallback);
return my->vkCreateDebugReportCallbackEXT(instance, &dbg, find_VkAllocationCallbacks(&my_alloc, alloc), callback);
}
EXPORT int my_vkDestroyDebugReportCallbackEXT(x64emu_t* emu, void* instance, void* callback, void* alloc)
{
my_VkAllocationCallbacks_t my_alloc;
return my->vkDestroyDebugReportCallbackEXT(instance, callback, find_VkAllocationCallbacks(&my_alloc, alloc));
}
CREATE(vkCreateHeadlessSurfaceEXT)
|