Inital Commit
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "C:\\Users\\wayan\\source\\repos\\VulkanTutorial\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{1C2ABDF2-6C67-4667-AA0E-24CC954DBA81}|VulkanTutorial\\VulkanTutorial.vcxproj|C:\\Users\\wayan\\source\\repos\\VulkanTutorial\\VulkanTutorial\\VulkanTutorial.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
|
||||
"RelativeMoniker": "D:0:0:{1C2ABDF2-6C67-4667-AA0E-24CC954DBA81}|VulkanTutorial\\VulkanTutorial.vcxproj|solutionrelative:VulkanTutorial\\VulkanTutorial.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
{
|
||||
"Orientation": 0,
|
||||
"VerticalTabListWidth": 256,
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 0,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "VulkanTutorial.cpp",
|
||||
"DocumentMoniker": "C:\\Users\\wayan\\source\\repos\\VulkanTutorial\\VulkanTutorial\\VulkanTutorial.cpp",
|
||||
"RelativeDocumentMoniker": "VulkanTutorial\\VulkanTutorial.cpp",
|
||||
"ToolTip": "C:\\Users\\wayan\\source\\repos\\VulkanTutorial\\VulkanTutorial\\VulkanTutorial.cpp",
|
||||
"RelativeToolTip": "VulkanTutorial\\VulkanTutorial.cpp",
|
||||
"ViewState": "AQIAAOMAAAAAAAAAAAAgwPQAAAAlAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
|
||||
"WhenOpened": "2022-09-11T16:51:15.651Z",
|
||||
"EditorCaption": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.3.32825.248
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VulkanTutorial", "VulkanTutorial\VulkanTutorial.vcxproj", "{1C2ABDF2-6C67-4667-AA0E-24CC954DBA81}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1C2ABDF2-6C67-4667-AA0E-24CC954DBA81}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{1C2ABDF2-6C67-4667-AA0E-24CC954DBA81}.Debug|x64.Build.0 = Debug|x64
|
||||
{1C2ABDF2-6C67-4667-AA0E-24CC954DBA81}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{1C2ABDF2-6C67-4667-AA0E-24CC954DBA81}.Debug|x86.Build.0 = Debug|Win32
|
||||
{1C2ABDF2-6C67-4667-AA0E-24CC954DBA81}.Release|x64.ActiveCfg = Release|x64
|
||||
{1C2ABDF2-6C67-4667-AA0E-24CC954DBA81}.Release|x64.Build.0 = Release|x64
|
||||
{1C2ABDF2-6C67-4667-AA0E-24CC954DBA81}.Release|x86.ActiveCfg = Release|Win32
|
||||
{1C2ABDF2-6C67-4667-AA0E-24CC954DBA81}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {102A524A-AB29-41D8-8766-3A413D9589E8}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,378 @@
|
||||
// VulkanTutorial.cpp : Diese Datei enthält die Funktion "main". Hier beginnt und endet die Ausführung des Programms.
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#define GLFW_INCLUDE_VULKAN
|
||||
#include <GLFW\glfw3.h>
|
||||
//#include "vulkan\vulkan.h"
|
||||
#include <vector>
|
||||
|
||||
#define ASSERT_VULKAN(val)\
|
||||
if(val != VK_SUCCESS){\
|
||||
__debugbreak();\
|
||||
}
|
||||
|
||||
GLFWwindow* window;
|
||||
|
||||
VkInstance instance;
|
||||
|
||||
VkDevice device;
|
||||
|
||||
VkSurfaceKHR surface;
|
||||
|
||||
VkSwapchainKHR swapchain;
|
||||
|
||||
VkImageView* ImageViews;
|
||||
|
||||
uint32_t amaountOfImapgesInSwapchain = 0;
|
||||
|
||||
const uint32_t width = 400;
|
||||
|
||||
const uint32_t height = 300;
|
||||
|
||||
void printStats(VkPhysicalDevice & device) {
|
||||
VkPhysicalDeviceProperties properties;
|
||||
vkGetPhysicalDeviceProperties(device, &properties);
|
||||
|
||||
std::cout << "Name: " << properties.deviceName << std::endl;
|
||||
|
||||
uint32_t apiVer = properties.apiVersion;
|
||||
|
||||
std::cout << "apiVers: " << VK_VERSION_MAJOR(apiVer) << "." << VK_VERSION_MINOR(apiVer) << "." << VK_VERSION_PATCH(apiVer) << std::endl;
|
||||
std::cout << "Driverversion: " << properties.driverVersion << std::endl;
|
||||
std::cout << "Vendor ID: " << properties.vendorID << std::endl;
|
||||
std::cout << "Device ID: " << properties.deviceID << std::endl;
|
||||
std::cout << "DeviceType: " << properties.deviceType << std::endl;
|
||||
std::cout << "DiscreteQueuePriorities: " << properties.limits.discreteQueuePriorities << std::endl;
|
||||
|
||||
VkPhysicalDeviceFeatures features;
|
||||
|
||||
vkGetPhysicalDeviceFeatures(device, &features);
|
||||
|
||||
std::cout << "Geometry Shader: " << features.geometryShader << std::endl;
|
||||
|
||||
VkPhysicalDeviceMemoryProperties memory;
|
||||
|
||||
vkGetPhysicalDeviceMemoryProperties(device, &memory);
|
||||
|
||||
uint32_t amountofQuefamilys;
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(device, &amountofQuefamilys, nullptr);
|
||||
|
||||
VkQueueFamilyProperties* familyprorerties = new VkQueueFamilyProperties[amountofQuefamilys];
|
||||
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(device, &amountofQuefamilys, familyprorerties);
|
||||
|
||||
std::cout << "Number Of Queue Families: " << amountofQuefamilys << std::endl;
|
||||
|
||||
for (int i = 0; i < amountofQuefamilys; i++) {
|
||||
std::cout << std::endl;
|
||||
std::cout << "Queue Family #" << i << std::endl;
|
||||
std::cout << "VK_QUEUE_GRAPHICS_BIT " << ((familyprorerties[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) != 0) << std::endl;
|
||||
std::cout << "VK_QUEUE_COMPUTE_BIT " << ((familyprorerties[i].queueFlags & VK_QUEUE_COMPUTE_BIT) != 0) << std::endl;
|
||||
std::cout << "VK_QUEUE_TRANSFAIR_BIT " << ((familyprorerties[i].queueFlags & VK_QUEUE_TRANSFER_BIT) != 0) << std::endl;
|
||||
std::cout << "VK_QUEUE_SPARSE_BINDING_BIT " << ((familyprorerties[i].queueFlags & VK_QUEUE_SPARSE_BINDING_BIT) != 0) << std::endl;
|
||||
std::cout << "QUEUE Count: " << familyprorerties[i].queueCount << std::endl;
|
||||
std::cout << "Timestamp Valid Bits: " << familyprorerties[i].timestampValidBits << std::endl;
|
||||
uint32_t width = familyprorerties[i].minImageTransferGranularity.width;
|
||||
uint32_t height = familyprorerties[i].minImageTransferGranularity.height;
|
||||
uint32_t depth = familyprorerties[i].minImageTransferGranularity.depth;
|
||||
std::cout << "Min Image Timstamp Granularity: " << width << ", " << height << ", " << depth << std::endl;
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
|
||||
VkSurfaceCapabilitiesKHR surfaceCapabilities;
|
||||
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(device, surface, &surfaceCapabilities);
|
||||
std::cout << "=======================Surface Capabilities=================" << std::endl;
|
||||
std::cout << "minImageCount: " << surfaceCapabilities.minImageCount << std::endl;
|
||||
std::cout << "maxImageCount: " << surfaceCapabilities.maxImageCount << std::endl;
|
||||
std::cout << "currentExtent: " << surfaceCapabilities.currentExtent.width << " : " << surfaceCapabilities.currentExtent.height << std::endl;
|
||||
std::cout << "minImageExtent: " << surfaceCapabilities.minImageExtent.width << " : " << surfaceCapabilities.minImageExtent.height << std::endl;
|
||||
std::cout << "maxImageExtent: " << surfaceCapabilities.maxImageExtent.width << " : " << surfaceCapabilities.maxImageExtent.height << std::endl;
|
||||
std::cout << "maxImageArrayLayers: " << surfaceCapabilities.maxImageArrayLayers << std::endl;
|
||||
std::cout << "supportedTransforms: " << surfaceCapabilities.supportedTransforms << std::endl;
|
||||
std::cout << "currentTransform: " << surfaceCapabilities.currentTransform << std::endl;
|
||||
std::cout << "compositeAlpha: " << surfaceCapabilities.supportedCompositeAlpha << std::endl;
|
||||
std::cout << "supportedUsageFlags: " << surfaceCapabilities.supportedUsageFlags << std::endl;
|
||||
|
||||
std::cout << std::endl;
|
||||
|
||||
uint32_t amountOfFormats = 0;
|
||||
vkGetPhysicalDeviceSurfaceFormatsKHR(device, surface, &amountOfFormats, nullptr);
|
||||
|
||||
VkSurfaceFormatKHR* sourfaceFormats = new VkSurfaceFormatKHR[amountOfFormats];
|
||||
vkGetPhysicalDeviceSurfaceFormatsKHR(device, surface, &amountOfFormats, sourfaceFormats);
|
||||
|
||||
std::cout << "Amount of Formats: " << amountOfFormats << std::endl;
|
||||
|
||||
for (int i = 0; i < amountOfFormats; i++) {
|
||||
std::cout << "Format: " << sourfaceFormats[i].format << std::endl;
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
|
||||
|
||||
uint32_t amountOfPresentationmodes = 0;
|
||||
|
||||
vkGetPhysicalDeviceSurfacePresentModesKHR(device, surface, &amountOfPresentationmodes, nullptr);
|
||||
|
||||
VkPresentModeKHR* PresentModes = new VkPresentModeKHR[amountOfPresentationmodes];
|
||||
|
||||
vkGetPhysicalDeviceSurfacePresentModesKHR(device, surface, &amountOfPresentationmodes, PresentModes);
|
||||
|
||||
std::cout << "Amount of Presentation Modes: " << amountOfPresentationmodes << std::endl;
|
||||
|
||||
for (int i = 0; i < amountOfPresentationmodes; i++) {
|
||||
std::cout << "Presentation Mode: " << PresentModes[i] << std::endl;
|
||||
}
|
||||
|
||||
delete[] PresentModes;
|
||||
delete[] sourfaceFormats;
|
||||
delete[] familyprorerties;
|
||||
}
|
||||
|
||||
void StartGLFW() {
|
||||
glfwInit();
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);//GLFW klarmachen , dass Vulkan und nicht open GL genutzt wird
|
||||
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
|
||||
|
||||
window = glfwCreateWindow(width, height, "Vulkan Tutorial", nullptr, nullptr);
|
||||
}
|
||||
|
||||
void startVulkan() {
|
||||
VkApplicationInfo appInfo;
|
||||
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
|
||||
appInfo.pNext = nullptr;
|
||||
appInfo.pApplicationName = "VulkanTutorial";
|
||||
appInfo.applicationVersion = VK_MAKE_VERSION(0, 0, 0);
|
||||
appInfo.pEngineName = "TolleEngine";
|
||||
appInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0);
|
||||
appInfo.apiVersion = VK_API_VERSION_1_3;
|
||||
|
||||
uint32_t amountOflayers;
|
||||
|
||||
vkEnumerateInstanceLayerProperties(&amountOflayers, nullptr);
|
||||
|
||||
VkLayerProperties* layers = new VkLayerProperties[amountOflayers];
|
||||
vkEnumerateInstanceLayerProperties(&amountOflayers, layers);
|
||||
|
||||
std::cout << "NumberofLayers: " << amountOflayers << std::endl;
|
||||
|
||||
std::cout << "-----------------" << std::endl;
|
||||
|
||||
for (int i = 0; i < amountOflayers; i++) {
|
||||
std::cout << "layerNumber: " << i << std::endl;
|
||||
std::cout << "layerName: " << layers[i].layerName << std::endl;
|
||||
std::cout << "layerSpecV: " << layers[i].specVersion << std::endl;
|
||||
std::cout << "layerImpV: " << layers[i].implementationVersion << std::endl;
|
||||
std::cout << "LayerDesc: " << layers[i].description << std::endl;
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
uint32_t amountOfExtensions;
|
||||
|
||||
vkEnumerateInstanceExtensionProperties(nullptr, &amountOfExtensions, nullptr);
|
||||
|
||||
VkExtensionProperties* extensions = new VkExtensionProperties[amountOfExtensions];
|
||||
vkEnumerateInstanceExtensionProperties(nullptr, &amountOfExtensions, extensions);
|
||||
|
||||
std::cout << "NumberOfExtensions: " << amountOfExtensions << std::endl;
|
||||
std::cout << "-----------------" << std::endl;
|
||||
|
||||
for (int i = 0; i < amountOfExtensions; i++) {
|
||||
std::cout << "ExtensionNumber: " << i << std::endl;
|
||||
std::cout << "ExtensionName: " << extensions[i].extensionName << std::endl;
|
||||
std::cout << "specVersion: " << extensions[i].specVersion << std::endl;
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
const std::vector<const char*> validationLayers = {
|
||||
"VK_LAYER_KHRONOS_validation"
|
||||
};
|
||||
|
||||
uint32_t amountofGflwExtensions = 0;
|
||||
auto glfwExtensions = glfwGetRequiredInstanceExtensions(&amountofGflwExtensions);
|
||||
|
||||
VkInstanceCreateInfo instanceInfo;
|
||||
instanceInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||
instanceInfo.pNext = nullptr;
|
||||
instanceInfo.flags = 0;
|
||||
instanceInfo.pApplicationInfo = &appInfo;
|
||||
instanceInfo.enabledLayerCount = validationLayers.size();
|
||||
instanceInfo.ppEnabledLayerNames = validationLayers.data();
|
||||
instanceInfo.enabledExtensionCount = amountofGflwExtensions;
|
||||
instanceInfo.ppEnabledExtensionNames = glfwExtensions;
|
||||
|
||||
VkResult result = vkCreateInstance(&instanceInfo, nullptr, &instance);
|
||||
|
||||
ASSERT_VULKAN(result);
|
||||
|
||||
result = glfwCreateWindowSurface(instance, window, nullptr, &surface);
|
||||
ASSERT_VULKAN(result);
|
||||
|
||||
uint32_t amountofphysicaldivices = 0;
|
||||
|
||||
vkEnumeratePhysicalDevices(instance, &amountofphysicaldivices, nullptr); // giebt die anzahl devices in den uint auf den gepointet wird zurück
|
||||
|
||||
//VkPhysicalDevice *physicalDevices = new VkPhysicalDevice[amountofphysicaldivices];
|
||||
std::vector<VkPhysicalDevice> physicalDevices;
|
||||
physicalDevices.resize(amountofphysicaldivices);
|
||||
|
||||
vkEnumeratePhysicalDevices(instance, &amountofphysicaldivices, physicalDevices.data());//Holt sich die grafikkarten in das array
|
||||
|
||||
for (int i = 0; i < amountofphysicaldivices; i++) {
|
||||
printStats(physicalDevices[i]);
|
||||
}
|
||||
|
||||
float queuePrios[] = { 1.0,1.0,1.0,1.0 };
|
||||
|
||||
VkDeviceQueueCreateInfo QeueInfo;
|
||||
QeueInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
||||
QeueInfo.pNext = nullptr;
|
||||
QeueInfo.flags = 0;
|
||||
QeueInfo.queueFamilyIndex = 0; // TODO Search correct family index depend on use
|
||||
QeueInfo.queueCount = 4; // TDOD Check if amount of Queues are there
|
||||
QeueInfo.pQueuePriorities = queuePrios;
|
||||
|
||||
VkPhysicalDeviceFeatures usedFeatures = {};
|
||||
|
||||
const std::vector<const char*> deviceExtensions = {
|
||||
VK_KHR_SWAPCHAIN_EXTENSION_NAME
|
||||
};
|
||||
|
||||
VkDeviceCreateInfo DeviceCreateInfo;
|
||||
DeviceCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
|
||||
DeviceCreateInfo.pNext = nullptr;
|
||||
DeviceCreateInfo.flags = 0;
|
||||
DeviceCreateInfo.queueCreateInfoCount = 1;
|
||||
DeviceCreateInfo.pQueueCreateInfos = &QeueInfo;
|
||||
DeviceCreateInfo.enabledLayerCount = 0;
|
||||
DeviceCreateInfo.ppEnabledLayerNames = nullptr;
|
||||
DeviceCreateInfo.enabledExtensionCount = deviceExtensions.size();
|
||||
DeviceCreateInfo.ppEnabledExtensionNames = deviceExtensions.data();
|
||||
DeviceCreateInfo.pEnabledFeatures = &usedFeatures;
|
||||
|
||||
//TODO pick "best Device" insted of first device
|
||||
result = vkCreateDevice(physicalDevices[0], &DeviceCreateInfo, nullptr, &device);
|
||||
ASSERT_VULKAN(result);
|
||||
|
||||
VkQueue queue;
|
||||
vkGetDeviceQueue(device, 0, 0, &queue);
|
||||
|
||||
VkBool32 surfaceSupport = false;
|
||||
result = vkGetPhysicalDeviceSurfaceSupportKHR(physicalDevices[0], 0, surface, &surfaceSupport);
|
||||
ASSERT_VULKAN(result);
|
||||
|
||||
if (!surfaceSupport) {
|
||||
std::cerr << "Surface not Supportet!" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
VkSwapchainCreateInfoKHR swapchainCreateInfo;
|
||||
|
||||
swapchainCreateInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
|
||||
swapchainCreateInfo.pNext = nullptr;
|
||||
swapchainCreateInfo.flags = 0;
|
||||
swapchainCreateInfo.surface = surface;
|
||||
swapchainCreateInfo.minImageCount = 3;//TODO CIV
|
||||
swapchainCreateInfo.imageFormat = VK_FORMAT_B8G8R8A8_UNORM;//TODO CIV
|
||||
swapchainCreateInfo.imageColorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR;//TODO CIV
|
||||
swapchainCreateInfo.imageExtent = VkExtent2D{width, height};
|
||||
swapchainCreateInfo.imageArrayLayers = 1;
|
||||
swapchainCreateInfo.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||
swapchainCreateInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE; // TODO civ
|
||||
swapchainCreateInfo.queueFamilyIndexCount = 0;
|
||||
swapchainCreateInfo.pQueueFamilyIndices = nullptr;
|
||||
swapchainCreateInfo.preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
|
||||
swapchainCreateInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
|
||||
swapchainCreateInfo.presentMode = VK_PRESENT_MODE_FIFO_KHR; //TODO CIV
|
||||
swapchainCreateInfo.clipped = VK_TRUE;
|
||||
swapchainCreateInfo.oldSwapchain = VK_NULL_HANDLE;
|
||||
|
||||
result = vkCreateSwapchainKHR(device, &swapchainCreateInfo, nullptr, &swapchain);
|
||||
ASSERT_VULKAN(result);
|
||||
|
||||
|
||||
vkGetSwapchainImagesKHR(device, swapchain, &amaountOfImapgesInSwapchain, nullptr);
|
||||
|
||||
VkImage* swapchainImages = new VkImage[amaountOfImapgesInSwapchain];
|
||||
result = vkGetSwapchainImagesKHR(device, swapchain, &amaountOfImapgesInSwapchain, swapchainImages);
|
||||
ASSERT_VULKAN(result);
|
||||
|
||||
ImageViews = new VkImageView[amaountOfImapgesInSwapchain];
|
||||
|
||||
for (int i = 0; i < amaountOfImapgesInSwapchain; i++) {
|
||||
|
||||
VkImageViewCreateInfo imageViewCreateInfo;
|
||||
imageViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
imageViewCreateInfo.pNext = nullptr;
|
||||
imageViewCreateInfo.flags = 0;
|
||||
imageViewCreateInfo.image = swapchainImages[i];
|
||||
imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;
|
||||
imageViewCreateInfo.format = VK_FORMAT_B8G8R8A8_UNORM; //todo CIV
|
||||
imageViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
imageViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
imageViewCreateInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
imageViewCreateInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
imageViewCreateInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
imageViewCreateInfo.subresourceRange.baseArrayLayer = 0;
|
||||
imageViewCreateInfo.subresourceRange.baseMipLevel = 0;
|
||||
imageViewCreateInfo.subresourceRange.layerCount = 1;
|
||||
imageViewCreateInfo.subresourceRange.levelCount = 1;
|
||||
|
||||
vkCreateImageView(device, &imageViewCreateInfo, nullptr, &ImageViews[i]);
|
||||
ASSERT_VULKAN(result);
|
||||
}
|
||||
|
||||
delete[] swapchainImages;
|
||||
delete[] layers;
|
||||
delete[] extensions;
|
||||
}
|
||||
|
||||
void gameLoop() {
|
||||
while (!glfwWindowShouldClose(window)) {
|
||||
glfwPollEvents();
|
||||
}
|
||||
}
|
||||
|
||||
void shutdownVulkan() {
|
||||
vkDeviceWaitIdle(device);
|
||||
for (int i = 0; i < amaountOfImapgesInSwapchain; i++) {
|
||||
vkDestroyImageView(device, ImageViews[i], nullptr);
|
||||
}
|
||||
|
||||
delete[] ImageViews;
|
||||
vkDestroySwapchainKHR(device, swapchain, nullptr);
|
||||
vkDestroyDevice(device, nullptr);
|
||||
vkDestroySurfaceKHR(instance, surface, nullptr);
|
||||
vkDestroyInstance(instance, nullptr);
|
||||
}
|
||||
|
||||
void shutdownGLFW() {
|
||||
glfwDestroyWindow(window);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
StartGLFW();
|
||||
startVulkan();
|
||||
gameLoop();
|
||||
shutdownVulkan();
|
||||
shutdownGLFW();
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Programm ausführen: STRG+F5 oder Menüeintrag "Debuggen" > "Starten ohne Debuggen starten"
|
||||
// Programm debuggen: F5 oder "Debuggen" > Menü "Debuggen starten"
|
||||
|
||||
// Tipps für den Einstieg:
|
||||
// 1. Verwenden Sie das Projektmappen-Explorer-Fenster zum Hinzufügen/Verwalten von Dateien.
|
||||
// 2. Verwenden Sie das Team Explorer-Fenster zum Herstellen einer Verbindung mit der Quellcodeverwaltung.
|
||||
// 3. Verwenden Sie das Ausgabefenster, um die Buildausgabe und andere Nachrichten anzuzeigen.
|
||||
// 4. Verwenden Sie das Fenster "Fehlerliste", um Fehler anzuzeigen.
|
||||
// 5. Wechseln Sie zu "Projekt" > "Neues Element hinzufügen", um neue Codedateien zu erstellen, bzw. zu "Projekt" > "Vorhandenes Element hinzufügen", um dem Projekt vorhandene Codedateien hinzuzufügen.
|
||||
// 6. Um dieses Projekt später erneut zu öffnen, wechseln Sie zu "Datei" > "Öffnen" > "Projekt", und wählen Sie die SLN-Datei aus.
|
||||
@@ -0,0 +1,141 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{1c2abdf2-6c67-4667-aa0e-24cc954dba81}</ProjectGuid>
|
||||
<RootNamespace>VulkanTutorial</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>C:\VulkanSDK\1.3.224.1\Include;C:\glfw-3.3.8.bin.WIN64\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>C:\VulkanSDK\1.3.224.1\Lib;C:\glfw-3.3.8.bin.WIN64\lib-vc2022</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>vulkan-1.lib;glfw3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>C:\VulkanSDK\1.3.224.1\Include;C:\glfw-3.3.8.bin.WIN64\include</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>C:\VulkanSDK\1.3.224.1\Lib;C:\glfw-3.3.8.bin.WIN64\lib-vc2022</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>vulkan-1.lib;glfw3.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="VulkanTutorial.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Quelldateien">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Headerdateien">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Ressourcendateien">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="VulkanTutorial.cpp">
|
||||
<Filter>Quelldateien</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<ProjectOutputs>
|
||||
<ProjectOutput>
|
||||
<FullPath>C:\Users\wayan\source\repos\VulkanTutorial\x64\Debug\VulkanTutorial.exe</FullPath>
|
||||
</ProjectOutput>
|
||||
</ProjectOutputs>
|
||||
<ContentFiles />
|
||||
<SatelliteDlls />
|
||||
<NonRecipeFileRefs />
|
||||
</Project>
|
||||
Binary file not shown.
@@ -0,0 +1,13 @@
|
||||
VulkanTutorial.cpp
|
||||
C:\Users\wayan\source\repos\VulkanTutorial\VulkanTutorial\VulkanTutorial.cpp(67,23): warning C4018: "<": Konflikt zwischen "signed" und "unsigned"
|
||||
C:\Users\wayan\source\repos\VulkanTutorial\VulkanTutorial\VulkanTutorial.cpp(108,23): warning C4018: "<": Konflikt zwischen "signed" und "unsigned"
|
||||
C:\Users\wayan\source\repos\VulkanTutorial\VulkanTutorial\VulkanTutorial.cpp(125,23): warning C4018: "<": Konflikt zwischen "signed" und "unsigned"
|
||||
C:\Users\wayan\source\repos\VulkanTutorial\VulkanTutorial\VulkanTutorial.cpp(163,23): warning C4018: "<": Konflikt zwischen "signed" und "unsigned"
|
||||
C:\Users\wayan\source\repos\VulkanTutorial\VulkanTutorial\VulkanTutorial.cpp(182,23): warning C4018: "<": Konflikt zwischen "signed" und "unsigned"
|
||||
C:\Users\wayan\source\repos\VulkanTutorial\VulkanTutorial\VulkanTutorial.cpp(201,59): warning C4267: "=": Konvertierung von "size_t" nach "uint32_t", Datenverlust möglich
|
||||
C:\Users\wayan\source\repos\VulkanTutorial\VulkanTutorial\VulkanTutorial.cpp(223,23): warning C4018: "<": Konflikt zwischen "signed" und "unsigned"
|
||||
C:\Users\wayan\source\repos\VulkanTutorial\VulkanTutorial\VulkanTutorial.cpp(251,67): warning C4267: "=": Konvertierung von "size_t" nach "uint32_t", Datenverlust möglich
|
||||
C:\Users\wayan\source\repos\VulkanTutorial\VulkanTutorial\VulkanTutorial.cpp(305,23): warning C4018: "<": Konflikt zwischen "signed" und "unsigned"
|
||||
C:\Users\wayan\source\repos\VulkanTutorial\VulkanTutorial\VulkanTutorial.cpp(341,23): warning C4018: "<": Konflikt zwischen "signed" und "unsigned"
|
||||
LINK : warning LNK4098: Standardbibliothek "MSVCRT" steht in Konflikt mit anderen Bibliotheken; /NODEFAULTLIB:Bibliothek verwenden.
|
||||
VulkanTutorial.vcxproj -> C:\Users\wayan\source\repos\VulkanTutorial\x64\Debug\VulkanTutorial.exe
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
C:\Users\wayan\source\repos\VulkanTutorial\VulkanTutorial\VulkanTutorial.cpp;C:\Users\wayan\source\repos\VulkanTutorial\VulkanTutorial\x64\Debug\VulkanTutorial.obj
|
||||
@@ -0,0 +1,2 @@
|
||||
PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.38.33130:TargetPlatformVersion=10.0.22621.0:
|
||||
Debug|x64|C:\Users\wayan\source\repos\VulkanTutorial\|
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
^C:\USERS\WAYAN\SOURCE\REPOS\VULKANTUTORIAL\VULKANTUTORIAL\X64\DEBUG\VULKANTUTORIAL.OBJ
|
||||
C:\Users\wayan\source\repos\VulkanTutorial\VulkanTutorial\x64\Debug\VulkanTutorial.ilk
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
x64\Debug\\_IsIncrementalBuild
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user