mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-29 22:20:48 +00:00
Improved OpenGL renderer
- Implemented color buffer reading.
This commit is contained in:
parent
bba1b6a6e0
commit
76a93443c3
@ -1051,7 +1051,20 @@ void GLGSRender::ExecCMD()
|
|||||||
|
|
||||||
void GLGSRender::Flip()
|
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);
|
||||||
|
|
||||||
|
if(Memory.IsGoodAddr(addr))
|
||||||
|
{
|
||||||
|
void* pixels = Memory.VirtualToRealAddr(addr);
|
||||||
|
glDrawPixels(width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, pixels);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(m_fbo.IsCreated())
|
||||||
{
|
{
|
||||||
m_fbo.Bind(GL_READ_FRAMEBUFFER);
|
m_fbo.Bind(GL_READ_FRAMEBUFFER);
|
||||||
GLfbo::Bind(GL_DRAW_FRAMEBUFFER, 0);
|
GLfbo::Bind(GL_DRAW_FRAMEBUFFER, 0);
|
||||||
|
@ -126,16 +126,15 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3
|
|||||||
Flip();
|
Flip();
|
||||||
|
|
||||||
m_gcm_current_buffer = args[0];
|
m_gcm_current_buffer = args[0];
|
||||||
|
m_read_buffer = true;
|
||||||
m_flip_status = 0;
|
m_flip_status = 0;
|
||||||
|
|
||||||
if(m_flip_handler)
|
if(m_flip_handler)
|
||||||
{
|
{
|
||||||
m_flip_handler.Handle(1, 0, 0);
|
m_flip_handler.Handle(1, 0, 0);
|
||||||
m_flip_handler.Branch(false);
|
m_flip_handler.Branch(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
SemaphorePostAndWait(m_sem_flip);
|
|
||||||
|
|
||||||
//Emu.Pause();
|
//Emu.Pause();
|
||||||
}
|
}
|
||||||
break;
|
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);
|
//ConLog.Warning("NV4097_SET_BEGIN_END: %x", a0);
|
||||||
|
|
||||||
|
m_read_buffer = false;
|
||||||
|
|
||||||
if(a0)
|
if(a0)
|
||||||
{
|
{
|
||||||
Begin(a0);
|
Begin(a0);
|
||||||
@ -1396,7 +1397,12 @@ void RSXThread::Task()
|
|||||||
if(put == get || !Emu.IsRunning())
|
if(put == get || !Emu.IsRunning())
|
||||||
{
|
{
|
||||||
if(put == get)
|
if(put == get)
|
||||||
|
{
|
||||||
|
if(m_flip_status == 0)
|
||||||
|
SemaphorePostAndWait(m_sem_flip);
|
||||||
|
|
||||||
SemaphorePostAndWait(m_sem_flush);
|
SemaphorePostAndWait(m_sem_flush);
|
||||||
|
}
|
||||||
|
|
||||||
Sleep(1);
|
Sleep(1);
|
||||||
continue;
|
continue;
|
||||||
|
@ -516,6 +516,7 @@ public:
|
|||||||
u32 m_surface_colour_target;
|
u32 m_surface_colour_target;
|
||||||
|
|
||||||
u8 m_begin_end;
|
u8 m_begin_end;
|
||||||
|
bool m_read_buffer;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RSXThread()
|
RSXThread()
|
||||||
@ -530,6 +531,8 @@ protected:
|
|||||||
, m_draw_mode(0)
|
, m_draw_mode(0)
|
||||||
, m_draw_array_count(0)
|
, m_draw_array_count(0)
|
||||||
, m_draw_array_first(~0)
|
, m_draw_array_first(~0)
|
||||||
|
, m_gcm_current_buffer(0)
|
||||||
|
, m_read_buffer(true)
|
||||||
{
|
{
|
||||||
m_set_alpha_test = false;
|
m_set_alpha_test = false;
|
||||||
m_set_blend = false;
|
m_set_blend = false;
|
||||||
|
@ -55,6 +55,8 @@ int cellGcmInit(u32 context_addr, u32 cmdSize, u32 ioSize, u32 ioAddress)
|
|||||||
const u32 local_size = 0xf900000; //TODO
|
const u32 local_size = 0xf900000; //TODO
|
||||||
const u32 local_addr = Memory.RSXFBMem.GetStartAddr();
|
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_addr = 0;
|
||||||
map_offset_pos = 0;
|
map_offset_pos = 0;
|
||||||
current_config.ioSize = re32(ioSize);
|
current_config.ioSize = re32(ioSize);
|
||||||
@ -370,7 +372,7 @@ int cellGcmSetWaitFlip(mem_ptr_t<CellGcmContextData> ctxt)
|
|||||||
{
|
{
|
||||||
cellGcmSys.Warning("cellGcmSetWaitFlip(ctx=0x%x)", ctxt.GetAddr());
|
cellGcmSys.Warning("cellGcmSetWaitFlip(ctx=0x%x)", ctxt.GetAddr());
|
||||||
|
|
||||||
//GSLockCurrent lock(GS_LOCK_WAIT_FLIP);
|
GSLockCurrent lock(GS_LOCK_WAIT_FLIP);
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user