mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
D3D: Skip redundant format convertions.
This commit is contained in:
@ -745,22 +745,6 @@ bool Renderer::SaveScreenshot(const std::string& filename, const TargetRectangle
|
||||
return saved_png;
|
||||
}
|
||||
|
||||
void formatBufferDump(const u8* in, u8* out, int w, int h, int p)
|
||||
{
|
||||
for (int y = 0; y < h; ++y)
|
||||
{
|
||||
auto line = (in + (h - y - 1) * p);
|
||||
for (int x = 0; x < w; ++x)
|
||||
{
|
||||
out[0] = line[2];
|
||||
out[1] = line[1];
|
||||
out[2] = line[0];
|
||||
out += 3;
|
||||
line += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This function has the final picture. We adjust the aspect ratio here.
|
||||
void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
|
||||
const EFBRectangle& rc, float Gamma)
|
||||
@ -886,11 +870,8 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
|
||||
D3D11_MAPPED_SUBRESOURCE map;
|
||||
D3D::context->Map(s_screenshot_texture, 0, D3D11_MAP_READ, 0, &map);
|
||||
|
||||
// TODO: This convertion is not needed. Get rid of it.
|
||||
std::vector<u8> image(source_width * source_height * 3);
|
||||
formatBufferDump((u8*)map.pData, image.data(), source_width, source_height, map.RowPitch);
|
||||
|
||||
DumpFrameData(image.data(), source_width, source_height, AVIDump::DumpFormat::FORMAT_BGR, true);
|
||||
DumpFrameData(reinterpret_cast<const u8*>(map.pData), source_width, source_height,
|
||||
AVIDump::DumpFormat::FORMAT_RGBA);
|
||||
FinishFrameData();
|
||||
|
||||
D3D::context->Unmap(s_screenshot_texture, 0);
|
||||
|
Reference in New Issue
Block a user