summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Assets/CustomAssetLibrary.cpp
diff options
context:
space:
mode:
authoriwubcode <iwubcode@users.noreply.github.com>2023-09-06 00:16:26 -0500
committeriwubcode <iwubcode@users.noreply.github.com>2023-10-10 09:58:14 -0500
commit0e8f8ea930d4b635fd7287f572dc2911996638bf (patch)
tree68b2ea7ddcff5beda8c1b3f02ef55e3d8e5e369d /Source/Core/VideoCommon/Assets/CustomAssetLibrary.cpp
parent1b7a590b4bb7d34152178e4768d453b40a4118ff (diff)
VideoCommon: instead of using 'CustomTextureData' directly, use 'TextureData' for texture assets, this allows us to provide additional metadata for textures. Such as a sampler or type information (to distinguish cube maps)
Diffstat (limited to 'Source/Core/VideoCommon/Assets/CustomAssetLibrary.cpp')
-rw-r--r--Source/Core/VideoCommon/Assets/CustomAssetLibrary.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/Source/Core/VideoCommon/Assets/CustomAssetLibrary.cpp b/Source/Core/VideoCommon/Assets/CustomAssetLibrary.cpp
index 8a78fed490..7b6420088f 100644
--- a/Source/Core/VideoCommon/Assets/CustomAssetLibrary.cpp
+++ b/Source/Core/VideoCommon/Assets/CustomAssetLibrary.cpp
@@ -6,7 +6,7 @@
#include <algorithm>
#include "Common/Logging/Log.h"
-#include "VideoCommon/Assets/CustomTextureData.h"
+#include "VideoCommon/Assets/TextureAsset.h"
namespace VideoCommon
{
@@ -26,16 +26,26 @@ std::size_t GetAssetSize(const CustomTextureData& data)
}
} // namespace
CustomAssetLibrary::LoadInfo CustomAssetLibrary::LoadGameTexture(const AssetID& asset_id,
- CustomTextureData* data)
+ TextureData* data)
{
const auto load_info = LoadTexture(asset_id, data);
if (load_info.m_bytes_loaded == 0)
return {};
+ if (data->m_type != TextureData::Type::Type_Texture2D)
+ {
+ ERROR_LOG_FMT(
+ VIDEO,
+ "Custom asset '{}' is not a valid game texture, it is expected to be a 2d texture "
+ "but was a '{}'.",
+ asset_id, data->m_type);
+ return {};
+ }
+
// Note: 'LoadTexture()' ensures we have a level loaded
- for (std::size_t slice_index = 0; slice_index < data->m_slices.size(); slice_index++)
+ for (std::size_t slice_index = 0; slice_index < data->m_texture.m_slices.size(); slice_index++)
{
- auto& slice = data->m_slices[slice_index];
+ auto& slice = data->m_texture.m_slices[slice_index];
const auto& first_mip = slice.m_levels[0];
// Verify that each mip level is the correct size (divide by 2 each time).