Skip to content

Commit

Permalink
-Added XrSystemFoveatedRenderingPropertiesVARJO, XrSystemColorSpacePr…
Browse files Browse the repository at this point in the history
…opertiesFB and xrEnumerateColorSpacesFB
  • Loading branch information
maluoi committed Jun 25, 2021
1 parent 5db56dc commit 4af380b
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 13 deletions.
77 changes: 69 additions & 8 deletions src/openxrexplorer/openxr_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,18 @@ xr_properties_t openxr_load_properties() {

const char *properties_err = nullptr;
if (!xr_instance_err && !xr_system_err) {
result.system = { XR_TYPE_SYSTEM_PROPERTIES };
result.hand_tracking = { XR_TYPE_SYSTEM_HAND_TRACKING_PROPERTIES_EXT };
result.hand_mesh = { XR_TYPE_SYSTEM_HAND_TRACKING_MESH_PROPERTIES_MSFT };
result.gaze = { XR_TYPE_SYSTEM_EYE_GAZE_INTERACTION_PROPERTIES_EXT };

result.system .next = &result.hand_tracking;
result.hand_tracking.next = &result.hand_mesh;
result.hand_mesh .next = &result.gaze;
result.system = { XR_TYPE_SYSTEM_PROPERTIES };
result.hand_tracking = { XR_TYPE_SYSTEM_HAND_TRACKING_PROPERTIES_EXT };
result.hand_mesh = { XR_TYPE_SYSTEM_HAND_TRACKING_MESH_PROPERTIES_MSFT };
result.gaze = { XR_TYPE_SYSTEM_EYE_GAZE_INTERACTION_PROPERTIES_EXT };
result.foveated_varjo = { XR_TYPE_SYSTEM_FOVEATED_RENDERING_PROPERTIES_VARJO };
result.color_space_fb = { XR_TYPE_SYSTEM_COLOR_SPACE_PROPERTIES_FB };

result.system .next = &result.hand_tracking;
result.hand_tracking .next = &result.hand_mesh;
result.hand_mesh .next = &result.gaze;
result.gaze .next = &result.foveated_varjo;
result.foveated_varjo.next = &result.color_space_fb;

XrResult error = xrGetSystemProperties(xr_instance, xr_system_id, &result.system);
if (XR_FAILED(error)) {
Expand Down Expand Up @@ -416,6 +420,34 @@ xr_properties_t openxr_load_properties() {
table.cols[0].add({"supportsEyeGazeInteraction"}); table.cols[1].add({result.gaze.supportsEyeGazeInteraction ? "True":"False"});
xr_tables.add(table);

table = {};
table.name_func = "xrGetSystemProperties";
table.name_type = "XrSystemFoveatedRenderingPropertiesVARJO";
table.spec = "XrSystemFoveatedRenderingPropertiesVARJO";
table.error = properties_err;
table.tag = display_tag_properties;
table.show_type = true;
table.column_count = 2;
table.cols[0].add({"supportsFoveatedRendering"}); table.cols[1].add({result.foveated_varjo.supportsFoveatedRendering ? "True":"False"});
xr_tables.add(table);

table = {};
table.name_func = "xrGetSystemProperties";
table.name_type = "XrSystemColorSpacePropertiesFB";
table.spec = "XrSystemColorSpacePropertiesFB";
table.error = properties_err;
table.tag = display_tag_properties;
table.show_type = true;
table.column_count = 2;
const char *color_space_name = "N/A";
switch (result.color_space_fb.colorSpace) {
#define CASE_GET_NAME(e, val) case e: color_space_name = #e; break;
XR_LIST_ENUM_XrColorSpaceFB(CASE_GET_NAME)
#undef CASE_GET_NAME
}
table.cols[0].add({"colorSpace"}); table.cols[1].add({color_space_name});
xr_tables.add(table);

return result;
}

Expand Down Expand Up @@ -625,4 +657,33 @@ void openxr_register_enums() {
return error;
};
xr_misc_enums.add(info);

info = { "xrEnumerateColorSpacesFB" };
info.source_type_name = "XrColorSpaceFB";
info.spec_link = "XrColorSpaceFB";
info.requires_session = true;
info.tag = display_tag_view;
info.load_info = [](xr_enum_info_t *ref_info, xr_settings_t settings) {
PFN_xrEnumerateColorSpacesFB xrEnumerateColorSpacesFB;
XrResult error = xrGetInstanceProcAddr(xr_instance, "xrEnumerateColorSpacesFB", (PFN_xrVoidFunction *)(&xrEnumerateColorSpacesFB));
if (XR_FAILED(error)) return error;

uint32_t count = 0;
error = xrEnumerateColorSpacesFB(xr_session, 0, &count, nullptr);
array_t<XrColorSpaceFB> color_spaces(count, (XrColorSpaceFB)0);
xrEnumerateColorSpacesFB(xr_session, count, &count, color_spaces.data);

for (size_t i = 0; i < color_spaces.count; i++) {
for (size_t i = 0; i < count; i++) {
switch (color_spaces[i]) {
#define CASE_GET_NAME(e, val) case e: ref_info->items.add({ #e }); break;
XR_LIST_ENUM_XrColorSpaceFB(CASE_GET_NAME)
#undef CASE_GET_NAME
}
}
}
color_spaces.free();
return error;
};
xr_misc_enums.add(info);
}
12 changes: 7 additions & 5 deletions src/openxrexplorer/openxr_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,13 @@ struct xr_enum_info_t {
};

struct xr_properties_t {
XrInstanceProperties instance;
XrSystemProperties system;
XrSystemHandTrackingPropertiesEXT hand_tracking;
XrSystemHandTrackingMeshPropertiesMSFT hand_mesh;
XrSystemEyeGazeInteractionPropertiesEXT gaze;
XrInstanceProperties instance;
XrSystemProperties system;
XrSystemHandTrackingPropertiesEXT hand_tracking;
XrSystemHandTrackingMeshPropertiesMSFT hand_mesh;
XrSystemEyeGazeInteractionPropertiesEXT gaze;
XrSystemFoveatedRenderingPropertiesVARJO foveated_varjo;
XrSystemColorSpacePropertiesFB color_space_fb;
};

struct xr_view_info_t {
Expand Down

0 comments on commit 4af380b

Please sign in to comment.