main.cpp 2.16 KB
Newer Older
1
#include <iostream>
2
#include <vkcv/Core.hpp>
Sebastian Gaida's avatar
Sebastian Gaida committed
3
#include <vkcv/Window.hpp>
4
#include <vkcv/ShaderProgram.hpp>
5
6

int main(int argc, const char** argv) {
Sebastian Gaida's avatar
Sebastian Gaida committed
7
    const char* applicationName = "First Triangle";
Sebastian Gaida's avatar
Sebastian Gaida committed
8
	vkcv::Window window = vkcv::Window::create(
Sebastian Gaida's avatar
Sebastian Gaida committed
9
            applicationName,
Sebastian Gaida's avatar
Sebastian Gaida committed
10
11
12
13
        800,
        600,
		false
	);
14
	vkcv::Core core = vkcv::Core::create(
Sebastian Gaida's avatar
Sebastian Gaida committed
15
            applicationName,
16
17
18
		VK_MAKE_VERSION(0, 0, 1),
		20,
		{vk::QueueFlagBits::eGraphics, vk::QueueFlagBits::eTransfer}
19
20
	);

21
	const auto &context = core.getContext();
22
23
24
	const vk::Instance& instance = context.getInstance();
	const vk::PhysicalDevice& physicalDevice = context.getPhysicalDevice();
	const vk::Device& device = context.getDevice();
25
26
27
28
29
30
31
32
33
34
35

	std::cout << "Physical device: " << physicalDevice.getProperties().deviceName << std::endl;

	switch (physicalDevice.getProperties().vendorID) {
		case 0x1002: std::cout << "Running AMD huh? You like underdogs, are you a Linux user?" << std::endl; break;
		case 0x10DE: std::cout << "An NVidia GPU, how predictable..." << std::endl; break;
		case 0x8086: std::cout << "Poor child, running on an Intel GPU, probably integrated..."
			"or perhaps you are from the future with a dedicated one?" << std::endl; break;
		case 0x13B5: std::cout << "ARM? What the hell are you running on, next thing I know you're trying to run Vulkan on a leg..." << std::endl; break;
		default: std::cout << "Unknown GPU vendor?! Either you're on an exotic system or your driver is broken..." << std::endl;
	}
36

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
	/*
	 * BufferHandle triangleVertices = core.createBuffer(vertices);
	 * BufferHandle triangleIndices = core.createBuffer(indices);
	 *
	 * // triangle Model creation goes here
	 *
	 *
	 * // attachment creation goes here
	 * PassHandle trianglePass = core.CreatePass(presentationPass);
	 *
	 * // shader creation goes here
	 * // material creation goes here
	 *
	 * PipelineHandle trianglePipeline = core.CreatePipeline(trianglePipeline);
	 */

	while (window.isWindowOpen())
	{
        // core.beginFrame(); or something like that
	    // core.execute(trianglePass, trianglePipeline, triangleModel);
	    // core.endFrame(); or something like that

	    // TBD: synchronization

Sebastian Gaida's avatar
Sebastian Gaida committed
61
62
		window.pollEvents();
	}
63
64
	return 0;
}