f5 now also clears cached framebuffers/targets.

This commit is contained in:
Ben Vanik 2015-05-25 14:58:04 -07:00
parent f2685dbb1d
commit 7cabcad69e
3 changed files with 22 additions and 1 deletions

View File

@ -171,6 +171,25 @@ void CommandProcessor::CallInThread(std::function<void()> fn) {
}
}
void CommandProcessor::ClearCaches() {
texture_cache()->Clear();
for (auto& cached_framebuffer : cached_framebuffers_) {
glDeleteFramebuffers(1, &cached_framebuffer.framebuffer);
}
cached_framebuffers_.clear();
for (auto& cached_color_render_target : cached_color_render_targets_) {
glDeleteTextures(1, &cached_color_render_target.texture);
}
cached_color_render_targets_.clear();
for (auto& cached_depth_render_target : cached_depth_render_targets_) {
glDeleteTextures(1, &cached_depth_render_target.texture);
}
cached_depth_render_targets_.clear();
}
void CommandProcessor::WorkerThreadMain() {
xe::threading::set_name("GL4 Worker");

View File

@ -70,6 +70,8 @@ class CommandProcessor {
void Shutdown();
void CallInThread(std::function<void()> fn);
void ClearCaches();
void set_swap_mode(SwapMode swap_mode) { swap_mode_ = swap_mode; }
void IssueSwap();
void IssueSwap(uint32_t frontbuffer_width, uint32_t frontbuffer_height);

View File

@ -237,7 +237,7 @@ void GL4GraphicsSystem::PlayTrace(const uint8_t* trace_data, size_t trace_size,
void GL4GraphicsSystem::ClearCaches() {
command_processor_->CallInThread(
[&]() { command_processor_->texture_cache()->Clear(); });
[&]() { command_processor_->ClearCaches(); });
}
void GL4GraphicsSystem::MarkVblank() {