[dxvk] Fix race condition requestCompileShader

This commit is contained in:
Philip Rebohle 2022-08-18 02:57:45 +02:00
parent a695644fea
commit 4869b0defa
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 13 additions and 3 deletions

View File

@ -249,7 +249,7 @@ namespace dxvk {
return &pair->second;
auto layout = createPipelineLayout(shaders.cs->getBindings());
auto library = findPipelineLibrary(shaders.cs);
auto library = findPipelineLibraryLocked(shaders.cs);
auto iter = m_computePipelines.emplace(
std::piecewise_construct,
@ -291,8 +291,8 @@ namespace dxvk {
DxvkShaderPipelineLibrary* fsLibrary = nullptr;
if (shaders.tcs == nullptr && shaders.tes == nullptr && shaders.gs == nullptr) {
vsLibrary = findPipelineLibrary(shaders.vs);
fsLibrary = findPipelineLibrary(shaders.fs);
vsLibrary = findPipelineLibraryLocked(shaders.vs);
fsLibrary = findPipelineLibraryLocked(shaders.fs);
}
auto iter = m_graphicsPipelines.emplace(
@ -445,6 +445,13 @@ namespace dxvk {
DxvkShaderPipelineLibrary* DxvkPipelineManager::findPipelineLibrary(
const Rc<DxvkShader>& shader) {
std::lock_guard<dxvk::mutex> lock(m_mutex);
return findPipelineLibraryLocked(shader);
}
DxvkShaderPipelineLibrary* DxvkPipelineManager::findPipelineLibraryLocked(
const Rc<DxvkShader>& shader) {
DxvkShaderPipelineLibraryKey key;
key.shader = shader;

View File

@ -302,6 +302,9 @@ namespace dxvk {
DxvkShaderPipelineLibrary* findPipelineLibrary(
const Rc<DxvkShader>& shader);
DxvkShaderPipelineLibrary* findPipelineLibraryLocked(
const Rc<DxvkShader>& shader);
bool canPrecompileShader(
const Rc<DxvkShader>& shader) const;