BPMemory: Expose the pixel_format and zformat fields in PE_CONTROL as enumerations.

This commit is contained in:
Tony Wasserka 2014-03-23 21:44:23 +01:00
parent 77a7bab5ae
commit 8941f19cdb
22 changed files with 160 additions and 157 deletions

View File

@ -246,7 +246,7 @@ void FifoPlaybackAnalyzer::StoreEfbCopyRegion()
UPE_Copy peCopy = m_BpMem.triggerEFBCopy; UPE_Copy peCopy = m_BpMem.triggerEFBCopy;
u32 copyfmt = peCopy.tp_realFormat(); u32 copyfmt = peCopy.tp_realFormat();
bool bFromZBuffer = m_BpMem.zcontrol.pixel_format == PIXELFMT_Z24; bool bFromZBuffer = m_BpMem.zcontrol.pixel_format == PEControl::Z24;
u32 address = bpmem.copyTexDest << 5; u32 address = bpmem.copyTexDest << 5;
u32 format = copyfmt; u32 format = copyfmt;

View File

@ -1031,8 +1031,8 @@ void PSTextureEncoder::Shutdown()
} }
size_t PSTextureEncoder::Encode(u8* dst, unsigned int dstFormat, size_t PSTextureEncoder::Encode(u8* dst, unsigned int dstFormat,
unsigned int srcFormat, const EFBRectangle& srcRect, bool isIntensity, PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
bool scaleByHalf) bool isIntensity, bool scaleByHalf)
{ {
if (!m_ready) // Make sure we initialized OK if (!m_ready) // Make sure we initialized OK
return 0; return 0;
@ -1122,7 +1122,7 @@ size_t PSTextureEncoder::Encode(u8* dst, unsigned int dstFormat,
D3D::context->OMSetRenderTargets(1, &m_outRTV, nullptr); D3D::context->OMSetRenderTargets(1, &m_outRTV, nullptr);
ID3D11ShaderResourceView* pEFB = (srcFormat == PIXELFMT_Z24) ? ID3D11ShaderResourceView* pEFB = (srcFormat == PEControl::Z24) ?
FramebufferManager::GetEFBDepthTexture()->GetSRV() : FramebufferManager::GetEFBDepthTexture()->GetSRV() :
// FIXME: Instead of resolving EFB, it would be better to pick out a // FIXME: Instead of resolving EFB, it would be better to pick out a
// single sample from each pixel. The game may break if it isn't // single sample from each pixel. The game may break if it isn't
@ -1208,10 +1208,10 @@ static const char* INTENSITY_FUNC_NAMES[2] = {
"Intensity_0", "Intensity_1" "Intensity_0", "Intensity_1"
}; };
bool PSTextureEncoder::SetStaticShader(unsigned int dstFormat, unsigned int srcFormat, bool PSTextureEncoder::SetStaticShader(unsigned int dstFormat, PEControl::PixelFormat srcFormat,
bool isIntensity, bool scaleByHalf) bool isIntensity, bool scaleByHalf)
{ {
size_t fetchNum = srcFormat; size_t fetchNum = static_cast<size_t>(srcFormat);
size_t scaledFetchNum = scaleByHalf ? 1 : 0; size_t scaledFetchNum = scaleByHalf ? 1 : 0;
size_t intensityNum = isIntensity ? 1 : 0; size_t intensityNum = isIntensity ? 1 : 0;
size_t generatorNum = dstFormat; size_t generatorNum = dstFormat;
@ -1244,7 +1244,7 @@ bool PSTextureEncoder::SetStaticShader(unsigned int dstFormat, unsigned int srcF
} }
INFO_LOG(VIDEO, "Compiling efb encoding shader for dstFormat 0x%X, srcFormat %d, isIntensity %d, scaleByHalf %d", INFO_LOG(VIDEO, "Compiling efb encoding shader for dstFormat 0x%X, srcFormat %d, isIntensity %d, scaleByHalf %d",
dstFormat, srcFormat, isIntensity ? 1 : 0, scaleByHalf ? 1 : 0); dstFormat, static_cast<int>(srcFormat), isIntensity ? 1 : 0, scaleByHalf ? 1 : 0);
// Shader permutation not found, so compile it // Shader permutation not found, so compile it
D3DBlob* bytecode = nullptr; D3DBlob* bytecode = nullptr;
@ -1258,7 +1258,7 @@ bool PSTextureEncoder::SetStaticShader(unsigned int dstFormat, unsigned int srcF
if (!D3D::CompilePixelShader(EFB_ENCODE_PS, sizeof(EFB_ENCODE_PS), &bytecode, macros)) if (!D3D::CompilePixelShader(EFB_ENCODE_PS, sizeof(EFB_ENCODE_PS), &bytecode, macros))
{ {
WARN_LOG(VIDEO, "EFB encoder shader for dstFormat 0x%X, srcFormat %d, isIntensity %d, scaleByHalf %d failed to compile", WARN_LOG(VIDEO, "EFB encoder shader for dstFormat 0x%X, srcFormat %d, isIntensity %d, scaleByHalf %d failed to compile",
dstFormat, srcFormat, isIntensity ? 1 : 0, scaleByHalf ? 1 : 0); dstFormat, static_cast<int>(srcFormat), isIntensity ? 1 : 0, scaleByHalf ? 1 : 0);
// Add dummy shader to map to prevent trying to compile over and // Add dummy shader to map to prevent trying to compile over and
// over again // over again
m_staticShaders[key] = nullptr; m_staticShaders[key] = nullptr;
@ -1369,9 +1369,9 @@ static const char* INTENSITY_CLASS_NAMES[2] = {
}; };
bool PSTextureEncoder::SetDynamicShader(unsigned int dstFormat, bool PSTextureEncoder::SetDynamicShader(unsigned int dstFormat,
unsigned int srcFormat, bool isIntensity, bool scaleByHalf) PEControl::PixelFormat srcFormat, bool isIntensity, bool scaleByHalf)
{ {
size_t fetchNum = srcFormat; size_t fetchNum = static_cast<size_t>(srcFormat);
size_t scaledFetchNum = scaleByHalf ? 1 : 0; size_t scaledFetchNum = scaleByHalf ? 1 : 0;
size_t intensityNum = isIntensity ? 1 : 0; size_t intensityNum = isIntensity ? 1 : 0;
size_t generatorNum = dstFormat; size_t generatorNum = dstFormat;

View File

@ -32,8 +32,8 @@ public:
void Init(); void Init();
void Shutdown(); void Shutdown();
size_t Encode(u8* dst, unsigned int dstFormat, size_t Encode(u8* dst, unsigned int dstFormat,
unsigned int srcFormat, const EFBRectangle& srcRect, bool isIntensity, PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
bool scaleByHalf); bool isIntensity, bool scaleByHalf);
private: private:
@ -54,15 +54,15 @@ private:
// Stuff only used in static-linking mode (SM4.0-compatible) // Stuff only used in static-linking mode (SM4.0-compatible)
bool InitStaticMode(); bool InitStaticMode();
bool SetStaticShader(unsigned int dstFormat, unsigned int srcFormat, bool SetStaticShader(unsigned int dstFormat,
bool isIntensity, bool scaleByHalf); PEControl::PixelFormat srcFormat, bool isIntensity, bool scaleByHalf);
typedef unsigned int ComboKey; // Key for a shader combination typedef unsigned int ComboKey; // Key for a shader combination
ComboKey MakeComboKey(unsigned int dstFormat, unsigned int srcFormat, ComboKey MakeComboKey(unsigned int dstFormat,
bool isIntensity, bool scaleByHalf) PEControl::PixelFormat srcFormat, bool isIntensity, bool scaleByHalf)
{ {
return (dstFormat << 4) | (srcFormat << 2) | (isIntensity ? (1<<1) : 0) return (dstFormat << 4) | (static_cast<int>(srcFormat) << 2) | (isIntensity ? (1<<1) : 0)
| (scaleByHalf ? (1<<0) : 0); | (scaleByHalf ? (1<<0) : 0);
} }
@ -74,8 +74,8 @@ private:
// Microsoft fixes their bloody HLSL compiler) // Microsoft fixes their bloody HLSL compiler)
bool InitDynamicMode(); bool InitDynamicMode();
bool SetDynamicShader(unsigned int dstFormat, unsigned int srcFormat, bool SetDynamicShader(unsigned int dstFormat,
bool isIntensity, bool scaleByHalf); PEControl::PixelFormat srcFormat, bool isIntensity, bool scaleByHalf);
ID3D11PixelShader* m_dynamicShader; ID3D11PixelShader* m_dynamicShader;
ID3D11ClassLinkage* m_classLinkage; ID3D11ClassLinkage* m_classLinkage;

View File

@ -315,7 +315,7 @@ void Renderer::SetColorMask()
UINT8 color_mask = 0; UINT8 color_mask = 0;
if (bpmem.alpha_test.TestResult() != AlphaTest::FAIL) if (bpmem.alpha_test.TestResult() != AlphaTest::FAIL)
{ {
if (bpmem.blendmode.alphaupdate && (bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24)) if (bpmem.blendmode.alphaupdate && (bpmem.zcontrol.pixel_format == PEControl::RGBA6_Z24))
color_mask = D3D11_COLOR_WRITE_ENABLE_ALPHA; color_mask = D3D11_COLOR_WRITE_ENABLE_ALPHA;
if (bpmem.blendmode.colorupdate) if (bpmem.blendmode.colorupdate)
color_mask |= D3D11_COLOR_WRITE_ENABLE_RED | D3D11_COLOR_WRITE_ENABLE_GREEN | D3D11_COLOR_WRITE_ENABLE_BLUE; color_mask |= D3D11_COLOR_WRITE_ENABLE_RED | D3D11_COLOR_WRITE_ENABLE_GREEN | D3D11_COLOR_WRITE_ENABLE_BLUE;
@ -409,7 +409,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
float val = *(float*)map.pData; float val = *(float*)map.pData;
u32 ret = 0; u32 ret = 0;
if (bpmem.zcontrol.pixel_format == PIXELFMT_RGB565_Z16) if (bpmem.zcontrol.pixel_format == PEControl::RGB565_Z16)
{ {
// if Z is in 16 bit format you must return a 16 bit integer // if Z is in 16 bit format you must return a 16 bit integer
ret = ((u32)(val * 0xffff)); ret = ((u32)(val * 0xffff));
@ -440,15 +440,15 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
// check what to do with the alpha channel (GX_PokeAlphaRead) // check what to do with the alpha channel (GX_PokeAlphaRead)
PixelEngine::UPEAlphaReadReg alpha_read_mode = PixelEngine::GetAlphaReadMode(); PixelEngine::UPEAlphaReadReg alpha_read_mode = PixelEngine::GetAlphaReadMode();
if (bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24) if (bpmem.zcontrol.pixel_format == PEControl::RGBA6_Z24)
{ {
ret = RGBA8ToRGBA6ToRGBA8(ret); ret = RGBA8ToRGBA6ToRGBA8(ret);
} }
else if (bpmem.zcontrol.pixel_format == PIXELFMT_RGB565_Z16) else if (bpmem.zcontrol.pixel_format == PEControl::RGB565_Z16)
{ {
ret = RGBA8ToRGB565ToRGBA8(ret); ret = RGBA8ToRGB565ToRGBA8(ret);
} }
if (bpmem.zcontrol.pixel_format != PIXELFMT_RGBA6_Z24) if (bpmem.zcontrol.pixel_format != PEControl::RGBA6_Z24)
{ {
ret |= 0xFF000000; ret |= 0xFF000000;
} }
@ -634,7 +634,7 @@ void Renderer::SetBlendMode(bool forceUpdate)
{ {
// Our render target always uses an alpha channel, so we need to override the blend functions to assume a destination alpha of 1 if the render target isn't supposed to have an alpha channel // Our render target always uses an alpha channel, so we need to override the blend functions to assume a destination alpha of 1 if the render target isn't supposed to have an alpha channel
// Example: D3DBLEND_DESTALPHA needs to be D3DBLEND_ONE since the result without an alpha channel is assumed to always be 1. // Example: D3DBLEND_DESTALPHA needs to be D3DBLEND_ONE since the result without an alpha channel is assumed to always be 1.
bool target_has_alpha = bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24; bool target_has_alpha = bpmem.zcontrol.pixel_format == PEControl::RGBA6_Z24;
const D3D11_BLEND d3dSrcFactors[8] = const D3D11_BLEND d3dSrcFactors[8] =
{ {
D3D11_BLEND_ZERO, D3D11_BLEND_ZERO,

View File

@ -121,7 +121,7 @@ TextureCache::TCacheEntryBase* TextureCache::CreateTexture(unsigned int width,
} }
void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFormat, void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFormat,
unsigned int srcFormat, const EFBRectangle& srcRect, PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
bool isIntensity, bool scaleByHalf, unsigned int cbufid, bool isIntensity, bool scaleByHalf, unsigned int cbufid,
const float *colmat) const float *colmat)
{ {
@ -159,9 +159,9 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
// Create texture copy // Create texture copy
D3D::drawShadedTexQuad( D3D::drawShadedTexQuad(
(srcFormat == PIXELFMT_Z24) ? FramebufferManager::GetEFBDepthTexture()->GetSRV() : FramebufferManager::GetEFBColorTexture()->GetSRV(), (srcFormat == PEControl::Z24) ? FramebufferManager::GetEFBDepthTexture()->GetSRV() : FramebufferManager::GetEFBColorTexture()->GetSRV(),
&sourcerect, Renderer::GetTargetWidth(), Renderer::GetTargetHeight(), &sourcerect, Renderer::GetTargetWidth(), Renderer::GetTargetHeight(),
(srcFormat == PIXELFMT_Z24) ? PixelShaderCache::GetDepthMatrixProgram(true) : PixelShaderCache::GetColorMatrixProgram(true), (srcFormat == PEControl::Z24) ? PixelShaderCache::GetDepthMatrixProgram(true) : PixelShaderCache::GetColorMatrixProgram(true),
VertexShaderCache::GetSimpleVertexShader(), VertexShaderCache::GetSimpleInputLayout()); VertexShaderCache::GetSimpleVertexShader(), VertexShaderCache::GetSimpleInputLayout());
D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(), FramebufferManager::GetEFBDepthTexture()->GetDSV()); D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(), FramebufferManager::GetEFBDepthTexture()->GetDSV());

View File

@ -30,7 +30,7 @@ private:
unsigned int expanded_width, unsigned int levels) override; unsigned int expanded_width, unsigned int levels) override;
void FromRenderTarget(u32 dstAddr, unsigned int dstFormat, void FromRenderTarget(u32 dstAddr, unsigned int dstFormat,
unsigned int srcFormat, const EFBRectangle& srcRect, PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
bool isIntensity, bool scaleByHalf, unsigned int cbufid, bool isIntensity, bool scaleByHalf, unsigned int cbufid,
const float *colmat) override; const float *colmat) override;

View File

@ -111,8 +111,8 @@ public:
virtual void Shutdown() = 0; virtual void Shutdown() = 0;
// Returns size in bytes of encoded block of memory // Returns size in bytes of encoded block of memory
virtual size_t Encode(u8* dst, unsigned int dstFormat, virtual size_t Encode(u8* dst, unsigned int dstFormat,
unsigned int srcFormat, const EFBRectangle& srcRect, bool isIntensity, PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
bool scaleByHalf) = 0; bool isIntensity, bool scaleByHalf) = 0;
}; };

View File

@ -877,7 +877,7 @@ void Renderer::SetColorMask()
{ {
if (bpmem.blendmode.colorupdate) if (bpmem.blendmode.colorupdate)
ColorMask = GL_TRUE; ColorMask = GL_TRUE;
if (bpmem.blendmode.alphaupdate && (bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24)) if (bpmem.blendmode.alphaupdate && (bpmem.zcontrol.pixel_format == PEControl::RGBA6_Z24))
AlphaMask = GL_TRUE; AlphaMask = GL_TRUE;
} }
glColorMask(ColorMask, ColorMask, ColorMask, AlphaMask); glColorMask(ColorMask, ColorMask, ColorMask, AlphaMask);
@ -989,7 +989,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
// Scale the 32-bit value returned by glReadPixels to a 24-bit // Scale the 32-bit value returned by glReadPixels to a 24-bit
// value (GC uses a 24-bit Z-buffer). // value (GC uses a 24-bit Z-buffer).
// TODO: in RE0 this value is often off by one, which causes lighting to disappear // TODO: in RE0 this value is often off by one, which causes lighting to disappear
if (bpmem.zcontrol.pixel_format == PIXELFMT_RGB565_Z16) if (bpmem.zcontrol.pixel_format == PEControl::RGB565_Z16)
{ {
// if Z is in 16 bit format you must return a 16 bit integer // if Z is in 16 bit format you must return a 16 bit integer
z = z >> 16; z = z >> 16;
@ -1047,15 +1047,15 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
// check what to do with the alpha channel (GX_PokeAlphaRead) // check what to do with the alpha channel (GX_PokeAlphaRead)
PixelEngine::UPEAlphaReadReg alpha_read_mode = PixelEngine::GetAlphaReadMode(); PixelEngine::UPEAlphaReadReg alpha_read_mode = PixelEngine::GetAlphaReadMode();
if (bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24) if (bpmem.zcontrol.pixel_format == PEControl::RGBA6_Z24)
{ {
color = RGBA8ToRGBA6ToRGBA8(color); color = RGBA8ToRGBA6ToRGBA8(color);
} }
else if (bpmem.zcontrol.pixel_format == PIXELFMT_RGB565_Z16) else if (bpmem.zcontrol.pixel_format == PEControl::RGB565_Z16)
{ {
color = RGBA8ToRGB565ToRGBA8(color); color = RGBA8ToRGB565ToRGBA8(color);
} }
if (bpmem.zcontrol.pixel_format != PIXELFMT_RGBA6_Z24) if (bpmem.zcontrol.pixel_format != PEControl::RGBA6_Z24)
{ {
color |= 0xFF000000; color |= 0xFF000000;
} }
@ -1207,7 +1207,7 @@ void Renderer::SetBlendMode(bool forceUpdate)
{ {
// Our render target always uses an alpha channel, so we need to override the blend functions to assume a destination alpha of 1 if the render target isn't supposed to have an alpha channel // Our render target always uses an alpha channel, so we need to override the blend functions to assume a destination alpha of 1 if the render target isn't supposed to have an alpha channel
// Example: D3DBLEND_DESTALPHA needs to be D3DBLEND_ONE since the result without an alpha channel is assumed to always be 1. // Example: D3DBLEND_DESTALPHA needs to be D3DBLEND_ONE since the result without an alpha channel is assumed to always be 1.
bool target_has_alpha = bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24; bool target_has_alpha = bpmem.zcontrol.pixel_format == PEControl::RGBA6_Z24;
bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate && target_has_alpha; bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate && target_has_alpha;
bool useDualSource = useDstAlpha && g_ActiveConfig.backend_info.bSupportsDualSourceBlend; bool useDualSource = useDstAlpha && g_ActiveConfig.backend_info.bSupportsDualSourceBlend;

View File

@ -258,14 +258,14 @@ TextureCache::TCacheEntryBase* TextureCache::CreateRenderTargetTexture(
} }
void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFormat, void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFormat,
unsigned int srcFormat, const EFBRectangle& srcRect, PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
bool isIntensity, bool scaleByHalf, unsigned int cbufid, bool isIntensity, bool scaleByHalf, unsigned int cbufid,
const float *colmat) const float *colmat)
{ {
g_renderer->ResetAPIState(); // reset any game specific settings g_renderer->ResetAPIState(); // reset any game specific settings
// Make sure to resolve anything we need to read from. // Make sure to resolve anything we need to read from.
const GLuint read_texture = (srcFormat == PIXELFMT_Z24) ? const GLuint read_texture = (srcFormat == PEControl::Z24) ?
FramebufferManager::ResolveAndGetDepthTarget(srcRect) : FramebufferManager::ResolveAndGetDepthTarget(srcRect) :
FramebufferManager::ResolveAndGetRenderTarget(srcRect); FramebufferManager::ResolveAndGetRenderTarget(srcRect);
@ -282,7 +282,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
glViewport(0, 0, virtual_width, virtual_height); glViewport(0, 0, virtual_width, virtual_height);
if (srcFormat == PIXELFMT_Z24) if (srcFormat == PEControl::Z24)
{ {
s_DepthMatrixProgram.Bind(); s_DepthMatrixProgram.Bind();
if (s_DepthCbufid != cbufid) if (s_DepthCbufid != cbufid)
@ -298,7 +298,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
} }
TargetRectangle R = g_renderer->ConvertEFBRectangle(srcRect); TargetRectangle R = g_renderer->ConvertEFBRectangle(srcRect);
glUniform4f(srcFormat == PIXELFMT_Z24 ? s_DepthCopyPositionUniform : s_ColorCopyPositionUniform, glUniform4f(srcFormat == PEControl::Z24 ? s_DepthCopyPositionUniform : s_ColorCopyPositionUniform,
R.left, R.top, R.right, R.bottom); R.left, R.top, R.right, R.bottom);
GL_REPORT_ERRORD(); GL_REPORT_ERRORD();
@ -312,7 +312,7 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
int encoded_size = TextureConverter::EncodeToRamFromTexture( int encoded_size = TextureConverter::EncodeToRamFromTexture(
addr, addr,
read_texture, read_texture,
srcFormat == PIXELFMT_Z24, srcFormat == PEControl::Z24,
isIntensity, isIntensity,
dstFormat, dstFormat,
scaleByHalf, scaleByHalf,

View File

@ -43,7 +43,7 @@ private:
unsigned int expanded_width, unsigned int level) override; unsigned int expanded_width, unsigned int level) override;
void FromRenderTarget(u32 dstAddr, unsigned int dstFormat, void FromRenderTarget(u32 dstAddr, unsigned int dstFormat,
unsigned int srcFormat, const EFBRectangle& srcRect, PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
bool isIntensity, bool scaleByHalf, unsigned int cbufid, bool isIntensity, bool scaleByHalf, unsigned int cbufid,
const float *colmat) override; const float *colmat) override;

View File

@ -35,12 +35,12 @@ namespace EfbInterface
{ {
switch (bpmem.zcontrol.pixel_format) switch (bpmem.zcontrol.pixel_format)
{ {
case PIXELFMT_RGB8_Z24: case PEControl::RGB8_Z24:
case PIXELFMT_Z24: case PEControl::Z24:
case PIXELFMT_RGB565_Z16: case PEControl::RGB565_Z16:
// do nothing // do nothing
break; break;
case PIXELFMT_RGBA6_Z24: case PEControl::RGBA6_Z24:
{ {
u32 a32 = a; u32 a32 = a;
u32 *dst = (u32*)&efb[offset]; u32 *dst = (u32*)&efb[offset];
@ -50,7 +50,7 @@ namespace EfbInterface
} }
break; break;
default: default:
ERROR_LOG(VIDEO, "Unsupported pixel format: %i", bpmem.zcontrol.pixel_format); ERROR_LOG(VIDEO, "Unsupported pixel format: %i", static_cast<int>(bpmem.zcontrol.pixel_format));
} }
} }
@ -58,8 +58,8 @@ namespace EfbInterface
{ {
switch (bpmem.zcontrol.pixel_format) switch (bpmem.zcontrol.pixel_format)
{ {
case PIXELFMT_RGB8_Z24: case PEControl::RGB8_Z24:
case PIXELFMT_Z24: case PEControl::Z24:
{ {
u32 src = *(u32*)rgb; u32 src = *(u32*)rgb;
u32 *dst = (u32*)&efb[offset]; u32 *dst = (u32*)&efb[offset];
@ -68,7 +68,7 @@ namespace EfbInterface
*dst = val; *dst = val;
} }
break; break;
case PIXELFMT_RGBA6_Z24: case PEControl::RGBA6_Z24:
{ {
u32 src = *(u32*)rgb; u32 src = *(u32*)rgb;
u32 *dst = (u32*)&efb[offset]; u32 *dst = (u32*)&efb[offset];
@ -79,9 +79,9 @@ namespace EfbInterface
*dst = val; *dst = val;
} }
break; break;
case PIXELFMT_RGB565_Z16: case PEControl::RGB565_Z16:
{ {
INFO_LOG(VIDEO, "PIXELFMT_RGB565_Z16 is not supported correctly yet"); INFO_LOG(VIDEO, "RGB565_Z16 is not supported correctly yet");
u32 src = *(u32*)rgb; u32 src = *(u32*)rgb;
u32 *dst = (u32*)&efb[offset]; u32 *dst = (u32*)&efb[offset];
u32 val = *dst & 0xff000000; u32 val = *dst & 0xff000000;
@ -90,7 +90,7 @@ namespace EfbInterface
} }
break; break;
default: default:
ERROR_LOG(VIDEO, "Unsupported pixel format: %i", bpmem.zcontrol.pixel_format); ERROR_LOG(VIDEO, "Unsupported pixel format: %i", static_cast<int>(bpmem.zcontrol.pixel_format));
} }
} }
@ -98,8 +98,8 @@ namespace EfbInterface
{ {
switch (bpmem.zcontrol.pixel_format) switch (bpmem.zcontrol.pixel_format)
{ {
case PIXELFMT_RGB8_Z24: case PEControl::RGB8_Z24:
case PIXELFMT_Z24: case PEControl::Z24:
{ {
u32 src = *(u32*)color; u32 src = *(u32*)color;
u32 *dst = (u32*)&efb[offset]; u32 *dst = (u32*)&efb[offset];
@ -108,7 +108,7 @@ namespace EfbInterface
*dst = val; *dst = val;
} }
break; break;
case PIXELFMT_RGBA6_Z24: case PEControl::RGBA6_Z24:
{ {
u32 src = *(u32*)color; u32 src = *(u32*)color;
u32 *dst = (u32*)&efb[offset]; u32 *dst = (u32*)&efb[offset];
@ -120,9 +120,9 @@ namespace EfbInterface
*dst = val; *dst = val;
} }
break; break;
case PIXELFMT_RGB565_Z16: case PEControl::RGB565_Z16:
{ {
INFO_LOG(VIDEO, "PIXELFMT_RGB565_Z16 is not supported correctly yet"); INFO_LOG(VIDEO, "RGB565_Z16 is not supported correctly yet");
u32 src = *(u32*)color; u32 src = *(u32*)color;
u32 *dst = (u32*)&efb[offset]; u32 *dst = (u32*)&efb[offset];
u32 val = *dst & 0xff000000; u32 val = *dst & 0xff000000;
@ -131,7 +131,7 @@ namespace EfbInterface
} }
break; break;
default: default:
ERROR_LOG(VIDEO, "Unsupported pixel format: %i", bpmem.zcontrol.pixel_format); ERROR_LOG(VIDEO, "Unsupported pixel format: %i", static_cast<int>(bpmem.zcontrol.pixel_format));
} }
} }
@ -139,8 +139,8 @@ namespace EfbInterface
{ {
switch (bpmem.zcontrol.pixel_format) switch (bpmem.zcontrol.pixel_format)
{ {
case PIXELFMT_RGB8_Z24: case PEControl::RGB8_Z24:
case PIXELFMT_Z24: case PEControl::Z24:
{ {
u32 src = *(u32*)&efb[offset]; u32 src = *(u32*)&efb[offset];
u32 *dst = (u32*)color; u32 *dst = (u32*)color;
@ -148,7 +148,7 @@ namespace EfbInterface
*dst = val; *dst = val;
} }
break; break;
case PIXELFMT_RGBA6_Z24: case PEControl::RGBA6_Z24:
{ {
u32 src = *(u32*)&efb[offset]; u32 src = *(u32*)&efb[offset];
color[ALP_C] = Convert6To8(src & 0x3f); color[ALP_C] = Convert6To8(src & 0x3f);
@ -157,9 +157,9 @@ namespace EfbInterface
color[RED_C] = Convert6To8((src >> 18) & 0x3f); color[RED_C] = Convert6To8((src >> 18) & 0x3f);
} }
break; break;
case PIXELFMT_RGB565_Z16: case PEControl::RGB565_Z16:
{ {
INFO_LOG(VIDEO, "PIXELFMT_RGB565_Z16 is not supported correctly yet"); INFO_LOG(VIDEO, "RGB565_Z16 is not supported correctly yet");
u32 src = *(u32*)&efb[offset]; u32 src = *(u32*)&efb[offset];
u32 *dst = (u32*)color; u32 *dst = (u32*)color;
u32 val = 0xff | ((src & 0x00ffffff) << 8); u32 val = 0xff | ((src & 0x00ffffff) << 8);
@ -167,7 +167,7 @@ namespace EfbInterface
} }
break; break;
default: default:
ERROR_LOG(VIDEO, "Unsupported pixel format: %i", bpmem.zcontrol.pixel_format); ERROR_LOG(VIDEO, "Unsupported pixel format: %i", static_cast<int>(bpmem.zcontrol.pixel_format));
} }
} }
@ -175,9 +175,9 @@ namespace EfbInterface
{ {
switch (bpmem.zcontrol.pixel_format) switch (bpmem.zcontrol.pixel_format)
{ {
case PIXELFMT_RGB8_Z24: case PEControl::RGB8_Z24:
case PIXELFMT_RGBA6_Z24: case PEControl::RGBA6_Z24:
case PIXELFMT_Z24: case PEControl::Z24:
{ {
u32 *dst = (u32*)&efb[offset]; u32 *dst = (u32*)&efb[offset];
u32 val = *dst & 0xff000000; u32 val = *dst & 0xff000000;
@ -185,9 +185,9 @@ namespace EfbInterface
*dst = val; *dst = val;
} }
break; break;
case PIXELFMT_RGB565_Z16: case PEControl::RGB565_Z16:
{ {
INFO_LOG(VIDEO, "PIXELFMT_RGB565_Z16 is not supported correctly yet"); INFO_LOG(VIDEO, "RGB565_Z16 is not supported correctly yet");
u32 *dst = (u32*)&efb[offset]; u32 *dst = (u32*)&efb[offset];
u32 val = *dst & 0xff000000; u32 val = *dst & 0xff000000;
val |= depth & 0x00ffffff; val |= depth & 0x00ffffff;
@ -195,7 +195,7 @@ namespace EfbInterface
} }
break; break;
default: default:
ERROR_LOG(VIDEO, "Unsupported pixel format: %i", bpmem.zcontrol.pixel_format); ERROR_LOG(VIDEO, "Unsupported pixel format: %i", static_cast<int>(bpmem.zcontrol.pixel_format));
} }
} }
@ -205,21 +205,21 @@ namespace EfbInterface
switch (bpmem.zcontrol.pixel_format) switch (bpmem.zcontrol.pixel_format)
{ {
case PIXELFMT_RGB8_Z24: case PEControl::RGB8_Z24:
case PIXELFMT_RGBA6_Z24: case PEControl::RGBA6_Z24:
case PIXELFMT_Z24: case PEControl::Z24:
{ {
depth = (*(u32*)&efb[offset]) & 0x00ffffff; depth = (*(u32*)&efb[offset]) & 0x00ffffff;
} }
break; break;
case PIXELFMT_RGB565_Z16: case PEControl::RGB565_Z16:
{ {
INFO_LOG(VIDEO, "PIXELFMT_RGB565_Z16 is not supported correctly yet"); INFO_LOG(VIDEO, "RGB565_Z16 is not supported correctly yet");
depth = (*(u32*)&efb[offset]) & 0x00ffffff; depth = (*(u32*)&efb[offset]) & 0x00ffffff;
} }
break; break;
default: default:
ERROR_LOG(VIDEO, "Unsupported pixel format: %i", bpmem.zcontrol.pixel_format); ERROR_LOG(VIDEO, "Unsupported pixel format: %i", static_cast<int>(bpmem.zcontrol.pixel_format));
} }
return depth; return depth;

View File

@ -1386,8 +1386,8 @@ void EncodeZ24halfscale(u8 *dst, u8 *src, u32 format)
void Encode(u8 *dest_ptr) void Encode(u8 *dest_ptr)
{ {
int pixelformat = bpmem.zcontrol.pixel_format; auto pixelformat = bpmem.zcontrol.pixel_format;
bool bFromZBuffer = pixelformat == PIXELFMT_Z24; bool bFromZBuffer = pixelformat == PEControl::Z24;
bool bIsIntensityFmt = bpmem.triggerEFBCopy.intensity_fmt > 0; bool bIsIntensityFmt = bpmem.triggerEFBCopy.intensity_fmt > 0;
u32 copyfmt = ((bpmem.triggerEFBCopy.target_pixel_format / 2) + ((bpmem.triggerEFBCopy.target_pixel_format & 1) * 8)); u32 copyfmt = ((bpmem.triggerEFBCopy.target_pixel_format / 2) + ((bpmem.triggerEFBCopy.target_pixel_format & 1) * 8));
@ -1409,24 +1409,24 @@ void Encode(u8 *dest_ptr)
if (bpmem.triggerEFBCopy.half_scale) if (bpmem.triggerEFBCopy.half_scale)
{ {
if (pixelformat == PIXELFMT_RGBA6_Z24) if (pixelformat == PEControl::RGBA6_Z24)
EncodeRGBA6halfscale(dest_ptr, src, format); EncodeRGBA6halfscale(dest_ptr, src, format);
else if (pixelformat == PIXELFMT_RGB8_Z24) else if (pixelformat == PEControl::RGB8_Z24)
EncodeRGB8halfscale(dest_ptr, src, format); EncodeRGB8halfscale(dest_ptr, src, format);
else if (pixelformat == PIXELFMT_RGB565_Z16) // not supported else if (pixelformat == PEControl::RGB565_Z16) // not supported
EncodeRGB8halfscale(dest_ptr, src, format); EncodeRGB8halfscale(dest_ptr, src, format);
else if (pixelformat == PIXELFMT_Z24) else if (pixelformat == PEControl::Z24)
EncodeZ24halfscale(dest_ptr, src, format); EncodeZ24halfscale(dest_ptr, src, format);
} }
else else
{ {
if (pixelformat == PIXELFMT_RGBA6_Z24) if (pixelformat == PEControl::RGBA6_Z24)
EncodeRGBA6(dest_ptr, src, format); EncodeRGBA6(dest_ptr, src, format);
else if (pixelformat == PIXELFMT_RGB8_Z24) else if (pixelformat == PEControl::RGB8_Z24)
EncodeRGB8(dest_ptr, src, format); EncodeRGB8(dest_ptr, src, format);
else if (pixelformat == PIXELFMT_RGB565_Z16) // not supported else if (pixelformat == PEControl::RGB565_Z16) // not supported
EncodeRGB8(dest_ptr, src, format); EncodeRGB8(dest_ptr, src, format);
else if (pixelformat == PIXELFMT_Z24) else if (pixelformat == PEControl::Z24)
EncodeZ24(dest_ptr, src, format); EncodeZ24(dest_ptr, src, format);
} }
} }

View File

@ -79,10 +79,10 @@ void SetColorMask()
g_renderer->SetColorMask(); g_renderer->SetColorMask();
} }
void CopyEFB(u32 dstAddr, unsigned int dstFormat, unsigned int srcFormat, void CopyEFB(u32 dstAddr, unsigned int dstFormat, PEControl::PixelFormat srcFormat,
const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf) const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf)
{ {
// bpmem.zcontrol.pixel_format to PIXELFMT_Z24 is when the game wants to copy from ZBuffer (Zbuffer uses 24-bit Format) // bpmem.zcontrol.pixel_format to PEControl::Z24 is when the game wants to copy from ZBuffer (Zbuffer uses 24-bit Format)
if (g_ActiveConfig.bEFBCopyEnable) if (g_ActiveConfig.bEFBCopyEnable)
{ {
TextureCache::CopyRenderTargetToTexture(dstAddr, dstFormat, srcFormat, TextureCache::CopyRenderTargetToTexture(dstAddr, dstFormat, srcFormat,
@ -111,11 +111,12 @@ void ClearScreen(const EFBRectangle &rc)
bool colorEnable = bpmem.blendmode.colorupdate; bool colorEnable = bpmem.blendmode.colorupdate;
bool alphaEnable = bpmem.blendmode.alphaupdate; bool alphaEnable = bpmem.blendmode.alphaupdate;
bool zEnable = bpmem.zmode.updateenable; bool zEnable = bpmem.zmode.updateenable;
auto pixel_format = bpmem.zcontrol.pixel_format;
// (1): Disable unused color channels // (1): Disable unused color channels
if (bpmem.zcontrol.pixel_format == PIXELFMT_RGB8_Z24 || if (pixel_format == PEControl::RGB8_Z24 ||
bpmem.zcontrol.pixel_format == PIXELFMT_RGB565_Z16 || pixel_format == PEControl::RGB565_Z16 ||
bpmem.zcontrol.pixel_format == PIXELFMT_Z24) pixel_format == PEControl::Z24)
{ {
alphaEnable = false; alphaEnable = false;
} }
@ -126,11 +127,11 @@ void ClearScreen(const EFBRectangle &rc)
u32 z = bpmem.clearZValue; u32 z = bpmem.clearZValue;
// (2) drop additional accuracy // (2) drop additional accuracy
if (bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24) if (pixel_format == PEControl::RGBA6_Z24)
{ {
color = RGBA8ToRGBA6ToRGBA8(color); color = RGBA8ToRGBA6ToRGBA8(color);
} }
else if (bpmem.zcontrol.pixel_format == PIXELFMT_RGB565_Z16) else if (pixel_format == PEControl::RGB565_Z16)
{ {
color = RGBA8ToRGB565ToRGBA8(color); color = RGBA8ToRGB565ToRGBA8(color);
z = Z24ToZ16ToZ24(z); z = Z24ToZ16ToZ24(z);
@ -156,8 +157,8 @@ void OnPixelFormatChange()
!g_ActiveConfig.backend_info.bSupportsFormatReinterpretation) !g_ActiveConfig.backend_info.bSupportsFormatReinterpretation)
return; return;
u32 old_format = Renderer::GetPrevPixelFormat(); auto old_format = Renderer::GetPrevPixelFormat();
u32 new_format = bpmem.zcontrol.pixel_format; auto new_format = bpmem.zcontrol.pixel_format;
// no need to reinterpret pixel data in these cases // no need to reinterpret pixel data in these cases
if (new_format == old_format || old_format == (unsigned int)-1) if (new_format == old_format || old_format == (unsigned int)-1)
@ -166,31 +167,31 @@ void OnPixelFormatChange()
// Check for pixel format changes // Check for pixel format changes
switch (old_format) switch (old_format)
{ {
case PIXELFMT_RGB8_Z24: case PEControl::RGB8_Z24:
case PIXELFMT_Z24: case PEControl::Z24:
// Z24 and RGB8_Z24 are treated equal, so just return in this case // Z24 and RGB8_Z24 are treated equal, so just return in this case
if (new_format == PIXELFMT_RGB8_Z24 || new_format == PIXELFMT_Z24) if (new_format == PEControl::RGB8_Z24 || new_format == PEControl::Z24)
goto skip; goto skip;
if (new_format == PIXELFMT_RGBA6_Z24) if (new_format == PEControl::RGBA6_Z24)
convtype = 0; convtype = 0;
else if (new_format == PIXELFMT_RGB565_Z16) else if (new_format == PEControl::RGB565_Z16)
convtype = 1; convtype = 1;
break; break;
case PIXELFMT_RGBA6_Z24: case PEControl::RGBA6_Z24:
if (new_format == PIXELFMT_RGB8_Z24 || if (new_format == PEControl::RGB8_Z24 ||
new_format == PIXELFMT_Z24) new_format == PEControl::Z24)
convtype = 2; convtype = 2;
else if (new_format == PIXELFMT_RGB565_Z16) else if (new_format == PEControl::RGB565_Z16)
convtype = 3; convtype = 3;
break; break;
case PIXELFMT_RGB565_Z16: case PEControl::RGB565_Z16:
if (new_format == PIXELFMT_RGB8_Z24 || if (new_format == PEControl::RGB8_Z24 ||
new_format == PIXELFMT_Z24) new_format == PEControl::Z24)
convtype = 4; convtype = 4;
else if (new_format == PIXELFMT_RGBA6_Z24) else if (new_format == PEControl::RGBA6_Z24)
convtype = 5; convtype = 5;
break; break;
@ -200,14 +201,14 @@ void OnPixelFormatChange()
if (convtype == -1) if (convtype == -1)
{ {
ERROR_LOG(VIDEO, "Unhandled EFB format change: %d to %d\n", old_format, new_format); ERROR_LOG(VIDEO, "Unhandled EFB format change: %d to %d\n", static_cast<int>(old_format), static_cast<int>(new_format));
goto skip; goto skip;
} }
g_renderer->ReinterpretPixelData(convtype); g_renderer->ReinterpretPixelData(convtype);
skip: skip:
DEBUG_LOG(VIDEO, "pixelfmt: pixel=%d, zc=%d", new_format, bpmem.zcontrol.zformat); DEBUG_LOG(VIDEO, "pixelfmt: pixel=%d, zc=%d", static_cast<int>(new_format), static_cast<int>(bpmem.zcontrol.zformat));
Renderer::StorePixelFormat(new_format); Renderer::StorePixelFormat(new_format);
} }

View File

@ -31,7 +31,7 @@ void SetBlendMode();
void SetDitherMode(); void SetDitherMode();
void SetLogicOpMode(); void SetLogicOpMode();
void SetColorMask(); void SetColorMask();
void CopyEFB(u32 dstAddr, unsigned int dstFormat, unsigned int srcFormat, void CopyEFB(u32 dstAddr, unsigned int dstFormat, PEControl::PixelFormat srcFormat,
const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf); const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf);
void ClearScreen(const EFBRectangle &rc); void ClearScreen(const EFBRectangle &rc);
void OnPixelFormatChange(); void OnPixelFormatChange();

View File

@ -92,7 +92,7 @@ void GetBPRegInfo(const u8* data, char* name, size_t name_size, char* desc, size
case BPMEM_ZCOMPARE: case BPMEM_ZCOMPARE:
{ {
SetRegName(BPMEM_ZCOMPARE); SetRegName(BPMEM_ZCOMPARE);
PE_CONTROL config; config.hex = cmddata; PEControl config; config.hex = cmddata;
const char* pixel_formats[] = { "RGB8_Z24", "RGBA6_Z24", "RGB565_Z16", "Z24", "Y8", "U8", "V8", "YUV420" }; const char* pixel_formats[] = { "RGB8_Z24", "RGBA6_Z24", "RGB565_Z16", "Z24", "Y8", "U8", "V8", "YUV420" };
const char* zformats[] = { "linear", "compressed (near)", "compressed (mid)", "compressed (far)", "inv linear", "compressed (inv near)", "compressed (inv mid)", "compressed (inv far)" }; const char* zformats[] = { "linear", "compressed (near)", "compressed (mid)", "compressed (far)", "inv linear", "compressed (inv near)", "compressed (inv mid)", "compressed (inv far)" };
snprintf(desc, desc_size, "EFB pixel format: %s\n" snprintf(desc, desc_size, "EFB pixel format: %s\n"

View File

@ -773,36 +773,38 @@ union FieldMask
u32 hex; u32 hex;
}; };
#define PIXELFMT_RGB8_Z24 0 union PEControl
#define PIXELFMT_RGBA6_Z24 1
#define PIXELFMT_RGB565_Z16 2
#define PIXELFMT_Z24 3
#define PIXELFMT_Y8 4
#define PIXELFMT_U8 5
#define PIXELFMT_V8 6
#define PIXELFMT_YUV420 7
#define ZC_LINEAR 0
#define ZC_NEAR 1
#define ZC_MID 2
#define ZC_FAR 3
// It seems these Z formats aren't supported/were removed ?
#define ZC_INV_LINEAR 4
#define ZC_INV_NEAR 5
#define ZC_INV_MID 6
#define ZC_INV_FAR 7
union PE_CONTROL
{ {
struct enum PixelFormat : u32
{ {
u32 pixel_format : 3; // PIXELFMT_X RGB8_Z24 = 0,
u32 zformat : 3; // Z Compression for 16bit Z format RGBA6_Z24 = 1,
u32 early_ztest : 1; // 1: before tex stage RGB565_Z16 = 2,
u32 unused : 17; Z24 = 3,
u32 rid : 8; Y8 = 4,
U8 = 5,
V8 = 6,
YUV420 = 7
}; };
enum DepthFormat : u32
{
ZLINEAR = 0,
ZNEAR = 1,
ZMID = 2,
ZFAR = 3,
// It seems these Z formats aren't supported/were removed ?
ZINV_LINEAR = 4,
ZINV_NEAR = 5,
ZINV_MID = 6,
ZINV_FAR = 7
};
BitField< 0,3,PixelFormat> pixel_format;
BitField< 3,3,DepthFormat> zformat;
BitField< 6,1,u32> early_ztest;
u32 hex; u32 hex;
}; };
@ -999,7 +1001,7 @@ struct BPMemory
ZMode zmode; //40 ZMode zmode; //40
BlendMode blendmode; //41 BlendMode blendmode; //41
ConstantAlpha dstalpha; //42 ConstantAlpha dstalpha; //42
PE_CONTROL zcontrol; //43 GXSetZCompLoc, GXPixModeSync PEControl zcontrol; //43 GXSetZCompLoc, GXPixModeSync
FieldMask fieldmask; //44 FieldMask fieldmask; //44
u32 drawdone; //45, bit1=1 if end of list u32 drawdone; //45, bit1=1 if end of list
u32 unknown5; //46 clock? u32 unknown5; //46 clock?

View File

@ -86,7 +86,7 @@ void GFXDebuggerBase::DumpPixelShader(const std::string& path)
const std::string filename = StringFromFormat("%sdump_ps.txt", path.c_str()); const std::string filename = StringFromFormat("%sdump_ps.txt", path.c_str());
std::string output; std::string output;
bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate && bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24; bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate && bpmem.zcontrol.pixel_format == PEControl::RGBA6_Z24;
if (!useDstAlpha) if (!useDstAlpha)
{ {
output = "Destination alpha disabled:\n"; output = "Destination alpha disabled:\n";

View File

@ -64,7 +64,7 @@ int Renderer::s_LastEFBScale;
bool Renderer::s_skipSwap; bool Renderer::s_skipSwap;
bool Renderer::XFBWrited; bool Renderer::XFBWrited;
unsigned int Renderer::prev_efb_format = (unsigned int)-1; PEControl::PixelFormat Renderer::prev_efb_format = (PEControl::PixelFormat)-1;
unsigned int Renderer::efb_scale_numeratorX = 1; unsigned int Renderer::efb_scale_numeratorX = 1;
unsigned int Renderer::efb_scale_numeratorY = 1; unsigned int Renderer::efb_scale_numeratorY = 1;
unsigned int Renderer::efb_scale_denominatorX = 1; unsigned int Renderer::efb_scale_denominatorX = 1;
@ -89,7 +89,7 @@ Renderer::Renderer()
Renderer::~Renderer() Renderer::~Renderer()
{ {
// invalidate previous efb format // invalidate previous efb format
prev_efb_format = (unsigned int)-1; prev_efb_format = (PEControl::PixelFormat)-1;
efb_scale_numeratorX = efb_scale_numeratorY = efb_scale_denominatorX = efb_scale_denominatorY = 1; efb_scale_numeratorX = efb_scale_numeratorY = efb_scale_denominatorX = efb_scale_denominatorY = 1;

View File

@ -111,8 +111,8 @@ public:
virtual bool SaveScreenshot(const std::string &filename, const TargetRectangle &rc) = 0; virtual bool SaveScreenshot(const std::string &filename, const TargetRectangle &rc) = 0;
static unsigned int GetPrevPixelFormat() { return prev_efb_format; } static PEControl::PixelFormat GetPrevPixelFormat() { return prev_efb_format; }
static void StorePixelFormat(unsigned int new_format) { prev_efb_format = new_format; } static void StorePixelFormat(PEControl::PixelFormat new_format) { prev_efb_format = new_format; }
protected: protected:
@ -151,7 +151,7 @@ protected:
static bool XFBWrited; static bool XFBWrited;
private: private:
static unsigned int prev_efb_format; static PEControl::PixelFormat prev_efb_format;
static unsigned int efb_scale_numeratorX; static unsigned int efb_scale_numeratorX;
static unsigned int efb_scale_numeratorY; static unsigned int efb_scale_numeratorY;
static unsigned int efb_scale_denominatorX; static unsigned int efb_scale_denominatorX;

View File

@ -572,7 +572,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage,
return ReturnEntry(stage, entry); return ReturnEntry(stage, entry);
} }
void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat, unsigned int srcFormat, void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat, PEControl::PixelFormat srcFormat,
const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf) const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf)
{ {
// Emulation methods: // Emulation methods:
@ -623,9 +623,9 @@ void TextureCache::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat
ColorMask[0] = ColorMask[1] = ColorMask[2] = ColorMask[3] = 255.0f; ColorMask[0] = ColorMask[1] = ColorMask[2] = ColorMask[3] = 255.0f;
ColorMask[4] = ColorMask[5] = ColorMask[6] = ColorMask[7] = 1.0f / 255.0f; ColorMask[4] = ColorMask[5] = ColorMask[6] = ColorMask[7] = 1.0f / 255.0f;
unsigned int cbufid = -1; unsigned int cbufid = -1;
bool efbHasAlpha = bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24; bool efbHasAlpha = bpmem.zcontrol.pixel_format == PEControl::RGBA6_Z24;
if (srcFormat == PIXELFMT_Z24) if (srcFormat == PEControl::Z24)
{ {
switch (dstFormat) switch (dstFormat)
{ {

View File

@ -77,7 +77,7 @@ public:
virtual void Load(unsigned int width, unsigned int height, virtual void Load(unsigned int width, unsigned int height,
unsigned int expanded_width, unsigned int level) = 0; unsigned int expanded_width, unsigned int level) = 0;
virtual void FromRenderTarget(u32 dstAddr, unsigned int dstFormat, virtual void FromRenderTarget(u32 dstAddr, unsigned int dstFormat,
unsigned int srcFormat, const EFBRectangle& srcRect, PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
bool isIntensity, bool scaleByHalf, unsigned int cbufid, bool isIntensity, bool scaleByHalf, unsigned int cbufid,
const float *colmat) = 0; const float *colmat) = 0;
@ -103,7 +103,7 @@ public:
static TCacheEntryBase* Load(unsigned int stage, u32 address, unsigned int width, unsigned int height, static TCacheEntryBase* Load(unsigned int stage, u32 address, unsigned int width, unsigned int height,
int format, unsigned int tlutaddr, int tlutfmt, bool use_mipmaps, unsigned int maxlevel, bool from_tmem); int format, unsigned int tlutaddr, int tlutfmt, bool use_mipmaps, unsigned int maxlevel, bool from_tmem);
static void CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat, unsigned int srcFormat, static void CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat, PEControl::PixelFormat srcFormat,
const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf); const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf);
static void RequestInvalidateTextureCache(); static void RequestInvalidateTextureCache();

View File

@ -219,7 +219,7 @@ void VertexManager::Flush()
bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass &&
bpmem.dstalpha.enable && bpmem.dstalpha.enable &&
bpmem.blendmode.alphaupdate && bpmem.blendmode.alphaupdate &&
bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24; bpmem.zcontrol.pixel_format == PEControl::RGBA6_Z24;
if (PerfQueryBase::ShouldEmulate()) if (PerfQueryBase::ShouldEmulate())
g_perf_query->EnableQuery(bpmem.zcontrol.early_ztest ? PQG_ZCOMP_ZCOMPLOC : PQG_ZCOMP); g_perf_query->EnableQuery(bpmem.zcontrol.early_ztest ? PQG_ZCOMP_ZCOMPLOC : PQG_ZCOMP);