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

Setting VkApplicationInfo::apiVersion to random values has no effect #1665

Closed
dictoon opened this issue Apr 1, 2020 · 4 comments
Closed
Assignees
Milestone

Comments

@dictoon
Copy link

dictoon commented Apr 1, 2020

The following code does not produce any error or validation error:

VkApplicationInfo app_info = {};
app_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
app_info.pApplicationName = "ApplicationName";
app_info.applicationVersion = VK_MAKE_VERSION(1, 0, 0);
app_info.pEngineName = "EngineName";
app_info.engineVersion = VK_MAKE_VERSION(1, 0, 0);
app_info.apiVersion = VK_MAKE_VERSION(42, 72, 0);  // <-- some ways in the future

VkInstanceCreateInfo create_info = {};
create_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
create_info.pApplicationInfo = &app_info;
...
if (vkCreateInstance(&create_info, nullptr, &m_instance) != VK_SUCCESS)
    throw std::runtime_error("Failed to create Vulkan instance");

Is it to be expected?

I'm using LunarG's Vulkan SDK version 1.2.131.2 on Windows 10 and an NVIDIA GeForce RTX 2080 Ti with game ready drivers 445.75 (the latest at the time of writing).

I'm currently using the VK_LAYER_LUNARG_standard_validation validation layer.

@mark-lunarg
Copy link
Contributor

@dictoon, can you point us to the valid usage statements in the specification that you'd expect to see called out? I did see this:

Vulkan 1.0 implementations were required to return VK_ERROR_INCOMPATIBLE_DRIVER if apiVersion was larger than 1.0.

But for other versions, it looks like anything might be valid.

@mark-lunarg mark-lunarg self-assigned this Apr 1, 2020
@dictoon
Copy link
Author

dictoon commented Apr 1, 2020

The spec doesn't mention anything about it. It was simply suggested by someone on the KhronosDevs Slack that "I would hope validation would have at least a sanity check there. Maybe file a validation bug?", so I did.

It would seem helpful for the validation layers to check that an app isn't passing random version values but as you pointed out, according to the spec it appears to be legal.

@mark-lunarg
Copy link
Contributor

The validation layers, by default, can and should only enforce the spec. However, it 's a good idea, and I've added this to the best-practices layer tracking issue #24, which is a great place for stuff like this. Thanks for the suggestion!

@dictoon
Copy link
Author

dictoon commented Apr 1, 2020

Thank you!

@shannon-lunarg shannon-lunarg added this to the sdk-1.2.135.0 milestone Apr 6, 2020
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

No branches or pull requests

3 participants