KhronosGroup/Vulkan-ExtensionLayer

ShaderObject: `VK_NULL_HANDLE` used instead of correct pipeline

qbojj opened this issue · 0 comments

qbojj commented

There's still a problem with thread safety.
If a pipeline was created in another thread during locking of data for writing, that pipeline should be bound, but in current implementation VK_NULL_HANDLE is bound.

if (pipeline == VK_NULL_HANDLE) {
std::unique_lock<std::shared_mutex> lock;
auto& pipelines = vertex_or_mesh_shader->pipelines.GetDataForWriting(lock);
// Ensure that a pipeline for this state wasn't created in another thread between the read lock above and the write lock
if (pipelines.NumEntries() == pipeline_count || pipelines.Find(state_data_key) == pipelines.end()) {
pipeline = CreateGraphicsPipelineForCommandBufferState(data);
pipelines.Add(state_data_key, pipeline);
}
}
data.device_data->vtable.CmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline);