mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-11-22 04:10:08 +01:00
[TEST] ASTC fixes
This commit is contained in:
parent
0fb0592a5f
commit
b1adbd8e6b
5 changed files with 6 additions and 32 deletions
|
|
@ -1384,11 +1384,7 @@ void DecompressBlock(ivec3 coord) {
|
||||||
p = Cf / 65535.0f;
|
p = Cf / 65535.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VULKAN
|
|
||||||
imageStore(dest_image, coord + ivec3(i, j, 0), p.gbar);
|
|
||||||
#else
|
|
||||||
imageStore(dest_image, coord + ivec3(i, j, 0), clamp(p, 0.0f, 1.0f).gbar);
|
imageStore(dest_image, coord + ivec3(i, j, 0), clamp(p, 0.0f, 1.0f).gbar);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -145,11 +145,6 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) {
|
||||||
info.size.depth == 1;
|
info.size.depth == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] bool WillUseWidenedAstcFormat(const Device& device, const ImageInfo& info) {
|
|
||||||
return WillUseAcceleratedAstcDecode(device, info) &&
|
|
||||||
!VideoCore::Surface::IsPixelFormatSRGB(info.format);
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] VkImageCreateInfo MakeImageCreateInfo(const Device& device, const ImageInfo& info,
|
[[nodiscard]] VkImageCreateInfo MakeImageCreateInfo(const Device& device, const ImageInfo& info,
|
||||||
std::optional<VkFormat> format_override = {}) {
|
std::optional<VkFormat> format_override = {}) {
|
||||||
auto format_info =
|
auto format_info =
|
||||||
|
|
@ -1837,12 +1832,7 @@ Image::Image(TextureCacheRuntime& runtime_, const ImageInfo& info_, GPUVAddr gpu
|
||||||
: VideoCommon::ImageBase(info_, gpu_addr_, cpu_addr_), scheduler{&runtime_.scheduler},
|
: VideoCommon::ImageBase(info_, gpu_addr_, cpu_addr_), scheduler{&runtime_.scheduler},
|
||||||
runtime{&runtime_},
|
runtime{&runtime_},
|
||||||
original_image(MakeImage(runtime_.device, runtime_.memory_allocator, info,
|
original_image(MakeImage(runtime_.device, runtime_.memory_allocator, info,
|
||||||
WillUseWidenedAstcFormat(runtime_.device, info)
|
runtime->ViewFormats(info.format))),
|
||||||
? std::span<const VkFormat>{}
|
|
||||||
: runtime->ViewFormats(info.format),
|
|
||||||
WillUseWidenedAstcFormat(runtime_.device, info)
|
|
||||||
? std::make_optional(VK_FORMAT_R32G32B32A32_SFLOAT)
|
|
||||||
: std::nullopt)),
|
|
||||||
aspect_mask(ImageAspectMask(info.format)) {
|
aspect_mask(ImageAspectMask(info.format)) {
|
||||||
if (IsPixelFormatASTC(info.format) && !runtime->device.IsOptimalAstcSupported()) {
|
if (IsPixelFormatASTC(info.format) && !runtime->device.IsOptimalAstcSupported()) {
|
||||||
switch (Settings::values.accelerate_astc.GetValue()) {
|
switch (Settings::values.accelerate_astc.GetValue()) {
|
||||||
|
|
@ -1873,9 +1863,7 @@ Image::Image(TextureCacheRuntime& runtime_, const ImageInfo& info_, GPUVAddr gpu
|
||||||
Settings::values.astc_recompression.GetValue() ==
|
Settings::values.astc_recompression.GetValue() ==
|
||||||
Settings::AstcRecompression::Uncompressed) {
|
Settings::AstcRecompression::Uncompressed) {
|
||||||
const auto& device = runtime->device.GetLogical();
|
const auto& device = runtime->device.GetLogical();
|
||||||
const VkFormat storage_format = WillUseWidenedAstcFormat(runtime->device, info)
|
const VkFormat storage_format = VK_FORMAT_A8B8G8R8_UNORM_PACK32;
|
||||||
? VK_FORMAT_R32G32B32A32_SFLOAT
|
|
||||||
: VK_FORMAT_A8B8G8R8_UNORM_PACK32;
|
|
||||||
for (s32 level = 0; level < info.resources.levels; ++level) {
|
for (s32 level = 0; level < info.resources.levels; ++level) {
|
||||||
storage_image_views[level] =
|
storage_image_views[level] =
|
||||||
MakeStorageView(device, level, *original_image, storage_format);
|
MakeStorageView(device, level, *original_image, storage_format);
|
||||||
|
|
@ -2266,9 +2254,7 @@ VkImageView Image::StorageImageView(s32 level) noexcept {
|
||||||
auto format_info =
|
auto format_info =
|
||||||
MaxwellToVK::SurfaceFormat(runtime->device, FormatType::Optimal, true, info.format);
|
MaxwellToVK::SurfaceFormat(runtime->device, FormatType::Optimal, true, info.format);
|
||||||
if (WillUseAcceleratedAstcDecode(runtime->device, info)) {
|
if (WillUseAcceleratedAstcDecode(runtime->device, info)) {
|
||||||
format_info.format = WillUseWidenedAstcFormat(runtime->device, info)
|
format_info.format = VK_FORMAT_A8B8G8R8_UNORM_PACK32;
|
||||||
? VK_FORMAT_R32G32B32A32_SFLOAT
|
|
||||||
: VK_FORMAT_A8B8G8R8_UNORM_PACK32;
|
|
||||||
}
|
}
|
||||||
view = MakeStorageView(runtime->device.GetLogical(), level, *(this->*current_image),
|
view = MakeStorageView(runtime->device.GetLogical(), level, *(this->*current_image),
|
||||||
format_info.format);
|
format_info.format);
|
||||||
|
|
@ -2444,11 +2430,7 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewI
|
||||||
SanitizeDepthStencilSwizzle(swizzle, device->SupportsDepthStencilSwizzleOne());
|
SanitizeDepthStencilSwizzle(swizzle, device->SupportsDepthStencilSwizzleOne());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uses_widened_astc_format = WillUseWidenedAstcFormat(*device, image.info);
|
|
||||||
auto format_info = MaxwellToVK::SurfaceFormat(*device, FormatType::Optimal, true, format);
|
auto format_info = MaxwellToVK::SurfaceFormat(*device, FormatType::Optimal, true, format);
|
||||||
if (uses_widened_astc_format) {
|
|
||||||
format_info.format = VK_FORMAT_R32G32B32A32_SFLOAT;
|
|
||||||
}
|
|
||||||
if (device->ApiVersion() >= VK_API_VERSION_1_3) {
|
if (device->ApiVersion() >= VK_API_VERSION_1_3) {
|
||||||
const VkFormatProperties3 properties3 =
|
const VkFormatProperties3 properties3 =
|
||||||
device->GetPhysical().GetFormatProperties3(format_info.format);
|
device->GetPhysical().GetFormatProperties3(format_info.format);
|
||||||
|
|
@ -2594,9 +2576,6 @@ VkImageView ImageView::StorageView(Shader::TextureType texture_type,
|
||||||
auto& view{typeless_storage_views[static_cast<size_t>(texture_type)]};
|
auto& view{typeless_storage_views[static_cast<size_t>(texture_type)]};
|
||||||
if (!view) {
|
if (!view) {
|
||||||
auto info = MaxwellToVK::SurfaceFormat(*device, FormatType::Optimal, true, format);
|
auto info = MaxwellToVK::SurfaceFormat(*device, FormatType::Optimal, true, format);
|
||||||
if (uses_widened_astc_format) {
|
|
||||||
info.format = VK_FORMAT_R32G32B32A32_SFLOAT;
|
|
||||||
}
|
|
||||||
view = MakeView(info.format, VK_IMAGE_ASPECT_COLOR_BIT, texture_type);
|
view = MakeView(info.format, VK_IMAGE_ASPECT_COLOR_BIT, texture_type);
|
||||||
}
|
}
|
||||||
return *view;
|
return *view;
|
||||||
|
|
|
||||||
|
|
@ -497,7 +497,6 @@ private:
|
||||||
VkSampleCountFlagBits samples = VK_SAMPLE_COUNT_1_BIT;
|
VkSampleCountFlagBits samples = VK_SAMPLE_COUNT_1_BIT;
|
||||||
u32 buffer_size = 0;
|
u32 buffer_size = 0;
|
||||||
|
|
||||||
bool uses_widened_astc_format = false;
|
|
||||||
bool supports_depth_comparison = false;
|
bool supports_depth_comparison = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -837,7 +837,8 @@ bool Device::ComputeIsOptimalAstcSupported() const {
|
||||||
VK_FORMAT_ASTC_12x10_UNORM_BLOCK, VK_FORMAT_ASTC_12x10_SRGB_BLOCK,
|
VK_FORMAT_ASTC_12x10_UNORM_BLOCK, VK_FORMAT_ASTC_12x10_SRGB_BLOCK,
|
||||||
VK_FORMAT_ASTC_12x12_UNORM_BLOCK, VK_FORMAT_ASTC_12x12_SRGB_BLOCK,
|
VK_FORMAT_ASTC_12x12_UNORM_BLOCK, VK_FORMAT_ASTC_12x12_SRGB_BLOCK,
|
||||||
};
|
};
|
||||||
if (!features.features.textureCompressionASTC_LDR) {
|
if (!features.features.textureCompressionASTC_LDR ||
|
||||||
|
!features.texture_compression_astc_hdr.textureCompressionASTC_HDR) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const auto format_feature_usage{VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT |
|
const auto format_feature_usage{VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT |
|
||||||
|
|
|
||||||
|
|
@ -381,8 +381,7 @@ FN_MAX_LIMIT_LIST
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsOptimalAstcSupported() const {
|
bool IsOptimalAstcSupported() const {
|
||||||
return features.features.textureCompressionASTC_LDR &&
|
return is_optimal_astc_supported;
|
||||||
features.texture_compression_astc_hdr.textureCompressionASTC_HDR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if BCn is natively supported.
|
/// Returns true if BCn is natively supported.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue