diff options
| author | Dolphin Bot <dolphin-emu-bot@users.noreply.github.com> | 2015-05-08 15:20:57 +0200 |
|---|---|---|
| committer | Dolphin Bot <dolphin-emu-bot@users.noreply.github.com> | 2015-05-08 15:20:57 +0200 |
| commit | ca7fe09f1adda29b8ac76ffa492b2d1e96649e6b (patch) | |
| tree | 1f9c0beba0e258cd796e34aa900271576de02b76 /Source/Core/VideoBackends/D3D/Render.cpp | |
| parent | 268b8fd26f8888bf08873bbc8d94b7eea00a402c (diff) | |
| parent | 1d745d632ab9f4774bc38782cd688a5fa48bc097 (diff) | |
Merge pull request #2369 from Armada651/depth-percision
VideoBackends: Use proper floating point depth precision.
Diffstat (limited to 'Source/Core/VideoBackends/D3D/Render.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/D3D/Render.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp index ec73313476..f11749d868 100644 --- a/Source/Core/VideoBackends/D3D/Render.cpp +++ b/Source/Core/VideoBackends/D3D/Render.cpp @@ -8,6 +8,7 @@ #include <strsafe.h> #include <unordered_map> +#include "Common/MathUtil.h" #include "Common/Timer.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 Z is in 16 bit format you must return a 16 bit integer - ret = ((u32)(val * 0xffff)); + ret = MathUtil::Clamp<u32>((u32)(val * 65536.0f), 0, 0xFFFF); } else { - ret = ((u32)(val * 0xffffff)); + ret = MathUtil::Clamp<u32>((u32)(val * 16777216.0f), 0, 0xFFFFFF); } D3D::context->Unmap(read_tex, 0); @@ -548,7 +549,7 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaE // Color is passed in bgra mode so we need to convert it to rgba u32 rgbaColor = (color & 0xFF00FF00) | ((color >> 16) & 0xFF) | ((color << 16) & 0xFF0000); - D3D::drawClearQuad(rgbaColor, (z & 0xFFFFFF) / float(0xFFFFFF)); + D3D::drawClearQuad(rgbaColor, (z & 0xFFFFFF) / 16777216.0f); D3D::stateman->PopDepthState(); D3D::stateman->PopBlendState(); |
