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

freeDescriptorSets returns an error union #163

Open
andrewrk opened this issue Sep 30, 2024 · 2 comments
Open

freeDescriptorSets returns an error union #163

andrewrk opened this issue Sep 30, 2024 · 2 comments

Comments

@andrewrk
Copy link
Contributor

andrewrk commented Sep 30, 2024

        pub fn freeDescriptorSets(
            self: Self,
            device: Device,
            descriptor_pool: DescriptorPool,
            descriptor_set_count: u32,
            p_descriptor_sets: [*]const DescriptorSet,
        ) FreeDescriptorSetsError!void {
            const result = self.dispatch.vkFreeDescriptorSets(
                device,
                descriptor_pool,
                descriptor_set_count,
                p_descriptor_sets,
            );
            switch (result) {
                Result.success => {},
                else => return error.Unknown,
            }
        }

really? can something go wrong when freeing these?

edit: question remains, but I remembered that these are allocated out of a pool so it's uncommon to need to free them individually.

@Snektron
Copy link
Owner

I've seen drivers return VK_ERROR_UNKNOWN from random places, so all functions also return this error. I would suggest to just assert that there is no write instead of handling it. Maybe it would sense to do that at a library level? It said clean up some of these things, what do you think?

@poconn
Copy link
Contributor

poconn commented Sep 30, 2024

A future extension could add a possible error code (e.g. some of the "maintenance" extensions modify existing functions like this), and given that it returns a VkResult, Khronos might think it's a possibility. Although encountering the "unknown" case is a bit contrived as the user would need to have enabled the extension by name but be using an old version of the bindings that doesn't support that extension (i.e. they would not be able to use its functions).

EDIT: Also in this case where an error result is added later, if freeDescriptorSets() currently returned void then that would be a breaking change, even if you're not using that extension.

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