2013-04-17 21:09:55 -06:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2014-02-10 11:54:46 -07:00
|
|
|
#pragma once
|
|
|
|
|
2014-02-17 03:18:15 -07:00
|
|
|
#include "Common/Hash.h"
|
2014-02-10 11:54:46 -07:00
|
|
|
|
2013-10-28 23:23:17 -06:00
|
|
|
enum
|
2008-12-07 21:46:09 -07:00
|
|
|
{
|
2012-01-29 13:17:22 -07:00
|
|
|
TMEM_SIZE = 1024*1024,
|
|
|
|
TMEM_LINE_SIZE = 32,
|
2008-12-07 21:46:09 -07:00
|
|
|
};
|
2011-02-25 13:35:05 -07:00
|
|
|
extern GC_ALIGNED16(u8 texMem[TMEM_SIZE]);
|
2008-12-07 21:46:09 -07:00
|
|
|
|
|
|
|
enum TextureFormat
|
|
|
|
{
|
2013-03-19 19:51:12 -06:00
|
|
|
GX_TF_I4 = 0x0,
|
|
|
|
GX_TF_I8 = 0x1,
|
|
|
|
GX_TF_IA4 = 0x2,
|
|
|
|
GX_TF_IA8 = 0x3,
|
|
|
|
GX_TF_RGB565 = 0x4,
|
|
|
|
GX_TF_RGB5A3 = 0x5,
|
|
|
|
GX_TF_RGBA8 = 0x6,
|
|
|
|
GX_TF_C4 = 0x8,
|
|
|
|
GX_TF_C8 = 0x9,
|
|
|
|
GX_TF_C14X2 = 0xA,
|
|
|
|
GX_TF_CMPR = 0xE,
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2013-03-19 19:51:12 -06:00
|
|
|
_GX_TF_CTF = 0x20, // copy-texture-format only (simply means linear?)
|
|
|
|
_GX_TF_ZTF = 0x10, // Z-texture-format
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2013-03-19 19:51:12 -06:00
|
|
|
// these formats are also valid when copying targets
|
|
|
|
GX_CTF_R4 = 0x0 | _GX_TF_CTF,
|
|
|
|
GX_CTF_RA4 = 0x2 | _GX_TF_CTF,
|
|
|
|
GX_CTF_RA8 = 0x3 | _GX_TF_CTF,
|
|
|
|
GX_CTF_YUVA8 = 0x6 | _GX_TF_CTF,
|
|
|
|
GX_CTF_A8 = 0x7 | _GX_TF_CTF,
|
|
|
|
GX_CTF_R8 = 0x8 | _GX_TF_CTF,
|
|
|
|
GX_CTF_G8 = 0x9 | _GX_TF_CTF,
|
|
|
|
GX_CTF_B8 = 0xA | _GX_TF_CTF,
|
|
|
|
GX_CTF_RG8 = 0xB | _GX_TF_CTF,
|
|
|
|
GX_CTF_GB8 = 0xC | _GX_TF_CTF,
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2013-03-19 19:51:12 -06:00
|
|
|
GX_TF_Z8 = 0x1 | _GX_TF_ZTF,
|
|
|
|
GX_TF_Z16 = 0x3 | _GX_TF_ZTF,
|
|
|
|
GX_TF_Z24X8 = 0x6 | _GX_TF_ZTF,
|
2008-12-07 21:46:09 -07:00
|
|
|
|
2013-03-19 19:51:12 -06:00
|
|
|
GX_CTF_Z4 = 0x0 | _GX_TF_ZTF | _GX_TF_CTF,
|
|
|
|
GX_CTF_Z8M = 0x9 | _GX_TF_ZTF | _GX_TF_CTF,
|
|
|
|
GX_CTF_Z8L = 0xA | _GX_TF_ZTF | _GX_TF_CTF,
|
|
|
|
GX_CTF_Z16L = 0xC | _GX_TF_ZTF | _GX_TF_CTF,
|
2008-12-07 21:46:09 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
int TexDecoder_GetTexelSizeInNibbles(int format);
|
|
|
|
int TexDecoder_GetTextureSizeInBytes(int width, int height, int format);
|
2009-08-11 14:36:13 -06:00
|
|
|
int TexDecoder_GetBlockWidthInTexels(u32 format);
|
|
|
|
int TexDecoder_GetBlockHeightInTexels(u32 format);
|
2008-12-07 21:46:09 -07:00
|
|
|
int TexDecoder_GetPaletteSize(int fmt);
|
|
|
|
|
|
|
|
enum PC_TexFormat
|
|
|
|
{
|
2009-05-09 01:55:30 -06:00
|
|
|
PC_TEX_FMT_NONE = 0,
|
|
|
|
PC_TEX_FMT_BGRA32,
|
|
|
|
PC_TEX_FMT_RGBA32,
|
2009-05-12 20:06:02 -06:00
|
|
|
PC_TEX_FMT_I4_AS_I8,
|
|
|
|
PC_TEX_FMT_IA4_AS_IA8,
|
2009-05-09 01:55:30 -06:00
|
|
|
PC_TEX_FMT_I8,
|
|
|
|
PC_TEX_FMT_IA8,
|
|
|
|
PC_TEX_FMT_RGB565,
|
|
|
|
PC_TEX_FMT_DXT1,
|
2008-12-07 21:46:09 -07:00
|
|
|
};
|
|
|
|
|
2010-06-19 07:31:40 -06:00
|
|
|
PC_TexFormat TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, int texformat, int tlutaddr, int tlutfmt,bool rgbaOnly = false);
|
2009-12-07 11:48:31 -07:00
|
|
|
PC_TexFormat GetPC_TexFormat(int texformat, int tlutfmt);
|
2009-10-10 15:19:39 -06:00
|
|
|
void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth, int texformat, int tlutaddr, int tlutfmt);
|
2013-01-09 02:19:18 -07:00
|
|
|
void TexDecoder_DecodeTexelRGBA8FromTmem(u8 *dst, const u8 *src_ar, const u8* src_gb, int s, int t, int imageWidth);
|
2013-01-10 07:12:21 -07:00
|
|
|
PC_TexFormat TexDecoder_DecodeRGBA8FromTmem(u8* dst, const u8 *src_ar, const u8 *src_gb, int width, int height);
|
2008-12-07 21:46:09 -07:00
|
|
|
void TexDecoder_SetTexFmtOverlayOptions(bool enable, bool center);
|