summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/RenderState.cpp
diff options
context:
space:
mode:
authorTilka <tilkax@gmail.com>2019-02-26 04:21:05 +0000
committerGitHub <noreply@github.com>2019-02-26 04:21:05 +0000
commit6ce7f44b8a0bb3b95d3f12ebffbef7a71a443fdd (patch)
tree98380ce3a3284c52597a6fba86589c847219ecd5 /Source/Core/VideoCommon/RenderState.cpp
parent19673ce79af814ca3b77d7f8ea60458e564bfa51 (diff)
parentf039149198657c1891e1c6462ed30c31ed4b8486 (diff)
Merge pull request #7753 from stenzek/videocommon-all-the-things
Move a significant amount of video backend logic to VideoCommon
Diffstat (limited to 'Source/Core/VideoCommon/RenderState.cpp')
-rw-r--r--Source/Core/VideoCommon/RenderState.cpp60
1 files changed, 58 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/RenderState.cpp b/Source/Core/VideoCommon/RenderState.cpp
index b61b031b04..04d8804f0c 100644
--- a/Source/Core/VideoCommon/RenderState.cpp
+++ b/Source/Core/VideoCommon/RenderState.cpp
@@ -6,6 +6,7 @@
#include <algorithm>
#include <array>
#include "VideoCommon/SamplerCommon.h"
+#include "VideoCommon/TextureConfig.h"
void RasterizationState::Generate(const BPMemory& bp, PrimitiveType primitive_type)
{
@@ -23,6 +24,12 @@ RasterizationState& RasterizationState::operator=(const RasterizationState& rhs)
return *this;
}
+FramebufferState& FramebufferState::operator=(const FramebufferState& rhs)
+{
+ hex = rhs.hex;
+ return *this;
+}
+
void DepthState::Generate(const BPMemory& bp)
{
testenable = bp.zmode.testenable.Value();
@@ -206,10 +213,19 @@ RasterizationState GetInvalidRasterizationState()
return state;
}
-RasterizationState GetNoCullRasterizationState()
+RasterizationState GetNoCullRasterizationState(PrimitiveType primitive)
{
RasterizationState state = {};
state.cullmode = GenMode::CULL_NONE;
+ state.primitive = primitive;
+ return state;
+}
+
+RasterizationState GetCullBackFaceRasterizationState(PrimitiveType primitive)
+{
+ RasterizationState state = {};
+ state.cullmode = GenMode::CULL_BACK;
+ state.primitive = primitive;
return state;
}
@@ -220,7 +236,7 @@ DepthState GetInvalidDepthState()
return state;
}
-DepthState GetNoDepthTestingDepthStencilState()
+DepthState GetNoDepthTestingDepthState()
{
DepthState state = {};
state.testenable = false;
@@ -229,6 +245,15 @@ DepthState GetNoDepthTestingDepthStencilState()
return state;
}
+DepthState GetAlwaysWriteDepthState()
+{
+ DepthState state = {};
+ state.testenable = true;
+ state.updateenable = true;
+ state.func = ZMode::ALWAYS;
+ return state;
+}
+
BlendingState GetInvalidBlendingState()
{
BlendingState state;
@@ -251,6 +276,21 @@ BlendingState GetNoBlendingBlendState()
return state;
}
+BlendingState GetNoColorWriteBlendState()
+{
+ BlendingState state = {};
+ state.usedualsrc = false;
+ state.blendenable = false;
+ state.srcfactor = BlendMode::ONE;
+ state.srcfactoralpha = BlendMode::ONE;
+ state.dstfactor = BlendMode::ZERO;
+ state.dstfactoralpha = BlendMode::ZERO;
+ state.logicopenable = false;
+ state.colorupdate = false;
+ state.alphaupdate = false;
+ return state;
+}
+
SamplerState GetInvalidSamplerState()
{
SamplerState state;
@@ -287,4 +327,20 @@ SamplerState GetLinearSamplerState()
state.anisotropic_filtering = false;
return state;
}
+
+FramebufferState GetColorFramebufferState(AbstractTextureFormat format)
+{
+ FramebufferState state = {};
+ state.color_texture_format = format;
+ state.depth_texture_format = AbstractTextureFormat::Undefined;
+ state.per_sample_shading = false;
+ state.samples = 1;
+ return state;
+}
+
+FramebufferState GetRGBA8FramebufferState()
+{
+ return GetColorFramebufferState(AbstractTextureFormat::RGBA8);
}
+
+} // namespace RenderState