2011-11-16 22:17:37 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2011-2011 Gregory hainaut
|
|
|
|
* Copyright (C) 2007-2009 Gabest
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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.
|
2011-11-16 22:17:37 +00:00
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "GSTexture.h"
|
|
|
|
|
2013-08-17 09:05:41 +00:00
|
|
|
namespace PboPool {
|
2013-08-03 08:29:01 +00:00
|
|
|
void BindPbo();
|
|
|
|
void UnbindPbo();
|
2013-08-17 09:05:41 +00:00
|
|
|
void NextPbo();
|
2015-05-15 16:32:47 +00:00
|
|
|
void NextPboWithSync();
|
2013-08-17 09:05:41 +00:00
|
|
|
|
|
|
|
char* Map(uint32 size);
|
|
|
|
void Unmap();
|
|
|
|
uint32 Offset();
|
|
|
|
void EndTransfer();
|
2013-08-03 08:29:01 +00:00
|
|
|
|
|
|
|
void Init();
|
|
|
|
void Destroy();
|
|
|
|
}
|
|
|
|
|
2011-11-16 22:17:37 +00:00
|
|
|
class GSTextureOGL : public GSTexture
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
GLuint m_texture_id; // the texture id
|
2011-12-23 12:32:40 +00:00
|
|
|
int m_pbo_size;
|
2012-01-08 21:59:42 +00:00
|
|
|
GLuint m_fbo_read;
|
2015-04-30 17:38:30 +00:00
|
|
|
bool m_dirty;
|
2015-05-12 16:03:06 +00:00
|
|
|
bool m_clean;
|
2011-11-16 22:17:37 +00:00
|
|
|
|
2015-05-18 09:29:04 +00:00
|
|
|
uint8* m_local_buffer;
|
|
|
|
|
2013-08-02 16:38:12 +00:00
|
|
|
// internal opengl format/type/alignment
|
|
|
|
GLenum m_int_format;
|
|
|
|
GLenum m_int_type;
|
|
|
|
uint32 m_int_alignment;
|
|
|
|
uint32 m_int_shift;
|
|
|
|
|
2013-08-17 08:57:52 +00:00
|
|
|
GLuint64 m_handles[12];
|
|
|
|
|
2011-11-16 22:17:37 +00:00
|
|
|
public:
|
2013-07-19 19:25:50 +00:00
|
|
|
explicit GSTextureOGL(int type, int w, int h, int format, GLuint fbo_read);
|
2011-11-16 22:17:37 +00:00
|
|
|
virtual ~GSTextureOGL();
|
|
|
|
|
2015-04-30 17:38:30 +00:00
|
|
|
void Invalidate();
|
2011-11-16 22:17:37 +00:00
|
|
|
bool Update(const GSVector4i& r, const void* data, int pitch);
|
|
|
|
bool Map(GSMap& m, const GSVector4i* r = NULL);
|
|
|
|
void Unmap();
|
|
|
|
bool Save(const string& fn, bool dds = false);
|
2012-01-02 20:08:11 +00:00
|
|
|
void Save(const string& fn, const void* image, uint32 pitch);
|
2011-11-21 22:36:03 +00:00
|
|
|
|
2011-12-21 23:09:36 +00:00
|
|
|
bool IsBackbuffer() { return (m_type == GSTexture::Backbuffer); }
|
2011-12-29 14:24:26 +00:00
|
|
|
bool IsDss() { return (m_type == GSTexture::DepthStencil); }
|
2012-01-31 17:08:05 +00:00
|
|
|
|
2015-05-12 15:41:41 +00:00
|
|
|
uint32 GetID() { return m_texture_id; }
|
2013-08-17 08:57:52 +00:00
|
|
|
GLuint64 GetHandle(GLuint sampler_id);
|
2015-05-15 13:24:43 +00:00
|
|
|
bool HasBeenCleaned() { return m_clean; }
|
2015-05-12 16:03:06 +00:00
|
|
|
void WasAttached() { m_clean = false; m_dirty = true; }
|
2015-05-15 13:24:43 +00:00
|
|
|
void WasCleaned() { m_clean = true; }
|
2011-11-16 22:17:37 +00:00
|
|
|
};
|