Merge pull request #354 from raven02/patch-34

RSX: matrix offset fix and use original buffer width/height for writing color/depth
This commit is contained in:
B1ackDaemon 2014-06-21 07:58:11 +03:00
commit 283c1f64e7
7 changed files with 43 additions and 45 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 started");
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 ended");
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;

View File

@ -36,7 +36,7 @@ next:
{
if (Emu.IsStopped())
{
ConLog.Warning("adecRawRead() aborted");
ConLog.Warning("adecRawRead(): aborted");
return 0;
}
Sleep(1);
@ -53,7 +53,7 @@ next:
{
if (!Memory.CopyToReal(buf, adec.reader.addr, adec.reader.size))
{
ConLog.Error("adecRawRead: data reading failed (reader.size=0x%x)", adec.reader.size);
ConLog.Error("adecRawRead(): data reading failed (reader.size=0x%x)", adec.reader.size);
Emu.Pause();
return 0;
}
@ -89,7 +89,7 @@ next:
}
else if (!Memory.CopyToReal(buf, adec.reader.addr, buf_size))
{
ConLog.Error("adecRawRead: data reading failed (buf_size=0x%x)", buf_size);
ConLog.Error("adecRawRead(): data reading failed (buf_size=0x%x)", buf_size);
Emu.Pause();
return 0;
}
@ -111,7 +111,7 @@ int adecRead(void* opaque, u8* buf, int buf_size)
{
if (buf_size < (int)adec.reader.rem_size)
{
ConLog.Error("adecRead: too small buf_size (rem_size = %d, buf_size = %d)", adec.reader.rem_size, buf_size);
ConLog.Error("adecRead(): too small buf_size (rem_size = %d, buf_size = %d)", adec.reader.rem_size, buf_size);
Emu.Pause();
return 0;
}
@ -131,7 +131,7 @@ int adecRead(void* opaque, u8* buf, int buf_size)
if (adecRawRead(opaque, header, 8) < 8) break;
if (header[0] != 0x0f || header[1] != 0xd0)
{
ConLog.Error("adecRead: 0x0FD0 header not found");
ConLog.Error("adecRead(): 0x0FD0 header not found");
Emu.Pause();
return -1;
}
@ -141,7 +141,7 @@ int adecRead(void* opaque, u8* buf, int buf_size)
OMAHeader oma(1 /* atrac3p id */, header[2], header[3]);
if (buf_size < sizeof(oma) + 8)
{
ConLog.Error("adecRead: OMAHeader writing failed");
ConLog.Error("adecRead(): OMAHeader writing failed");
Emu.Pause();
return 0;
}
@ -198,7 +198,7 @@ u32 adecOpen(AudioDecoder* data)
thread t("Audio Decoder[" + std::to_string(adec_id) + "] Thread", [&]()
{
ConLog.Write("Audio Decoder enter()");
ConLog.Write("Audio Decoder thread started");
AdecTask& task = adec.task;
@ -371,7 +371,7 @@ u32 adecOpen(AudioDecoder* data)
{
if (Emu.IsStopped())
{
ConLog.Warning("adecDecodeAu aborted");
ConLog.Warning("adecDecodeAu: aborted");
return;
}
@ -497,16 +497,16 @@ u32 adecOpen(AudioDecoder* data)
case adecClose:
{
adec.is_finished = true;
ConLog.Write("Audio Decoder exit");
ConLog.Write("Audio Decoder thread ended");
return;
}
default:
ConLog.Error("Audio Decoder error: unknown task(%d)", task.type);
ConLog.Error("Audio Decoder thread error: unknown task(%d)", task.type);
}
}
adec.is_finished = true;
ConLog.Warning("Audio Decoder aborted");
ConLog.Warning("Audio Decoder thread aborted");
});
t.detach();

View File

@ -50,11 +50,11 @@ int cellAudioInit()
if (do_dump && !m_dump.Init())
{
ConLog.Error("Audio aborted: AudioDumper::Init() failed");
ConLog.Error("cellAudioInit(): AudioDumper::Init() failed");
return;
}
ConLog.Write("Audio started");
ConLog.Write("Audio thread started");
if (Ini.AudioDumpToFile.GetValue())
m_dump.WriteHeader();
@ -146,7 +146,7 @@ int cellAudioInit()
{
if (Emu.IsStopped())
{
ConLog.Warning("Audio aborted");
ConLog.Warning("Audio thread aborted");
goto abort;
}
@ -426,7 +426,7 @@ int cellAudioInit()
{
if (m_dump.WriteData(&buf8ch, sizeof(buf8ch)) != sizeof(buf8ch)) // write file data
{
ConLog.Error("Audio aborted: AudioDumper::WriteData() failed");
ConLog.Error("cellAudioInit(): AudioDumper::WriteData() failed");
goto abort;
}
}
@ -434,13 +434,13 @@ int cellAudioInit()
{
if (m_dump.WriteData(&buf2ch, sizeof(buf2ch)) != sizeof(buf2ch)) // write file data
{
ConLog.Error("Audio aborted: AudioDumper::WriteData() failed");
ConLog.Error("cellAudioInit(): AudioDumper::WriteData() failed");
goto abort;
}
}
else
{
ConLog.Error("Audio aborted: unknown AudioDumper::GetCh() value (%d)", m_dump.GetCh());
ConLog.Error("cellAudioInit(): unknown AudioDumper::GetCh() value (%d)", m_dump.GetCh());
goto abort;
}
}
@ -448,7 +448,7 @@ int cellAudioInit()
//ConLog.Write("Audio perf: start=%d (access=%d, AddData=%d, events=%d, dump=%d)",
//stamp0 - m_config.start_time, stamp1 - stamp0, stamp2 - stamp1, stamp3 - stamp2, get_system_time() - stamp3);
}
ConLog.Write("Audio finished");
ConLog.Write("Audio thread ended");
abort:
queue.Push(nullptr);
queue_float.Push(nullptr);
@ -505,7 +505,7 @@ int cellAudioQuit()
Sleep(1);
if (Emu.IsStopped())
{
ConLog.Warning("cellAudioQuit() aborted");
ConLog.Warning("cellAudioQuit(): aborted");
return CELL_OK;
}
}

View File

@ -47,7 +47,7 @@ u32 dmuxOpen(Demuxer* data)
thread t("Demuxer[" + std::to_string(dmux_id) + "] Thread", [&]()
{
ConLog.Write("Demuxer enter (mem=0x%x, size=0x%x, cb=0x%x, arg=0x%x)", dmux.memAddr, dmux.memSize, dmux.cbFunc, dmux.cbArg);
ConLog.Write("Demuxer thread started (mem=0x%x, size=0x%x, cb=0x%x, arg=0x%x)", dmux.memAddr, dmux.memSize, dmux.cbFunc, dmux.cbArg);
DemuxerTask task;
DemuxerStream stream;
@ -357,7 +357,7 @@ u32 dmuxOpen(Demuxer* data)
case dmuxClose:
{
dmux.is_finished = true;
ConLog.Write("Demuxer exit");
ConLog.Write("Demuxer thread ended");
return;
}
@ -450,11 +450,11 @@ u32 dmuxOpen(Demuxer* data)
break;
default:
ConLog.Error("Demuxer error: unknown task(%d)", task.type);
ConLog.Error("Demuxer thread error: unknown task(%d)", task.type);
return;
}
}
ConLog.Warning("Demuxer aborted");
ConLog.Warning("Demuxer thread aborted");
});
t.detach();

View File

@ -35,7 +35,7 @@ next:
{
if (Emu.IsStopped())
{
ConLog.Warning("vdecRead() aborted");
ConLog.Warning("vdecRead(): aborted");
return 0;
}
Sleep(1);
@ -52,7 +52,7 @@ next:
{
if (!Memory.CopyToReal(buf, vdec.reader.addr, vdec.reader.size))
{
ConLog.Error("vdecRead: data reading failed (reader.size=0x%x)", vdec.reader.size);
ConLog.Error("vdecRead(): data reading failed (reader.size=0x%x)", vdec.reader.size);
Emu.Pause();
return 0;
}
@ -92,7 +92,7 @@ next:
}
else if (!Memory.CopyToReal(buf, vdec.reader.addr, buf_size))
{
ConLog.Error("vdecRead: data reading failed (buf_size=0x%x)", buf_size);
ConLog.Error("vdecRead(): data reading failed (buf_size=0x%x)", buf_size);
Emu.Pause();
return 0;
}
@ -136,7 +136,7 @@ u32 vdecOpen(VideoDecoder* data)
thread t("Video Decoder[" + std::to_string(vdec_id) + "] Thread", [&]()
{
ConLog.Write("Video Decoder enter()");
ConLog.Write("Video Decoder thread started");
VdecTask& task = vdec.task;
@ -305,7 +305,7 @@ u32 vdecOpen(VideoDecoder* data)
{
if (Emu.IsStopped())
{
ConLog.Warning("vdecDecodeAu aborted");
ConLog.Warning("vdecDecodeAu: aborted");
return;
}
@ -398,7 +398,7 @@ u32 vdecOpen(VideoDecoder* data)
case vdecClose:
{
vdec.is_finished = true;
ConLog.Write("Video Decoder exit");
ConLog.Write("Video Decoder thread ended");
return;
}
@ -409,12 +409,12 @@ u32 vdecOpen(VideoDecoder* data)
break;
default:
ConLog.Error("Video Decoder error: unknown task(%d)", task.type);
ConLog.Error("Video Decoder thread error: unknown task(%d)", task.type);
}
}
vdec.is_finished = true;
ConLog.Warning("Video Decoder aborted");
ConLog.Warning("Video Decoder thread aborted");
});
t.detach();