mirror of
https://git.eden-emu.dev/archive/citron
synced 2026-03-23 01:56:08 -04:00
revert 750af88ed9
revert fix(video): handle invalid texture format in format lookup table Return default pixel format for uninitialized texture descriptors (format=0, components=0) instead of asserting. Prevents crashes when texture cache encounters uninitialized texture data. Fixes assertion failures in format_lookup_table.cpp:250. Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/common_types.h"
|
||||
@@ -44,14 +43,6 @@ constexpr u32 Hash(TextureFormat format, ComponentType component, bool is_srgb =
|
||||
PixelFormat PixelFormatFromTextureInfo(TextureFormat format, ComponentType red, ComponentType green,
|
||||
ComponentType blue, ComponentType alpha,
|
||||
bool is_srgb) noexcept {
|
||||
// Handle invalid/uninitialized texture format (0) with zero components
|
||||
// This can occur when texture descriptors are not yet initialized
|
||||
if (static_cast<u32>(format) == 0 && static_cast<u32>(red) == 0 &&
|
||||
static_cast<u32>(green) == 0 && static_cast<u32>(blue) == 0 &&
|
||||
static_cast<u32>(alpha) == 0) {
|
||||
return PixelFormat::A8B8G8R8_UNORM;
|
||||
}
|
||||
|
||||
switch (Hash(format, red, green, blue, alpha, is_srgb)) {
|
||||
case Hash(TextureFormat::A8B8G8R8, UNORM):
|
||||
return PixelFormat::A8B8G8R8_UNORM;
|
||||
|
||||
Reference in New Issue
Block a user