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

Guard invalid device memory flushes. #2671

Merged
merged 1 commit into from
Mar 15, 2019
Merged

Conversation

AWoloszyn
Copy link
Contributor

Fixes #2617.

@@ -211,7 +211,7 @@ cmd VkResult vkFlushMappedMemoryRanges(
}
}

if !(flushRange.memory in DeviceMemories) { vkErrorInvalidDeviceMemory(flushRange.memory) }
if !(flushRange.memory in DeviceMemories) { vkErrorInvalidDeviceMemory(flushRange.memory) } else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason for not bothering indenting this block of code?

Side comment: I don't like inline if statements, however I won't push new styles if it's the standard for these .api source files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So the reason that we have been doing this is because we can't early-return in the API language.

We use this pattern so that we don't add incredible amounts of nesting.
What I REALLY want to say is

if !(flush.memory in DeviceMemories) { return; }

@AWoloszyn AWoloszyn merged commit 2f286f4 into google:master Mar 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants