Skip to content

Commit

Permalink
Merge pull request #167 from neobrain/ogl-efbpokes
Browse files Browse the repository at this point in the history
Implement EFB pokes in the OpenGL backend.
  • Loading branch information
Sonicadvance1 committed Mar 20, 2014
2 parents 51fdf8a + d946e4e commit 89efec6
Showing 1 changed file with 38 additions and 4 deletions.
42 changes: 38 additions & 4 deletions Source/Core/VideoBackends/OGL/Render.cpp
Expand Up @@ -1065,12 +1065,46 @@ u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
}

case POKE_COLOR:
{
ResetAPIState();

glClearColor(float((poke_data >> 16) & 0xFF) / 255.0f,
float((poke_data >> 8) & 0xFF) / 255.0f,
float((poke_data >> 0) & 0xFF) / 255.0f,
float((poke_data >> 24) & 0xFF) / 255.0f);

glEnable(GL_SCISSOR_TEST);
glScissor(targetPixelRc.left, targetPixelRc.bottom, targetPixelRc.GetWidth(), targetPixelRc.GetHeight());

glClear(GL_COLOR_BUFFER_BIT);

RestoreAPIState();

// TODO: Could just update the EFB cache with the new value
ClearEFBCache();

break;
}

case POKE_Z:
// TODO: Implement. One way is to draw a tiny pixel-sized rectangle at
// the exact location. Note: EFB pokes are susceptible to Z-buffering
// and perhaps blending.
//WARN_LOG(VIDEOINTERFACE, "This is probably some kind of software rendering");
{
ResetAPIState();

glDepthMask(GL_TRUE);
glClearDepthf(float(poke_data & 0xFFFFFF) / float(0xFFFFFF));

glEnable(GL_SCISSOR_TEST);
glScissor(targetPixelRc.left, targetPixelRc.bottom, targetPixelRc.GetWidth(), targetPixelRc.GetHeight());

glClear(GL_DEPTH_BUFFER_BIT);

RestoreAPIState();

// TODO: Could just update the EFB cache with the new value
ClearEFBCache();

break;
}

default:
break;
Expand Down

0 comments on commit 89efec6

Please sign in to comment.