2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2009 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2013-04-18 03:29:41 +00:00
|
|
|
// Refer to the license.txt file included.
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2014-02-10 18:54:46 +00:00
|
|
|
#pragma once
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "VideoCommon/VideoCommon.h"
|
2010-06-09 01:37:08 +00:00
|
|
|
|
|
|
|
namespace EfbInterface
|
|
|
|
{
|
2013-04-14 03:54:02 +00:00
|
|
|
const int DEPTH_BUFFER_START = EFB_WIDTH * EFB_HEIGHT * 3;
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2013-08-22 12:07:21 +00:00
|
|
|
// xfb color format - packed so the compiler doesn't mess with alignment
|
2013-08-20 12:56:19 +00:00
|
|
|
#pragma pack(push,1)
|
2014-07-24 00:26:54 +00:00
|
|
|
struct yuv422_packed
|
|
|
|
{
|
2013-08-20 11:51:39 +00:00
|
|
|
u8 Y;
|
|
|
|
u8 UV;
|
2014-07-24 00:26:54 +00:00
|
|
|
};
|
2013-08-20 12:56:19 +00:00
|
|
|
#pragma pack(pop)
|
2013-08-20 11:51:39 +00:00
|
|
|
|
2013-08-20 12:56:19 +00:00
|
|
|
// But this struct is only used internally, so we could optimise alignment
|
2014-07-24 00:26:54 +00:00
|
|
|
struct yuv444
|
|
|
|
{
|
2013-08-20 11:51:39 +00:00
|
|
|
u8 Y;
|
|
|
|
s8 U;
|
|
|
|
s8 V;
|
2014-07-24 00:26:54 +00:00
|
|
|
};
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2014-08-11 01:18:38 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ALP_C,
|
|
|
|
BLU_C,
|
|
|
|
GRN_C,
|
|
|
|
RED_C
|
|
|
|
};
|
2013-08-22 12:07:21 +00:00
|
|
|
|
|
|
|
// color order is ABGR in order to emulate RGBA on little-endian hardware
|
|
|
|
|
2013-04-14 03:54:02 +00:00
|
|
|
// does full blending of an incoming pixel
|
|
|
|
void BlendTev(u16 x, u16 y, u8 *color);
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2013-04-14 03:54:02 +00:00
|
|
|
// compare z at location x,y
|
|
|
|
// writes it if it passes
|
|
|
|
// returns result of compare.
|
|
|
|
bool ZCompare(u16 x, u16 y, u32 z);
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2013-04-14 03:54:02 +00:00
|
|
|
// sets the color and alpha
|
|
|
|
void SetColor(u16 x, u16 y, u8 *color);
|
|
|
|
void SetDepth(u16 x, u16 y, u32 depth);
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2013-04-14 03:54:02 +00:00
|
|
|
void GetColor(u16 x, u16 y, u8 *color);
|
2013-08-20 11:51:39 +00:00
|
|
|
void GetColorYUV(u16 x, u16 y, yuv444 *color);
|
2013-04-14 03:54:02 +00:00
|
|
|
u32 GetDepth(u16 x, u16 y);
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2013-04-14 03:54:02 +00:00
|
|
|
u8* GetPixelPointer(u16 x, u16 y, bool depth);
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2013-08-20 11:51:39 +00:00
|
|
|
void CopyToXFB(yuv422_packed* xfb_in_ram, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc, float Gamma);
|
2013-11-23 07:04:37 +00:00
|
|
|
void BypassXFB(u8* texture, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc, float Gamma);
|
2013-08-20 11:51:39 +00:00
|
|
|
|
2013-02-26 01:05:02 +00:00
|
|
|
void DoState(PointerWrap &p);
|
2014-03-29 02:22:15 +00:00
|
|
|
|
|
|
|
extern u32 perf_values[PQ_NUM_MEMBERS];
|
2014-04-05 20:08:00 +00:00
|
|
|
inline void IncPerfCounterQuadCount(PerfQueryType type)
|
|
|
|
{
|
2014-03-29 02:22:15 +00:00
|
|
|
// NOTE: hardware doesn't process individual pixels but quads instead.
|
|
|
|
// Current software renderer architecture works on pixels though, so
|
|
|
|
// we have this "quad" hack here to only increment the registers on
|
|
|
|
// every fourth rendered pixel
|
|
|
|
static u32 quad[PQ_NUM_MEMBERS];
|
|
|
|
if (++quad[type] != 3)
|
|
|
|
return;
|
|
|
|
quad[type] = 0;
|
|
|
|
++perf_values[type];
|
|
|
|
}
|
2010-06-09 01:37:08 +00:00
|
|
|
}
|