Add config
This commit is contained in:
1 parent
cf51bccc9a
commit
aab56a7cef
4 files changed
+74
No files matched your search
@@ -0,0 +1,26 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#include "config.h"
|
||||
#include "../wapp/wapp.h"
|
||||
|
||||
wp_intern Config config = {
|
||||
#ifdef USE_SDL_WINDOW_BACKEND
|
||||
.window_backend = WINDOW_BACKEND_SDL,
|
||||
.window_backend_name = "SDL",
|
||||
#else
|
||||
#error "No window backend detected"
|
||||
#endif
|
||||
|
||||
#ifdef USE_VULKAN_RENDER_BACKEND
|
||||
.gpu_backend = GPU_BACKEND_VULKAN,
|
||||
.gpu_backend_name = "Vulkan",
|
||||
.shader_format = SHADER_FORMAT_SPIRV,
|
||||
.shader_format_name = "spirv",
|
||||
#else
|
||||
#error "No render backend detected"
|
||||
#endif
|
||||
};
|
||||
|
||||
Config configGet(void) {
|
||||
return config;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#include "../wapp/wapp.h"
|
||||
|
||||
typedef enum WindowBackend {
|
||||
WINDOW_BACKEND_SDL,
|
||||
|
||||
COUNT_WINDOW_BACKENDS,
|
||||
} WindowBackend;
|
||||
|
||||
typedef enum GpuBackend {
|
||||
GPU_BACKEND_VULKAN,
|
||||
|
||||
COUNT_GPU_BACKENDS,
|
||||
} GpuBackend;
|
||||
|
||||
typedef enum ShaderFormat {
|
||||
SHADER_FORMAT_SPIRV,
|
||||
|
||||
COUNT_SHADER_FORMATS,
|
||||
} ShaderFormat;
|
||||
|
||||
typedef struct Config {
|
||||
const char *window_backend_name;
|
||||
const char *gpu_backend_name;
|
||||
const char *shader_format_name;
|
||||
WindowBackend window_backend;
|
||||
GpuBackend gpu_backend;
|
||||
ShaderFormat shader_format;
|
||||
} Config;
|
||||
|
||||
Config configGet(void);
|
||||
|
||||
#endif // !CONFIG_H
|
||||
@@ -0,0 +1,8 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#ifndef CONFIG_INC_H
|
||||
#define CONFIG_INC_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#endif // !CONFIG_INC_H
|
||||
@@ -0,0 +1,3 @@
|
||||
// vim:fileencoding=utf-8:foldmethod=marker
|
||||
|
||||
#include "config.c"
|
||||
Reference in new issue
Block a user