From ab5d0a584f4dc366f1312d9aa60f8cd3c2959d31 Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Mon, 18 Apr 2016 20:10:24 +0200 Subject: [PATCH] Make Engine/Graphics/Texture.cpp 64bit-clean (hopefully!) ((ULONG*)td_ulObject)[iFr] is fishy - and ULONG td_ulObject already is in an union with ULONG* td_pulObjects, so use td_pulObjects when appropriate (i.e. if td_ctFrames>1) Also fixed some checks accordingly. --- Sources/Engine/Graphics/Texture.cpp | 32 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Sources/Engine/Graphics/Texture.cpp b/Sources/Engine/Graphics/Texture.cpp index 9f3f03d..55596bc 100644 --- a/Sources/Engine/Graphics/Texture.cpp +++ b/Sources/Engine/Graphics/Texture.cpp @@ -1312,7 +1312,7 @@ void CTextureData::SetAsCurrent( INDEX iFrameNo/*=0*/, BOOL bForceUpload/*=FALSE // if not already generated, generate bind number(s) and force upload const PIX pixTextureSize = pixWidth*pixHeight; - if( td_ulObject==NONE) + if((td_ctFrames>1 && td_pulObjects==NULL) || td_ulObject==NONE) { // check whether frames are present ASSERT( td_pulFrames!=NULL && td_pulFrames[0]!=0xDEADBEEF); @@ -1367,8 +1367,7 @@ void CTextureData::SetAsCurrent( INDEX iFrameNo/*=0*/, BOOL bForceUpload/*=FALSE for( INDEX iFr=0; iFr1 && td_pulObjects!=NULL) || td_ulObject!=NONE); return; } @@ -1402,14 +1401,11 @@ void CTextureData::SetAsCurrent( INDEX iFrameNo/*=0*/, BOOL bForceUpload/*=FALSE // must reset local texture parameters for each frame of animated texture for( INDEX iFr=0; iFr1) ulTexObject = ((ULONG*)td_ulObject)[iFrameNo]; // animation + ULONG ulTexObject = (td_ctFrames>1) ? td_pulObjects[iFrameNo] : td_ulObject; // single-frame or animation if( bUseProbe) { // set probe if burst value doesn't allow real texture if( _pGfx->gl_slAllowedUploadBurst<0) { @@ -1440,17 +1436,22 @@ void CTextureData::Unbind(void) // reset mark td_tvLastDrawn = (__int64) 0; - // only if bound - if( td_ulObject==NONE) { - ASSERT( td_ulProbeObject==NONE); - return; - } // free frame number(s) if( td_ctFrames>1) { // animation + // only if bound + if( td_pulObjects == NULL || td_pulObjects[0]==NONE) { + ASSERT( td_pulObjects == NULL || td_pulObjects[0]==NONE); + return; + } for( INDEX iFrame=0; iFrame1) ulTexObject = td_pulObjects[0]; + ULONG ulTexObject = (td_ctFrames>1) ? td_pulObjects[0] : td_ulObject; // add structure size and anim block size SLONG slUsed = sizeof(*this) + CAnimData::GetUsedMemory()-sizeof(CAnimData);