From e047f45a4b5f01b2c0d8c98ab61c5665b35885a9 Mon Sep 17 00:00:00 2001 From: ganome Date: Tue, 20 Aug 2024 11:45:17 -0600 Subject: [PATCH] vulkantest - from vulkan-tutorial.com --- .gitignore | 1 + .vscode/tasks.json | 28 +++++++++++++++++++++++++++ cpp/vulkan/vulkantest/Makefile | 5 +++++ cpp/vulkan/vulkantest/main.cpp | 35 ++++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+) create mode 100644 .vscode/tasks.json create mode 100644 cpp/vulkan/vulkantest/Makefile create mode 100644 cpp/vulkan/vulkantest/main.cpp diff --git a/.gitignore b/.gitignore index a6291c1..655f4f3 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ /python/.idea/workspace.xml cpp/vscode/helloworld +cpp/vulkan/vulkantest/VulkanTest diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..05054c5 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,28 @@ +{ + "tasks": [ + { + "type": "cppbuild", + "label": "C/C++: g++ build active file", + "command": "/usr/bin/g++", + "args": [ + "-fdiagnostics-color=always", + "-g", + "${file}", + "-o", + "${fileDirname}/${fileBasenameNoExtension}" + ], + "options": { + "cwd": "${fileDirname}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "Task generated by Debugger." + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/cpp/vulkan/vulkantest/Makefile b/cpp/vulkan/vulkantest/Makefile new file mode 100644 index 0000000..bfc7aee --- /dev/null +++ b/cpp/vulkan/vulkantest/Makefile @@ -0,0 +1,5 @@ +CFLAGS = -std=c++17 -O2 +LDFLAGS = -lglfw -lvulkan -ldl -lpthread -lX11 -lXxf86vm -lXrandr -lXi + +VulkanTest: main.cpp + g++ $(CFLAGS) -o VulkanTest main.cpp $(LDFLAGS) diff --git a/cpp/vulkan/vulkantest/main.cpp b/cpp/vulkan/vulkantest/main.cpp new file mode 100644 index 0000000..b8f6e6f --- /dev/null +++ b/cpp/vulkan/vulkantest/main.cpp @@ -0,0 +1,35 @@ +#define GLFW_INCLUDE_VULKAN +#include + +#define GLM_FORCE_RADIANS +#define GLM_FORCE_DEPTH_ZERO_TO_ONE +#include +#include + +#include + +int main() { + glfwInit(); + + glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); + GLFWwindow* window = glfwCreateWindow(800, 600, "Vulkan window", nullptr, nullptr); + + uint32_t extensionCount = 0; + vkEnumerateInstanceExtensionProperties(nullptr, &extensionCount, nullptr); + + std::cout << extensionCount << " extensions supported\n"; + + glm::mat4 matrix; + glm::vec4 vec; + auto test = matrix * vec; + + while(!glfwWindowShouldClose(window)) { + glfwPollEvents(); + } + + glfwDestroyWindow(window); + + glfwTerminate(); + + return 0; +} \ No newline at end of file