summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/EFBInterface.h
blob: 414b84c43645fa3b0de13778b9e23792f9d8d452 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2025 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include <memory>

#include "Common/CommonTypes.h"

enum class EFBReinterpretType;

class EFBInterfaceBase
{
public:
  virtual ~EFBInterfaceBase();

  virtual void ReinterpretPixelData(EFBReinterpretType convtype) = 0;

  virtual void PokeColor(u16 x, u16 y, u32 color) = 0;
  virtual void PokeDepth(u16 x, u16 y, u32 depth) = 0;

  u32 PeekColor(u16 x, u16 y);
  u32 PeekDepth(u16 x, u16 y);

protected:
  bool ShouldSkipAccess(u16 x, u16 y) const;

  virtual u32 PeekColorInternal(u16 x, u16 y) = 0;
  virtual u32 PeekDepthInternal(u16 x, u16 y) = 0;
};

class HardwareEFBInterface 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;
  u32 PeekDepthInternal(u16 x, u16 y) override;
};

extern std::unique_ptr<EFBInterfaceBase> g_efb_interface;