Skip to content

Commit a5ca2c7

Browse files
authored
Merge pull request #54 from GeneralsOnlineDevelopmentTeam/seer/texture-refactor
Texture: Refactor texture application and assignment
2 parents 6b9c714 + f1b2ff4 commit a5ca2c7

2 files changed

Lines changed: 6 additions & 28 deletions

File tree

  • GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2
  • Generals/Code/Libraries/Source/WWVegas/WW3D2

‎Generals/Code/Libraries/Source/WWVegas/WW3D2/texture.cpp‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -542,12 +542,10 @@ void TextureClass::Apply_Null(unsigned int stage)
542542

543543
void TextureClass::Apply_New_Surface(bool initialized)
544544
{
545-
if (D3DTexture) D3DTexture->Release();
546-
D3DTexture=TextureLoadTask->Peek_D3D_Texture();
547-
D3DTexture->AddRef();
545+
Set_D3D_Base_Texture(TextureLoadTask->Peek_D3D_Texture());
548546
if (initialized) Initialized=true;
549547

550-
WWASSERT(D3DTexture);
548+
WWASSERT(Peek_D3D_Base_Texture());
551549
IDirect3DSurface8* surface;
552550
DX8_ErrorCode(Peek_D3D_Texture()->GetSurfaceLevel(0,&surface));
553551
D3DSURFACE_DESC d3d_desc;

‎GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/texture.cpp‎

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -895,12 +895,7 @@ void TextureClass::Apply_New_Surface
895895
bool disable_auto_invalidation
896896
)
897897
{
898-
IDirect3DBaseTexture8* d3d_tex=Peek_D3D_Base_Texture();
899-
900-
if (d3d_tex) d3d_tex->Release();
901-
902-
Poke_Texture(d3d_texture);//TextureLoadTask->Peek_D3D_Texture();
903-
d3d_texture->AddRef();
898+
Set_D3D_Base_Texture(d3d_texture);
904899

905900
if (initialized) Initialized=true;
906901
if (disable_auto_invalidation) InactivationTime = 0;
@@ -1276,12 +1271,7 @@ void ZTextureClass::Apply_New_Surface
12761271
bool disable_auto_invalidation
12771272
)
12781273
{
1279-
IDirect3DBaseTexture8* d3d_tex=Peek_D3D_Base_Texture();
1280-
1281-
if (d3d_tex) d3d_tex->Release();
1282-
1283-
Poke_Texture(d3d_texture);//TextureLoadTask->Peek_D3D_Texture();
1284-
d3d_texture->AddRef();
1274+
Set_D3D_Base_Texture(d3d_texture);
12851275

12861276
if (initialized) Initialized=true;
12871277
if (disable_auto_invalidation) InactivationTime = 0;
@@ -1595,12 +1585,7 @@ void CubeTextureClass::Apply_New_Surface
15951585
bool disable_auto_invalidation
15961586
)
15971587
{
1598-
IDirect3DBaseTexture8* d3d_tex=Peek_D3D_Base_Texture();
1599-
1600-
if (d3d_tex) d3d_tex->Release();
1601-
1602-
Poke_Texture(d3d_texture);//TextureLoadTask->Peek_D3D_Texture();
1603-
d3d_texture->AddRef();
1588+
Set_D3D_Base_Texture(d3d_texture);
16041589

16051590
if (initialized) Initialized=true;
16061591
if (disable_auto_invalidation) InactivationTime = 0;
@@ -1883,12 +1868,7 @@ void VolumeTextureClass::Apply_New_Surface
18831868
bool disable_auto_invalidation
18841869
)
18851870
{
1886-
IDirect3DBaseTexture8* d3d_tex=Peek_D3D_Base_Texture();
1887-
1888-
if (d3d_tex) d3d_tex->Release();
1889-
1890-
Poke_Texture(d3d_texture);//TextureLoadTask->Peek_D3D_Texture();
1891-
d3d_texture->AddRef();
1871+
Set_D3D_Base_Texture(d3d_texture);
18921872

18931873
if (initialized) Initialized=true;
18941874
if (disable_auto_invalidation) InactivationTime = 0;

0 commit comments

Comments
 (0)