1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 12:12:50 +01:00
This commit is contained in:
Nekotekina 2013-12-08 05:00:53 +04:00
commit 2135fb9685
4 changed files with 41 additions and 5 deletions

View File

@ -1051,7 +1051,32 @@ void GLGSRender::ExecCMD()
void GLGSRender::Flip()
{
if(m_fbo.IsCreated())
if(m_read_buffer)
{
gcmBuffer* buffers = (gcmBuffer*)Memory.GetMemFromAddr(m_gcm_buffers_addr);
u32 width = re(buffers[m_gcm_current_buffer].width);
u32 height = re(buffers[m_gcm_current_buffer].height);
u32 addr = GetAddress(re(buffers[m_gcm_current_buffer].offset), CELL_GCM_LOCATION_LOCAL);
glRotated(90, 1, 0, 0);
if(Memory.IsGoodAddr(addr))
{
//TODO
//buffer rotating
static Array<u8> pixels;
pixels.SetCount(width * height * 4);
u8* src = (u8*)Memory.VirtualToRealAddr(addr);
for(u32 y=0; y<height; ++y)
{
memcpy(pixels + (height - y - 1) * width * 4, src + y * width * 4, width * 4);
}
glDrawPixels(width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, pixels.GetPtr());
}
}
else if(m_fbo.IsCreated())
{
m_fbo.Bind(GL_READ_FRAMEBUFFER);
GLfbo::Bind(GL_DRAW_FRAMEBUFFER, 0);

View File

@ -126,16 +126,15 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
Flip();
m_gcm_current_buffer = args[0];
m_read_buffer = true;
m_flip_status = 0;
if(m_flip_handler)
{
m_flip_handler.Handle(1, 0, 0);
m_flip_handler.Branch(false);
}
SemaphorePostAndWait(m_sem_flip);
//Emu.Pause();
}
break;
@ -612,6 +611,8 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
//ConLog.Warning("NV4097_SET_BEGIN_END: %x", a0);
m_read_buffer = false;
if(a0)
{
Begin(a0);
@ -1396,7 +1397,12 @@ void RSXThread::Task()
if(put == get || !Emu.IsRunning())
{
if(put == get)
{
if(m_flip_status == 0)
SemaphorePostAndWait(m_sem_flip);
SemaphorePostAndWait(m_sem_flush);
}
Sleep(1);
continue;

View File

@ -516,6 +516,7 @@ public:
u32 m_surface_colour_target;
u8 m_begin_end;
bool m_read_buffer;
protected:
RSXThread()
@ -530,6 +531,8 @@ protected:
, m_draw_mode(0)
, m_draw_array_count(0)
, m_draw_array_first(~0)
, m_gcm_current_buffer(0)
, m_read_buffer(true)
{
m_set_alpha_test = false;
m_set_blend = false;

View File

@ -55,6 +55,8 @@ int cellGcmInit(u32 context_addr, u32 cmdSize, u32 ioSize, u32 ioAddress)
const u32 local_size = 0xf900000; //TODO
const u32 local_addr = Memory.RSXFBMem.GetStartAddr();
cellGcmSys.Warning("*** local memory(addr=0x%x, size=0x%x)", local_addr, local_size);
map_offset_addr = 0;
map_offset_pos = 0;
current_config.ioSize = re32(ioSize);
@ -370,7 +372,7 @@ int cellGcmSetWaitFlip(mem_ptr_t<CellGcmContextData> ctxt)
{
cellGcmSys.Warning("cellGcmSetWaitFlip(ctx=0x%x)", ctxt.GetAddr());
//GSLockCurrent lock(GS_LOCK_WAIT_FLIP);
GSLockCurrent lock(GS_LOCK_WAIT_FLIP);
return CELL_OK;
}