Merge branch 'master' of github.com:bkaradzic/bgfx

This commit is contained in:
bkaradzic 2012-10-21 22:10:41 -07:00
commit e82b998bc2
11 changed files with 58 additions and 21 deletions

View file

@ -8,17 +8,18 @@ all:
premake --file=premake/premake4.lua --gcc=nacl gmake
premake --file=premake/premake4.lua --gcc=mingw gmake
premake --file=premake/premake4.lua --gcc=linux gmake
premake --file=premake/premake4.lua --gcc=emscripten gmake
make -s --no-print-directory -C src
nacl-debug32:
make -C .build/projects/gmake-nacl config=debug32
nacl-release32:
make -C .build/projects/gmake-nacl config=release32
nacl-debug64:
make -C .build/projects/gmake-nacl config=debug64
nacl-release64:
make -C .build/projects/gmake-nacl config=release64
nacl: nacl-debug32 nacl-release32 nacl-debug64 nacl-release64
linux-debug32:
make -C .build/projects/gmake-linux config=debug32
linux-release32:
make -C .build/projects/gmake-linux config=release32
linux-debug64:
make -C .build/projects/gmake-linux config=debug64
linux-release64:
make -C .build/projects/gmake-linux config=release64
linux: linux-debug32 linux-release32 linux-debug64 linux-release64
mingw-debug32:
make -C .build/projects/gmake-mingw config=debug32
@ -30,12 +31,12 @@ mingw-release64:
make -C .build/projects/gmake-mingw config=release64
mingw: mingw-debug32 mingw-release32 mingw-debug64 mingw-release64
linux-debug32:
make -C .build/projects/gmake-linux config=debug32
linux-release32:
make -C .build/projects/gmake-linux config=release32
linux-debug64:
make -C .build/projects/gmake-linux config=debug64
linux-release64:
make -C .build/projects/gmake-linux config=release64
linux: linux-debug32 linux-release32 linux-debug64 linux-release64
nacl-debug32:
make -C .build/projects/gmake-nacl config=debug32
nacl-release32:
make -C .build/projects/gmake-nacl config=release32
nacl-debug64:
make -C .build/projects/gmake-nacl config=debug64
nacl-release64:
make -C .build/projects/gmake-nacl config=release64
nacl: nacl-debug32 nacl-release32 nacl-debug64 nacl-release64

View file

@ -18,6 +18,9 @@ project "example-00-helloworld"
"bgfx",
}
configuration { "emscripten" }
targetextension ".bc"
configuration { "nacl" }
targetextension ".nexe"

View file

@ -20,6 +20,9 @@ project "example-01-cubes"
"bgfx",
}
configuration { "emscripten" }
targetextension ".bc"
configuration { "nacl" }
targetextension ".nexe"

View file

@ -20,6 +20,9 @@ project "example-02-metaballs"
"bgfx",
}
configuration { "emscripten" }
targetextension ".bc"
configuration { "nacl" }
targetextension ".nexe"

View file

@ -20,6 +20,9 @@ project "example-03-raymarch"
"bgfx",
}
configuration { "emscripten" }
targetextension ".bc"
configuration { "nacl" }
targetextension ".nexe"

View file

@ -27,6 +27,9 @@ project "example-04-mesh"
"openctm",
}
configuration { "emscripten" }
targetextension ".bc"
configuration { "nacl" }
targetextension ".nexe"

View file

@ -27,6 +27,9 @@ project "example-05-instancing"
"openctm",
}
configuration { "emscripten" }
targetextension ".bc"
configuration { "nacl" }
targetextension ".nexe"

View file

@ -22,6 +22,7 @@ newoption {
value = "GCC",
description = "Choose GCC flavor",
allowed = {
{ "emscripten", "Emscripten" },
{ "linux", "Linux" },
{ "mingw", "MinGW" },
{ "nacl", "Google Native Client" },
@ -57,6 +58,13 @@ if _ACTION == "gmake" then
"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
location (BGFX_BUILD_DIR .. "projects/" .. _ACTION .. "-linux")
end
@ -191,6 +199,11 @@ configuration { "linux", "x64" }
"-m64",
}
configuration { "emscripten" }
targetdir (BGFX_BUILD_DIR .. "emscripten" .. "/bin")
objdir (BGFX_BUILD_DIR .. "emscripten" .. "/obj")
libdirs { BGFX_THIRD_PARTY_DIR .. "lib/emscripten" }
configuration { "nacl" }
defines { "_BSD_SOURCE=1", "_POSIX_C_SOURCE=199506", "_XOPEN_SOURCE=600" }
includedirs { BX_DIR .. "include/compat/nacl" }

View file

@ -26,7 +26,10 @@
# endif // BGFX_CONFIG_RENDERER_OPENGL
# 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
# ifndef BGFX_CONFIG_RENDERER_OPENGLES3

View file

@ -340,8 +340,10 @@ namespace bgfx
if (NULL == m_context)
{
EGLNativeDisplayType ndt = EGL_DEFAULT_DISPLAY;
EGLNativeWindowType nwt = (EGLNativeWindowType)NULL;
# if BX_PLATFORM_WINDOWS
ndt = GetDC(g_bgfxHwnd);
nwt = g_bgfxHwnd;
# endif // BX_PLATFORM_
m_display = eglGetDisplay(ndt);
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);
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.");
m_context = eglCreateContext(m_display, config, EGL_NO_CONTEXT, contextAttrs);

View file

@ -89,7 +89,7 @@
# include <GLES3/gl3ext.h>
# endif // BGFX_CONFIG_RENDERER_
# if BX_PLATFORM_WINDOWS
# if BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_WINDOWS
# include <EGL/egl.h>
# undef BGFX_USE_EGL
# define BGFX_USE_EGL 1