add sdl build flag
This commit is contained in:
parent
d6580c58f4
commit
b3726d3627
@ -42,12 +42,12 @@
|
||||
# include "../external/vma/vk_mem_alloc.h"
|
||||
#endif
|
||||
|
||||
#ifndef BUILD_WASM
|
||||
#ifdef BUILD_SDL
|
||||
# include <SDL3/SDL.h>
|
||||
|
||||
#ifdef BUILD_VULKAN
|
||||
# ifdef BUILD_VULKAN
|
||||
# include <SDL3/SDL_vulkan.h>
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -50,7 +50,19 @@ static if(!__traits(compiles, { glActiveTexture(0x84C0); }))
|
||||
PFNGLACTIVETEXTUREPROC glActiveTexture;
|
||||
}
|
||||
|
||||
alias GLLoadProcAddr = SDL_GL_GetProcAddress;
|
||||
static if(__traits(compiles, { SDL_GL_GetProcAddress("Test"); }))
|
||||
{
|
||||
alias GLLoadProcAddr = SDL_GL_GetProcAddress;
|
||||
}
|
||||
else
|
||||
{
|
||||
void* GLLoadProcAddr(const char* name)
|
||||
{
|
||||
assert(false, "Currently requires SDL");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
GLLoadFuncs()
|
||||
|
||||
@ -15,6 +15,8 @@ import core.stdc.stdio : Printf = printf;
|
||||
import std.format : sformat;
|
||||
import std.math.rounding : Ceil = ceil;
|
||||
|
||||
enum bool SDL_ENABLED = __traits(compiles, { u32 count; SDL_Vulkan_GetInstanceExtensions(&count); });
|
||||
|
||||
version(VULKAN_DEBUG)
|
||||
{
|
||||
const BUILD_DEBUG = true;
|
||||
@ -69,7 +71,10 @@ version(Windows)
|
||||
struct PlatformHandles
|
||||
{
|
||||
bool sdl;
|
||||
static if(SDL_ENABLED)
|
||||
{
|
||||
SDL_Window* sdl_window;
|
||||
}
|
||||
version(linux)
|
||||
{
|
||||
Display* display;
|
||||
@ -2767,6 +2772,8 @@ Init(VulkanBuildInfo build_info, u64 permanent_mem, u64 frame_mem)
|
||||
|
||||
char*[] instance_ext = instance_ext_base;
|
||||
if(build_info.platform_handles.sdl)
|
||||
{
|
||||
static if(SDL_ENABLED)
|
||||
{
|
||||
u32 total_extension_count = cast(u32)instance_ext.length;
|
||||
|
||||
@ -2819,6 +2826,11 @@ Init(VulkanBuildInfo build_info, u64 permanent_mem, u64 frame_mem)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(false, "Must be built with SDL or have the SDL flag disabled");
|
||||
}
|
||||
}
|
||||
|
||||
VkApplicationInfo app_info = {
|
||||
sType: VK_STRUCTURE_TYPE_APPLICATION_INFO,
|
||||
@ -2901,6 +2913,8 @@ Init(VulkanBuildInfo build_info, u64 permanent_mem, u64 frame_mem)
|
||||
if(success)
|
||||
{
|
||||
if(g_vk.platform_handles.sdl)
|
||||
{
|
||||
static if(SDL_ENABLED)
|
||||
{
|
||||
if(!SDL_Vulkan_CreateSurface(g_vk.platform_handles.sdl_window, g_vk.instance, null, &g_vk.surface))
|
||||
{
|
||||
@ -2908,6 +2922,7 @@ Init(VulkanBuildInfo build_info, u64 permanent_mem, u64 frame_mem)
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
version(linux)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user