From 403f585a1959beb3a00e337d328e4bf9932ff9ea Mon Sep 17 00:00:00 2001 From: Vincent Lejeune Date: Sat, 10 Oct 2015 01:25:54 +0200 Subject: [PATCH] Remove color mask --- rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp | 17 +++++++---------- rpcs3/Emu/RSX/GL/GLGSRender.cpp | 8 ++++---- rpcs3/Emu/RSX/RSXThread.cpp | 9 --------- rpcs3/Emu/RSX/RSXThread.h | 9 +-------- rpcs3/Emu/SysCalls/Modules/cellResc.cpp | 2 +- rpcs3/Gui/RSXDebugger.cpp | 10 +++++----- 6 files changed, 18 insertions(+), 37 deletions(-) diff --git a/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp b/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp index 05cff617f3..89fad2ef05 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12PipelineState.cpp @@ -297,16 +297,13 @@ bool D3D12GSRender::LoadProgram() break; } - if (m_set_color_mask) - { - UINT8 mask = 0; - mask |= m_color_mask_r ? D3D12_COLOR_WRITE_ENABLE_RED : 0; - mask |= m_color_mask_g ? D3D12_COLOR_WRITE_ENABLE_GREEN : 0; - mask |= m_color_mask_b ? D3D12_COLOR_WRITE_ENABLE_BLUE : 0; - mask |= m_color_mask_a ? D3D12_COLOR_WRITE_ENABLE_ALPHA : 0; - for (unsigned i = 0; i < prop.numMRT; i++) - prop.Blend.RenderTarget[i].RenderTargetWriteMask = mask; - } + UINT8 mask = 0; + mask |= (rsx::method_registers[NV4097_SET_COLOR_MASK] >> 16) & 0xFF ? D3D12_COLOR_WRITE_ENABLE_RED : 0; + mask |= (rsx::method_registers[NV4097_SET_COLOR_MASK] >> 8) & 0xFF ? D3D12_COLOR_WRITE_ENABLE_GREEN : 0; + mask |= rsx::method_registers[NV4097_SET_COLOR_MASK] & 0xFF ? D3D12_COLOR_WRITE_ENABLE_BLUE : 0; + mask |= (rsx::method_registers[NV4097_SET_COLOR_MASK] >> 24) & 0xFF ? D3D12_COLOR_WRITE_ENABLE_ALPHA : 0; + for (unsigned i = 0; i < prop.numMRT; i++) + prop.Blend.RenderTarget[i].RenderTargetWriteMask = mask; prop.IASet = m_IASet; diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.cpp b/rpcs3/Emu/RSX/GL/GLGSRender.cpp index e7705f2539..1382881fb1 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.cpp +++ b/rpcs3/Emu/RSX/GL/GLGSRender.cpp @@ -1578,9 +1578,9 @@ void GLGSRender::clear_surface(u32 arg) { InitDrawBuffers(); - if (m_set_color_mask) +// if (m_set_color_mask) { - glColorMask(m_color_mask_r, m_color_mask_g, m_color_mask_b, m_color_mask_a); +// glColorMask(m_color_mask_r, m_color_mask_g, m_color_mask_b, m_color_mask_a); checkForGlError("glColorMask"); } @@ -1638,9 +1638,9 @@ void GLGSRender::end() InitDrawBuffers(); - if (m_set_color_mask) +// if (m_set_color_mask) { - glColorMask(m_color_mask_r, m_color_mask_g, m_color_mask_b, m_color_mask_a); +// glColorMask(m_color_mask_r, m_color_mask_g, m_color_mask_b, m_color_mask_a); checkForGlError("glColorMask"); } diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 628eca82b3..c5351ae3bb 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -563,17 +563,8 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const // Color Mask case NV4097_SET_COLOR_MASK: - { - const u32 a0 = ARGS(0); - - m_set_color_mask = true; - m_color_mask_a = a0 & 0x1000000 ? true : false; - m_color_mask_r = a0 & 0x0010000 ? true : false; - m_color_mask_g = a0 & 0x0000100 ? true : false; - m_color_mask_b = a0 & 0x0000001 ? true : false; notifyRasterizerStateChange(); break; - } case NV4097_SET_COLOR_MASK_MRT: { diff --git a/rpcs3/Emu/RSX/RSXThread.h b/rpcs3/Emu/RSX/RSXThread.h index 3331fe0a85..176d9aa2cd 100644 --- a/rpcs3/Emu/RSX/RSXThread.h +++ b/rpcs3/Emu/RSX/RSXThread.h @@ -179,13 +179,6 @@ public: // Dither bool m_set_dither; - // Color mask - bool m_set_color_mask; - bool m_color_mask_r; - bool m_color_mask_g; - bool m_color_mask_b; - bool m_color_mask_a; - // Clip bool m_set_clip; float m_clip_min; @@ -509,7 +502,7 @@ protected: rsx::method_registers[NV4097_SET_DEPTH_FUNC] = 0x0201; m_set_dither = false; - m_set_color_mask = false; + rsx::method_registers[NV4097_SET_COLOR_MASK] = -1; m_set_clip = false; m_set_depth_bounds_test = false; m_set_depth_bounds = false; diff --git a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp index 232f4520d2..3d69f9aa4e 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp @@ -468,7 +468,7 @@ void SetupRsxRenderingStates(vm::ptr& cntxt) { //TODO: use cntxt GSRender& r = Emu.GetGSManager().GetRender(); - r.m_set_color_mask = true; r.m_color_mask_a = r.m_color_mask_r = r.m_color_mask_g = r.m_color_mask_b = true; + rsx::method_registers[NV4097_SET_COLOR_MASK] = -1; rsx::method_registers[NV4097_SET_DEPTH_MASK] = 0; r.m_set_alpha_test = false; r.m_set_blend = false; diff --git a/rpcs3/Gui/RSXDebugger.cpp b/rpcs3/Gui/RSXDebugger.cpp index b0de82ceda..be978d3c31 100644 --- a/rpcs3/Gui/RSXDebugger.cpp +++ b/rpcs3/Gui/RSXDebugger.cpp @@ -601,11 +601,11 @@ void RSXDebugger::GetSettings() render.m_blend_color_b, render.m_blend_color_a)); LIST_SETTINGS_ADD("Clipping", wxString::Format("Min:%f, Max:%f", render.m_clip_min, render.m_clip_max)); - LIST_SETTINGS_ADD("Color mask", !(render.m_set_color_mask) ? "(none)" : wxString::Format("R:%d, G:%d, B:%d, A:%d", - render.m_color_mask_r, - render.m_color_mask_g, - render.m_color_mask_b, - render.m_color_mask_a)); + LIST_SETTINGS_ADD("Color mask", !(rsx::method_registers[NV4097_SET_COLOR_MASK]) ? "(none)" : wxString::Format("R:%d, G:%d, B:%d, A:%d", + (rsx::method_registers[NV4097_SET_COLOR_MASK] >> 16) & 0xff, + (rsx::method_registers[NV4097_SET_COLOR_MASK] >> 8) & 0xff, + (rsx::method_registers[NV4097_SET_COLOR_MASK]) & 0xff, + (rsx::method_registers[NV4097_SET_COLOR_MASK] >> 24) & 0xff)); LIST_SETTINGS_ADD("Context DMA Color A", wxString::Format("0x%x", render.m_context_dma_color_a)); LIST_SETTINGS_ADD("Context DMA Color B", wxString::Format("0x%x", render.m_context_dma_color_b)); LIST_SETTINGS_ADD("Context DMA Color C", wxString::Format("0x%x", render.m_context_dma_color_c));