mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-10 14:39:01 +01:00
AVIDump: Hard code rgba.
This commit is contained in:
parent
8b38d5a115
commit
db0509560e
@ -870,8 +870,8 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
|
|||||||
D3D11_MAPPED_SUBRESOURCE map;
|
D3D11_MAPPED_SUBRESOURCE map;
|
||||||
D3D::context->Map(s_screenshot_texture, 0, D3D11_MAP_READ, 0, &map);
|
D3D::context->Map(s_screenshot_texture, 0, D3D11_MAP_READ, 0, &map);
|
||||||
|
|
||||||
DumpFrameData(reinterpret_cast<const u8*>(map.pData), source_width, source_height, map.RowPitch,
|
DumpFrameData(reinterpret_cast<const u8*>(map.pData), source_width, source_height,
|
||||||
AVIDump::DumpFormat::FORMAT_RGBA);
|
map.RowPitch);
|
||||||
FinishFrameData();
|
FinishFrameData();
|
||||||
|
|
||||||
D3D::context->Unmap(s_screenshot_texture, 0);
|
D3D::context->Unmap(s_screenshot_texture, 0);
|
||||||
|
@ -848,8 +848,7 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
|
|||||||
CheckHR(s_screenshot_texture->Map(0, &read_range, &screenshot_texture_map));
|
CheckHR(s_screenshot_texture->Map(0, &read_range, &screenshot_texture_map));
|
||||||
|
|
||||||
DumpFrameData(reinterpret_cast<const u8*>(screenshot_texture_map), source_width, source_height,
|
DumpFrameData(reinterpret_cast<const u8*>(screenshot_texture_map), source_width, source_height,
|
||||||
dst_location.PlacedFootprint.Footprint.RowPitch,
|
dst_location.PlacedFootprint.Footprint.RowPitch);
|
||||||
AVIDump::DumpFormat::FORMAT_RGBA);
|
|
||||||
FinishFrameData();
|
FinishFrameData();
|
||||||
|
|
||||||
D3D12_RANGE write_range = {};
|
D3D12_RANGE write_range = {};
|
||||||
|
@ -1469,7 +1469,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight,
|
|||||||
flipped_trc.GetHeight(), GL_RGBA, GL_UNSIGNED_BYTE, image.data());
|
flipped_trc.GetHeight(), GL_RGBA, GL_UNSIGNED_BYTE, image.data());
|
||||||
|
|
||||||
DumpFrameData(image.data(), flipped_trc.GetWidth(), flipped_trc.GetHeight(),
|
DumpFrameData(image.data(), flipped_trc.GetWidth(), flipped_trc.GetHeight(),
|
||||||
flipped_trc.GetWidth() * 4, AVIDump::DumpFormat::FORMAT_RGBA, true);
|
flipped_trc.GetWidth() * 4, true);
|
||||||
FinishFrameData();
|
FinishFrameData();
|
||||||
}
|
}
|
||||||
// Finish up the current frame, print some stats
|
// Finish up the current frame, print some stats
|
||||||
|
@ -496,8 +496,7 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
|
|||||||
DumpFrameData(reinterpret_cast<const u8*>(m_screenshot_readback_texture->GetMapPointer()),
|
DumpFrameData(reinterpret_cast<const u8*>(m_screenshot_readback_texture->GetMapPointer()),
|
||||||
static_cast<int>(m_screenshot_render_texture->GetWidth()),
|
static_cast<int>(m_screenshot_render_texture->GetWidth()),
|
||||||
static_cast<int>(m_screenshot_render_texture->GetHeight()),
|
static_cast<int>(m_screenshot_render_texture->GetHeight()),
|
||||||
static_cast<int>(m_screenshot_readback_texture->GetRowStride()),
|
static_cast<int>(m_screenshot_readback_texture->GetRowStride()));
|
||||||
AVIDump::DumpFormat::FORMAT_RGBA);
|
|
||||||
FinishFrameData();
|
FinishFrameData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,6 @@ static u64 s_last_pts;
|
|||||||
static int s_current_width;
|
static int s_current_width;
|
||||||
static int s_current_height;
|
static int s_current_height;
|
||||||
static int s_file_index = 0;
|
static int s_file_index = 0;
|
||||||
static AVIDump::DumpFormat s_current_format;
|
|
||||||
static const u8* s_stored_frame_data;
|
static const u8* s_stored_frame_data;
|
||||||
static int s_stored_frame_width;
|
static int s_stored_frame_width;
|
||||||
static int s_stored_frame_height;
|
static int s_stored_frame_height;
|
||||||
@ -63,18 +62,9 @@ static void InitAVCodec()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AVIDump::Start(int w, int h, DumpFormat format)
|
bool AVIDump::Start(int w, int h)
|
||||||
{
|
{
|
||||||
if (format == DumpFormat::FORMAT_BGR)
|
s_pix_fmt = AV_PIX_FMT_RGBA;
|
||||||
{
|
|
||||||
s_pix_fmt = AV_PIX_FMT_BGR24;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
s_pix_fmt = AV_PIX_FMT_RGBA;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_current_format = format;
|
|
||||||
|
|
||||||
s_width = w;
|
s_width = w;
|
||||||
s_height = h;
|
s_height = h;
|
||||||
@ -320,7 +310,7 @@ void AVIDump::CheckResolution(int width, int height)
|
|||||||
int temp_file_index = s_file_index;
|
int temp_file_index = s_file_index;
|
||||||
Stop();
|
Stop();
|
||||||
s_file_index = temp_file_index + 1;
|
s_file_index = temp_file_index + 1;
|
||||||
Start(width, height, s_current_format);
|
Start(width, height);
|
||||||
s_current_width = width;
|
s_current_width = width;
|
||||||
s_current_height = height;
|
s_current_height = height;
|
||||||
}
|
}
|
||||||
|
@ -15,13 +15,7 @@ private:
|
|||||||
static void StoreFrameData(const u8* data, int width, int height, int stride);
|
static void StoreFrameData(const u8* data, int width, int height, int stride);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum class DumpFormat
|
static bool Start(int w, int h);
|
||||||
{
|
|
||||||
FORMAT_BGR,
|
|
||||||
FORMAT_RGBA
|
|
||||||
};
|
|
||||||
|
|
||||||
static bool Start(int w, int h, DumpFormat format);
|
|
||||||
static void AddFrame(const u8* data, int width, int height, int stride);
|
static void AddFrame(const u8* data, int width, int height, int stride);
|
||||||
static void Stop();
|
static void Stop();
|
||||||
static void DoState();
|
static void DoState();
|
||||||
|
@ -555,8 +555,7 @@ bool Renderer::IsFrameDumping()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::DumpFrameData(const u8* data, int w, int h, int stride, AVIDump::DumpFormat format,
|
void Renderer::DumpFrameData(const u8* data, int w, int h, int stride, bool swap_upside_down)
|
||||||
bool swap_upside_down)
|
|
||||||
{
|
{
|
||||||
#if defined(HAVE_LIBAV) || defined(_WIN32)
|
#if defined(HAVE_LIBAV) || defined(_WIN32)
|
||||||
if (w == 0 || h == 0)
|
if (w == 0 || h == 0)
|
||||||
@ -564,7 +563,6 @@ void Renderer::DumpFrameData(const u8* data, int w, int h, int stride, AVIDump::
|
|||||||
|
|
||||||
m_last_framedump_width = w;
|
m_last_framedump_width = w;
|
||||||
m_last_framedump_height = h;
|
m_last_framedump_height = h;
|
||||||
m_last_framedump_format = format;
|
|
||||||
m_last_framedump_stride = stride;
|
m_last_framedump_stride = stride;
|
||||||
|
|
||||||
// TODO: Refactor this. Right now it's needed for the implace flipping of the image.
|
// TODO: Refactor this. Right now it's needed for the implace flipping of the image.
|
||||||
@ -572,7 +570,7 @@ void Renderer::DumpFrameData(const u8* data, int w, int h, int stride, AVIDump::
|
|||||||
|
|
||||||
if (!m_last_frame_dumped)
|
if (!m_last_frame_dumped)
|
||||||
{
|
{
|
||||||
m_AVI_dumping = AVIDump::Start(w, h, format);
|
m_AVI_dumping = AVIDump::Start(w, h);
|
||||||
if (!m_AVI_dumping)
|
if (!m_AVI_dumping)
|
||||||
{
|
{
|
||||||
OSD::AddMessage("AVIDump Start failed", 2000);
|
OSD::AddMessage("AVIDump Start failed", 2000);
|
||||||
|
@ -148,8 +148,7 @@ protected:
|
|||||||
static void RecordVideoMemory();
|
static void RecordVideoMemory();
|
||||||
|
|
||||||
bool IsFrameDumping();
|
bool IsFrameDumping();
|
||||||
void DumpFrameData(const u8* data, int w, int h, int stride, AVIDump::DumpFormat format,
|
void DumpFrameData(const u8* data, int w, int h, int stride, bool swap_upside_down = false);
|
||||||
bool swap_upside_down = false);
|
|
||||||
void FinishFrameData();
|
void FinishFrameData();
|
||||||
|
|
||||||
static volatile bool s_bScreenshot;
|
static volatile bool s_bScreenshot;
|
||||||
@ -195,7 +194,6 @@ private:
|
|||||||
int m_last_framedump_width = 0;
|
int m_last_framedump_width = 0;
|
||||||
int m_last_framedump_height = 0;
|
int m_last_framedump_height = 0;
|
||||||
int m_last_framedump_stride = 0;
|
int m_last_framedump_stride = 0;
|
||||||
AVIDump::DumpFormat m_last_framedump_format;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern std::unique_ptr<Renderer> g_renderer;
|
extern std::unique_ptr<Renderer> g_renderer;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user