mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 04:36:07 +00:00
aux: Migrate num_ to _count
This commit is contained in:
parent
469b9d907d
commit
dfa0aba496
1
doc/changes/auxiliary/mr.977.md
Normal file
1
doc/changes/auxiliary/mr.977.md
Normal file
|
@ -0,0 +1 @@
|
|||
Rename all `num_` parameters and fields, typically to `_count`, to match OpenXR convention.
|
|
@ -95,7 +95,7 @@ ahardwarebuffer_image_allocate(const struct xrt_swapchain_create_info *xsci, xrt
|
|||
static xrt_result_t
|
||||
ahardwarebuffer_images_allocate(struct xrt_image_native_allocator *xina,
|
||||
const struct xrt_swapchain_create_info *xsci,
|
||||
size_t num_images,
|
||||
size_t image_count,
|
||||
struct xrt_image_native *out_images)
|
||||
{
|
||||
AHardwareBuffer_Desc desc;
|
||||
|
@ -130,9 +130,9 @@ ahardwarebuffer_images_allocate(struct xrt_image_native_allocator *xina,
|
|||
}
|
||||
#endif
|
||||
|
||||
memset(out_images, 0, sizeof(*out_images) * num_images);
|
||||
memset(out_images, 0, sizeof(*out_images) * image_count);
|
||||
bool failed = false;
|
||||
for (size_t i = 0; i < num_images; ++i) {
|
||||
for (size_t i = 0; i < image_count; ++i) {
|
||||
int ret = AHardwareBuffer_allocate(&desc, &(out_images[i].handle));
|
||||
if (ret != 0) {
|
||||
AHB_ERROR("Failed allocating image %d.", (int)i);
|
||||
|
@ -141,7 +141,7 @@ ahardwarebuffer_images_allocate(struct xrt_image_native_allocator *xina,
|
|||
}
|
||||
}
|
||||
if (failed) {
|
||||
for (size_t i = 0; i < num_images; ++i) {
|
||||
for (size_t i = 0; i < image_count; ++i) {
|
||||
u_graphics_buffer_unref(&(out_images[i].handle));
|
||||
}
|
||||
return XRT_ERROR_ALLOCATION;
|
||||
|
@ -150,9 +150,11 @@ ahardwarebuffer_images_allocate(struct xrt_image_native_allocator *xina,
|
|||
}
|
||||
|
||||
static xrt_result_t
|
||||
ahardwarebuffer_images_free(struct xrt_image_native_allocator *xina, size_t num_images, struct xrt_image_native *images)
|
||||
ahardwarebuffer_images_free(struct xrt_image_native_allocator *xina,
|
||||
size_t image_count,
|
||||
struct xrt_image_native *images)
|
||||
{
|
||||
for (size_t i = 0; i < num_images; ++i) {
|
||||
for (size_t i = 0; i < image_count; ++i) {
|
||||
u_graphics_buffer_unref(&(images[i].handle));
|
||||
}
|
||||
return XRT_SUCCESS;
|
||||
|
|
|
@ -286,7 +286,7 @@ open_tracking_settings(struct u_config_json *json)
|
|||
bool
|
||||
u_config_json_get_tracking_overrides(struct u_config_json *json,
|
||||
struct xrt_tracking_override *out_overrides,
|
||||
size_t *out_num_overrides)
|
||||
size_t *out_override_count)
|
||||
{
|
||||
cJSON *t = open_tracking_settings(json);
|
||||
if (t == NULL) {
|
||||
|
@ -296,14 +296,14 @@ u_config_json_get_tracking_overrides(struct u_config_json *json,
|
|||
|
||||
cJSON *overrides = cJSON_GetObjectItemCaseSensitive(t, "tracking_overrides");
|
||||
|
||||
*out_num_overrides = 0;
|
||||
*out_override_count = 0;
|
||||
|
||||
cJSON *override = NULL;
|
||||
cJSON_ArrayForEach(override, overrides)
|
||||
{
|
||||
bool bad = false;
|
||||
|
||||
struct xrt_tracking_override *o = &out_overrides[(*out_num_overrides)++];
|
||||
struct xrt_tracking_override *o = &out_overrides[(*out_override_count)++];
|
||||
bad |= !get_obj_str(override, "target_device_serial", o->target_device_serial, XRT_DEVICE_NAME_LEN);
|
||||
bad |= !get_obj_str(override, "tracker_device_serial", o->tracker_device_serial, XRT_DEVICE_NAME_LEN);
|
||||
|
||||
|
@ -336,7 +336,7 @@ u_config_json_get_tracking_overrides(struct u_config_json *json,
|
|||
o->input_name = xrt_input_name_enum(input_name);
|
||||
|
||||
if (bad) {
|
||||
*out_num_overrides = 0;
|
||||
*out_override_count = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ make_pose(struct xrt_pose *pose)
|
|||
}
|
||||
|
||||
void
|
||||
u_config_json_save_overrides(struct u_config_json *json, struct xrt_tracking_override *overrides, size_t num_overrides)
|
||||
u_config_json_save_overrides(struct u_config_json *json, struct xrt_tracking_override *overrides, size_t override_count)
|
||||
{
|
||||
if (!json->file_loaded) {
|
||||
u_config_json_make_default_root(json);
|
||||
|
@ -475,7 +475,7 @@ u_config_json_save_overrides(struct u_config_json *json, struct xrt_tracking_ove
|
|||
cJSON_DeleteItemFromObject(t, "tracking_overrides");
|
||||
cJSON *o = cJSON_AddArrayToObject(t, "tracking_overrides");
|
||||
|
||||
for (size_t i = 0; i < num_overrides; i++) {
|
||||
for (size_t i = 0; i < override_count; i++) {
|
||||
cJSON *entry = cJSON_CreateObject();
|
||||
|
||||
cJSON_AddStringToObject(entry, "target_device_serial", overrides[i].target_device_serial);
|
||||
|
|
|
@ -59,7 +59,9 @@ u_config_json_save_calibration(struct u_config_json *json, struct xrt_settings_t
|
|||
* @ingroup aux_util
|
||||
*/
|
||||
void
|
||||
u_config_json_save_overrides(struct u_config_json *json, struct xrt_tracking_override *overrides, size_t num_overrides);
|
||||
u_config_json_save_overrides(struct u_config_json *json,
|
||||
struct xrt_tracking_override *overrides,
|
||||
size_t override_count);
|
||||
|
||||
/*!
|
||||
* Read from the JSON loaded json config file and returns the active config,
|
||||
|
@ -90,7 +92,7 @@ u_config_json_get_tracking_settings(struct u_config_json *json, struct xrt_setti
|
|||
bool
|
||||
u_config_json_get_tracking_overrides(struct u_config_json *json,
|
||||
struct xrt_tracking_override *out_overrides,
|
||||
size_t *out_num_overrides);
|
||||
size_t *out_override_count);
|
||||
|
||||
/*!
|
||||
* Extract remote settings from the JSON.
|
||||
|
|
|
@ -33,11 +33,11 @@ index_for(int row, int col, int stride, int offset)
|
|||
}
|
||||
|
||||
void
|
||||
run_func(struct xrt_device *xdev, func_calc calc, int num_views, struct xrt_hmd_parts *target, size_t num)
|
||||
run_func(struct xrt_device *xdev, func_calc calc, int view_count, struct xrt_hmd_parts *target, size_t num)
|
||||
{
|
||||
assert(calc != NULL);
|
||||
assert(num_views == 2);
|
||||
assert(num_views <= 2);
|
||||
assert(view_count == 2);
|
||||
assert(view_count <= 2);
|
||||
|
||||
size_t vertex_offsets[2] = {0};
|
||||
size_t index_offsets[2] = {0};
|
||||
|
@ -48,7 +48,7 @@ run_func(struct xrt_device *xdev, func_calc calc, int num_views, struct xrt_hmd_
|
|||
int vert_rows = cells_rows + 1;
|
||||
|
||||
size_t vertex_count_per_view = vert_rows * vert_cols;
|
||||
size_t vertex_count = vertex_count_per_view * num_views;
|
||||
size_t vertex_count = vertex_count_per_view * view_count;
|
||||
|
||||
size_t uv_channels_count = 3;
|
||||
size_t stride_in_floats = 2 + uv_channels_count * 2;
|
||||
|
@ -58,7 +58,7 @@ run_func(struct xrt_device *xdev, func_calc calc, int num_views, struct xrt_hmd_
|
|||
|
||||
// Setup the vertices for all views.
|
||||
size_t i = 0;
|
||||
for (int view = 0; view < num_views; view++) {
|
||||
for (int view = 0; view < view_count; view++) {
|
||||
vertex_offsets[view] = i / stride_in_floats;
|
||||
|
||||
for (int r = 0; r < vert_rows; r++) {
|
||||
|
@ -85,12 +85,12 @@ run_func(struct xrt_device *xdev, func_calc calc, int num_views, struct xrt_hmd_
|
|||
}
|
||||
|
||||
size_t index_count_per_view = cells_rows * (vert_cols * 2 + 2);
|
||||
size_t index_count_total = index_count_per_view * num_views;
|
||||
size_t index_count_total = index_count_per_view * view_count;
|
||||
int *indices = U_TYPED_ARRAY_CALLOC(int, index_count_total);
|
||||
|
||||
// Set up indices for all views.
|
||||
i = 0;
|
||||
for (int view = 0; view < num_views; view++) {
|
||||
for (int view = 0; view < view_count; view++) {
|
||||
index_offsets[view] = i;
|
||||
|
||||
size_t off = vertex_offsets[view];
|
||||
|
|
|
@ -422,35 +422,35 @@ u_hand_joints_update_curl(struct u_hand_tracking *set,
|
|||
set->joints.palm.relation.relation_flags = POSE_VALID_FLAGS | VELOCIY_VALID_FLAGS;
|
||||
|
||||
struct u_joint_space_relation *prev = &set->joints.wrist;
|
||||
for (int joint_num = 0; joint_num < set->joints.fingers[XRT_FINGER_LITTLE].num_joints; joint_num++) {
|
||||
for (int joint_num = 0; joint_num < set->joints.fingers[XRT_FINGER_LITTLE].joint_count; joint_num++) {
|
||||
struct u_joint_space_relation *joint = &set->joints.fingers[XRT_FINGER_LITTLE].joints[joint_num];
|
||||
u_hand_joint_compute_next_by_curl(set, prev, hand, at_timestamp_ns, joint, curl_little);
|
||||
prev = joint;
|
||||
}
|
||||
|
||||
prev = &set->joints.wrist;
|
||||
for (int joint_num = 0; joint_num < set->joints.fingers[XRT_FINGER_RING].num_joints; joint_num++) {
|
||||
for (int joint_num = 0; joint_num < set->joints.fingers[XRT_FINGER_RING].joint_count; joint_num++) {
|
||||
struct u_joint_space_relation *joint = &set->joints.fingers[XRT_FINGER_RING].joints[joint_num];
|
||||
u_hand_joint_compute_next_by_curl(set, prev, hand, at_timestamp_ns, joint, curl_ring);
|
||||
prev = joint;
|
||||
}
|
||||
|
||||
prev = &set->joints.wrist;
|
||||
for (int joint_num = 0; joint_num < set->joints.fingers[XRT_FINGER_MIDDLE].num_joints; joint_num++) {
|
||||
for (int joint_num = 0; joint_num < set->joints.fingers[XRT_FINGER_MIDDLE].joint_count; joint_num++) {
|
||||
struct u_joint_space_relation *joint = &set->joints.fingers[XRT_FINGER_MIDDLE].joints[joint_num];
|
||||
u_hand_joint_compute_next_by_curl(set, prev, hand, at_timestamp_ns, joint, curl_middle);
|
||||
prev = joint;
|
||||
}
|
||||
|
||||
prev = &set->joints.wrist;
|
||||
for (int joint_num = 0; joint_num < set->joints.fingers[XRT_FINGER_INDEX].num_joints; joint_num++) {
|
||||
for (int joint_num = 0; joint_num < set->joints.fingers[XRT_FINGER_INDEX].joint_count; joint_num++) {
|
||||
struct u_joint_space_relation *joint = &set->joints.fingers[XRT_FINGER_INDEX].joints[joint_num];
|
||||
u_hand_joint_compute_next_by_curl(set, prev, hand, at_timestamp_ns, joint, curl_index);
|
||||
prev = joint;
|
||||
}
|
||||
|
||||
prev = &set->joints.wrist;
|
||||
for (int joint_num = 0; joint_num < set->joints.fingers[XRT_FINGER_THUMB].num_joints; joint_num++) {
|
||||
for (int joint_num = 0; joint_num < set->joints.fingers[XRT_FINGER_THUMB].joint_count; joint_num++) {
|
||||
struct u_joint_space_relation *joint = &set->joints.fingers[XRT_FINGER_THUMB].joints[joint_num];
|
||||
u_hand_joint_compute_next_by_curl(set, prev, hand, at_timestamp_ns, joint, curl_thumb);
|
||||
prev = joint;
|
||||
|
@ -474,7 +474,7 @@ u_hand_joints_init_default_set(struct u_hand_tracking *set,
|
|||
.joints = {.palm = {.joint_id = XRT_HAND_JOINT_PALM, .relation = identity},
|
||||
.wrist = {.joint_id = XRT_HAND_JOINT_WRIST, .relation = identity},
|
||||
|
||||
.fingers = {[XRT_FINGER_LITTLE] = {.num_joints = 5,
|
||||
.fingers = {[XRT_FINGER_LITTLE] = {.joint_count = 5,
|
||||
.joints =
|
||||
{
|
||||
{
|
||||
|
@ -500,7 +500,7 @@ u_hand_joints_init_default_set(struct u_hand_tracking *set,
|
|||
},
|
||||
}},
|
||||
|
||||
[XRT_FINGER_RING] = {.num_joints = 5,
|
||||
[XRT_FINGER_RING] = {.joint_count = 5,
|
||||
.joints =
|
||||
{
|
||||
{
|
||||
|
@ -525,7 +525,7 @@ u_hand_joints_init_default_set(struct u_hand_tracking *set,
|
|||
},
|
||||
}},
|
||||
|
||||
[XRT_FINGER_MIDDLE] = {.num_joints = 5,
|
||||
[XRT_FINGER_MIDDLE] = {.joint_count = 5,
|
||||
.joints =
|
||||
{
|
||||
{
|
||||
|
@ -551,7 +551,7 @@ u_hand_joints_init_default_set(struct u_hand_tracking *set,
|
|||
},
|
||||
}},
|
||||
|
||||
[XRT_FINGER_INDEX] = {.num_joints = 5,
|
||||
[XRT_FINGER_INDEX] = {.joint_count = 5,
|
||||
.joints =
|
||||
{
|
||||
{
|
||||
|
@ -576,7 +576,7 @@ u_hand_joints_init_default_set(struct u_hand_tracking *set,
|
|||
},
|
||||
}},
|
||||
|
||||
[XRT_FINGER_THUMB] = {.num_joints = 4,
|
||||
[XRT_FINGER_THUMB] = {.joint_count = 4,
|
||||
.joints = {
|
||||
{
|
||||
.joint_id = XRT_HAND_JOINT_THUMB_METACARPAL,
|
||||
|
|
|
@ -65,7 +65,7 @@ struct u_joint_space_relation
|
|||
struct u_finger_joint_set
|
||||
{
|
||||
struct u_joint_space_relation joints[5];
|
||||
int num_joints;
|
||||
int joint_count;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
|
|
@ -1136,26 +1136,26 @@ static VkResult
|
|||
vk_find_graphics_queue(struct vk_bundle *vk, uint32_t *out_graphics_queue)
|
||||
{
|
||||
/* Find the first graphics queue */
|
||||
uint32_t num_queues = 0;
|
||||
uint32_t queue_count = 0;
|
||||
uint32_t i = 0;
|
||||
vk->vkGetPhysicalDeviceQueueFamilyProperties(vk->physical_device, &num_queues, NULL);
|
||||
vk->vkGetPhysicalDeviceQueueFamilyProperties(vk->physical_device, &queue_count, NULL);
|
||||
|
||||
VkQueueFamilyProperties *queue_family_props = U_TYPED_ARRAY_CALLOC(VkQueueFamilyProperties, num_queues);
|
||||
VkQueueFamilyProperties *queue_family_props = U_TYPED_ARRAY_CALLOC(VkQueueFamilyProperties, queue_count);
|
||||
|
||||
vk->vkGetPhysicalDeviceQueueFamilyProperties(vk->physical_device, &num_queues, queue_family_props);
|
||||
vk->vkGetPhysicalDeviceQueueFamilyProperties(vk->physical_device, &queue_count, queue_family_props);
|
||||
|
||||
if (num_queues == 0) {
|
||||
if (queue_count == 0) {
|
||||
VK_DEBUG(vk, "Failed to get queue properties");
|
||||
goto err_free;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_queues; i++) {
|
||||
for (i = 0; i < queue_count; i++) {
|
||||
if (queue_family_props[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= num_queues) {
|
||||
if (i >= queue_count) {
|
||||
VK_DEBUG(vk, "No graphics queue found");
|
||||
goto err_free;
|
||||
}
|
||||
|
@ -1175,20 +1175,20 @@ static VkResult
|
|||
vk_find_compute_only_queue(struct vk_bundle *vk, uint32_t *out_compute_queue)
|
||||
{
|
||||
/* Find the first graphics queue */
|
||||
uint32_t num_queues = 0;
|
||||
uint32_t queue_count = 0;
|
||||
uint32_t i = 0;
|
||||
vk->vkGetPhysicalDeviceQueueFamilyProperties(vk->physical_device, &num_queues, NULL);
|
||||
vk->vkGetPhysicalDeviceQueueFamilyProperties(vk->physical_device, &queue_count, NULL);
|
||||
|
||||
VkQueueFamilyProperties *queue_family_props = U_TYPED_ARRAY_CALLOC(VkQueueFamilyProperties, num_queues);
|
||||
VkQueueFamilyProperties *queue_family_props = U_TYPED_ARRAY_CALLOC(VkQueueFamilyProperties, queue_count);
|
||||
|
||||
vk->vkGetPhysicalDeviceQueueFamilyProperties(vk->physical_device, &num_queues, queue_family_props);
|
||||
vk->vkGetPhysicalDeviceQueueFamilyProperties(vk->physical_device, &queue_count, queue_family_props);
|
||||
|
||||
if (num_queues == 0) {
|
||||
if (queue_count == 0) {
|
||||
VK_DEBUG(vk, "Failed to get queue properties");
|
||||
goto err_free;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_queues; i++) {
|
||||
for (i = 0; i < queue_count; i++) {
|
||||
if (queue_family_props[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1198,7 +1198,7 @@ vk_find_compute_only_queue(struct vk_bundle *vk, uint32_t *out_compute_queue)
|
|||
}
|
||||
}
|
||||
|
||||
if (i >= num_queues) {
|
||||
if (i >= queue_count) {
|
||||
VK_DEBUG(vk, "No compute only queue found");
|
||||
goto err_free;
|
||||
}
|
||||
|
@ -1216,9 +1216,9 @@ err_free:
|
|||
}
|
||||
|
||||
static bool
|
||||
vk_check_extension(struct vk_bundle *vk, VkExtensionProperties *props, uint32_t num_props, const char *ext)
|
||||
vk_check_extension(struct vk_bundle *vk, VkExtensionProperties *props, uint32_t prop_count, const char *ext)
|
||||
{
|
||||
for (uint32_t i = 0; i < num_props; i++) {
|
||||
for (uint32_t i = 0; i < prop_count; i++) {
|
||||
if (strcmp(props[i].extensionName, ext) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
@ -1228,7 +1228,7 @@ vk_check_extension(struct vk_bundle *vk, VkExtensionProperties *props, uint32_t
|
|||
}
|
||||
|
||||
static void
|
||||
fill_in_has_extensions(struct vk_bundle *vk, const char **device_extensions, uint32_t num_device_extensions)
|
||||
fill_in_has_extensions(struct vk_bundle *vk, const char **device_extensions, uint32_t device_extension_count)
|
||||
{
|
||||
// beginning of GENERATED extension code - do not modify - used by scripts
|
||||
// Reset before filling out.
|
||||
|
@ -1236,7 +1236,7 @@ fill_in_has_extensions(struct vk_bundle *vk, const char **device_extensions, uin
|
|||
vk->has_EXT_global_priority = false;
|
||||
vk->has_EXT_robustness2 = false;
|
||||
|
||||
for (uint32_t i = 0; i < num_device_extensions; i++) {
|
||||
for (uint32_t i = 0; i < device_extension_count; i++) {
|
||||
const char *ext = device_extensions[i];
|
||||
|
||||
#if defined(VK_GOOGLE_display_timing)
|
||||
|
@ -1267,20 +1267,20 @@ static VkResult
|
|||
vk_get_device_ext_props(struct vk_bundle *vk,
|
||||
VkPhysicalDevice physical_device,
|
||||
VkExtensionProperties **out_props,
|
||||
uint32_t *out_num_props)
|
||||
uint32_t *out_prop_count)
|
||||
{
|
||||
uint32_t num_props = 0;
|
||||
VkResult res = vk->vkEnumerateDeviceExtensionProperties(physical_device, NULL, &num_props, NULL);
|
||||
uint32_t prop_count = 0;
|
||||
VkResult res = vk->vkEnumerateDeviceExtensionProperties(physical_device, NULL, &prop_count, NULL);
|
||||
vk_check_error("vkEnumerateDeviceExtensionProperties", res, false);
|
||||
|
||||
VkExtensionProperties *props = U_TYPED_ARRAY_CALLOC(VkExtensionProperties, num_props);
|
||||
VkExtensionProperties *props = U_TYPED_ARRAY_CALLOC(VkExtensionProperties, prop_count);
|
||||
|
||||
res = vk->vkEnumerateDeviceExtensionProperties(physical_device, NULL, &num_props, props);
|
||||
res = vk->vkEnumerateDeviceExtensionProperties(physical_device, NULL, &prop_count, props);
|
||||
vk_check_error_with_free("vkEnumerateDeviceExtensionProperties", res, false, props);
|
||||
|
||||
// Check above returns on failure.
|
||||
*out_props = props;
|
||||
*out_num_props = num_props;
|
||||
*out_prop_count = prop_count;
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
@ -1289,25 +1289,25 @@ static bool
|
|||
vk_build_device_extensions(struct vk_bundle *vk,
|
||||
VkPhysicalDevice physical_device,
|
||||
const char *const *required_device_extensions,
|
||||
uint32_t num_required_device_extensions,
|
||||
uint32_t required_device_extension_count,
|
||||
const char *const *optional_device_extensions,
|
||||
uint32_t num_optional_device_extensions,
|
||||
uint32_t optional_device_extension_count,
|
||||
const char ***out_device_extensions,
|
||||
uint32_t *out_num_device_extensions)
|
||||
uint32_t *out_device_extension_count)
|
||||
{
|
||||
VkExtensionProperties *props = NULL;
|
||||
uint32_t num_props = 0;
|
||||
if (vk_get_device_ext_props(vk, physical_device, &props, &num_props) != VK_SUCCESS) {
|
||||
uint32_t prop_count = 0;
|
||||
if (vk_get_device_ext_props(vk, physical_device, &props, &prop_count) != VK_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t max_exts = num_required_device_extensions + num_optional_device_extensions;
|
||||
uint32_t max_exts = required_device_extension_count + optional_device_extension_count;
|
||||
|
||||
const char **device_extensions = U_TYPED_ARRAY_CALLOC(const char *, max_exts);
|
||||
|
||||
for (uint32_t i = 0; i < num_required_device_extensions; i++) {
|
||||
for (uint32_t i = 0; i < required_device_extension_count; i++) {
|
||||
const char *ext = required_device_extensions[i];
|
||||
if (!vk_check_extension(vk, props, num_props, ext)) {
|
||||
if (!vk_check_extension(vk, props, prop_count, ext)) {
|
||||
U_LOG_E("VkPhysicalDevice does not support required extension %s", ext);
|
||||
free(props);
|
||||
return false;
|
||||
|
@ -1316,12 +1316,12 @@ vk_build_device_extensions(struct vk_bundle *vk,
|
|||
device_extensions[i] = ext;
|
||||
}
|
||||
|
||||
uint32_t num_device_extensions = num_required_device_extensions;
|
||||
for (uint32_t i = 0; i < num_optional_device_extensions; i++) {
|
||||
uint32_t device_extension_count = required_device_extension_count;
|
||||
for (uint32_t i = 0; i < optional_device_extension_count; i++) {
|
||||
const char *ext = optional_device_extensions[i];
|
||||
if (vk_check_extension(vk, props, num_props, ext)) {
|
||||
if (vk_check_extension(vk, props, prop_count, ext)) {
|
||||
U_LOG_D("Using optional device ext %s", ext);
|
||||
device_extensions[num_device_extensions++] = ext;
|
||||
device_extensions[device_extension_count++] = ext;
|
||||
} else {
|
||||
U_LOG_T("NOT using optional device ext %s", ext);
|
||||
continue;
|
||||
|
@ -1329,12 +1329,12 @@ vk_build_device_extensions(struct vk_bundle *vk,
|
|||
}
|
||||
|
||||
// Fill this out here.
|
||||
fill_in_has_extensions(vk, device_extensions, num_device_extensions);
|
||||
fill_in_has_extensions(vk, device_extensions, device_extension_count);
|
||||
|
||||
free(props);
|
||||
|
||||
*out_device_extensions = device_extensions;
|
||||
*out_num_device_extensions = num_device_extensions;
|
||||
*out_device_extension_count = device_extension_count;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1406,9 +1406,9 @@ vk_create_device(struct vk_bundle *vk,
|
|||
bool only_compute,
|
||||
VkQueueGlobalPriorityEXT global_priority,
|
||||
const char *const *required_device_extensions,
|
||||
size_t num_required_device_extensions,
|
||||
size_t required_device_extension_count,
|
||||
const char *const *optional_device_extensions,
|
||||
size_t num_optional_device_extensions,
|
||||
size_t optional_device_extension_count,
|
||||
const struct vk_device_features *optional_device_features)
|
||||
{
|
||||
VkResult ret;
|
||||
|
@ -1419,10 +1419,10 @@ vk_create_device(struct vk_bundle *vk,
|
|||
}
|
||||
|
||||
const char **device_extensions;
|
||||
uint32_t num_device_extensions;
|
||||
uint32_t device_extension_count;
|
||||
if (!vk_build_device_extensions(vk, vk->physical_device, required_device_extensions,
|
||||
num_required_device_extensions, optional_device_extensions,
|
||||
num_optional_device_extensions, &device_extensions, &num_device_extensions)) {
|
||||
required_device_extension_count, optional_device_extensions,
|
||||
optional_device_extension_count, &device_extensions, &device_extension_count)) {
|
||||
return VK_ERROR_EXTENSION_NOT_PRESENT;
|
||||
}
|
||||
|
||||
|
@ -1490,7 +1490,7 @@ vk_create_device(struct vk_bundle *vk,
|
|||
.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
|
||||
.queueCreateInfoCount = 1,
|
||||
.pQueueCreateInfos = &queue_create_info,
|
||||
.enabledExtensionCount = num_device_extensions,
|
||||
.enabledExtensionCount = device_extension_count,
|
||||
.ppEnabledExtensionNames = device_extensions,
|
||||
.pEnabledFeatures = &enabled_features,
|
||||
};
|
||||
|
|
|
@ -426,9 +426,9 @@ vk_create_device(struct vk_bundle *vk,
|
|||
bool only_compute,
|
||||
VkQueueGlobalPriorityEXT global_priorty,
|
||||
const char *const *required_device_extensions,
|
||||
size_t num_required_device_extensions,
|
||||
size_t required_device_extension_count,
|
||||
const char *const *optional_device_extensions,
|
||||
size_t num_optional_device_extension,
|
||||
size_t optional_device_extension_count,
|
||||
const struct vk_device_features *optional_device_features);
|
||||
|
||||
/*!
|
||||
|
|
|
@ -312,18 +312,18 @@ destroy_image(struct vk_bundle *vk, struct vk_image *image)
|
|||
VkResult
|
||||
vk_ic_allocate(struct vk_bundle *vk,
|
||||
const struct xrt_swapchain_create_info *xscci,
|
||||
uint32_t num_images,
|
||||
uint32_t image_count,
|
||||
struct vk_image_collection *out_vkic)
|
||||
{
|
||||
VkResult ret = VK_SUCCESS;
|
||||
|
||||
if (num_images > ARRAY_SIZE(out_vkic->images)) {
|
||||
if (image_count > ARRAY_SIZE(out_vkic->images)) {
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
|
||||
size_t i = 0;
|
||||
for (; i < num_images; i++) {
|
||||
for (; i < image_count; i++) {
|
||||
ret = create_image(vk, xscci, &out_vkic->images[i]);
|
||||
if (ret != VK_SUCCESS) {
|
||||
break;
|
||||
|
@ -331,7 +331,7 @@ vk_ic_allocate(struct vk_bundle *vk,
|
|||
}
|
||||
|
||||
// Set the fields.
|
||||
out_vkic->num_images = num_images;
|
||||
out_vkic->image_count = image_count;
|
||||
out_vkic->info = *xscci;
|
||||
|
||||
if (ret == VK_SUCCESS) {
|
||||
|
@ -357,18 +357,18 @@ VkResult
|
|||
vk_ic_from_natives(struct vk_bundle *vk,
|
||||
const struct xrt_swapchain_create_info *xscci,
|
||||
struct xrt_image_native *native_images,
|
||||
uint32_t num_images,
|
||||
uint32_t image_count,
|
||||
struct vk_image_collection *out_vkic)
|
||||
{
|
||||
VkResult ret = VK_ERROR_INITIALIZATION_FAILED;
|
||||
|
||||
if (num_images > ARRAY_SIZE(out_vkic->images)) {
|
||||
if (image_count > ARRAY_SIZE(out_vkic->images)) {
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
|
||||
size_t i = 0;
|
||||
for (; i < num_images; i++) {
|
||||
for (; i < image_count; i++) {
|
||||
// Ensure that all handles are consumed or none are.
|
||||
xrt_graphics_buffer_handle_t buf = u_graphics_buffer_ref(native_images[i].handle);
|
||||
|
||||
|
@ -381,13 +381,13 @@ vk_ic_from_natives(struct vk_bundle *vk,
|
|||
native_images[i].handle = buf;
|
||||
}
|
||||
// Set the fields.
|
||||
out_vkic->num_images = num_images;
|
||||
out_vkic->image_count = image_count;
|
||||
out_vkic->info = *xscci;
|
||||
|
||||
if (ret == VK_SUCCESS) {
|
||||
// We have consumed all handles now, close all of the copies we
|
||||
// made, all this to make sure we do all or nothing.
|
||||
for (size_t k = 0; k < num_images; k++) {
|
||||
for (size_t k = 0; k < image_count; k++) {
|
||||
u_graphics_buffer_unref(&native_images[k].handle);
|
||||
native_images[k].size = 0;
|
||||
}
|
||||
|
@ -409,10 +409,10 @@ vk_ic_from_natives(struct vk_bundle *vk,
|
|||
void
|
||||
vk_ic_destroy(struct vk_bundle *vk, struct vk_image_collection *vkic)
|
||||
{
|
||||
for (size_t i = 0; i < vkic->num_images; i++) {
|
||||
for (size_t i = 0; i < vkic->image_count; i++) {
|
||||
destroy_image(vk, &vkic->images[i]);
|
||||
}
|
||||
vkic->num_images = 0;
|
||||
vkic->image_count = 0;
|
||||
U_ZERO(&vkic->info);
|
||||
}
|
||||
|
||||
|
@ -425,7 +425,7 @@ vk_ic_get_handles(struct vk_bundle *vk,
|
|||
VkResult ret = VK_SUCCESS;
|
||||
|
||||
size_t i = 0;
|
||||
for (; i < vkic->num_images && i < max_handles; i++) {
|
||||
for (; i < vkic->image_count && i < max_handles; i++) {
|
||||
ret = get_device_memory_handle(vk, vkic->images[i].memory, &out_handles[i]);
|
||||
if (ret != VK_SUCCESS) {
|
||||
break;
|
||||
|
|
|
@ -37,7 +37,7 @@ struct vk_image_collection
|
|||
|
||||
struct vk_image images[8];
|
||||
|
||||
uint32_t num_images;
|
||||
uint32_t image_count;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
@ -47,7 +47,7 @@ struct vk_image_collection
|
|||
VkResult
|
||||
vk_ic_allocate(struct vk_bundle *vk,
|
||||
const struct xrt_swapchain_create_info *xscci,
|
||||
uint32_t num_images,
|
||||
uint32_t image_count,
|
||||
struct vk_image_collection *out_vkic);
|
||||
|
||||
/*!
|
||||
|
@ -57,7 +57,7 @@ VkResult
|
|||
vk_ic_from_natives(struct vk_bundle *vk,
|
||||
const struct xrt_swapchain_create_info *xscci,
|
||||
struct xrt_image_native *native_images,
|
||||
uint32_t num_images,
|
||||
uint32_t image_count,
|
||||
struct vk_image_collection *out_vkic);
|
||||
|
||||
/*!
|
||||
|
|
|
@ -133,7 +133,7 @@ do_post_create_vulkan_setup(struct vk_bundle *vk,
|
|||
const struct xrt_swapchain_create_info *info,
|
||||
struct comp_swapchain *sc)
|
||||
{
|
||||
uint32_t num_images = sc->vkic.num_images;
|
||||
uint32_t num_images = sc->vkic.image_count;
|
||||
VkCommandBuffer cmd_buffer;
|
||||
|
||||
VkComponentMapping components = {
|
||||
|
@ -335,7 +335,7 @@ comp_swapchain_create(struct vk_bundle *vk,
|
|||
xrt_graphics_buffer_handle_t handles[ARRAY_SIZE(sc->vkic.images)];
|
||||
|
||||
vk_ic_get_handles(vk, &sc->vkic, ARRAY_SIZE(handles), handles);
|
||||
for (uint32_t i = 0; i < sc->vkic.num_images; i++) {
|
||||
for (uint32_t i = 0; i < sc->vkic.image_count; i++) {
|
||||
sc->base.images[i].handle = handles[i];
|
||||
sc->base.images[i].size = sc->vkic.images[i].size;
|
||||
sc->base.images[i].use_dedicated_allocation = sc->vkic.images[i].use_dedicated_allocation;
|
||||
|
|
Loading…
Reference in a new issue