@@ -88,39 +88,32 @@ XrResult ApiLayerInterface::GetApiLayerProperties(const std::string& openxr_comm
8888 }
8989
9090 manifest_count = static_cast <uint32_t >(manifest_files.size ());
91+ if (nullptr == outgoing_count) {
92+ LoaderLogger::LogErrorMessage (" xrEnumerateInstanceExtensionProperties" ,
93+ " VUID-xrEnumerateApiLayerProperties-propertyCountOutput-parameter: null propertyCountOutput" );
94+ return XR_ERROR_VALIDATION_FAILURE;
95+ }
96+
97+ *outgoing_count = manifest_count;
9198 if (0 == incoming_count) {
92- if (nullptr == outgoing_count) {
93- return XR_ERROR_VALIDATION_FAILURE;
94- }
95- *outgoing_count = manifest_count;
96- } else if (nullptr != api_layer_properties) {
97- if (incoming_count < manifest_count && nullptr != api_layer_properties) {
98- LoaderLogger::LogErrorMessage (
99- " xrEnumerateInstanceExtensionProperties" ,
100- " VUID-xrEnumerateApiLayerProperties-propertyCapacityInput-parameter: insufficient space in array" );
101- *outgoing_count = manifest_count;
102- return XR_ERROR_SIZE_INSUFFICIENT;
103- }
99+ // capacity check only
100+ return XR_SUCCESS;
101+ }
102+ if (nullptr == api_layer_properties) {
103+ // incoming_count is not 0 BUT the api_layer_properties is NULL
104+ LoaderLogger::LogErrorMessage (" xrEnumerateInstanceExtensionProperties" ,
105+ " VUID-xrEnumerateApiLayerProperties-properties-parameter: non-zero capacity but null array" );
106+ return XR_ERROR_VALIDATION_FAILURE;
107+ }
108+ if (incoming_count < manifest_count) {
109+ LoaderLogger::LogErrorMessage (
110+ " xrEnumerateInstanceExtensionProperties" ,
111+ " VUID-xrEnumerateApiLayerProperties-propertyCapacityInput-parameter: insufficient space in array" );
112+ return XR_ERROR_SIZE_INSUFFICIENT;
113+ }
104114
105- uint32_t prop = 0 ;
106- bool properties_valid = true ;
107- for (; prop < incoming_count && prop < manifest_count; ++prop) {
108- if (nullptr != api_layer_properties[prop].next ) {
109- LoaderLogger::LogErrorMessage (openxr_command, " VUID-XrApiLayerProperties-next-next: expected NULL" );
110- properties_valid = false ;
111- }
112- if (properties_valid) {
113- api_layer_properties[prop] = manifest_files[prop]->GetApiLayerProperties ();
114- }
115- }
116- if (!properties_valid) {
117- LoaderLogger::LogErrorMessage (openxr_command,
118- " VUID-xrEnumerateApiLayerProperties-properties-parameter: invalid properties" );
119- return XR_ERROR_VALIDATION_FAILURE;
120- }
121- if (nullptr != outgoing_count) {
122- *outgoing_count = prop;
123- }
115+ for (uint32_t prop = 0 ; prop < incoming_count && prop < manifest_count; ++prop) {
116+ manifest_files[prop]->PopulateApiLayerProperties (api_layer_properties[prop]);
124117 }
125118 return XR_SUCCESS;
126119}
0 commit comments