VideoCommon: Abstract bounding box

This moves much of the duplicated bounding box code into VideoCommon,
leaving only the specific buffer implementations in each backend.
This commit is contained in:
Techjar
2021-06-09 07:42:21 -04:00
parent 7ec02ee4d3
commit 1161af8059
41 changed files with 617 additions and 708 deletions

View File

@ -38,6 +38,7 @@ class AbstractPipeline;
class AbstractShader;
class AbstractTexture;
class AbstractStagingTexture;
class BoundingBox;
class NativeVertexFormat;
class NetPlayChatUI;
class PointerWrap;
@ -213,8 +214,11 @@ public:
virtual u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data);
virtual void PokeEFB(EFBAccessType type, const EfbPokeData* points, size_t num_points);
u16 BBoxRead(int index);
void BBoxWrite(int index, u16 value);
bool IsBBoxEnabled() const;
void BBoxEnable();
void BBoxDisable();
u16 BBoxRead(u32 index);
void BBoxWrite(u32 index, u16 value);
void BBoxFlush();
virtual void Flush() {}
@ -303,9 +307,7 @@ protected:
// Should be called with the ImGui lock held.
void DrawImGui();
virtual u16 BBoxReadImpl(int index) = 0;
virtual void BBoxWriteImpl(int index, u16 value) = 0;
virtual void BBoxFlushImpl() {}
virtual std::unique_ptr<BoundingBox> CreateBoundingBox() const = 0;
AbstractFramebuffer* m_current_framebuffer = nullptr;
const AbstractPipeline* m_current_pipeline = nullptr;
@ -396,6 +398,8 @@ private:
u32 m_last_xfb_stride = 0;
u32 m_last_xfb_height = 0;
std::unique_ptr<BoundingBox> m_bounding_box;
// Nintendo's SDK seems to write "default" bounding box values before every draw (1023 0 1023 0
// are the only values encountered so far, which happen to be the extents allowed by the BP
// registers) to reset the registers for comparison in the pixel engine, and presumably to detect