Skip to content

Comments

Check the aspect against the image.#2601

Merged
AWoloszyn merged 1 commit intogoogle:masterfrom
AWoloszyn:check_aspect
Feb 12, 2019
Merged

Check the aspect against the image.#2601
AWoloszyn merged 1 commit intogoogle:masterfrom
AWoloszyn:check_aspect

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.
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