88 lines
1.9 KiB
C++
88 lines
1.9 KiB
C++
// Blaze.cpp : This file contains the 'main' function. Program execution begins and ends there.
|
|
//
|
|
|
|
#include <fmt/format.h>
|
|
|
|
#include <cassert>
|
|
|
|
#include <volk.h>
|
|
#include <SDL3/SDL.h>
|
|
#include <SDL3/SDL_vulkan.h>
|
|
|
|
#define ASSERT(COND) assert((COND))
|
|
|
|
#define VK_CHECK(RESULT) ASSERT((RESULT) == VK_SUCCESS)
|
|
|
|
constexpr uint32_t WIDTH = 1280;
|
|
constexpr uint32_t HEIGHT = 720;
|
|
|
|
int main()
|
|
{
|
|
volkInitialize();
|
|
|
|
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);
|
|
|
|
SDL_Window* window = SDL_CreateWindow("Blaze Test", WIDTH, HEIGHT, SDL_WINDOW_VULKAN);
|
|
|
|
VkApplicationInfo applicationInfo{
|
|
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
|
|
.pNext = nullptr,
|
|
.pApplicationName = "Test",
|
|
.applicationVersion = VK_MAKE_API_VERSION(0, 0, 1, 0),
|
|
.pEngineName = "Blaze",
|
|
.engineVersion = VK_MAKE_API_VERSION(0, 0, 1, 0),
|
|
.apiVersion = VK_API_VERSION_1_3,
|
|
};
|
|
|
|
uint32_t instanceExtensionCount;
|
|
char const* const* instanceExtensions = SDL_Vulkan_GetInstanceExtensions(&instanceExtensionCount);
|
|
|
|
VkInstanceCreateInfo createInfo{
|
|
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
|
|
.pNext = nullptr,
|
|
.flags = 0,
|
|
.pApplicationInfo = &applicationInfo,
|
|
.enabledLayerCount = 0,
|
|
.ppEnabledLayerNames = nullptr,
|
|
.enabledExtensionCount = instanceExtensionCount,
|
|
.ppEnabledExtensionNames = instanceExtensions,
|
|
};
|
|
|
|
VkInstance instance;
|
|
VK_CHECK(vkCreateInstance(&createInfo, nullptr, &instance));
|
|
volkLoadInstance(instance);
|
|
|
|
VkSurfaceKHR surface;
|
|
ASSERT(SDL_Vulkan_CreateSurface(window, instance, nullptr, &surface));
|
|
|
|
bool isRunning = true;
|
|
while (isRunning)
|
|
{
|
|
SDL_PumpEvents();
|
|
|
|
SDL_Event event;
|
|
while(SDL_PollEvent(&event))
|
|
{
|
|
switch (event.type)
|
|
{
|
|
case SDL_EVENT_QUIT:
|
|
isRunning = false;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
SDL_Vulkan_DestroySurface(instance, surface, nullptr);
|
|
|
|
vkDestroyInstance(instance, nullptr);
|
|
|
|
volkFinalize();
|
|
|
|
//Blaze blaze;
|
|
|
|
SDL_DestroyWindow(window);
|
|
|
|
SDL_Quit();
|
|
} |