RSX: matrix offset fix and use original buffer width for writing color/depth

This commit is contained in:
raven02 2014-06-21 06:57:23 +08:00
parent e79236a97f
commit 12f217aba9
3 changed files with 12 additions and 14 deletions

View File

@ -294,7 +294,7 @@ void GLGSRender::InitVertexData()
// Offset
scaleOffsetMat[3] = (GLfloat&)methodRegisters[NV4097_SET_VIEWPORT_OFFSET + (0x4 * 0)] - (RSXThread::m_width / RSXThread::m_width_scale);
scaleOffsetMat[7] = (GLfloat&)methodRegisters[NV4097_SET_VIEWPORT_OFFSET + (0x4 * 1)] - (RSXThread::m_height / RSXThread::m_height_scale);
scaleOffsetMat[11] = (GLfloat&)methodRegisters[NV4097_SET_VIEWPORT_OFFSET + (0x4 * 2)];
scaleOffsetMat[11] = (GLfloat&)methodRegisters[NV4097_SET_VIEWPORT_OFFSET + (0x4 * 2)] - 1 / 2.0f;
scaleOffsetMat[3] /= RSXThread::m_width / RSXThread::m_width_scale;
scaleOffsetMat[7] /= RSXThread::m_height / RSXThread::m_height_scale;
@ -452,11 +452,11 @@ void GLGSRender::WriteDepthBuffer()
return;
}
glReadPixels(0, 0, RSXThread::m_width, RSXThread::m_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, &Memory[address]);
glReadPixels(0, 0, RSXThread::m_buffer_width, RSXThread::m_buffer_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, &Memory[address]);
checkForGlError("glReadPixels");
glBindTexture(GL_TEXTURE_2D, g_depth_tex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, RSXThread::m_width, RSXThread::m_height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &Memory[address]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, RSXThread::m_buffer_width, RSXThread::m_buffer_height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &Memory[address]);
checkForGlError("glTexImage2D");
glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, &Memory[address]);
checkForGlError("glGetTexImage");
@ -481,7 +481,7 @@ void GLGSRender::WriteColourBufferA()
glReadBuffer(GL_COLOR_ATTACHMENT0);
checkForGlError("glReadBuffer(GL_COLOR_ATTACHMENT0)");
glReadPixels(0, 0, RSXThread::m_width, RSXThread::m_height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, &Memory[address]);
glReadPixels(0, 0, RSXThread::m_buffer_width, RSXThread::m_buffer_height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, &Memory[address]);
checkForGlError("glReadPixels(GL_RGBA, GL_UNSIGNED_INT_8_8_8_8)");
}
@ -504,7 +504,7 @@ void GLGSRender::WriteColourBufferB()
glReadBuffer(GL_COLOR_ATTACHMENT1);
checkForGlError("glReadBuffer(GL_COLOR_ATTACHMENT1)");
glReadPixels(0, 0, RSXThread::m_width, RSXThread::m_height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, &Memory[address]);
glReadPixels(0, 0, RSXThread::m_buffer_width, RSXThread::m_buffer_height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, &Memory[address]);
checkForGlError("glReadPixels(GL_RGBA, GL_UNSIGNED_INT_8_8_8_8)");
}
@ -527,7 +527,7 @@ void GLGSRender::WriteColourBufferC()
glReadBuffer(GL_COLOR_ATTACHMENT2);
checkForGlError("glReadBuffer(GL_COLOR_ATTACHMENT2)");
glReadPixels(0, 0, RSXThread::m_width, RSXThread::m_height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, &Memory[address]);
glReadPixels(0, 0, RSXThread::m_buffer_width, RSXThread::m_buffer_height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, &Memory[address]);
checkForGlError("glReadPixels(GL_RGBA, GL_UNSIGNED_INT_8_8_8_8)");
}
@ -550,7 +550,7 @@ void GLGSRender::WriteColourBufferD()
glReadBuffer(GL_COLOR_ATTACHMENT3);
checkForGlError("glReadBuffer(GL_COLOR_ATTACHMENT3)");
glReadPixels(0, 0, RSXThread::m_width, RSXThread::m_height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, &Memory[address]);
glReadPixels(0, 0, RSXThread::m_buffer_width, RSXThread::m_buffer_height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, &Memory[address]);
checkForGlError("glReadPixels(GL_RGBA, GL_UNSIGNED_INT_8_8_8_8)");
}

View File

@ -1267,10 +1267,6 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
if (Ini.GSDownscale.GetValue() && Ini.GSResolution.GetValue() == 4)
{
// Disable write color/depth buffer during downscaling as it is not yet scaled propertly
Ini.GSDumpColorBuffers.SetValue(false);
Ini.GSDumpDepthBuffer.SetValue(false);
if (m_width == 1280 && m_height == 720)
{
// Set scale ratio for 720p
@ -1867,7 +1863,7 @@ void RSXThread::End()
void RSXThread::Task()
{
u8 inc;
ConLog.Write("RSX thread entry");
ConLog.Write("RSX thread enter");
OnInitThread();
@ -1957,7 +1953,7 @@ void RSXThread::Task()
//memset(Memory.GetMemFromAddr(p.m_ioAddress + get), 0, (count + 1) * 4);
}
ConLog.Write("RSX thread exit...");
ConLog.Write("RSX thread exit");
OnExitThread();
}

View File

@ -140,6 +140,8 @@ public:
u32 m_width;
u32 m_height;
u32 m_buffer_width;
u32 m_buffer_height;
float m_width_scale;
float m_height_scale;
u32 m_draw_array_count;