summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/D3D/Render.cpp
diff options
context:
space:
mode:
authorMarkus Wick <markus+github@selfnet.de>2014-12-08 09:05:22 +0100
committerMarkus Wick <markus+github@selfnet.de>2014-12-08 09:05:22 +0100
commitff4526b4a9b7dbcbdbaff35a657739e272aea637 (patch)
treeafa330fc93476afb8ffe731ec197abcaf487c0fc /Source/Core/VideoBackends/D3D/Render.cpp
parent3a149c3aab63be54c5932563b2957e9e3016a8aa (diff)
parentcf7512683c04e6e9836929c34f458515928eca4b (diff)
Merge pull request #1657 from Tinob/master
Add HW bounding Box support to d3d backend
Diffstat (limited to 'Source/Core/VideoBackends/D3D/Render.cpp')
-rw-r--r--Source/Core/VideoBackends/D3D/Render.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp
index 6adf3ac52f..c393afeb50 100644
--- a/Source/Core/VideoBackends/D3D/Render.cpp
+++ b/Source/Core/VideoBackends/D3D/Render.cpp
@@ -16,6 +16,7 @@
#include "Core/Host.h"
#include "Core/Movie.h"
+#include "VideoBackends/D3D/BoundingBox.h"
#include "VideoBackends/D3D/D3DBase.h"
#include "VideoBackends/D3D/D3DState.h"
#include "VideoBackends/D3D/D3DUtil.h"
@@ -1213,4 +1214,43 @@ int Renderer::GetMaxTextureSize()
return DX11::D3D::GetMaxTextureSize();
}
+u16 Renderer::BBoxRead(int index)
+{
+ // Here we get the min/max value of the truncated position of the upscaled framebuffer.
+ // So we have to correct them to the unscaled EFB sizes.
+ int value = BBox::Get(index);
+
+ if (index < 2)
+ {
+ // left/right
+ value = value * EFB_WIDTH / s_target_width;
+ }
+ else
+ {
+ // up/down
+ value = value * EFB_HEIGHT / s_target_height;
+ }
+ if (index & 1)
+ value++; // fix max values to describe the outer border
+
+ return value;
+}
+
+void Renderer::BBoxWrite(int index, u16 _value)
+{
+ int value = _value; // u16 isn't enough to multiply by the efb width
+ if (index & 1)
+ value--;
+ if (index < 2)
+ {
+ value = value * s_target_width / EFB_WIDTH;
+ }
+ else
+ {
+ value = value * s_target_height / EFB_HEIGHT;
+ }
+
+ BBox::Set(index, value);
+}
+
} // namespace DX11