VideoBackendBase: Convert EFBAccessType into an enum class

This commit is contained in:
Lioncash
2017-01-23 02:51:46 -05:00
parent a2caa0d733
commit 5b461f50af
12 changed files with 75 additions and 53 deletions

View File

@ -74,7 +74,7 @@ static const u32 EFB_CACHE_HEIGHT = (EFB_HEIGHT + EFB_CACHE_RECT_SIZE - 1) / EFB
static bool s_efbCacheValid[2][EFB_CACHE_WIDTH * EFB_CACHE_HEIGHT];
static bool s_efbCacheIsCleared = false;
static std::vector<u32>
s_efbCache[2][EFB_CACHE_WIDTH * EFB_CACHE_HEIGHT]; // 2 for PEEK_Z and PEEK_COLOR
s_efbCache[2][EFB_CACHE_WIDTH * EFB_CACHE_HEIGHT]; // 2 for PeekZ and PeekColor
static void APIENTRY ErrorCallback(GLenum source, GLenum type, GLuint id, GLenum severity,
GLsizei length, const char* message, const void* userParam)
@ -841,7 +841,7 @@ void ClearEFBCache()
void Renderer::UpdateEFBCache(EFBAccessType type, u32 cacheRectIdx, const EFBRectangle& efbPixelRc,
const TargetRectangle& targetPixelRc, const void* data)
{
u32 cacheType = (type == PEEK_Z ? 0 : 1);
const u32 cacheType = (type == EFBAccessType::PeekZ ? 0 : 1);
if (!s_efbCache[cacheType][cacheRectIdx].size())
s_efbCache[cacheType][cacheRectIdx].resize(EFB_CACHE_RECT_SIZE * EFB_CACHE_RECT_SIZE);
@ -862,7 +862,7 @@ void Renderer::UpdateEFBCache(EFBAccessType type, u32 cacheRectIdx, const EFBRec
u32 xPixel = (EFBToScaledX(xEFB) + EFBToScaledX(xEFB + 1)) / 2;
u32 xData = xPixel - targetPixelRc.left;
u32 value;
if (type == PEEK_Z)
if (type == EFBAccessType::PeekZ)
{
float* ptr = (float*)data;
value = MathUtil::Clamp<u32>((u32)(ptr[yData * targetPixelRcWidth + xData] * 16777216.0f),
@ -901,7 +901,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
EFBRectangle efbPixelRc;
if (type == PEEK_COLOR || type == PEEK_Z)
if (type == EFBAccessType::PeekColor || type == EFBAccessType::PeekZ)
{
// Get the rectangular target region containing the EFB pixel
efbPixelRc.left = (x / EFB_CACHE_RECT_SIZE) * EFB_CACHE_RECT_SIZE;
@ -924,7 +924,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
// TODO (FIX) : currently, AA path is broken/offset and doesn't return the correct pixel
switch (type)
{
case PEEK_Z:
case EFBAccessType::PeekZ:
{
if (!s_efbCacheValid[0][cacheRectIdx])
{
@ -958,7 +958,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
return z;
}
case PEEK_COLOR: // GXPeekARGB
case EFBAccessType::PeekColor: // GXPeekARGB
{
// Although it may sound strange, this really is A8R8G8B8 and not RGBA or 24-bit...