Compare commits

...

9 Commits

Author SHA1 Message Date
Liam
3304d58edb vulkan_device: disable extended_dynamic_state2 on ARM drivers 2023-06-15 12:29:54 -04:00
bunnei
ce0510913a Merge pull request #10729 from liamwhite/windows-is-a-meme
vfs_real: add file LRU cache for open file limits
2023-06-14 18:32:25 -07:00
Morph
fb97aec26b Merge pull request #10781 from 8bitDream/vcpkg
externals: Fix update vcpkg to 2023.06.14
2023-06-14 18:07:05 -04:00
Morph
702a2ac631 Merge pull request #10749 from Morph1984/strong-typing
buffer_cache_base: Specify buffer type in HostBindings
2023-06-14 18:03:11 -04:00
Liam
ed7c4af915 vfs_real: require file existence on open 2023-06-13 17:22:47 -04:00
Liam
dbbe237668 vfs_real: add simplified open file cache 2023-06-13 17:16:14 -04:00
Liam
0e7eaaba5a vfs_real: lazily open files 2023-06-13 10:37:34 -04:00
Liam
f25236a4d6 vfs_real: add file LRU cache for open file limits 2023-06-13 10:37:34 -04:00
Morph
925586f97b buffer_cache_base: Specify buffer type in HostBindings
Avoid reinterpret-casting from void pointer since the type is already known at compile time.
2023-06-13 00:59:42 -04:00
9 changed files with 172 additions and 150 deletions

View File

@@ -25,6 +25,8 @@ namespace FS = Common::FS;
namespace {
constexpr size_t MaxOpenFiles = 512;
constexpr FS::FileAccessMode ModeFlagsToFileAccessMode(Mode mode) {
switch (mode) {
case Mode::Read:
@@ -73,28 +75,30 @@ VfsEntryType RealVfsFilesystem::GetEntryType(std::string_view path_) const {
VirtualFile RealVfsFilesystem::OpenFile(std::string_view path_, Mode perms) {
const auto path = FS::SanitizePath(path_, FS::DirectorySeparator::PlatformDefault);
if (const auto weak_iter = cache.find(path); weak_iter != cache.cend()) {
const auto& weak = weak_iter->second;
if (!weak.expired()) {
return std::shared_ptr<RealVfsFile>(new RealVfsFile(*this, weak.lock(), path, perms));
if (auto it = cache.find(path); it != cache.end()) {
if (auto file = it->second.lock(); file) {
return file;
}
}
auto backing = FS::FileOpen(path, ModeFlagsToFileAccessMode(perms), FS::FileType::BinaryFile);
if (!backing) {
if (!FS::Exists(path) || !FS::IsFile(path)) {
return nullptr;
}
cache.insert_or_assign(path, std::move(backing));
auto reference = std::make_unique<FileReference>();
this->InsertReferenceIntoList(*reference);
// Cannot use make_shared as RealVfsFile constructor is private
return std::shared_ptr<RealVfsFile>(new RealVfsFile(*this, backing, path, perms));
auto file =
std::shared_ptr<RealVfsFile>(new RealVfsFile(*this, std::move(reference), path, perms));
cache[path] = file;
return file;
}
VirtualFile RealVfsFilesystem::CreateFile(std::string_view path_, Mode perms) {
const auto path = FS::SanitizePath(path_, FS::DirectorySeparator::PlatformDefault);
cache.erase(path);
// Current usages of CreateFile expect to delete the contents of an existing file.
if (FS::IsFile(path)) {
FS::IOFile temp{path, FS::FileAccessMode::Write, FS::FileType::BinaryFile};
@@ -123,51 +127,22 @@ VirtualFile RealVfsFilesystem::CopyFile(std::string_view old_path_, std::string_
VirtualFile RealVfsFilesystem::MoveFile(std::string_view old_path_, std::string_view new_path_) {
const auto old_path = FS::SanitizePath(old_path_, FS::DirectorySeparator::PlatformDefault);
const auto new_path = FS::SanitizePath(new_path_, FS::DirectorySeparator::PlatformDefault);
const auto cached_file_iter = cache.find(old_path);
if (cached_file_iter != cache.cend()) {
auto file = cached_file_iter->second.lock();
if (!cached_file_iter->second.expired()) {
file->Close();
}
if (!FS::RenameFile(old_path, new_path)) {
return nullptr;
}
cache.erase(old_path);
file->Open(new_path, FS::FileAccessMode::Read, FS::FileType::BinaryFile);
if (file->IsOpen()) {
cache.insert_or_assign(new_path, std::move(file));
} else {
LOG_ERROR(Service_FS, "Failed to open path {} in order to re-cache it", new_path);
}
} else {
ASSERT(false);
cache.erase(old_path);
cache.erase(new_path);
if (!FS::RenameFile(old_path, new_path)) {
return nullptr;
}
return OpenFile(new_path, Mode::ReadWrite);
}
bool RealVfsFilesystem::DeleteFile(std::string_view path_) {
const auto path = FS::SanitizePath(path_, FS::DirectorySeparator::PlatformDefault);
const auto cached_iter = cache.find(path);
if (cached_iter != cache.cend()) {
if (!cached_iter->second.expired()) {
cached_iter->second.lock()->Close();
}
cache.erase(path);
}
cache.erase(path);
return FS::RemoveFile(path);
}
VirtualDir RealVfsFilesystem::OpenDirectory(std::string_view path_, Mode perms) {
const auto path = FS::SanitizePath(path_, FS::DirectorySeparator::PlatformDefault);
// Cannot use make_shared as RealVfsDirectory constructor is private
return std::shared_ptr<RealVfsDirectory>(new RealVfsDirectory(*this, path, perms));
}
@@ -176,7 +151,6 @@ VirtualDir RealVfsFilesystem::CreateDirectory(std::string_view path_, Mode perms
if (!FS::CreateDirs(path)) {
return nullptr;
}
// Cannot use make_shared as RealVfsDirectory constructor is private
return std::shared_ptr<RealVfsDirectory>(new RealVfsDirectory(*this, path, perms));
}
@@ -194,73 +168,102 @@ VirtualDir RealVfsFilesystem::MoveDirectory(std::string_view old_path_,
if (!FS::RenameDir(old_path, new_path)) {
return nullptr;
}
for (auto& kv : cache) {
// If the path in the cache doesn't start with old_path, then bail on this file.
if (kv.first.rfind(old_path, 0) != 0) {
continue;
}
const auto file_old_path =
FS::SanitizePath(kv.first, FS::DirectorySeparator::PlatformDefault);
auto file_new_path = FS::SanitizePath(new_path + '/' + kv.first.substr(old_path.size()),
FS::DirectorySeparator::PlatformDefault);
const auto& cached = cache[file_old_path];
if (cached.expired()) {
continue;
}
auto file = cached.lock();
cache.erase(file_old_path);
file->Open(file_new_path, FS::FileAccessMode::Read, FS::FileType::BinaryFile);
if (file->IsOpen()) {
cache.insert_or_assign(std::move(file_new_path), std::move(file));
} else {
LOG_ERROR(Service_FS, "Failed to open path {} in order to re-cache it", file_new_path);
}
}
return OpenDirectory(new_path, Mode::ReadWrite);
}
bool RealVfsFilesystem::DeleteDirectory(std::string_view path_) {
const auto path = FS::SanitizePath(path_, FS::DirectorySeparator::PlatformDefault);
for (auto& kv : cache) {
// If the path in the cache doesn't start with path, then bail on this file.
if (kv.first.rfind(path, 0) != 0) {
continue;
}
const auto& entry = cache[kv.first];
if (!entry.expired()) {
entry.lock()->Close();
}
cache.erase(kv.first);
}
return FS::RemoveDirRecursively(path);
}
RealVfsFile::RealVfsFile(RealVfsFilesystem& base_, std::shared_ptr<FS::IOFile> backing_,
const std::string& path_, Mode perms_)
: base(base_), backing(std::move(backing_)), path(path_), parent_path(FS::GetParentPath(path_)),
path_components(FS::SplitPathComponents(path_)), perms(perms_) {}
void RealVfsFilesystem::RefreshReference(const std::string& path, Mode perms,
FileReference& reference) {
// Temporarily remove from list.
this->RemoveReferenceFromList(reference);
RealVfsFile::~RealVfsFile() = default;
// Restore file if needed.
if (!reference.file) {
this->EvictSingleReference();
reference.file =
FS::FileOpen(path, ModeFlagsToFileAccessMode(perms), FS::FileType::BinaryFile);
if (reference.file) {
num_open_files++;
}
}
// Reinsert into list.
this->InsertReferenceIntoList(reference);
}
void RealVfsFilesystem::DropReference(std::unique_ptr<FileReference>&& reference) {
// Remove from list.
this->RemoveReferenceFromList(*reference);
// Close the file.
if (reference->file) {
reference->file.reset();
num_open_files--;
}
}
void RealVfsFilesystem::EvictSingleReference() {
if (num_open_files < MaxOpenFiles || open_references.empty()) {
return;
}
// Get and remove from list.
auto& reference = open_references.back();
this->RemoveReferenceFromList(reference);
// Close the file.
if (reference.file) {
reference.file.reset();
num_open_files--;
}
// Reinsert into closed list.
this->InsertReferenceIntoList(reference);
}
void RealVfsFilesystem::InsertReferenceIntoList(FileReference& reference) {
if (reference.file) {
open_references.push_front(reference);
} else {
closed_references.push_front(reference);
}
}
void RealVfsFilesystem::RemoveReferenceFromList(FileReference& reference) {
if (reference.file) {
open_references.erase(open_references.iterator_to(reference));
} else {
closed_references.erase(closed_references.iterator_to(reference));
}
}
RealVfsFile::RealVfsFile(RealVfsFilesystem& base_, std::unique_ptr<FileReference> reference_,
const std::string& path_, Mode perms_)
: base(base_), reference(std::move(reference_)), path(path_),
parent_path(FS::GetParentPath(path_)), path_components(FS::SplitPathComponents(path_)),
perms(perms_) {}
RealVfsFile::~RealVfsFile() {
base.DropReference(std::move(reference));
}
std::string RealVfsFile::GetName() const {
return path_components.back();
}
std::size_t RealVfsFile::GetSize() const {
return backing->GetSize();
base.RefreshReference(path, perms, *reference);
return reference->file ? reference->file->GetSize() : 0;
}
bool RealVfsFile::Resize(std::size_t new_size) {
return backing->SetSize(new_size);
base.RefreshReference(path, perms, *reference);
return reference->file ? reference->file->SetSize(new_size) : false;
}
VirtualDir RealVfsFile::GetContainingDirectory() const {
@@ -276,27 +279,25 @@ bool RealVfsFile::IsReadable() const {
}
std::size_t RealVfsFile::Read(u8* data, std::size_t length, std::size_t offset) const {
if (!backing->Seek(static_cast<s64>(offset))) {
base.RefreshReference(path, perms, *reference);
if (!reference->file || !reference->file->Seek(static_cast<s64>(offset))) {
return 0;
}
return backing->ReadSpan(std::span{data, length});
return reference->file->ReadSpan(std::span{data, length});
}
std::size_t RealVfsFile::Write(const u8* data, std::size_t length, std::size_t offset) {
if (!backing->Seek(static_cast<s64>(offset))) {
base.RefreshReference(path, perms, *reference);
if (!reference->file || !reference->file->Seek(static_cast<s64>(offset))) {
return 0;
}
return backing->WriteSpan(std::span{data, length});
return reference->file->WriteSpan(std::span{data, length});
}
bool RealVfsFile::Rename(std::string_view name) {
return base.MoveFile(path, parent_path + '/' + std::string(name)) != nullptr;
}
void RealVfsFile::Close() {
backing->Close();
}
// TODO(DarkLordZach): MSVC would not let me combine the following two functions using 'if
// constexpr' because there is a compile error in the branch not used.

View File

@@ -3,8 +3,9 @@
#pragma once
#include <map>
#include <string_view>
#include <boost/container/flat_map.hpp>
#include "common/intrusive_list.h"
#include "core/file_sys/mode.h"
#include "core/file_sys/vfs.h"
@@ -14,6 +15,11 @@ class IOFile;
namespace FileSys {
struct FileReference : public Common::IntrusiveListBaseNode<FileReference> {
std::shared_ptr<Common::FS::IOFile> file{};
};
class RealVfsFile;
class RealVfsFilesystem : public VfsFilesystem {
public:
RealVfsFilesystem();
@@ -35,7 +41,21 @@ public:
bool DeleteDirectory(std::string_view path) override;
private:
boost::container::flat_map<std::string, std::weak_ptr<Common::FS::IOFile>> cache;
using ReferenceListType = Common::IntrusiveListBaseTraits<FileReference>::ListType;
std::map<std::string, std::weak_ptr<VfsFile>, std::less<>> cache;
ReferenceListType open_references;
ReferenceListType closed_references;
size_t num_open_files{};
private:
friend class RealVfsFile;
void RefreshReference(const std::string& path, Mode perms, FileReference& reference);
void DropReference(std::unique_ptr<FileReference>&& reference);
void EvictSingleReference();
private:
void InsertReferenceIntoList(FileReference& reference);
void RemoveReferenceFromList(FileReference& reference);
};
// An implementation of VfsFile that represents a file on the user's computer.
@@ -57,13 +77,11 @@ public:
bool Rename(std::string_view name) override;
private:
RealVfsFile(RealVfsFilesystem& base, std::shared_ptr<Common::FS::IOFile> backing,
RealVfsFile(RealVfsFilesystem& base, std::unique_ptr<FileReference> reference,
const std::string& path, Mode perms = Mode::Read);
void Close();
RealVfsFilesystem& base;
std::shared_ptr<Common::FS::IOFile> backing;
std::unique_ptr<FileReference> reference;
std::string path;
std::string parent_path;
std::vector<std::string> path_components;

View File

@@ -715,7 +715,7 @@ void BufferCache<P>::BindHostIndexBuffer() {
template <class P>
void BufferCache<P>::BindHostVertexBuffers() {
HostBindings host_bindings;
HostBindings<typename P::Buffer> host_bindings;
bool any_valid{false};
auto& flags = maxwell3d->dirty.flags;
for (u32 index = 0; index < NUM_VERTEX_BUFFERS; ++index) {
@@ -741,7 +741,7 @@ void BufferCache<P>::BindHostVertexBuffers() {
const u32 stride = maxwell3d->regs.vertex_streams[index].stride;
const u32 offset = buffer.Offset(binding.cpu_addr);
host_bindings.buffers.push_back(reinterpret_cast<void*>(&buffer));
host_bindings.buffers.push_back(&buffer);
host_bindings.offsets.push_back(offset);
host_bindings.sizes.push_back(binding.size);
host_bindings.strides.push_back(stride);
@@ -900,7 +900,7 @@ void BufferCache<P>::BindHostTransformFeedbackBuffers() {
if (maxwell3d->regs.transform_feedback_enabled == 0) {
return;
}
HostBindings host_bindings;
HostBindings<typename P::Buffer> host_bindings;
for (u32 index = 0; index < NUM_TRANSFORM_FEEDBACK_BUFFERS; ++index) {
const Binding& binding = channel_state->transform_feedback_buffers[index];
if (maxwell3d->regs.transform_feedback.controls[index].varying_count == 0 &&
@@ -913,7 +913,7 @@ void BufferCache<P>::BindHostTransformFeedbackBuffers() {
SynchronizeBuffer(buffer, binding.cpu_addr, size);
const u32 offset = buffer.Offset(binding.cpu_addr);
host_bindings.buffers.push_back(reinterpret_cast<void*>(&buffer));
host_bindings.buffers.push_back(&buffer);
host_bindings.offsets.push_back(offset);
host_bindings.sizes.push_back(binding.size);
}

View File

@@ -105,8 +105,9 @@ static constexpr Binding NULL_BINDING{
.buffer_id = NULL_BUFFER_ID,
};
template <typename Buffer>
struct HostBindings {
boost::container::small_vector<void*, NUM_VERTEX_BUFFERS> buffers;
boost::container::small_vector<Buffer*, NUM_VERTEX_BUFFERS> buffers;
boost::container::small_vector<u64, NUM_VERTEX_BUFFERS> offsets;
boost::container::small_vector<u64, NUM_VERTEX_BUFFERS> sizes;
boost::container::small_vector<u64, NUM_VERTEX_BUFFERS> strides;

View File

@@ -232,12 +232,12 @@ void BufferCacheRuntime::BindVertexBuffer(u32 index, Buffer& buffer, u32 offset,
}
}
void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings& bindings) {
for (u32 index = 0; index < bindings.buffers.size(); index++) {
BindVertexBuffer(
bindings.min_index + index, *reinterpret_cast<Buffer*>(bindings.buffers[index]),
static_cast<u32>(bindings.offsets[index]), static_cast<u32>(bindings.sizes[index]),
static_cast<u32>(bindings.strides[index]));
void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bindings) {
for (u32 index = 0; index < bindings.buffers.size(); ++index) {
BindVertexBuffer(bindings.min_index + index, *bindings.buffers[index],
static_cast<u32>(bindings.offsets[index]),
static_cast<u32>(bindings.sizes[index]),
static_cast<u32>(bindings.strides[index]));
}
}
@@ -329,10 +329,9 @@ void BufferCacheRuntime::BindTransformFeedbackBuffer(u32 index, Buffer& buffer,
static_cast<GLintptr>(offset), static_cast<GLsizeiptr>(size));
}
void BufferCacheRuntime::BindTransformFeedbackBuffers(VideoCommon::HostBindings& bindings) {
for (u32 index = 0; index < bindings.buffers.size(); index++) {
glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, index,
reinterpret_cast<Buffer*>(bindings.buffers[index])->Handle(),
void BufferCacheRuntime::BindTransformFeedbackBuffers(VideoCommon::HostBindings<Buffer>& bindings) {
for (u32 index = 0; index < bindings.buffers.size(); ++index) {
glBindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, index, bindings.buffers[index]->Handle(),
static_cast<GLintptr>(bindings.offsets[index]),
static_cast<GLsizeiptr>(bindings.sizes[index]));
}

View File

@@ -87,7 +87,8 @@ public:
void BindIndexBuffer(Buffer& buffer, u32 offset, u32 size);
void BindVertexBuffer(u32 index, Buffer& buffer, u32 offset, u32 size, u32 stride);
void BindVertexBuffers(VideoCommon::HostBindings& bindings);
void BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bindings);
void BindUniformBuffer(size_t stage, u32 binding_index, Buffer& buffer, u32 offset, u32 size);
@@ -100,7 +101,8 @@ public:
bool is_written);
void BindTransformFeedbackBuffer(u32 index, Buffer& buffer, u32 offset, u32 size);
void BindTransformFeedbackBuffers(VideoCommon::HostBindings& bindings);
void BindTransformFeedbackBuffers(VideoCommon::HostBindings<Buffer>& bindings);
void BindTextureBuffer(Buffer& buffer, u32 offset, u32 size,
VideoCore::Surface::PixelFormat format);

View File

@@ -501,11 +501,10 @@ void BufferCacheRuntime::BindVertexBuffer(u32 index, VkBuffer buffer, u32 offset
}
}
void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings& bindings) {
void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bindings) {
boost::container::small_vector<VkBuffer, 32> buffer_handles;
for (u32 index = 0; index < bindings.buffers.size(); index++) {
auto& buffer = *reinterpret_cast<Buffer*>(bindings.buffers[index]);
auto handle = buffer.Handle();
for (u32 index = 0; index < bindings.buffers.size(); ++index) {
auto handle = bindings.buffers[index]->Handle();
if (handle == VK_NULL_HANDLE) {
bindings.offsets[index] = 0;
bindings.sizes[index] = VK_WHOLE_SIZE;
@@ -521,16 +520,13 @@ void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings& bindings)
buffer_handles = buffer_handles](vk::CommandBuffer cmdbuf) {
cmdbuf.BindVertexBuffers2EXT(
bindings.min_index, bindings.max_index - bindings.min_index, buffer_handles.data(),
reinterpret_cast<const VkDeviceSize*>(bindings.offsets.data()),
reinterpret_cast<const VkDeviceSize*>(bindings.sizes.data()),
reinterpret_cast<const VkDeviceSize*>(bindings.strides.data()));
bindings.offsets.data(), bindings.sizes.data(), bindings.strides.data());
});
} else {
scheduler.Record([bindings = bindings,
buffer_handles = buffer_handles](vk::CommandBuffer cmdbuf) {
cmdbuf.BindVertexBuffers(
bindings.min_index, bindings.max_index - bindings.min_index, buffer_handles.data(),
reinterpret_cast<const VkDeviceSize*>(bindings.offsets.data()));
cmdbuf.BindVertexBuffers(bindings.min_index, bindings.max_index - bindings.min_index,
buffer_handles.data(), bindings.offsets.data());
});
}
}
@@ -556,22 +552,20 @@ void BufferCacheRuntime::BindTransformFeedbackBuffer(u32 index, VkBuffer buffer,
});
}
void BufferCacheRuntime::BindTransformFeedbackBuffers(VideoCommon::HostBindings& bindings) {
void BufferCacheRuntime::BindTransformFeedbackBuffers(VideoCommon::HostBindings<Buffer>& bindings) {
if (!device.IsExtTransformFeedbackSupported()) {
// Already logged in the rasterizer
return;
}
boost::container::small_vector<VkBuffer, 4> buffer_handles;
for (u32 index = 0; index < bindings.buffers.size(); index++) {
auto& buffer = *reinterpret_cast<Buffer*>(bindings.buffers[index]);
buffer_handles.push_back(buffer.Handle());
for (u32 index = 0; index < bindings.buffers.size(); ++index) {
buffer_handles.push_back(bindings.buffers[index]->Handle());
}
scheduler.Record(
[bindings = bindings, buffer_handles = buffer_handles](vk::CommandBuffer cmdbuf) {
cmdbuf.BindTransformFeedbackBuffersEXT(
0, static_cast<u32>(buffer_handles.size()), buffer_handles.data(),
reinterpret_cast<const VkDeviceSize*>(bindings.offsets.data()),
reinterpret_cast<const VkDeviceSize*>(bindings.sizes.data()));
cmdbuf.BindTransformFeedbackBuffersEXT(0, static_cast<u32>(buffer_handles.size()),
buffer_handles.data(), bindings.offsets.data(),
bindings.sizes.data());
});
}

View File

@@ -97,10 +97,12 @@ public:
void BindQuadIndexBuffer(PrimitiveTopology topology, u32 first, u32 count);
void BindVertexBuffer(u32 index, VkBuffer buffer, u32 offset, u32 size, u32 stride);
void BindVertexBuffers(VideoCommon::HostBindings& bindings);
void BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bindings);
void BindTransformFeedbackBuffer(u32 index, VkBuffer buffer, u32 offset, u32 size);
void BindTransformFeedbackBuffers(VideoCommon::HostBindings& bindings);
void BindTransformFeedbackBuffers(VideoCommon::HostBindings<Buffer>& bindings);
std::span<u8> BindMappedUniformBuffer([[maybe_unused]] size_t stage,
[[maybe_unused]] u32 binding_index, u32 size) {

View File

@@ -344,6 +344,7 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
const bool is_qualcomm = driver_id == VK_DRIVER_ID_QUALCOMM_PROPRIETARY;
const bool is_turnip = driver_id == VK_DRIVER_ID_MESA_TURNIP;
const bool is_s8gen2 = device_id == 0x43050a01;
const bool is_arm = driver_id == VK_DRIVER_ID_ARM_PROPRIETARY;
if ((is_mvk || is_qualcomm || is_turnip) && !is_suitable) {
LOG_WARNING(Render_Vulkan, "Unsuitable driver, continuing anyway");
@@ -391,7 +392,6 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
CollectPhysicalMemoryInfo();
CollectToolingInfo();
#ifdef ANDROID
if (is_qualcomm || is_turnip) {
LOG_WARNING(Render_Vulkan,
"Qualcomm and Turnip drivers have broken VK_EXT_custom_border_color");
@@ -411,7 +411,7 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
extensions.push_descriptor = false;
loaded_extensions.erase(VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME);
#ifdef ARCHITECTURE_arm64
#if defined(ANDROID) && defined(ARCHITECTURE_arm64)
// Patch the driver to enable BCn textures.
const auto major = (properties.properties.driverVersion >> 24) << 2;
const auto minor = (properties.properties.driverVersion >> 12) & 0xFFFU;
@@ -431,18 +431,23 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
} else {
LOG_WARNING(Render_Vulkan, "Adreno driver can't be patched to enable BCn textures");
}
#endif // ARCHITECTURE_arm64
#endif
}
const bool is_arm = driver_id == VK_DRIVER_ID_ARM_PROPRIETARY;
if (is_arm) {
must_emulate_scaled_formats = true;
LOG_WARNING(Render_Vulkan, "ARM drivers have broken VK_EXT_extended_dynamic_state");
extensions.extended_dynamic_state = false;
loaded_extensions.erase(VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME);
LOG_WARNING(Render_Vulkan, "ARM drivers have broken VK_EXT_extended_dynamic_state2");
features.extended_dynamic_state2.extendedDynamicState2 = false;
features.extended_dynamic_state2.extendedDynamicState2LogicOp = false;
features.extended_dynamic_state2.extendedDynamicState2PatchControlPoints = false;
extensions.extended_dynamic_state2 = false;
loaded_extensions.erase(VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME);
}
#endif // ANDROID
if (is_nvidia) {
const u32 nv_major_version = (properties.properties.driverVersion >> 22) & 0x3ff;