Merge pull request #10398 from liamwhite/bcn
video_core: add ASTC recompression
This commit is contained in:
commit
76f6388969
23 changed files with 1150 additions and 27 deletions
|
@ -6,6 +6,7 @@
|
|||
#include "common/assert.h"
|
||||
#include "common/common_types.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/settings.h"
|
||||
#include "video_core/engines/maxwell_3d.h"
|
||||
#include "video_core/renderer_vulkan/maxwell_to_vk.h"
|
||||
#include "video_core/surface.h"
|
||||
|
@ -237,14 +238,25 @@ FormatInfo SurfaceFormat(const Device& device, FormatType format_type, bool with
|
|||
PixelFormat pixel_format) {
|
||||
ASSERT(static_cast<size_t>(pixel_format) < std::size(tex_format_tuples));
|
||||
FormatTuple tuple = tex_format_tuples[static_cast<size_t>(pixel_format)];
|
||||
// Use A8B8G8R8_UNORM on hardware that doesn't support ASTC natively
|
||||
// Transcode on hardware that doesn't support ASTC natively
|
||||
if (!device.IsOptimalAstcSupported() && VideoCore::Surface::IsPixelFormatASTC(pixel_format)) {
|
||||
const bool is_srgb = with_srgb && VideoCore::Surface::IsPixelFormatSRGB(pixel_format);
|
||||
if (is_srgb) {
|
||||
tuple.format = VK_FORMAT_A8B8G8R8_SRGB_PACK32;
|
||||
} else {
|
||||
tuple.format = VK_FORMAT_A8B8G8R8_UNORM_PACK32;
|
||||
tuple.usage |= Storage;
|
||||
|
||||
switch (Settings::values.astc_recompression.GetValue()) {
|
||||
case Settings::AstcRecompression::Uncompressed:
|
||||
if (is_srgb) {
|
||||
tuple.format = VK_FORMAT_A8B8G8R8_SRGB_PACK32;
|
||||
} else {
|
||||
tuple.format = VK_FORMAT_A8B8G8R8_UNORM_PACK32;
|
||||
tuple.usage |= Storage;
|
||||
}
|
||||
break;
|
||||
case Settings::AstcRecompression::Bc1:
|
||||
tuple.format = is_srgb ? VK_FORMAT_BC1_RGBA_SRGB_BLOCK : VK_FORMAT_BC1_RGBA_UNORM_BLOCK;
|
||||
break;
|
||||
case Settings::AstcRecompression::Bc3:
|
||||
tuple.format = is_srgb ? VK_FORMAT_BC3_SRGB_BLOCK : VK_FORMAT_BC3_UNORM_BLOCK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const bool attachable = (tuple.usage & Attachable) != 0;
|
||||
|
|
|
@ -1272,7 +1272,9 @@ Image::Image(TextureCacheRuntime& runtime_, const ImageInfo& info_, GPUVAddr gpu
|
|||
if (IsPixelFormatASTC(info.format) && !runtime->device.IsOptimalAstcSupported()) {
|
||||
if (Settings::values.async_astc.GetValue()) {
|
||||
flags |= VideoCommon::ImageFlagBits::AsynchronousDecode;
|
||||
} else if (Settings::values.accelerate_astc.GetValue() && info.size.depth == 1) {
|
||||
} else if (Settings::values.astc_recompression.GetValue() ==
|
||||
Settings::AstcRecompression::Uncompressed &&
|
||||
Settings::values.accelerate_astc.GetValue() && info.size.depth == 1) {
|
||||
flags |= VideoCommon::ImageFlagBits::AcceleratedUpload;
|
||||
}
|
||||
flags |= VideoCommon::ImageFlagBits::Converted;
|
||||
|
@ -1287,7 +1289,9 @@ Image::Image(TextureCacheRuntime& runtime_, const ImageInfo& info_, GPUVAddr gpu
|
|||
.usage = VK_IMAGE_USAGE_STORAGE_BIT,
|
||||
};
|
||||
current_image = *original_image;
|
||||
if (IsPixelFormatASTC(info.format) && !runtime->device.IsOptimalAstcSupported()) {
|
||||
if (IsPixelFormatASTC(info.format) && !runtime->device.IsOptimalAstcSupported() &&
|
||||
Settings::values.astc_recompression.GetValue() ==
|
||||
Settings::AstcRecompression::Uncompressed) {
|
||||
const auto& device = runtime->device.GetLogical();
|
||||
storage_image_views.reserve(info.resources.levels);
|
||||
for (s32 level = 0; level < info.resources.levels; ++level) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue