Play-/Source/gs/GsCachedArea.h

50 lines
992 B
C
Raw Permalink Normal View History

#pragma once
2015-03-09 23:17:00 -04:00
#include <utility>
#include "Types.h"
class CGsCachedArea
{
public:
typedef uint64 DirtyPageHolder;
2017-01-15 18:11:29 -05:00
struct PageRect
{
uint32 x;
uint32 y;
uint32 width;
uint32 height;
};
enum
{
MAX_DIRTYPAGES_SECTIONS = 8, //Needs to be enough to cover a 4MB area (4MB / 8192 = 512 = sizeof(uint64) * MAX_DIRTYPAGES_SECTIONS * 8)
MAX_DIRTYPAGES = sizeof(DirtyPageHolder) * MAX_DIRTYPAGES_SECTIONS * 8
};
2018-04-30 21:01:23 +01:00
CGsCachedArea();
2018-04-30 21:01:23 +01:00
void SetArea(uint32 psm, uint32 bufPtr, uint32 bufWidth, uint32 height);
2018-04-30 21:01:23 +01:00
PageRect GetAreaPageRect() const;
PageRect GetDirtyPageRect() const;
2018-04-30 21:01:23 +01:00
uint32 GetPageCount() const;
uint32 GetSize() const;
2018-04-30 21:01:23 +01:00
void Invalidate(uint32, uint32);
bool IsPageDirty(uint32) const;
void SetPageDirty(uint32);
bool HasDirtyPages() const;
void ClearDirtyPages();
void ClearDirtyPages(const PageRect&);
private:
2018-04-30 21:01:23 +01:00
uint32 m_psm = 0;
uint32 m_bufPtr = 0;
uint32 m_bufWidth = 0;
uint32 m_height = 0;
2018-04-30 21:01:23 +01:00
DirtyPageHolder m_dirtyPages[MAX_DIRTYPAGES_SECTIONS];
};