summaryrefslogtreecommitdiff
path: root/tools/gfx/vulkan/vk-module.h
blob: 7ddd5da45b109ae24580b53ce61b57889f5a1805 (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
// vk-module.h
#pragma once

#include "slang.h"

#include "slang-com-helper.h"

#if SLANG_WINDOWS_FAMILY
#   define VK_USE_PLATFORM_WIN32_KHR 1
#else
#   define VK_USE_PLATFORM_XLIB_KHR 1
#endif

#define VK_NO_PROTOTYPES

#include <vulkan/include/vulkan/vulkan.h>

namespace gfx {

struct VulkanModule
{
        /// true if has been initialized
    SLANG_FORCE_INLINE bool isInitialized() const { return m_module != nullptr; }

        /// Get a function by name
    PFN_vkVoidFunction getFunction(const char* name) const;

        /// Initialize
    Slang::Result init();
        /// Destroy
    void destroy();

        /// Dtor
    ~VulkanModule() { destroy(); }

    protected:
    void* m_module = nullptr;
};

} // renderer_test