settings,video_core: Consolidate ASTC decoding options

Just puts them all neatly into one place.
This commit is contained in:
lat9nq 2023-05-03 20:42:33 -04:00
parent c0202da9ac
commit 5cffa34288
12 changed files with 105 additions and 52 deletions

View file

@ -232,10 +232,9 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4
[[nodiscard]] bool CanBeAccelerated(const TextureCacheRuntime& runtime,
const VideoCommon::ImageInfo& info) {
if (IsPixelFormatASTC(info.format) && info.size.depth == 1 && !runtime.HasNativeASTC()) {
return Settings::values.accelerate_astc.GetValue() &&
return Settings::values.accelerate_astc.GetValue() == Settings::AstcDecodeMode::GPU &&
Settings::values.astc_recompression.GetValue() ==
Settings::AstcRecompression::Uncompressed &&
!Settings::values.async_astc.GetValue();
Settings::AstcRecompression::Uncompressed;
}
// Disable other accelerated uploads for now as they don't implement swizzled uploads
return false;
@ -267,7 +266,8 @@ void ApplySwizzle(GLuint handle, PixelFormat format, std::array<SwizzleSource, 4
[[nodiscard]] bool CanBeDecodedAsync(const TextureCacheRuntime& runtime,
const VideoCommon::ImageInfo& info) {
if (IsPixelFormatASTC(info.format) && !runtime.HasNativeASTC()) {
return Settings::values.async_astc.GetValue();
return Settings::values.accelerate_astc.GetValue() ==
Settings::AstcDecodeMode::CPUAsynchronous;
}
return false;
}

View file

@ -817,7 +817,7 @@ TextureCacheRuntime::TextureCacheRuntime(const Device& device_, Scheduler& sched
: device{device_}, scheduler{scheduler_}, memory_allocator{memory_allocator_},
staging_buffer_pool{staging_buffer_pool_}, blit_image_helper{blit_image_helper_},
render_pass_cache{render_pass_cache_}, resolution{Settings::values.resolution_info} {
if (Settings::values.accelerate_astc) {
if (Settings::values.accelerate_astc.GetValue() == Settings::AstcDecodeMode::GPU) {
astc_decoder_pass.emplace(device, scheduler, descriptor_pool, staging_buffer_pool,
compute_pass_descriptor_queue, memory_allocator);
}
@ -1301,12 +1301,19 @@ Image::Image(TextureCacheRuntime& runtime_, const ImageInfo& info_, GPUVAddr gpu
runtime->ViewFormats(info.format))),
aspect_mask(ImageAspectMask(info.format)) {
if (IsPixelFormatASTC(info.format) && !runtime->device.IsOptimalAstcSupported()) {
if (Settings::values.async_astc.GetValue()) {
switch (Settings::values.accelerate_astc.GetValue()) {
case Settings::AstcDecodeMode::GPU:
if (Settings::values.astc_recompression.GetValue() ==
Settings::AstcRecompression::Uncompressed &&
info.size.depth == 1) {
flags |= VideoCommon::ImageFlagBits::AcceleratedUpload;
}
break;
case Settings::AstcDecodeMode::CPUAsynchronous:
flags |= VideoCommon::ImageFlagBits::AsynchronousDecode;
} else if (Settings::values.astc_recompression.GetValue() ==
Settings::AstcRecompression::Uncompressed &&
Settings::values.accelerate_astc.GetValue() && info.size.depth == 1) {
flags |= VideoCommon::ImageFlagBits::AcceleratedUpload;
break;
default:
break;
}
flags |= VideoCommon::ImageFlagBits::Converted;
flags |= VideoCommon::ImageFlagBits::CostlyLoad;