Removed support for Native Client. https://developer.chrome.com/native-client/migration
This commit is contained in:
Родитель
18d0eebbce
Коммит
c4f5129e84
|
@ -16,7 +16,7 @@ namespace ImGui
|
||||||
|
|
||||||
void ImFileList::ChDir(const char* path)
|
void ImFileList::ChDir(const char* path)
|
||||||
{
|
{
|
||||||
#if BX_PLATFORM_NACL || BX_PLATFORM_PS4
|
#if BX_PLATFORM_PS4
|
||||||
BX_UNUSED(path);
|
BX_UNUSED(path);
|
||||||
#else
|
#else
|
||||||
DIR* dir = opendir(path);
|
DIR* dir = opendir(path);
|
||||||
|
@ -47,7 +47,7 @@ namespace ImGui
|
||||||
|
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
}
|
}
|
||||||
#endif // BX_PLATFORM_NACL || BX_PLATFORM_PS4
|
#endif // BX_PLATFORM_PS4
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImFileList::Draw()
|
void ImFileList::Draw()
|
||||||
|
|
|
@ -37,7 +37,6 @@ Supported platforms:
|
||||||
* iOS (iPhone, iPad, AppleTV)
|
* iOS (iPhone, iPad, AppleTV)
|
||||||
* Linux
|
* Linux
|
||||||
* MIPS Creator CI20
|
* MIPS Creator CI20
|
||||||
* Native Client (PPAPI 37+, ARM, x86, x64, PNaCl)
|
|
||||||
* OSX (10.9+)
|
* OSX (10.9+)
|
||||||
* RaspberryPi
|
* RaspberryPi
|
||||||
* SteamLink
|
* SteamLink
|
||||||
|
|
|
@ -72,13 +72,13 @@ static const uint16_t s_cubeIndices[36] =
|
||||||
6, 3, 7,
|
6, 3, 7,
|
||||||
};
|
};
|
||||||
|
|
||||||
#if BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_NACL
|
#if BX_PLATFORM_EMSCRIPTEN
|
||||||
static const int64_t highwm = 1000000/35;
|
static const int64_t highwm = 1000000/35;
|
||||||
static const int64_t lowwm = 1000000/27;
|
static const int64_t lowwm = 1000000/27;
|
||||||
#else
|
#else
|
||||||
static const int64_t highwm = 1000000/65;
|
static const int64_t highwm = 1000000/65;
|
||||||
static const int64_t lowwm = 1000000/57;
|
static const int64_t lowwm = 1000000/57;
|
||||||
#endif // BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_NACL
|
#endif // BX_PLATFORM_EMSCRIPTEN
|
||||||
|
|
||||||
class ExampleDrawStress : public entry::AppI
|
class ExampleDrawStress : public entry::AppI
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,231 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2011-2017 Branimir Karadzic. All rights reserved.
|
|
||||||
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "entry_p.h"
|
|
||||||
|
|
||||||
#if ENTRY_CONFIG_USE_NATIVE && BX_PLATFORM_NACL
|
|
||||||
|
|
||||||
#include <bgfx/platform.h>
|
|
||||||
|
|
||||||
#include <pthread.h>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include <ppapi/c/pp_errors.h>
|
|
||||||
#include <ppapi/c/pp_module.h>
|
|
||||||
#include <ppapi/c/ppb.h>
|
|
||||||
#include <ppapi/c/ppb_core.h>
|
|
||||||
#include <ppapi/c/ppb_graphics_3d.h>
|
|
||||||
#include <ppapi/c/ppb_instance.h>
|
|
||||||
#include <ppapi/c/ppb_message_loop.h>
|
|
||||||
#include <ppapi/c/ppb_url_loader.h>
|
|
||||||
#include <ppapi/c/ppb_url_request_info.h>
|
|
||||||
#include <ppapi/c/ppb_url_response_info.h>
|
|
||||||
#include <ppapi/c/ppb_var.h>
|
|
||||||
#include <ppapi/c/ppp.h>
|
|
||||||
#include <ppapi/c/ppp_instance.h>
|
|
||||||
#include <ppapi/gles2/gl2ext_ppapi.h>
|
|
||||||
|
|
||||||
#include <bx/thread.h>
|
|
||||||
|
|
||||||
#include "entry.h"
|
|
||||||
|
|
||||||
namespace entry
|
|
||||||
{
|
|
||||||
const PPB_Core* g_coreInterface;
|
|
||||||
const PPB_Instance* g_instInterface;
|
|
||||||
const PPB_Graphics3D* g_graphicsInterface;
|
|
||||||
const PPB_MessageLoop* g_messageLoopInterface;
|
|
||||||
const PPB_URLLoader* g_urlLoaderInterface;
|
|
||||||
const PPB_URLRequestInfo* g_urlRequestInterface;
|
|
||||||
const PPB_URLResponseInfo* g_urlResponseInterface;
|
|
||||||
const PPB_Var* g_varInterface;
|
|
||||||
PP_Instance g_instance;
|
|
||||||
|
|
||||||
const Event* poll()
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Event* poll(WindowHandle _handle)
|
|
||||||
{
|
|
||||||
BX_UNUSED(_handle);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void release(const Event* _event)
|
|
||||||
{
|
|
||||||
BX_UNUSED(_event);
|
|
||||||
}
|
|
||||||
|
|
||||||
WindowHandle createWindow(int32_t _x, int32_t _y, uint32_t _width, uint32_t _height, uint32_t _flags, const char* _title)
|
|
||||||
{
|
|
||||||
BX_UNUSED(_x, _y, _width, _height, _flags, _title);
|
|
||||||
WindowHandle handle = { UINT16_MAX };
|
|
||||||
return handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
void destroyWindow(WindowHandle _handle)
|
|
||||||
{
|
|
||||||
BX_UNUSED(_handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setWindowPos(WindowHandle _handle, int32_t _x, int32_t _y)
|
|
||||||
{
|
|
||||||
BX_UNUSED(_handle, _x, _y);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setWindowSize(WindowHandle _handle, uint32_t _width, uint32_t _height)
|
|
||||||
{
|
|
||||||
BX_UNUSED(_handle, _width, _height);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setWindowTitle(WindowHandle _handle, const char* _title)
|
|
||||||
{
|
|
||||||
BX_UNUSED(_handle, _title);
|
|
||||||
}
|
|
||||||
|
|
||||||
void toggleWindowFrame(WindowHandle _handle)
|
|
||||||
{
|
|
||||||
BX_UNUSED(_handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
void toggleFullscreen(WindowHandle _handle)
|
|
||||||
{
|
|
||||||
BX_UNUSED(_handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setMouseLock(WindowHandle _handle, bool _lock)
|
|
||||||
{
|
|
||||||
BX_UNUSED(_handle, _lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename Type>
|
|
||||||
bool initializeInterface(PPB_GetInterface _interface, const char* _name, const Type*& _result)
|
|
||||||
{
|
|
||||||
_result = reinterpret_cast<const Type*>(_interface(_name) );
|
|
||||||
// DBG("%p %s", _result, _name);
|
|
||||||
return NULL != _result;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct MainThreadEntry
|
|
||||||
{
|
|
||||||
int m_argc;
|
|
||||||
char** m_argv;
|
|
||||||
|
|
||||||
static int32_t threadFunc(void* _userData);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct NaclContext
|
|
||||||
{
|
|
||||||
NaclContext()
|
|
||||||
{
|
|
||||||
static const char* argv[1] = { "nacl.nexe" };
|
|
||||||
m_mte.m_argc = 1;
|
|
||||||
m_mte.m_argv = const_cast<char**>(argv);
|
|
||||||
|
|
||||||
m_thread.init(MainThreadEntry::threadFunc, &m_mte);
|
|
||||||
}
|
|
||||||
|
|
||||||
~NaclContext()
|
|
||||||
{
|
|
||||||
m_thread.shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
MainThreadEntry m_mte;
|
|
||||||
bx::Thread m_thread;
|
|
||||||
};
|
|
||||||
|
|
||||||
static NaclContext* s_ctx;
|
|
||||||
|
|
||||||
int32_t MainThreadEntry::threadFunc(void* _userData)
|
|
||||||
{
|
|
||||||
MainThreadEntry* self = (MainThreadEntry*)_userData;
|
|
||||||
|
|
||||||
PP_Resource resource = g_messageLoopInterface->Create(g_instance);
|
|
||||||
g_messageLoopInterface->AttachToCurrentThread(resource);
|
|
||||||
|
|
||||||
int32_t result = main(self->m_argc, self->m_argv);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PP_Bool naclInstanceDidCreate(PP_Instance _instance, uint32_t /*_argc*/, const char* /*_argn*/[], const char* /*_argv*/[])
|
|
||||||
{
|
|
||||||
g_instance = _instance; // one instance only!
|
|
||||||
|
|
||||||
if (bgfx::naclSetInterfaces(g_instance, g_instInterface, g_graphicsInterface, NULL) )
|
|
||||||
{
|
|
||||||
s_ctx = new NaclContext;
|
|
||||||
return PP_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return PP_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void naclInstanceDidDestroy(PP_Instance _instance)
|
|
||||||
{
|
|
||||||
BX_UNUSED(_instance);
|
|
||||||
delete s_ctx;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void naclInstanceDidChangeView(PP_Instance /*_instance*/, PP_Resource /*_view*/)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void naclInstanceDidChangeFocus(PP_Instance /*_instance*/, PP_Bool /*_focus*/)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static PP_Bool naclInstanceHandleDocumentLoad(PP_Instance /*_instance*/, PP_Resource /*_urlLoader*/)
|
|
||||||
{
|
|
||||||
return PP_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace entry
|
|
||||||
|
|
||||||
using namespace entry;
|
|
||||||
|
|
||||||
PP_EXPORT const void* PPP_GetInterface(const char* _name)
|
|
||||||
{
|
|
||||||
if (0 == bx::strCmp(_name, PPP_INSTANCE_INTERFACE) )
|
|
||||||
{
|
|
||||||
static PPP_Instance instanceInterface =
|
|
||||||
{
|
|
||||||
&naclInstanceDidCreate,
|
|
||||||
&naclInstanceDidDestroy,
|
|
||||||
&naclInstanceDidChangeView,
|
|
||||||
&naclInstanceDidChangeFocus,
|
|
||||||
&naclInstanceHandleDocumentLoad,
|
|
||||||
};
|
|
||||||
|
|
||||||
return &instanceInterface;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
PP_EXPORT int32_t PPP_InitializeModule(PP_Module _module, PPB_GetInterface _interface)
|
|
||||||
{
|
|
||||||
DBG("PPAPI version: %d", PPAPI_RELEASE);
|
|
||||||
|
|
||||||
BX_UNUSED(_module);
|
|
||||||
bool result = true;
|
|
||||||
result &= initializeInterface(_interface, PPB_CORE_INTERFACE, g_coreInterface);
|
|
||||||
result &= initializeInterface(_interface, PPB_GRAPHICS_3D_INTERFACE, g_graphicsInterface);
|
|
||||||
result &= initializeInterface(_interface, PPB_INSTANCE_INTERFACE, g_instInterface);
|
|
||||||
result &= initializeInterface(_interface, PPB_MESSAGELOOP_INTERFACE, g_messageLoopInterface);
|
|
||||||
result &= initializeInterface(_interface, PPB_URLLOADER_INTERFACE, g_urlLoaderInterface);
|
|
||||||
result &= initializeInterface(_interface, PPB_URLREQUESTINFO_INTERFACE, g_urlRequestInterface);
|
|
||||||
result &= initializeInterface(_interface, PPB_URLRESPONSEINFO_INTERFACE, g_urlResponseInterface);
|
|
||||||
result &= initializeInterface(_interface, PPB_VAR_INTERFACE, g_varInterface);
|
|
||||||
result &= glInitializePPAPI(_interface);
|
|
||||||
|
|
||||||
return result ? PP_OK : PP_ERROR_NOINTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
PP_EXPORT void PPP_ShutdownModule()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // ENTRY_CONFIG_USE_NATIVE && BX_PLATFROM_NACL
|
|
|
@ -34,7 +34,6 @@
|
||||||
|| BX_PLATFORM_EMSCRIPTEN \
|
|| BX_PLATFORM_EMSCRIPTEN \
|
||||||
|| BX_PLATFORM_IOS \
|
|| BX_PLATFORM_IOS \
|
||||||
|| BX_PLATFORM_LINUX \
|
|| BX_PLATFORM_LINUX \
|
||||||
|| BX_PLATFORM_NACL \
|
|
||||||
|| BX_PLATFORM_OSX \
|
|| BX_PLATFORM_OSX \
|
||||||
|| BX_PLATFORM_QNX \
|
|| BX_PLATFORM_QNX \
|
||||||
|| BX_PLATFORM_RPI \
|
|| BX_PLATFORM_RPI \
|
||||||
|
|
|
@ -131,19 +131,4 @@ namespace bgfx
|
||||||
|
|
||||||
} // namespace bgfx
|
} // namespace bgfx
|
||||||
|
|
||||||
#if BX_PLATFORM_NACL
|
|
||||||
# include <ppapi/c/ppb_graphics_3d.h>
|
|
||||||
# include <ppapi/c/ppb_instance.h>
|
|
||||||
|
|
||||||
namespace bgfx
|
|
||||||
{
|
|
||||||
typedef void (*PostSwapBuffersFn)(uint32_t _width, uint32_t _height);
|
|
||||||
|
|
||||||
///
|
|
||||||
bool naclSetInterfaces(::PP_Instance, const ::PPB_Instance*, const ::PPB_Graphics3D*, PostSwapBuffersFn);
|
|
||||||
|
|
||||||
} // namespace bgfx
|
|
||||||
|
|
||||||
#endif // BX_PLATFORM_
|
|
||||||
|
|
||||||
#endif // BGFX_PLATFORM_H_HEADER_GUARD
|
#endif // BGFX_PLATFORM_H_HEADER_GUARD
|
||||||
|
|
31
makefile
31
makefile
|
@ -56,9 +56,6 @@ projgen: ## Generate project files for all configurations.
|
||||||
$(GENIE) --with-examples --gcc=ios-arm gmake
|
$(GENIE) --with-examples --gcc=ios-arm gmake
|
||||||
$(GENIE) --with-examples --gcc=ios-arm64 gmake
|
$(GENIE) --with-examples --gcc=ios-arm64 gmake
|
||||||
$(GENIE) --with-examples --gcc=ios-simulator gmake
|
$(GENIE) --with-examples --gcc=ios-simulator gmake
|
||||||
$(GENIE) --with-examples --gcc=nacl gmake
|
|
||||||
$(GENIE) --with-examples --gcc=nacl-arm gmake
|
|
||||||
$(GENIE) --with-examples --gcc=pnacl gmake
|
|
||||||
$(GENIE) --with-examples --gcc=rpi gmake
|
$(GENIE) --with-examples --gcc=rpi gmake
|
||||||
|
|
||||||
.build/projects/gmake-android-arm:
|
.build/projects/gmake-android-arm:
|
||||||
|
@ -189,34 +186,6 @@ vs2017-release64: .build/projects/vs2017 ## Build - vs2017 x64 Release
|
||||||
devenv .build/projects/vs2017/bgfx.sln /Build "Release|x64"
|
devenv .build/projects/vs2017/bgfx.sln /Build "Release|x64"
|
||||||
vs2017: vs2017-debug32 vs2017-release32 vs2017-debug64 vs2017-release64 ## Build - vs2017 x86/x64 Debug and Release
|
vs2017: vs2017-debug32 vs2017-release32 vs2017-debug64 vs2017-release64 ## Build - vs2017 x86/x64 Debug and Release
|
||||||
|
|
||||||
.build/projects/gmake-nacl:
|
|
||||||
$(GENIE) --gcc=nacl gmake
|
|
||||||
nacl-debug32: .build/projects/gmake-nacl ## Build - Native Client x86 Debug
|
|
||||||
$(MAKE) -R -C .build/projects/gmake-nacl config=debug32
|
|
||||||
nacl-release32: .build/projects/gmake-nacl ## Build - Native Client x86 Release
|
|
||||||
$(MAKE) -R -C .build/projects/gmake-nacl config=release32
|
|
||||||
nacl-debug64: .build/projects/gmake-nacl ## Build - Native Client x64 Debug
|
|
||||||
$(MAKE) -R -C .build/projects/gmake-nacl config=debug64
|
|
||||||
nacl-release64: .build/projects/gmake-nacl ## Build - Native Client x64 Release
|
|
||||||
$(MAKE) -R -C .build/projects/gmake-nacl config=release64
|
|
||||||
nacl: nacl-debug32 nacl-release32 nacl-debug64 nacl-release64 ## Build - Native Client x86/x64 Debug and Release
|
|
||||||
|
|
||||||
.build/projects/gmake-nacl-arm:
|
|
||||||
$(GENIE) --gcc=nacl-arm gmake
|
|
||||||
nacl-arm-debug: .build/projects/gmake-nacl-arm ## Build - Native Client ARM Debug
|
|
||||||
$(MAKE) -R -C .build/projects/gmake-nacl-arm config=debug
|
|
||||||
nacl-arm-release: .build/projects/gmake-nacl-arm ## Build - Native Client ARM Release
|
|
||||||
$(MAKE) -R -C .build/projects/gmake-nacl-arm config=release
|
|
||||||
nacl-arm: nacl-arm-debug32 nacl-arm-release32 ## Build - Native Client ARM Debug and Release
|
|
||||||
|
|
||||||
.build/projects/gmake-pnacl:
|
|
||||||
$(GENIE) --gcc=pnacl gmake
|
|
||||||
pnacl-debug: .build/projects/gmake-pnacl ## Build - Portable Native Client Debug
|
|
||||||
$(MAKE) -R -C .build/projects/gmake-pnacl config=debug
|
|
||||||
pnacl-release: .build/projects/gmake-pnacl ## Build - Portable Native Client Release
|
|
||||||
$(MAKE) -R -C .build/projects/gmake-pnacl config=release
|
|
||||||
pnacl: pnacl-debug pnacl-release ## Build - Portable Native Client Debug and Release
|
|
||||||
|
|
||||||
.build/projects/gmake-osx:
|
.build/projects/gmake-osx:
|
||||||
$(GENIE) --with-tools --with-examples --with-shared-lib --gcc=osx gmake
|
$(GENIE) --with-tools --with-examples --with-shared-lib --gcc=osx gmake
|
||||||
osx-debug32: .build/projects/gmake-osx ## Build - OSX x86 Debug
|
osx-debug32: .build/projects/gmake-osx ## Build - OSX x86 Debug
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#include "bgfx.cpp"
|
#include "bgfx.cpp"
|
||||||
#include "glcontext_egl.cpp"
|
#include "glcontext_egl.cpp"
|
||||||
#include "glcontext_glx.cpp"
|
#include "glcontext_glx.cpp"
|
||||||
#include "glcontext_ppapi.cpp"
|
|
||||||
#include "glcontext_wgl.cpp"
|
#include "glcontext_wgl.cpp"
|
||||||
#include "hmd.cpp"
|
#include "hmd.cpp"
|
||||||
#include "hmd_ovr.cpp"
|
#include "hmd_ovr.cpp"
|
||||||
|
|
|
@ -1958,7 +1958,6 @@ namespace bgfx
|
||||||
|| BX_PLATFORM_ANDROID
|
|| BX_PLATFORM_ANDROID
|
||||||
|| BX_PLATFORM_EMSCRIPTEN
|
|| BX_PLATFORM_EMSCRIPTEN
|
||||||
|| BX_PLATFORM_IOS
|
|| BX_PLATFORM_IOS
|
||||||
|| BX_PLATFORM_NACL
|
|
||||||
|| BX_PLATFORM_RPI
|
|| BX_PLATFORM_RPI
|
||||||
) )
|
) )
|
||||||
{
|
{
|
||||||
|
@ -2613,7 +2612,7 @@ namespace bgfx
|
||||||
}
|
}
|
||||||
|
|
||||||
if (true
|
if (true
|
||||||
&& !BX_ENABLED(BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_NACL || BX_PLATFORM_PS4)
|
&& !BX_ENABLED(BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_PS4)
|
||||||
&& RendererType::Noop != _type
|
&& RendererType::Noop != _type
|
||||||
&& NULL == g_platformData.ndt
|
&& NULL == g_platformData.ndt
|
||||||
&& NULL == g_platformData.nwh
|
&& NULL == g_platformData.nwh
|
||||||
|
|
|
@ -64,7 +64,6 @@
|
||||||
|| BX_PLATFORM_ANDROID \
|
|| BX_PLATFORM_ANDROID \
|
||||||
|| BX_PLATFORM_EMSCRIPTEN \
|
|| BX_PLATFORM_EMSCRIPTEN \
|
||||||
|| BX_PLATFORM_IOS \
|
|| BX_PLATFORM_IOS \
|
||||||
|| BX_PLATFORM_NACL \
|
|
||||||
|| BX_PLATFORM_QNX \
|
|| BX_PLATFORM_QNX \
|
||||||
|| BX_PLATFORM_RPI \
|
|| BX_PLATFORM_RPI \
|
||||||
|| BX_PLATFORM_STEAMLINK \
|
|| BX_PLATFORM_STEAMLINK \
|
||||||
|
|
|
@ -1,254 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2011-2017 Branimir Karadzic. All rights reserved.
|
|
||||||
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "bgfx_p.h"
|
|
||||||
|
|
||||||
#if BX_PLATFORM_NACL && (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)
|
|
||||||
# include <bgfx/platform.h>
|
|
||||||
# include "renderer_gl.h"
|
|
||||||
|
|
||||||
namespace bgfx { namespace gl
|
|
||||||
{
|
|
||||||
# define GL_IMPORT(_optional, _proto, _func, _import) _proto _func
|
|
||||||
# include "glimports.h"
|
|
||||||
|
|
||||||
void naclSwapCompleteCb(void* /*_data*/, int32_t /*_result*/);
|
|
||||||
|
|
||||||
PP_CompletionCallback naclSwapComplete =
|
|
||||||
{
|
|
||||||
naclSwapCompleteCb,
|
|
||||||
NULL,
|
|
||||||
PP_COMPLETIONCALLBACK_FLAG_NONE
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Ppapi
|
|
||||||
{
|
|
||||||
Ppapi()
|
|
||||||
: m_context(0)
|
|
||||||
, m_instance(0)
|
|
||||||
, m_instInterface(NULL)
|
|
||||||
, m_graphicsInterface(NULL)
|
|
||||||
, m_instancedArrays(NULL)
|
|
||||||
, m_query(NULL)
|
|
||||||
, m_postSwapBuffers(NULL)
|
|
||||||
, m_forceSwap(true)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool setInterfaces(PP_Instance _instance, const PPB_Instance* _instInterface, const PPB_Graphics3D* _graphicsInterface, PostSwapBuffersFn _postSwapBuffers);
|
|
||||||
|
|
||||||
void resize(uint32_t _width, uint32_t _height, uint32_t /*_flags*/)
|
|
||||||
{
|
|
||||||
m_graphicsInterface->ResizeBuffers(m_context, _width, _height);
|
|
||||||
}
|
|
||||||
|
|
||||||
void swap()
|
|
||||||
{
|
|
||||||
glSetCurrentContextPPAPI(m_context);
|
|
||||||
m_graphicsInterface->SwapBuffers(m_context, naclSwapComplete);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isValid() const
|
|
||||||
{
|
|
||||||
return 0 != m_context;
|
|
||||||
}
|
|
||||||
|
|
||||||
PP_Resource m_context;
|
|
||||||
PP_Instance m_instance;
|
|
||||||
const PPB_Instance* m_instInterface;
|
|
||||||
const PPB_Graphics3D* m_graphicsInterface;
|
|
||||||
const PPB_OpenGLES2InstancedArrays* m_instancedArrays;
|
|
||||||
const PPB_OpenGLES2Query* m_query;
|
|
||||||
PostSwapBuffersFn m_postSwapBuffers;
|
|
||||||
bool m_forceSwap;
|
|
||||||
};
|
|
||||||
|
|
||||||
static Ppapi s_ppapi;
|
|
||||||
|
|
||||||
void naclSwapCompleteCb(void* /*_data*/, int32_t /*_result*/)
|
|
||||||
{
|
|
||||||
// For NaCl bgfx doesn't create render thread, but rendering is always
|
|
||||||
// multithreaded. Frame rendering is done on main thread, and context
|
|
||||||
// is initialized when PPAPI interfaces are set. Force swap is there to
|
|
||||||
// keep calling swap complete callback, so that initialization doesn't
|
|
||||||
// deadlock on semaphores.
|
|
||||||
if (s_ppapi.m_forceSwap)
|
|
||||||
{
|
|
||||||
s_ppapi.swap();
|
|
||||||
}
|
|
||||||
|
|
||||||
renderFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void GL_APIENTRY naclVertexAttribDivisor(GLuint _index, GLuint _divisor)
|
|
||||||
{
|
|
||||||
s_ppapi.m_instancedArrays->VertexAttribDivisorANGLE(s_ppapi.m_context, _index, _divisor);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void GL_APIENTRY naclDrawArraysInstanced(GLenum _mode, GLint _first, GLsizei _count, GLsizei _primcount)
|
|
||||||
{
|
|
||||||
s_ppapi.m_instancedArrays->DrawArraysInstancedANGLE(s_ppapi.m_context, _mode, _first, _count, _primcount);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void GL_APIENTRY naclDrawElementsInstanced(GLenum _mode, GLsizei _count, GLenum _type, const GLvoid* _indices, GLsizei _primcount)
|
|
||||||
{
|
|
||||||
s_ppapi.m_instancedArrays->DrawElementsInstancedANGLE(s_ppapi.m_context, _mode, _count, _type, _indices, _primcount);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void GL_APIENTRY naclGenQueries(GLsizei _n, GLuint* _queries)
|
|
||||||
{
|
|
||||||
s_ppapi.m_query->GenQueriesEXT(s_ppapi.m_context, _n, _queries);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void GL_APIENTRY naclDeleteQueries(GLsizei _n, const GLuint* _queries)
|
|
||||||
{
|
|
||||||
s_ppapi.m_query->DeleteQueriesEXT(s_ppapi.m_context, _n, _queries);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void GL_APIENTRY naclBeginQuery(GLenum _target, GLuint _id)
|
|
||||||
{
|
|
||||||
BX_UNUSED(_target);
|
|
||||||
s_ppapi.m_query->BeginQueryEXT(s_ppapi.m_context, GL_ANY_SAMPLES_PASSED_EXT, _id);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void GL_APIENTRY naclEndQuery(GLenum _target)
|
|
||||||
{
|
|
||||||
BX_UNUSED(_target);
|
|
||||||
s_ppapi.m_query->EndQueryEXT(s_ppapi.m_context, GL_ANY_SAMPLES_PASSED_EXT);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void GL_APIENTRY naclGetQueryObjectiv(GLuint _id, GLenum _pname, GLint* _params)
|
|
||||||
{
|
|
||||||
BX_UNUSED(_id, _pname);
|
|
||||||
s_ppapi.m_query->GetQueryivEXT(s_ppapi.m_context, GL_ANY_SAMPLES_PASSED_EXT, GL_CURRENT_QUERY_EXT, _params);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void GL_APIENTRY naclGetQueryObjectui64v(GLuint _id, GLenum _pname, GLuint64* _params)
|
|
||||||
{
|
|
||||||
BX_UNUSED(_id, _pname);
|
|
||||||
GLint params;
|
|
||||||
s_ppapi.m_query->GetQueryivEXT(s_ppapi.m_context, GL_ANY_SAMPLES_PASSED_EXT, GL_CURRENT_QUERY_EXT, ¶ms);
|
|
||||||
*_params = params;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Ppapi::setInterfaces(PP_Instance _instance, const PPB_Instance* _instInterface, const PPB_Graphics3D* _graphicsInterface, PostSwapBuffersFn _postSwapBuffers)
|
|
||||||
{
|
|
||||||
BX_TRACE("PPAPI Interfaces");
|
|
||||||
|
|
||||||
m_instance = _instance;
|
|
||||||
m_instInterface = _instInterface;
|
|
||||||
m_graphicsInterface = _graphicsInterface;
|
|
||||||
m_instancedArrays = glGetInstancedArraysInterfacePPAPI();
|
|
||||||
m_query = glGetQueryInterfacePPAPI();
|
|
||||||
m_postSwapBuffers = _postSwapBuffers;
|
|
||||||
|
|
||||||
int32_t attribs[] =
|
|
||||||
{
|
|
||||||
PP_GRAPHICS3DATTRIB_ALPHA_SIZE, 8,
|
|
||||||
PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 24,
|
|
||||||
PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 8,
|
|
||||||
PP_GRAPHICS3DATTRIB_SAMPLES, 0,
|
|
||||||
PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, 0,
|
|
||||||
PP_GRAPHICS3DATTRIB_WIDTH, BGFX_DEFAULT_WIDTH,
|
|
||||||
PP_GRAPHICS3DATTRIB_HEIGHT, BGFX_DEFAULT_HEIGHT,
|
|
||||||
PP_GRAPHICS3DATTRIB_NONE
|
|
||||||
};
|
|
||||||
|
|
||||||
m_context = m_graphicsInterface->Create(m_instance, 0, attribs);
|
|
||||||
if (0 == m_context)
|
|
||||||
{
|
|
||||||
BX_TRACE("Failed to create context!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_instInterface->BindGraphics(m_instance, m_context);
|
|
||||||
glSetCurrentContextPPAPI(m_context);
|
|
||||||
m_graphicsInterface->SwapBuffers(m_context, naclSwapComplete);
|
|
||||||
|
|
||||||
if (NULL != m_instancedArrays)
|
|
||||||
{
|
|
||||||
glVertexAttribDivisor = naclVertexAttribDivisor;
|
|
||||||
glDrawArraysInstanced = naclDrawArraysInstanced;
|
|
||||||
glDrawElementsInstanced = naclDrawElementsInstanced;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NULL != m_query)
|
|
||||||
{
|
|
||||||
glGenQueries = naclGenQueries;
|
|
||||||
glDeleteQueries = naclDeleteQueries;
|
|
||||||
glBeginQuery = naclBeginQuery;
|
|
||||||
glEndQuery = naclEndQuery;
|
|
||||||
glGetQueryObjectiv = naclGetQueryObjectiv;
|
|
||||||
glGetQueryObjectui64v = naclGetQueryObjectui64v;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prevent render thread creation.
|
|
||||||
RenderFrame::Enum result = renderFrame();
|
|
||||||
return RenderFrame::NoContext == result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GlContext::create(uint32_t _width, uint32_t _height)
|
|
||||||
{
|
|
||||||
BX_UNUSED(_width, _height);
|
|
||||||
BX_TRACE("GlContext::create");
|
|
||||||
|
|
||||||
g_internalData.context = &s_ppapi.m_context;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GlContext::destroy()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void GlContext::resize(uint32_t _width, uint32_t _height, uint32_t _flags)
|
|
||||||
{
|
|
||||||
s_ppapi.m_forceSwap = false;
|
|
||||||
s_ppapi.resize(_width, _height, _flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t GlContext::getCaps() const
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
SwapChainGL* GlContext::createSwapChain(void* /*_nwh*/)
|
|
||||||
{
|
|
||||||
BX_CHECK(false, "Shouldn't be called!");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GlContext::destroySwapChain(SwapChainGL* /*_swapChain*/)
|
|
||||||
{
|
|
||||||
BX_CHECK(false, "Shouldn't be called!");
|
|
||||||
}
|
|
||||||
|
|
||||||
void GlContext::swap(SwapChainGL* /*_swapChain*/)
|
|
||||||
{
|
|
||||||
s_ppapi.swap();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GlContext::makeCurrent(SwapChainGL* /*_swapChain*/)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void GlContext::import()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GlContext::isValid() const
|
|
||||||
{
|
|
||||||
return s_ppapi.isValid();
|
|
||||||
}
|
|
||||||
|
|
||||||
} /* namespace gl */ } // namespace bgfx
|
|
||||||
|
|
||||||
namespace bgfx
|
|
||||||
{
|
|
||||||
bool naclSetInterfaces(PP_Instance _instance, const PPB_Instance* _instInterface, const PPB_Graphics3D* _graphicsInterface, PostSwapBuffersFn _postSwapBuffers)
|
|
||||||
{
|
|
||||||
return gl::s_ppapi.setInterfaces( _instance, _instInterface, _graphicsInterface, _postSwapBuffers);
|
|
||||||
}
|
|
||||||
} // namespace bgfx
|
|
||||||
|
|
||||||
#endif // BX_PLATFORM_NACL && (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)
|
|
|
@ -1,43 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2011-2017 Branimir Karadzic. All rights reserved.
|
|
||||||
* License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef BGFX_GLCONTEXT_PPAPI_H_HEADER_GUARD
|
|
||||||
#define BGFX_GLCONTEXT_PPAPI_H_HEADER_GUARD
|
|
||||||
|
|
||||||
#if BX_PLATFORM_NACL
|
|
||||||
|
|
||||||
# include <ppapi/gles2/gl2ext_ppapi.h>
|
|
||||||
# include <ppapi/c/pp_completion_callback.h>
|
|
||||||
# include <ppapi/c/ppb_instance.h>
|
|
||||||
# include <ppapi/c/ppb_graphics_3d.h>
|
|
||||||
|
|
||||||
namespace bgfx { namespace gl
|
|
||||||
{
|
|
||||||
struct SwapChainGL;
|
|
||||||
|
|
||||||
struct GlContext
|
|
||||||
{
|
|
||||||
GlContext()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void create(uint32_t _width, uint32_t _height);
|
|
||||||
void destroy();
|
|
||||||
void resize(uint32_t _width, uint32_t _height, uint32_t _flags);
|
|
||||||
|
|
||||||
uint64_t getCaps() const;
|
|
||||||
SwapChainGL* createSwapChain(void* _nwh);
|
|
||||||
void destroySwapChain(SwapChainGL* _swapChain);
|
|
||||||
void swap(SwapChainGL* _swapChain = NULL);
|
|
||||||
void makeCurrent(SwapChainGL* _swapChain = NULL);
|
|
||||||
|
|
||||||
void import();
|
|
||||||
bool isValid() const;
|
|
||||||
};
|
|
||||||
} /* namespace gl */ } // namespace bgfx
|
|
||||||
|
|
||||||
#endif // BX_PLATFORM_NACL
|
|
||||||
|
|
||||||
#endif // BGFX_GLCONTEXT_PPAPI_H_HEADER_GUARD
|
|
|
@ -2037,15 +2037,6 @@ namespace bgfx { namespace gl
|
||||||
|| s_extension[Extension::OES_vertex_array_object].m_supported
|
|| s_extension[Extension::OES_vertex_array_object].m_supported
|
||||||
;
|
;
|
||||||
|
|
||||||
if (BX_ENABLED(BX_PLATFORM_NACL) )
|
|
||||||
{
|
|
||||||
m_vaoSupport &= true
|
|
||||||
&& NULL != glGenVertexArrays
|
|
||||||
&& NULL != glDeleteVertexArrays
|
|
||||||
&& NULL != glBindVertexArray
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_vaoSupport)
|
if (m_vaoSupport)
|
||||||
{
|
{
|
||||||
GL_CHECK(glGenVertexArrays(1, &m_vao) );
|
GL_CHECK(glGenVertexArrays(1, &m_vao) );
|
||||||
|
|
|
@ -935,9 +935,7 @@ typedef uint64_t GLuint64;
|
||||||
# define GL_LINE_SMOOTH 0x0B20
|
# define GL_LINE_SMOOTH 0x0B20
|
||||||
#endif // GL_LINE_SMOOTH
|
#endif // GL_LINE_SMOOTH
|
||||||
|
|
||||||
#if BX_PLATFORM_NACL
|
#if BX_PLATFORM_WINDOWS
|
||||||
# include "glcontext_ppapi.h"
|
|
||||||
#elif BX_PLATFORM_WINDOWS
|
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#elif BX_PLATFORM_LINUX || BX_PLATFORM_BSD
|
#elif BX_PLATFORM_LINUX || BX_PLATFORM_BSD
|
||||||
# include "glcontext_glx.h"
|
# include "glcontext_glx.h"
|
||||||
|
|
|
@ -952,7 +952,6 @@ namespace bgfx
|
||||||
preprocessor.setDefaultDefine("BX_PLATFORM_EMSCRIPTEN");
|
preprocessor.setDefaultDefine("BX_PLATFORM_EMSCRIPTEN");
|
||||||
preprocessor.setDefaultDefine("BX_PLATFORM_IOS");
|
preprocessor.setDefaultDefine("BX_PLATFORM_IOS");
|
||||||
preprocessor.setDefaultDefine("BX_PLATFORM_LINUX");
|
preprocessor.setDefaultDefine("BX_PLATFORM_LINUX");
|
||||||
preprocessor.setDefaultDefine("BX_PLATFORM_NACL");
|
|
||||||
preprocessor.setDefaultDefine("BX_PLATFORM_OSX");
|
preprocessor.setDefaultDefine("BX_PLATFORM_OSX");
|
||||||
preprocessor.setDefaultDefine("BX_PLATFORM_PS4");
|
preprocessor.setDefaultDefine("BX_PLATFORM_PS4");
|
||||||
preprocessor.setDefaultDefine("BX_PLATFORM_WINDOWS");
|
preprocessor.setDefaultDefine("BX_PLATFORM_WINDOWS");
|
||||||
|
@ -1003,11 +1002,6 @@ namespace bgfx
|
||||||
preprocessor.setDefine(glslDefine);
|
preprocessor.setDefine(glslDefine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (0 == bx::strCmpI(platform, "nacl") )
|
|
||||||
{
|
|
||||||
preprocessor.setDefine("BX_PLATFORM_NACL=1");
|
|
||||||
preprocessor.setDefine("BGFX_SHADER_LANGUAGE_GLSL=1");
|
|
||||||
}
|
|
||||||
else if (0 == bx::strCmpI(platform, "osx") )
|
else if (0 == bx::strCmpI(platform, "osx") )
|
||||||
{
|
{
|
||||||
preprocessor.setDefine("BX_PLATFORM_OSX=1");
|
preprocessor.setDefine("BX_PLATFORM_OSX=1");
|
||||||
|
|
Загрузка…
Ссылка в новой задаче