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

vkCreateInstance should return an error if a layer can't be loaded #18

Closed
davidlunarg opened this issue May 17, 2018 · 1 comment · Fixed by #411
Closed

vkCreateInstance should return an error if a layer can't be loaded #18

davidlunarg opened this issue May 17, 2018 · 1 comment · Fixed by #411
Assignees
Milestone

Comments

@davidlunarg
Copy link
Contributor

If the json file for the trace layer is missing or otherwise can't be found, vkCreateInstance returns VK_ERROR_LAYER_NOT_PRESENT.

If the shared library for the trace layer is missing otherwise can't be found, vkCreateInstance returns VK_SUCCESS. It seems it should return VK_ERROR_LAYER_NOT_PRESENT.

Quoting from the vkCreateInstance manual page:

vkCreateInstance verifies that the requested layers exist. If not, vkCreateInstance will return VK_ERROR_LAYER_NOT_PRESENT.

This issue needs to be resolved so that LunarG/VulkanTools#501 can work correctly.

@lenny-lunarg lenny-lunarg self-assigned this May 17, 2018
@charles-lunarg
Copy link
Collaborator

charles-lunarg commented Jun 1, 2020

This is because when the loader does the validation of the layers, it doesn't open the layer library, it only validates that the json is correct, and that ppEnableLayerNames is in the list of layers available on the system.

The actual loading of the layer library is only done when setting up the dispatch chain, and as I found, it simply skips over the layer if it fails to load the library, but doesn't report an error.

loader.c, line 5883

lib_handle = loaderOpenLayerFile(inst, "instance", layer_prop);
            if (!lib_handle) {
                continue;
            }

While it might make sense to return VK_ERROR_LAYER_NOT_PRESENT where the continue is now, it would be less intrusive if in the layer validation there was a check to see if the layer library exists (which doesn't require loading it, as that may be a potentially expensive operation).

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

Successfully merging a pull request may close this issue.

4 participants