Browse Source

[vk] Depth State Refresh Update.

true-eds
CamilleLaVey 4 weeks ago
committed by Caio Oliveira
parent
commit
e2264170f6
No known key found for this signature in database GPG Key ID: AAAE6C7FD4186B0C
  1. 4
      src/video_core/renderer_vulkan/vk_graphics_pipeline.h
  2. 19
      src/video_core/renderer_vulkan/vk_scheduler.cpp
  3. 1
      src/video_core/renderer_vulkan/vk_scheduler.h
  4. 4
      src/video_core/renderer_vulkan/vk_state_tracker.h

4
src/video_core/renderer_vulkan/vk_graphics_pipeline.h

@ -89,6 +89,10 @@ public:
bool SupportsAlphaToOne() const noexcept {
return fragment_has_color0_output;
}
bool UsesExtendedDynamicState() const noexcept {
return key.state.extended_dynamic_state != 0;
}
GraphicsPipeline& operator=(GraphicsPipeline&&) noexcept = delete;
GraphicsPipeline(GraphicsPipeline&&) noexcept = delete;

19
src/video_core/renderer_vulkan/vk_scheduler.cpp

@ -13,6 +13,7 @@
#include "common/thread.h"
#include "video_core/renderer_vulkan/vk_command_pool.h"
#include "video_core/renderer_vulkan/vk_graphics_pipeline.h"
#include "video_core/renderer_vulkan/vk_master_semaphore.h"
#include "video_core/renderer_vulkan/vk_scheduler.h"
#include "video_core/renderer_vulkan/vk_state_tracker.h"
@ -130,9 +131,27 @@ void Scheduler::RequestOutsideRenderPassOperationContext() {
bool Scheduler::UpdateGraphicsPipeline(GraphicsPipeline* pipeline) {
if (state.graphics_pipeline == pipeline) {
if (pipeline && pipeline->UsesExtendedDynamicState() &&
state.needs_state_enable_refresh) {
state_tracker.InvalidateStateEnableFlag();
state.needs_state_enable_refresh = false;
}
return false;
}
state.graphics_pipeline = pipeline;
if (!pipeline) {
return true;
}
if (!pipeline->UsesExtendedDynamicState()) {
state.needs_state_enable_refresh = true;
} else if (state.needs_state_enable_refresh) {
state_tracker.InvalidateStateEnableFlag();
state.needs_state_enable_refresh = false;
}
return true;
}

1
src/video_core/renderer_vulkan/vk_scheduler.h

@ -214,6 +214,7 @@ private:
GraphicsPipeline* graphics_pipeline = nullptr;
bool is_rescaling = false;
bool rescaling_defined = false;
bool needs_state_enable_refresh = false;
};
void WorkerThread(std::stop_token stop_token);

4
src/video_core/renderer_vulkan/vk_state_tracker.h

@ -97,6 +97,10 @@ public:
(*flags)[Dirty::Scissors] = true;
}
void InvalidateStateEnableFlag() {
(*flags)[Dirty::StateEnable] = true;
}
bool TouchViewports() {
const bool dirty_viewports = Exchange(Dirty::Viewports, false);
const bool rescale_viewports = Exchange(VideoCommon::Dirty::RescaleViewports, false);

Loading…
Cancel
Save