diff --git a/rpcs3/Emu/GS/GCM.h b/rpcs3/Emu/GS/GCM.h index cff6b5a3d1..1b444ae079 100644 --- a/rpcs3/Emu/GS/GCM.h +++ b/rpcs3/Emu/GS/GCM.h @@ -68,6 +68,11 @@ enum CELL_GCM_SMOOTH = 0x1D01, }; +enum +{ + CELL_GCM_SYSTEM_MODE_IOMAP_512MB = 1, +}; + // GCM Texture enum { diff --git a/rpcs3/Emu/GS/GL/GLGSRender.cpp b/rpcs3/Emu/GS/GL/GLGSRender.cpp index a5d9e75731..8022d6864e 100644 --- a/rpcs3/Emu/GS/GL/GLGSRender.cpp +++ b/rpcs3/Emu/GS/GL/GLGSRender.cpp @@ -883,7 +883,7 @@ void GLGSRender::ExecCMD() Enable(m_set_depth_test, GL_DEPTH_TEST); Enable(m_set_alpha_test, GL_ALPHA_TEST); Enable(m_set_depth_bounds_test, GL_DEPTH_BOUNDS_TEST_EXT); - Enable(m_set_blend, GL_BLEND); + Enable(m_set_blend || m_set_blend_mrt1 || m_set_blend_mrt2 || m_set_blend_mrt3, GL_BLEND); Enable(m_set_logic_op, GL_LOGIC_OP); Enable(m_set_cull_face, GL_CULL_FACE); Enable(m_set_dither, GL_DITHER); diff --git a/rpcs3/Emu/GS/RSXThread.cpp b/rpcs3/Emu/GS/RSXThread.cpp index 8901fab043..d028acf755 100644 --- a/rpcs3/Emu/GS/RSXThread.cpp +++ b/rpcs3/Emu/GS/RSXThread.cpp @@ -547,11 +547,9 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 case NV4097_SET_BLEND_ENABLE_MRT: { - if (ARGS(0)) - LOG_WARNING(RSX, "NV4097_SET_BLEND_ENABLE_MRT: %x", ARGS(0)); - - // TODO: - // (cmd)[1] = CELL_GCM_ENDIAN_SWAP(((mrt1) << 1) | ((mrt2) << 2) | ((mrt3) << 3)); + m_set_blend_mrt1 = ARGS(0) & 0x02 ? true : false; + m_set_blend_mrt2 = ARGS(0) & 0x04 ? true : false; + m_set_blend_mrt3 = ARGS(0) & 0x08 ? true : false; } break; diff --git a/rpcs3/Emu/GS/RSXThread.h b/rpcs3/Emu/GS/RSXThread.h index 6fb367dc4f..10c8ef83bb 100644 --- a/rpcs3/Emu/GS/RSXThread.h +++ b/rpcs3/Emu/GS/RSXThread.h @@ -269,6 +269,9 @@ public: u8 m_blend_color_g; u8 m_blend_color_b; u8 m_blend_color_a; + bool m_set_blend_mrt1; + bool m_set_blend_mrt2; + bool m_set_blend_mrt3; // Stencil Test bool m_set_stencil_test; @@ -440,6 +443,9 @@ protected: m_set_alpha_test = false; m_set_depth_bounds_test = false; m_set_blend = false; + m_set_blend_mrt1 = false; + m_set_blend_mrt2 = false; + m_set_blend_mrt3 = false; m_set_logic_op = false; m_set_cull_face = false; m_set_dither = false; @@ -518,6 +524,9 @@ protected: m_set_front_polygon_mode = false; m_set_back_polygon_mode = false; m_set_blend = false; + m_set_blend_mrt1 = false; + m_set_blend_mrt2 = false; + m_set_blend_mrt3 = false; m_set_blend_sfactor = false; m_set_blend_dfactor = false; m_set_blend_equation = false; diff --git a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp index f91232d0c4..72f81606ae 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp @@ -16,6 +16,7 @@ extern Module *cellGcmSys = nullptr; u32 local_size = 0; u32 local_addr = 0; +u32 system_mode = 0; enum { @@ -311,7 +312,17 @@ int cellGcmInit(u32 context_addr, u32 cmdSize, u32 ioSize, u32 ioAddress) cellGcmSys->Warning("*** local memory(addr=0x%x, size=0x%x)", local_addr, local_size); InitOffsetTable(); - Memory.MemoryBlocks.push_back(Memory.RSXIOMem.SetRange(0x50000000, 0x10000000/*256MB*/));//TODO: implement allocateAdressSpace in memoryBase + if (system_mode == CELL_GCM_SYSTEM_MODE_IOMAP_512MB) + { + cellGcmSys->Warning("cellGcmInit(): 512MB io address space used"); + Memory.MemoryBlocks.push_back(Memory.RSXIOMem.SetRange(0x50000000, 0x20000000/*512MB*/));//TODO: implement allocateAdressSpace in memoryBase + } + else + { + cellGcmSys->Warning("cellGcmInit(): 256MB io address space used"); + Memory.MemoryBlocks.push_back(Memory.RSXIOMem.SetRange(0x50000000, 0x10000000/*256MB*/));//TODO: implement allocateAdressSpace in memoryBase + } + if(cellGcmMapEaIoAddress(ioAddress, 0, ioSize) != CELL_OK) { Memory.MemoryBlocks.pop_back(); @@ -729,9 +740,12 @@ u64 cellGcmGetVBlankCount() return Emu.GetGSManager().GetRender().m_vblank_count; } -int cellGcmInitSystemMode() +int cellGcmInitSystemMode(u64 mode) { - UNIMPLEMENTED_FUNC(cellGcmSys); + cellGcmSys->Log("cellGcmInitSystemMode(mode=0x%x)", mode); + + system_mode = mode; + return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp index 5b0713d74f..66edaf3dfa 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp @@ -537,7 +537,7 @@ void SetupRsxRenderingStates(mem_ptr_t& cntxt) r.m_set_depth_mask = true; r.m_depth_mask = 0; r.m_set_alpha_test = false; r.m_set_blend = false; - //GcmCmdTypePrefix::cellGcmSetBlendEnableMrt(con, CELL_GCM_FALSE, CELL_GCM_FALSE, CELL_GCM_FALSE); + r.m_set_blend_mrt1 = r.m_set_blend_mrt2 = r.m_set_blend_mrt3 = false; r.m_set_logic_op = false; r.m_set_cull_face = false; r.m_set_depth_bounds_test = false;