From 5f3ea1005a7fce603969f1f81cb83b2971914536 Mon Sep 17 00:00:00 2001 From: raven02 Date: Sun, 20 Jul 2014 14:46:50 +0800 Subject: [PATCH 1/2] Make a spelling difference consistent --- rpcs3/Emu/GS/GL/GLGSRender.cpp | 65 ++++++++++++------------- rpcs3/Emu/GS/GL/GLGSRender.h | 8 +-- rpcs3/Emu/GS/RSXThread.cpp | 2 +- rpcs3/Emu/GS/RSXThread.h | 2 +- rpcs3/Emu/SysCalls/Modules/cellResc.cpp | 4 +- 5 files changed, 39 insertions(+), 42 deletions(-) diff --git a/rpcs3/Emu/GS/GL/GLGSRender.cpp b/rpcs3/Emu/GS/GL/GLGSRender.cpp index 8a7f082f83..34d5f43399 100644 --- a/rpcs3/Emu/GS/GL/GLGSRender.cpp +++ b/rpcs3/Emu/GS/GL/GLGSRender.cpp @@ -461,9 +461,6 @@ void GLGSRender::WriteDepthBuffer() return; } - // Reset the flag - m_set_context_dma_z = false; - u32 address = GetAddress(m_surface_offset_z, m_context_dma_z - 0xfeed0000); if (!Memory.IsGoodAddr(address)) { @@ -491,7 +488,7 @@ void GLGSRender::WriteDepthBuffer() } -void GLGSRender::WriteColourBufferA() +void GLGSRender::WriteColorBufferA() { if (!m_set_context_dma_color_a) { @@ -501,16 +498,16 @@ void GLGSRender::WriteColourBufferA() u32 address = GetAddress(m_surface_offset_a, m_context_dma_color_a - 0xfeed0000); if (!Memory.IsGoodAddr(address)) { - LOG_WARNING(RSX, "Bad colour buffer a address: address=0x%x, offset=0x%x, dma=0x%x", address, m_surface_offset_a, m_context_dma_color_a); + LOG_WARNING(RSX, "Bad color buffer a address: address=0x%x, offset=0x%x, dma=0x%x", address, m_surface_offset_a, m_context_dma_color_a); return; } glReadBuffer(GL_COLOR_ATTACHMENT0); - checkForGlError("WriteColourBufferA(): glReadBuffer(GL_COLOR_ATTACHMENT0)"); + checkForGlError("WriteColorBufferA(): glReadBuffer(GL_COLOR_ATTACHMENT0)"); glBindBuffer(GL_PIXEL_PACK_BUFFER, g_pbo[0]); glBufferData(GL_PIXEL_PACK_BUFFER, RSXThread::m_buffer_width * RSXThread::m_buffer_height * 4, 0, GL_STREAM_READ); glReadPixels(0, 0, RSXThread::m_buffer_width, RSXThread::m_buffer_height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, 0); - checkForGlError("WriteColourBufferA(): glReadPixels(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8)"); + checkForGlError("WriteColorBufferA(): glReadPixels(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8)"); GLubyte *packed = (GLubyte *)glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY); if (packed) { @@ -520,7 +517,7 @@ void GLGSRender::WriteColourBufferA() glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); } -void GLGSRender::WriteColourBufferB() +void GLGSRender::WriteColorBufferB() { if (!m_set_context_dma_color_b) { @@ -530,16 +527,16 @@ void GLGSRender::WriteColourBufferB() u32 address = GetAddress(m_surface_offset_b, m_context_dma_color_b - 0xfeed0000); if (!Memory.IsGoodAddr(address)) { - LOG_WARNING(RSX, "Bad colour buffer b address: address=0x%x, offset=0x%x, dma=0x%x", address, m_surface_offset_b, m_context_dma_color_b); + LOG_WARNING(RSX, "Bad color buffer b address: address=0x%x, offset=0x%x, dma=0x%x", address, m_surface_offset_b, m_context_dma_color_b); return; } glReadBuffer(GL_COLOR_ATTACHMENT1); - checkForGlError("WriteColourBufferB(): glReadBuffer(GL_COLOR_ATTACHMENT1)"); + checkForGlError("WriteColorBufferB(): glReadBuffer(GL_COLOR_ATTACHMENT1)"); glBindBuffer(GL_PIXEL_PACK_BUFFER, g_pbo[1]); glBufferData(GL_PIXEL_PACK_BUFFER, RSXThread::m_buffer_width * RSXThread::m_buffer_height * 4, 0, GL_STREAM_READ); glReadPixels(0, 0, RSXThread::m_buffer_width, RSXThread::m_buffer_height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, 0); - checkForGlError("WriteColourBufferB(): glReadPixels(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8)"); + checkForGlError("WriteColorBufferB(): glReadPixels(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8)"); GLubyte *packed = (GLubyte *)glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY); if (packed) { @@ -550,7 +547,7 @@ void GLGSRender::WriteColourBufferB() } -void GLGSRender::WriteColourBufferC() +void GLGSRender::WriteColorBufferC() { if (!m_set_context_dma_color_c) { @@ -560,16 +557,16 @@ void GLGSRender::WriteColourBufferC() u32 address = GetAddress(m_surface_offset_c, m_context_dma_color_c - 0xfeed0000); if (!Memory.IsGoodAddr(address)) { - LOG_WARNING(RSX, "Bad colour buffer c address: address=0x%x, offset=0x%x, dma=0x%x", address, m_surface_offset_c, m_context_dma_color_c); + LOG_WARNING(RSX, "Bad color buffer c address: address=0x%x, offset=0x%x, dma=0x%x", address, m_surface_offset_c, m_context_dma_color_c); return; } glReadBuffer(GL_COLOR_ATTACHMENT2); - checkForGlError("WriteColourBufferC(): glReadBuffer(GL_COLOR_ATTACHMENT2)"); + checkForGlError("WriteColorBufferC(): glReadBuffer(GL_COLOR_ATTACHMENT2)"); glBindBuffer(GL_PIXEL_PACK_BUFFER, g_pbo[2]); glBufferData(GL_PIXEL_PACK_BUFFER, RSXThread::m_buffer_width * RSXThread::m_buffer_height * 4, 0, GL_STREAM_READ); glReadPixels(0, 0, RSXThread::m_buffer_width, RSXThread::m_buffer_height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, 0); - checkForGlError("WriteColourBufferC(): glReadPixels(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8)"); + checkForGlError("WriteColorBufferC(): glReadPixels(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8)"); GLubyte *packed = (GLubyte *)glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY); if (packed) { @@ -579,7 +576,7 @@ void GLGSRender::WriteColourBufferC() glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); } -void GLGSRender::WriteColourBufferD() +void GLGSRender::WriteColorBufferD() { if (!m_set_context_dma_color_d) { @@ -589,16 +586,16 @@ void GLGSRender::WriteColourBufferD() u32 address = GetAddress(m_surface_offset_d, m_context_dma_color_d - 0xfeed0000); if (!Memory.IsGoodAddr(address)) { - LOG_WARNING(RSX, "Bad colour buffer d address: address=0x%x, offset=0x%x, dma=0x%x", address, m_surface_offset_d, m_context_dma_color_d); + LOG_WARNING(RSX, "Bad color buffer d address: address=0x%x, offset=0x%x, dma=0x%x", address, m_surface_offset_d, m_context_dma_color_d); return; } glReadBuffer(GL_COLOR_ATTACHMENT3); - checkForGlError("WriteColourBufferD(): glReadBuffer(GL_COLOR_ATTACHMENT3)"); + checkForGlError("WriteColorBufferD(): glReadBuffer(GL_COLOR_ATTACHMENT3)"); glBindBuffer(GL_PIXEL_PACK_BUFFER, g_pbo[3]); glBufferData(GL_PIXEL_PACK_BUFFER, RSXThread::m_buffer_width * RSXThread::m_buffer_height * 4, 0, GL_STREAM_READ); glReadPixels(0, 0, RSXThread::m_buffer_width, RSXThread::m_buffer_height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, 0); - checkForGlError("WriteColourBufferD(): glReadPixels(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8)"); + checkForGlError("WriteColorBufferD(): glReadPixels(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8)"); GLubyte *packed = (GLubyte *)glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY); if (packed) { @@ -614,35 +611,35 @@ void GLGSRender::WriteColorBuffers() glPixelStorei(GL_PACK_ROW_LENGTH, 0); glPixelStorei(GL_PACK_ALIGNMENT, 4); - switch(m_surface_colour_target) + switch(m_surface_color_target) { case CELL_GCM_SURFACE_TARGET_NONE: return; case CELL_GCM_SURFACE_TARGET_0: - WriteColourBufferA(); + WriteColorBufferA(); break; case CELL_GCM_SURFACE_TARGET_1: - WriteColourBufferB(); + WriteColorBufferB(); break; case CELL_GCM_SURFACE_TARGET_MRT1: - WriteColourBufferA(); - WriteColourBufferB(); + WriteColorBufferA(); + WriteColorBufferB(); break; case CELL_GCM_SURFACE_TARGET_MRT2: - WriteColourBufferA(); - WriteColourBufferB(); - WriteColourBufferC(); + WriteColorBufferA(); + WriteColorBufferB(); + WriteColorBufferC(); break; case CELL_GCM_SURFACE_TARGET_MRT3: - WriteColourBufferA(); - WriteColourBufferB(); - WriteColourBufferC(); - WriteColourBufferD(); + WriteColorBufferA(); + WriteColorBufferB(); + WriteColorBufferC(); + WriteColorBufferD(); break; } } @@ -802,7 +799,7 @@ void GLGSRender::InitDrawBuffers() static const GLenum draw_buffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3 }; - switch(m_surface_colour_target) + switch(m_surface_color_target) { case CELL_GCM_SURFACE_TARGET_NONE: break; @@ -828,7 +825,7 @@ void GLGSRender::InitDrawBuffers() break; default: - LOG_ERROR(RSX, "Bad surface colour target: %d", m_surface_colour_target); + LOG_ERROR(RSX, "Bad surface color target: %d", m_surface_color_target); break; } } @@ -1194,7 +1191,7 @@ void GLGSRender::Flip() checkForGlError("glScissor"); } - switch (m_surface_colour_target) + switch (m_surface_color_target) { case CELL_GCM_SURFACE_TARGET_0: case CELL_GCM_SURFACE_TARGET_1: diff --git a/rpcs3/Emu/GS/GL/GLGSRender.h b/rpcs3/Emu/GS/GL/GLGSRender.h index f327cf2091..8596ed0116 100644 --- a/rpcs3/Emu/GS/GL/GLGSRender.h +++ b/rpcs3/Emu/GS/GL/GLGSRender.h @@ -849,10 +849,10 @@ private: void WriteBuffers(); void WriteDepthBuffer(); void WriteColorBuffers(); - void WriteColourBufferA(); - void WriteColourBufferB(); - void WriteColourBufferC(); - void WriteColourBufferD(); + void WriteColorBufferA(); + void WriteColorBufferB(); + void WriteColorBufferC(); + void WriteColorBufferD(); void DrawObjects(); void InitDrawBuffers(); diff --git a/rpcs3/Emu/GS/RSXThread.cpp b/rpcs3/Emu/GS/RSXThread.cpp index b8e5a58074..f7b40be108 100644 --- a/rpcs3/Emu/GS/RSXThread.cpp +++ b/rpcs3/Emu/GS/RSXThread.cpp @@ -1368,7 +1368,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t args, const u32 case NV4097_SET_SURFACE_COLOR_TARGET: { - m_surface_colour_target = ARGS(0); + m_surface_color_target = ARGS(0); } break; diff --git a/rpcs3/Emu/GS/RSXThread.h b/rpcs3/Emu/GS/RSXThread.h index 7f7fce9acf..a519e6ea58 100644 --- a/rpcs3/Emu/GS/RSXThread.h +++ b/rpcs3/Emu/GS/RSXThread.h @@ -379,7 +379,7 @@ public: u32 m_surface_offset_c; u32 m_surface_offset_d; u32 m_surface_offset_z; - u32 m_surface_colour_target; + u32 m_surface_color_target; // DMA context bool m_set_context_dma_color_a; diff --git a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp index 4b61ee5c34..3d5da159b7 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp @@ -565,7 +565,7 @@ void SetupRsxRenderingStates(mem_ptr_t& cntxt) r.m_height = s_rescInternalInstance->m_dstHeight; r.m_surface_depth_format = 2; - r.m_surface_colour_target = 1; + r.m_surface_color_target = 1; if (IsPalInterpolate()) { @@ -606,7 +606,7 @@ void SetupSurfaces(mem_ptr_t& cntxt) r.m_surface_type = CELL_GCM_SURFACE_PITCH; r.m_surface_antialias = CELL_GCM_SURFACE_CENTER_1; r.m_surface_color_format = (u8)s_rescInternalInstance->m_pRescDsts->format; - r.m_surface_colour_target = (!isMrt) ? CELL_GCM_SURFACE_TARGET_0 : CELL_GCM_SURFACE_TARGET_MRT1; + r.m_surface_color_target = (!isMrt) ? CELL_GCM_SURFACE_TARGET_0 : CELL_GCM_SURFACE_TARGET_MRT1; //surface.colorLocation[0] = CELL_GCM_LOCATION_LOCAL; r.m_surface_offset_a = dstOffset0; r.m_surface_pitch_a = s_rescInternalInstance->m_dstPitch; From 9c2fe3b25d4f2b5b52882537ff713ff6d1324dc3 Mon Sep 17 00:00:00 2001 From: DHrpcs3 Date: Mon, 21 Jul 2014 09:57:07 +0000 Subject: [PATCH 2/2] Revert "Regression fix #343" --- rpcs3/Emu/GS/GL/GLFragmentProgram.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp b/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp index ffbd115437..a3f43a09dc 100644 --- a/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp +++ b/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp @@ -248,9 +248,9 @@ template std::string GLFragmentDecompilerThread::GetSRC(T src) std::string GLFragmentDecompilerThread::BuildCode() { //main += fmt::Format("\tgl_FragColor = %c0;\n", m_ctrl & 0x40 ? 'r' : 'h'); - AddCode(m_parr.AddParam(PARAM_OUT, "vec4", "ocol0", 0) + " = " + (m_ctrl & 0x40 ? "r0" : "h0") + ";\n"); static const std::pair table[] = { + { "ocol0", m_ctrl & 0x40 ? "r0" : "h0" }, { "ocol1", m_ctrl & 0x40 ? "r2" : "h2" }, { "ocol2", m_ctrl & 0x40 ? "r3" : "h4" }, { "ocol3", m_ctrl & 0x40 ? "r4" : "h6" }, @@ -260,7 +260,7 @@ std::string GLFragmentDecompilerThread::BuildCode() for (int i = 0; i < sizeof(table) / sizeof(*table); ++i) { if (m_parr.HasParam(PARAM_NONE, "vec4", table[i].second)) - AddCode(m_parr.AddParam(PARAM_OUT, "vec4", table[i].first, i+1) + " = " + table[i].second + ";"); + AddCode(m_parr.AddParam(PARAM_OUT, "vec4", table[i].first, i) + " = " + table[i].second + ";"); } if (m_ctrl & 0xe) main += "\tgl_FragDepth = r1.z;\n";