1
0
Fork 0
forked from suyu/suyu

distinguish between moltenVK and other drivers.

This commit is contained in:
Alessio1989 2024-03-14 20:34:14 +01:00 committed by Crimson Hawk
parent 8b395f188c
commit 47ab25dbf7
2 changed files with 10 additions and 3 deletions

View file

@ -136,8 +136,11 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) {
auto usage = ImageUsageFlags(format_info, info.format); auto usage = ImageUsageFlags(format_info, info.format);
if (is_3d) { if (is_3d) {
flags |= VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT; flags |= VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT;
// Force usage to be VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT only on MoltenVK
if (device.IsMoltenVK()) {
usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_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{
.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
@ -164,8 +167,7 @@ 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) {
const bool is_buffer = (info.type == ImageType::Buffer); if (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);

View file

@ -702,6 +702,11 @@ public:
return properties.driver.driverID == VK_DRIVER_ID_NVIDIA_PROPRIETARY; return properties.driver.driverID == VK_DRIVER_ID_NVIDIA_PROPRIETARY;
} }
/// Checks if we are runing MolvenVK.
bool IsMoltenVK() const noexcept {
return properties.driver.driverID == VK_DRIVER_ID_MOLTENVK;
}
NvidiaArchitecture GetNvidiaArch() const noexcept { NvidiaArchitecture GetNvidiaArch() const noexcept {
return nvidia_arch; return nvidia_arch;
} }