mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 15:45:42 +00:00
PostProcessing/FX: Fix loading of resource textures
This commit is contained in:
parent
edae13d9e4
commit
4ef465cea4
|
@ -6,6 +6,7 @@
|
|||
#include "shadergen.h"
|
||||
|
||||
// TODO: Remove me
|
||||
#include "core/host.h"
|
||||
#include "core/settings.h"
|
||||
|
||||
#include "common/assert.h"
|
||||
|
@ -775,14 +776,20 @@ bool PostProcessing::ReShadeFXShader::CreatePasses(GPUTexture::Format backbuffer
|
|||
return false;
|
||||
}
|
||||
|
||||
const std::string image_path =
|
||||
Path::Combine(EmuFolders::Shaders, Path::Combine("reshade" FS_OSPATH_SEPARATOR_STR "Textures", source));
|
||||
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()))
|
||||
{
|
||||
// Might be a base file/resource instead.
|
||||
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.texture = g_gpu_device->CreateTexture(image.GetWidth(), image.GetHeight(), 1, 1, 1, GPUTexture::Type::Texture,
|
||||
|
|
Loading…
Reference in a new issue