Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShaderObject: VK_NULL_HANDLE used instead of correct pipeline #282

Closed
qbojj opened this issue Jul 23, 2023 · 0 comments · Fixed by #287
Closed

ShaderObject: VK_NULL_HANDLE used instead of correct pipeline #282

qbojj opened this issue Jul 23, 2023 · 0 comments · Fixed by #287
Assignees

Comments

@qbojj
Copy link
Contributor

qbojj commented Jul 23, 2023

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);

@qbojj qbojj changed the title ShaderObject: VK_NULL_HANDLE used instead of corrent pipeline ShaderObject: VK_NULL_HANDLE used instead of correct pipeline Jul 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants