fixed blending and PC_TEX_FMT_I8 and PC_TEX_FMT_I4_AS_I8 texture loading in dx11
enjoy git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5686 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
7e27914b45
commit
c759f7b3be
|
@ -78,18 +78,22 @@ void ReplaceTexture2D(ID3D11Texture2D* pTexture, const u8* buffer, unsigned int
|
|||
break;
|
||||
case PC_TEX_FMT_I8:
|
||||
case PC_TEX_FMT_I4_AS_I8:
|
||||
for (unsigned int y = 0; y < height; y++)
|
||||
{
|
||||
u8* in = (u8*)buffer + y * pitch;
|
||||
u32* pBits = (u32*)((u8*)outptr + y * destPitch);
|
||||
for (unsigned int x = 0; x < width; x++)
|
||||
const u8 *pIn = buffer;
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
const u8 col = *in;
|
||||
*pBits = 0xFF000000 | (col << 16) | (col << 8) | col;
|
||||
in++;
|
||||
pBits++;
|
||||
u8* pBits = ((u8*)outptr + (y * destPitch));
|
||||
for(int i = 0; i < width * 4; i += 4)
|
||||
{
|
||||
pBits[i] = pIn[i / 4];
|
||||
pBits[i+1] = pIn[i / 4];
|
||||
pBits[i+2] = pIn[i / 4];
|
||||
pBits[i + 3] = pIn[i / 4];
|
||||
}
|
||||
pIn += pitch;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case PC_TEX_FMT_BGRA32:
|
||||
// BGRA32 textures can be uploaded directly to VRAM when using DEFAULT textures
|
||||
|
|
|
@ -759,11 +759,11 @@ void Renderer::SetBlendMode(bool forceUpdate)
|
|||
{
|
||||
#define BLEND_ENABLE_MASK 1
|
||||
#define BLENDOP_SHIFT 2
|
||||
#define BLENDOP_MASK (1<<BLENDOP_SHIFT)
|
||||
#define BLENDOP_MASK 4
|
||||
#define SRCFACTOR_SHIFT 3
|
||||
#define DESTFACTOR_SHIFT 6
|
||||
#define SRCFACTOR_MASK (7 << SRCFACTOR_SHIFT)
|
||||
#define DESTFACTOR_MASK (7 << DESTFACTOR_SHIFT)
|
||||
#define FACTOR_MASK 7
|
||||
|
||||
|
||||
// blend mode bit mask
|
||||
// 0 - blend enable
|
||||
|
@ -795,8 +795,8 @@ void Renderer::SetBlendMode(bool forceUpdate)
|
|||
|
||||
if (changes & 0x1F8) // blend RGB change
|
||||
{
|
||||
D3D::gfxstate->SetSrcBlend(d3dSrcFactors[(newval & SRCFACTOR_MASK) >> SRCFACTOR_SHIFT]);
|
||||
D3D::gfxstate->SetDestBlend(d3dDestFactors[(newval & DESTFACTOR_MASK) >> DESTFACTOR_SHIFT]);
|
||||
D3D::gfxstate->SetSrcBlend(d3dSrcFactors[(newval >> SRCFACTOR_SHIFT) & FACTOR_MASK]);
|
||||
D3D::gfxstate->SetDestBlend(d3dDestFactors[(newval >> DESTFACTOR_SHIFT) & FACTOR_MASK]);
|
||||
}
|
||||
s_blendMode = newval;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue