mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
mixed commit:
in D3D and Opengl: fixed one nasty bug in texture loading where if a dynamic texture keeps his format but the tlut format is changed, the try or reloading the texture in the same texture could cause a hang if the size of the resulting texture is different than the original (size in bytes) Applied a ugly temporal hack to the texture conversor to solve efb to ram misalignments and effect distortions. in D3D: Pseudo implementation of logic ops using basic blending: the first 8 operations are "good approximations", the remaining 8 are bullshit :) if someone have a better approximation to emulate this logic please let me know. please test if i don't break anything in the process and test Mario kart wee you will get a nice surprise.:) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4656 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -103,13 +103,20 @@ LPDIRECT3DTEXTURE9 CreateTexture2D(const u8* buffer, const int width, const int
|
||||
break;
|
||||
case D3DFMT_A8R8G8B8:
|
||||
{
|
||||
u32* pIn = pBuffer;
|
||||
for (int y = 0; y < height; y++)
|
||||
/*if(Lock.Pitch == width * 4)
|
||||
{
|
||||
u32* pBits = (u32*)((u8*)Lock.pBits + (y * Lock.Pitch));
|
||||
memcpy(pBits, pIn, width * 4);
|
||||
pIn += pitch;
|
||||
memcpy(Lock.pBits,buffer,width*height*4);
|
||||
}
|
||||
else
|
||||
{*/
|
||||
u32* pIn = pBuffer;
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
u32* pBits = (u32*)((u8*)Lock.pBits + (y * Lock.Pitch));
|
||||
memcpy(pBits, pIn, width * 4);
|
||||
pIn += pitch;
|
||||
}
|
||||
//}
|
||||
}
|
||||
break;
|
||||
case D3DFMT_DXT1:
|
||||
@ -122,6 +129,25 @@ LPDIRECT3DTEXTURE9 CreateTexture2D(const u8* buffer, const int width, const int
|
||||
return pTexture;
|
||||
}
|
||||
|
||||
LPDIRECT3DTEXTURE9 CreateOnlyTexture2D(const int width, const int height, D3DFORMAT fmt)
|
||||
{
|
||||
LPDIRECT3DTEXTURE9 pTexture;
|
||||
// crazy bitmagic, sorry :)
|
||||
bool isPow2 = !((width&(width-1)) || (height&(height-1)));
|
||||
bool bExpand = false;
|
||||
HRESULT hr;
|
||||
// TODO(ector): Allow mipmaps for non-pow textures on newer cards?
|
||||
// TODO(ector): Use the game-specified mipmaps?
|
||||
if (!isPow2)
|
||||
hr = dev->CreateTexture(width, height, 1, 0, fmt, D3DPOOL_MANAGED, &pTexture, NULL);
|
||||
else
|
||||
hr = dev->CreateTexture(width, height, 0, D3DUSAGE_AUTOGENMIPMAP, fmt, D3DPOOL_MANAGED, &pTexture, NULL);
|
||||
|
||||
if (FAILED(hr))
|
||||
return 0;
|
||||
return pTexture;
|
||||
}
|
||||
|
||||
void ReplaceTexture2D(LPDIRECT3DTEXTURE9 pTexture, const u8* buffer, const int width, const int height,const int pitch, D3DFORMAT fmt)
|
||||
{
|
||||
u32* pBuffer = (u32*)buffer;
|
||||
|
Reference in New Issue
Block a user