PostProcessing/FX: Fix loading of resource textures
This commit is contained in:
parent
edae13d9e4
commit
4ef465cea4
|
@ -6,6 +6,7 @@
|
||||||
#include "shadergen.h"
|
#include "shadergen.h"
|
||||||
|
|
||||||
// TODO: Remove me
|
// TODO: Remove me
|
||||||
|
#include "core/host.h"
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
@ -775,13 +776,19 @@ bool PostProcessing::ReShadeFXShader::CreatePasses(GPUTexture::Format backbuffer
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string image_path =
|
|
||||||
Path::Combine(EmuFolders::Shaders, Path::Combine("reshade" FS_OSPATH_SEPARATOR_STR "Textures", source));
|
|
||||||
Common::RGBA8Image image;
|
Common::RGBA8Image image;
|
||||||
if (!image.LoadFromFile(image_path.c_str()))
|
if (const std::string image_path =
|
||||||
|
Path::Combine(EmuFolders::Shaders, Path::Combine("reshade" FS_OSPATH_SEPARATOR_STR "Textures", source));
|
||||||
|
!image.LoadFromFile(image_path.c_str()))
|
||||||
{
|
{
|
||||||
Error::SetString(error, fmt::format("Failed to load image '{}' (from '{}')", source, image_path).c_str());
|
// Might be a base file/resource instead.
|
||||||
return false;
|
const std::string resource_name = Path::Combine("shaders/reshade/Textures", source);
|
||||||
|
if (std::optional<std::vector<u8>> resdata = Host::ReadResourceFile(resource_name.c_str());
|
||||||
|
!resdata.has_value() || !image.LoadFromBuffer(resource_name.c_str(), resdata->data(), resdata->size()))
|
||||||
|
{
|
||||||
|
Error::SetString(error, fmt::format("Failed to load image '{}' (from '{}')", source, image_path).c_str());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tex.rt_scale = 0.0f;
|
tex.rt_scale = 0.0f;
|
||||||
|
|
Loading…
Reference in New Issue