-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
41 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
source /home/danielbevenius/work/ai/vulkan/1.3.275.0/setup-env.sh | ||
source /home/danbev/work/ai/vulkan/1.3.283.0/setup-env.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,47 @@ | ||
#define GLFW_INCLUDE_VULKAN | ||
#include <GLFW/glfw3.h> | ||
|
||
#define GLM_FORCE_RADIANS | ||
#define GLM_FORCE_DEPTH_ZERO_TO_ONE | ||
#include <glm/vec4.hpp> | ||
#include <glm/mat4x4.hpp> | ||
|
||
#include <vulkan/vulkan.h> | ||
#include <iostream> | ||
#include <vector> | ||
#include <stdexcept> | ||
|
||
int main() { | ||
glfwInit(); | ||
|
||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); | ||
GLFWwindow* window = glfwCreateWindow(800, 600, "Vulkan Example 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(); | ||
// Application info | ||
VkApplicationInfo appInfo{}; | ||
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; | ||
appInfo.pApplicationName = "Vulkan App"; | ||
appInfo.applicationVersion = VK_MAKE_VERSION(1, 0, 0); | ||
appInfo.pEngineName = "No Engine"; | ||
appInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0); | ||
appInfo.apiVersion = VK_API_VERSION_1_0; | ||
|
||
// Instance creation info | ||
VkInstanceCreateInfo createInfo{}; | ||
createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; | ||
createInfo.pApplicationInfo = &appInfo; | ||
|
||
// Specify extensions | ||
std::vector<const char*> extensions = { | ||
VK_KHR_SURFACE_EXTENSION_NAME | ||
}; | ||
createInfo.enabledExtensionCount = static_cast<uint32_t>(extensions.size()); | ||
createInfo.ppEnabledExtensionNames = extensions.data(); | ||
|
||
// No validation layers for this simple example | ||
createInfo.enabledLayerCount = 0; | ||
|
||
// Create the Vulkan instance | ||
VkInstance instance; | ||
VkResult result = vkCreateInstance(&createInfo, nullptr, &instance); | ||
|
||
if (result != VK_SUCCESS) { | ||
throw std::runtime_error("Failed to create Vulkan instance!"); | ||
} | ||
|
||
glfwDestroyWindow(window); | ||
std::cout << "Vulkan instance created successfully." << std::endl; | ||
|
||
// Use the Vulkan instance... | ||
|
||
glfwTerminate(); | ||
// Clean up | ||
vkDestroyInstance(instance, nullptr); | ||
|
||
return 0; | ||
} |