2015-05-24 06:55:12 +02:00
|
|
|
// Copyright 2009 Dolphin Emulator Project
|
2021-07-05 03:22:19 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2014-02-10 13:54:46 -05:00
|
|
|
#pragma once
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2016-01-17 16:54:31 -05:00
|
|
|
#include "Common/CommonTypes.h"
|
2019-07-16 20:18:48 -04:00
|
|
|
#include "Common/MathUtil.h"
|
2025-03-11 21:12:06 -05:00
|
|
|
#include "VideoCommon/EFBInterface.h"
|
2016-01-17 16:54:31 -05:00
|
|
|
#include "VideoCommon/PerfQueryBase.h"
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2009-10-12 00:48:24 +00:00
|
|
|
namespace EfbInterface
|
|
|
|
{
|
2013-08-23 00:07:21 +12:00
|
|
|
// xfb color format - packed so the compiler doesn't mess with alignment
|
2013-08-21 00:56:19 +12:00
|
|
|
#pragma pack(push, 1)
|
2014-07-23 20:26:54 -04:00
|
|
|
struct yuv422_packed
|
|
|
|
{
|
2013-08-20 23:51:39 +12:00
|
|
|
u8 Y;
|
|
|
|
u8 UV;
|
2014-07-23 20:26:54 -04:00
|
|
|
};
|
2013-08-21 00:56:19 +12:00
|
|
|
#pragma pack(pop)
|
2013-08-20 23:51:39 +12:00
|
|
|
|
2013-08-21 00:56:19 +12:00
|
|
|
// But this struct is only used internally, so we could optimise alignment
|
2014-07-23 20:26:54 -04:00
|
|
|
struct yuv444
|
|
|
|
{
|
2013-08-20 23:51:39 +12:00
|
|
|
u8 Y;
|
|
|
|
s8 U;
|
|
|
|
s8 V;
|
2014-07-23 20:26:54 -04:00
|
|
|
};
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2014-08-10 21:18:38 -04:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ALP_C,
|
|
|
|
BLU_C,
|
|
|
|
GRN_C,
|
|
|
|
RED_C
|
|
|
|
};
|
2013-08-23 00:07:21 +12:00
|
|
|
|
|
|
|
// color order is ABGR in order to emulate RGBA on little-endian hardware
|
|
|
|
|
2009-10-12 00:48:24 +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
|
|
|
|
2009-10-12 00:48:24 +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
|
|
|
|
2009-10-12 00:48:24 +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
|
|
|
|
2009-10-12 00:48:24 +00:00
|
|
|
u8* GetPixelPointer(u16 x, u16 y, bool depth);
|
2010-06-09 01:37:08 +00:00
|
|
|
|
2019-04-16 00:47:46 +10:00
|
|
|
void EncodeXFB(u8* xfb_in_ram, u32 memory_stride, const MathUtil::Rectangle<int>& source_rect,
|
|
|
|
float y_scale, float gamma);
|
2013-08-20 23:51:39 +12:00
|
|
|
|
2018-05-18 15:13:03 -04:00
|
|
|
u32 GetPerfQueryResult(PerfQueryType type);
|
|
|
|
void ResetPerfQuery();
|
|
|
|
void IncPerfCounterQuadCount(PerfQueryType type);
|
|
|
|
} // namespace EfbInterface
|
2025-03-11 21:12:06 -05:00
|
|
|
|
|
|
|
namespace SW
|
|
|
|
{
|
|
|
|
class SWEFBInterface final : public EFBInterfaceBase
|
|
|
|
{
|
|
|
|
void ReinterpretPixelData(EFBReinterpretType convtype) override;
|
|
|
|
|
|
|
|
void PokeColor(u16 x, u16 y, u32 color) override;
|
|
|
|
void PokeDepth(u16 x, u16 y, u32 depth) override;
|
|
|
|
|
|
|
|
u32 PeekColorInternal(u16 x, u16 y) override;
|
2025-03-26 00:55:40 -05:00
|
|
|
u32 PeekDepthInternal(u16 x, u16 y) override;
|
2025-03-11 21:12:06 -05:00
|
|
|
};
|
|
|
|
} // namespace SW
|