|
|
|
@ -17,6 +17,12 @@
|
|
|
|
|
|
|
|
|
|
#define MESH_SIZE 36*2*4*4
|
|
|
|
|
|
|
|
|
|
#define ASSERT(cond, msg)\
|
|
|
|
|
if(!(cond)) {\
|
|
|
|
|
fprintf(stderr, "Runtime assertion %s at %s:%d failed: %s\n", #cond, __FILE__, __LINE__, msg);\
|
|
|
|
|
exit(-1);\
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float pos_y = 0.0;
|
|
|
|
|
float pos_z = 0.0;
|
|
|
|
|
float pos_x = 0.0;
|
|
|
|
@ -65,7 +71,7 @@ void key_callback(GLFWwindow* win, int key, int scancode, int action, int mods)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
//glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_X11);
|
|
|
|
|
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_X11);
|
|
|
|
|
uint32_t glfw_res = glfwInit();
|
|
|
|
|
printf("glfwInit: (%d)\n", glfw_res);
|
|
|
|
|
//glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
|
|
|
@ -109,7 +115,8 @@ int main() {
|
|
|
|
|
VkSurfaceKHR surface;
|
|
|
|
|
{
|
|
|
|
|
res = glfwCreateWindowSurface(vkins, win, NULL, &surface);
|
|
|
|
|
printf("CreateWindowSurface: (%ld)\n", res);
|
|
|
|
|
printf("CreateWindowSurface: (%018p) (%018p, %018p)\n", res, VK_ERROR_EXTENSION_NOT_PRESENT, VK_ERROR_NATIVE_WINDOW_IN_USE_KHR);
|
|
|
|
|
ASSERT(surface != NULL, "Failed to create GLFW Window Surface.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VkPhysicalDevice pdev;
|
|
|
|
@ -121,6 +128,8 @@ int main() {
|
|
|
|
|
VkPhysicalDevice* phys_devs = malloc(sizeof(VkPhysicalDevice) * num_d);
|
|
|
|
|
res = vkEnumeratePhysicalDevices(vkins, &num_d, &phys_devs[0]);
|
|
|
|
|
printf("EnumeratePhysicalDevices 2: (%ld) %lu\n", res, num_d);
|
|
|
|
|
ASSERT(num_d > 0, "Failed to detect any physical devices.");
|
|
|
|
|
ASSERT(res == VK_SUCCESS, "Failed to enumerate physical devices.");
|
|
|
|
|
|
|
|
|
|
pdev = phys_devs[0];
|
|
|
|
|
}
|
|
|
|
@ -828,7 +837,7 @@ int main() {
|
|
|
|
|
|
|
|
|
|
VkSwapchainKHR swapchain;
|
|
|
|
|
{
|
|
|
|
|
VkSurfaceCapabilitiesKHR caps;
|
|
|
|
|
VkSurfaceCapabilitiesKHR caps = {};
|
|
|
|
|
res = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(pdev, surface, &caps);
|
|
|
|
|
printf("GetPhysicalDeviceSurfaceCapabilitiesKHR: (%ld)\n", res);
|
|
|
|
|
printf("minImageCount: %d\n", caps.minImageCount);
|
|
|
|
@ -1135,6 +1144,7 @@ int main() {
|
|
|
|
|
unsigned long long time_now = get_time();
|
|
|
|
|
printf(" \r");
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
usleep(12);
|
|
|
|
|
printf("ms per frame: %llu\r", (time_now - time_bef)/1000);
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
}
|
|
|
|
|