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