From 857a2b18f12eaedd559ec4cbbc08be4e476c685d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Tue, 23 Dec 2014 23:32:36 -0800 Subject: [PATCH] Android: Fixed GLES3+ build. --- examples/common/entry/entry_android.cpp | 10 ++++- src/glcontext_egl.cpp | 8 +++- src/glimports.h | 59 +++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 2 deletions(-) diff --git a/examples/common/entry/entry_android.cpp b/examples/common/entry/entry_android.cpp index 329b0a48..f899e3f9 100644 --- a/examples/common/entry/entry_android.cpp +++ b/examples/common/entry/entry_android.cpp @@ -91,7 +91,15 @@ namespace entry if (m_window == NULL) { m_window = m_app->window; - bgfx::androidSetWindow(m_app->window); + bgfx::androidSetWindow(m_window); + + int32_t width = ANativeWindow_getWidth(m_window); + int32_t height = ANativeWindow_getHeight(m_window); + + DBG("ANativeWindow width %d, height %d", width, height); + WindowHandle defaultWindow = { 0 }; + m_eventQueue.postSizeEvent(defaultWindow, width, height); + m_thread.init(MainThreadEntry::threadFunc, &m_mte); } break; diff --git a/src/glcontext_egl.cpp b/src/glcontext_egl.cpp index 979b165a..8a34b7c3 100644 --- a/src/glcontext_egl.cpp +++ b/src/glcontext_egl.cpp @@ -276,8 +276,14 @@ EGL_IMPORT # endif // BX_PLATFORM_RPI } - void GlContext::resize(uint32_t /*_width*/, uint32_t /*_height*/, bool _vsync) + void GlContext::resize(uint32_t _width, uint32_t _height, bool _vsync) { +# if BX_PLATFORM_ANDROID + EGLint format; + eglGetConfigAttrib(m_display, m_config, EGL_NATIVE_VISUAL_ID, &format); + ANativeWindow_setBuffersGeometry(g_bgfxAndroidWindow, _width, _height, format); +# endif // BX_PLATFORM_ANDROID + eglSwapInterval(m_display, _vsync ? 1 : 0); } diff --git a/src/glimports.h b/src/glimports.h index 2261ae0c..a3645abc 100644 --- a/src/glimports.h +++ b/src/glimports.h @@ -474,6 +474,65 @@ GL_IMPORT_NV___(true, PFNGLDELETEQUERIESPROC, glDeleteQueri GL_IMPORT_NV___(true, PFNGLBEGINQUERYPROC, glBeginQuery); GL_IMPORT_NV___(true, PFNGLENDQUERYPROC, glEndQuery); GL_IMPORT_NV___(true, PFNGLGETQUERYOBJECTUI64VPROC, glGetQueryObjectui64v); +#else +GL_IMPORT______(true, PFNGLTEXIMAGE3DPROC, glTexImage3D); +GL_IMPORT______(true, PFNGLTEXSUBIMAGE3DPROC, glTexSubImage3D); +GL_IMPORT______(true, PFNGLCOMPRESSEDTEXIMAGE3DPROC, glCompressedTexImage3D); +GL_IMPORT______(true, PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC, glCompressedTexSubImage3D); + +GL_IMPORT______(true, PFNGLTEXSTORAGE2DPROC, glTexStorage2D); +GL_IMPORT______(true, PFNGLTEXSTORAGE3DPROC, glTexStorage3D); + +GL_IMPORT______(true, PFNGLINSERTEVENTMARKEREXTPROC, glInsertEventMarker); +GL_IMPORT______(true, PFNGLPUSHGROUPMARKEREXTPROC, glPushGroupMarker); +GL_IMPORT______(true, PFNGLPOPGROUPMARKEREXTPROC, glPopGroupMarker); +GL_IMPORT______(true, PFNGLOBJECTLABELPROC, glObjectLabel); + +GL_IMPORT______(true, PFNGLGETPROGRAMBINARYPROC, glGetProgramBinary); +GL_IMPORT______(true, PFNGLPROGRAMBINARYPROC, glProgramBinary); + +GL_IMPORT______(true, PFNGLVERTEXATTRIBDIVISORPROC, glVertexAttribDivisor); +GL_IMPORT______(true, PFNGLDRAWARRAYSINSTANCEDPROC, glDrawArraysInstanced); +GL_IMPORT______(true, PFNGLDRAWELEMENTSINSTANCEDPROC, glDrawElementsInstanced); + +GL_IMPORT______(true, PFNGLBINDVERTEXARRAYPROC, glBindVertexArray); +GL_IMPORT______(true, PFNGLDELETEVERTEXARRAYSPROC, glDeleteVertexArrays); +GL_IMPORT______(true, PFNGLGENVERTEXARRAYSPROC, glGenVertexArrays); + +GL_IMPORT______(true, PFNGLENABLEIPROC, glEnablei); +GL_IMPORT______(true, PFNGLDISABLEIPROC, glDisablei); +GL_IMPORT______(true, PFNGLBLENDEQUATIONIPROC, glBlendEquationi); +GL_IMPORT______(true, PFNGLBLENDEQUATIONSEPARATEIPROC, glBlendEquationSeparatei); +GL_IMPORT______(true, PFNGLBLENDFUNCIPROC, glBlendFunci); +GL_IMPORT______(true, PFNGLBLENDFUNCSEPARATEIPROC, glBlendFuncSeparatei); + +GL_IMPORT______(true, PFNGLDRAWBUFFERPROC, glDrawBuffer); +GL_IMPORT______(true, PFNGLREADBUFFERPROC, glReadBuffer); +GL_IMPORT______(true, PFNGLGENSAMPLERSPROC, glGenSamplers); +GL_IMPORT______(true, PFNGLDELETESAMPLERSPROC, glDeleteSamplers); +GL_IMPORT______(true, PFNGLBINDSAMPLERPROC, glBindSampler); +GL_IMPORT______(true, PFNGLSAMPLERPARAMETERFPROC, glSamplerParameterf); +GL_IMPORT______(true, PFNGLSAMPLERPARAMETERIPROC, glSamplerParameteri); + +GL_IMPORT______(true, PFNGLBINDBUFFERBASEPROC, glBindBufferBase); +GL_IMPORT______(true, PFNGLBINDBUFFERRANGEPROC, glBindBufferRange); +GL_IMPORT______(true, PFNGLBINDIMAGETEXTUREPROC, glBindImageTexture); +GL_IMPORT______(true, PFNGLGETPROGRAMINTERFACEIVPROC, glGetProgramInterfaceiv); +GL_IMPORT______(true, PFNGLGETPROGRAMRESOURCEINDEXPROC, glGetProgramResourceIndex); +GL_IMPORT______(true, PFNGLGETPROGRAMRESOURCEIVPROC, glGetProgramResourceiv); +GL_IMPORT______(true, PFNGLGETPROGRAMRESOURCENAMEPROC, glGetProgramResourceName); +GL_IMPORT______(true, PFNGLGETPROGRAMRESOURCELOCATIONPROC, glGetProgramResourceLocation); +GL_IMPORT______(true, PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC, glGetProgramResourceLocationIndex); +GL_IMPORT______(true, PFNGLMEMORYBARRIERPROC, glMemoryBarrier); +GL_IMPORT______(true, PFNGLDISPATCHCOMPUTEPROC, glDispatchCompute); +GL_IMPORT______(true, PFNGLDISPATCHCOMPUTEINDIRECTPROC, glDispatchComputeIndirect); + +GL_IMPORT______(true, PFNGLDRAWBUFFERSPROC, glDrawBuffers); +GL_IMPORT______(true, PFNGLGENQUERIESPROC, glGenQueries); +GL_IMPORT______(true, PFNGLDELETEQUERIESPROC, glDeleteQueries); +GL_IMPORT______(true, PFNGLBEGINQUERYPROC, glBeginQuery); +GL_IMPORT______(true, PFNGLENDQUERYPROC, glEndQuery); +GL_IMPORT______(true, PFNGLGETQUERYOBJECTUI64VPROC, glGetQueryObjectui64v); # endif // BGFX_CONFIG_RENDERER_OPENGLES < 30 #endif // !BGFX_CONFIG_RENDERER_OPENGL