From 12a94ed5b7ba5b886e888c52355536764bbb6e42 Mon Sep 17 00:00:00 2001 From: engineer_apple Date: Sat, 13 Feb 2021 21:49:03 +0000 Subject: [PATCH] BurningVideo: remove align 16 byte on win32 git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6191 dfc29bdd-3216-0410-991c-e03cc46cb475 --- source/Irrlicht/CSoftwareDriver2.cpp | 28 +++++++------------ source/Irrlicht/CSoftwareDriver2.h | 11 ++++---- source/Irrlicht/IBurningShader.cpp | 3 ++ .../Irrlicht/SoftwareDriver2_compile_config.h | 5 ++++ 4 files changed, 23 insertions(+), 24 deletions(-) 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/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