From c759f7b3be87c8bb83647ae1a18ec7a591908028 Mon Sep 17 00:00:00 2001 From: Rodolfo Osvaldo Bogado Date: Mon, 14 Jun 2010 00:13:49 +0000 Subject: [PATCH] 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 --- .../Plugin_VideoDX11/Src/D3DTexture.cpp | 20 +++++++++++-------- .../Plugins/Plugin_VideoDX11/Src/Render.cpp | 10 +++++----- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Source/Plugins/Plugin_VideoDX11/Src/D3DTexture.cpp b/Source/Plugins/Plugin_VideoDX11/Src/D3DTexture.cpp index 7206d1db4c..266c97d25a 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/D3DTexture.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/D3DTexture.cpp @@ -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 diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp index 7ed3e83f01..747f6e6c52 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp @@ -759,11 +759,11 @@ void Renderer::SetBlendMode(bool forceUpdate) { #define BLEND_ENABLE_MASK 1 #define BLENDOP_SHIFT 2 - #define BLENDOP_MASK (1<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; }