blob: 430151e36785e9afc0faea0fa88cf032232fc8f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
|
#ifndef PKE_WINDOW_HPP
#define PKE_WINDOW_HPP
#include "asset-manager.hpp"
#include "backends/imgui_impl_glfw.h"
#include "backends/imgui_impl_vulkan.h"
#include "event.hpp"
#include "imgui.h"
#include "memory.hpp"
#include "ecs.hpp"
#include "glm/mat4x4.hpp"
#include <cstring>
#include <cstdio>
#include <vector>
#include <cassert>
#include <GLFW/glfw3.h>
#include <vulkan/vulkan.h>
// TODO replace me with something more elegant
const unsigned int MAX_FRAMES_IN_FLIGHT = 3;
extern GLFWwindow *window;
extern VkInstance vkInstance;
extern VkPhysicalDevice vkPhysicalDevice;
extern VkPhysicalDeviceProperties vkPhysicalDeviceProperties;
extern VkSurfaceKHR vkSurfaceKHR;
extern VkDevice vkDevice;
extern VkAllocationCallbacks *vkAllocator;
extern VkQueue graphicsQueue;
extern VkCommandPool graphicsCommandPool;
extern VkCommandBuffer graphicsCommandBuffer;
extern VkQueue transferQueue;
extern VkCommandPool transferCommandPool;
extern VkCommandBuffer transferCommandBuffer;
extern unsigned int graphicsFamilyIndex;
extern unsigned int presentFamilyIndex;
extern unsigned int transferFamilyIndex;
struct PKEWindowProperties {
unsigned int width = 1280;
unsigned int height = 720;
};
struct UniformBufferObject {
glm::mat4 model;
glm::mat4 view;
glm::mat4 proj;
};
void CreateWindow(PKEWindowProperties *wp);
void DestroyWindow();
VkShaderModule UploadShader(AssetHandle handle);
void Render();
unsigned int FindMemoryTypeIndex(uint32_t typeFilter, VkMemoryPropertyFlags memPropertyFlags);
void BeginTransferBuffer(VkDeviceSize requestedMemorySize, VkBuffer &buffer, VkDeviceMemory &deviceMemory, void *&deviceData);
void EndTransferBuffer(VkBuffer &buffer, VkDeviceMemory &deviceMemory);
#endif /* PKE_WINDOW_HPP */
|