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

Address feedback on enum validation #2087

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 27 additions & 12 deletions chapters/fundamentals.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -877,12 +877,11 @@ Specification_, can: be `NULL`.
[[fundamentals-validusage-enums]]
==== Valid Usage for Enumerated Types

Any parameter of an enumerated type must: be a valid enumerant for that
type.
Use of an enumerant is valid if the following conditions are true:
An enumerant value is valid for a particular use if the following conditions
are true:
Copy link
Contributor

@krOoze krOoze Mar 26, 2023

Choose a reason for hiding this comment

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

maybe "all the following conditions".

Choose a reason for hiding this comment

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

We're inconsistent about whether we use "all". I agree it wouldn't hurt!


* The enumerant is defined as part of the enumerated type.
* The enumerant is not a value suffixed with etext:_MAX_ENUM^1^.
* The enumerant is not a value suffixed with etext:_MAX_ENUM.
** This value exists only to ensure that C `enum` types are 32 bits in
size and must: not be used by applications.
* If the enumerant is used in a function that has a slink:VkInstance as
Expand All @@ -897,18 +896,34 @@ endif::VK_VERSION_1_1[]
for the instance.
* If the enumerant is used in a function that has a slink:VkPhysicalDevice
object as its first parameter and either:
ifdef::VK_KHR_get_physical_device_properties2,VK_VERSION_1_1[]
** it was added by a <<extensions, device extension>> that is supported by
that physical device and
ifdef::VK_KHR_get_physical_device_properties2[]
apiext:VK_KHR_get_physical_device_properties2 was enabled for the current
instance
endif::VK_KHR_get_physical_device_properties2[]
ifdef::VK_KHR_get_physical_device_properties2+VK_VERSION_1_1[or]
ifdef::VK_VERSION_1_1[]
the value of slink:VkApplicationInfo::pname:apiVersion is greater
than or equal to Vulkan 1.1
endif::VK_VERSION_1_1[]
;
endif::VK_KHR_get_physical_device_properties2,VK_VERSION_1_1[]
** it was added by a core version that is supported by that device (as
reported by slink:VkPhysicalDeviceProperties::pname:apiVersion);
reported by slink:VkPhysicalDeviceProperties::pname:apiVersion) and the
value of slink:VkApplicationInfo::pname:apiVersion is greater than or
equal to the version that added it; or
** it was added by an <<extensions, instance extension>> that was enabled
for the instance; or
** it was added by a <<extensions, device extension>> that is supported by
that device.
* If the enumerant is used in a function that has any other dispatchable
object as its first parameter and either:
for the current instance.
* If the enumerant is used in a function that has a dispatchable object
created or allocated from a device as its first parameter and either:
Copy link
Contributor

Choose a reason for hiding this comment

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

This is incorrect. Either "dispatchable object created or allocated from a physical device" or "dispatchable object that is device or its children".

** it was added by a core version that is supported for the device (as
reported by slink:VkPhysicalDeviceProperties::pname:apiVersion); or
reported by slink:VkPhysicalDeviceProperties::pname:apiVersion)
and the value of slink:VkApplicationInfo::pname:apiVersion is greater
than or equal to the version that added it; or
** it was added by a <<extensions, device extension>> that was enabled for
the device.
the current device.

Any enumerated type returned from a query command or otherwise output from
Vulkan to the application must: not have a reserved value.
Expand Down
3 changes: 3 additions & 0 deletions chapters/initialization.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ include::{generated}/api/protos/vkEnumerateInstanceVersion.adoc[]
of Vulkan supported by instance-level functionality, encoded as
described in <<extendingvulkan-coreversions-versionnumbers>>.

If flink:vkGetInstanceProcAddr returns a code:NULL pointer when this
Copy link
Contributor

Choose a reason for hiding this comment

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

I think styleguide uses only ticks for NULL

function is queried, the implementation only supports Vulkan version 1.0.

[NOTE]
.Note
====
Expand Down