Minor simplification, buildfixes

This commit is contained in:
Henrik Rydgard 2015-07-26 22:54:18 +02:00
parent 2430c283a5
commit c8fe0b2690
4 changed files with 51 additions and 44 deletions

View File

@ -21,6 +21,7 @@
#include "Core/MemMap.h"
#include "Core/MIPS/MIPS.h"
#include "Core/Reporting.h"
#include "GPU/GPUState.h" // Used by TextureDecoder.h when templates get instanced
#include "GPU/Common/TextureDecoder.h"
#include "GPU/GPUInterface.h"
#include "Core/HW/SimpleAudioDec.h"

View File

@ -16,6 +16,8 @@
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include <arm_neon.h>
#include "GPU/GPUState.h"
#include "GPU/Common/TextureDecoder.h"
#if !defined(ARM) && !defined(ARM64)

View File

@ -522,50 +522,52 @@ namespace DX9 {
return;
}
// Let's only do this if not clearing depth.
if (gstate.isModeClear() && gstate.isClearModeDepthMask()) {
return;
}
if (src->z_address == dst->z_address &&
src->z_stride != 0 && dst->z_stride != 0 &&
src->renderWidth == dst->renderWidth &&
src->renderHeight == dst->renderHeight) {
// Let's only do this if not clearing.
if (!gstate.isModeClear() || !gstate.isClearModeDepthMask()) {
// Doesn't work. Use a shader maybe?
/*fbo_unbind();
// Doesn't work. Use a shader maybe?
/*fbo_unbind();
LPDIRECT3DTEXTURE9 srcTex = fbo_get_depth_texture(src->fbo);
LPDIRECT3DTEXTURE9 dstTex = fbo_get_depth_texture(dst->fbo);
LPDIRECT3DTEXTURE9 srcTex = fbo_get_depth_texture(src->fbo);
LPDIRECT3DTEXTURE9 dstTex = fbo_get_depth_texture(dst->fbo);
if (srcTex && dstTex) {
D3DSURFACE_DESC srcDesc;
srcTex->GetLevelDesc(0, &srcDesc);
D3DSURFACE_DESC dstDesc;
dstTex->GetLevelDesc(0, &dstDesc);
if (srcTex && dstTex) {
D3DSURFACE_DESC srcDesc;
srcTex->GetLevelDesc(0, &srcDesc);
D3DSURFACE_DESC dstDesc;
dstTex->GetLevelDesc(0, &dstDesc);
D3DLOCKED_RECT srcLock;
D3DLOCKED_RECT dstLock;
HRESULT srcLockRes = srcTex->LockRect(0, &srcLock, nullptr, D3DLOCK_READONLY);
HRESULT dstLockRes = dstTex->LockRect(0, &dstLock, nullptr, 0);
if (SUCCEEDED(srcLockRes) && SUCCEEDED(dstLockRes)) {
int pitch = std::min(srcLock.Pitch, dstLock.Pitch);
u32 h = std::min(srcDesc.Height, dstDesc.Height);
const u8 *srcp = (const u8 *)srcLock.pBits;
u8 *dstp = (u8 *)dstLock.pBits;
for (u32 y = 0; y < h; ++y) {
memcpy(dstp, srcp, pitch);
dstp += dstLock.Pitch;
srcp += srcLock.Pitch;
}
}
if (SUCCEEDED(srcLockRes)) {
srcTex->UnlockRect(0);
}
if (SUCCEEDED(dstLockRes)) {
dstTex->UnlockRect(0);
D3DLOCKED_RECT srcLock;
D3DLOCKED_RECT dstLock;
HRESULT srcLockRes = srcTex->LockRect(0, &srcLock, nullptr, D3DLOCK_READONLY);
HRESULT dstLockRes = dstTex->LockRect(0, &dstLock, nullptr, 0);
if (SUCCEEDED(srcLockRes) && SUCCEEDED(dstLockRes)) {
int pitch = std::min(srcLock.Pitch, dstLock.Pitch);
u32 h = std::min(srcDesc.Height, dstDesc.Height);
const u8 *srcp = (const u8 *)srcLock.pBits;
u8 *dstp = (u8 *)dstLock.pBits;
for (u32 y = 0; y < h; ++y) {
memcpy(dstp, srcp, pitch);
dstp += dstLock.Pitch;
srcp += srcLock.Pitch;
}
}
RebindFramebuffer();*/
if (SUCCEEDED(srcLockRes)) {
srcTex->UnlockRect(0);
}
if (SUCCEEDED(dstLockRes)) {
dstTex->UnlockRect(0);
}
}
RebindFramebuffer();*/
}
}

View File

@ -831,6 +831,10 @@ void FramebufferManager::BlitFramebufferDepth(VirtualFramebuffer *src, VirtualFr
return;
}
if (gstate.isModeClear() && gstate.isClearModeDepthMask()) {
return;
}
if (src->z_address == dst->z_address &&
src->z_stride != 0 && dst->z_stride != 0 &&
src->renderWidth == dst->renderWidth &&
@ -844,21 +848,19 @@ void FramebufferManager::BlitFramebufferDepth(VirtualFramebuffer *src, VirtualFr
bool useNV = !gl_extensions.GLES3;
#endif
// Let's only do this if not clearing.
if (!gstate.isModeClear() || !gstate.isClearModeDepthMask()) {
fbo_bind_for_read(src->fbo);
glDisable(GL_SCISSOR_TEST);
// Let's only do this if not clearing depth.
fbo_bind_for_read(src->fbo);
glDisable(GL_SCISSOR_TEST);
#if defined(USING_GLES2) && defined(ANDROID) // We only support this extension on Android, it's not even available on PC.
if (useNV) {
glBlitFramebufferNV(0, 0, src->renderWidth, src->renderHeight, 0, 0, dst->renderWidth, dst->renderHeight, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
} else
if (useNV) {
glBlitFramebufferNV(0, 0, src->renderWidth, src->renderHeight, 0, 0, dst->renderWidth, dst->renderHeight, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
} else
#endif // defined(USING_GLES2) && defined(ANDROID)
glBlitFramebuffer(0, 0, src->renderWidth, src->renderHeight, 0, 0, dst->renderWidth, dst->renderHeight, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
// If we set dst->depthUpdated here, our optimization above would be pointless.
glBlitFramebuffer(0, 0, src->renderWidth, src->renderHeight, 0, 0, dst->renderWidth, dst->renderHeight, GL_DEPTH_BUFFER_BIT, GL_NEAREST);
// If we set dst->depthUpdated here, our optimization above would be pointless.
glstate.scissorTest.restore();
}
glstate.scissorTest.restore();
}
}
}