mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-28 02:26:07 +00:00
renderer_vulkan: Remove some fallbacks and misc format queries that are no longer needed. (#1773)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
This commit is contained in:
parent
8caca4df32
commit
3e22622508
|
@ -68,11 +68,10 @@ std::unordered_map<vk::Format, vk::FormatProperties3> GetFormatProperties(
|
||||||
}
|
}
|
||||||
// Other miscellaneous formats, e.g. for color buffers, swizzles, or compatibility
|
// Other miscellaneous formats, e.g. for color buffers, swizzles, or compatibility
|
||||||
static constexpr std::array misc_formats = {
|
static constexpr std::array misc_formats = {
|
||||||
vk::Format::eA2R10G10B10UnormPack32, vk::Format::eA8B8G8R8UnormPack32,
|
vk::Format::eA2R10G10B10UnormPack32,
|
||||||
vk::Format::eA8B8G8R8SrgbPack32, vk::Format::eB8G8R8A8Unorm,
|
vk::Format::eB8G8R8A8Unorm,
|
||||||
vk::Format::eB8G8R8A8Snorm, vk::Format::eB8G8R8A8Uint,
|
vk::Format::eB8G8R8A8Srgb,
|
||||||
vk::Format::eB8G8R8A8Sint, vk::Format::eB8G8R8A8Srgb,
|
vk::Format::eD24UnormS8Uint,
|
||||||
vk::Format::eR5G6B5UnormPack16, vk::Format::eD24UnormS8Uint,
|
|
||||||
};
|
};
|
||||||
for (const auto& format : misc_formats) {
|
for (const auto& format : misc_formats) {
|
||||||
if (!format_properties.contains(format)) {
|
if (!format_properties.contains(format)) {
|
||||||
|
@ -583,8 +582,6 @@ bool Instance::IsFormatSupported(const vk::Format format,
|
||||||
|
|
||||||
static vk::Format GetAlternativeFormat(const vk::Format format) {
|
static vk::Format GetAlternativeFormat(const vk::Format format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case vk::Format::eB5G6R5UnormPack16:
|
|
||||||
return vk::Format::eR5G6B5UnormPack16;
|
|
||||||
case vk::Format::eD16UnormS8Uint:
|
case vk::Format::eD16UnormS8Uint:
|
||||||
return vk::Format::eD24UnormS8Uint;
|
return vk::Format::eD24UnormS8Uint;
|
||||||
default:
|
default:
|
||||||
|
@ -604,19 +601,4 @@ vk::Format Instance::GetSupportedFormat(const vk::Format format,
|
||||||
return format;
|
return format;
|
||||||
}
|
}
|
||||||
|
|
||||||
vk::ComponentMapping Instance::GetSupportedComponentSwizzle(
|
|
||||||
const vk::Format format, const vk::ComponentMapping swizzle,
|
|
||||||
const vk::FormatFeatureFlags2 flags) const {
|
|
||||||
if (IsFormatSupported(format, flags)) [[likely]] {
|
|
||||||
return swizzle;
|
|
||||||
}
|
|
||||||
|
|
||||||
vk::ComponentMapping supported_swizzle = swizzle;
|
|
||||||
if (format == vk::Format::eB5G6R5UnormPack16) {
|
|
||||||
// B5G6R5 -> R5G6B5
|
|
||||||
std::swap(supported_swizzle.r, supported_swizzle.b);
|
|
||||||
}
|
|
||||||
return supported_swizzle;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Vulkan
|
} // namespace Vulkan
|
||||||
|
|
|
@ -33,10 +33,6 @@ public:
|
||||||
[[nodiscard]] vk::Format GetSupportedFormat(vk::Format format,
|
[[nodiscard]] vk::Format GetSupportedFormat(vk::Format format,
|
||||||
vk::FormatFeatureFlags2 flags) const;
|
vk::FormatFeatureFlags2 flags) const;
|
||||||
|
|
||||||
/// Re-orders a component swizzle for format compatibility, if needed.
|
|
||||||
[[nodiscard]] vk::ComponentMapping GetSupportedComponentSwizzle(
|
|
||||||
vk::Format format, vk::ComponentMapping swizzle, vk::FormatFeatureFlags2 flags) const;
|
|
||||||
|
|
||||||
/// Returns the Vulkan instance
|
/// Returns the Vulkan instance
|
||||||
vk::Instance GetInstance() const {
|
vk::Instance GetInstance() const {
|
||||||
return *instance;
|
return *instance;
|
||||||
|
|
|
@ -141,8 +141,7 @@ ImageView::ImageView(const Vulkan::Instance& instance, const ImageViewInfo& info
|
||||||
.image = image.image,
|
.image = image.image,
|
||||||
.viewType = info.type,
|
.viewType = info.type,
|
||||||
.format = instance.GetSupportedFormat(format, image.format_features),
|
.format = instance.GetSupportedFormat(format, image.format_features),
|
||||||
.components =
|
.components = info.mapping,
|
||||||
instance.GetSupportedComponentSwizzle(format, info.mapping, image.format_features),
|
|
||||||
.subresourceRange{
|
.subresourceRange{
|
||||||
.aspectMask = aspect,
|
.aspectMask = aspect,
|
||||||
.baseMipLevel = info.range.base.level,
|
.baseMipLevel = info.range.base.level,
|
||||||
|
|
Loading…
Reference in a new issue