diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/input_common/input_engine.cpp | 11 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_texture_cache.h | 4 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | 3 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.cpp | 4 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_texture_cache.h | 2 | ||||
-rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 36 | ||||
-rw-r--r-- | src/video_core/texture_cache/texture_cache_base.h | 3 | ||||
-rw-r--r-- | src/video_core/vulkan_common/vulkan_device.cpp | 2 |
8 files changed, 59 insertions, 6 deletions
diff --git a/src/input_common/input_engine.cpp b/src/input_common/input_engine.cpp index 91aa96aa7..e4c5b5b3c 100644 --- a/src/input_common/input_engine.cpp +++ b/src/input_common/input_engine.cpp @@ -380,13 +380,16 @@ void InputEngine::TriggerOnMotionChange(const PadIdentifier& identifier, int mot if (!configuring || !mapping_callback.on_data) { return; } + const auto old_value = GetMotion(identifier, motion); bool is_active = false; - if (std::abs(value.accel_x) > 1.5f || std::abs(value.accel_y) > 1.5f || - std::abs(value.accel_z) > 1.5f) { + if (std::abs(value.accel_x - old_value.accel_x) > 1.5f || + std::abs(value.accel_y - old_value.accel_y) > 1.5f || + std::abs(value.accel_z - old_value.accel_z) > 1.5f) { is_active = true; } - if (std::abs(value.gyro_x) > 0.6f || std::abs(value.gyro_y) > 0.6f || - std::abs(value.gyro_z) > 0.6f) { + if (std::abs(value.gyro_x - old_value.gyro_x) > 0.6f || + std::abs(value.gyro_y - old_value.gyro_y) > 0.6f || + std::abs(value.gyro_z - old_value.gyro_z) > 0.6f) { is_active = true; } if (!is_active) { diff --git a/src/video_core/renderer_opengl/gl_texture_cache.h b/src/video_core/renderer_opengl/gl_texture_cache.h index 1190999a8..3e9b3302b 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.h +++ b/src/video_core/renderer_opengl/gl_texture_cache.h @@ -144,6 +144,10 @@ public: return state_tracker; } + void BarrierFeedbackLoop() const noexcept { + // OpenGL does not require a barrier for attachment feedback loops. + } + private: struct StagingBuffers { explicit StagingBuffers(GLenum storage_flags_, GLenum map_flags_); diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index f1bcd5cd6..506b78f08 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp @@ -481,12 +481,13 @@ void GraphicsPipeline::ConfigureImpl(bool is_indexed) { if constexpr (Spec::enabled_stages[4]) { prepare_stage(4); } + texture_cache.UpdateRenderTargets(false); + texture_cache.CheckFeedbackLoop(views); ConfigureDraw(rescaling, render_area); } void GraphicsPipeline::ConfigureDraw(const RescalingPushConstant& rescaling, const RenderAreaPushConstant& render_area) { - texture_cache.UpdateRenderTargets(false); scheduler.RequestRenderpass(texture_cache.GetFramebuffer()); if (!is_built.load(std::memory_order::relaxed)) { diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 4d0481f2a..da5af25eb 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp @@ -861,6 +861,10 @@ VkBuffer TextureCacheRuntime::GetTemporaryBuffer(size_t needed_size) { return *buffers[level]; } +void TextureCacheRuntime::BarrierFeedbackLoop() { + scheduler.RequestOutsideRenderPassOperationContext(); +} + void TextureCacheRuntime::ReinterpretImage(Image& dst, Image& src, std::span<const VideoCommon::ImageCopy> copies) { std::vector<VkBufferImageCopy> vk_in_copies(copies.size()); diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h index 4166b3d20..0f7a5ffd4 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.h +++ b/src/video_core/renderer_vulkan/vk_texture_cache.h @@ -103,6 +103,8 @@ public: [[nodiscard]] VkBuffer GetTemporaryBuffer(size_t needed_size); + void BarrierFeedbackLoop(); + const Device& device; Scheduler& scheduler; MemoryAllocator& memory_allocator; diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index b24086fce..8e62a5f78 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -184,6 +184,42 @@ void TextureCache<P>::FillComputeImageViews(std::span<ImageViewInOut> views) { } template <class P> +void TextureCache<P>::CheckFeedbackLoop(std::span<const ImageViewInOut> views) { + const bool requires_barrier = [&] { + for (const auto& view : views) { + if (!view.id) { + continue; + } + auto& image_view = slot_image_views[view.id]; + + // Check color targets + for (const auto& ct_view_id : render_targets.color_buffer_ids) { + if (ct_view_id) { + auto& ct_view = slot_image_views[ct_view_id]; + if (image_view.image_id == ct_view.image_id) { + return true; + } + } + } + + // Check zeta target + if (render_targets.depth_buffer_id) { + auto& zt_view = slot_image_views[render_targets.depth_buffer_id]; + if (image_view.image_id == zt_view.image_id) { + return true; + } + } + } + + return false; + }(); + + if (requires_barrier) { + runtime.BarrierFeedbackLoop(); + } +} + +template <class P> typename P::Sampler* TextureCache<P>::GetGraphicsSampler(u32 index) { if (index > channel_state->graphics_sampler_table.Limit()) { LOG_DEBUG(HW_GPU, "Invalid sampler index={}", index); diff --git a/src/video_core/texture_cache/texture_cache_base.h b/src/video_core/texture_cache/texture_cache_base.h index 0720494e5..1a3308e2d 100644 --- a/src/video_core/texture_cache/texture_cache_base.h +++ b/src/video_core/texture_cache/texture_cache_base.h @@ -148,6 +148,9 @@ public: /// Fill image_view_ids with the compute images in indices void FillComputeImageViews(std::span<ImageViewInOut> views); + /// Handle feedback loops during draws. + void CheckFeedbackLoop(std::span<const ImageViewInOut> views); + /// Get the sampler from the graphics descriptor table in the specified index Sampler* GetGraphicsSampler(u32 index); diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index f6e6f2736..c0b2b3e17 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp @@ -1034,7 +1034,7 @@ void Device::CollectPhysicalMemoryInfo() { } const s64 available_memory = static_cast<s64>(device_access_memory - device_initial_usage); device_access_memory = static_cast<u64>(std::max<s64>( - std::min<s64>(available_memory - 8_GiB, 4_GiB), static_cast<s64>(local_memory))); + std::min<s64>(available_memory - 8_GiB, 4_GiB), std::min<s64>(local_memory, 4_GiB))); } void Device::CollectToolingInfo() { |