diff options
| -rw-r--r-- | src/core/hle/kernel/k_thread.h | 10 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_ipc.cpp | 37 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_synchronization.cpp | 41 | ||||
| -rw-r--r-- | src/video_core/compatible_formats.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.cpp | 45 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.h | 5 | ||||
| -rw-r--r-- | src/video_core/texture_cache/types.h | 1 | ||||
| -rw-r--r-- | src/video_core/texture_cache/util.cpp | 9 | ||||
| -rw-r--r-- | src/video_core/vulkan_common/vulkan_device.h | 6 |
9 files changed, 110 insertions, 50 deletions
diff --git a/src/core/hle/kernel/k_thread.h b/src/core/hle/kernel/k_thread.h index dd662b3f8..d178c2453 100644 --- a/src/core/hle/kernel/k_thread.h +++ b/src/core/hle/kernel/k_thread.h | |||
| @@ -338,6 +338,15 @@ public: | |||
| 338 | return m_parent != nullptr; | 338 | return m_parent != nullptr; |
| 339 | } | 339 | } |
| 340 | 340 | ||
| 341 | std::span<KSynchronizationObject*> GetSynchronizationObjectBuffer() { | ||
| 342 | return m_sync_object_buffer.sync_objects; | ||
| 343 | } | ||
| 344 | |||
| 345 | std::span<Handle> GetHandleBuffer() { | ||
| 346 | return {m_sync_object_buffer.handles.data() + Svc::ArgumentHandleCountMax, | ||
| 347 | Svc::ArgumentHandleCountMax}; | ||
| 348 | } | ||
| 349 | |||
| 341 | u16 GetUserDisableCount() const; | 350 | u16 GetUserDisableCount() const; |
| 342 | void SetInterruptFlag(); | 351 | void SetInterruptFlag(); |
| 343 | void ClearInterruptFlag(); | 352 | void ClearInterruptFlag(); |
| @@ -855,6 +864,7 @@ private: | |||
| 855 | u32* m_light_ipc_data{}; | 864 | u32* m_light_ipc_data{}; |
| 856 | KProcessAddress m_tls_address{}; | 865 | KProcessAddress m_tls_address{}; |
| 857 | KLightLock m_activity_pause_lock; | 866 | KLightLock m_activity_pause_lock; |
| 867 | SyncObjectBuffer m_sync_object_buffer{}; | ||
| 858 | s64 m_schedule_count{}; | 868 | s64 m_schedule_count{}; |
| 859 | s64 m_last_scheduled_tick{}; | 869 | s64 m_last_scheduled_tick{}; |
| 860 | std::array<QueueEntry, Core::Hardware::NUM_CPU_CORES> m_per_core_priority_queue_entry{}; | 870 | std::array<QueueEntry, Core::Hardware::NUM_CPU_CORES> m_per_core_priority_queue_entry{}; |
diff --git a/src/core/hle/kernel/svc/svc_ipc.cpp b/src/core/hle/kernel/svc/svc_ipc.cpp index 60247df2e..bb94f6934 100644 --- a/src/core/hle/kernel/svc/svc_ipc.cpp +++ b/src/core/hle/kernel/svc/svc_ipc.cpp | |||
| @@ -38,22 +38,31 @@ Result SendAsyncRequestWithUserBuffer(Core::System& system, Handle* out_event_ha | |||
| 38 | 38 | ||
| 39 | Result ReplyAndReceive(Core::System& system, s32* out_index, uint64_t handles_addr, s32 num_handles, | 39 | Result ReplyAndReceive(Core::System& system, s32* out_index, uint64_t handles_addr, s32 num_handles, |
| 40 | Handle reply_target, s64 timeout_ns) { | 40 | Handle reply_target, s64 timeout_ns) { |
| 41 | // Ensure number of handles is valid. | ||
| 42 | R_UNLESS(0 <= num_handles && num_handles <= ArgumentHandleCountMax, ResultOutOfRange); | ||
| 43 | |||
| 44 | // Get the synchronization context. | ||
| 41 | auto& kernel = system.Kernel(); | 45 | auto& kernel = system.Kernel(); |
| 42 | auto& handle_table = GetCurrentProcess(kernel).GetHandleTable(); | 46 | auto& handle_table = GetCurrentProcess(kernel).GetHandleTable(); |
| 43 | 47 | auto objs = GetCurrentThread(kernel).GetSynchronizationObjectBuffer(); | |
| 44 | R_UNLESS(0 <= num_handles && num_handles <= ArgumentHandleCountMax, ResultOutOfRange); | 48 | auto handles = GetCurrentThread(kernel).GetHandleBuffer(); |
| 45 | R_UNLESS(GetCurrentMemory(kernel).IsValidVirtualAddressRange( | 49 | |
| 46 | handles_addr, static_cast<u64>(sizeof(Handle) * num_handles)), | 50 | // Copy user handles. |
| 47 | ResultInvalidPointer); | 51 | if (num_handles > 0) { |
| 48 | 52 | // Ensure we can try to get the handles. | |
| 49 | std::array<Handle, Svc::ArgumentHandleCountMax> handles; | 53 | R_UNLESS(GetCurrentMemory(kernel).IsValidVirtualAddressRange( |
| 50 | GetCurrentMemory(kernel).ReadBlock(handles_addr, handles.data(), sizeof(Handle) * num_handles); | 54 | handles_addr, static_cast<u64>(sizeof(Handle) * num_handles)), |
| 51 | 55 | ResultInvalidPointer); | |
| 52 | // Convert handle list to object table. | 56 | |
| 53 | std::array<KSynchronizationObject*, Svc::ArgumentHandleCountMax> objs; | 57 | // Get the handles. |
| 54 | R_UNLESS(handle_table.GetMultipleObjects<KSynchronizationObject>(objs.data(), handles.data(), | 58 | GetCurrentMemory(kernel).ReadBlock(handles_addr, handles.data(), |
| 55 | num_handles), | 59 | sizeof(Handle) * num_handles); |
| 56 | ResultInvalidHandle); | 60 | |
| 61 | // Convert the handles to objects. | ||
| 62 | R_UNLESS(handle_table.GetMultipleObjects<KSynchronizationObject>( | ||
| 63 | objs.data(), handles.data(), num_handles), | ||
| 64 | ResultInvalidHandle); | ||
| 65 | } | ||
| 57 | 66 | ||
| 58 | // Ensure handles are closed when we're done. | 67 | // Ensure handles are closed when we're done. |
| 59 | SCOPE_EXIT({ | 68 | SCOPE_EXIT({ |
diff --git a/src/core/hle/kernel/svc/svc_synchronization.cpp b/src/core/hle/kernel/svc/svc_synchronization.cpp index 53df5bcd8..f02d03f30 100644 --- a/src/core/hle/kernel/svc/svc_synchronization.cpp +++ b/src/core/hle/kernel/svc/svc_synchronization.cpp | |||
| @@ -47,21 +47,35 @@ Result ResetSignal(Core::System& system, Handle handle) { | |||
| 47 | R_THROW(ResultInvalidHandle); | 47 | R_THROW(ResultInvalidHandle); |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | static Result WaitSynchronization(Core::System& system, int32_t* out_index, const Handle* handles, | 50 | /// Wait for the given handles to synchronize, timeout after the specified nanoseconds |
| 51 | int32_t num_handles, int64_t timeout_ns) { | 51 | Result WaitSynchronization(Core::System& system, int32_t* out_index, u64 user_handles, |
| 52 | int32_t num_handles, int64_t timeout_ns) { | ||
| 53 | LOG_TRACE(Kernel_SVC, "called user_handles={:#x}, num_handles={}, timeout_ns={}", user_handles, | ||
| 54 | num_handles, timeout_ns); | ||
| 55 | |||
| 52 | // Ensure number of handles is valid. | 56 | // Ensure number of handles is valid. |
| 53 | R_UNLESS(0 <= num_handles && num_handles <= Svc::ArgumentHandleCountMax, ResultOutOfRange); | 57 | R_UNLESS(0 <= num_handles && num_handles <= Svc::ArgumentHandleCountMax, ResultOutOfRange); |
| 54 | 58 | ||
| 55 | // Get the synchronization context. | 59 | // Get the synchronization context. |
| 56 | auto& kernel = system.Kernel(); | 60 | auto& kernel = system.Kernel(); |
| 57 | auto& handle_table = GetCurrentProcess(kernel).GetHandleTable(); | 61 | auto& handle_table = GetCurrentProcess(kernel).GetHandleTable(); |
| 58 | std::array<KSynchronizationObject*, Svc::ArgumentHandleCountMax> objs; | 62 | auto objs = GetCurrentThread(kernel).GetSynchronizationObjectBuffer(); |
| 63 | auto handles = GetCurrentThread(kernel).GetHandleBuffer(); | ||
| 59 | 64 | ||
| 60 | // Copy user handles. | 65 | // Copy user handles. |
| 61 | if (num_handles > 0) { | 66 | if (num_handles > 0) { |
| 67 | // Ensure we can try to get the handles. | ||
| 68 | R_UNLESS(GetCurrentMemory(kernel).IsValidVirtualAddressRange( | ||
| 69 | user_handles, static_cast<u64>(sizeof(Handle) * num_handles)), | ||
| 70 | ResultInvalidPointer); | ||
| 71 | |||
| 72 | // Get the handles. | ||
| 73 | GetCurrentMemory(kernel).ReadBlock(user_handles, handles.data(), | ||
| 74 | sizeof(Handle) * num_handles); | ||
| 75 | |||
| 62 | // Convert the handles to objects. | 76 | // Convert the handles to objects. |
| 63 | R_UNLESS(handle_table.GetMultipleObjects<KSynchronizationObject>(objs.data(), handles, | 77 | R_UNLESS(handle_table.GetMultipleObjects<KSynchronizationObject>( |
| 64 | num_handles), | 78 | objs.data(), handles.data(), num_handles), |
| 65 | ResultInvalidHandle); | 79 | ResultInvalidHandle); |
| 66 | } | 80 | } |
| 67 | 81 | ||
| @@ -80,23 +94,6 @@ static Result WaitSynchronization(Core::System& system, int32_t* out_index, cons | |||
| 80 | R_RETURN(res); | 94 | R_RETURN(res); |
| 81 | } | 95 | } |
| 82 | 96 | ||
| 83 | /// Wait for the given handles to synchronize, timeout after the specified nanoseconds | ||
| 84 | Result WaitSynchronization(Core::System& system, int32_t* out_index, u64 user_handles, | ||
| 85 | int32_t num_handles, int64_t timeout_ns) { | ||
| 86 | LOG_TRACE(Kernel_SVC, "called user_handles={:#x}, num_handles={}, timeout_ns={}", user_handles, | ||
| 87 | num_handles, timeout_ns); | ||
| 88 | |||
| 89 | // Ensure number of handles is valid. | ||
| 90 | R_UNLESS(0 <= num_handles && num_handles <= Svc::ArgumentHandleCountMax, ResultOutOfRange); | ||
| 91 | std::array<Handle, Svc::ArgumentHandleCountMax> handles; | ||
| 92 | if (num_handles > 0) { | ||
| 93 | GetCurrentMemory(system.Kernel()) | ||
| 94 | .ReadBlock(user_handles, handles.data(), num_handles * sizeof(Handle)); | ||
| 95 | } | ||
| 96 | |||
| 97 | R_RETURN(WaitSynchronization(system, out_index, handles.data(), num_handles, timeout_ns)); | ||
| 98 | } | ||
| 99 | |||
| 100 | /// Resumes a thread waiting on WaitSynchronization | 97 | /// Resumes a thread waiting on WaitSynchronization |
| 101 | Result CancelSynchronization(Core::System& system, Handle handle) { | 98 | Result CancelSynchronization(Core::System& system, Handle handle) { |
| 102 | LOG_TRACE(Kernel_SVC, "called handle=0x{:X}", handle); | 99 | LOG_TRACE(Kernel_SVC, "called handle=0x{:X}", handle); |
diff --git a/src/video_core/compatible_formats.cpp b/src/video_core/compatible_formats.cpp index ab4f4d407..87d69ebc5 100644 --- a/src/video_core/compatible_formats.cpp +++ b/src/video_core/compatible_formats.cpp | |||
| @@ -272,6 +272,9 @@ constexpr Table MakeNonNativeBgrCopyTable() { | |||
| 272 | 272 | ||
| 273 | bool IsViewCompatible(PixelFormat format_a, PixelFormat format_b, bool broken_views, | 273 | bool IsViewCompatible(PixelFormat format_a, PixelFormat format_b, bool broken_views, |
| 274 | bool native_bgr) { | 274 | bool native_bgr) { |
| 275 | if (format_a == format_b) { | ||
| 276 | return true; | ||
| 277 | } | ||
| 275 | if (broken_views) { | 278 | if (broken_views) { |
| 276 | // If format views are broken, only accept formats that are identical. | 279 | // If format views are broken, only accept formats that are identical. |
| 277 | return format_a == format_b; | 280 | return format_a == format_b; |
| @@ -282,6 +285,9 @@ bool IsViewCompatible(PixelFormat format_a, PixelFormat format_b, bool broken_vi | |||
| 282 | } | 285 | } |
| 283 | 286 | ||
| 284 | bool IsCopyCompatible(PixelFormat format_a, PixelFormat format_b, bool native_bgr) { | 287 | bool IsCopyCompatible(PixelFormat format_a, PixelFormat format_b, bool native_bgr) { |
| 288 | if (format_a == format_b) { | ||
| 289 | return true; | ||
| 290 | } | ||
| 285 | static constexpr Table BGR_TABLE = MakeNativeBgrCopyTable(); | 291 | static constexpr Table BGR_TABLE = MakeNativeBgrCopyTable(); |
| 286 | static constexpr Table NO_BGR_TABLE = MakeNonNativeBgrCopyTable(); | 292 | static constexpr Table NO_BGR_TABLE = MakeNonNativeBgrCopyTable(); |
| 287 | return IsSupported(native_bgr ? BGR_TABLE : NO_BGR_TABLE, format_a, format_b); | 293 | return IsSupported(native_bgr ? BGR_TABLE : NO_BGR_TABLE, format_a, format_b); |
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 8385b5509..3aac3cfab 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp | |||
| @@ -36,8 +36,10 @@ using VideoCommon::ImageFlagBits; | |||
| 36 | using VideoCommon::ImageInfo; | 36 | using VideoCommon::ImageInfo; |
| 37 | using VideoCommon::ImageType; | 37 | using VideoCommon::ImageType; |
| 38 | using VideoCommon::SubresourceRange; | 38 | using VideoCommon::SubresourceRange; |
| 39 | using VideoCore::Surface::BytesPerBlock; | ||
| 39 | using VideoCore::Surface::IsPixelFormatASTC; | 40 | using VideoCore::Surface::IsPixelFormatASTC; |
| 40 | using VideoCore::Surface::IsPixelFormatInteger; | 41 | using VideoCore::Surface::IsPixelFormatInteger; |
| 42 | using VideoCore::Surface::SurfaceType; | ||
| 41 | 43 | ||
| 42 | namespace { | 44 | namespace { |
| 43 | constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) { | 45 | constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) { |
| @@ -130,7 +132,7 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) { | |||
| 130 | [[nodiscard]] VkImageCreateInfo MakeImageCreateInfo(const Device& device, const ImageInfo& info) { | 132 | [[nodiscard]] VkImageCreateInfo MakeImageCreateInfo(const Device& device, const ImageInfo& info) { |
| 131 | const PixelFormat format = StorageFormat(info.format); | 133 | const PixelFormat format = StorageFormat(info.format); |
| 132 | const auto format_info = MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, false, format); | 134 | const auto format_info = MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, false, format); |
| 133 | VkImageCreateFlags flags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT; | 135 | VkImageCreateFlags flags{}; |
| 134 | if (info.type == ImageType::e2D && info.resources.layers >= 6 && | 136 | if (info.type == ImageType::e2D && info.resources.layers >= 6 && |
| 135 | info.size.width == info.size.height && !device.HasBrokenCubeImageCompability()) { | 137 | info.size.width == info.size.height && !device.HasBrokenCubeImageCompability()) { |
| 136 | flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT; | 138 | flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT; |
| @@ -163,11 +165,24 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) { | |||
| 163 | } | 165 | } |
| 164 | 166 | ||
| 165 | [[nodiscard]] vk::Image MakeImage(const Device& device, const MemoryAllocator& allocator, | 167 | [[nodiscard]] vk::Image MakeImage(const Device& device, const MemoryAllocator& allocator, |
| 166 | const ImageInfo& info) { | 168 | const ImageInfo& info, std::span<const VkFormat> view_formats) { |
| 167 | if (info.type == ImageType::Buffer) { | 169 | if (info.type == ImageType::Buffer) { |
| 168 | return vk::Image{}; | 170 | return vk::Image{}; |
| 169 | } | 171 | } |
| 170 | return allocator.CreateImage(MakeImageCreateInfo(device, info)); | 172 | VkImageCreateInfo image_ci = MakeImageCreateInfo(device, info); |
| 173 | const VkImageFormatListCreateInfo image_format_list = { | ||
| 174 | .sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO, | ||
| 175 | .pNext = nullptr, | ||
| 176 | .viewFormatCount = static_cast<u32>(view_formats.size()), | ||
| 177 | .pViewFormats = view_formats.data(), | ||
| 178 | }; | ||
| 179 | if (view_formats.size() > 1) { | ||
| 180 | image_ci.flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT; | ||
| 181 | if (device.IsKhrImageFormatListSupported()) { | ||
| 182 | image_ci.pNext = &image_format_list; | ||
| 183 | } | ||
| 184 | } | ||
| 185 | return allocator.CreateImage(image_ci); | ||
| 171 | } | 186 | } |
| 172 | 187 | ||
| 173 | [[nodiscard]] VkImageAspectFlags ImageAspectMask(PixelFormat format) { | 188 | [[nodiscard]] VkImageAspectFlags ImageAspectMask(PixelFormat format) { |
| @@ -806,6 +821,23 @@ TextureCacheRuntime::TextureCacheRuntime(const Device& device_, Scheduler& sched | |||
| 806 | astc_decoder_pass.emplace(device, scheduler, descriptor_pool, staging_buffer_pool, | 821 | astc_decoder_pass.emplace(device, scheduler, descriptor_pool, staging_buffer_pool, |
| 807 | compute_pass_descriptor_queue, memory_allocator); | 822 | compute_pass_descriptor_queue, memory_allocator); |
| 808 | } | 823 | } |
| 824 | if (!device.IsKhrImageFormatListSupported()) { | ||
| 825 | return; | ||
| 826 | } | ||
| 827 | for (size_t index_a = 0; index_a < VideoCore::Surface::MaxPixelFormat; index_a++) { | ||
| 828 | const auto image_format = static_cast<PixelFormat>(index_a); | ||
| 829 | if (IsPixelFormatASTC(image_format) && !device.IsOptimalAstcSupported()) { | ||
| 830 | view_formats[index_a].push_back(VK_FORMAT_A8B8G8R8_UNORM_PACK32); | ||
| 831 | } | ||
| 832 | for (size_t index_b = 0; index_b < VideoCore::Surface::MaxPixelFormat; index_b++) { | ||
| 833 | const auto view_format = static_cast<PixelFormat>(index_b); | ||
| 834 | if (VideoCore::Surface::IsViewCompatible(image_format, view_format, false, true)) { | ||
| 835 | const auto view_info = | ||
| 836 | MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, true, view_format); | ||
| 837 | view_formats[index_a].push_back(view_info.format); | ||
| 838 | } | ||
| 839 | } | ||
| 840 | } | ||
| 809 | } | 841 | } |
| 810 | 842 | ||
| 811 | void TextureCacheRuntime::Finish() { | 843 | void TextureCacheRuntime::Finish() { |
| @@ -1265,8 +1297,8 @@ void TextureCacheRuntime::TickFrame() {} | |||
| 1265 | Image::Image(TextureCacheRuntime& runtime_, const ImageInfo& info_, GPUVAddr gpu_addr_, | 1297 | Image::Image(TextureCacheRuntime& runtime_, const ImageInfo& info_, GPUVAddr gpu_addr_, |
| 1266 | VAddr cpu_addr_) | 1298 | VAddr cpu_addr_) |
| 1267 | : VideoCommon::ImageBase(info_, gpu_addr_, cpu_addr_), scheduler{&runtime_.scheduler}, | 1299 | : VideoCommon::ImageBase(info_, gpu_addr_, cpu_addr_), scheduler{&runtime_.scheduler}, |
| 1268 | runtime{&runtime_}, | 1300 | runtime{&runtime_}, original_image(MakeImage(runtime_.device, runtime_.memory_allocator, info, |
| 1269 | original_image(MakeImage(runtime_.device, runtime_.memory_allocator, info)), | 1301 | runtime->ViewFormats(info.format))), |
| 1270 | aspect_mask(ImageAspectMask(info.format)) { | 1302 | aspect_mask(ImageAspectMask(info.format)) { |
| 1271 | if (IsPixelFormatASTC(info.format) && !runtime->device.IsOptimalAstcSupported()) { | 1303 | if (IsPixelFormatASTC(info.format) && !runtime->device.IsOptimalAstcSupported()) { |
| 1272 | if (Settings::values.async_astc.GetValue()) { | 1304 | if (Settings::values.async_astc.GetValue()) { |
| @@ -1471,7 +1503,8 @@ bool Image::ScaleUp(bool ignore) { | |||
| 1471 | auto scaled_info = info; | 1503 | auto scaled_info = info; |
| 1472 | scaled_info.size.width = scaled_width; | 1504 | scaled_info.size.width = scaled_width; |
| 1473 | scaled_info.size.height = scaled_height; | 1505 | scaled_info.size.height = scaled_height; |
| 1474 | scaled_image = MakeImage(runtime->device, runtime->memory_allocator, scaled_info); | 1506 | scaled_image = MakeImage(runtime->device, runtime->memory_allocator, scaled_info, |
| 1507 | runtime->ViewFormats(info.format)); | ||
| 1475 | ignore = false; | 1508 | ignore = false; |
| 1476 | } | 1509 | } |
| 1477 | current_image = *scaled_image; | 1510 | current_image = *scaled_image; |
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h index 220943116..6621210ea 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.h +++ b/src/video_core/renderer_vulkan/vk_texture_cache.h | |||
| @@ -103,6 +103,10 @@ public: | |||
| 103 | 103 | ||
| 104 | [[nodiscard]] VkBuffer GetTemporaryBuffer(size_t needed_size); | 104 | [[nodiscard]] VkBuffer GetTemporaryBuffer(size_t needed_size); |
| 105 | 105 | ||
| 106 | std::span<const VkFormat> ViewFormats(PixelFormat format) { | ||
| 107 | return view_formats[static_cast<std::size_t>(format)]; | ||
| 108 | } | ||
| 109 | |||
| 106 | void BarrierFeedbackLoop(); | 110 | void BarrierFeedbackLoop(); |
| 107 | 111 | ||
| 108 | const Device& device; | 112 | const Device& device; |
| @@ -113,6 +117,7 @@ public: | |||
| 113 | RenderPassCache& render_pass_cache; | 117 | RenderPassCache& render_pass_cache; |
| 114 | std::optional<ASTCDecoderPass> astc_decoder_pass; | 118 | std::optional<ASTCDecoderPass> astc_decoder_pass; |
| 115 | const Settings::ResolutionScalingInfo& resolution; | 119 | const Settings::ResolutionScalingInfo& resolution; |
| 120 | std::array<std::vector<VkFormat>, VideoCore::Surface::MaxPixelFormat> view_formats; | ||
| 116 | 121 | ||
| 117 | static constexpr size_t indexing_slots = 8 * sizeof(size_t); | 122 | static constexpr size_t indexing_slots = 8 * sizeof(size_t); |
| 118 | std::array<vk::Buffer, indexing_slots> buffers{}; | 123 | std::array<vk::Buffer, indexing_slots> buffers{}; |
diff --git a/src/video_core/texture_cache/types.h b/src/video_core/texture_cache/types.h index a0e10643f..0453456b4 100644 --- a/src/video_core/texture_cache/types.h +++ b/src/video_core/texture_cache/types.h | |||
| @@ -54,7 +54,6 @@ enum class RelaxedOptions : u32 { | |||
| 54 | Format = 1 << 1, | 54 | Format = 1 << 1, |
| 55 | Samples = 1 << 2, | 55 | Samples = 1 << 2, |
| 56 | ForceBrokenViews = 1 << 3, | 56 | ForceBrokenViews = 1 << 3, |
| 57 | FormatBpp = 1 << 4, | ||
| 58 | }; | 57 | }; |
| 59 | DECLARE_ENUM_FLAG_OPERATORS(RelaxedOptions) | 58 | DECLARE_ENUM_FLAG_OPERATORS(RelaxedOptions) |
| 60 | 59 | ||
diff --git a/src/video_core/texture_cache/util.cpp b/src/video_core/texture_cache/util.cpp index 9a618a57a..0de6ed09d 100644 --- a/src/video_core/texture_cache/util.cpp +++ b/src/video_core/texture_cache/util.cpp | |||
| @@ -1201,8 +1201,7 @@ std::optional<SubresourceBase> FindSubresource(const ImageInfo& candidate, const | |||
| 1201 | // Format checking is relaxed, but we still have to check for matching bytes per block. | 1201 | // Format checking is relaxed, but we still have to check for matching bytes per block. |
| 1202 | // This avoids creating a view for blits on UE4 titles where formats with different bytes | 1202 | // This avoids creating a view for blits on UE4 titles where formats with different bytes |
| 1203 | // per block are aliased. | 1203 | // per block are aliased. |
| 1204 | if (BytesPerBlock(existing.format) != BytesPerBlock(candidate.format) && | 1204 | if (BytesPerBlock(existing.format) != BytesPerBlock(candidate.format)) { |
| 1205 | False(options & RelaxedOptions::FormatBpp)) { | ||
| 1206 | return std::nullopt; | 1205 | return std::nullopt; |
| 1207 | } | 1206 | } |
| 1208 | } else { | 1207 | } else { |
| @@ -1233,11 +1232,7 @@ std::optional<SubresourceBase> FindSubresource(const ImageInfo& candidate, const | |||
| 1233 | } | 1232 | } |
| 1234 | const bool strict_size = False(options & RelaxedOptions::Size); | 1233 | const bool strict_size = False(options & RelaxedOptions::Size); |
| 1235 | if (!IsBlockLinearSizeCompatible(existing, candidate, base->level, 0, strict_size)) { | 1234 | if (!IsBlockLinearSizeCompatible(existing, candidate, base->level, 0, strict_size)) { |
| 1236 | if (False(options & RelaxedOptions::FormatBpp)) { | 1235 | return std::nullopt; |
| 1237 | return std::nullopt; | ||
| 1238 | } else if (!IsBlockLinearSizeCompatibleBPPRelaxed(existing, candidate, base->level, 0)) { | ||
| 1239 | return std::nullopt; | ||
| 1240 | } | ||
| 1241 | } | 1236 | } |
| 1242 | // TODO: compare block sizes | 1237 | // TODO: compare block sizes |
| 1243 | return base; | 1238 | return base; |
diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index 1f17265d5..3ace1fb03 100644 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h | |||
| @@ -77,6 +77,7 @@ VK_DEFINE_HANDLE(VmaAllocator) | |||
| 77 | EXTENSION(KHR, SPIRV_1_4, spirv_1_4) \ | 77 | EXTENSION(KHR, SPIRV_1_4, spirv_1_4) \ |
| 78 | EXTENSION(KHR, SWAPCHAIN, swapchain) \ | 78 | EXTENSION(KHR, SWAPCHAIN, swapchain) \ |
| 79 | EXTENSION(KHR, SWAPCHAIN_MUTABLE_FORMAT, swapchain_mutable_format) \ | 79 | EXTENSION(KHR, SWAPCHAIN_MUTABLE_FORMAT, swapchain_mutable_format) \ |
| 80 | EXTENSION(KHR, IMAGE_FORMAT_LIST, image_format_list) \ | ||
| 80 | EXTENSION(NV, DEVICE_DIAGNOSTICS_CONFIG, device_diagnostics_config) \ | 81 | EXTENSION(NV, DEVICE_DIAGNOSTICS_CONFIG, device_diagnostics_config) \ |
| 81 | EXTENSION(NV, GEOMETRY_SHADER_PASSTHROUGH, geometry_shader_passthrough) \ | 82 | EXTENSION(NV, GEOMETRY_SHADER_PASSTHROUGH, geometry_shader_passthrough) \ |
| 82 | EXTENSION(NV, VIEWPORT_ARRAY2, viewport_array2) \ | 83 | EXTENSION(NV, VIEWPORT_ARRAY2, viewport_array2) \ |
| @@ -408,6 +409,11 @@ public: | |||
| 408 | return extensions.workgroup_memory_explicit_layout; | 409 | return extensions.workgroup_memory_explicit_layout; |
| 409 | } | 410 | } |
| 410 | 411 | ||
| 412 | /// Returns true if the device supports VK_KHR_image_format_list. | ||
| 413 | bool IsKhrImageFormatListSupported() const { | ||
| 414 | return extensions.image_format_list || instance_version >= VK_API_VERSION_1_2; | ||
| 415 | } | ||
| 416 | |||
| 411 | /// Returns true if the device supports VK_EXT_primitive_topology_list_restart. | 417 | /// Returns true if the device supports VK_EXT_primitive_topology_list_restart. |
| 412 | bool IsTopologyListPrimitiveRestartSupported() const { | 418 | bool IsTopologyListPrimitiveRestartSupported() const { |
| 413 | return features.primitive_topology_list_restart.primitiveTopologyListRestart; | 419 | return features.primitive_topology_list_restart.primitiveTopologyListRestart; |