diff options
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/query_cache.h | 10 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/renderer_vulkan.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/shader/memory_util.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/shader_cache.h | 10 |
5 files changed, 16 insertions, 14 deletions
diff --git a/src/video_core/query_cache.h b/src/video_core/query_cache.h index 2f75f8801..e12dab899 100644 --- a/src/video_core/query_cache.h +++ b/src/video_core/query_cache.h | |||
| @@ -220,8 +220,8 @@ private: | |||
| 220 | return cache_begin < addr_end && addr_begin < cache_end; | 220 | return cache_begin < addr_end && addr_begin < cache_end; |
| 221 | }; | 221 | }; |
| 222 | 222 | ||
| 223 | const u64 page_end = addr_end >> PAGE_SHIFT; | 223 | const u64 page_end = addr_end >> PAGE_BITS; |
| 224 | for (u64 page = addr_begin >> PAGE_SHIFT; page <= page_end; ++page) { | 224 | for (u64 page = addr_begin >> PAGE_BITS; page <= page_end; ++page) { |
| 225 | const auto& it = cached_queries.find(page); | 225 | const auto& it = cached_queries.find(page); |
| 226 | if (it == std::end(cached_queries)) { | 226 | if (it == std::end(cached_queries)) { |
| 227 | continue; | 227 | continue; |
| @@ -242,14 +242,14 @@ private: | |||
| 242 | /// Registers the passed parameters as cached and returns a pointer to the stored cached query. | 242 | /// Registers the passed parameters as cached and returns a pointer to the stored cached query. |
| 243 | CachedQuery* Register(VideoCore::QueryType type, VAddr cpu_addr, u8* host_ptr, bool timestamp) { | 243 | CachedQuery* Register(VideoCore::QueryType type, VAddr cpu_addr, u8* host_ptr, bool timestamp) { |
| 244 | rasterizer.UpdatePagesCachedCount(cpu_addr, CachedQuery::SizeInBytes(timestamp), 1); | 244 | rasterizer.UpdatePagesCachedCount(cpu_addr, CachedQuery::SizeInBytes(timestamp), 1); |
| 245 | const u64 page = static_cast<u64>(cpu_addr) >> PAGE_SHIFT; | 245 | const u64 page = static_cast<u64>(cpu_addr) >> PAGE_BITS; |
| 246 | return &cached_queries[page].emplace_back(static_cast<QueryCache&>(*this), type, cpu_addr, | 246 | return &cached_queries[page].emplace_back(static_cast<QueryCache&>(*this), type, cpu_addr, |
| 247 | host_ptr); | 247 | host_ptr); |
| 248 | } | 248 | } |
| 249 | 249 | ||
| 250 | /// Tries to a get a cached query. Returns nullptr on failure. | 250 | /// Tries to a get a cached query. Returns nullptr on failure. |
| 251 | CachedQuery* TryGet(VAddr addr) { | 251 | CachedQuery* TryGet(VAddr addr) { |
| 252 | const u64 page = static_cast<u64>(addr) >> PAGE_SHIFT; | 252 | const u64 page = static_cast<u64>(addr) >> PAGE_BITS; |
| 253 | const auto it = cached_queries.find(page); | 253 | const auto it = cached_queries.find(page); |
| 254 | if (it == std::end(cached_queries)) { | 254 | if (it == std::end(cached_queries)) { |
| 255 | return nullptr; | 255 | return nullptr; |
| @@ -268,7 +268,7 @@ private: | |||
| 268 | } | 268 | } |
| 269 | 269 | ||
| 270 | static constexpr std::uintptr_t PAGE_SIZE = 4096; | 270 | static constexpr std::uintptr_t PAGE_SIZE = 4096; |
| 271 | static constexpr unsigned PAGE_SHIFT = 12; | 271 | static constexpr unsigned PAGE_BITS = 12; |
| 272 | 272 | ||
| 273 | Core::System& system; | 273 | Core::System& system; |
| 274 | VideoCore::RasterizerInterface& rasterizer; | 274 | VideoCore::RasterizerInterface& rasterizer; |
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp index 59b441943..cd9673d1f 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp +++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <fmt/format.h> | 13 | #include <fmt/format.h> |
| 14 | 14 | ||
| 15 | #include "common/dynamic_library.h" | 15 | #include "common/dynamic_library.h" |
| 16 | #include "common/file_util.h" | ||
| 16 | #include "common/logging/log.h" | 17 | #include "common/logging/log.h" |
| 17 | #include "common/telemetry.h" | 18 | #include "common/telemetry.h" |
| 18 | #include "core/core.h" | 19 | #include "core/core.h" |
| @@ -76,7 +77,8 @@ Common::DynamicLibrary OpenVulkanLibrary() { | |||
| 76 | char* libvulkan_env = getenv("LIBVULKAN_PATH"); | 77 | char* libvulkan_env = getenv("LIBVULKAN_PATH"); |
| 77 | if (!libvulkan_env || !library.Open(libvulkan_env)) { | 78 | if (!libvulkan_env || !library.Open(libvulkan_env)) { |
| 78 | // Use the libvulkan.dylib from the application bundle. | 79 | // Use the libvulkan.dylib from the application bundle. |
| 79 | std::string filename = File::GetBundleDirectory() + "/Contents/Frameworks/libvulkan.dylib"; | 80 | const std::string filename = |
| 81 | FileUtil::GetBundleDirectory() + "/Contents/Frameworks/libvulkan.dylib"; | ||
| 80 | library.Open(filename.c_str()); | 82 | library.Open(filename.c_str()); |
| 81 | } | 83 | } |
| 82 | #else | 84 | #else |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 184b2238a..a77fa35c3 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
| @@ -870,7 +870,7 @@ void RasterizerVulkan::BeginTransformFeedback() { | |||
| 870 | UNIMPLEMENTED_IF(binding.buffer_offset != 0); | 870 | UNIMPLEMENTED_IF(binding.buffer_offset != 0); |
| 871 | 871 | ||
| 872 | const GPUVAddr gpu_addr = binding.Address(); | 872 | const GPUVAddr gpu_addr = binding.Address(); |
| 873 | const std::size_t size = binding.buffer_size; | 873 | const auto size = static_cast<VkDeviceSize>(binding.buffer_size); |
| 874 | const auto [buffer, offset] = buffer_cache.UploadMemory(gpu_addr, size, 4, true); | 874 | const auto [buffer, offset] = buffer_cache.UploadMemory(gpu_addr, size, 4, true); |
| 875 | 875 | ||
| 876 | scheduler.Record([buffer = buffer, offset = offset, size](vk::CommandBuffer cmdbuf) { | 876 | scheduler.Record([buffer = buffer, offset = offset, size](vk::CommandBuffer cmdbuf) { |
diff --git a/src/video_core/shader/memory_util.cpp b/src/video_core/shader/memory_util.cpp index 074f21691..5071c83ca 100644 --- a/src/video_core/shader/memory_util.cpp +++ b/src/video_core/shader/memory_util.cpp | |||
| @@ -66,12 +66,12 @@ ProgramCode GetShaderCode(Tegra::MemoryManager& memory_manager, GPUVAddr gpu_add | |||
| 66 | 66 | ||
| 67 | u64 GetUniqueIdentifier(Tegra::Engines::ShaderType shader_type, bool is_a, const ProgramCode& code, | 67 | u64 GetUniqueIdentifier(Tegra::Engines::ShaderType shader_type, bool is_a, const ProgramCode& code, |
| 68 | const ProgramCode& code_b) { | 68 | const ProgramCode& code_b) { |
| 69 | u64 unique_identifier = boost::hash_value(code); | 69 | size_t unique_identifier = boost::hash_value(code); |
| 70 | if (is_a) { | 70 | if (is_a) { |
| 71 | // VertexA programs include two programs | 71 | // VertexA programs include two programs |
| 72 | boost::hash_combine(unique_identifier, boost::hash_value(code_b)); | 72 | boost::hash_combine(unique_identifier, boost::hash_value(code_b)); |
| 73 | } | 73 | } |
| 74 | return unique_identifier; | 74 | return static_cast<u64>(unique_identifier); |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | } // namespace VideoCommon::Shader | 77 | } // namespace VideoCommon::Shader |
diff --git a/src/video_core/shader_cache.h b/src/video_core/shader_cache.h index a23c23886..2dd270e99 100644 --- a/src/video_core/shader_cache.h +++ b/src/video_core/shader_cache.h | |||
| @@ -19,7 +19,7 @@ namespace VideoCommon { | |||
| 19 | 19 | ||
| 20 | template <class T> | 20 | template <class T> |
| 21 | class ShaderCache { | 21 | class ShaderCache { |
| 22 | static constexpr u64 PAGE_SHIFT = 14; | 22 | static constexpr u64 PAGE_BITS = 14; |
| 23 | 23 | ||
| 24 | struct Entry { | 24 | struct Entry { |
| 25 | VAddr addr_start; | 25 | VAddr addr_start; |
| @@ -87,8 +87,8 @@ protected: | |||
| 87 | const VAddr addr_end = addr + size; | 87 | const VAddr addr_end = addr + size; |
| 88 | Entry* const entry = NewEntry(addr, addr_end, data.get()); | 88 | Entry* const entry = NewEntry(addr, addr_end, data.get()); |
| 89 | 89 | ||
| 90 | const u64 page_end = addr_end >> PAGE_SHIFT; | 90 | const u64 page_end = addr_end >> PAGE_BITS; |
| 91 | for (u64 page = addr >> PAGE_SHIFT; page <= page_end; ++page) { | 91 | for (u64 page = addr >> PAGE_BITS; page <= page_end; ++page) { |
| 92 | invalidation_cache[page].push_back(entry); | 92 | invalidation_cache[page].push_back(entry); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| @@ -108,8 +108,8 @@ private: | |||
| 108 | /// @pre invalidation_mutex is locked | 108 | /// @pre invalidation_mutex is locked |
| 109 | void InvalidatePagesInRegion(VAddr addr, std::size_t size) { | 109 | void InvalidatePagesInRegion(VAddr addr, std::size_t size) { |
| 110 | const VAddr addr_end = addr + size; | 110 | const VAddr addr_end = addr + size; |
| 111 | const u64 page_end = addr_end >> PAGE_SHIFT; | 111 | const u64 page_end = addr_end >> PAGE_BITS; |
| 112 | for (u64 page = addr >> PAGE_SHIFT; page <= page_end; ++page) { | 112 | for (u64 page = addr >> PAGE_BITS; page <= page_end; ++page) { |
| 113 | const auto it = invalidation_cache.find(page); | 113 | const auto it = invalidation_cache.find(page); |
| 114 | if (it == invalidation_cache.end()) { | 114 | if (it == invalidation_cache.end()) { |
| 115 | continue; | 115 | continue; |