Fixed: Visible noise at image border with bilinear texture filter enabled
git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@270 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
parent
602396892b
commit
a8f7a3befa
|
@ -37,6 +37,8 @@
|
||||||
#include "../Util.h"
|
#include "../Util.h"
|
||||||
#include "../gb/gbGlobals.h"
|
#include "../gb/gbGlobals.h"
|
||||||
|
|
||||||
|
#include <memory.h>
|
||||||
|
|
||||||
// Direct3D
|
// Direct3D
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define D3D_DEBUG_INFO
|
#define D3D_DEBUG_INFO
|
||||||
|
@ -97,6 +99,7 @@ private:
|
||||||
|
|
||||||
void createFont();
|
void createFont();
|
||||||
void destroyFont();
|
void destroyFont();
|
||||||
|
bool clearTexture( LPDIRECT3DTEXTURE9 texture, size_t textureHeight );
|
||||||
void createTexture( unsigned int textureWidth, unsigned int textureHeight );
|
void createTexture( unsigned int textureWidth, unsigned int textureHeight );
|
||||||
void destroyTexture();
|
void destroyTexture();
|
||||||
void calculateDestRect();
|
void calculateDestRect();
|
||||||
|
@ -375,8 +378,9 @@ void Direct3DDisplay::render()
|
||||||
|
|
||||||
// copy pix to emulatedImage and apply pixel filter if selected
|
// copy pix to emulatedImage and apply pixel filter if selected
|
||||||
D3DLOCKED_RECT lr;
|
D3DLOCKED_RECT lr;
|
||||||
|
const RECT target = { 0, 0, width, height };
|
||||||
|
|
||||||
if( FAILED( hr = emulatedImage[ mbCurrentTexture ]->LockRect( 0, &lr, NULL, D3DLOCK_DISCARD ) ) ) {
|
if( FAILED( hr = emulatedImage[ mbCurrentTexture ]->LockRect( 0, &lr, &target, 0 ) ) ) {
|
||||||
DXTRACE_ERR_MSGBOX( _T("Can not lock texture"), hr );
|
DXTRACE_ERR_MSGBOX( _T("Can not lock texture"), hr );
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
@ -554,6 +558,23 @@ void Direct3DDisplay::destroyFont()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// fill texture completely with black
|
||||||
|
bool Direct3DDisplay::clearTexture( LPDIRECT3DTEXTURE9 texture, size_t textureHeight )
|
||||||
|
{
|
||||||
|
D3DLOCKED_RECT lr;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
if( FAILED( hr = texture->LockRect( 0, &lr, NULL, 0 ) ) ) {
|
||||||
|
DXTRACE_ERR_MSGBOX( _T("Can not lock texture"), hr );
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
memset( lr.pBits, 0x00, lr.Pitch * textureHeight );
|
||||||
|
texture->UnlockRect( 0 );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// when either textureWidth or textureHeight is 0, last texture size will be used
|
// when either textureWidth or textureHeight is 0, last texture size will be used
|
||||||
void Direct3DDisplay::createTexture( unsigned int textureWidth, unsigned int textureHeight )
|
void Direct3DDisplay::createTexture( unsigned int textureWidth, unsigned int textureHeight )
|
||||||
{
|
{
|
||||||
|
@ -589,6 +610,9 @@ void Direct3DDisplay::createTexture( unsigned int textureWidth, unsigned int tex
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// initialize whole texture with black since we might see
|
||||||
|
// the initial noise when using bilinear texture filtering
|
||||||
|
clearTexture( emulatedImage[0], textureSize );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !emulatedImage[1] && theApp.d3dMotionBlur ) {
|
if( !emulatedImage[1] && theApp.d3dMotionBlur ) {
|
||||||
|
@ -606,6 +630,7 @@ void Direct3DDisplay::createTexture( unsigned int textureWidth, unsigned int tex
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clearTexture( emulatedImage[1], textureSize );
|
||||||
mbTextureEmpty = true;
|
mbTextureEmpty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue