mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
Properly emulate the alpha read pixel engine register function (used for EFB peeks).
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6313 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -36,6 +36,7 @@
|
||||
#include "Profiler.h"
|
||||
#include "Statistics.h"
|
||||
#include "ImageWrite.h"
|
||||
#include "PixelEngine.h"
|
||||
#include "Render.h"
|
||||
#include "OpcodeDecoding.h"
|
||||
#include "BPStructs.h"
|
||||
@ -854,6 +855,20 @@ void Renderer::SetColorMask()
|
||||
glColorMask(ColorMask, ColorMask, ColorMask, AlphaMask);
|
||||
}
|
||||
|
||||
// This function allows the CPU to directly access the EFB.
|
||||
// There are EFB peeks (which will read the color or depth of a pixel)
|
||||
// and EFB pokes (which will change the color or depth of a pixel).
|
||||
//
|
||||
// The behavior of EFB peeks can only be modified by:
|
||||
// - GX_PokeAlphaRead
|
||||
// The behavior of EFB pokes can be modified by:
|
||||
// - GX_PokeAlphaMode (TODO)
|
||||
// - GX_PokeAlphaUpdate (TODO)
|
||||
// - GX_PokeBlendMode (TODO)
|
||||
// - GX_PokeColorUpdate (TODO)
|
||||
// - GX_PokeDither (TODO)
|
||||
// - GX_PokeDstAlpha (TODO)
|
||||
// - GX_PokeZMode (TODO)
|
||||
u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
|
||||
{
|
||||
if (!g_ActiveConfig.bEFBAccessEnable)
|
||||
@ -922,7 +937,12 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
|
||||
glReadPixels(srcX, srcY, 1, 1, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, &color);
|
||||
GL_REPORT_ERRORD();
|
||||
|
||||
return color;
|
||||
// check what to do with the alpha channel (GX_PokeAlphaRead)
|
||||
PixelEngine::UPEAlphaReadReg alpha_read_mode;
|
||||
PixelEngine::Read16((u16&)alpha_read_mode, PE_DSTALPHACONF);
|
||||
if(alpha_read_mode.ReadMode == 2) return color; // GX_READ_NONE
|
||||
else if(alpha_read_mode.ReadMode == 1) return (color | 0xFF000000); // GX_READ_FF
|
||||
else /*if(alpha_read_mode.ReadMode == 0)*/ return (color & 0x00FFFFFF); // GX_READ_00
|
||||
}
|
||||
|
||||
case POKE_COLOR:
|
||||
|
Reference in New Issue
Block a user