From a550521bd52c3f9b57cba8fa9d7f6bd748e1b3df Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 19 Jun 2020 12:36:37 +0100 Subject: [PATCH] Find struct annotations more robustly --- renderdoc/driver/shaders/dxil/dxil_reflect.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/renderdoc/driver/shaders/dxil/dxil_reflect.cpp b/renderdoc/driver/shaders/dxil/dxil_reflect.cpp index 890a8c196..f412146cb 100644 --- a/renderdoc/driver/shaders/dxil/dxil_reflect.cpp +++ b/renderdoc/driver/shaders/dxil/dxil_reflect.cpp @@ -286,10 +286,19 @@ struct TypeInfo if(!typeAnnotations) return; - RDCASSERT(typeAnnotations->children.size() >= 2, typeAnnotations->children.size()); - const Metadata *structAnnotations = typeAnnotations->children[0]; + const Metadata *structAnnotations = NULL; - RDCASSERTEQUAL(getival(structAnnotations->children[0]), 0); + for(size_t i = 0; i < typeAnnotations->children.size(); i++) + { + if(getival(typeAnnotations->children[i]->children[0]) == 0) + { + structAnnotations = typeAnnotations->children[i]; + break; + } + } + + if(!structAnnotations) + return; for(size_t c = 1; c < structAnnotations->children.size(); c += 2) {