1
// Copyright (c) 2012- PPSSPP 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 or later versions.
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 git repository and contact information can be found at
16
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
19
// Has to be included before TextureScaler.h, else we get those std::bind errors in VS2012..
20
#include "../native/base/basictypes.h"
24
#include "gfx/gl_common.h"
26
#include "GPU/Common/TextureScalerCommon.h"
27
#include "GPU/GLES/TextureScaler.h"
28
#include "Common/ColorConv.h"
29
#include "Common/Log.h"
30
#include "Common/ThreadPools.h"
32
int TextureScalerGL::BytesPerPixel(u32 format) {
33
return (format == GL_UNSIGNED_BYTE) ? 4 : 2;
36
u32 TextureScalerGL::Get8888Format() {
37
return GL_UNSIGNED_BYTE;
40
void TextureScalerGL::ConvertTo8888(u32 format, u32* source, u32* &dest, int width, int height) {
42
case GL_UNSIGNED_BYTE:
43
dest = source; // already fine
46
case GL_UNSIGNED_SHORT_4_4_4_4:
47
GlobalThreadPool::Loop(std::bind(&convert4444_gl, (u16*)source, dest, width, placeholder::_1, placeholder::_2), 0, height);
50
case GL_UNSIGNED_SHORT_5_6_5:
51
GlobalThreadPool::Loop(std::bind(&convert565_gl, (u16*)source, dest, width, placeholder::_1, placeholder::_2), 0, height);
54
case GL_UNSIGNED_SHORT_5_5_5_1:
55
GlobalThreadPool::Loop(std::bind(&convert5551_gl, (u16*)source, dest, width, placeholder::_1, placeholder::_2), 0, height);
60
ERROR_LOG(G3D, "iXBRZTexScaling: unsupported texture format");