| 
									
										
										
										
											2015-05-24 06:55:12 +02:00
										 |  |  | // Copyright 2008 Dolphin Emulator Project
 | 
					
						
							| 
									
										
										
										
											2015-05-18 01:08:10 +02:00
										 |  |  | // Licensed under GPLv2+
 | 
					
						
							| 
									
										
										
										
											2013-04-17 23:09:55 -04:00
										 |  |  | // Refer to the license.txt file included.
 | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-10 13:54:46 -05:00
										 |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-17 16:54:31 -05:00
										 |  |  | #include "Common/CommonTypes.h"
 | 
					
						
							| 
									
										
										
										
											2014-02-10 13:54:46 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-10-29 01:23:17 -04:00
										 |  |  | enum | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2015-02-15 14:43:31 -05:00
										 |  |  | 	TMEM_SIZE = 1024 * 1024, | 
					
						
							| 
									
										
										
										
											2012-01-29 21:17:22 +01:00
										 |  |  | 	TMEM_LINE_SIZE = 32, | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2015-09-05 11:44:21 -04:00
										 |  |  | alignas(16) extern u8 texMem[TMEM_SIZE]; | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | enum TextureFormat | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2015-09-05 18:33:50 +12:00
										 |  |  | 	// These are the texture formats that can be read by the texture mapper.
 | 
					
						
							| 
									
										
										
										
											2013-03-19 21:51:12 -04: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-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-05 18:33:50 +12:00
										 |  |  | 	_GX_TF_ZTF = 0x10,  // flag for Z texture formats (used internally by dolphin)
 | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-05 18:33:50 +12:00
										 |  |  | 	// Depth texture formats (which directly map to the equivalent colour format above.)
 | 
					
						
							|  |  |  | 	GX_TF_Z8     = 0x1 | _GX_TF_ZTF, | 
					
						
							|  |  |  | 	GX_TF_Z16    = 0x3 | _GX_TF_ZTF, | 
					
						
							|  |  |  | 	GX_TF_Z24X8  = 0x6 | _GX_TF_ZTF, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	_GX_TF_CTF   = 0x20,  // flag for copy-texture-format only (used internally by dolphin)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// These are extra formats that can be used when copying from efb,
 | 
					
						
							|  |  |  | 	// they use one of texel formats from above, but pack diffrent data into them.
 | 
					
						
							| 
									
										
										
										
											2013-03-19 21:51:12 -04:00
										 |  |  | 	GX_CTF_R4    = 0x0 | _GX_TF_CTF, | 
					
						
							|  |  |  | 	GX_CTF_RA4   = 0x2 | _GX_TF_CTF, | 
					
						
							|  |  |  | 	GX_CTF_RA8   = 0x3 | _GX_TF_CTF, | 
					
						
							| 
									
										
										
										
											2015-09-05 18:33:50 +12:00
										 |  |  | 	GX_CTF_YUVA8 = 0x6 | _GX_TF_CTF, // YUV 4:4:4 - Dolphin doesn't implement this format as no commercial games use it
 | 
					
						
							| 
									
										
										
										
											2013-03-19 21:51:12 -04:00
										 |  |  | 	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-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-05 18:33:50 +12:00
										 |  |  | 	// extra depth texture formats that can be used for efb copies.
 | 
					
						
							| 
									
										
										
										
											2013-03-19 21:51:12 -04:00
										 |  |  | 	GX_CTF_Z4    = 0x0 | _GX_TF_ZTF | _GX_TF_CTF, | 
					
						
							| 
									
										
										
										
											2015-09-05 02:45:29 +12:00
										 |  |  | 	GX_CTF_Z8H   = 0x8 | _GX_TF_ZTF | _GX_TF_CTF, // This produces an identical result to to GX_TF_Z8
 | 
					
						
							| 
									
										
										
										
											2013-03-19 21:51:12 -04:00
										 |  |  | 	GX_CTF_Z8M   = 0x9 | _GX_TF_ZTF | _GX_TF_CTF, | 
					
						
							|  |  |  | 	GX_CTF_Z8L   = 0xA | _GX_TF_ZTF | _GX_TF_CTF, | 
					
						
							| 
									
										
										
										
											2015-09-05 02:45:29 +12:00
										 |  |  | 	GX_CTF_Z16R  = 0xB | _GX_TF_ZTF | _GX_TF_CTF, // Reversed version of GX_TF_Z16
 | 
					
						
							| 
									
										
										
										
											2013-03-19 21:51:12 -04:00
										 |  |  | 	GX_CTF_Z16L  = 0xC | _GX_TF_ZTF | _GX_TF_CTF, | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-08-10 15:04:29 -04:00
										 |  |  | enum TlutFormat | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	GX_TL_IA8    = 0x0, | 
					
						
							|  |  |  | 	GX_TL_RGB565 = 0x1, | 
					
						
							|  |  |  | 	GX_TL_RGB5A3 = 0x2, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | int TexDecoder_GetTexelSizeInNibbles(int format); | 
					
						
							|  |  |  | int TexDecoder_GetTextureSizeInBytes(int width, int height, int format); | 
					
						
							| 
									
										
										
										
											2009-08-11 20:36:13 +00:00
										 |  |  | int TexDecoder_GetBlockWidthInTexels(u32 format); | 
					
						
							|  |  |  | int TexDecoder_GetBlockHeightInTexels(u32 format); | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | int TexDecoder_GetPaletteSize(int fmt); | 
					
						
							| 
									
										
										
										
											2015-12-01 05:07:36 +13:00
										 |  |  | int TexDecoder_GetEfbCopyBaseFormat(int format); | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-17 09:46:31 +01:00
										 |  |  | void TexDecoder_Decode(u8 *dst, const u8 *src, int width, int height, int texformat, const u8* tlut, TlutFormat tlutfmt); | 
					
						
							|  |  |  | void TexDecoder_DecodeRGBA8FromTmem(u8* dst, const u8 *src_ar, const u8 *src_gb, int width, int height); | 
					
						
							| 
									
										
										
										
											2014-08-10 15:28:42 -04:00
										 |  |  | void TexDecoder_DecodeTexel(u8 *dst, const u8 *src, int s, int t, int imageWidth, int texformat, const u8* tlut, TlutFormat tlutfmt); | 
					
						
							| 
									
										
										
										
											2013-01-09 10:19:18 +01:00
										 |  |  | void TexDecoder_DecodeTexelRGBA8FromTmem(u8 *dst, const u8 *src_ar, const u8* src_gb, int s, int t, int imageWidth); | 
					
						
							| 
									
										
										
										
											2014-07-12 10:49:24 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-08 04:46:09 +00:00
										 |  |  | void TexDecoder_SetTexFmtOverlayOptions(bool enable, bool center); | 
					
						
							| 
									
										
										
										
											2014-07-12 10:49:24 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Internal method, implemented by TextureDecoder_Generic and TextureDecoder_x64. */ | 
					
						
							| 
									
										
										
										
											2015-01-17 09:46:31 +01:00
										 |  |  | void _TexDecoder_DecodeImpl(u32 * dst, const u8 * src, int width, int height, int texformat, const u8* tlut, TlutFormat tlutfmt); |