-
Notifications
You must be signed in to change notification settings - Fork 474
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
Document effects of vkFreeDescriptorSets and vkResetDescriptorPool failure, if any. #2317
Comments
A return type though cannot reasonably be removed from function signature without breaking compatibility. Meanwhile the spec is not exactly incorrect. It would return Note the language already does not acknowlege any possibility of failure:
|
I'm not suggesting the return value be removed, but I think it's important to know what the state of the pool and descriptor sets may be when a value other than |
What do you mean by failed call? How would the call fail, if only permitted return value is |
The documentation for these calls specifically states that "on success, this command returns With this in mind, I offer some followup questions:
|
No function is ever allowed to return What you observe is the result of undefined behaviour, in which case anything may happen and the validation layers just so happen to exploit that liberty. You cannot assume anything about the state of the descriptor pool, let alone the remainder of your program. |
From the VkResult manual page: "Any command returning a The same page states that If either |
OK, so I'm going over the spec again and I see that section 3.7 (Valid Usage) clearly states: "The core layer assumes applications are using the API correctly. Except as documented elsewhere in the Specification, the behavior of the core layer to an application using the API incorrectly is undefined, and may include program termination." Given such wording, the inevitable conclusion is that With this in mind I propose the following changes, specifically:
|
That's just an artifact of the script which autogenerates this language. |
That's true, but a search against the manual pages for Vulkan 1.2 reveals the only calls returning something on success and nothing on failure are Since these are the only two functions in Vulkan that do this, I believe it would be appropriate to note explicitly that the return value exists for historical reasons only and that it's safe to assume the functions always return |
I think there are a handful of vendor extensions with similar lack-of-error behavior, but agreed, not many. One possibility is to recognize when a command has no error codes in the XML and generate some boilerplate about that situation, if that would help. |
#2325 is a good fix for this case. Dropping in a note to the WG to also consider vkResetCommandPool, which is listed as returning either VK_SUCCESS or OODM. Did we intend this, or should it also be logically void, i.e. not allowed to fail? |
@TomOlson Please also consider |
@TomOlson as we discussed just now, the couple of commands that explicitly have VK_ERROR_UNKNOWN errorcodes in the XML should probably also be considered in this context. I suspect it's just an oversight, these are from fairly obscure vendor extensions. |
Tracking internally as vulkan#3824: vkResetCommandPool, vkResetCommandBuffer, vkResetFences, and vkResetEvent, plus any documented uses of VK_ERROR_UNKNOWN. Informally, it sounds like we do have some implementations that detect and report memory heap exhaustion when resetting command pools, but we'll confirm. We agree that developers should not have to waste time worrying about error returns that will never happen, so we'll fix any cases we find. |
@TomOlson in addition to those commands, vkAcquireDrmDisplayEXT and vkGetDrmDisplayEXT contain spec language defining conditions under which VK_ERROR_UNKNOWN must be returned (though not XML errorcodes, oddly). This is a different form of the problem but probably should be addressed as well, ideally by having them return a meaningful error code. |
The documentation for vkFreeDescriptorSets and vkResetDescriptorPool indicates return values of
VK_SUCCESS
on success, but it makes no mention of other possible return values and, more importantly, makes no mention of the state of the pool and descriptor sets after failure. Do all descriptor sets remain valid after failure? Might some be freed and others not? Could the pool itself end up in an inconsistent state after a failed reset, with e.g. some descriptor sets becoming invalid but not being returned to the pool? As it stands the documentation provides no guidance on what programs should expect after these calls have failed.A related issue, #1070, mentions other return values which have now been removed. In the responses to that issue one contributor stated that including those other values "was probably an oversight, and if we can establish that all implementations only return successfully, we'll probably add a restriction to the allowed return value and a Note explaining the discrepancy." The return values have been removed without noting any restriction on the return value (beyond, perhaps, an implicit one by omission).
The standard needs to address this.
The text was updated successfully, but these errors were encountered: