Skip to content
Snippets Groups Projects
Commit c4ff7ecf authored by ameerj's avatar ameerj
Browse files

textures: Reintroduce CPU ASTC decoder

Users may want to fall back to the CPU ASTC texture decoder due to hangs
and crashes that may be caused by keeping the GPU under compute heavy
loads for extended periods of time. This is especially the case in games
such as Astral Chain which make extensive use of ASTC textures.
parent f3caf536
No related branches found
No related tags found
No related merge requests found
...@@ -237,6 +237,7 @@ add_library(video_core STATIC ...@@ -237,6 +237,7 @@ add_library(video_core STATIC
texture_cache/util.cpp texture_cache/util.cpp
texture_cache/util.h texture_cache/util.h
textures/astc.h textures/astc.h
textures/astc.cpp
textures/decoders.cpp textures/decoders.cpp
textures/decoders.h textures/decoders.h
textures/texture.cpp textures/texture.cpp
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include "video_core/texture_cache/formatter.h" #include "video_core/texture_cache/formatter.h"
#include "video_core/texture_cache/samples_helper.h" #include "video_core/texture_cache/samples_helper.h"
#include "video_core/texture_cache/util.h" #include "video_core/texture_cache/util.h"
#include "video_core/textures/astc.h"
#include "video_core/textures/decoders.h" #include "video_core/textures/decoders.h"
namespace VideoCommon { namespace VideoCommon {
...@@ -884,8 +885,16 @@ void ConvertImage(std::span<const u8> input, const ImageInfo& info, std::span<u8 ...@@ -884,8 +885,16 @@ void ConvertImage(std::span<const u8> input, const ImageInfo& info, std::span<u8
ASSERT(copy.image_extent == mip_size); ASSERT(copy.image_extent == mip_size);
ASSERT(copy.buffer_row_length == Common::AlignUp(mip_size.width, tile_size.width)); ASSERT(copy.buffer_row_length == Common::AlignUp(mip_size.width, tile_size.width));
ASSERT(copy.buffer_image_height == Common::AlignUp(mip_size.height, tile_size.height)); ASSERT(copy.buffer_image_height == Common::AlignUp(mip_size.height, tile_size.height));
DecompressBC4(input.subspan(copy.buffer_offset), copy.image_extent, if (IsPixelFormatASTC(info.format)) {
output.subspan(output_offset)); ASSERT(copy.image_extent.depth == 1);
Tegra::Texture::ASTC::Decompress(input.subspan(copy.buffer_offset),
copy.image_extent.width, copy.image_extent.height,
copy.image_subresource.num_layers, tile_size.width,
tile_size.height, output.subspan(output_offset));
} else {
DecompressBC4(input.subspan(copy.buffer_offset), copy.image_extent,
output.subspan(output_offset));
}
copy.buffer_offset = output_offset; copy.buffer_offset = output_offset;
copy.buffer_row_length = mip_size.width; copy.buffer_row_length = mip_size.width;
copy.buffer_image_height = mip_size.height; copy.buffer_image_height = mip_size.height;
......
This diff is collapsed.
...@@ -129,4 +129,7 @@ struct AstcBufferData { ...@@ -129,4 +129,7 @@ struct AstcBufferData {
decltype(REPLICATE_BYTE_TO_16_TABLE) replicate_byte_to_16 = REPLICATE_BYTE_TO_16_TABLE; decltype(REPLICATE_BYTE_TO_16_TABLE) replicate_byte_to_16 = REPLICATE_BYTE_TO_16_TABLE;
} constexpr ASTC_BUFFER_DATA; } constexpr ASTC_BUFFER_DATA;
void Decompress(std::span<const uint8_t> data, uint32_t width, uint32_t height, uint32_t depth,
uint32_t block_width, uint32_t block_height, std::span<uint8_t> output);
} // namespace Tegra::Texture::ASTC } // namespace Tegra::Texture::ASTC
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment