From 3a54e8d6b887ffff44388002c6312274a74acebe Mon Sep 17 00:00:00 2001 From: cutealien Date: Sun, 21 Feb 2021 16:37:56 +0000 Subject: [PATCH] Merging r6186 through r6192 from trunk to ogl-es branch git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@6193 dfc29bdd-3216-0410-991c-e03cc46cb475 --- changes.txt | 3 ++ include/IGUIElement.h | 23 +++++++++++++++ include/rect.h | 16 +++++++---- source/Irrlicht/CSoftwareDriver2.cpp | 28 +++++++------------ source/Irrlicht/CSoftwareDriver2.h | 11 ++++---- source/Irrlicht/IBurningShader.cpp | 3 ++ .../Irrlicht.xcodeproj/project.pbxproj | 10 +++++-- source/Irrlicht/Makefile | 10 ++----- .../Irrlicht/SoftwareDriver2_compile_config.h | 5 ++++ tests/tests-last-passed-at.txt | 2 +- 10 files changed, 71 insertions(+), 40 deletions(-) diff --git a/changes.txt b/changes.txt index 4413771e..be43b0ba 100644 --- a/changes.txt +++ b/changes.txt @@ -9,6 +9,9 @@ Changes in ogl-es (not yet released - will be merged with trunk at some point) -------------------------- Changes in 1.9 (not yet released) +- Fix bug in rect::clipAgainst that had caused rects completely outside to the left-top of the rect to be clipped against ending up with both corners outside. + It still worked for UI in most cases as the resulting rectangle still had an area of 0. +- Add getAlign functions to IGUIElement - Add optional multitouch support to X11 (but disabled in IrrCompileConfig by default). Thanks @TheBrokenRail for a patch proposal based on example code from esjeon (patch #322). - Slightly changed close window handling on X11 (optimized and avoids problems on some shells). Thanks @TheBrokenRail for a patch (was part of patch #322). - Add getActiveColor functions to IGUIStaticText and IGUIButton (get currently used color). diff --git a/include/IGUIElement.h b/include/IGUIElement.h index d5d0bace..5968430a 100644 --- a/include/IGUIElement.h +++ b/include/IGUIElement.h @@ -209,6 +209,29 @@ public: } } + //! How left element border is aligned when parent is resized + EGUI_ALIGNMENT getAlignLeft() const + { + return AlignLeft; + } + + //! How right element border is aligned when parent is resized + EGUI_ALIGNMENT getAlignRight() const + { + return AlignRight; + } + + //! How top element border is aligned when parent is resized + EGUI_ALIGNMENT getAlignTop() const + { + return AlignTop; + } + + //! How bottom element border is aligned when parent is resized + EGUI_ALIGNMENT getAlignBottom() const + { + return AlignBottom; + } //! Updates the absolute position. virtual void updateAbsolutePosition() diff --git a/include/rect.h b/include/rect.h index aeb9cc5f..85becf0e 100644 --- a/include/rect.h +++ b/include/rect.h @@ -135,16 +135,20 @@ namespace core if (other.LowerRightCorner.Y < LowerRightCorner.Y) LowerRightCorner.Y = other.LowerRightCorner.Y; + if (other.UpperLeftCorner.X > LowerRightCorner.X) + LowerRightCorner.X = other.UpperLeftCorner.X; + if (other.UpperLeftCorner.Y > LowerRightCorner.Y) + LowerRightCorner.Y = other.UpperLeftCorner.Y; + + if (other.LowerRightCorner.X < UpperLeftCorner.X) + UpperLeftCorner.X = other.LowerRightCorner.X; + if (other.LowerRightCorner.Y < UpperLeftCorner.Y) + UpperLeftCorner.Y = other.LowerRightCorner.Y; + if (other.UpperLeftCorner.X > UpperLeftCorner.X) UpperLeftCorner.X = other.UpperLeftCorner.X; if (other.UpperLeftCorner.Y > UpperLeftCorner.Y) UpperLeftCorner.Y = other.UpperLeftCorner.Y; - - // correct possible invalid rect resulting from clipping - if (UpperLeftCorner.Y > LowerRightCorner.Y) - UpperLeftCorner.Y = LowerRightCorner.Y; - if (UpperLeftCorner.X > LowerRightCorner.X) - UpperLeftCorner.X = LowerRightCorner.X; } //! Moves this rectangle to fit inside another one. diff --git a/source/Irrlicht/CSoftwareDriver2.cpp b/source/Irrlicht/CSoftwareDriver2.cpp index 605b15b4..8fa5a9de 100644 --- a/source/Irrlicht/CSoftwareDriver2.cpp +++ b/source/Irrlicht/CSoftwareDriver2.cpp @@ -466,19 +466,19 @@ bool CBurningVideoDriver::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const on = 1; break; - case EVDF_TEXTURE_NPOT: // for 2D - on = 0; - break; - case EVDF_ARB_FRAGMENT_PROGRAM_1: case EVDF_ARB_VERTEX_PROGRAM_1: on = 1; break; -#if defined(PATCH_SUPERTUX_8_0_1) +#if defined(PATCH_SUPERTUX_8_0_1_with_1_9_0) case EVDF_TEXTURE_NPOT: case EVDF_ARB_GLSL: on = 1; break; +#else + case EVDF_TEXTURE_NPOT: // for 2D + on = 0; + break; #endif #if defined(SOFTWARE_DRIVER_2_2D_AS_3D) @@ -1310,16 +1310,6 @@ REALINLINE s32 CBurningVideoDriver::lodFactor_inside(const s4DVertexPair* burnin inline void CBurningVideoDriver::select_polygon_mipmap_inside(s4DVertex* burning_restrict face[], const size_t tex, const CSoftwareTexture2_Bound& b) const { #ifdef SOFTWARE_DRIVER_2_PERSPECTIVE_CORRECT -#if defined(Tweak_Burning) - (face[0] + 1)->Tex[tex].x = face[0]->Tex[tex].x * (face[0] + 1)->Pos.w * (b.w + Tweak.tex_w_add) + (b.cx + Tweak.tex_cx_add); - (face[0] + 1)->Tex[tex].y = face[0]->Tex[tex].y * (face[0] + 1)->Pos.w * (b.h + Tweak.tex_h_add) + (b.cy + Tweak.tex_cy_add); - - (face[1] + 1)->Tex[tex].x = face[1]->Tex[tex].x * (face[1] + 1)->Pos.w * (b.w + Tweak.tex_w_add) + (b.cx + Tweak.tex_cx_add); - (face[1] + 1)->Tex[tex].y = face[1]->Tex[tex].y * (face[1] + 1)->Pos.w * (b.h + Tweak.tex_h_add) + (b.cy + Tweak.tex_cy_add); - - (face[2] + 1)->Tex[tex].x = face[2]->Tex[tex].x * (face[2] + 1)->Pos.w * (b.w + Tweak.tex_w_add) + (b.cx + Tweak.tex_cx_add); - (face[2] + 1)->Tex[tex].y = face[2]->Tex[tex].y * (face[2] + 1)->Pos.w * (b.h + Tweak.tex_h_add) + (b.cy + Tweak.tex_cy_add); -#else (face[0] + 1)->Tex[tex].x = face[0]->Tex[tex].x * (face[0] + 1)->Pos.w * b.w + b.cx; (face[0] + 1)->Tex[tex].y = face[0]->Tex[tex].y * (face[0] + 1)->Pos.w * b.h + b.cy; @@ -1328,7 +1318,6 @@ inline void CBurningVideoDriver::select_polygon_mipmap_inside(s4DVertex* burning (face[2] + 1)->Tex[tex].x = face[2]->Tex[tex].x * (face[2] + 1)->Pos.w * b.w + b.cx; (face[2] + 1)->Tex[tex].y = face[2]->Tex[tex].y * (face[2] + 1)->Pos.w * b.h + b.cy; -#endif #else (face[0] + 1)->Tex[tex].x = face[0]->Tex[tex].x * b.w; (face[0] + 1)->Tex[tex].y = face[0]->Tex[tex].y * b.h; @@ -1369,13 +1358,13 @@ void CBurningVideoDriver::VertexCache_map_source_format() os::Printer::log("BurningVideo pointer should be 8 bytes", ELL_ERROR); _IRR_DEBUG_BREAK_IF(1); } -#endif if (((unsigned long long)Transformation&15) || ((unsigned long long)TransformationFlag & 15)) { os::Printer::log("BurningVideo Matrix Stack not 16 byte aligned", ELL_ERROR); _IRR_DEBUG_BREAK_IF(1); } +#endif SVSize* vSize = VertexCache.vSize; @@ -3464,7 +3453,7 @@ ITexture* CBurningVideoDriver::addRenderTargetTexture(const core::dimension2ddrop(); + if ( img ) img->drop(); addTexture(tex); tex->drop(); return tex; @@ -3713,6 +3702,9 @@ s32 CBurningVideoDriver::addHighLevelShaderMaterial( IShaderConstantSetCallBack* callback, E_MATERIAL_TYPE baseMaterial, s32 userData +#if defined(PATCH_SUPERTUX_8_0_1_with_1_9_0) + , E_GPU_SHADING_LANGUAGE shadingLang +#endif ) { s32 materialID = -1; diff --git a/source/Irrlicht/CSoftwareDriver2.h b/source/Irrlicht/CSoftwareDriver2.h index 4c87bf3f..62a1bcc5 100644 --- a/source/Irrlicht/CSoftwareDriver2.h +++ b/source/Irrlicht/CSoftwareDriver2.h @@ -215,11 +215,6 @@ namespace video IDepthBuffer * getDepthBuffer () { return DepthBuffer; } IStencilBuffer * getStencilBuffer () { return StencilBuffer; } - //#define Tweak_Burning -#if defined(Tweak_Burning) - virtual void postEventFromUser(const void* sevent) _IRR_OVERRIDE_; -#endif - //! Adds a new material renderer to the VideoDriver, using pixel and/or //! vertex shaders to render geometry. virtual s32 addShaderMaterial(const c8* vertexShaderProgram, @@ -245,7 +240,11 @@ namespace video u32 verticesOut = 0, IShaderConstantSetCallBack* callback = 0, E_MATERIAL_TYPE baseMaterial = video::EMT_SOLID, - s32 userData = 0) _IRR_OVERRIDE_; + s32 userData = 0 +#if defined(PATCH_SUPERTUX_8_0_1_with_1_9_0) + , E_GPU_SHADING_LANGUAGE shadingLang = EGSL_DEFAULT +#endif + ) _IRR_OVERRIDE_; //IMaterialRendererService diff --git a/source/Irrlicht/IBurningShader.cpp b/source/Irrlicht/IBurningShader.cpp index c7945e8c..b72cd9ac 100644 --- a/source/Irrlicht/IBurningShader.cpp +++ b/source/Irrlicht/IBurningShader.cpp @@ -29,11 +29,13 @@ void IBurningShader::constructor_IBurningShader(CBurningVideoDriver* driver) setDebugName("IBurningShader"); #endif +#if defined(ENV64BIT) if (((unsigned long long)&scan & 15) || ((unsigned long long)&line & 15)) { os::Printer::log("BurningVideo Shader not 16 byte aligned", ELL_ERROR); _IRR_DEBUG_BREAK_IF(1); } +#endif Interlaced.enable = 0; Interlaced.bypass = 1; @@ -96,6 +98,7 @@ IBurningShader::IBurningShader( { constructor_IBurningShader(driver); BaseMaterial = baseMaterial; + UserData = userData; CallBack = callback; if (CallBack) CallBack->grab(); diff --git a/source/Irrlicht/Irrlicht.xcodeproj/project.pbxproj b/source/Irrlicht/Irrlicht.xcodeproj/project.pbxproj index 3d25caa8..85b0ebb2 100644 --- a/source/Irrlicht/Irrlicht.xcodeproj/project.pbxproj +++ b/source/Irrlicht/Irrlicht.xcodeproj/project.pbxproj @@ -3183,7 +3183,10 @@ ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = c11; GCC_NO_COMMON_BLOCKS = YES; - "GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = "DEBUG=1"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "PNG_ARM_NEON_OPT=0", + ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -3219,7 +3222,10 @@ ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = c11; GCC_NO_COMMON_BLOCKS = YES; - "GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = "NDEBUG=1"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "NDEBUG=1", + "PNG_ARM_NEON_OPT=0", + ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNDECLARED_SELECTOR = YES; diff --git a/source/Irrlicht/Makefile b/source/Irrlicht/Makefile index d637b553..8ddcc537 100644 --- a/source/Irrlicht/Makefile +++ b/source/Irrlicht/Makefile @@ -77,16 +77,12 @@ emscripten: EMSCRIPTEN=1 CXXINCS = -I../../include -Izlib -Ijpeglib -Ilibpng CPPFLAGS += $(CXXINCS) -DIRRLICHT_EXPORTS=1 -CXXFLAGS += -Wall -pipe -fno-exceptions -fno-rtti -fstrict-aliasing +CXXFLAGS += -Wall -pipe -fno-exceptions -fno-rtti #CXXFLAGS += -std=gnu++11 -U__STRICT_ANSI__ ifndef NDEBUG CXXFLAGS += -g -D_DEBUG else - ifndef EMSCRIPTEN - CXXFLAGS += -fexpensive-optimizations -O3 - else - CXXFLAGS += -O3 - endif + CXXFLAGS += -O3 endif ifdef PROFILE CXXFLAGS += -pg @@ -102,7 +98,7 @@ ifdef EMSCRIPTEN CXXFLAGS += -s WASM=1 endif else - CFLAGS := -O3 -fexpensive-optimizations -DPNG_THREAD_UNSAFE_OK -DPNG_NO_MMX_CODE -DPNG_NO_MNG_FEATURES -DPNG_ARM_NEON_OPT=0 + CFLAGS := -O3 -DPNG_THREAD_UNSAFE_OK -DPNG_NO_MMX_CODE -DPNG_NO_MNG_FEATURES -DPNG_ARM_NEON_OPT=0 endif sharedlib sharedlib_osx: CXXFLAGS += -fPIC diff --git a/source/Irrlicht/SoftwareDriver2_compile_config.h b/source/Irrlicht/SoftwareDriver2_compile_config.h index 897049ac..f76bfe7e 100644 --- a/source/Irrlicht/SoftwareDriver2_compile_config.h +++ b/source/Irrlicht/SoftwareDriver2_compile_config.h @@ -308,7 +308,12 @@ namespace irr { //! Compiler Align #if defined(_MSC_VER) +#if defined(ENV64BIT) #define ALIGN(x) __declspec(align(x)) +#else +// ALIGN(16) not working +#define ALIGN(x) __declspec(align(8)) +#endif #elif defined(__GNUC__) #define ALIGN(x) __attribute__ ((aligned(x))) #else diff --git a/tests/tests-last-passed-at.txt b/tests/tests-last-passed-at.txt index 15f31461..09ce1bdc 100644 --- a/tests/tests-last-passed-at.txt +++ b/tests/tests-last-passed-at.txt @@ -1,4 +1,4 @@ Tests finished. 72 tests of 72 passed. Compiled as DEBUG -Test suite pass at GMT Tue Dec 01 13:34:31 2020 +Test suite pass at GMT Thu Feb 11 14:00:00 2021