@@ -2217,31 +2217,30 @@ static SpvReflectResult ParseDescriptorBlockVariableUsage(
22172217 case SpvOpTypeArray : {
22182218 // Parse through array's type hierarchy to find the actual/non-array element type
22192219 SpvReflectTypeDescription * p_type = p_var -> type_description ;
2220- while ((p_type -> op == SpvOpTypeArray ) && (index_index < p_access_chain -> index_count )) {
2221- // Find the array element type id
2222- Node * p_node = FindNode (p_parser , p_type -> id );
2223- if (p_node == NULL ) {
2224- return SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_ID_REFERENCE ;
2225- }
2226- uint32_t element_type_id = p_node -> array_traits .element_type_id ;
2227- // Get the array element type
2228- p_type = FindType (p_module , element_type_id );
2229- if (p_type == NULL ) {
2230- return SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_ID_REFERENCE ;
2231- }
2232- // Next access index
2233- index_index += 1 ;
2220+ // Find the array element type id
2221+ Node * p_node = FindNode (p_parser , p_type -> id );
2222+ if (p_node == NULL ) {
2223+ return SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_ID_REFERENCE ;
22342224 }
2235- // Parse current var again with a type override and advanced index index
2236- SpvReflectResult result = ParseDescriptorBlockVariableUsage (
2237- p_parser ,
2238- p_module ,
2239- p_access_chain ,
2240- index_index ,
2241- p_type -> op ,
2242- p_var );
2243- if (result != SPV_REFLECT_RESULT_SUCCESS ) {
2244- return result ;
2225+ uint32_t element_type_id = p_node -> array_traits .element_type_id ;
2226+ // Get the array element type
2227+ p_type = FindType (p_module , element_type_id );
2228+ if (p_type == NULL ) {
2229+ return SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_ID_REFERENCE ;
2230+ }
2231+
2232+ if (index_index < p_access_chain -> index_count ) {
2233+ // Parse current var again with a type override and advanced index index
2234+ SpvReflectResult result = ParseDescriptorBlockVariableUsage (
2235+ p_parser ,
2236+ p_module ,
2237+ p_access_chain ,
2238+ index_index + 1 ,
2239+ p_type -> op ,
2240+ p_var );
2241+ if (result != SPV_REFLECT_RESULT_SUCCESS ) {
2242+ return result ;
2243+ }
22452244 }
22462245 }
22472246 break ;
0 commit comments