From 41eb62d51a832917b9f9c641caba3c78ed3137fd Mon Sep 17 00:00:00 2001 From: stm <14291421+stephanmeesters@users.noreply.github.com> Date: Wed, 15 Apr 2026 21:37:45 +0200 Subject: [PATCH 1/9] wwmemlog usage --- .../Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp | 4 ++++ .../Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp index 51311e81aa8..d0e4fc3e37f 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp @@ -43,6 +43,7 @@ #include "dx8caps.h" #include "sphere.h" #include "thread.h" +#include "wwmemlog.h" #define DEFAULT_IB_SIZE 5000 @@ -318,6 +319,7 @@ SortingIndexBufferClass::SortingIndexBufferClass(unsigned short index_count_) : IndexBufferClass(BUFFER_TYPE_SORTING,index_count_) { + WWMEMLOG(MEM_RENDERER); WWASSERT(index_count); index_buffer=W3DNEWARRAY unsigned short[index_count]; @@ -438,6 +440,7 @@ DynamicIBAccessClass::WriteLockClass::~WriteLockClass() void DynamicIBAccessClass::Allocate_DX8_Dynamic_Buffer() { + WWMEMLOG(MEM_RENDERER); WWASSERT(!_DynamicDX8IndexBufferInUse); _DynamicDX8IndexBufferInUse=true; @@ -473,6 +476,7 @@ void DynamicIBAccessClass::Allocate_DX8_Dynamic_Buffer() void DynamicIBAccessClass::Allocate_Sorting_Dynamic_Buffer() { + WWMEMLOG(MEM_RENDERER); WWASSERT(!_DynamicSortingIndexArrayInUse); _DynamicSortingIndexArrayInUse=true; diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp index 2de977daa02..fa6f89f5fa6 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp @@ -43,6 +43,7 @@ #include "dx8fvf.h" #include "dx8caps.h" #include "thread.h" +#include "wwmemlog.h" #include #define DEFAULT_VB_SIZE 5000 @@ -78,6 +79,7 @@ VertexBufferClass::VertexBufferClass(unsigned type_, unsigned FVF, unsigned shor type(type_), engine_refs(0) { + WWMEMLOG(MEM_RENDERER); WWASSERT(VertexCount); WWASSERT(type==BUFFER_TYPE_DX8 || type==BUFFER_TYPE_SORTING); WWASSERT(FVF != 0); @@ -284,6 +286,7 @@ SortingVertexBufferClass::SortingVertexBufferClass(unsigned short VertexCount) : VertexBufferClass(BUFFER_TYPE_SORTING, dynamic_fvf_type, VertexCount) { + WWMEMLOG(MEM_RENDERER); VertexBuffer=W3DNEWARRAY VertexFormatXYZNDUV2[VertexCount]; } @@ -759,6 +762,7 @@ void DynamicVBAccessClass::_Deinit() void DynamicVBAccessClass::Allocate_DX8_Dynamic_Buffer() { + WWMEMLOG(MEM_RENDERER); WWASSERT(!_DynamicDX8VertexBufferInUse); _DynamicDX8VertexBufferInUse=true; @@ -795,6 +799,7 @@ void DynamicVBAccessClass::Allocate_DX8_Dynamic_Buffer() void DynamicVBAccessClass::Allocate_Sorting_Dynamic_Buffer() { + WWMEMLOG(MEM_RENDERER); WWASSERT(!_DynamicSortingVertexArrayInUse); _DynamicSortingVertexArrayInUse=true; From 8cdb70796faef8b55e3a287a52fcf351c4a6d7a6 Mon Sep 17 00:00:00 2001 From: stm <14291421+stephanmeesters@users.noreply.github.com> Date: Wed, 15 Apr 2026 21:44:01 +0200 Subject: [PATCH 2/9] headers --- .../Libraries/Source/WWVegas/WW3D2/dx8fvf.cpp | 23 +++++++++++++++++++ .../Source/WWVegas/WW3D2/dx8indexbuffer.cpp | 4 ++-- .../Source/WWVegas/WW3D2/dx8vertexbuffer.cpp | 7 +++--- .../Source/WWVegas/WW3D2/dx8vertexbuffer.h | 7 +++--- 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8fvf.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8fvf.cpp index a30cf97d23d..b24c295d3d5 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8fvf.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8fvf.cpp @@ -16,6 +16,29 @@ ** along with this program. If not, see . */ +/*********************************************************************************************** + *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S *** + *********************************************************************************************** + * * + * Project Name : ww3d * + * * + * $Archive:: /Commando/Code/ww3d2/dx8fvf.h $* + * * + * Original Author:: Jani Penttinen * + * * + * $Author:: Kenny Mitchell * + * * + * $Modtime:: 06/26/02 5:06p $* + * * + * $Revision:: 7 $* + * * + * 06/26/02 KM VB Vertex format update for shaders * + * 07/17/02 KM VB Vertex format update for displacement mapping * + * 08/01/02 KM VB Vertex format update for cube mapping * + *---------------------------------------------------------------------------------------------* + * Functions: * + * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + #include "dx8fvf.h" #include "wwstring.h" #include diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp index d0e4fc3e37f..1720a7b3a40 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp @@ -28,9 +28,9 @@ * * * $Author:: Jani_p $* * * - * $Modtime:: 7/10/01 1:30p $* + * $Modtime:: 11/09/01 3:12p $* * * - * $Revision:: 22 $* + * $Revision:: 26 $* * * *---------------------------------------------------------------------------------------------* * Functions: * diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp index fa6f89f5fa6..cfb06e02f7f 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp @@ -26,12 +26,13 @@ * * * Original Author:: Jani Penttinen * * * - * $Author:: Jani_p $* + * $Author:: Kenny Mitchell * * * - * $Modtime:: 7/10/01 1:33p $* + * $Modtime:: 06/26/02 5:06p $* * * - * $Revision:: 34 $* + * $Revision:: 39 $* * * + * 06/26/02 KM VB Vertex format size update for shaders * *---------------------------------------------------------------------------------------------* * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.h b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.h index 668b1ab411d..e9d4f3a33b6 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.h +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.h @@ -26,12 +26,13 @@ * * * Original Author:: Jani Penttinen * * * - * $Author:: Jani_p $* + * $Author:: Kenny Mitchell * * * - * $Modtime:: 7/09/01 8:15p $* + * $Modtime:: 06/26/02 5:06p $* * * - * $Revision:: 25 $* + * $Revision:: 26 $* * * + * 06/26/02 KM VB Vertex format size update for shaders * *---------------------------------------------------------------------------------------------* * Functions: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ From 84e2903bbadec620cfd8e4dc3dcae204257c4cf4 Mon Sep 17 00:00:00 2001 From: stm <14291421+stephanmeesters@users.noreply.github.com> Date: Wed, 15 Apr 2026 21:45:25 +0200 Subject: [PATCH 3/9] dx8caps usage --- .../Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp | 3 +++ .../Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp index 1720a7b3a40..95b1e3994a2 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp @@ -293,6 +293,9 @@ DX8IndexBufferClass::DX8IndexBufferClass(unsigned short index_count_,UsageType u ((usage&USAGE_DYNAMIC) ? D3DUSAGE_DYNAMIC : 0)| ((usage&USAGE_NPATCHES) ? D3DUSAGE_NPATCHES : 0)| ((usage&USAGE_SOFTWAREPROCESSING) ? D3DUSAGE_SOFTWAREPROCESSING : 0); + if (!DX8Wrapper::Get_Current_Caps()->Support_TnL()) { + usage_flags|=D3DUSAGE_SOFTWAREPROCESSING; + } DX8CALL(CreateIndexBuffer( sizeof(WORD)*index_count, diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp index cfb06e02f7f..f6029ccc01e 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp @@ -437,6 +437,9 @@ void DX8VertexBufferClass::Create_Vertex_Buffer(UsageType usage) ((usage&USAGE_DYNAMIC) ? D3DUSAGE_DYNAMIC : 0)| ((usage&USAGE_NPATCHES) ? D3DUSAGE_NPATCHES : 0)| ((usage&USAGE_SOFTWAREPROCESSING) ? D3DUSAGE_SOFTWAREPROCESSING : 0); + if (!DX8Wrapper::Get_Current_Caps()->Support_TnL()) { + usage_flags|=D3DUSAGE_SOFTWAREPROCESSING; + } // New Code if (!DX8Wrapper::Get_Current_Caps()->Support_TnL()) { From 5108a7683758fc3a78c7718ab6395aebefd871ad Mon Sep 17 00:00:00 2001 From: stm <14291421+stephanmeesters@users.noreply.github.com> Date: Wed, 15 Apr 2026 21:50:27 +0200 Subject: [PATCH 4/9] support failed index buffer allocation --- .../Source/WWVegas/WW3D2/dx8indexbuffer.cpp | 34 +++++++++++++++++-- .../Source/WWVegas/WW3D2/dx8indexbuffer.cpp | 5 +-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp index 95b1e3994a2..b3da8b9c450 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp @@ -297,12 +297,42 @@ DX8IndexBufferClass::DX8IndexBufferClass(unsigned short index_count_,UsageType u usage_flags|=D3DUSAGE_SOFTWAREPROCESSING; } - DX8CALL(CreateIndexBuffer( + HRESULT ret; + DX8CALL_HRES(CreateIndexBuffer( sizeof(WORD)*index_count, usage_flags, D3DFMT_INDEX16, (usage&USAGE_DYNAMIC) ? D3DPOOL_DEFAULT : D3DPOOL_MANAGED, - &index_buffer)); + &index_buffer), ret); + + if (SUCCEEDED(ret)) { + return; + } + + WWDEBUG_SAY(("Index buffer creation failed, trying to release assets...")); + + // Vertex buffer creation failed, so try releasing least used textures and flushing the mesh cache. + + // Free all textures that haven't been used in the last 5 seconds + TextureClass::Invalidate_Old_Unused_Textures(5000); + + // Invalidate the mesh cache + WW3D::_Invalidate_Mesh_Cache(); + + // Try again... + ret=DX8Wrapper::_Get_D3D_Device8()->CreateIndexBuffer( + sizeof(WORD)*index_count, + usage_flags, + D3DFMT_INDEX16, + (usage&USAGE_DYNAMIC) ? D3DPOOL_DEFAULT : D3DPOOL_MANAGED, + &index_buffer); + + if (SUCCEEDED(ret)) { + WWDEBUG_SAY(("...Index buffer creation successful")); + } + + // If it still fails it is fatal + DX8_ErrorCode(ret); } // ---------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp index 2cdcb48d6c2..2ef4a2afbb0 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp @@ -297,12 +297,13 @@ DX8IndexBufferClass::DX8IndexBufferClass(unsigned short index_count_,UsageType u usage_flags|=D3DUSAGE_SOFTWAREPROCESSING; } - HRESULT ret=DX8Wrapper::_Get_D3D_Device8()->CreateIndexBuffer( + HRESULT ret; + DX8CALL_HRES(CreateIndexBuffer( sizeof(WORD)*index_count, usage_flags, D3DFMT_INDEX16, (usage&USAGE_DYNAMIC) ? D3DPOOL_DEFAULT : D3DPOOL_MANAGED, - &index_buffer); + &index_buffer), ret); if (SUCCEEDED(ret)) { return; From a55d5eb572d55df62f66eedab678ce687a93ddf5 Mon Sep 17 00:00:00 2001 From: stm <14291421+stephanmeesters@users.noreply.github.com> Date: Wed, 15 Apr 2026 21:51:49 +0200 Subject: [PATCH 5/9] re-enable vertex buffer debug in ZH --- .../Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp index eb872540e96..f816c39402d 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp @@ -836,7 +836,7 @@ DynamicVBAccessClass::WriteLockClass::WriteLockClass(DynamicVBAccessClass* dynam switch (DynamicVBAccess->Get_Type()) { case BUFFER_TYPE_DYNAMIC_DX8: #ifdef VERTEX_BUFFER_LOG -/* { + { WWASSERT(!dx8_lock); dx8_lock++; StringClass fvf_name; @@ -847,7 +847,6 @@ DynamicVBAccessClass::WriteLockClass::WriteLockClass(DynamicVBAccessClass* dynam DynamicVBAccess->VertexBuffer->FVF_Info().Get_FVF_Size(), fvf_name)); } -*/ #endif WWASSERT(_DynamicDX8VertexBuffer); // WWASSERT(!_DynamicDX8VertexBuffer->Engine_Refs()); @@ -879,10 +878,9 @@ DynamicVBAccessClass::WriteLockClass::~WriteLockClass() switch (DynamicVBAccess->Get_Type()) { case BUFFER_TYPE_DYNAMIC_DX8: #ifdef VERTEX_BUFFER_LOG -/* dx8_lock--; + dx8_lock--; WWASSERT(!dx8_lock); WWDEBUG_SAY(("DynamicVertexBuffer->Unlock()")); -*/ #endif DX8_Assert(); DX8_ErrorCode(static_cast(DynamicVBAccess->VertexBuffer)->Get_DX8_Vertex_Buffer()->Unlock()); From 4b44adf22ddcb2a66d5b6820b90ce73752732dac Mon Sep 17 00:00:00 2001 From: stm <14291421+stephanmeesters@users.noreply.github.com> Date: Wed, 15 Apr 2026 21:52:29 +0200 Subject: [PATCH 6/9] workaround for failed vertex buffer creation out of memory --- .../Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp index f6029ccc01e..22619cea369 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp @@ -458,8 +458,10 @@ void DX8VertexBufferClass::Create_Vertex_Buffer(UsageType usage) WWDEBUG_SAY(("Vertex buffer creation failed, trying to release assets...")); - // Vertex buffer creation failed. Must be out of memory. Try releasing all our D3D assets and re-creating - // them. + // Vertex buffer creation failed, so try releasing least used textures and flushing the mesh cache. + + // Free all textures that haven't been used in the last 5 seconds + TextureClass::Invalidate_Old_Unused_Textures(5000); // Invalidate the mesh cache WW3D::_Invalidate_Mesh_Cache(); From 5f94a017f3ce143afd068ec84f6f906c65913e89 Mon Sep 17 00:00:00 2001 From: stm <14291421+stephanmeesters@users.noreply.github.com> Date: Wed, 15 Apr 2026 21:54:44 +0200 Subject: [PATCH 7/9] vertex buffer debugging --- .../Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp index 22619cea369..fd0b7feb74e 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp @@ -424,10 +424,10 @@ void DX8VertexBufferClass::Create_Vertex_Buffer(UsageType usage) WWDEBUG_SAY(("CreateVertexBuffer(fvfsize=%d, vertex_count=%d, D3DUSAGE_WRITEONLY|%s|%s, fvf: %s, %s)", FVF_Info().Get_FVF_Size(), VertexCount, - usage&USAGE_DYNAMIC ? "D3DUSAGE_DYNAMIC" : "-", - usage&USAGE_SOFTWAREPROCESSING ? "D3DUSAGE_SOFTWAREPROCESSING" : "-", + (usage&USAGE_DYNAMIC) ? "D3DUSAGE_DYNAMIC" : "-", + (usage&USAGE_SOFTWAREPROCESSING) ? "D3DUSAGE_SOFTWAREPROCESSING" : "-", fvf_name, - dynamic ? "D3DPOOL_DEFAULT" : "D3DPOOL_MANAGED")); + (usage&USAGE_DYNAMIC) ? "D3DPOOL_DEFAULT" : "D3DPOOL_MANAGED")); _DX8VertexBufferCount++; WWDEBUG_SAY(("Current vertex buffer count: %d",_DX8VertexBufferCount)); #endif From f7e368076b5c5872e428e78d8b655e0aa792f046 Mon Sep 17 00:00:00 2001 From: stm <14291421+stephanmeesters@users.noreply.github.com> Date: Wed, 6 May 2026 14:41:19 +0200 Subject: [PATCH 8/9] process greptile comments --- .../Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp | 2 +- .../Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp | 4 ---- .../Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp | 2 +- .../Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp | 4 ---- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp index b3da8b9c450..517e275e6b4 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp @@ -311,7 +311,7 @@ DX8IndexBufferClass::DX8IndexBufferClass(unsigned short index_count_,UsageType u WWDEBUG_SAY(("Index buffer creation failed, trying to release assets...")); - // Vertex buffer creation failed, so try releasing least used textures and flushing the mesh cache. + // Index buffer creation failed, so try releasing least used textures and flushing the mesh cache. // Free all textures that haven't been used in the last 5 seconds TextureClass::Invalidate_Old_Unused_Textures(5000); diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp index fd0b7feb74e..756ffd2db20 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp @@ -437,10 +437,6 @@ void DX8VertexBufferClass::Create_Vertex_Buffer(UsageType usage) ((usage&USAGE_DYNAMIC) ? D3DUSAGE_DYNAMIC : 0)| ((usage&USAGE_NPATCHES) ? D3DUSAGE_NPATCHES : 0)| ((usage&USAGE_SOFTWAREPROCESSING) ? D3DUSAGE_SOFTWAREPROCESSING : 0); - if (!DX8Wrapper::Get_Current_Caps()->Support_TnL()) { - usage_flags|=D3DUSAGE_SOFTWAREPROCESSING; - } - // New Code if (!DX8Wrapper::Get_Current_Caps()->Support_TnL()) { usage_flags|=D3DUSAGE_SOFTWAREPROCESSING; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp index 2ef4a2afbb0..7e8882c218f 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp @@ -311,7 +311,7 @@ DX8IndexBufferClass::DX8IndexBufferClass(unsigned short index_count_,UsageType u WWDEBUG_SAY(("Index buffer creation failed, trying to release assets...")); - // Vertex buffer creation failed, so try releasing least used textures and flushing the mesh cache. + // Index buffer creation failed, so try releasing least used textures and flushing the mesh cache. // Free all textures that haven't been used in the last 5 seconds TextureClass::Invalidate_Old_Unused_Textures(5000); diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp index f816c39402d..027d1c3cf36 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8vertexbuffer.cpp @@ -437,10 +437,6 @@ void DX8VertexBufferClass::Create_Vertex_Buffer(UsageType usage) ((usage&USAGE_DYNAMIC) ? D3DUSAGE_DYNAMIC : 0)| ((usage&USAGE_NPATCHES) ? D3DUSAGE_NPATCHES : 0)| ((usage&USAGE_SOFTWAREPROCESSING) ? D3DUSAGE_SOFTWAREPROCESSING : 0); - if (!DX8Wrapper::Get_Current_Caps()->Support_TnL()) { - usage_flags|=D3DUSAGE_SOFTWAREPROCESSING; - } - // New Code if (!DX8Wrapper::Get_Current_Caps()->Support_TnL()) { usage_flags|=D3DUSAGE_SOFTWAREPROCESSING; From 6d39b1e24504b40aa0b74479a4829da9fda2a99a Mon Sep 17 00:00:00 2001 From: stm <14291421+stephanmeesters@users.noreply.github.com> Date: Wed, 6 May 2026 20:42:57 +0200 Subject: [PATCH 9/9] Revert createindexbuffer handling to how it was in ZH --- .../Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp | 5 ++--- .../Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp index 517e275e6b4..89f2f3bd9ee 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp @@ -297,13 +297,12 @@ DX8IndexBufferClass::DX8IndexBufferClass(unsigned short index_count_,UsageType u usage_flags|=D3DUSAGE_SOFTWAREPROCESSING; } - HRESULT ret; - DX8CALL_HRES(CreateIndexBuffer( + HRESULT ret=DX8Wrapper::_Get_D3D_Device8()->CreateIndexBuffer( sizeof(WORD)*index_count, usage_flags, D3DFMT_INDEX16, (usage&USAGE_DYNAMIC) ? D3DPOOL_DEFAULT : D3DPOOL_MANAGED, - &index_buffer), ret); + &index_buffer); if (SUCCEEDED(ret)) { return; diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp index 7e8882c218f..9245837f95b 100644 --- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp +++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx8indexbuffer.cpp @@ -297,13 +297,12 @@ DX8IndexBufferClass::DX8IndexBufferClass(unsigned short index_count_,UsageType u usage_flags|=D3DUSAGE_SOFTWAREPROCESSING; } - HRESULT ret; - DX8CALL_HRES(CreateIndexBuffer( + HRESULT ret=DX8Wrapper::_Get_D3D_Device8()->CreateIndexBuffer( sizeof(WORD)*index_count, usage_flags, D3DFMT_INDEX16, (usage&USAGE_DYNAMIC) ? D3DPOOL_DEFAULT : D3DPOOL_MANAGED, - &index_buffer), ret); + &index_buffer); if (SUCCEEDED(ret)) { return;