DX11: Prefer DXGI_FORMAT_R8G8B8A8 to DXGI_FORMAT_B8G8R8A8 wherever appropriate.

Slightly modify the way we're doing screenshots once again, thanks to Orphis this time ;)


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5743 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
NeoBrainX
2010-06-19 01:02:43 +00:00
parent 08d7861578
commit d7bbddcbd3
8 changed files with 42 additions and 15 deletions

View File

@ -271,8 +271,9 @@ TextureCache::TCacheEntry* TextureCache::Load(unsigned int stage, u32 address, u
if (pcfmt == PC_TEX_FMT_NONE)
pcfmt = TexDecoder_Decode(temp, ptr, expandedWidth, expandedHeight, tex_format, tlutaddr, tlutfmt);
DXGI_FORMAT d3d_fmt = DXGI_FORMAT_B8G8R8A8_UNORM;
DXGI_FORMAT d3d_fmt = DXGI_FORMAT_R8G8B8A8_UNORM;
bool swap_r_b = false;
if (pcfmt == PC_TEX_FMT_BGRA32 && D3D::BGRATexturesSupported()) d3d_fmt = DXGI_FORMAT_B8G8R8A8_UNORM;
entry.oldpixel = ((u32*)ptr)[0];
if (g_ActiveConfig.bSafeTextureCache) entry.hash = hash_value;
@ -400,7 +401,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo
entry.Scaledh = Scaledtex_h;
entry.fmt = copyfmt;
entry.isNonPow2 = true;
entry.texture = D3DTexture2D::Create(Scaledtex_w, Scaledtex_h, (D3D11_BIND_FLAG)((int)D3D11_BIND_RENDER_TARGET|(int)D3D11_BIND_SHADER_RESOURCE), D3D11_USAGE_DEFAULT, DXGI_FORMAT_B8G8R8A8_UNORM);
entry.texture = D3DTexture2D::Create(Scaledtex_w, Scaledtex_h, (D3D11_BIND_FLAG)((int)D3D11_BIND_RENDER_TARGET|(int)D3D11_BIND_SHADER_RESOURCE), D3D11_USAGE_DEFAULT, DXGI_FORMAT_R8G8B8A8_UNORM);
if (entry.texture == NULL) PanicAlert("CopyRenderTargetToTexture failed to create entry.texture at %s %d\n", __FILE__, __LINE__);
textures[address] = entry;
tex = entry.texture;