diff --git a/Source/Core/VideoBackends/Vulkan/FramebufferManager.cpp b/Source/Core/VideoBackends/Vulkan/FramebufferManager.cpp index 7ab7c6ecd3..53351e0325 100644 --- a/Source/Core/VideoBackends/Vulkan/FramebufferManager.cpp +++ b/Source/Core/VideoBackends/Vulkan/FramebufferManager.cpp @@ -1192,11 +1192,11 @@ void FramebufferManager::DrawPokeVertices(const EFBPokeVertex* vertices, size_t pipeline_info.gs = (GetEFBLayers() > 1) ? m_poke_geometry_shader : VK_NULL_HANDLE; pipeline_info.ps = m_poke_fragment_shader; pipeline_info.render_pass = m_efb_load_render_pass; - pipeline_info.rasterization_state.hex = Util::GetNoCullRasterizationState().hex; + pipeline_info.rasterization_state.hex = RenderState::GetNoCullRasterizationState().hex; pipeline_info.rasterization_state.primitive = m_poke_primitive; pipeline_info.multisampling_state.hex = GetEFBMultisamplingState().hex; - pipeline_info.depth_state.hex = Util::GetNoDepthTestingDepthStencilState().hex; - pipeline_info.blend_state.hex = Util::GetNoBlendingBlendState().hex; + pipeline_info.depth_state.hex = RenderState::GetNoDepthTestingDepthStencilState().hex; + pipeline_info.blend_state.hex = RenderState::GetNoBlendingBlendState().hex; pipeline_info.blend_state.colorupdate = write_color; pipeline_info.blend_state.alphaupdate = write_color; if (write_depth) diff --git a/Source/Core/VideoBackends/Vulkan/RasterFont.cpp b/Source/Core/VideoBackends/Vulkan/RasterFont.cpp index 39534cbf5d..7410ba5c86 100644 --- a/Source/Core/VideoBackends/Vulkan/RasterFont.cpp +++ b/Source/Core/VideoBackends/Vulkan/RasterFont.cpp @@ -400,7 +400,7 @@ void RasterFont::PrintMultiLineText(VkRenderPass render_pass, const std::string& draw.SetPSSampler(0, m_texture->GetView(), g_object_cache->GetLinearSampler()); // Setup alpha blending - BlendingState blend_state = Util::GetNoBlendingBlendState(); + BlendingState blend_state = RenderState::GetNoBlendingBlendState(); blend_state.blendenable = true; blend_state.srcfactor = BlendMode::SRCALPHA; blend_state.dstfactor = BlendMode::INVSRCALPHA; diff --git a/Source/Core/VideoBackends/Vulkan/Renderer.cpp b/Source/Core/VideoBackends/Vulkan/Renderer.cpp index 07c0242751..fc3eb59c39 100644 --- a/Source/Core/VideoBackends/Vulkan/Renderer.cpp +++ b/Source/Core/VideoBackends/Vulkan/Renderer.cpp @@ -455,11 +455,11 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool color_enable, bool alpha StateTracker::GetInstance()->SetPendingRebind(); // Mask away the appropriate colors and use a shader - BlendingState blend_state = Util::GetNoBlendingBlendState(); + BlendingState blend_state = RenderState::GetNoBlendingBlendState(); blend_state.colorupdate = color_enable; blend_state.alphaupdate = alpha_enable; - DepthState depth_state = Util::GetNoDepthTestingDepthStencilState(); + DepthState depth_state = RenderState::GetNoDepthTestingDepthStencilState(); depth_state.testenable = z_enable; depth_state.updateenable = z_enable; depth_state.func = ZMode::ALWAYS; diff --git a/Source/Core/VideoBackends/Vulkan/ShaderCache.cpp b/Source/Core/VideoBackends/Vulkan/ShaderCache.cpp index f32ca869ef..9bd41b882f 100644 --- a/Source/Core/VideoBackends/Vulkan/ShaderCache.cpp +++ b/Source/Core/VideoBackends/Vulkan/ShaderCache.cpp @@ -1210,9 +1210,9 @@ void ShaderCache::CreateDummyPipeline(const UberShader::VertexShaderUid& vuid, VK_NULL_HANDLE; pinfo.ps = GetPixelUberShaderForUid(puid); pinfo.render_pass = FramebufferManager::GetInstance()->GetEFBLoadRenderPass(); - pinfo.rasterization_state.hex = Util::GetNoCullRasterizationState().hex; - pinfo.depth_state.hex = Util::GetNoDepthTestingDepthStencilState().hex; - pinfo.blend_state.hex = Util::GetNoBlendingBlendState().hex; + pinfo.rasterization_state.hex = RenderState::GetNoCullRasterizationState().hex; + pinfo.depth_state.hex = RenderState::GetNoDepthTestingDepthStencilState().hex; + pinfo.blend_state.hex = RenderState::GetNoBlendingBlendState().hex; pinfo.multisampling_state.hex = FramebufferManager::GetInstance()->GetEFBMultisamplingState().hex; pinfo.rasterization_state.primitive = guid.GetUidData()->primitive_type; GetPipelineWithCacheResultAsync(pinfo); diff --git a/Source/Core/VideoBackends/Vulkan/Util.cpp b/Source/Core/VideoBackends/Vulkan/Util.cpp index 0f8c17c384..8a94dd42ad 100644 --- a/Source/Core/VideoBackends/Vulkan/Util.cpp +++ b/Source/Core/VideoBackends/Vulkan/Util.cpp @@ -185,36 +185,6 @@ VkBlendFactor GetAlphaBlendFactor(VkBlendFactor factor) } } -RasterizationState GetNoCullRasterizationState() -{ - RasterizationState state = {}; - state.cullmode = GenMode::CULL_NONE; - return state; -} - -DepthState GetNoDepthTestingDepthStencilState() -{ - DepthState state = {}; - state.testenable = false; - state.updateenable = false; - state.func = ZMode::ALWAYS; - return state; -} - -BlendingState GetNoBlendingBlendState() -{ - BlendingState state = {}; - state.blendenable = false; - state.srcfactor = BlendMode::ONE; - state.srcfactoralpha = BlendMode::ZERO; - state.dstfactor = BlendMode::ONE; - state.dstfactoralpha = BlendMode::ZERO; - state.logicopenable = false; - state.colorupdate = true; - state.alphaupdate = true; - return state; -} - void SetViewportAndScissor(VkCommandBuffer command_buffer, int x, int y, int width, int height, float min_depth /*= 0.0f*/, float max_depth /*= 1.0f*/) { @@ -342,10 +312,10 @@ UtilityShaderDraw::UtilityShaderDraw(VkCommandBuffer command_buffer, m_pipeline_info.vs = vertex_shader; m_pipeline_info.gs = geometry_shader; m_pipeline_info.ps = pixel_shader; - m_pipeline_info.rasterization_state.hex = Util::GetNoCullRasterizationState().hex; + m_pipeline_info.rasterization_state.hex = RenderState::GetNoCullRasterizationState().hex; m_pipeline_info.rasterization_state.primitive = primitive; - m_pipeline_info.depth_state.hex = Util::GetNoDepthTestingDepthStencilState().hex; - m_pipeline_info.blend_state.hex = Util::GetNoBlendingBlendState().hex; + m_pipeline_info.depth_state.hex = RenderState::GetNoDepthTestingDepthStencilState().hex; + m_pipeline_info.blend_state.hex = RenderState::GetNoBlendingBlendState().hex; m_pipeline_info.multisampling_state.per_sample_shading = false; m_pipeline_info.multisampling_state.samples = 1; } diff --git a/Source/Core/VideoBackends/Vulkan/Util.h b/Source/Core/VideoBackends/Vulkan/Util.h index 2cb253423f..413e3b96c5 100644 --- a/Source/Core/VideoBackends/Vulkan/Util.h +++ b/Source/Core/VideoBackends/Vulkan/Util.h @@ -38,10 +38,6 @@ VkRect2D ClampRect2D(const VkRect2D& rect, u32 width, u32 height); // Map {SRC,DST}_COLOR to {SRC,DST}_ALPHA VkBlendFactor GetAlphaBlendFactor(VkBlendFactor factor); -RasterizationState GetNoCullRasterizationState(); -DepthState GetNoDepthTestingDepthStencilState(); -BlendingState GetNoBlendingBlendState(); - // Combines viewport and scissor updates void SetViewportAndScissor(VkCommandBuffer command_buffer, int x, int y, int width, int height, float min_depth = 0.0f, float max_depth = 1.0f); diff --git a/Source/Core/VideoCommon/RenderState.cpp b/Source/Core/VideoCommon/RenderState.cpp index d019214206..d8cd5e7f11 100644 --- a/Source/Core/VideoCommon/RenderState.cpp +++ b/Source/Core/VideoCommon/RenderState.cpp @@ -144,3 +144,37 @@ void BlendingState::Generate(const BPMemory& bp) } } } + +namespace RenderState +{ +RasterizationState GetNoCullRasterizationState() +{ + RasterizationState state = {}; + state.cullmode = GenMode::CULL_NONE; + return state; +} + +DepthState GetNoDepthTestingDepthStencilState() +{ + DepthState state = {}; + state.testenable = false; + state.updateenable = false; + state.func = ZMode::ALWAYS; + return state; +} + +BlendingState GetNoBlendingBlendState() +{ + 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 = true; + state.alphaupdate = true; + return state; +} +} diff --git a/Source/Core/VideoCommon/RenderState.h b/Source/Core/VideoCommon/RenderState.h index 03af1f1f3e..d3a006a887 100644 --- a/Source/Core/VideoCommon/RenderState.h +++ b/Source/Core/VideoCommon/RenderState.h @@ -58,3 +58,10 @@ union BlendingState u32 hex; }; + +namespace RenderState +{ +RasterizationState GetNoCullRasterizationState(); +DepthState GetNoDepthTestingDepthStencilState(); +BlendingState GetNoBlendingBlendState(); +}