Legacy cleanup, part 2 (#3659)
* Legacy cleanup, part 2 There are still things that can be removed, those will be likely done in part three: `The Return of the Cleanup` :) Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com> * Fix windows build Somehow there were some unfixed errors from enabled warnings? I'm unsure if I've pulled repo in unstable state, or those were somehow missed. Signed-off-by: nemerle <96597+nemerle@users.noreply.github.com>
This commit is contained in:
@@ -5,60 +5,12 @@
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CRYINCLUDE_CRYCOMMON_ITEXTURE_H
|
||||
#define CRYINCLUDE_CRYCOMMON_ITEXTURE_H
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/PlatformDef.h>
|
||||
|
||||
#include "Cry_Math.h"
|
||||
#include "Cry_Color.h"
|
||||
#include "Tarray.h"
|
||||
#include <smartptr.h>
|
||||
class CTexture;
|
||||
|
||||
#ifndef COMPILER_SUPPORTS_ENUM_SPECIFICATION
|
||||
# if defined(_MSC_VER)
|
||||
# define COMPILER_SUPPORTS_ENUM_SPECIFICATION 1
|
||||
# else
|
||||
# define COMPILER_SUPPORTS_ENUM_SPECIFICATION 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if COMPILER_SUPPORTS_ENUM_SPECIFICATION
|
||||
enum ETEX_Type : uint8
|
||||
#else
|
||||
typedef uint8 ETEX_Type;
|
||||
enum eTEX_Type
|
||||
#endif
|
||||
{
|
||||
eTT_1D = 0,
|
||||
eTT_2D,
|
||||
eTT_3D,
|
||||
eTT_Cube,
|
||||
eTT_CubeArray,
|
||||
eTT_Dyn2D,
|
||||
eTT_User,
|
||||
eTT_NearestCube,
|
||||
|
||||
eTT_2DArray,
|
||||
eTT_2DMS,
|
||||
|
||||
eTT_Auto2D,
|
||||
|
||||
eTT_MaxTexType, // not used
|
||||
};
|
||||
|
||||
#include <AzCore/base.h>
|
||||
|
||||
// Texture formats
|
||||
#if COMPILER_SUPPORTS_ENUM_SPECIFICATION
|
||||
enum ETEX_Format : uint8
|
||||
#else
|
||||
typedef uint8 ETEX_Format;
|
||||
enum eTEX_Format
|
||||
#endif
|
||||
enum ETEX_Format : AZ::u8
|
||||
{
|
||||
eTF_Unknown = 0,
|
||||
eTF_R8G8B8A8S,
|
||||
@@ -147,277 +99,20 @@ enum eTEX_Format
|
||||
eTF_MaxFormat // unused, must be always the last in the list
|
||||
};
|
||||
|
||||
#if COMPILER_SUPPORTS_ENUM_SPECIFICATION
|
||||
enum ETEX_TileMode : uint8
|
||||
#else
|
||||
typedef uint8 ETEX_TileMode;
|
||||
enum eTEX_TileMode
|
||||
#endif
|
||||
{
|
||||
eTM_None = 0,
|
||||
eTM_LinearPadded,
|
||||
eTM_Optimal,
|
||||
};
|
||||
|
||||
|
||||
enum ETextureFlags
|
||||
{
|
||||
FT_NOMIPS = 0x00000001,
|
||||
FT_TEX_NORMAL_MAP = 0x00000002,
|
||||
FT_TEX_WAS_NOT_PRE_TILED = 0x00000004,
|
||||
FT_USAGE_DEPTHSTENCIL = 0x00000008,
|
||||
FT_USAGE_ALLOWREADSRGB = 0x00000010,
|
||||
FT_FILESINGLE = 0x00000020, // suppress loading of additional files like _DDNDIF (faster, RC can tag the file for that)
|
||||
FT_TEX_FONT = 0x00000040,
|
||||
FT_HAS_ATTACHED_ALPHA = 0x00000080,
|
||||
FT_USAGE_UNORDERED_ACCESS = 0x00000100,
|
||||
FT_USAGE_READBACK = 0x00000200,
|
||||
FT_USAGE_MSAA = 0x00000400,
|
||||
FT_FORCE_MIPS = 0x00000800,
|
||||
FT_USAGE_RENDERTARGET = 0x00001000,
|
||||
FT_USAGE_DYNAMIC = 0x00002000,
|
||||
FT_STAGE_READBACK = 0x00004000,
|
||||
FT_STAGE_UPLOAD = 0x00008000,
|
||||
FT_DONT_RELEASE = 0x00010000,
|
||||
FT_ASYNC_PREPARE = 0x00020000,
|
||||
FT_DONT_STREAM = 0x00040000,
|
||||
#if defined(AZ_RESTRICTED_PLATFORM)
|
||||
#include AZ_RESTRICTED_FILE(ITexture_h)
|
||||
#endif
|
||||
|
||||
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
|
||||
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
|
||||
#else
|
||||
#if defined(AZ_PLATFORM_IOS)
|
||||
FT_USAGE_MEMORYLESS = 0x00080000, //reusing an unused bit for ios
|
||||
#else
|
||||
FT_USAGE_PREDICATED_TILING = 0x00080000, //unused
|
||||
#endif
|
||||
#endif
|
||||
FT_FAILED = 0x00100000,
|
||||
FT_FROMIMAGE = 0x00200000,
|
||||
FT_STATE_CLAMP = 0x00400000,
|
||||
FT_USAGE_ATLAS = 0x00800000,
|
||||
FT_ALPHA = 0x01000000,
|
||||
FT_REPLICATE_TO_ALL_SIDES = 0x02000000,
|
||||
FT_KEEP_LOWRES_SYSCOPY = 0x04000000, // keep low res copy in system memory for voxelization on CPU
|
||||
FT_SPLITTED = 0x08000000, // for split dds files
|
||||
FT_USE_HTILE = 0x10000000,
|
||||
FT_IGNORE_PRECACHE = 0x20000000,
|
||||
FT_COMPOSITE = 0x40000000,
|
||||
FT_USAGE_UAV_RWTEXTURE = 0x80000000,
|
||||
};
|
||||
|
||||
struct SDepthTexture;
|
||||
|
||||
struct STextureStreamingStats
|
||||
{
|
||||
STextureStreamingStats(bool bComputeTexturesPerFrame)
|
||||
: bComputeReuquiredTexturesPerFrame(bComputeTexturesPerFrame)
|
||||
{
|
||||
nMaxPoolSize = 0;
|
||||
nCurrentPoolSize = 0;
|
||||
nStreamedTexturesSize = 0;
|
||||
nStaticTexturesSize = 0;
|
||||
nThroughput = 0;
|
||||
nNumTexturesPerFrame = 0;
|
||||
nRequiredStreamedTexturesSize = 0;
|
||||
nRequiredStreamedTexturesCount = 0;
|
||||
bPoolOverflow = false;
|
||||
bPoolOverflowTotally = false;
|
||||
fPoolFragmentation = 0.0f;
|
||||
}
|
||||
size_t nMaxPoolSize;
|
||||
size_t nCurrentPoolSize;
|
||||
size_t nStreamedTexturesSize;
|
||||
size_t nStaticTexturesSize;
|
||||
uint32 nNumTexturesPerFrame;
|
||||
size_t nThroughput;
|
||||
size_t nRequiredStreamedTexturesSize;
|
||||
uint32 nRequiredStreamedTexturesCount;
|
||||
float fPoolFragmentation;
|
||||
uint32 bPoolOverflow : 1;
|
||||
uint32 bPoolOverflowTotally : 1;
|
||||
const bool bComputeReuquiredTexturesPerFrame;
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Texture object interface
|
||||
class CDeviceTexture;
|
||||
class ITexture
|
||||
{
|
||||
protected:
|
||||
virtual ~ITexture() {}
|
||||
public:
|
||||
|
||||
// <interfuscator:shuffle>
|
||||
virtual int AddRef() = 0;
|
||||
virtual int Release() = 0;
|
||||
virtual int ReleaseForce() = 0;
|
||||
|
||||
virtual const ColorF& GetClearColor() const = 0;
|
||||
virtual const ETEX_Format GetDstFormat() const = 0;
|
||||
virtual const ETEX_Format GetSrcFormat() const = 0;
|
||||
virtual const ETEX_Type GetTexType() const = 0;
|
||||
virtual void ApplyTexture(int nTUnit, int nState = -1) = 0;
|
||||
virtual const char* GetName() const = 0;
|
||||
virtual const int GetWidth() const = 0;
|
||||
virtual const int GetHeight() const = 0;
|
||||
virtual const int GetDepth() const = 0;
|
||||
virtual const int GetTextureID() const = 0;
|
||||
virtual const uint32 GetFlags() const = 0;
|
||||
virtual const int GetNumMips() const = 0;
|
||||
virtual const int GetRequiredMip() const = 0;
|
||||
virtual const int GetDeviceDataSize() const = 0;
|
||||
virtual const int GetDataSize() const = 0;
|
||||
virtual const ETEX_Type GetTextureType() const = 0;
|
||||
// Sets the texture type of the texture to be used before the texture is loaded.
|
||||
// Once the texture is loaded the type from the file will overwrite whatever
|
||||
// value was set here.
|
||||
virtual void SetTextureType(ETEX_Type type) = 0;
|
||||
virtual const bool IsTextureLoaded() const = 0;
|
||||
virtual void PrecacheAsynchronously(float fMipFactor, int nFlags, int nUpdateId, int nCounter = 1) = 0;
|
||||
virtual uint8* GetData32(int nSide = 0, int nLevel = 0, uint8* pDst = NULL, ETEX_Format eDstFormat = eTF_R8G8B8A8) = 0;
|
||||
virtual bool SetFilter(int nFilter) = 0; // FILTER_ flags
|
||||
virtual void SetClamp(bool bEnable) = 0; // Texture addressing set
|
||||
virtual float GetAvgBrightness() const = 0;
|
||||
|
||||
virtual int StreamCalculateMipsSigned(float fMipFactor) const = 0;
|
||||
virtual int GetStreamableMipNumber() const = 0;
|
||||
virtual int GetStreamableMemoryUsage(int nStartMip) const = 0;
|
||||
virtual int GetMinLoadedMip() const = 0;
|
||||
|
||||
using StagingHook = AZStd::function<bool(void*, uint32, uint32)>;
|
||||
virtual void Readback(AZ::u32 subresourceIndex, StagingHook callback) = 0;
|
||||
|
||||
virtual bool Reload() = 0;
|
||||
// Used for debugging/profiling.
|
||||
virtual const char* GetFormatName() const = 0;
|
||||
virtual const char* GetTypeName() const = 0;
|
||||
virtual const bool IsStreamedVirtual() const = 0;
|
||||
virtual const bool IsShared() const = 0;
|
||||
virtual const bool IsStreamable() const = 0;
|
||||
virtual bool IsStreamedIn(const int nMinPrecacheRoundIds[2]) const = 0;
|
||||
virtual const int GetAccessFrameId() const = 0;
|
||||
|
||||
virtual const ETEX_Format GetTextureDstFormat() const = 0;
|
||||
virtual const ETEX_Format GetTextureSrcFormat() const = 0;
|
||||
|
||||
virtual bool IsPostponed() const = 0;
|
||||
virtual const bool IsParticularMipStreamed(float fMipFactor) const = 0;
|
||||
|
||||
// get low res system memory (used for CPU voxelization)
|
||||
virtual const ColorB* GetLowResSystemCopy([[maybe_unused]] uint16& nWidth, [[maybe_unused]] uint16& nHeight, [[maybe_unused]] int** ppLowResSystemCopyAtlasId) { return 0; }
|
||||
|
||||
// </interfuscator:shuffle>
|
||||
|
||||
void GetMemoryUsage([[maybe_unused]] ICrySizer* pSizer) const
|
||||
{
|
||||
static_assert(eTT_MaxTexType <= 255);
|
||||
static_assert(eTF_MaxFormat <= 255);
|
||||
/*LATER*/
|
||||
}
|
||||
|
||||
virtual void SetKeepSystemCopy(bool bKeepSystemCopy) = 0;
|
||||
virtual void UpdateTextureRegion(const uint8_t* data, int nX, int nY, int nZ, int USize, int VSize, int ZSize, ETEX_Format eTFSrc) = 0;
|
||||
virtual CDeviceTexture* GetDevTexture() const = 0;
|
||||
|
||||
};
|
||||
|
||||
struct STextureLoadData
|
||||
{
|
||||
void* m_pData;
|
||||
size_t m_DataSize;
|
||||
int m_Width;
|
||||
int m_Height;
|
||||
ETEX_Format m_Format;
|
||||
int m_NumMips;
|
||||
int m_nFlags;
|
||||
ITexture* m_pTexture;
|
||||
STextureLoadData()
|
||||
: m_pData(nullptr)
|
||||
, m_Width(0)
|
||||
, m_Height(0)
|
||||
, m_Format(eTF_Unknown)
|
||||
, m_NumMips(0)
|
||||
, m_nFlags(0)
|
||||
, m_pTexture(nullptr)
|
||||
{
|
||||
}
|
||||
~STextureLoadData()
|
||||
{
|
||||
if (m_pData)
|
||||
{
|
||||
CryModuleFree(m_pData);
|
||||
}
|
||||
}
|
||||
|
||||
static void* AllocateData(size_t dataSize)
|
||||
{
|
||||
return CryModuleMalloc(dataSize);
|
||||
}
|
||||
};
|
||||
struct ITextureLoadHandler
|
||||
{
|
||||
virtual ~ITextureLoadHandler() {}
|
||||
virtual bool LoadTextureData(const char* path, STextureLoadData& loadData) = 0;
|
||||
virtual bool SupportsExtension(const char* ext) const = 0;
|
||||
virtual void Update() = 0;
|
||||
};
|
||||
|
||||
//=========================================================================================
|
||||
|
||||
class IDynTexture
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
fNeedRegenerate = 1ul << 0,
|
||||
};
|
||||
// <interfuscator:shuffle>
|
||||
virtual ~IDynTexture(){}
|
||||
virtual void Release() = 0;
|
||||
virtual void GetSubImageRect(uint32& nX, uint32& nY, uint32& nWidth, uint32& nHeight) = 0;
|
||||
virtual void GetImageRect(uint32& nX, uint32& nY, uint32& nWidth, uint32& nHeight) = 0;
|
||||
virtual int GetTextureID() = 0;
|
||||
virtual void Lock() = 0;
|
||||
virtual void UnLock() = 0;
|
||||
virtual int GetWidth() = 0;
|
||||
virtual int GetHeight() = 0;
|
||||
virtual bool IsValid() = 0;
|
||||
virtual uint8 GetFlags() const = 0;
|
||||
virtual void SetFlags([[maybe_unused]] uint8 flags) {}
|
||||
virtual bool Update(int nNewWidth, int nNewHeight) = 0;
|
||||
virtual void Apply(int nTUnit, int nTS = -1) = 0;
|
||||
virtual bool ClearRT() = 0;
|
||||
virtual bool SetRT(int nRT, bool bPush, struct SDepthTexture* pDepthSurf, bool bScreenVP = false) = 0;
|
||||
virtual bool SetRectStates() = 0;
|
||||
virtual bool RestoreRT(int nRT, bool bPop) = 0;
|
||||
virtual ITexture* GetTexture() = 0;
|
||||
virtual void SetUpdateMask() = 0;
|
||||
virtual void ResetUpdateMask() = 0;
|
||||
virtual bool IsSecondFrame() = 0;
|
||||
virtual bool GetImageData32([[maybe_unused]] uint8* pData, [[maybe_unused]] int nDataSize) { return 0; }
|
||||
// </interfuscator:shuffle>
|
||||
};
|
||||
|
||||
// Animating Texture sequence definition
|
||||
class ITexAnim
|
||||
{
|
||||
public:
|
||||
virtual ~ITexAnim() {};
|
||||
virtual void Release() = 0;
|
||||
virtual void AddRef() = 0;
|
||||
};
|
||||
|
||||
struct AZ_DEPRECATED(STexAnim, "STexAnim has been deprecated and replaced by the abstract interface ITexAnim above and CTexAnim in RenderDLL/Common/Textures/Texture.h. This was done to keep proper ref counting between CryRenderDLL and EditorLib.") {};
|
||||
|
||||
struct STexComposition
|
||||
{
|
||||
_smart_ptr<ITexture> pTexture;
|
||||
uint16 nSrcSlice;
|
||||
uint16 nDstSlice;
|
||||
};
|
||||
|
||||
#endif // CRYINCLUDE_CRYCOMMON_ITEXTURE_H
|
||||
|
||||
Reference in New Issue
Block a user