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

Safeness bug in StorageImage2d::write #453

Merged
merged 3 commits into from
Mar 1, 2021
Merged

Conversation

Jasper-Bekkers
Copy link
Contributor

@Jasper-Bekkers Jasper-Bekkers commented Feb 26, 2021

It's pretty easy to see why this is unsafe, if multiple threads write to the same coordinate race-conditions happen (for example calling this with Coord(0, 0) in a pixel shader that covers more then one pixel would trample data).

Ultimately this should be addressed through something like #216 and some higher level abstractions on top of our buffer types, but since we don't have those for now, marking this as unsafe seems to be the only thing we can do for now.

It's pretty easy to see why this is unsafe, if multiple threads write to the same coordinate race-conditions happen.

Ultimately this should be addressed through something like #216 and some higher level abstractions on top of our buffer types, but since we don't have those for now, marking this as unsafe seems to be the only thing we can do for now.
Copy link
Contributor

@eddyb eddyb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems straight-forward enough, cc @khyperia for visibility.

EDIT: oh can't land anyway, failed CI

@eddyb eddyb enabled auto-merge (squash) February 26, 2021 19:22
@XAMPPRocky
Copy link
Member

LGTM, just need to update the test to use unsafe.

image.write(glam::UVec2::new(0, 1), texels);

Copy link
Contributor

@khyperia khyperia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once the test is fixed

@eddyb eddyb merged commit 2f4c67e into main Mar 1, 2021
@eddyb eddyb deleted the unsafe-mutable-storage-buffer branch March 1, 2021 15:20
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 this pull request may close these issues.

4 participants