summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2017-04-30 15:54:45 +1000
committerStenzek <stenzek@gmail.com>2017-09-11 19:40:26 +1000
commit2869c570f1d0b67d2ee4304ea528bef3ef4b563e (patch)
tree2f10d4f34da42a5e9f81706f853451bd8a59a701 /Source/Core/VideoCommon
parent4d36f0cc87d2cc2bc40ec1c36a65623dc3822f01 (diff)
Renderer: Move depth state to VideoCommon and seperate from bpmem
Diffstat (limited to 'Source/Core/VideoCommon')
-rw-r--r--Source/Core/VideoCommon/BPFunctions.cpp6
-rw-r--r--Source/Core/VideoCommon/RenderBase.h2
-rw-r--r--Source/Core/VideoCommon/RenderState.cpp7
-rw-r--r--Source/Core/VideoCommon/RenderState.h11
4 files changed, 23 insertions, 3 deletions
diff --git a/Source/Core/VideoCommon/BPFunctions.cpp b/Source/Core/VideoCommon/BPFunctions.cpp
index b74b6f84d4..a482f72fbd 100644
--- a/Source/Core/VideoCommon/BPFunctions.cpp
+++ b/Source/Core/VideoCommon/BPFunctions.cpp
@@ -68,12 +68,14 @@ void SetScissor()
void SetDepthMode()
{
- g_renderer->SetDepthMode();
+ DepthState state = {};
+ state.Generate(bpmem);
+ g_renderer->SetDepthState(state);
}
void SetBlendMode()
{
- BlendingState state;
+ BlendingState state = {};
state.Generate(bpmem);
g_renderer->SetBlendingState(state);
}
diff --git a/Source/Core/VideoCommon/RenderBase.h b/Source/Core/VideoCommon/RenderBase.h
index 7b7f43b7f6..838585323c 100644
--- a/Source/Core/VideoCommon/RenderBase.h
+++ b/Source/Core/VideoCommon/RenderBase.h
@@ -67,7 +67,7 @@ public:
virtual void SetBlendingState(const BlendingState& state) {}
virtual void SetScissorRect(const EFBRectangle& rc) {}
virtual void SetGenerationMode() {}
- virtual void SetDepthMode() {}
+ virtual void SetDepthState(const DepthState& state) {}
virtual void SetSamplerState(int stage, int texindex, bool custom_tex) {}
virtual void SetInterlacingMode() {}
virtual void SetViewport() {}
diff --git a/Source/Core/VideoCommon/RenderState.cpp b/Source/Core/VideoCommon/RenderState.cpp
index 7e6d845ccb..344ec5b32a 100644
--- a/Source/Core/VideoCommon/RenderState.cpp
+++ b/Source/Core/VideoCommon/RenderState.cpp
@@ -4,6 +4,13 @@
#include "VideoCommon/RenderState.h"
+void DepthState::Generate(const BPMemory& bp)
+{
+ testenable = bp.zmode.testenable.Value();
+ updateenable = bp.zmode.updateenable.Value();
+ func = bp.zmode.func.Value();
+}
+
// If the framebuffer format has no alpha channel, it is assumed to
// ONE on blending. As the backends may emulate this framebuffer
// configuration with an alpha channel, we just drop all references
diff --git a/Source/Core/VideoCommon/RenderState.h b/Source/Core/VideoCommon/RenderState.h
index 25a55ba17a..d1af098f25 100644
--- a/Source/Core/VideoCommon/RenderState.h
+++ b/Source/Core/VideoCommon/RenderState.h
@@ -9,6 +9,17 @@
#include "VideoCommon/BPMemory.h"
#include "VideoCommon/BPStructs.h"
+union DepthState
+{
+ void Generate(const BPMemory& bp);
+
+ BitField<0, 1, u32> testenable;
+ BitField<1, 1, u32> updateenable;
+ BitField<2, 3, ZMode::CompareMode> func;
+
+ u32 hex;
+};
+
union BlendingState
{
void Generate(const BPMemory& bp);