mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
BPMemory: Expose the pixel_format and zformat fields in PE_CONTROL as enumerations.
This commit is contained in:
@ -1031,8 +1031,8 @@ void PSTextureEncoder::Shutdown()
|
||||
}
|
||||
|
||||
size_t PSTextureEncoder::Encode(u8* dst, unsigned int dstFormat,
|
||||
unsigned int srcFormat, const EFBRectangle& srcRect, bool isIntensity,
|
||||
bool scaleByHalf)
|
||||
PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
|
||||
bool isIntensity, bool scaleByHalf)
|
||||
{
|
||||
if (!m_ready) // Make sure we initialized OK
|
||||
return 0;
|
||||
@ -1122,7 +1122,7 @@ size_t PSTextureEncoder::Encode(u8* dst, unsigned int dstFormat,
|
||||
|
||||
D3D::context->OMSetRenderTargets(1, &m_outRTV, nullptr);
|
||||
|
||||
ID3D11ShaderResourceView* pEFB = (srcFormat == PIXELFMT_Z24) ?
|
||||
ID3D11ShaderResourceView* pEFB = (srcFormat == PEControl::Z24) ?
|
||||
FramebufferManager::GetEFBDepthTexture()->GetSRV() :
|
||||
// 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
|
||||
@ -1208,10 +1208,10 @@ static const char* INTENSITY_FUNC_NAMES[2] = {
|
||||
"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)
|
||||
{
|
||||
size_t fetchNum = srcFormat;
|
||||
size_t fetchNum = static_cast<size_t>(srcFormat);
|
||||
size_t scaledFetchNum = scaleByHalf ? 1 : 0;
|
||||
size_t intensityNum = isIntensity ? 1 : 0;
|
||||
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",
|
||||
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
|
||||
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))
|
||||
{
|
||||
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
|
||||
// over again
|
||||
m_staticShaders[key] = nullptr;
|
||||
@ -1369,9 +1369,9 @@ static const char* INTENSITY_CLASS_NAMES[2] = {
|
||||
};
|
||||
|
||||
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 intensityNum = isIntensity ? 1 : 0;
|
||||
size_t generatorNum = dstFormat;
|
||||
|
@ -32,8 +32,8 @@ public:
|
||||
void Init();
|
||||
void Shutdown();
|
||||
size_t Encode(u8* dst, unsigned int dstFormat,
|
||||
unsigned int srcFormat, const EFBRectangle& srcRect, bool isIntensity,
|
||||
bool scaleByHalf);
|
||||
PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
|
||||
bool isIntensity, bool scaleByHalf);
|
||||
|
||||
private:
|
||||
|
||||
@ -54,15 +54,15 @@ private:
|
||||
// Stuff only used in static-linking mode (SM4.0-compatible)
|
||||
|
||||
bool InitStaticMode();
|
||||
bool SetStaticShader(unsigned int dstFormat, unsigned int srcFormat,
|
||||
bool isIntensity, bool scaleByHalf);
|
||||
bool SetStaticShader(unsigned int dstFormat,
|
||||
PEControl::PixelFormat srcFormat, bool isIntensity, bool scaleByHalf);
|
||||
|
||||
typedef unsigned int ComboKey; // Key for a shader combination
|
||||
|
||||
ComboKey MakeComboKey(unsigned int dstFormat, unsigned int srcFormat,
|
||||
bool isIntensity, bool scaleByHalf)
|
||||
ComboKey MakeComboKey(unsigned int dstFormat,
|
||||
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);
|
||||
}
|
||||
|
||||
@ -74,8 +74,8 @@ private:
|
||||
// Microsoft fixes their bloody HLSL compiler)
|
||||
|
||||
bool InitDynamicMode();
|
||||
bool SetDynamicShader(unsigned int dstFormat, unsigned int srcFormat,
|
||||
bool isIntensity, bool scaleByHalf);
|
||||
bool SetDynamicShader(unsigned int dstFormat,
|
||||
PEControl::PixelFormat srcFormat, bool isIntensity, bool scaleByHalf);
|
||||
|
||||
ID3D11PixelShader* m_dynamicShader;
|
||||
ID3D11ClassLinkage* m_classLinkage;
|
||||
|
@ -315,7 +315,7 @@ void Renderer::SetColorMask()
|
||||
UINT8 color_mask = 0;
|
||||
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;
|
||||
if (bpmem.blendmode.colorupdate)
|
||||
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;
|
||||
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
|
||||
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)
|
||||
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);
|
||||
}
|
||||
else if (bpmem.zcontrol.pixel_format == PIXELFMT_RGB565_Z16)
|
||||
else if (bpmem.zcontrol.pixel_format == PEControl::RGB565_Z16)
|
||||
{
|
||||
ret = RGBA8ToRGB565ToRGBA8(ret);
|
||||
}
|
||||
if (bpmem.zcontrol.pixel_format != PIXELFMT_RGBA6_Z24)
|
||||
if (bpmem.zcontrol.pixel_format != PEControl::RGBA6_Z24)
|
||||
{
|
||||
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
|
||||
// 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] =
|
||||
{
|
||||
D3D11_BLEND_ZERO,
|
||||
|
@ -121,7 +121,7 @@ TextureCache::TCacheEntryBase* TextureCache::CreateTexture(unsigned int width,
|
||||
}
|
||||
|
||||
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,
|
||||
const float *colmat)
|
||||
{
|
||||
@ -159,9 +159,9 @@ void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFo
|
||||
|
||||
// Create texture copy
|
||||
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(),
|
||||
(srcFormat == PIXELFMT_Z24) ? PixelShaderCache::GetDepthMatrixProgram(true) : PixelShaderCache::GetColorMatrixProgram(true),
|
||||
(srcFormat == PEControl::Z24) ? PixelShaderCache::GetDepthMatrixProgram(true) : PixelShaderCache::GetColorMatrixProgram(true),
|
||||
VertexShaderCache::GetSimpleVertexShader(), VertexShaderCache::GetSimpleInputLayout());
|
||||
|
||||
D3D::context->OMSetRenderTargets(1, &FramebufferManager::GetEFBColorTexture()->GetRTV(), FramebufferManager::GetEFBDepthTexture()->GetDSV());
|
||||
|
@ -30,7 +30,7 @@ private:
|
||||
unsigned int expanded_width, unsigned int levels) override;
|
||||
|
||||
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,
|
||||
const float *colmat) override;
|
||||
|
||||
|
@ -111,8 +111,8 @@ public:
|
||||
virtual void Shutdown() = 0;
|
||||
// Returns size in bytes of encoded block of memory
|
||||
virtual size_t Encode(u8* dst, unsigned int dstFormat,
|
||||
unsigned int srcFormat, const EFBRectangle& srcRect, bool isIntensity,
|
||||
bool scaleByHalf) = 0;
|
||||
PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect,
|
||||
bool isIntensity, bool scaleByHalf) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user