diff options
| author | JMC47 <JMC4789@gmail.com> | 2023-09-03 18:29:00 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-03 18:29:00 -0400 |
| commit | 900439ea0d3cfdfae259890a94dfc383103f1bad (patch) | |
| tree | 3bba0bfc72346aee1301dcc3f118098c48ae7881 /Source/Core/VideoCommon/Assets/TextureAsset.cpp | |
| parent | 6f6eb73667d461073b44f993c00095c30ac35414 (diff) | |
| parent | 62fee2f3b60c84b27efbb0792e3695bbe812ac1a (diff) | |
Merge pull request #12102 from iwubcode/cubemap_custom_texture
VideoCommon: add ability to load cube maps into custom texture data
Diffstat (limited to 'Source/Core/VideoCommon/Assets/TextureAsset.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/Assets/TextureAsset.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/Assets/TextureAsset.cpp b/Source/Core/VideoCommon/Assets/TextureAsset.cpp index 3bf477a58a..f7f3a00849 100644 --- a/Source/Core/VideoCommon/Assets/TextureAsset.cpp +++ b/Source/Core/VideoCommon/Assets/TextureAsset.cpp @@ -47,7 +47,7 @@ bool GameTextureAsset::Validate(u32 native_width, u32 native_height) const return false; } - if (m_data->m_levels.empty()) + if (m_data->m_slices.empty()) { ERROR_LOG_FMT(VIDEO, "Game texture can't be validated for asset '{}' because no data was available.", @@ -55,9 +55,28 @@ bool GameTextureAsset::Validate(u32 native_width, u32 native_height) const return false; } + if (m_data->m_slices.size() > 1) + { + ERROR_LOG_FMT( + VIDEO, + "Game texture can't be validated for asset '{}' because it has more slices than expected.", + GetAssetId()); + return false; + } + + const auto& slice = m_data->m_slices[0]; + if (slice.m_levels.empty()) + { + ERROR_LOG_FMT( + VIDEO, + "Game texture can't be validated for asset '{}' because first slice has no data available.", + GetAssetId()); + return false; + } + // Verify that the aspect ratio of the texture hasn't changed, as this could have // side-effects. - const VideoCommon::CustomTextureData::Level& first_mip = m_data->m_levels[0]; + const VideoCommon::CustomTextureData::ArraySlice::Level& first_mip = slice.m_levels[0]; if (first_mip.width * native_height != first_mip.height * native_width) { // Note: this feels like this should return an error but |
