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

Check the aspect against the image. #2601

Merged
merged 1 commit into from
Feb 12, 2019
Merged

Conversation

AWoloszyn
Copy link
Contributor

We were not checking that the aspect existed before dereferencing it.

We were not checking that the aspect existed before dereferencing it.
@@ -232,6 +232,7 @@ sub void accessImageSubresourceSlice(ref!ImageObject image, VkImageSubresourceRa
case VK_IMAGE_ASPECT_STENCIL_BIT:
as!u64(1)
}
if !aspectBit in image.Aspects { vkErrorInvalidImageAspect(image.VulkanHandle, aspectBit) } else {
Copy link
Member

Choose a reason for hiding this comment

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

Is this really a syntax format pattern we are using? or are you just trying to avoid lots of whitespace changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have used this in a few places.
Since we don't have early-returns, we have been putting anything that behaves like an early-return like this (in the vulkan api files). Ideally I want

if !aspectBit in image.Aspecs { return; }

Otherwise we would have insane amounts of nesting, that does not help readability at all

@AWoloszyn AWoloszyn merged commit 6c88028 into google:master Feb 12, 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