From 0f7f4ccaf9dd054b40691b82eedd2c61dc61d25a Mon Sep 17 00:00:00 2001 From: iwubcode Date: Mon, 2 Oct 2017 00:21:10 -0500 Subject: [PATCH] Software Backend: allow screenshots/video to be taken with valid data --- Source/Core/VideoBackends/Software/SWTexture.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Source/Core/VideoBackends/Software/SWTexture.cpp b/Source/Core/VideoBackends/Software/SWTexture.cpp index b42f3d4e21..66e76f09a5 100644 --- a/Source/Core/VideoBackends/Software/SWTexture.cpp +++ b/Source/Core/VideoBackends/Software/SWTexture.cpp @@ -10,8 +10,21 @@ namespace SW { +namespace +{ +#pragma pack(push, 1) +struct Pixel +{ + u8 r; + u8 g; + u8 b; + u8 a; +}; +#pragma pack(pop) +} SWTexture::SWTexture(const TextureConfig& tex_config) : AbstractTexture(tex_config) { + m_data.resize(tex_config.width * tex_config.height * 4); } void SWTexture::Bind(unsigned int stage) @@ -31,7 +44,8 @@ void SWTexture::CopyRectangleFromTexture(const AbstractTexture* source, } else { - copy_region(software_source_texture->GetData(), srcrect, GetData(), dstrect); + copy_region(reinterpret_cast(software_source_texture->GetData()), srcrect, + reinterpret_cast(GetData()), dstrect); } }