mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-10 21:40:43 +00:00
Merge branch 'master' of https://github.com/DHrpcs3/rpcs3
This commit is contained in:
commit
da8194d659
@ -248,9 +248,9 @@ template<typename T> 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<std::string, std::string> 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";
|
||||
|
@ -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:
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -565,7 +565,7 @@ void SetupRsxRenderingStates(mem_ptr_t<CellGcmContextData>& 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<CellGcmContextData>& 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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user