Skip to content
This repository has been archived by the owner on Jul 19, 2018. It is now read-only.

layers: GH1752 Update ImageSubrange checks #1758

Merged
merged 1 commit into from
May 19, 2017
Merged

layers: GH1752 Update ImageSubrange checks #1758

merged 1 commit into from
May 19, 2017

Conversation

krOoze
Copy link
Contributor

@krOoze krOoze commented May 10, 2017

I had to use the extended VU code + text. The unextended VU is missing in the database (though it has its own VUID in the spec).

Does not include 3D slicing tests (I don't have VK_KHR_maintenance1 anyway).
The validation check for 3D slicing is included though. There's not much room for error (it is tied to the normal non 3D code). Someone should check it (and add the tests) just the same.

namespace std {

template <typename T>
std::string to_string(T var) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not entirely happy with you defining stuff in std namespace. This is generally not acceptable, except for adding specializations for your own types.

Copy link
Contributor

Choose a reason for hiding this comment

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

It does suck that we don't have it in the NDK yet. Perhaps add a utility call that does the same, using to_string for all platforms except Android?

Copy link
Contributor Author

@krOoze krOoze May 17, 2017

Choose a reason for hiding this comment

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

It is a hack/workaround.
I want it to be unacceptable and to break the minute Android provides proper STL and this project migrates to that new NDK version.

Also, I already sneaked one of these in core_validation.cpp 😋

Are you fine with it as explained, or should I try a different approach?

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK, let's go with this as you've written it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hah, okay. Fine with me given precedent, although we'll have to decide if we want to force everyone to whatever NDK eventually supports it. Looks like r16 or later now, per android/ndk#82

HandleToUint64(image_state->image), __LINE__, VALIDATION_ERROR_00768, "IMAGE", "%s: %s.levelCount is 0. %s",
cmd_name, param_name, validation_error_map[VALIDATION_ERROR_00768]);
} else if (subresourceRange.levelCount == VK_REMAINING_MIP_LEVELS) {
// TODO: Not in the spec VUs. Probably missing -- KhronosGroup/Vulkan-Docs#416
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we waiting for this to be resolved before wanting to land this?

Copy link
Contributor Author

@krOoze krOoze May 17, 2017

Choose a reason for hiding this comment

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

Doesn't feel like it should be my decision... but IMO it is an obvious spec bug, and the resolution will not be surprising. Besides it is unspecified behavior even currently (i.e. what would the semantics of this Base>Max with Remaining even be, if allowed) and so worth a diagnostic message. Users can benefit in the meantime (it may be months, it may be days before resolution).

const int32_t tex_width = 32;
const int32_t tex_height = 32;
VkImageCreateInfo image_create_info = {};
image_create_info.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be able to use VkImageObj to get rid of most of this boilerplate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea.
I just stole this stuff from the test below...

Copy link
Contributor Author

@krOoze krOoze May 18, 2017

Choose a reason for hiding this comment

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

@chrisforbes Alright, dealt with this + made some other code quality touches to the tests.

vkCmdClearColorImage(m_commandBuffer->GetBufferHandle(), dstImage.handle(), VK_IMAGE_LAYOUT_GENERAL, &clear_color, 1,
&range);
m_errorMonitor->VerifyFound();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Meat of this test looks good 👍

- fix #1752
- handle possible overflow of `level`+`count`
- include correct err code in msges
- update and add some tests
@mark-lunarg mark-lunarg merged commit 23c5a20 into KhronosGroup:master May 19, 2017
@krOoze krOoze deleted the fix_vk_remaining branch May 19, 2017 16:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Layers show false-positive when using VK_REMAINING_MIP_LEVELS
4 participants