summaryrefslogtreecommitdiffstatsci
path: root/samples/SampleApp.hpp
blob: 97f062051246d2b96403879da84f6a1e0cf3fbb3 (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
#pragma once
#include <stdio.h>
#include <vector>

#include "vkvg.h"
#include "vkh.h"

#include <GLFW/glfw3.h>

#define TRY_LOAD_DEVICE_EXT(ext)                                                                                   \
{                                                                                                                  \
    if (vkh_phyinfo_try_get_extension_properties(pi, #ext, NULL))                                                  \
        enabledExts[enabledExtsCount++] = #ext;                                                                    \
}


class SampleApp {
    bool try_get_phyinfo(VkhPhyInfo *phys, uint32_t phyCount, VkPhysicalDeviceType gpuType, VkhPhyInfo *phy);

    static void key_callback(GLFWwindow *window, int key, int scancode, int action, int mods);

    VkPhysicalDeviceMemoryProperties memory_properties;
    VkPhysicalDeviceProperties       gpu_props;

  public:
    uint32_t width = 512;
    uint32_t height = 512;
    uint32_t iterations = 0;
    uint32_t testSize = 500;
    std::vector<uint32_t> logSeverity = {1};
    uint32_t logType = 0;
    bool listGpus = false;
    int32_t gpuIndex = -1;
    VkSampleCountFlags samples = VK_SAMPLE_COUNT_1_BIT;

    std::vector<uint32_t> testsToRun;
    VkPhysicalDeviceType preferedGPU = VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU;
    VkPresentModeKHR presentMode = VK_PRESENT_MODE_MAILBOX_KHR;

    GLFWwindow* win;
    VkSurfaceKHR vkSurf;
    VkhApp app;
    VkhDevice vkhDev;
    VkhPresenter renderer;
    uint32_t presentQIndex;

    void Init();
    void Run();
    void CleanUp();
};