/
redgpu
/
raygpu
Обзор
Документация
Войти
/
redgpu
/
raygpu
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
include/config.h
116 строк
3 KB
manuel
Demacroify
05 янв 2026, 23:44
05 янв 2026, 23:44
40d0fc1
Код
Авторство
О чём код?
// begin file include/config.h #ifndef CONFIG_H_INCLUDED #define CONFIG_H_INCLUDED #ifdef __EMSCRIPTEN__ #if !defined (SUPPORT_WGSL_PARSER) && !defined(SUPPORT_WGPU_BACKEND) #warning None of {SUPPORT_WGSL_PARSER, SUPPORT_WGPU_BACKEND} is defined #warning Defining them all to 1 #define SUPPORT_WGSL_PARSER 1 #define SUPPORT_WGPU_BACKEND 1 #endif #if !defined(SUPPORT_GLFW) && !defined(SUPPORT_SDL3) #define SUPPORT_SDL3 1 #endif #endif #ifndef SUPPORT_WGSL_PARSER //#define SUPPORT_WGSL_PARSER 1 #endif #ifndef SUPPORT_GLSL_PARSER #define SUPPORT_GLSL_PARSER 0 #endif #ifndef SUPPORT_GLFW #define SUPPORT_GLFW 0 #endif #if SUPPORT_SDL3 == 0 && SUPPORT_GLFW == 0 && SUPPORT_RGFW == 0 #define FORCE_HEADLESS 1 #endif #if SUPPORT_SDL3 == 1 #define MAIN_WINDOW_SDL3 #elif SUPPORT_GLFW == 1 #define MAIN_WINDOW_GLFW #elif SUPPORT_RGFW == 1 #define MAIN_WINDOW_RGFW #else #endif #if defined(MAIN_WINDOW_SDL3) && defined(MAIN_WINDOW_GLFW) #error only_one_main_window_type_is_supported #endif // Detect and define DEFAULT_BACKEND based on the target platform #if defined(_WIN32) || defined(_WIN64) // Windows platform detected // If msvc, default to DirectX, otherwise (e.g. w64devkit) use vulkan #ifdef _MSC_VER #define DEFAULT_BACKEND WGPUBackendType_D3D12 #else #define DEFAULT_BACKEND WGPUBackendType_Vulkan #endif #elif defined(__APPLE__) && defined(__MACH__) // Apple platform detected (macOS, iOS, etc.) #define DEFAULT_BACKEND WGPUBackendType_Metal #elif defined(__linux__) || defined(__unix__) || defined(__FreeBSD__) // Linux or Unix-like platform detected #define DEFAULT_BACKEND WGPUBackendType_Vulkan #else // Fallback to Vulkan for any other platforms #define DEFAULT_BACKEND WGPUBackendType_Vulkan #pragma message("Unknown platform. Defaulting to Vulkan as the backend.") #endif // The RENDERBATCH_SIZE is how many vertices can be batched at most // It must be a multiple of 12 to guarantee that RL_LINES, RL_TRIANGLES and RL_QUADS // trigger an overflow on a completed shape. // Because of that, it needs to be a multiple of both 3 and 4 #ifndef RENDERBATCH_SIZE_MULTIPLIER #define RENDERBATCH_SIZE_MULTIPLIER 10 #endif #define RENDERBATCH_SIZE (RENDERBATCH_SIZE_MULTIPLIER * 12) #ifndef VERTEX_BUFFER_CACHE_SIZE #define VERTEX_BUFFER_CACHE_SIZE 128 #endif #ifndef MAX_COLOR_ATTACHMENTS #define MAX_COLOR_ATTACHMENTS 4 #endif #ifndef MAX_VERTEX_ATTRIBUTES #define MAX_VERTEX_ATTRIBUTES 8 #endif #define MAX_VERTEX_ATTRIBUTE_NAME_LENGTH 15 #define MAX_BINDING_NAME_LENGTH 23 #define MAX_SHADER_ENTRYPOINT_NAME_LENGTH 31 #define MAX_MIP_LEVELS 8 //#ifndef VULKAN_USE_DYNAMIC_RENDERING // #define VULKAN_USE_DYNAMIC_RENDERING 1 //#endif //#ifndef VULKAN_ENABLE_RAYTRACING // #define VULKAN_ENABLE_RAYTRACING 0 //#endif #define RAYGPU_NO_INLINE_FUNCTIONS 1 #if !defined(RL_MALLOC) && !defined(RL_CALLOC) && !defined(RL_REALLOC) && !defined(RL_FREE) #define RL_MALLOC malloc #define RL_CALLOC calloc #define RL_REALLOC realloc #define RL_FREE free #elif !defined(RL_MALLOC) || !defined(RL_CALLOC) || !defined(RL_REALLOC) || !defined(RL_FREE) #error Must define all of RL_MALLOC, RL_CALLOC, RL_REALLOC and RL_FREE or none #endif #endif // CONFIG_H_INCLUDED // end file include/config.h