From 09e5835074e1ede70a27e362c79dbb1837a268a6 Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Sun, 28 Sep 2025 12:06:57 +0200 Subject: [PATCH 1/2] refactor: Remove obsolete pragma optimize directives --- Core/Libraries/Source/WWVegas/WW3D2/aabtree.cpp | 8 -------- .../Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp | 2 -- .../Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp | 3 --- .../Code/Libraries/Source/WWVegas/WW3D2/texture.cpp | 3 --- .../Code/Libraries/Source/WWVegas/WW3D2/textureloader.cpp | 3 --- GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp | 8 +------- 6 files changed, 1 insertion(+), 26 deletions(-) diff --git a/Core/Libraries/Source/WWVegas/WW3D2/aabtree.cpp b/Core/Libraries/Source/WWVegas/WW3D2/aabtree.cpp index ce077c2952..0dc4fb8cc2 100644 --- a/Core/Libraries/Source/WWVegas/WW3D2/aabtree.cpp +++ b/Core/Libraries/Source/WWVegas/WW3D2/aabtree.cpp @@ -724,10 +724,6 @@ bool AABTreeClass::Intersect_OBBox_Recursive(AABTreeClass::CullNodeStruct * node return res; } -#ifdef RTS_DEBUG -#pragma optimize("", off) // We get an odd error when using optimized in the debug. -// All optimized seems to work. jba. -#endif /*********************************************************************************************** * AABTreeClass::Cast_Ray_To_Polys -- cast the ray to polys in the given node * * * @@ -787,10 +783,6 @@ bool AABTreeClass::Cast_Ray_To_Polys(CullNodeStruct * node,RayCollisionTestClass } return false; } -#ifdef RTS_DEBUG -#pragma optimize("", on) -#endif - /*********************************************************************************************** * AABTreeClass::Cast_Semi_Infinite_Axis_Aligned_Ray_To_Polys -- cast ray to polys in the node * diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp index 8911bd9e8c..da700a2d94 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp @@ -62,8 +62,6 @@ #include "assetmgr.h" #include "WW3D2/dx8wrapper.h" -//#pragma optimize("", off) - //#define ALLOW_WATER_TRACK_EDIT //number of vertex pages allocated - allows double buffering of vertex updates. diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp index 51a8cb7fac..b85a955a1b 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/render2d.cpp @@ -58,9 +58,6 @@ #include "wwmemlog.h" #include "assetmgr.h" -//#pragma optimize("", off) -//#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes") - RectClass Render2DClass::ScreenResolution( 0,0,0,0 ); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texture.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texture.cpp index a3dd2c564a..df53dadbaf 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texture.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texture.cpp @@ -59,9 +59,6 @@ #include "texturethumbnail.h" #include "wwprofile.h" -//#pragma optimize("", off) -//#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes") - const unsigned DEFAULT_INACTIVATION_TIME=20000; /* diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/textureloader.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/textureloader.cpp index cc45c9b795..7d1795a9eb 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/textureloader.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/textureloader.cpp @@ -62,9 +62,6 @@ #include "bitmaphandler.h" #include "wwprofile.h" -//#pragma optimize("", off) -//#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes") - bool TextureLoader::TextureLoadSuspended; int TextureLoader::TextureInactiveOverrideTime = 0; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp index eca1d02a26..c37deea52a 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp @@ -2056,12 +2056,6 @@ void DrawObject::setRampFeedbackParms(const Coord3D *start, const Coord3D *end, } -// This routine fails to draw poly triggers in some cases when optimized. -// So just shut it off for now. The failure case was new doc, add a poly trigger. -// Adding any other object fixed the problem. jba - -#pragma optimize("", off) - bool _skip_drawobject_render = false; /** Render draws into the current 3d context. */ @@ -2457,7 +2451,7 @@ if (pMapObj->isSelected()) { m_lineRenderer->Reset(); } } -#pragma optimize("", on) + void BuildRectFromSegmentAndWidth(const Coord3D* start, const Coord3D* end, Real width, Coord3D* outBL, Coord3D* outTL, Coord3D* outBR, Coord3D* outTR) From 21010df1b5680b2e45e641cc9dc8bde01b05be2f Mon Sep 17 00:00:00 2001 From: xezon <4720891+xezon@users.noreply.github.com> Date: Tue, 30 Sep 2025 19:37:15 +0200 Subject: [PATCH 2/2] Replicate in Generals --- .../Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp | 2 -- Generals/Code/Tools/WorldBuilder/src/DrawObject.cpp | 8 +------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp index 0964c1ab4c..406ee01ac2 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp @@ -59,8 +59,6 @@ #include "assetmgr.h" #include "WW3D2/dx8wrapper.h" -//#pragma optimize("", off) - //#define ALLOW_WATER_TRACK_EDIT //number of vertex pages allocated - allows double buffering of vertex updates. diff --git a/Generals/Code/Tools/WorldBuilder/src/DrawObject.cpp b/Generals/Code/Tools/WorldBuilder/src/DrawObject.cpp index 7245e7e684..8c60712f75 100644 --- a/Generals/Code/Tools/WorldBuilder/src/DrawObject.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/DrawObject.cpp @@ -1622,12 +1622,6 @@ void DrawObject::setRampFeedbackParms(const Coord3D *start, const Coord3D *end, } -// This routine fails to draw poly triggers in some cases when optimized. -// So just shut it off for now. The failure case was new doc, add a poly trigger. -// Adding any other object fixed the problem. jba - -#pragma optimize("", off) - /** Render draws into the current 3d context. */ void DrawObject::Render(RenderInfoClass & rinfo) { @@ -1933,7 +1927,7 @@ void DrawObject::Render(RenderInfoClass & rinfo) } } -#pragma optimize("", on) + void BuildRectFromSegmentAndWidth(const Coord3D* start, const Coord3D* end, Real width, Coord3D* outBL, Coord3D* outTL, Coord3D* outBR, Coord3D* outTR)