mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-26 03:51:38 +02:00
Probably a good idea to check s_efbAccessRequested.
If EFB access still seems slow, please check DSP stuff instead... git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3771 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
d85f5a6937
commit
5c7844df69
@ -525,61 +525,64 @@ static volatile u32 s_AccessEFBResult = 0;
|
|||||||
|
|
||||||
void VideoFifo_CheckEFBAccess()
|
void VideoFifo_CheckEFBAccess()
|
||||||
{
|
{
|
||||||
s_efbAccessRequested = false;
|
if (s_efbAccessRequested)
|
||||||
|
|
||||||
Common::MemFence();
|
|
||||||
|
|
||||||
switch (s_accessEFBArgs.type)
|
|
||||||
{
|
{
|
||||||
case PEEK_Z:
|
s_efbAccessRequested = false;
|
||||||
|
|
||||||
|
Common::MemFence();
|
||||||
|
|
||||||
|
switch (s_accessEFBArgs.type)
|
||||||
{
|
{
|
||||||
u32 z = 0;
|
case PEEK_Z:
|
||||||
float xScale = Renderer::GetTargetScaleX();
|
|
||||||
float yScale = Renderer::GetTargetScaleY();
|
|
||||||
|
|
||||||
if (g_Config.iMultisampleMode != MULTISAMPLE_OFF)
|
|
||||||
{
|
{
|
||||||
// Find the proper dimensions
|
u32 z = 0;
|
||||||
TRectangle source, scaledTargetSource;
|
float xScale = Renderer::GetTargetScaleX();
|
||||||
ComputeBackbufferRectangle(&source);
|
float yScale = Renderer::GetTargetScaleY();
|
||||||
source.Scale(xScale, yScale, &scaledTargetSource);
|
|
||||||
// This will resolve and bind to the depth buffer
|
if (g_Config.iMultisampleMode != MULTISAMPLE_OFF)
|
||||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, Renderer::ResolveAndGetDepthTarget(scaledTargetSource));
|
{
|
||||||
|
// Find the proper dimensions
|
||||||
|
TRectangle source, scaledTargetSource;
|
||||||
|
ComputeBackbufferRectangle(&source);
|
||||||
|
source.Scale(xScale, yScale, &scaledTargetSource);
|
||||||
|
// This will resolve and bind to the depth buffer
|
||||||
|
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, Renderer::ResolveAndGetDepthTarget(scaledTargetSource));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read the z value! Also adjust the pixel to read to the upscaled EFB resolution
|
||||||
|
// Plus we need to flip the y value as the OGL image is upside down
|
||||||
|
glReadPixels(s_accessEFBArgs.x*xScale, Renderer::GetTargetHeight() - s_accessEFBArgs.y*yScale, 1, 1, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, &z);
|
||||||
|
GL_REPORT_ERRORD();
|
||||||
|
|
||||||
|
// Clamp the 32bits value returned by glReadPixels to a 24bits value (GC uses a 24bits Z-Buffer)
|
||||||
|
s_AccessEFBResult = z / 0x100;
|
||||||
|
|
||||||
|
// We should probably re-bind the old fbo here.
|
||||||
|
if (g_Config.iMultisampleMode != MULTISAMPLE_OFF) {
|
||||||
|
Renderer::SetFramebuffer(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
// Read the z value! Also adjust the pixel to read to the upscaled EFB resolution
|
case POKE_Z:
|
||||||
// Plus we need to flip the y value as the OGL image is upside down
|
// TODO: Implement
|
||||||
glReadPixels(s_accessEFBArgs.x*xScale, Renderer::GetTargetHeight() - s_accessEFBArgs.y*yScale, 1, 1, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, &z);
|
break;
|
||||||
GL_REPORT_ERRORD();
|
|
||||||
|
|
||||||
// Clamp the 32bits value returned by glReadPixels to a 24bits value (GC uses a 24bits Z-Buffer)
|
case PEEK_COLOR:
|
||||||
s_AccessEFBResult = z / 0x100;
|
// TODO: Implement
|
||||||
|
s_AccessEFBResult = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
// We should probably re-bind the old fbo here.
|
case POKE_COLOR:
|
||||||
if (g_Config.iMultisampleMode != MULTISAMPLE_OFF) {
|
// TODO: Implement. One way is to draw a tiny pixel-sized rectangle at
|
||||||
Renderer::SetFramebuffer(0);
|
// 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");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case POKE_Z:
|
s_efbResponseEvent.Set();
|
||||||
// TODO: Implement
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PEEK_COLOR:
|
|
||||||
// TODO: Implement
|
|
||||||
s_AccessEFBResult = 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case POKE_COLOR:
|
|
||||||
// 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");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s_efbResponseEvent.Set();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 Video_AccessEFB(EFBAccessType type, u32 x, u32 y)
|
u32 Video_AccessEFB(EFBAccessType type, u32 x, u32 y)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user