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
|
2012-09-09 18:16:11 +00:00
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 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-12-21 23:09:36 +00:00
|
|
|
enum {RenderTarget = 1, DepthStencil, Texture, Offscreen, Backbuffer};
|
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;
|
2016-02-24 21:52:17 +00:00
|
|
|
virtual bool Save(const string& fn, bool user_image = false, bool dds = false) = 0;
|
2015-05-12 15:41:41 +00:00
|
|
|
virtual uint32 GetID() { return 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;
|
2015-07-10 19:11:14 +00:00
|
|
|
|
|
|
|
// Typical size of a RGBA texture
|
|
|
|
virtual uint32 GetMemUsage() { return m_size.x * m_size.y * 4; }
|
2009-02-09 21:15:56 +00:00
|
|
|
};
|