2010-04-25 00:31:27 +00:00
|
|
|
/*
|
2009-02-09 21:15:56 +00:00
|
|
|
* Copyright (C) 2007-2009 Gabest
|
|
|
|
* http://www.gabest.org
|
|
|
|
*
|
|
|
|
* This Program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-02-09 21:15:56 +00:00
|
|
|
* This Program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-02-09 21:15:56 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with GNU Make; see the file COPYING. If not, write to
|
2010-04-25 00:31:27 +00:00
|
|
|
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
2009-02-09 21:15:56 +00:00
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "GSVector.h"
|
|
|
|
|
|
|
|
class GSTexture
|
|
|
|
{
|
2009-08-02 23:07:30 +00:00
|
|
|
protected:
|
2009-02-09 21:15:56 +00:00
|
|
|
GSVector2 m_scale;
|
2009-07-16 21:36:07 +00:00
|
|
|
GSVector2i m_size;
|
2009-08-02 23:07:30 +00:00
|
|
|
int m_type;
|
|
|
|
int m_format;
|
|
|
|
bool m_msaa;
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2009-08-02 23:07:30 +00:00
|
|
|
public:
|
2009-06-12 19:09:17 +00:00
|
|
|
struct GSMap {uint8* bits; int pitch;};
|
|
|
|
|
2011-02-23 09:16:00 +00:00
|
|
|
enum {RenderTarget = 1, DepthStencil, Texture, Offscreen};
|
2009-06-12 19:09:17 +00:00
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
public:
|
2009-08-02 23:07:30 +00:00
|
|
|
GSTexture();
|
2009-02-09 21:15:56 +00:00
|
|
|
virtual ~GSTexture() {}
|
|
|
|
|
2009-06-12 19:09:17 +00:00
|
|
|
virtual operator bool() {ASSERT(0); return false;}
|
2009-06-06 10:11:22 +00:00
|
|
|
|
2009-05-14 16:41:52 +00:00
|
|
|
virtual bool Update(const GSVector4i& r, const void* data, int pitch) = 0;
|
2009-06-12 19:09:17 +00:00
|
|
|
virtual bool Map(GSMap& m, const GSVector4i* r = NULL) = 0;
|
2009-02-09 21:15:56 +00:00
|
|
|
virtual void Unmap() = 0;
|
2009-05-11 08:18:00 +00:00
|
|
|
virtual bool Save(const string& fn, bool dds = false) = 0;
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2009-08-02 23:07:30 +00:00
|
|
|
GSVector2 GetScale() const {return m_scale;}
|
|
|
|
void SetScale(const GSVector2& scale) {m_scale = scale;}
|
|
|
|
|
2009-07-16 21:36:07 +00:00
|
|
|
int GetWidth() const {return m_size.x;}
|
|
|
|
int GetHeight() const {return m_size.y;}
|
|
|
|
GSVector2i GetSize() const {return m_size;}
|
2009-08-02 23:07:30 +00:00
|
|
|
|
|
|
|
int GetType() const {return m_type;}
|
|
|
|
int GetFormat() const {return m_format;}
|
|
|
|
|
|
|
|
bool IsMSAA() const {return m_msaa;}
|
2010-05-23 15:33:50 +00:00
|
|
|
|
|
|
|
// frame number (arbitrary base) the texture was recycled on
|
|
|
|
// different purpose than texture cache ages, do not attempt to merge
|
|
|
|
unsigned last_frame_used;
|
|
|
|
|
2010-05-15 04:51:15 +00:00
|
|
|
bool LikelyOffset;
|
|
|
|
float OffsetHack_modx;
|
|
|
|
float OffsetHack_mody;
|
2009-02-09 21:15:56 +00:00
|
|
|
};
|