diff options
Diffstat (limited to 'Source/Core/VideoCommon/RenderState.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/RenderState.cpp | 60 |
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 |
