[GPU] Remove PipelineCache::ClearCache
This commit is contained in:
parent
9aaf19a455
commit
d31ddd9b23
|
@ -3045,8 +3045,6 @@ bool D3D12CommandProcessor::EndSubmission(bool is_swap) {
|
||||||
|
|
||||||
texture_cache_->ClearCache();
|
texture_cache_->ClearCache();
|
||||||
|
|
||||||
pipeline_cache_->ClearCache();
|
|
||||||
|
|
||||||
for (auto it : root_signatures_bindful_) {
|
for (auto it : root_signatures_bindful_) {
|
||||||
it.second->Release();
|
it.second->Release();
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,9 +175,8 @@ bool PipelineCache::Initialize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PipelineCache::Shutdown() {
|
void PipelineCache::Shutdown() {
|
||||||
ClearCache(true);
|
// Shut down all threads, before destroying the pipelines since they may be
|
||||||
|
// creating them.
|
||||||
// Shut down all threads.
|
|
||||||
if (!creation_threads_.empty()) {
|
if (!creation_threads_.empty()) {
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(creation_request_lock_);
|
std::lock_guard<std::mutex> lock(creation_request_lock_);
|
||||||
|
@ -191,44 +190,11 @@ void PipelineCache::Shutdown() {
|
||||||
}
|
}
|
||||||
creation_completion_event_.reset();
|
creation_completion_event_.reset();
|
||||||
|
|
||||||
ui::d3d12::util::ReleaseAndNull(dxc_compiler_);
|
// Shut down the persistent shader / pipeline storage.
|
||||||
ui::d3d12::util::ReleaseAndNull(dxc_utils_);
|
|
||||||
ui::d3d12::util::ReleaseAndNull(dxbc_converter_);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PipelineCache::ClearCache(bool shutting_down) {
|
|
||||||
bool reinitialize_shader_storage =
|
|
||||||
!shutting_down && storage_write_thread_ != nullptr;
|
|
||||||
std::filesystem::path shader_storage_cache_root;
|
|
||||||
uint32_t shader_storage_title_id = shader_storage_title_id_;
|
|
||||||
if (reinitialize_shader_storage) {
|
|
||||||
shader_storage_cache_root = shader_storage_cache_root_;
|
|
||||||
}
|
|
||||||
ShutdownShaderStorage();
|
ShutdownShaderStorage();
|
||||||
|
|
||||||
// Remove references to the current pipeline.
|
|
||||||
current_pipeline_ = nullptr;
|
|
||||||
|
|
||||||
if (!creation_threads_.empty()) {
|
|
||||||
// Empty the pipeline creation queue and make sure there are no threads
|
|
||||||
// currently creating pipelines because pipelines are going to be deleted.
|
|
||||||
bool await_creation_completion_event = false;
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> lock(creation_request_lock_);
|
|
||||||
creation_queue_.clear();
|
|
||||||
await_creation_completion_event = creation_threads_busy_ != 0;
|
|
||||||
if (await_creation_completion_event) {
|
|
||||||
creation_completion_event_->Reset();
|
|
||||||
creation_completion_set_event_ = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (await_creation_completion_event) {
|
|
||||||
creation_request_cond_.notify_one();
|
|
||||||
xe::threading::Wait(creation_completion_event_.get(), false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Destroy all pipelines.
|
// Destroy all pipelines.
|
||||||
|
current_pipeline_ = nullptr;
|
||||||
for (auto it : pipelines_) {
|
for (auto it : pipelines_) {
|
||||||
it.second->state->Release();
|
it.second->state->Release();
|
||||||
delete it.second;
|
delete it.second;
|
||||||
|
@ -250,10 +216,10 @@ void PipelineCache::ClearCache(bool shutting_down) {
|
||||||
shaders_.clear();
|
shaders_.clear();
|
||||||
shader_storage_index_ = 0;
|
shader_storage_index_ = 0;
|
||||||
|
|
||||||
if (reinitialize_shader_storage) {
|
// Shut down shader translation.
|
||||||
InitializeShaderStorage(shader_storage_cache_root, shader_storage_title_id,
|
ui::d3d12::util::ReleaseAndNull(dxc_compiler_);
|
||||||
false);
|
ui::d3d12::util::ReleaseAndNull(dxc_utils_);
|
||||||
}
|
ui::d3d12::util::ReleaseAndNull(dxbc_converter_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PipelineCache::InitializeShaderStorage(
|
void PipelineCache::InitializeShaderStorage(
|
||||||
|
|
|
@ -55,7 +55,10 @@ class PipelineCache {
|
||||||
|
|
||||||
bool Initialize();
|
bool Initialize();
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
void ClearCache(bool shutting_down = false);
|
// No ClearCache because it's undesirable with the persistent shader storage
|
||||||
|
// (if the storage is reloaded, effectively nothing is cleared, while the call
|
||||||
|
// takes a long time, and if it's not, there will be heavy stuttering for the
|
||||||
|
// rest of the execution of the guest).
|
||||||
|
|
||||||
void InitializeShaderStorage(const std::filesystem::path& cache_root,
|
void InitializeShaderStorage(const std::filesystem::path& cache_root,
|
||||||
uint32_t title_id, bool blocking);
|
uint32_t title_id, bool blocking);
|
||||||
|
|
Loading…
Reference in New Issue