Fix screen flickering with frameskip on D3D plugin, also fix occasional hang when turning frameskip off

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4194 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
sl1nk3.s
2009-09-04 06:09:21 +00:00
parent 08d3dee74c
commit 5a21d72693
13 changed files with 88 additions and 91 deletions

View File

@ -205,7 +205,7 @@ void SetColorMask(const BPCmd &bp)
Renderer::SetColorMask();
}
void CopyEFB(const BPCmd &bp, const EFBRectangle &rc, const u32 &address, const bool &fromZBuffer, const bool &isIntensityFmt, const u32 &copyfmt, const bool &scaleByHalf)
void CopyEFB(const BPCmd &bp, const EFBRectangle &rc, const u32 &address, const bool &fromZBuffer, const bool &isIntensityFmt, const u32 &copyfmt, const int &scaleByHalf)
{
TextureCache::CopyRenderTargetToTexture(address, fromZBuffer, isIntensityFmt, copyfmt, scaleByHalf, rc);
}

View File

@ -38,6 +38,7 @@
#include "EmuWindow.h"
#include "AVIDump.h"
#include "OnScreenDisplay.h"
#include "Fifo.h"
#include "debugger/debugger.h"
@ -149,6 +150,9 @@ void formatBufferDump(const char *in, char *out, int w, int h, int p)
void Renderer::SwapBuffers()
{
if (g_bSkipCurrentFrame)
return;
// Center window again.
if (EmuWindow::GetParentWnd())
{

View File

@ -266,14 +266,13 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
}
// EXTREMELY incomplete.
void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyfmt, bool bScaleByHalf, const EFBRectangle &source_rect)
void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyfmt, int bScaleByHalf, const EFBRectangle &source_rect)
{
int efb_w = source_rect.GetWidth();
int efb_h = source_rect.GetHeight();
int mult = bScaleByHalf ? 2 : 1;
int tex_w = (abs(source_rect.GetWidth()) / mult);
int tex_h = (abs(source_rect.GetHeight()) / mult);
int tex_w = (abs(source_rect.GetWidth()) >> bScaleByHalf);
int tex_h = (abs(source_rect.GetHeight()) >> bScaleByHalf);
TexCache::iterator iter;
LPDIRECT3DTEXTURE9 tex;
@ -282,7 +281,6 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo
{
if (!iter->second.isRenderTarget)
{
ERROR_LOG(VIDEO, "Using non-rendertarget texture as render target!!! WTF?", FALSE);
// Remove it and recreate it as a render target
iter->second.texture->Release();
iter->second.texture = 0;
@ -305,7 +303,6 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo
entry.w = tex_w;
entry.h = tex_h;
// TODO(ector): infer this size in some sensible way
D3D::dev->CreateTexture(tex_w, tex_h, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &entry.texture, 0);
textures[address] = entry;
tex = entry.texture;

View File

@ -63,7 +63,7 @@ public:
static void Shutdown();
static void Invalidate(bool shutdown);
static TCacheEntry *Load(int stage, u32 address, int width, int height, int format, int tlutaddr, int tlutfmt);
static void CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyfmt, bool bScaleByHalf, const EFBRectangle &source_rect);
static void CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool bIsIntensityFmt, u32 copyfmt, int bScaleByHalf, const EFBRectangle &source_rect);
};
#endif