mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 00:58:30 -05:00
Merge branch 'master' of github.com:bkaradzic/bgfx
This commit is contained in:
commit
e82b998bc2
11 changed files with 58 additions and 21 deletions
37
makefile
37
makefile
|
@ -8,17 +8,18 @@ all:
|
||||||
premake --file=premake/premake4.lua --gcc=nacl gmake
|
premake --file=premake/premake4.lua --gcc=nacl gmake
|
||||||
premake --file=premake/premake4.lua --gcc=mingw gmake
|
premake --file=premake/premake4.lua --gcc=mingw gmake
|
||||||
premake --file=premake/premake4.lua --gcc=linux gmake
|
premake --file=premake/premake4.lua --gcc=linux gmake
|
||||||
|
premake --file=premake/premake4.lua --gcc=emscripten gmake
|
||||||
make -s --no-print-directory -C src
|
make -s --no-print-directory -C src
|
||||||
|
|
||||||
nacl-debug32:
|
linux-debug32:
|
||||||
make -C .build/projects/gmake-nacl config=debug32
|
make -C .build/projects/gmake-linux config=debug32
|
||||||
nacl-release32:
|
linux-release32:
|
||||||
make -C .build/projects/gmake-nacl config=release32
|
make -C .build/projects/gmake-linux config=release32
|
||||||
nacl-debug64:
|
linux-debug64:
|
||||||
make -C .build/projects/gmake-nacl config=debug64
|
make -C .build/projects/gmake-linux config=debug64
|
||||||
nacl-release64:
|
linux-release64:
|
||||||
make -C .build/projects/gmake-nacl config=release64
|
make -C .build/projects/gmake-linux config=release64
|
||||||
nacl: nacl-debug32 nacl-release32 nacl-debug64 nacl-release64
|
linux: linux-debug32 linux-release32 linux-debug64 linux-release64
|
||||||
|
|
||||||
mingw-debug32:
|
mingw-debug32:
|
||||||
make -C .build/projects/gmake-mingw config=debug32
|
make -C .build/projects/gmake-mingw config=debug32
|
||||||
|
@ -30,12 +31,12 @@ mingw-release64:
|
||||||
make -C .build/projects/gmake-mingw config=release64
|
make -C .build/projects/gmake-mingw config=release64
|
||||||
mingw: mingw-debug32 mingw-release32 mingw-debug64 mingw-release64
|
mingw: mingw-debug32 mingw-release32 mingw-debug64 mingw-release64
|
||||||
|
|
||||||
linux-debug32:
|
nacl-debug32:
|
||||||
make -C .build/projects/gmake-linux config=debug32
|
make -C .build/projects/gmake-nacl config=debug32
|
||||||
linux-release32:
|
nacl-release32:
|
||||||
make -C .build/projects/gmake-linux config=release32
|
make -C .build/projects/gmake-nacl config=release32
|
||||||
linux-debug64:
|
nacl-debug64:
|
||||||
make -C .build/projects/gmake-linux config=debug64
|
make -C .build/projects/gmake-nacl config=debug64
|
||||||
linux-release64:
|
nacl-release64:
|
||||||
make -C .build/projects/gmake-linux config=release64
|
make -C .build/projects/gmake-nacl config=release64
|
||||||
linux: linux-debug32 linux-release32 linux-debug64 linux-release64
|
nacl: nacl-debug32 nacl-release32 nacl-debug64 nacl-release64
|
||||||
|
|
|
@ -18,6 +18,9 @@ project "example-00-helloworld"
|
||||||
"bgfx",
|
"bgfx",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configuration { "emscripten" }
|
||||||
|
targetextension ".bc"
|
||||||
|
|
||||||
configuration { "nacl" }
|
configuration { "nacl" }
|
||||||
targetextension ".nexe"
|
targetextension ".nexe"
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,9 @@ project "example-01-cubes"
|
||||||
"bgfx",
|
"bgfx",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configuration { "emscripten" }
|
||||||
|
targetextension ".bc"
|
||||||
|
|
||||||
configuration { "nacl" }
|
configuration { "nacl" }
|
||||||
targetextension ".nexe"
|
targetextension ".nexe"
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,9 @@ project "example-02-metaballs"
|
||||||
"bgfx",
|
"bgfx",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configuration { "emscripten" }
|
||||||
|
targetextension ".bc"
|
||||||
|
|
||||||
configuration { "nacl" }
|
configuration { "nacl" }
|
||||||
targetextension ".nexe"
|
targetextension ".nexe"
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,9 @@ project "example-03-raymarch"
|
||||||
"bgfx",
|
"bgfx",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configuration { "emscripten" }
|
||||||
|
targetextension ".bc"
|
||||||
|
|
||||||
configuration { "nacl" }
|
configuration { "nacl" }
|
||||||
targetextension ".nexe"
|
targetextension ".nexe"
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,9 @@ project "example-04-mesh"
|
||||||
"openctm",
|
"openctm",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configuration { "emscripten" }
|
||||||
|
targetextension ".bc"
|
||||||
|
|
||||||
configuration { "nacl" }
|
configuration { "nacl" }
|
||||||
targetextension ".nexe"
|
targetextension ".nexe"
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,9 @@ project "example-05-instancing"
|
||||||
"openctm",
|
"openctm",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configuration { "emscripten" }
|
||||||
|
targetextension ".bc"
|
||||||
|
|
||||||
configuration { "nacl" }
|
configuration { "nacl" }
|
||||||
targetextension ".nexe"
|
targetextension ".nexe"
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ newoption {
|
||||||
value = "GCC",
|
value = "GCC",
|
||||||
description = "Choose GCC flavor",
|
description = "Choose GCC flavor",
|
||||||
allowed = {
|
allowed = {
|
||||||
|
{ "emscripten", "Emscripten" },
|
||||||
{ "linux", "Linux" },
|
{ "linux", "Linux" },
|
||||||
{ "mingw", "MinGW" },
|
{ "mingw", "MinGW" },
|
||||||
{ "nacl", "Google Native Client" },
|
{ "nacl", "Google Native Client" },
|
||||||
|
@ -57,6 +58,13 @@ if _ACTION == "gmake" then
|
||||||
"ExtraWarnings",
|
"ExtraWarnings",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if "emscripten" == _OPTIONS["gcc"] then
|
||||||
|
premake.gcc.cc = "emcc"
|
||||||
|
premake.gcc.cxx = "em++"
|
||||||
|
premake.gcc.ar = "emar"
|
||||||
|
location (BGFX_BUILD_DIR .. "projects/" .. _ACTION .. "-emscripten")
|
||||||
|
end
|
||||||
|
|
||||||
if "linux" == _OPTIONS["gcc"] then
|
if "linux" == _OPTIONS["gcc"] then
|
||||||
location (BGFX_BUILD_DIR .. "projects/" .. _ACTION .. "-linux")
|
location (BGFX_BUILD_DIR .. "projects/" .. _ACTION .. "-linux")
|
||||||
end
|
end
|
||||||
|
@ -191,6 +199,11 @@ configuration { "linux", "x64" }
|
||||||
"-m64",
|
"-m64",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configuration { "emscripten" }
|
||||||
|
targetdir (BGFX_BUILD_DIR .. "emscripten" .. "/bin")
|
||||||
|
objdir (BGFX_BUILD_DIR .. "emscripten" .. "/obj")
|
||||||
|
libdirs { BGFX_THIRD_PARTY_DIR .. "lib/emscripten" }
|
||||||
|
|
||||||
configuration { "nacl" }
|
configuration { "nacl" }
|
||||||
defines { "_BSD_SOURCE=1", "_POSIX_C_SOURCE=199506", "_XOPEN_SOURCE=600" }
|
defines { "_BSD_SOURCE=1", "_POSIX_C_SOURCE=199506", "_XOPEN_SOURCE=600" }
|
||||||
includedirs { BX_DIR .. "include/compat/nacl" }
|
includedirs { BX_DIR .. "include/compat/nacl" }
|
||||||
|
|
|
@ -26,7 +26,10 @@
|
||||||
# endif // BGFX_CONFIG_RENDERER_OPENGL
|
# endif // BGFX_CONFIG_RENDERER_OPENGL
|
||||||
|
|
||||||
# ifndef BGFX_CONFIG_RENDERER_OPENGLES2
|
# ifndef BGFX_CONFIG_RENDERER_OPENGLES2
|
||||||
# define BGFX_CONFIG_RENDERER_OPENGLES2 (BX_PLATFORM_NACL|BX_PLATFORM_ANDROID|BX_PLATFORM_IOS)
|
# define BGFX_CONFIG_RENDERER_OPENGLES2 (BX_PLATFORM_EMSCRIPTEN \
|
||||||
|
|BX_PLATFORM_NACL \
|
||||||
|
|BX_PLATFORM_ANDROID \
|
||||||
|
|BX_PLATFORM_IOS)
|
||||||
# endif // BGFX_CONFIG_RENDERER_OPENGLES2
|
# endif // BGFX_CONFIG_RENDERER_OPENGLES2
|
||||||
|
|
||||||
# ifndef BGFX_CONFIG_RENDERER_OPENGLES3
|
# ifndef BGFX_CONFIG_RENDERER_OPENGLES3
|
||||||
|
|
|
@ -340,8 +340,10 @@ namespace bgfx
|
||||||
if (NULL == m_context)
|
if (NULL == m_context)
|
||||||
{
|
{
|
||||||
EGLNativeDisplayType ndt = EGL_DEFAULT_DISPLAY;
|
EGLNativeDisplayType ndt = EGL_DEFAULT_DISPLAY;
|
||||||
|
EGLNativeWindowType nwt = (EGLNativeWindowType)NULL;
|
||||||
# if BX_PLATFORM_WINDOWS
|
# if BX_PLATFORM_WINDOWS
|
||||||
ndt = GetDC(g_bgfxHwnd);
|
ndt = GetDC(g_bgfxHwnd);
|
||||||
|
nwt = g_bgfxHwnd;
|
||||||
# endif // BX_PLATFORM_
|
# endif // BX_PLATFORM_
|
||||||
m_display = eglGetDisplay(ndt);
|
m_display = eglGetDisplay(ndt);
|
||||||
BGFX_FATAL(m_display != EGL_NO_DISPLAY, Fatal::OPENGL_UnableToCreateContext, "Failed to create display 0x%08x", m_display);
|
BGFX_FATAL(m_display != EGL_NO_DISPLAY, Fatal::OPENGL_UnableToCreateContext, "Failed to create display 0x%08x", m_display);
|
||||||
|
@ -380,7 +382,7 @@ namespace bgfx
|
||||||
success = eglChooseConfig(m_display, attrs, &config, 1, &numConfig);
|
success = eglChooseConfig(m_display, attrs, &config, 1, &numConfig);
|
||||||
BGFX_FATAL(success, Fatal::OPENGL_UnableToCreateContext, "eglChooseConfig");
|
BGFX_FATAL(success, Fatal::OPENGL_UnableToCreateContext, "eglChooseConfig");
|
||||||
|
|
||||||
m_surface = eglCreateWindowSurface(m_display, config, (EGLNativeWindowType)g_bgfxHwnd, NULL);
|
m_surface = eglCreateWindowSurface(m_display, config, nwt, NULL);
|
||||||
BGFX_FATAL(m_surface != EGL_NO_SURFACE, Fatal::OPENGL_UnableToCreateContext, "Failed to create surface.");
|
BGFX_FATAL(m_surface != EGL_NO_SURFACE, Fatal::OPENGL_UnableToCreateContext, "Failed to create surface.");
|
||||||
|
|
||||||
m_context = eglCreateContext(m_display, config, EGL_NO_CONTEXT, contextAttrs);
|
m_context = eglCreateContext(m_display, config, EGL_NO_CONTEXT, contextAttrs);
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
# include <GLES3/gl3ext.h>
|
# include <GLES3/gl3ext.h>
|
||||||
# endif // BGFX_CONFIG_RENDERER_
|
# endif // BGFX_CONFIG_RENDERER_
|
||||||
|
|
||||||
# if BX_PLATFORM_WINDOWS
|
# if BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_WINDOWS
|
||||||
# include <EGL/egl.h>
|
# include <EGL/egl.h>
|
||||||
# undef BGFX_USE_EGL
|
# undef BGFX_USE_EGL
|
||||||
# define BGFX_USE_EGL 1
|
# define BGFX_USE_EGL 1
|
||||||
|
|
Loading…
Reference in a new issue