diff --git a/GPU/D3D11/FramebufferManagerD3D11.cpp b/GPU/D3D11/FramebufferManagerD3D11.cpp index b77834e41f..3622f394e6 100644 --- a/GPU/D3D11/FramebufferManagerD3D11.cpp +++ b/GPU/D3D11/FramebufferManagerD3D11.cpp @@ -578,8 +578,8 @@ void FramebufferManagerD3D11::SimpleBlit( memcpy(map.pData, vtx, 4 * sizeof(Vtx)); context_->Unmap(quadBuffer_, 0); - draw_->BindFramebufferAsTexture(src, 0, Draw::FB_COLOR_BIT, 0); draw_->BindFramebufferAsRenderTarget(dest); + draw_->BindFramebufferAsTexture(src, 0, Draw::FB_COLOR_BIT, 0); Bind2DShader(); D3D11_VIEWPORT vp{ 0.0f, 0.0f, (float)destW, (float)destH, 0.0f, 1.0f }; context_->RSSetViewports(1, &vp); diff --git a/GPU/D3D11/TextureCacheD3D11.cpp b/GPU/D3D11/TextureCacheD3D11.cpp index e6518bbe58..8c1531d582 100644 --- a/GPU/D3D11/TextureCacheD3D11.cpp +++ b/GPU/D3D11/TextureCacheD3D11.cpp @@ -1126,8 +1126,8 @@ void TextureCacheD3D11::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture & gpuStats.numTexturesDecoded++; // For UpdateSubresource, we can't decode directly into the texture so we allocate a buffer :( - u32 *mapData; - int mapRowPitch; + u32 *mapData = nullptr; + int mapRowPitch = 0; if (replaced.GetSize(level, w, h)) { mapData = new u32[w * h]{}; mapRowPitch = w * 4; @@ -1139,16 +1139,20 @@ void TextureCacheD3D11::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture & u32 texaddr = gstate.getTextureAddress(level); int bufw = GetTextureBufw(level, texaddr, tfmt); int bpp = dstFmt == DXGI_FORMAT_B8G8R8A8_UNORM ? 4 : 2; - mapRowPitch = std::max(bufw, w) * 4; - mapData = new u32[mapRowPitch / 4 * h]{}; - - u32 *pixelData = (u32 *)mapData; - int decPitch = mapRowPitch; + u32 *pixelData; + int decPitch; if (scaleFactor > 1) { tmpTexBufRearrange.resize(std::max(bufw, w) * h); pixelData = tmpTexBufRearrange.data(); // We want to end up with a neatly packed texture for scaling. decPitch = w * bpp; + mapData = new u32[(w * scaleFactor) * (h * scaleFactor)]; + mapRowPitch = w * scaleFactor * 4; + } else { + mapRowPitch = std::max(bufw, w) * bpp; + mapData = new u32[mapRowPitch / bpp * h]{}; + pixelData = (u32 *)mapData; + decPitch = mapRowPitch; } bool decSuccess = DecodeTextureLevel((u8 *)pixelData, decPitch, tfmt, clutformat, texaddr, level, bufw, false, false); diff --git a/GPU/D3D11/TextureScalerD3D11.cpp b/GPU/D3D11/TextureScalerD3D11.cpp index a71ca42c8f..f8b3a406cd 100644 --- a/GPU/D3D11/TextureScalerD3D11.cpp +++ b/GPU/D3D11/TextureScalerD3D11.cpp @@ -29,24 +29,24 @@ int TextureScalerD3D11::BytesPerPixel(u32 format) { } u32 TextureScalerD3D11::Get8888Format() { - return DXGI_FORMAT_R8G8B8A8_UNORM; + return DXGI_FORMAT_B8G8R8A8_UNORM; } void TextureScalerD3D11::ConvertTo8888(u32 format, u32* source, u32* &dest, int width, int height) { switch (format) { - case GE_FORMAT_8888: + case DXGI_FORMAT_B8G8R8A8_UNORM: dest = source; // already fine break; - case GE_FORMAT_4444: + case DXGI_FORMAT_B4G4R4A4_UNORM: GlobalThreadPool::Loop(std::bind(&convert4444_dx9, (u16*)source, dest, width, std::placeholders::_1, std::placeholders::_2), 0, height); break; - case GE_FORMAT_565: + case DXGI_FORMAT_B5G6R5_UNORM: GlobalThreadPool::Loop(std::bind(&convert565_dx9, (u16*)source, dest, width, std::placeholders::_1, std::placeholders::_2), 0, height); break; - case GE_FORMAT_5551: + case DXGI_FORMAT_B5G5R5A1_UNORM: GlobalThreadPool::Loop(std::bind(&convert5551_dx9, (u16*)source, dest, width, std::placeholders::_1, std::placeholders::_2), 0, height); break; diff --git a/Windows/MainWindowMenu.cpp b/Windows/MainWindowMenu.cpp index 121d25e781..b62126b728 100644 --- a/Windows/MainWindowMenu.cpp +++ b/Windows/MainWindowMenu.cpp @@ -1091,7 +1091,7 @@ namespace MainWindow { CheckMenuItem(menu, texscalingitems[i], MF_BYCOMMAND | ((i == g_Config.iTexScalingLevel) ? MF_CHECKED : MF_UNCHECKED)); } - if (!gl_extensions.OES_texture_npot) { + if (g_Config.iGPUBackend == (int)GPUBackend::OPENGL && !gl_extensions.OES_texture_npot) { EnableMenuItem(menu, ID_TEXTURESCALING_3X, MF_GRAYED); EnableMenuItem(menu, ID_TEXTURESCALING_5X, MF_GRAYED); } else {