VideoBackends: Clamp Z peek values.
This commit is contained in:
parent
0f2c72f0f8
commit
1a409a2e16
|
@ -8,6 +8,7 @@
|
||||||
#include <strsafe.h>
|
#include <strsafe.h>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
|
#include "Common/MathUtil.h"
|
||||||
#include "Common/Timer.h"
|
#include "Common/Timer.h"
|
||||||
|
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
|
@ -419,11 +420,11 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
|
||||||
if (bpmem.zcontrol.pixel_format == PEControl::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 * 65536.0f));
|
ret = MathUtil::Clamp<u32>((u32)(val * 65536.0f), 0, 0xFFFF);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret = ((u32)(val * 16777216.0f));
|
ret = MathUtil::Clamp<u32>((u32)(val * 16777216.0f), 0, 0xFFFFFF);
|
||||||
}
|
}
|
||||||
D3D::context->Unmap(read_tex, 0);
|
D3D::context->Unmap(read_tex, 0);
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "Common/Atomic.h"
|
#include "Common/Atomic.h"
|
||||||
#include "Common/CommonPaths.h"
|
#include "Common/CommonPaths.h"
|
||||||
#include "Common/FileUtil.h"
|
#include "Common/FileUtil.h"
|
||||||
|
#include "Common/MathUtil.h"
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
#include "Common/Thread.h"
|
#include "Common/Thread.h"
|
||||||
#include "Common/Timer.h"
|
#include "Common/Timer.h"
|
||||||
|
@ -940,7 +941,7 @@ void Renderer::UpdateEFBCache(EFBAccessType type, u32 cacheRectIdx, const EFBRec
|
||||||
if (type == PEEK_Z)
|
if (type == PEEK_Z)
|
||||||
{
|
{
|
||||||
float* ptr = (float*)data;
|
float* ptr = (float*)data;
|
||||||
value = (u32)(ptr[yData * targetPixelRcWidth + xData] * 16777216.0f);
|
value = MathUtil::Clamp<u32>((u32)(ptr[yData * targetPixelRcWidth + xData] * 16777216.0f), 0, 0xFFFFFF);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue