main
1#include <SDL2/SDL_events.h>
2#include <SDL2/SDL_video.h>
3#include <SDL2/SDL_vulkan.h>
4#include <stdio.h>
5#include <vulkan/vulkan_core.h>
6#include <SDL2/SDL.h>
7#include "libgogvk/gog_instance.h"
8#include <stdio.h>
9
10int main() {
11 VkApplicationInfo app_i = {
12 .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
13 .pApplicationName = "GOG Headless Test",
14 .apiVersion = VK_API_VERSION_1_3
15 };
16
17 VkInstanceCreateInfo inst_ci = {
18 .sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
19 .pApplicationInfo = &app_i,
20 .enabledExtensionCount = 0, // No window extensions for now!
21 .ppEnabledExtensionNames = NULL
22 };
23
24 VkInstance vk_inst;
25 if (vkCreateInstance(&inst_ci, NULL, &vk_inst) != VK_SUCCESS) {
26 printf("Failed to create Vulkan Instance. Is the SDK installed?\n");
27 return -1;
28 }
29
30 gog_instance gog = {
31 .vk_instance = vk_inst,
32 .vk_surface = VK_NULL_HANDLE // No window target
33 };
34
35 gog_instance_audit(&gog);
36
37 printf("\n--- GOG HARDWARE AUDIT ---\n");
38 printf("Found %u device(s):\n", gog.device_c);
39
40 for (uint32_t i = 0; i < gog.device_c; i++) {
41 gog_device* d = &gog.devices[i];
42 printf("\n[%u] %s\n", i, d->props.deviceName);
43 printf(" Type: %s\n", (d->props.deviceType == 2) ? "Discrete" : "Integrated/Other");
44 printf(" Perf Metric: %u\n", d->specs.performance);
45 printf(" VRAM: %u MB\n", d->specs.vram_mb);
46 printf(" Graphics Q: Family %u\n", d->queues.graphics);
47 printf(" Compute Q: Family %u\n", d->queues.compute);
48 }
49
50 /* 5. Test Activation (Open the first one) */
51 if (gog.device_c > 0) {
52 printf("\nTesting Activation on Device [0]...\n");
53 // Note: Use your gog_device_open function here
54 // If success:
55 printf("Device [0] logical handle: %p\n", (void*)gog.devices[0].logical);
56 }
57
58 /* 6. Cleanup */
59 gog_instance_destroy(&gog);
60 vkDestroyInstance(vk_inst, NULL);
61
62 printf("\nTest Complete.\n");
63 return 0;
64}