mirror of
https://gitlab.com/suyu-emu/suyu.git
synced 2024-03-15 23:15:44 +00:00
Clyde/molten vk 64bit fix
This commit is contained in:
parent
de83c5e6a6
commit
b2b769e45b
|
@ -121,15 +121,22 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) {
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] VkImageCreateInfo MakeImageCreateInfo(const Device& device, const ImageInfo& info) {
|
[[nodiscard]] VkImageCreateInfo MakeImageCreateInfo(const Device& device, const ImageInfo& info) {
|
||||||
|
const bool is_2d = (info.type == ImageType::e2D);
|
||||||
|
const bool is_3d = (info.type == ImageType::e3D);
|
||||||
const auto format_info =
|
const auto format_info =
|
||||||
MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, false, info.format);
|
MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, false, info.format);
|
||||||
VkImageCreateFlags flags{};
|
VkImageCreateFlags flags{};
|
||||||
if (info.type == ImageType::e2D && info.resources.layers >= 6 &&
|
if (is_2d && info.resources.layers >= 6 && info.size.width == info.size.height &&
|
||||||
info.size.width == info.size.height && !device.HasBrokenCubeImageCompatibility()) {
|
!device.HasBrokenCubeImageCompatibility()) {
|
||||||
flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT;
|
flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT;
|
||||||
}
|
}
|
||||||
if (info.type == ImageType::e3D) {
|
|
||||||
|
// fix moltenVK issues with some 3D games
|
||||||
|
// credit to Jarrod Norwell from Sudachi https://github.com/jarrodnorwell/Sudachi
|
||||||
|
auto usage = ImageUsageFlags(format_info, info.format);
|
||||||
|
if (is_3d) {
|
||||||
flags |= VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT;
|
flags |= VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT;
|
||||||
|
usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||||
}
|
}
|
||||||
const auto [samples_x, samples_y] = VideoCommon::SamplesLog2(info.num_samples);
|
const auto [samples_x, samples_y] = VideoCommon::SamplesLog2(info.num_samples);
|
||||||
return VkImageCreateInfo{
|
return VkImageCreateInfo{
|
||||||
|
@ -147,7 +154,7 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) {
|
||||||
.arrayLayers = static_cast<u32>(info.resources.layers),
|
.arrayLayers = static_cast<u32>(info.resources.layers),
|
||||||
.samples = ConvertSampleCount(info.num_samples),
|
.samples = ConvertSampleCount(info.num_samples),
|
||||||
.tiling = VK_IMAGE_TILING_OPTIMAL,
|
.tiling = VK_IMAGE_TILING_OPTIMAL,
|
||||||
.usage = ImageUsageFlags(format_info, info.format),
|
.usage = usage,
|
||||||
.sharingMode = VK_SHARING_MODE_EXCLUSIVE,
|
.sharingMode = VK_SHARING_MODE_EXCLUSIVE,
|
||||||
.queueFamilyIndexCount = 0,
|
.queueFamilyIndexCount = 0,
|
||||||
.pQueueFamilyIndices = nullptr,
|
.pQueueFamilyIndices = nullptr,
|
||||||
|
@ -157,7 +164,8 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) {
|
||||||
|
|
||||||
[[nodiscard]] vk::Image MakeImage(const Device& device, const MemoryAllocator& allocator,
|
[[nodiscard]] vk::Image MakeImage(const Device& device, const MemoryAllocator& allocator,
|
||||||
const ImageInfo& info, std::span<const VkFormat> view_formats) {
|
const ImageInfo& info, std::span<const VkFormat> view_formats) {
|
||||||
if (info.type == ImageType::Buffer) {
|
const bool is_buffer = (info.type == ImageType::Buffer);
|
||||||
|
if (is_buffer) {
|
||||||
return vk::Image{};
|
return vk::Image{};
|
||||||
}
|
}
|
||||||
VkImageCreateInfo image_ci = MakeImageCreateInfo(device, info);
|
VkImageCreateInfo image_ci = MakeImageCreateInfo(device, info);
|
||||||
|
@ -697,7 +705,7 @@ struct RangedBarrierRange {
|
||||||
void BlitScale(Scheduler& scheduler, VkImage src_image, VkImage dst_image, const ImageInfo& info,
|
void BlitScale(Scheduler& scheduler, VkImage src_image, VkImage dst_image, const ImageInfo& info,
|
||||||
VkImageAspectFlags aspect_mask, const Settings::ResolutionScalingInfo& resolution,
|
VkImageAspectFlags aspect_mask, const Settings::ResolutionScalingInfo& resolution,
|
||||||
bool up_scaling = true) {
|
bool up_scaling = true) {
|
||||||
const bool is_2d = info.type == ImageType::e2D;
|
const bool is_2d = (info.type == ImageType::e2D);
|
||||||
const auto resources = info.resources;
|
const auto resources = info.resources;
|
||||||
const VkExtent2D extent{
|
const VkExtent2D extent{
|
||||||
.width = info.size.width,
|
.width = info.size.width,
|
||||||
|
@ -1562,7 +1570,7 @@ bool Image::ScaleUp(bool ignore) {
|
||||||
flags |= ImageFlagBits::Rescaled;
|
flags |= ImageFlagBits::Rescaled;
|
||||||
has_scaled = true;
|
has_scaled = true;
|
||||||
if (!scaled_image) {
|
if (!scaled_image) {
|
||||||
const bool is_2d = info.type == ImageType::e2D;
|
const bool is_2d = (info.type == ImageType::e2D);
|
||||||
const u32 scaled_width = resolution.ScaleUp(info.size.width);
|
const u32 scaled_width = resolution.ScaleUp(info.size.width);
|
||||||
const u32 scaled_height = is_2d ? resolution.ScaleUp(info.size.height) : info.size.height;
|
const u32 scaled_height = is_2d ? resolution.ScaleUp(info.size.height) : info.size.height;
|
||||||
auto scaled_info = info;
|
auto scaled_info = info;
|
||||||
|
@ -1620,7 +1628,7 @@ bool Image::BlitScaleHelper(bool scale_up) {
|
||||||
const auto operation = is_bilinear ? Tegra::Engines::Fermi2D::Filter::Bilinear
|
const auto operation = is_bilinear ? Tegra::Engines::Fermi2D::Filter::Bilinear
|
||||||
: Tegra::Engines::Fermi2D::Filter::Point;
|
: Tegra::Engines::Fermi2D::Filter::Point;
|
||||||
|
|
||||||
const bool is_2d = info.type == ImageType::e2D;
|
const bool is_2d = (info.type == ImageType::e2D);
|
||||||
const auto& resolution = runtime->resolution;
|
const auto& resolution = runtime->resolution;
|
||||||
const u32 scaled_width = resolution.ScaleUp(info.size.width);
|
const u32 scaled_width = resolution.ScaleUp(info.size.width);
|
||||||
const u32 scaled_height = is_2d ? resolution.ScaleUp(info.size.height) : info.size.height;
|
const u32 scaled_height = is_2d ? resolution.ScaleUp(info.size.height) : info.size.height;
|
||||||
|
|
Loading…
Reference in a new issue