diff --git a/android/jni/Android.mk b/android/jni/Android.mk index ec59afab3..6bcb93dc1 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -195,7 +195,7 @@ LOCAL_SRC_FILES := $(wildcard jni/src/*.cpp) $(wildcard jni/src/*/*.cpp) $(wildc LOCAL_PATH:=. LOCAL_MODULE := stk LOCAL_LDLIBS := -llog -landroid -lEGL -lGLESv1_CM -lGLESv2 -lGLESv3 -LOCAL_CFLAGS := -Ijni/irrlicht/source/Irrlicht/ -Ijni/irrlicht/include/ -Ijni/jpeglib/ -Ijni/libpng/ -Ijni/ -Iinclude/ -I$(call my-dir)/../../sources/android/native_app_glue/ -DBUILD_OGLES2 -DNO_IRR_COMPILE_WITH_SOFTWARE_ -DNO_IRR_COMPILE_WITH_BURNINGSVIDEO_ -DSUPERTUXKART_DATADIR=\"/sdcard/stk/\" -DANDROID_DEVICE -DANDROID -Ijni/src/ -Ijni/bullet/src -DNO_CURL -std=c++11 -Iobj/freetype/freetype/include/freetype2/ -Ijni/enet/include/ -Ijni/angelscript/include/ -DDEBUG -DNO_SOUND -DGLEW_NO_GLU -Ijni/ifaddrs +LOCAL_CFLAGS := -Ijni/irrlicht/source/Irrlicht/ -Ijni/irrlicht/include/ -Ijni/jpeglib/ -Ijni/libpng/ -Ijni/ -Iinclude/ -I$(call my-dir)/../../sources/android/native_app_glue/ -DBUILD_OGLES2 -DNO_IRR_COMPILE_WITH_SOFTWARE_ -DNO_IRR_COMPILE_WITH_BURNINGSVIDEO_ -DSUPERTUXKART_DATADIR=\"/sdcard/stk/\" -DUSE_GLES2 -DANDROID -Ijni/src/ -Ijni/bullet/src -DNO_CURL -std=c++11 -Iobj/freetype/freetype/include/freetype2/ -Ijni/enet/include/ -Ijni/angelscript/include/ -DDEBUG -DNO_SOUND -DGLEW_NO_GLU -Ijni/ifaddrs LOCAL_SHARED_LIBRARIES := irrlicht LOCAL_STATIC_LIBRARIES := bullet enet freetype ifaddrs angelscript diff --git a/src/config/user_config.hpp b/src/config/user_config.hpp index 97c67e306..d4d859992 100644 --- a/src/config/user_config.hpp +++ b/src/config/user_config.hpp @@ -447,11 +447,7 @@ namespace UserConfigParams PARAM_DEFAULT( IntUserConfigParam(120, "max_fps", &m_video_group, "Maximum fps, should be at least 60") ); PARAM_PREFIX BoolUserConfigParam m_force_legacy_device -#ifndef ANDROID PARAM_DEFAULT(BoolUserConfigParam(false, "force_legacy_device", -#else - PARAM_DEFAULT(BoolUserConfigParam(true, "force_legacy_device", -#endif &m_video_group, "Force OpenGL 2 context, even if OpenGL 3 is available.")); PARAM_PREFIX BoolUserConfigParam m_texture_compression diff --git a/src/graphics/2dutils.cpp b/src/graphics/2dutils.cpp index b90ed1ad7..8e6ad148e 100644 --- a/src/graphics/2dutils.cpp +++ b/src/graphics/2dutils.cpp @@ -25,7 +25,7 @@ #include "glwrap.hpp" #include "utils/cpp2011.hpp" -#if defined(ANDROID) || defined(USE_GLES2) +#if defined(USE_GLES2) # define _IRR_COMPILE_WITH_OGLES2_ # include "../../lib/irrlicht/source/Irrlicht/COGLES2Texture.h" #else @@ -184,7 +184,7 @@ static void drawTexColoredQuad(const video::ITexture *texture, ColoredTextureRectShader::getInstance()->use(); glBindVertexArray(ColoredTextureRectShader::getInstance()->m_vao); -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) const irr::video::COpenGLTexture *t = static_cast(texture); #else @@ -322,7 +322,7 @@ void draw2DImage(const video::ITexture* texture, UniformColoredTextureRectShader::getInstance()->use(); glBindVertexArray(SharedGPUObjects::getUI_VAO()); -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) const video::COpenGLTexture *c_texture = static_cast(texture); #else @@ -439,7 +439,7 @@ void draw2DImage(const video::ITexture* texture, } else { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) const video::COpenGLTexture *c_texture = static_cast(texture); #else diff --git a/src/graphics/central_settings.cpp b/src/graphics/central_settings.cpp index e0bc26cf3..10e3eddf5 100644 --- a/src/graphics/central_settings.cpp +++ b/src/graphics/central_settings.cpp @@ -68,10 +68,10 @@ void CentralVideoSettings::init() Log::info("IrrDriver", "OpenGL renderer: %s", glGetString(GL_RENDERER)); Log::info("IrrDriver", "OpenGL version string: %s", glGetString(GL_VERSION)); } -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) m_glsl = (m_gl_major_version > 3 || (m_gl_major_version == 3 && m_gl_minor_version >= 1)) && !UserConfigParams::m_force_legacy_device; -#elif !defined(ANDROID) +#else m_glsl = m_gl_major_version >= 3 && !UserConfigParams::m_force_legacy_device; #endif if (!ProfileWorld::isNoGraphics()) @@ -83,7 +83,7 @@ void CentralVideoSettings::init() std::string card((char*)(glGetString(GL_RENDERER))); GraphicsRestrictions::init(driver, card); -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (hasGLExtension("GL_AMD_vertex_shader_layer")) { hasVSLayer = true; Log::info("GLDriver", "AMD Vertex Shader Layer Present"); diff --git a/src/graphics/gl_headers.hpp b/src/graphics/gl_headers.hpp index c291c9dfa..183aebbcd 100644 --- a/src/graphics/gl_headers.hpp +++ b/src/graphics/gl_headers.hpp @@ -21,7 +21,7 @@ #define GLEW_STATIC extern "C" { -#if !defined(ANDROID_DEVICE) && !defined(USE_GLES2) +#if !defined(USE_GLES2) # include #endif } @@ -40,7 +40,7 @@ extern "C" { # ifndef GL_TEXTURE_SWIZZLE_RGBA # define GL_TEXTURE_SWIZZLE_RGBA 0x8E46 # endif -#elif defined(ANDROID_DEVICE) || defined(USE_GLES2) +#elif defined(USE_GLES2) # include # include # include @@ -55,12 +55,10 @@ extern "C" { # include #endif -#if defined(ANDROID) || defined(USE_GLES2) +#if defined(USE_GLES2) #define GL_BGRA 0x80E1 #define GL_BGR 0x80E0 -#endif -#if defined(USE_GLES2) #define GL_FRAMEBUFFER_COMPLETE_EXT GL_FRAMEBUFFER_COMPLETE #define GL_TEXTURE_BUFFER GL_TEXTURE_BUFFER_EXT #define GL_FRAMEBUFFER_SRGB GL_FRAMEBUFFER_SRGB_EXT diff --git a/src/graphics/glwrap.cpp b/src/graphics/glwrap.cpp index ca165fb01..6324a1f55 100644 --- a/src/graphics/glwrap.cpp +++ b/src/graphics/glwrap.cpp @@ -94,7 +94,7 @@ bool GLContextDebugBit = false; #ifdef DEBUG -#if !defined(__APPLE__) && !defined(ANDROID) +#if !defined(__APPLE__) #define ARB_DEBUG_OUTPUT #endif #endif @@ -188,7 +188,7 @@ void initGL() return; is_gl_init = true; // For Mesa extension reporting -#if !defined(ANDROID_DEVICE) && !defined(USE_GLES2) +#if !defined(USE_GLES2) #ifndef WIN32 glewExperimental = GL_TRUE; #endif @@ -267,7 +267,7 @@ FrameBuffer::FrameBuffer(const std::vector &RTTs, size_t w, size_t h, { glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo); -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (layered) { for (unsigned i = 0; i < RTTs.size(); i++) @@ -279,10 +279,8 @@ FrameBuffer::FrameBuffer(const std::vector &RTTs, size_t w, size_t h, for (unsigned i = 0; i < RTTs.size(); i++) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, RTTs[i], 0); } -#ifndef ANDROID //~ GLenum result = glCheckFramebufferStatus(GL_FRAMEBUFFER); //~ assert(result == GL_FRAMEBUFFER_COMPLETE_EXT); -#endif } FrameBuffer::FrameBuffer(const std::vector &RTTs, GLuint DS, size_t w, @@ -292,7 +290,7 @@ FrameBuffer::FrameBuffer(const std::vector &RTTs, GLuint DS, size_t w, { glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo); -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (layered) { for (unsigned i = 0; i < RTTs.size(); i++) @@ -306,12 +304,10 @@ FrameBuffer::FrameBuffer(const std::vector &RTTs, GLuint DS, size_t w, glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, RTTs[i], 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, DS, 0); } -#ifndef ANDROID //~ GLenum result = glCheckFramebufferStatus(GL_FRAMEBUFFER); //~ assert(result == GL_FRAMEBUFFER_COMPLETE_EXT); if (layered) glGenFramebuffers(1, &fbolayer); -#endif } FrameBuffer::~FrameBuffer() diff --git a/src/graphics/gpu_particles.cpp b/src/graphics/gpu_particles.cpp index 9340f288b..bdaba97ae 100644 --- a/src/graphics/gpu_particles.cpp +++ b/src/graphics/gpu_particles.cpp @@ -182,7 +182,6 @@ void ParticleSystemProxy::setFlip() void ParticleSystemProxy::setHeightmap(const std::vector > &hm, float f1, float f2, float f3, float f4) { -#ifndef ANDROID track_x = f1, track_z = f2, track_x_len = f3, track_z_len = f4; unsigned width = (unsigned)hm.size(); @@ -205,7 +204,6 @@ void ParticleSystemProxy::setHeightmap(const std::vector > &h glBindBuffer(GL_TEXTURE_BUFFER, 0); delete[] hm_array; -#endif } static @@ -412,7 +410,6 @@ void ParticleSystemProxy::cleanGL() void ParticleSystemProxy::CommonRenderingVAO(GLuint PositionBuffer) { -#ifndef ANDROID glBindBuffer(GL_ARRAY_BUFFER, SharedGPUObjects::getParticleQuadVBO()); glEnableVertexAttribArray(4); glVertexAttribPointer(4, 4, GL_FLOAT, GL_FALSE, 4 * sizeof(float), 0); @@ -429,12 +426,10 @@ void ParticleSystemProxy::CommonRenderingVAO(GLuint PositionBuffer) glEnableVertexAttribArray(2); glVertexAttribPointer(2, 1, GL_FLOAT, GL_FALSE, sizeof(ParticleData), (GLvoid *)(7 * sizeof(float))); glVertexAttribDivisorARB(2, 1); -#endif } void ParticleSystemProxy::AppendQuaternionRenderingVAO(GLuint QuaternionBuffer) { -#ifndef ANDROID glBindBuffer(GL_ARRAY_BUFFER, QuaternionBuffer); glEnableVertexAttribArray(5); @@ -444,12 +439,10 @@ void ParticleSystemProxy::AppendQuaternionRenderingVAO(GLuint QuaternionBuffer) glEnableVertexAttribArray(6); glVertexAttribPointer(6, 1, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (GLvoid *)(3 * sizeof(float))); glVertexAttribDivisorARB(6, 1); -#endif } void ParticleSystemProxy::CommonSimulationVAO(GLuint position_vbo, GLuint initialValues_vbo) { -#ifndef ANDROID glBindBuffer(GL_ARRAY_BUFFER, position_vbo); glEnableVertexAttribArray(0); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(ParticleSystemProxy::ParticleData), (GLvoid*)0); @@ -469,12 +462,10 @@ void ParticleSystemProxy::CommonSimulationVAO(GLuint position_vbo, GLuint initia glVertexAttribPointer(6, 3, GL_FLOAT, GL_FALSE, sizeof(ParticleSystemProxy::ParticleData), (GLvoid*)(4 * sizeof(float))); glEnableVertexAttribArray(7); glVertexAttribPointer(7, 1, GL_FLOAT, GL_FALSE, sizeof(ParticleSystemProxy::ParticleData), (GLvoid*)(7 * sizeof(float))); -#endif } void ParticleSystemProxy::simulate() { -#ifndef ANDROID int timediff = int(GUIEngine::getLatestDt() * 1000.f); int active_count = getEmitter()->getMaxLifeTime() * getEmitter()->getMaxParticlesPerSecond() / 1000; core::matrix4 matrix = getAbsoluteTransformation(); @@ -524,7 +515,6 @@ void ParticleSystemProxy::simulate() std::swap(tfb_buffers[0], tfb_buffers[1]); std::swap(current_rendering_vao, non_current_rendering_vao); std::swap(current_simulation_vao, non_current_simulation_vao); -#endif } void ParticleSystemProxy::drawFlip() diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp index 41b51fbf8..eb4915b8c 100644 --- a/src/graphics/irr_driver.cpp +++ b/src/graphics/irr_driver.cpp @@ -75,7 +75,7 @@ #if (IRRLICHT_VERSION_MAJOR < 1 || IRRLICHT_VERSION_MINOR < 7 || \ _IRR_MATERIAL_MAX_TEXTURES_ < 8 || !defined(_IRR_COMPILE_WITH_OPENGL_) || \ - !defined(_IRR_COMPILE_WITH_B3D_LOADER_)) && !defined(ANDROID) && !defined(USE_GLES2) + !defined(_IRR_COMPILE_WITH_B3D_LOADER_)) #error "Building against an incompatible Irrlicht. Distros, \ please use the included version." #endif @@ -456,12 +456,12 @@ void IrrDriver::initDevice() if(m_device) break; -#if !defined(ANDROID_DEVICE) && !defined(USE_GLES2) +#if !defined(USE_GLES2) params.DriverType = video::EDT_OPENGL; #else params.DriverType = video::EDT_OGLES2; #endif -#if defined(ANDROID_DEVICE) +#if defined(ANDROID) params.PrivateData = global_android_app; #endif params.Stencilbuffer = false; @@ -509,7 +509,6 @@ void IrrDriver::initDevice() { UserConfigParams::m_width = MIN_SUPPORTED_WIDTH; UserConfigParams::m_height = MIN_SUPPORTED_HEIGHT; -#if !defined(ANDROID_DEVICE) #if defined(USE_GLES2) m_device = createDevice(video::EDT_OGLES2, #else @@ -524,15 +523,6 @@ void IrrDriver::initDevice() this, // event receiver file_manager->getFileSystem() ); -#else - struct irr::SIrrlichtCreationParameters p; - p.DriverType = video::EDT_OGLES2; - // The android app object is needed by the irrlicht device. - p.PrivateData = global_android_app; - p.WindowSize = core::dimension2d(1280,800); - - m_device = createDeviceEx(p); -#endif if (m_device) { Log::verbose("irr_driver", "An invalid resolution was set in " diff --git a/src/graphics/post_processing.cpp b/src/graphics/post_processing.cpp index 149a69da1..385505407 100644 --- a/src/graphics/post_processing.cpp +++ b/src/graphics/post_processing.cpp @@ -76,7 +76,7 @@ public: GLuint m_dest_tu; ComputeShadowBlurVShader() { -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) loadProgram(OBJECT, GL_COMPUTE_SHADER, "blurshadowV.comp"); m_dest_tu = 1; assignUniforms("pixel", "weights"); @@ -139,7 +139,7 @@ public: GLuint m_dest_tu; ComputeGaussian6VBlurShader() { -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) loadProgram(OBJECT, GL_COMPUTE_SHADER, "gaussian6v.comp"); m_dest_tu = 1; assignUniforms("pixel", "weights"); @@ -158,7 +158,7 @@ public: GLuint m_dest_tu; ComputeGaussian6HBlurShader() { -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) loadProgram(OBJECT, GL_COMPUTE_SHADER, "gaussian6h.comp"); m_dest_tu = 1; assignUniforms("pixel", "weights"); @@ -177,7 +177,7 @@ public: GLuint m_dest_tu; ComputeShadowBlurHShader() { -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) loadProgram(OBJECT, GL_COMPUTE_SHADER, "blurshadowH.comp"); m_dest_tu = 1; assignUniforms("pixel", "weights"); @@ -242,7 +242,7 @@ public: GLuint m_dest_tu; ComputeGaussian17TapHShader() { -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) loadProgram(OBJECT, GL_COMPUTE_SHADER, "bilateralH.comp"); m_dest_tu = 2; assignUniforms("pixel"); @@ -255,7 +255,7 @@ public: void render(const FrameBuffer &fb, const FrameBuffer &auxiliary, int width, int height) { -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) use(); glBindSampler(m_dest_tu, 0); setTextureUnits(fb.getRTT()[0], @@ -302,7 +302,7 @@ public: ComputeGaussian17TapVShader() { -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) loadProgram(OBJECT, GL_COMPUTE_SHADER, "bilateralV.comp"); m_dest_tu = 2; assignUniforms("pixel"); @@ -315,7 +315,7 @@ public: void render(const FrameBuffer &auxiliary, const FrameBuffer &fb, int width, int height) { -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) use(); glBindSampler(m_dest_tu, 0); setTextureUnits(auxiliary.getRTT()[0], @@ -1049,7 +1049,7 @@ void PostProcessing::renderRHDebug(unsigned SHR, unsigned SHG, unsigned SHB, const core::matrix4 &rh_matrix, const core::vector3df &rh_extend) { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) glEnable(GL_PROGRAM_POINT_SIZE); RHDebug::getInstance()->use(); glActiveTexture(GL_TEXTURE0 + RHDebug::getInstance()->m_tu_shr); @@ -1146,7 +1146,7 @@ void PostProcessing::renderGaussian6BlurLayer(FrameBuffer &in_fbo, UserConfigParams::m_shadows_resolution, UserConfigParams::m_shadows_resolution, sigma_h); } -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) else { const std::vector &weightsV = getGaussianWeight(sigma_v, 7); @@ -1207,7 +1207,7 @@ void PostProcessing::renderGaussian6Blur(const FrameBuffer &in_fbo, Gaussian6HBlurShader::getInstance()->render(auxiliary, in_fbo.getWidth(), in_fbo.getHeight(), sigma_h); } -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) else { const std::vector &weightsV = getGaussianWeight(sigma_v, 7); @@ -1267,7 +1267,7 @@ void PostProcessing::renderGaussian17TapBlur(const FrameBuffer &in_fbo, assert(in_fbo.getWidth() == auxiliary.getWidth() && in_fbo.getHeight() == auxiliary.getHeight()); -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) if (CVS->supportsComputeShadersFiltering()) glMemoryBarrier(GL_FRAMEBUFFER_BARRIER_BIT); #endif @@ -1289,7 +1289,7 @@ void PostProcessing::renderGaussian17TapBlur(const FrameBuffer &in_fbo, } } -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) if (CVS->supportsComputeShadersFiltering()) glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT); #endif @@ -1311,7 +1311,7 @@ void PostProcessing::renderGaussian17TapBlur(const FrameBuffer &in_fbo, } } -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) if (CVS->supportsComputeShadersFiltering()) glMemoryBarrier(GL_TEXTURE_FETCH_BARRIER_BIT); #endif @@ -1668,9 +1668,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode, if (!CVS->isARBUniformBufferObjectUsable()) return in_fbo; -#if !defined(ANDROID) glEnable(GL_FRAMEBUFFER_SRGB); -#endif irr_driver->getFBO(FBO_MLAA_COLORS).bind(); renderPassThrough(in_fbo->getRTT()[0], irr_driver->getFBO(FBO_MLAA_COLORS).getWidth(), @@ -1684,9 +1682,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode, applyMLAA(); PROFILER_POP_CPU_MARKER(); } -#if !defined(ANDROID) glDisable(GL_FRAMEBUFFER_SRGB); -#endif return out_fbo; } // render diff --git a/src/graphics/render.cpp b/src/graphics/render.cpp index a972429b5..7e1e927ac 100644 --- a/src/graphics/render.cpp +++ b/src/graphics/render.cpp @@ -188,10 +188,8 @@ void IrrDriver::renderGLSL(float dt) if (World::getWorld() && World::getWorld()->getTrack()->hasShadows() && m_spherical_harmonics->has6Textures()) irr_driver->getSceneManager()->setAmbientLight(SColor(0, 0, 0, 0)); -#if !defined(ANDROID) if (!CVS->isDefferedEnabled()) glEnable(GL_FRAMEBUFFER_SRGB); -#endif PROFILER_PUSH_CPU_MARKER("Update Light Info", 0xFF, 0x0, 0x0); unsigned plc = updateLightsInfo(camnode, dt); @@ -283,16 +281,12 @@ void IrrDriver::renderGLSL(float dt) } else { -#if !defined(ANDROID) glEnable(GL_FRAMEBUFFER_SRGB); -#endif glBindFramebuffer(GL_FRAMEBUFFER, 0); if (CVS->isDefferedEnabled()) camera->activate(); m_post_processing->renderPassThrough(fbo->getRTT()[0], viewport.LowerRightCorner.X - viewport.UpperLeftCorner.X, viewport.LowerRightCorner.Y - viewport.UpperLeftCorner.Y); -#if !defined(ANDROID) glDisable(GL_FRAMEBUFFER_SRGB); -#endif } } // Save projection-view matrix for the next frame @@ -405,10 +399,8 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po else { // We need a cleared depth buffer for some effect (eg particles depth blending) -#if !defined(ANDROID) if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_WORKING)) glDisable(GL_FRAMEBUFFER_SRGB); -#endif m_rtts->getFBO(FBO_NORMAL_AND_DEPTHS).bind(); // Bind() modifies the viewport. In order not to affect anything else, // the viewport is just reset here and not removed in Bind(). @@ -418,10 +410,8 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po vp.LowerRightCorner.X - vp.UpperLeftCorner.X, vp.LowerRightCorner.Y - vp.UpperLeftCorner.Y); glClear(GL_DEPTH_BUFFER_BIT); -#if !defined(ANDROID) if (GraphicsRestrictions::isDisabled(GraphicsRestrictions::GR_FRAMEBUFFER_SRGB_WORKING)) glEnable(GL_FRAMEBUFFER_SRGB); -#endif glBindFramebuffer(GL_FRAMEBUFFER, 0); } PROFILER_POP_CPU_MARKER(); @@ -544,9 +534,7 @@ void IrrDriver::renderScene(scene::ICameraSceneNode * const camnode, unsigned po } if (!CVS->isDefferedEnabled() && !forceRTT) { -#if !defined(ANDROID) glDisable(GL_FRAMEBUFFER_SRGB); -#endif glDisable(GL_DEPTH_TEST); glDepthMask(GL_FALSE); return; @@ -687,7 +675,7 @@ void IrrDriver::renderGlow(std::vector& glows) if (CVS->supportsIndirectInstancingRendering()) { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) glBindBuffer(GL_DRAW_INDIRECT_BUFFER, GlowPassCmd::getInstance()->drawindirectcmd); InstancedColorizeShader::getInstance()->use(); diff --git a/src/graphics/render_geometry.cpp b/src/graphics/render_geometry.cpp index 3235da4a1..5a01c0760 100644 --- a/src/graphics/render_geometry.cpp +++ b/src/graphics/render_geometry.cpp @@ -165,7 +165,7 @@ class ShadowShader : public TextureShader public: ShadowShader() { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) // Geometry shader needed if (CVS->getGLSLVersion() < 150) return; @@ -191,7 +191,7 @@ class InstancedShadowShader : public TextureShadergetGLSLVersion() < 150) @@ -404,7 +404,7 @@ class RefShadowShader : public TextureShadergetGLSLVersion() < 150) return; @@ -432,7 +432,7 @@ class InstancedRefShadowShader : public TextureShadergetGLSLVersion() < 150) return; @@ -489,7 +489,7 @@ class NormalVisualizer : public Shader public: NormalVisualizer() { -#if !defined(ANDROID) && !defined(USE_GLES2) //????? +#if !defined(USE_GLES2) loadProgram(OBJECT, GL_VERTEX_SHADER, "instanced_object_pass.vert", GL_GEOMETRY_SHADER, "normal_visualizer.geom", GL_FRAGMENT_SHADER, "coloredquad.frag"); @@ -655,7 +655,7 @@ class GrassShadowShader : public TextureShadergetGLSLVersion() < 150) return; @@ -683,7 +683,7 @@ class InstancedGrassShadowShader : public TextureShadergetGLSLVersion() < 150) return; @@ -1111,7 +1111,7 @@ void renderMeshes1stPass() template void renderInstancedMeshes1stPass(Args...args) { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) std::vector &meshes = T::InstancedList::getInstance()->SolidPass; T::InstancedFirstPassShader::getInstance()->use(); glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType, T::Instance)); @@ -1139,7 +1139,7 @@ void renderInstancedMeshes1stPass(Args...args) template void multidraw1stPass(Args...args) { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) T::InstancedFirstPassShader::getInstance()->use(); glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType, T::Instance)); if (SolidPassCmd::getInstance()->Size[T::MaterialType]) @@ -1160,7 +1160,7 @@ void IrrDriver::renderSolidFirstPass() { windDir = getWindDir(); -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (CVS->supportsIndirectInstancingRendering()) glBindBuffer(GL_DRAW_INDIRECT_BUFFER, SolidPassCmd::getInstance()->drawindirectcmd); #endif @@ -1181,7 +1181,7 @@ void IrrDriver::renderSolidFirstPass() renderMeshes1stPass(); renderMeshes1stPass(); -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (CVS->isAZDOEnabled()) { multidraw1stPass(); @@ -1250,7 +1250,7 @@ void renderMeshes2ndPass( const std::vector &Prefilled_Handle, template void renderInstancedMeshes2ndPass(const std::vector &Prefilled_tex, Args...args) { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) std::vector &meshes = T::InstancedList::getInstance()->SolidPass; T::InstancedSecondPassShader::getInstance()->use(); glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType, @@ -1273,7 +1273,7 @@ void renderInstancedMeshes2ndPass(const std::vector &Prefilled_tex, Args template void multidraw2ndPass(const std::vector &Handles, Args... args) { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) T::InstancedSecondPassShader::getInstance()->use(); glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType, T::Instance)); @@ -1302,7 +1302,7 @@ void IrrDriver::renderSolidSecondPass() uint64_t DiffuseHandle = 0, SpecularHandle = 0, SSAOHandle = 0, DepthHandle = 0; -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (CVS->isAZDOEnabled()) { DiffuseHandle = glGetTextureSamplerHandleARB(m_rtts->getRenderTarget(RTT_DIFFUSE), @@ -1327,7 +1327,7 @@ void IrrDriver::renderSolidSecondPass() } #endif -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (CVS->supportsIndirectInstancingRendering()) glBindBuffer(GL_DRAW_INDIRECT_BUFFER, SolidPassCmd::getInstance()->drawindirectcmd); @@ -1355,7 +1355,7 @@ void IrrDriver::renderSolidSecondPass() renderMeshes2ndPass(createVector(DiffuseHandle, SpecularHandle, SSAOHandle), DiffSpecSSAOTex); renderMeshes2ndPass(createVector(DiffuseHandle, SpecularHandle, SSAOHandle), DiffSpecSSAOTex); -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (CVS->isAZDOEnabled()) { multidraw2ndPass(createVector(DiffuseHandle, SpecularHandle, SSAOHandle, 0, 0)); @@ -1424,7 +1424,7 @@ void IrrDriver::renderSolidSecondPass() template static void renderInstancedMeshNormals() { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) std::vector &meshes = T::InstancedList::getInstance()->SolidPass; NormalVisualizer::getInstance()->use(); glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType, T::Instance)); @@ -1442,7 +1442,7 @@ static void renderInstancedMeshNormals() template static void renderMultiMeshNormals() { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) NormalVisualizer::getInstance()->use(); glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType, T::Instance)); if (SolidPassCmd::getInstance()->Size[T::MaterialType]) @@ -1459,7 +1459,7 @@ static void renderMultiMeshNormals() // ---------------------------------------------------------------------------- void IrrDriver::renderNormalsVisualisation() { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (CVS->isAZDOEnabled()) { renderMultiMeshNormals(); renderMultiMeshNormals(); @@ -1716,7 +1716,7 @@ void renderShadow(unsigned cascade) template void renderInstancedShadow(unsigned cascade, Args ...args) { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) T::InstancedShadowPassShader::getInstance()->use(); glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType, InstanceTypeShadow)); @@ -1740,7 +1740,7 @@ void renderInstancedShadow(unsigned cascade, Args ...args) template static void multidrawShadow(unsigned i, Args ...args) { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) T::InstancedShadowPassShader::getInstance()->use(); glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType, InstanceTypeShadow)); @@ -1759,7 +1759,7 @@ static void multidrawShadow(unsigned i, Args ...args) // ---------------------------------------------------------------------------- void IrrDriver::renderShadows() { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) glDepthFunc(GL_LEQUAL); glDepthMask(GL_TRUE); glEnable(GL_DEPTH_TEST); @@ -1894,7 +1894,7 @@ void drawRSM(const core::matrix4 & rsm_matrix) template void renderRSMShadow(Args ...args) { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) T::InstancedRSMShader::getInstance()->use(); glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType, InstanceTypeRSM)); auto t = T::InstancedList::getInstance()->RSM; @@ -1916,7 +1916,7 @@ void renderRSMShadow(Args ...args) template void multidrawRSM(Args...args) { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) T::InstancedRSMShader::getInstance()->use(); glBindVertexArray(VAOManager::getInstance()->getInstanceVAO(T::VertexType, InstanceTypeRSM)); @@ -1949,7 +1949,7 @@ void IrrDriver::renderRSM() drawRSM(rsm_matrix); drawRSM(rsm_matrix); -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (CVS->supportsIndirectInstancingRendering()) glBindBuffer(GL_DRAW_INDIRECT_BUFFER, RSMPassCmd::getInstance()->drawindirectcmd); diff --git a/src/graphics/render_lighting.cpp b/src/graphics/render_lighting.cpp index f3cf5a980..180ee78f1 100644 --- a/src/graphics/render_lighting.cpp +++ b/src/graphics/render_lighting.cpp @@ -101,12 +101,10 @@ public: sizeof(LightBaseClass::PointLightInfo), (GLvoid*)(7 * sizeof(float))); -#ifndef ANDROID glVertexAttribDivisorARB(attrib_Position, 1); glVertexAttribDivisorARB(attrib_Energy, 1); glVertexAttribDivisorARB(attrib_Color, 1); glVertexAttribDivisorARB(attrib_Radius, 1); -#endif } // PointLightShader }; // PointLightShader @@ -152,12 +150,10 @@ public: sizeof(LightBaseClass::PointLightInfo), (GLvoid*)(7 * sizeof(float))); -#ifndef ANDROID glVertexAttribDivisorARB(attrib_Position, 1); glVertexAttribDivisorARB(attrib_Energy, 1); glVertexAttribDivisorARB(attrib_Color, 1); glVertexAttribDivisorARB(attrib_Radius, 1); -#endif } // PointLightScatterShader }; @@ -232,7 +228,7 @@ class RadianceHintsConstructionShader public: RadianceHintsConstructionShader() { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (CVS->isAMDVertexShaderLayerUsable()) { loadProgram(OBJECT, GL_VERTEX_SHADER, "slicedscreenquad.vert", @@ -263,7 +259,7 @@ class NVWorkaroundRadianceHintsConstructionShader public: NVWorkaroundRadianceHintsConstructionShader() { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) loadProgram(OBJECT,GL_VERTEX_SHADER,"slicedscreenquad_nvworkaround.vert", GL_GEOMETRY_SHADER, "rhpassthrough.geom", GL_FRAGMENT_SHADER, "rh.frag"); diff --git a/src/graphics/shader.cpp b/src/graphics/shader.cpp index 75b0cf049..7cfcd079c 100644 --- a/src/graphics/shader.cpp +++ b/src/graphics/shader.cpp @@ -64,15 +64,14 @@ GLuint ShaderBase::loadShader(const std::string &file, unsigned type) GLuint id = glCreateShader(type); std::ostringstream code; -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) code << "#version " << CVS->getGLSLVersion()<<"\n"; -#endif -#if defined(USE_GLES2) +#else if (CVS->isGLSL()) code << "#version 300 es\n"; #endif -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) // Some drivers report that the compute shaders extension is available, // but they report only OpenGL 3.x version, and thus these extensions // must be enabled manually. Otherwise the shaders compilation will fail diff --git a/src/graphics/shaders.cpp b/src/graphics/shaders.cpp index 87a0a094d..b2cfaa9a6 100644 --- a/src/graphics/shaders.cpp +++ b/src/graphics/shaders.cpp @@ -178,10 +178,9 @@ GLuint loadShader(const char * file, unsigned type) { GLuint Id = glCreateShader(type); char versionString[20]; -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) sprintf(versionString, "#version %d\n", CVS->getGLSLVersion()); -#endif -#if defined(USE_GLES2) +#else if (CVS->isGLSL()) sprintf(versionString, "#version 300 es\n"); #endif @@ -252,7 +251,7 @@ void Shaders::loadShaders() int saved_shaders[ES_COUNT]; memcpy(saved_shaders, m_shaders, sizeof(m_shaders)); -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) std::string name = "pass"; #else std::string name = "pass_gles"; diff --git a/src/graphics/shadow_matrices.cpp b/src/graphics/shadow_matrices.cpp index 0a526819e..9a3a9e3c3 100644 --- a/src/graphics/shadow_matrices.cpp +++ b/src/graphics/shadow_matrices.cpp @@ -47,7 +47,7 @@ class LightspaceBoundingBoxShader public: LightspaceBoundingBoxShader() { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) loadProgram(OBJECT, GL_COMPUTE_SHADER, "Lightspaceboundingbox.comp"); assignSamplerNames(0, "depth", ST_NEAREST_FILTERED); assignUniforms("SunCamMatrix", "split0", "split1", "split2", "splitmax"); @@ -66,7 +66,7 @@ class ShadowMatricesGenerationShader public: ShadowMatricesGenerationShader() { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) loadProgram(OBJECT, GL_COMPUTE_SHADER, "shadowmatrixgeneration.comp"); assignUniforms("SunCamMatrix"); GLuint block_idx = @@ -222,7 +222,7 @@ core::matrix4 ShadowMatrices::getTighestFitOrthoProj(const core::matrix4 &transf void ShadowMatrices::updateSplitAndLightcoordRangeFromComputeShaders(unsigned int width, unsigned int height) { -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) struct CascadeBoundingBox { int xmin; diff --git a/src/graphics/skybox.cpp b/src/graphics/skybox.cpp index e44fa5fbf..3121427c2 100644 --- a/src/graphics/skybox.cpp +++ b/src/graphics/skybox.cpp @@ -185,7 +185,7 @@ void Skybox::generateCubeMapFromTextures() } glBindTexture(GL_TEXTURE_CUBE_MAP, m_cube_map); -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) GLint internal_format = CVS->isTextureCompressionEnabled() ? GL_COMPRESSED_SRGB_ALPHA : GL_SRGB_ALPHA; #else @@ -208,7 +208,6 @@ void Skybox::generateCubeMapFromTextures() // ---------------------------------------------------------------------------- void Skybox::generateSpecularCubemap() { -#ifndef ANDROID glGenTextures(1, &m_specular_probe); glBindTexture(GL_TEXTURE_CUBE_MAP, m_specular_probe); size_t cubemap_size = 256; @@ -304,7 +303,6 @@ void Skybox::generateSpecularCubemap() } glBindFramebuffer(GL_FRAMEBUFFER, 0); glDeleteFramebuffers(1, &fbo); -#endif } // generateSpecularCubemap @@ -323,7 +321,7 @@ Skybox::Skybox(const std::vector &skybox_textures) { m_skybox_textures = skybox_textures; -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS); #endif diff --git a/src/graphics/stk_mesh.cpp b/src/graphics/stk_mesh.cpp index 59e0bf156..b285c9b0f 100644 --- a/src/graphics/stk_mesh.cpp +++ b/src/graphics/stk_mesh.cpp @@ -344,7 +344,7 @@ static void setTexture(GLMesh &mesh, unsigned i, bool is_srgb, getUnicolorTexture(video::SColor(255, 127, 127, 127)); } compressTexture(mesh.textures[i], is_srgb); -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (CVS->isAZDOEnabled()) { if (!mesh.TextureHandles[i]) @@ -425,7 +425,7 @@ void initTexturesTransparent(GLMesh &mesh) return; } compressTexture(mesh.textures[0], true); -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (CVS->isAZDOEnabled()) { if (!mesh.TextureHandles[0]) diff --git a/src/graphics/stk_mesh_scene_node.cpp b/src/graphics/stk_mesh_scene_node.cpp index 98d7a7125..fe47d0dde 100644 --- a/src/graphics/stk_mesh_scene_node.cpp +++ b/src/graphics/stk_mesh_scene_node.cpp @@ -127,9 +127,7 @@ void STKMeshSceneNode::drawGlow(const GLMesh &mesh) GLenum itype = mesh.IndexType; size_t count = mesh.IndexCount; ColorizeShader::getInstance()->setUniforms(AbsoluteTransformation, video::SColorf(glowcolor.getRed() / 255.f, glowcolor.getGreen() / 255.f, glowcolor.getBlue() / 255.f)); -#ifndef ANDROID glDrawElementsBaseVertex(ptype, count, itype, (GLvoid *)mesh.vaoOffset, mesh.vaoBaseVertex); -#endif } void STKMeshSceneNode::updatevbo() @@ -305,7 +303,7 @@ void STKMeshSceneNode::render() size_t count = mesh.IndexCount; compressTexture(mesh.textures[0], true); -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (CVS->isAZDOEnabled()) { if (!mesh.TextureHandles[0]) @@ -350,7 +348,7 @@ void STKMeshSceneNode::render() GLenum itype = mesh.IndexType; size_t count = mesh.IndexCount; -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (CVS->isAZDOEnabled()) { GLuint64 DiffuseHandle = @@ -462,7 +460,7 @@ void STKMeshSceneNode::render() tmpcol.getBlue() / 255.0f); compressTexture(mesh.textures[0], true); -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (CVS->isAZDOEnabled()) { if (!mesh.TextureHandles[0]) @@ -502,7 +500,7 @@ void STKMeshSceneNode::render() size_t count = mesh.IndexCount; compressTexture(mesh.textures[0], true); -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (CVS->isAZDOEnabled()) { if (!mesh.TextureHandles[0]) diff --git a/src/graphics/stk_scene_manager.cpp b/src/graphics/stk_scene_manager.cpp index b7e277e9b..18f4ec392 100644 --- a/src/graphics/stk_scene_manager.cpp +++ b/src/graphics/stk_scene_manager.cpp @@ -692,7 +692,7 @@ PROFILER_POP_CPU_MARKER(); size_t offset = 0, current_cmd = 0; if (!CVS->supportsAsyncInstanceUpload()) { -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) glBindBuffer(GL_ARRAY_BUFFER, VAOManager::getInstance()->getInstanceBuffer(InstanceTypeDualTex)); InstanceBufferDualTex = (InstanceDataDualTex*)glMapBufferRange(GL_ARRAY_BUFFER, 0, 10000 * sizeof(InstanceDataDualTex), GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); glBindBuffer(GL_DRAW_INDIRECT_BUFFER, SolidPassCmd::getInstance()->drawindirectcmd); @@ -742,7 +742,7 @@ PROFILER_POP_CPU_MARKER(); if (!CVS->supportsAsyncInstanceUpload()) { -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) glUnmapBuffer(GL_ARRAY_BUFFER); glUnmapBuffer(GL_DRAW_INDIRECT_BUFFER); #endif @@ -754,7 +754,7 @@ PROFILER_POP_CPU_MARKER(); if (!CVS->supportsAsyncInstanceUpload()) { -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) glBindBuffer(GL_ARRAY_BUFFER, VAOManager::getInstance()->getInstanceBuffer(InstanceTypeGlow)); GlowInstanceBuffer = (GlowInstanceData*)glMapBufferRange(GL_ARRAY_BUFFER, 0, 10000 * sizeof(InstanceDataDualTex), GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); glBindBuffer(GL_DRAW_INDIRECT_BUFFER, GlowPassCmd::getInstance()->drawindirectcmd); @@ -780,7 +780,7 @@ PROFILER_POP_CPU_MARKER(); if (!CVS->supportsAsyncInstanceUpload()) { -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) glUnmapBuffer(GL_ARRAY_BUFFER); glUnmapBuffer(GL_DRAW_INDIRECT_BUFFER); #endif @@ -793,7 +793,7 @@ PROFILER_POP_CPU_MARKER(); size_t offset = 0, current_cmd = 0; if (!CVS->supportsAsyncInstanceUpload()) { -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) glBindBuffer(GL_ARRAY_BUFFER, VAOManager::getInstance()->getInstanceBuffer(InstanceTypeShadow)); ShadowInstanceBuffer = (InstanceDataSingleTex*)glMapBufferRange(GL_ARRAY_BUFFER, 0, 10000 * sizeof(InstanceDataDualTex), GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); glBindBuffer(GL_DRAW_INDIRECT_BUFFER, ShadowPassCmd::getInstance()->drawindirectcmd); @@ -820,7 +820,7 @@ PROFILER_POP_CPU_MARKER(); } if (!CVS->supportsAsyncInstanceUpload()) { -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) glUnmapBuffer(GL_ARRAY_BUFFER); glUnmapBuffer(GL_DRAW_INDIRECT_BUFFER); #endif @@ -832,7 +832,7 @@ PROFILER_POP_CPU_MARKER(); size_t offset = 0, current_cmd = 0; if (!CVS->supportsAsyncInstanceUpload()) { -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) glBindBuffer(GL_ARRAY_BUFFER, VAOManager::getInstance()->getInstanceBuffer(InstanceTypeRSM)); RSMInstanceBuffer = (InstanceDataSingleTex*)glMapBufferRange(GL_ARRAY_BUFFER, 0, 10000 * sizeof(InstanceDataDualTex), GL_MAP_WRITE_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); glBindBuffer(GL_DRAW_INDIRECT_BUFFER, RSMPassCmd::getInstance()->drawindirectcmd); @@ -863,7 +863,7 @@ PROFILER_POP_CPU_MARKER(); if (!CVS->supportsAsyncInstanceUpload()) { -#if !defined(USE_GLES2) && !defined(ANDROID) +#if !defined(USE_GLES2) glUnmapBuffer(GL_ARRAY_BUFFER); glUnmapBuffer(GL_DRAW_INDIRECT_BUFFER); #endif @@ -874,7 +874,7 @@ PROFILER_POP_CPU_MARKER(); poly_count[SOLID_NORMAL_AND_DEPTH_PASS] += SolidPoly; poly_count[SHADOW_PASS] += ShadowPoly; -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (CVS->supportsAsyncInstanceUpload()) glMemoryBarrier(GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT); #endif diff --git a/src/graphics/stk_scene_manager.hpp b/src/graphics/stk_scene_manager.hpp index 949baa5be..116ec2b82 100644 --- a/src/graphics/stk_scene_manager.hpp +++ b/src/graphics/stk_scene_manager.hpp @@ -37,7 +37,7 @@ public: DrawElementsIndirectCommand *Ptr; CommandBuffer() { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) glGenBuffers(1, &drawindirectcmd); glBindBuffer(GL_DRAW_INDIRECT_BUFFER, drawindirectcmd); if (CVS->supportsAsyncInstanceUpload()) diff --git a/src/graphics/texture_manager.cpp b/src/graphics/texture_manager.cpp index 2a2a51fba..3d7c9c35c 100644 --- a/src/graphics/texture_manager.cpp +++ b/src/graphics/texture_manager.cpp @@ -20,7 +20,7 @@ #include "graphics/central_settings.hpp" #include "graphics/irr_driver.hpp" -#if defined(ANDROID) || defined(USE_GLES2) +#if defined(USE_GLES2) #define _IRR_COMPILE_WITH_OGLES2_ #include "../../lib/irrlicht/source/Irrlicht/COGLES2Texture.h" #else @@ -34,7 +34,7 @@ GLuint getTextureGLuint(irr::video::ITexture *tex) { -#if defined(ANDROID) || defined(USE_GLES2) +#if defined(USE_GLES2) return static_cast(tex)->getOpenGLTextureName(); #else return static_cast(tex)->getOpenGLTextureName(); @@ -44,7 +44,7 @@ GLuint getTextureGLuint(irr::video::ITexture *tex) GLuint getDepthTexture(irr::video::ITexture *tex) { assert(tex->isRenderTarget()); -#if defined(ANDROID) || defined(USE_GLES2) +#if defined(USE_GLES2) return 1; //static_cast(tex)->DepthRenderBuffer; #else return static_cast(tex)->DepthBufferTexture; @@ -107,14 +107,14 @@ void compressTexture(irr::video::ITexture *tex, bool srgb, bool premul_alpha) if (!CVS->isTextureCompressionEnabled()) { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (srgb) internalFormat = (tex->hasAlpha()) ? GL_SRGB_ALPHA : GL_SRGB; else #endif internalFormat = (tex->hasAlpha()) ? GL_RGBA : GL_RGB; } -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) else { if (srgb) @@ -185,7 +185,7 @@ bool loadCompressedTexture(const std::string& compressed_tex) */ void saveCompressedTexture(const std::string& compressed_tex) { -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) int internal_format, width, height, size, compressionSuccessful; glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, (GLint *)&internal_format); glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, (GLint *)&width); diff --git a/src/graphics/texture_shader.cpp b/src/graphics/texture_shader.cpp index 039758ad8..63f737928 100644 --- a/src/graphics/texture_shader.cpp +++ b/src/graphics/texture_shader.cpp @@ -55,9 +55,7 @@ void TextureShaderBase::bindTextureNearest(GLuint texture_unit, GLuint tex) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); -#ifndef ANDROID glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.); -#endif } // bindTextureNearest @@ -73,9 +71,7 @@ void TextureShaderBase::bindTextureTrilinearAnisotropic(GLuint tex_unit, GLuint int aniso = UserConfigParams::m_anisotropic; if (aniso == 0) aniso = 1; -#ifndef ANDROID glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)aniso); -#endif } // bindTextureTrilinearAnisotropic // ---------------------------------------------------------------------------- @@ -90,10 +86,8 @@ void TextureShaderBase::bindCubemapTrilinear(unsigned tex_unit, unsigned tex) int aniso = UserConfigParams::m_anisotropic; if (aniso == 0) aniso = 1; -#ifndef ANDROID glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)aniso); -#endif } // bindCubemapTrilinear // ---------------------------------------------------------------------------- @@ -106,9 +100,7 @@ void TextureShaderBase::bindTextureNearestClamped(GLuint texture_unit, glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); -#ifndef ANDROID glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.); -#endif } // bindTextureNearestClamped // ---------------------------------------------------------------------------- @@ -122,9 +114,7 @@ void TextureShaderBase::bindTextureBilinear(GLuint texture_unit, GLuint tex) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); -#ifndef ANDROID glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.); -#endif } // bindTextureBilinear // ---------------------------------------------------------------------------- @@ -136,9 +126,7 @@ void TextureShaderBase::bindTextureBilinearClamped(GLuint tex_unit, GLuint tex) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); -#ifndef ANDROID glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.); -#endif } // bindTextureBilinearClamped // ---------------------------------------------------------------------------- @@ -150,9 +138,7 @@ void TextureShaderBase::bindTextureSemiTrilinear(GLuint tex_unit, GLuint tex_id) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); -#ifndef ANDROID glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.); -#endif } // bindTextureSemiTrilinear // ---------------------------------------------------------------------------- @@ -181,9 +167,7 @@ void TextureShaderBase::bindTrilinearClampedArrayTexture(unsigned tex_unit, int aniso = UserConfigParams::m_anisotropic; if (aniso == 0) aniso = 1; -#ifndef ANDROID glTexParameterf(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)aniso); -#endif } // bindTrilinearClampedArrayTexture // ---------------------------------------------------------------------------- @@ -195,9 +179,7 @@ void TextureShaderBase::bindTextureVolume(unsigned tex_unit, unsigned tex_id) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); -#ifndef ANDROID glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.); -#endif } // bindTextureVolume // ---------------------------------------------------------------------------- @@ -229,9 +211,7 @@ GLuint TextureShaderBase::createSamplers(SamplerTypeNew sampler_type) glSamplerParameteri(id, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glSamplerParameteri(id, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glSamplerParameteri(id, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); -#ifndef ANDROID glSamplerParameterf(id, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.); -#endif return createNearestSampler(); } case ST_BILINEAR_CLAMPED_FILTERED: @@ -254,9 +234,7 @@ GLuint TextureShaderBase::createNearestSampler() glSamplerParameteri(id, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glSamplerParameteri(id, GL_TEXTURE_WRAP_S, GL_REPEAT); glSamplerParameteri(id, GL_TEXTURE_WRAP_T, GL_REPEAT); -#ifndef ANDROID glSamplerParameterf(id, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.); -#endif return id; #endif } // createNearestSampler @@ -274,9 +252,7 @@ GLuint TextureShaderBase::createTrilinearSampler() int aniso = UserConfigParams::m_anisotropic; if (aniso == 0) aniso = 1; -#ifndef ANDROID glSamplerParameterf(id, GL_TEXTURE_MAX_ANISOTROPY_EXT, (float)aniso); -#endif return id; #endif } // createTrilinearSampler diff --git a/src/graphics/texture_shader.hpp b/src/graphics/texture_shader.hpp index 7c57c8d26..16222fa7c 100644 --- a/src/graphics/texture_shader.hpp +++ b/src/graphics/texture_shader.hpp @@ -215,11 +215,9 @@ public: template void setTextureHandlesImpl(uint64_t handle, HandlesId... args) { -#ifndef ANDROID if (handle) glUniformHandleui64ARB(m_texture_location[N], handle); setTextureHandlesImpl(args...); -#endif } // setTextureHandlesImpl // ------------------------------------------------------------------------ diff --git a/src/graphics/vao_manager.cpp b/src/graphics/vao_manager.cpp index a76a3fb27..7d69b3238 100644 --- a/src/graphics/vao_manager.cpp +++ b/src/graphics/vao_manager.cpp @@ -39,7 +39,7 @@ VAOManager::VAOManager() { glGenBuffers(1, &instance_vbo[i]); glBindBuffer(GL_ARRAY_BUFFER, instance_vbo[i]); -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (CVS->supportsAsyncInstanceUpload()) { glBufferStorage(GL_ARRAY_BUFFER, 10000 * sizeof(InstanceDataDualTex), 0, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT); @@ -90,7 +90,7 @@ resizeBufferIfNecessary(size_t &lastIndex, size_t newLastIndex, size_t bufferSiz GLuint newVBO; glGenBuffers(1, &newVBO); glBindBuffer(type, newVBO); -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (CVS->supportsAsyncInstanceUpload()) { glBufferStorage(type, bufferSize *stride, 0, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT); @@ -293,7 +293,7 @@ void VAOManager::append(scene::IMeshBuffer *mb, VTXTYPE tp) size_t old_idx_cnt = last_index[tp]; regenerateBuffer(tp, old_vtx_cnt + mb->getVertexCount(), old_idx_cnt + mb->getIndexCount()); -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (CVS->supportsAsyncInstanceUpload()) { void *tmp = (char*)VBOPtr[tp] + old_vtx_cnt * getVertexPitch(tp); @@ -305,7 +305,7 @@ void VAOManager::append(scene::IMeshBuffer *mb, VTXTYPE tp) glBindBuffer(GL_ARRAY_BUFFER, vbo[tp]); glBufferSubData(GL_ARRAY_BUFFER, old_vtx_cnt * getVertexPitch(tp), mb->getVertexCount() * getVertexPitch(tp), mb->getVertices()); } -#if !defined(ANDROID) && !defined(USE_GLES2) +#if !defined(USE_GLES2) if (CVS->supportsAsyncInstanceUpload()) { void *tmp = (char*)IBOPtr[tp] + old_idx_cnt * sizeof(u16); diff --git a/src/guiengine/skin.cpp b/src/guiengine/skin.cpp index 118055e6f..5bf5454be 100644 --- a/src/guiengine/skin.cpp +++ b/src/guiengine/skin.cpp @@ -1961,14 +1961,10 @@ void Skin::process3DPane(IGUIElement *element, const core::recti &rect, FrameBuffer* fb = mvw->getFrameBuffer(); if (fb != NULL && fb->getRTT().size() > 0) { -#if !defined(ANDROID) glEnable(GL_FRAMEBUFFER_SRGB); -#endif draw2DImageFromRTT(fb->getRTT()[0], 512, 512, rect, core::rect(0, 0, 512, 512), NULL, SColor(255, 255, 255, 255), true); -#if !defined(ANDROID) glDisable(GL_FRAMEBUFFER_SRGB); -#endif } } else if (type == WTYPE_ICON_BUTTON || type == WTYPE_MODEL_VIEW) diff --git a/src/main.cpp b/src/main.cpp index 81a76f760..f90d76a55 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1117,10 +1117,6 @@ void initUserConfig() //============================================================================= void initRest() { -#ifdef ANDROID - UserConfigParams::m_no_start_screen = true; -#endif - stk_config->load(file_manager->getAsset("stk_config.xml")); irr_driver = new IrrDriver(); @@ -1271,19 +1267,10 @@ void askForInternetPermission() #endif // ---------------------------------------------------------------------------- -#ifdef ANDROID -void stk_run() { - main_loop->run(); -} -int stk_main() -{ - CommandLine::init(0, {}); -#else int main(int argc, char *argv[] ) { CommandLine::init(argc, argv); -#endif CrashReporting::installHandlers(); srand(( unsigned ) time( 0 )); @@ -1519,11 +1506,7 @@ int main(int argc, char *argv[] ) race_manager->setupPlayerKartInfo(); race_manager->startNew(false); } -#ifdef ANDROID - return 0; -#else main_loop->run(); -#endif } // try catch (std::exception &e) diff --git a/src/main_loop.cpp b/src/main_loop.cpp index 7c08823d7..fc4a8bfe4 100644 --- a/src/main_loop.cpp +++ b/src/main_loop.cpp @@ -171,7 +171,7 @@ void MainLoop::run() m_curr_time = device->getTimer()->getRealTime(); - #if defined(ANDROID_DEVICE) + #if defined(ANDROID) auto sensorManager = ASensorManager_getInstance(); auto accelerometerSensor = ASensorManager_getDefaultSensor(sensorManager, ASENSOR_TYPE_ACCELEROMETER); @@ -186,7 +186,7 @@ void MainLoop::run() while(!m_abort) { - #if defined(ANDROID_DEVICE) + #if defined(ANDROID) int ident; int events; struct android_poll_source* source; diff --git a/src/utils/log.cpp b/src/utils/log.cpp index c9a42b617..f77f0bcfc 100644 --- a/src/utils/log.cpp +++ b/src/utils/log.cpp @@ -23,7 +23,7 @@ #include #include -#ifdef ANDROID_DEVICE +#ifdef ANDROID # include #endif @@ -136,7 +136,7 @@ void Log::printMessage(int level, const char *component, const char *format, if(level