1 // Copyright (C) 2003 Dolphin Project.
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, version 2.0.
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU General Public License 2.0 for more details.
12 // A copy of the GPL 2.0 should have been included with the program.
13 // If not, see http://www.gnu.org/licenses/
15 // Official SVN repository and contact information can be found at
16 // http://code.google.com/p/dolphin-emu/
23 #include "D3DTexture.h"
24 #include "VideoCommon.h"
32 D3DTexture2D
* texture
;
41 unsigned int w
, h
, fmt
, MipLevels
;
42 int Realw
, Realh
, Scaledw
, Scaledh
;
47 TCacheEntry() : texture(NULL
), addr(0), size_in_bytes(0), hash(0), paletteHash(0), oldpixel(0),
48 frameCount(0), w(0), h(0), fmt(0), MipLevels(0), Realw(0), Realh(0), Scaledw(0), Scaledh(0),
49 isRenderTarget(false), isNonPow2(true) {}
51 void Destroy(bool shutdown
);
52 bool IntersectsMemoryRange(u32 range_address
, u32 range_size
);
56 static void Cleanup();
57 static void Shutdown();
58 static void Invalidate(bool shutdown
);
59 static void InvalidateRange(u32 start_address
, u32 size
);
60 static TCacheEntry
* TextureCache::Load(unsigned int stage
, u32 address
, unsigned int width
, unsigned int height
, unsigned int tex_format
, unsigned int tlutaddr
, unsigned int tlutfmt
, bool UseNativeMips
, unsigned int maxlevel
);
61 static void CopyRenderTargetToTexture(u32 address
, bool bFromZBuffer
, bool bIsIntensityFmt
, u32 copyfmt
, unsigned int bScaleByHalf
, const EFBRectangle
&source_rect
);
64 typedef std::map
<u32
,TCacheEntry
> TexCache
;
67 static TexCache textures
;