[Vulkan] Cache clear: shared memory, scratch buffer
This commit is contained in:
parent
d5815d9e6a
commit
7c2df55209
|
@ -979,10 +979,7 @@ void VulkanCommandProcessor::ShutdownContext() {
|
||||||
const ui::vulkan::VulkanProvider::DeviceFunctions& dfn = provider.dfn();
|
const ui::vulkan::VulkanProvider::DeviceFunctions& dfn = provider.dfn();
|
||||||
VkDevice device = provider.device();
|
VkDevice device = provider.device();
|
||||||
|
|
||||||
ui::vulkan::util::DestroyAndNullHandle(dfn.vkDestroyBuffer, device,
|
DestroyScratchBuffer();
|
||||||
scratch_buffer_);
|
|
||||||
ui::vulkan::util::DestroyAndNullHandle(dfn.vkFreeMemory, device,
|
|
||||||
scratch_buffer_memory_);
|
|
||||||
|
|
||||||
for (SwapFramebuffer& swap_framebuffer : swap_framebuffers_) {
|
for (SwapFramebuffer& swap_framebuffer : swap_framebuffers_) {
|
||||||
ui::vulkan::util::DestroyAndNullHandle(dfn.vkDestroyFramebuffer, device,
|
ui::vulkan::util::DestroyAndNullHandle(dfn.vkDestroyFramebuffer, device,
|
||||||
|
@ -3064,6 +3061,13 @@ bool VulkanCommandProcessor::EndSubmission(bool is_swap) {
|
||||||
if (cache_clear_requested_ && AwaitAllQueueOperationsCompletion()) {
|
if (cache_clear_requested_ && AwaitAllQueueOperationsCompletion()) {
|
||||||
cache_clear_requested_ = false;
|
cache_clear_requested_ = false;
|
||||||
|
|
||||||
|
DestroyScratchBuffer();
|
||||||
|
|
||||||
|
for (SwapFramebuffer& swap_framebuffer : swap_framebuffers_) {
|
||||||
|
ui::vulkan::util::DestroyAndNullHandle(dfn.vkDestroyFramebuffer, device,
|
||||||
|
swap_framebuffer.framebuffer);
|
||||||
|
}
|
||||||
|
|
||||||
assert_true(command_buffers_submitted_.empty());
|
assert_true(command_buffers_submitted_.empty());
|
||||||
for (const CommandBuffer& command_buffer : command_buffers_writable_) {
|
for (const CommandBuffer& command_buffer : command_buffers_writable_) {
|
||||||
dfn.vkDestroyCommandPool(device, command_buffer.pool, nullptr);
|
dfn.vkDestroyCommandPool(device, command_buffer.pool, nullptr);
|
||||||
|
@ -3083,10 +3087,7 @@ bool VulkanCommandProcessor::EndSubmission(bool is_swap) {
|
||||||
|
|
||||||
primitive_processor_->ClearCache();
|
primitive_processor_->ClearCache();
|
||||||
|
|
||||||
for (SwapFramebuffer& swap_framebuffer : swap_framebuffers_) {
|
shared_memory_->ClearCache();
|
||||||
ui::vulkan::util::DestroyAndNullHandle(dfn.vkDestroyFramebuffer, device,
|
|
||||||
swap_framebuffer.framebuffer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3130,6 +3131,23 @@ void VulkanCommandProcessor::SplitPendingBarrier() {
|
||||||
pending_image_memory_barrier_count;
|
pending_image_memory_barrier_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VulkanCommandProcessor::DestroyScratchBuffer() {
|
||||||
|
assert_false(scratch_buffer_used_);
|
||||||
|
|
||||||
|
const ui::vulkan::VulkanProvider& provider = GetVulkanProvider();
|
||||||
|
const ui::vulkan::VulkanProvider::DeviceFunctions& dfn = provider.dfn();
|
||||||
|
VkDevice device = provider.device();
|
||||||
|
|
||||||
|
scratch_buffer_last_usage_submission_ = 0;
|
||||||
|
scratch_buffer_last_access_mask_ = 0;
|
||||||
|
scratch_buffer_last_stage_mask_ = 0;
|
||||||
|
scratch_buffer_size_ = 0;
|
||||||
|
ui::vulkan::util::DestroyAndNullHandle(dfn.vkDestroyBuffer, device,
|
||||||
|
scratch_buffer_);
|
||||||
|
ui::vulkan::util::DestroyAndNullHandle(dfn.vkFreeMemory, device,
|
||||||
|
scratch_buffer_memory_);
|
||||||
|
}
|
||||||
|
|
||||||
void VulkanCommandProcessor::UpdateDynamicState(
|
void VulkanCommandProcessor::UpdateDynamicState(
|
||||||
const draw_util::ViewportInfo& viewport_info, bool primitive_polygonal,
|
const draw_util::ViewportInfo& viewport_info, bool primitive_polygonal,
|
||||||
reg::RB_DEPTHCONTROL normalized_depth_control) {
|
reg::RB_DEPTHCONTROL normalized_depth_control) {
|
||||||
|
|
|
@ -447,6 +447,8 @@ class VulkanCommandProcessor : public CommandProcessor {
|
||||||
|
|
||||||
void SplitPendingBarrier();
|
void SplitPendingBarrier();
|
||||||
|
|
||||||
|
void DestroyScratchBuffer();
|
||||||
|
|
||||||
void UpdateDynamicState(const draw_util::ViewportInfo& viewport_info,
|
void UpdateDynamicState(const draw_util::ViewportInfo& viewport_info,
|
||||||
bool primitive_polygonal,
|
bool primitive_polygonal,
|
||||||
reg::RB_DEPTHCONTROL normalized_depth_control);
|
reg::RB_DEPTHCONTROL normalized_depth_control);
|
||||||
|
|
Loading…
Reference in New Issue