More common things moved out from the GFX plugins. No visible changes.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@27 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2008-07-18 19:33:55 +00:00
parent ca13c54855
commit b3c55018a6
36 changed files with 857 additions and 924 deletions

View File

@ -15,73 +15,73 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _TextureMngr_H
#define _TextureMngr_H
#include <map>
#include "BPStructs.h"
struct TRectangle
{
int left, top, right, bottom;
};
class TextureMngr
{
public:
struct TCacheEntry
{
TCacheEntry() : texture(0), addr(0), hash(0), w(0), h(0), isRenderTarget(false), isUpsideDown(false), isNonPow2(true), bHaveMipMaps(false) { mode.hex = 0xFCFCFCFC; }
u32 texture;
u32 addr;
u32 hash;
u32 paletteHash;
u32 hashoffset;
u32 oldpixel; // used for simple cleanup
TexMode0 mode; // current filter and clamp modes that texture is set to
int frameCount;
int w,h,fmt;
bool isRenderTarget; // if render texture, then rendertex is filled with the direct copy of the render target
// later conversions would have to convert properly from rendertexfmt to texfmt
bool isUpsideDown;
bool isNonPow2; // if nonpow2, use GL_TEXTURE_2D, else GL_TEXTURE_RECTANGLE_NV
bool bHaveMipMaps;
void SetTextureParameters(TexMode0& newmode);
void Destroy();
void ConvertFromRenderTarget(u32 taddr, int twidth, int theight, int tformat, int tlutaddr, int tlutfmt);
};
struct DEPTHTARGET
{
DEPTHTARGET() : targ(0), framecount(0) {}
GLuint targ;
int framecount;
};
private:
typedef std::map<u32,TCacheEntry> TexCache;
static u8 *temp;
static TexCache textures;
static std::map<u32, DEPTHTARGET> mapDepthTargets;
static int nTex2DEnabled, nTexRECTEnabled;
public:
static void Init();
static void Cleanup();
static void Shutdown();
static void Invalidate();
static TCacheEntry* Load(int texstage, u32 address, int width, int height, int format, int tlutaddr, int tlutfmt);
static void CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyfmt, bool bScaleByHalf, TRectangle *source);
static void EnableTex2D(int stage);
static void EnableTexRECT(int stage);
static void DisableStage(int stage); // sets active texture
};
#endif
#ifndef _TextureMngr_H
#define _TextureMngr_H
#include <map>
#include "BPStructs.h"
struct TRectangle
{
int left, top, right, bottom;
};
class TextureMngr
{
public:
struct TCacheEntry
{
TCacheEntry() : texture(0), addr(0), hash(0), w(0), h(0), isRenderTarget(false), isUpsideDown(false), isNonPow2(true), bHaveMipMaps(false) { mode.hex = 0xFCFCFCFC; }
u32 texture;
u32 addr;
u32 hash;
u32 paletteHash;
u32 hashoffset;
u32 oldpixel; // used for simple cleanup
TexMode0 mode; // current filter and clamp modes that texture is set to
int frameCount;
int w,h,fmt;
bool isRenderTarget; // if render texture, then rendertex is filled with the direct copy of the render target
// later conversions would have to convert properly from rendertexfmt to texfmt
bool isUpsideDown;
bool isNonPow2; // if nonpow2, use GL_TEXTURE_2D, else GL_TEXTURE_RECTANGLE_NV
bool bHaveMipMaps;
void SetTextureParameters(TexMode0& newmode);
void Destroy();
void ConvertFromRenderTarget(u32 taddr, int twidth, int theight, int tformat, int tlutaddr, int tlutfmt);
};
struct DEPTHTARGET
{
DEPTHTARGET() : targ(0), framecount(0) {}
GLuint targ;
int framecount;
};
private:
typedef std::map<u32,TCacheEntry> TexCache;
static u8 *temp;
static TexCache textures;
static std::map<u32, DEPTHTARGET> mapDepthTargets;
static int nTex2DEnabled, nTexRECTEnabled;
public:
static void Init();
static void Cleanup();
static void Shutdown();
static void Invalidate();
static TCacheEntry* Load(int texstage, u32 address, int width, int height, int format, int tlutaddr, int tlutfmt);
static void CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyfmt, bool bScaleByHalf, TRectangle *source);
static void EnableTex2D(int stage);
static void EnableTexRECT(int stage);
static void DisableStage(int stage); // sets active texture
};
#endif