summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/D3D/Render.cpp
diff options
context:
space:
mode:
authorRodolfo Bogado <rodolfoosvaldobogado@gmail.com>2014-12-04 23:01:20 -0300
committerRodolfo Bogado <rodolfoosvaldobogado@gmail.com>2014-12-05 15:03:24 -0300
commit93b4540e1943263e33aebf9aa3912f35dbdb4a0a (patch)
tree949df27d122c7a2d41d445af982c714d14d15ee2 /Source/Core/VideoBackends/D3D/Render.cpp
parentc617b6c722d293be3b79d7344ea2d05828e7acc3 (diff)
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