Lines Matching refs:append
198 struct_order_list.append(base_type)
261 self.enum_type_dict[enum_type].append(enum_name)
399 list.append("#ifdef VK_USE_PLATFORM_XLIB_KHR")
401 list.append("#ifdef VK_USE_PLATFORM_XCB_KHR")
403 list.append("#ifdef VK_USE_PLATFORM_WAYLAND_KHR")
405 list.append("#ifdef VK_USE_PLATFORM_MIR_KHR")
407 list.append("#ifdef VK_USE_PLATFORM_ANDROID_KHR")
409 list.append("#ifdef VK_USE_PLATFORM_WIN32_KHR")
414 list.append("#endif //VK_USE_PLATFORM_XLIB_KHR")
416 list.append("#endif //VK_USE_PLATFORM_XCB_KHR")
418 list.append("#endif //VK_USE_PLATFORM_WAYLAND_KHR")
420 list.append("#endif //VK_USE_PLATFORM_MIR_KHR")
422 list.append("#endif //VK_USE_PLATFORM_ANDROID_KHR")
424 list.append("#endif //VK_USE_PLATFORM_WIN32_KHR")
594 copyright.append('/* THIS FILE IS GENERATED. DO NOT EDIT. */');
595 copyright.append('');
596 copyright.append('/*');
597 copyright.append(' * Vulkan');
598 copyright.append(' *');
599 copyright.append(' * Copyright (c) 2015-2016 The Khronos Group Inc.');
600 copyright.append(' * Copyright (c) 2015-2016 Valve Corporation.');
601 copyright.append(' * Copyright (c) 2015-2016 LunarG, Inc.');
602 copyright.append(' * Copyright (c) 2015-2016 Google Inc.');
603 copyright.append(' *');
604 copyright.append(' * Licensed under the Apache License, Version 2.0 (the "License");');
605 copyright.append(' * you may not use this file except in compliance with the License.');
606 copyright.append(' * You may obtain a copy of the License at');
607 copyright.append(' *');
608 copyright.append(' * http://www.apache.org/licenses/LICENSE-2.0');
609 copyright.append(' *');
610 copyright.append(' * Unless required by applicable law or agreed to in writing, software');
611 copyright.append(' * distributed under the License is distributed on an "AS IS" BASIS,');
612 … copyright.append(' * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.');
613 copyright.append(' * See the License for the specific language governing permissions and');
614 copyright.append(' * limitations under the License.');
615 copyright.append(' *');
616 copyright.append(' * Author: Courtney Goeltzenleuchter <courtney@LunarG.com>');
617 copyright.append(' * Author: Tobin Ehlis <tobin@lunarg.com>');
618 copyright.append(' */');
619 copyright.append('');
624 header.append("//#includes, #defines, globals and such...\n")
625 …header.append("#include <stdio.h>\n#include <%s>\n#include <%s_enum_string_helper.h>\n" % (os.path…
631 class_def.append(self._generateDynamicPrintFunctions())
633 class_def.append("\n// %s class definition" % self.get_class_name(s))
634 class_def.append(self._generateConstructorDefinitions(s))
635 class_def.append(self._generateDestructorDefinitions(s))
636 class_def.append(self._generateDisplayDefinitions(s))
641 …con_defs.append("%s::%s() : m_struct(), m_indent(0), m_dummy_prefix('\\0'), m_origStructAddr(NULL)…
643 …con_defs.append("%s::%s(%s* pInStruct) : m_indent(0), m_dummy_prefix('\\0')\n{\n m_struct = *pI…
644 …con_defs.append("%s::%s(const %s* pInStruct) : m_indent(0), m_dummy_prefix('\\0')\n{\n m_struct…
652 …dp_funcs.append("\nvoid dynamic_display_full_txt(const void* pStruct, uint32_t indent)\n{\n // …
653 dp_funcs.append(" VkStructureType sType = ((VkApplicationInfo*)pStruct)->sType;\n")
654 dp_funcs.append(" switch (sType)\n {")
665 dp_funcs.append(" case %s:\n {" % (v))
666 … dp_funcs.append(" %s %s((%s*)pStruct);" % (class_name, instance_name, struct_name))
667 dp_funcs.append(" %s.set_indent(indent);" % (instance_name))
668 dp_funcs.append(" %s.display_full_txt();" % (instance_name))
669 dp_funcs.append(" }")
670 dp_funcs.append(" break;")
672 dp_funcs.append(" }")
673 dp_funcs.append("}\n")
758 …sh_funcs.append('char* %s(const %s* pStruct, const char* prefix);' % (self._get_sh_func_name(s), t…
759 sh_funcs.append('')
760 sh_funcs.append('#if defined(_WIN32)')
761 … sh_funcs.append('// Microsoft did not implement C99 in Visual Studio; but started adding it with')
762 … sh_funcs.append('// VS2013. However, VS2013 still did not have snprintf(). The following is a')
763 sh_funcs.append('// work-around.')
764 sh_funcs.append('#define snprintf _snprintf')
765 sh_funcs.append('#endif // _WIN32\n')
773 stp_list.append(self.struct_dict[s][m])
774 …sh_funcs.append('char* %s(const %s* pStruct, const char* prefix)\n{\n char* str;' % (self._get_…
775 sh_funcs.append(" size_t len;")
779 sh_funcs.append(" char* tmpStr;")
780 sh_funcs.append(' char* extra_indent = (char*)malloc(strlen(prefix) + 3);')
781 sh_funcs.append(' strcpy(extra_indent, " ");')
782 sh_funcs.append(' strncat(extra_indent, prefix, strlen(prefix));')
783 sh_funcs.append(' char* stp_strs[%i];' % num_stps)
792 sh_funcs.append(' if (pStruct->%s) {' % stp_list[index]['name'])
794 … sh_funcs.append(' tmpStr = dynamic_display((void*)pStruct->pNext, prefix);')
795 sh_funcs.append(' len = 256+strlen(tmpStr);')
796 sh_funcs.append(' stp_strs[%i] = (char*)malloc(len);' % index)
798 …sh_funcs.append(' snprintf(stp_strs[%i], len, " %%spNext (addr)\\n%%s", prefix, tmpStr);' %…
800 …sh_funcs.append(' snprintf(stp_strs[%i], len, " %%spNext (0x%%p)\\n%%s", prefix, (void*)pSt…
801 sh_funcs.append(' free(tmpStr);')
805 …sh_funcs.append(' tmpStr = %s(&pStruct->%s[0], extra_indent);' % (self._get_sh_func_name(st…
807 …sh_funcs.append(' tmpStr = %s(pStruct->%s, extra_indent);' % (self._get_sh_func_name(stp_li…
808 sh_funcs.append(' len = 256+strlen(tmpStr)+strlen(prefix);')
809 sh_funcs.append(' stp_strs[%i] = (char*)malloc(len);' % (index))
811 …sh_funcs.append(' snprintf(stp_strs[%i], len, " %%s%s (addr)\\n%%s", prefix, tmpStr);' % (i…
813 …sh_funcs.append(' snprintf(stp_strs[%i], len, " %%s%s (0x%%p)\\n%%s", prefix, (void*)pStruc…
814 sh_funcs.append(' }')
815 sh_funcs.append(" else\n stp_strs[%i] = \"\";" % (index))
817 …sh_funcs.append(' tmpStr = %s(&pStruct->%s[0], extra_indent);' % (self._get_sh_func_name(stp_li…
818 sh_funcs.append(' len = 256+strlen(tmpStr);')
819 sh_funcs.append(' stp_strs[%i] = (char*)malloc(len);' % (index))
821 …sh_funcs.append(' snprintf(stp_strs[%i], len, " %%s%s[0] (addr)\\n%%s", prefix, tmpStr);' % (in…
823 …sh_funcs.append(' snprintf(stp_strs[%i], len, " %%s%s[0] (0x%%p)\\n%%s", prefix, (void*)&pStruc…
825 …sh_funcs.append(' tmpStr = %s(&pStruct->%s, extra_indent);' % (self._get_sh_func_name(stp_list[…
826 sh_funcs.append(' len = 256+strlen(tmpStr);')
827 sh_funcs.append(' stp_strs[%i] = (char*)malloc(len);' % (index))
829 …sh_funcs.append(' snprintf(stp_strs[%i], len, " %%s%s (addr)\\n%%s", prefix, tmpStr);' % (index…
831 …sh_funcs.append(' snprintf(stp_strs[%i], len, " %%s%s (0x%%p)\\n%%s", prefix, (void*)&pStruct->…
833 sh_funcs.append(' len = %ssizeof(char)*1024;' % (total_strlen_str))
834 sh_funcs.append(' str = (char*)malloc(len);')
835 sh_funcs.append(' snprintf(str, len, "')
844 … sh_funcs.append(' for (int32_t stp_index = %i; stp_index >= 0; stp_index--) {' % (num_stps-1))
845 sh_funcs.append(' if (0 < strlen(stp_strs[stp_index])) {')
846 … sh_funcs.append(' strncat(str, stp_strs[stp_index], strlen(stp_strs[stp_index]));')
847 sh_funcs.append(' free(stp_strs[stp_index]);')
848 sh_funcs.append(' }')
849 sh_funcs.append(' }')
850 sh_funcs.append(' free(extra_indent);')
851 sh_funcs.append(" return str;\n}")
853 sh_funcs.append("char* dynamic_display(const void* pStruct, const char* prefix)\n{")
854 sh_funcs.append(" // Cast to APP_INFO ptr initially just to pull sType off struct")
855 sh_funcs.append(" if (pStruct == NULL) {")
856 sh_funcs.append(" return NULL;")
857 sh_funcs.append(" }")
858 sh_funcs.append(" VkStructureType sType = ((VkApplicationInfo*)pStruct)->sType;")
859 … sh_funcs.append(' char indent[100];\n strcpy(indent, " ");\n strcat(indent, prefix);')
860 sh_funcs.append(" switch (sType)\n {")
868 sh_funcs.append(' case %s:\n {' % (v))
869 … sh_funcs.append(' return %s((%s*)pStruct, indent);' % (print_func_name, struct_name))
870 sh_funcs.append(' }')
871 sh_funcs.append(' break;')
872 sh_funcs.append(" default:")
873 sh_funcs.append(" return NULL;")
874 sh_funcs.append(" }")
875 sh_funcs.append("}")
889 sh_funcs.append('%s' % lineinfo.get())
893 …sh_funcs.append('std::string %s(const %s* pStruct, const std::string prefix);' % (self._get_sh_fun…
896 sh_funcs.append('\n')
897 sh_funcs.append('%s' % lineinfo.get())
906 stp_list.append(self.struct_dict[s][m])
907 sh_funcs.append('%s' % lineinfo.get())
912 …sh_funcs.append('std::string %s(const %s* pStruct, const std::string prefix)\n{' % (self._get_sh_f…
913 sh_funcs.append('%s' % lineinfo.get())
915 sh_funcs.append('%susing namespace StreamControl;' % (indent))
916 sh_funcs.append('%susing namespace std;' % (indent))
917 sh_funcs.append('%sstring final_str;' % (indent))
918 sh_funcs.append('%sstring tmp_str;' % (indent))
919 sh_funcs.append('%sstring extra_indent = " " + prefix;' % (indent))
921 sh_funcs.append('%sstringstream ss[%u];' % (indent, num_non_enum_elems))
925 sh_funcs.append('%sstring stp_strs[%u];' % (indent, num_stps))
932 sh_funcs.append('%s' % lineinfo.get())
934 sh_funcs.append('%s' % lineinfo.get())
937 sh_funcs.append('%s' % lineinfo.get())
939 sh_funcs.append('%s' % lineinfo.get())
940 sh_funcs.append('%sstp_strs[%u] = "";' % (indent, index))
942 sh_funcs.append('%sstringstream index_ss;' % (indent))
946 … sh_funcs.append('%sif (pStruct->imageSharingMode == VK_SHARING_MODE_CONCURRENT) {' % (indent))
948 … sh_funcs.append('%sif (pStruct->sharingMode == VK_SHARING_MODE_CONCURRENT) {' % (indent))
951 …sh_funcs.append('%sif ((pStruct->descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) ||' …
952 …sh_funcs.append('%s (pStruct->descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) ||' …
953 …sh_funcs.append('%s (pStruct->descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) ||' …
954 …sh_funcs.append('%s (pStruct->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE)) {'…
957 …sh_funcs.append('%sif ((pStruct->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) ||' …
958 …sh_funcs.append('%s (pStruct->descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) ||' …
959 …sh_funcs.append('%s (pStruct->descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC) ||' …
960 …sh_funcs.append('%s (pStruct->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) {'…
963 …sh_funcs.append('%sif ((pStruct->descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER) ||' % …
964 …sh_funcs.append('%s (pStruct->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)) {' %…
967 … sh_funcs.append('%sif (pStruct->%s) {' % (indent, stp_list[index]['name']))
969 … sh_funcs.append('%sfor (uint32_t i = 0; i < %s; i++) {' % (indent, array_count))
971 sh_funcs.append('%sindex_ss.str("");' % (indent))
972 sh_funcs.append('%sindex_ss << i;' % (indent))
974 sh_funcs.append('%s' % lineinfo.get())
977 …sh_funcs.append('%sss[%u] << string_%s(pStruct->%s[i]);' % (indent, index, stp_list[index]['type']…
978 …sh_funcs.append('%sstp_strs[%u] += " " + prefix + "%s[" + index_ss.str() + "] = " + ss[%u].str() +…
980 sh_funcs.append('%s' % lineinfo.get())
981 …sh_funcs.append('%sss[%u] << "0x" << %spStruct->%s[i];' % (indent, index, addr_char, stp_list[inde…
982 …sh_funcs.append('%stmp_str = %s(%spStruct->%s[i], extra_indent);' % (indent, self._get_sh_func_nam…
984 sh_funcs.append('%s' % lineinfo.get())
985 …sh_funcs.append('%sstp_strs[%u] += " " + prefix + "%s[" + index_ss.str() + "] (addr)\\n" + tmp_str…
987 sh_funcs.append('%s' % lineinfo.get())
988 …sh_funcs.append('%sstp_strs[%u] += " " + prefix + "%s[" + index_ss.str() + "] (" + ss[%u].str() + …
990 sh_funcs.append('%s' % lineinfo.get())
993 …sh_funcs.append('%sss[%u] << "0x" << %spStruct->%s[i];' % (indent, index, addr_char, stp_list[inde…
995 …sh_funcs.append('%sss[%u] << %spStruct->%s[i];' % (indent, index, addr_char, stp_list[index]['name…
997 …sh_funcs.append('%sstp_strs[%u] += " " + prefix + "%s[" + index_ss.str() + "].handle = " + ss[%u].…
999 …sh_funcs.append('%sstp_strs[%u] += " " + prefix + "%s[" + index_ss.str() + "] = " + ss[%u].str() +…
1000 sh_funcs.append('%s' % lineinfo.get())
1001 sh_funcs.append('%sss[%u].str("");' % (indent, index))
1003 sh_funcs.append('%s}' % (indent))
1006 sh_funcs.append('%s}' % (indent))
1010 sh_funcs.append('%s}' % (indent))
1012 sh_funcs.append('%s' % lineinfo.get())
1013 sh_funcs.append('%sif (pStruct->%s) {' % (indent, stp_list[index]['name']))
1016 sh_funcs.append('%s' % lineinfo.get())
1017 … sh_funcs.append(' tmp_str = dynamic_display((void*)pStruct->pNext, prefix);')
1021 sh_funcs.append('%s' % lineinfo.get())
1022 …sh_funcs.append(' tmp_str = %s(&pStruct->%s[0], extra_indent);' % (self._get_sh_func_name(s…
1024 sh_funcs.append('%s' % lineinfo.get())
1025 …sh_funcs.append(' tmp_str = %s(pStruct->%s, extra_indent);' % (self._get_sh_func_name(stp_l…
1026 …sh_funcs.append(' ss[%u] << "0x" << %spStruct->%s;' % (index, addr_char, stp_list[index]['n…
1028 sh_funcs.append('%s' % lineinfo.get())
1029 …sh_funcs.append(' stp_strs[%u] = " " + prefix + "%s (addr)\\n" + tmp_str;' % (index, stp_li…
1031 sh_funcs.append('%s' % lineinfo.get())
1032 …sh_funcs.append(' stp_strs[%u] = " " + prefix + "%s (" + ss[%u].str() + ")\\n" + tmp_str;' …
1033 sh_funcs.append(' ss[%u].str("");' % (index))
1034 sh_funcs.append(' }')
1035 sh_funcs.append(' else')
1036 sh_funcs.append(' stp_strs[%u] = "";' % index)
1038 sh_funcs.append('%s' % lineinfo.get())
1039 …sh_funcs.append(' tmp_str = %s(&pStruct->%s, extra_indent);' % (self._get_sh_func_name(stp_list…
1040 …sh_funcs.append(' ss[%u] << "0x" << %spStruct->%s;' % (index, addr_char, stp_list[index]['name'…
1042 …sh_funcs.append(' stp_strs[%u] = " " + prefix + "%s (addr)\\n" + tmp_str;' % (index, stp_list[i…
1043 sh_funcs.append('%s' % lineinfo.get())
1045 …sh_funcs.append(' stp_strs[%u] = " " + prefix + "%s (" + ss[%u].str() + ")\\n" + tmp_str;' % (i…
1046 sh_funcs.append('%s' % lineinfo.get())
1047 sh_funcs.append(' ss[%u].str("");' % index)
1055 sh_funcs.append('%s' % lineinfo.get())
1056 sh_funcs.append(' ss[%u].str("addr");' % (index))
1058 sh_funcs.append('%s' % lineinfo.get())
1059 … sh_funcs.append(' ss[%u] << "0x" << &pStruct->%s;' % (index, self.struct_dict[s][m]['name']))
1061 sh_funcs.append('%s' % lineinfo.get())
1062 …sh_funcs.append(' ss[%u] << "0x" << (void*)pStruct->%s;' % (index, self.struct_dict[s][m]['name…
1064 sh_funcs.append('%s' % lineinfo.get())
1065 …sh_funcs.append(' ss[%u].str(pStruct->%s ? "TRUE" : "FALSE");' % (index, self.struct_dict[s][m]…
1067 sh_funcs.append('%s' % lineinfo.get())
1068 … sh_funcs.append(' ss[%u] << pStruct->%s;' % (index, self.struct_dict[s][m]['name']))
1070 sh_funcs.append('%s' % lineinfo.get())
1071 sh_funcs.append(' if (StreamControl::writeAddress)')
1072 …sh_funcs.append(' ss[%u] << "0x" << pStruct->%s;' % (index, self.struct_dict[s][m]['name']))
1073 sh_funcs.append(' else')
1074 sh_funcs.append(' ss[%u].str("address");' % (index))
1076 sh_funcs.append('%s' % lineinfo.get())
1077 … sh_funcs.append(' if (pStruct->%s != NULL) {' % self.struct_dict[s][m]['name'])
1078 … sh_funcs.append(' ss[%u] << pStruct->%s;' % (index, self.struct_dict[s][m]['name']))
1079 sh_funcs.append(' } else {')
1080 sh_funcs.append(' ss[%u] << "";' % index)
1081 sh_funcs.append(' }')
1086 sh_funcs.append('%s' % lineinfo.get())
1087 … sh_funcs.append(' ss[%u] << "0x" << pStruct->%s;' % (index, self.struct_dict[s][m]['name']))
1090 … sh_funcs.append('%s: NB: Edit here to choose hex vs dec output by variable name' % lineinfo.get())
1091 … sh_funcs.append(' ss[%u] << "0x" << pStruct->%s;' % (index, self.struct_dict[s][m]['name']))
1093 …sh_funcs.append('%s: NB Edit this section to choose hex vs dec output by variable name' % lineinfo…
1094 … sh_funcs.append(' ss[%u] << pStruct->%s;' % (index, self.struct_dict[s][m]['name']))
1100 sh_funcs.append('%s' % lineinfo.get())
1101 sh_funcs.append(' if (pStruct->%s)' % (self.struct_dict[s][m]['name']))
1102 …sh_funcs.append(' ss[%u] << "0x" << pStruct->%s << " (See individual array values below)";'…
1103 sh_funcs.append(' else')
1104 sh_funcs.append(' ss[%u].str("NULL");' % (index))
1110 …final_str.append('+ prefix + "%s = " + %s + "\\n"' % (self.struct_dict[s][m]['name'], value_print))
1112 … final_str.append("+ %s" % " + ".join(['stp_strs[%u]' % n for n in reversed(range(num_stps))]))
1113 sh_funcs.append('%s' % lineinfo.get())
1115 sh_funcs.append(' final_str = final_str %s;' % final_str_part)
1116 sh_funcs.append(' return final_str;\n}')
1122 sh_funcs.append('%s' % lineinfo.get())
1123 …sh_funcs.append("std::string string_convert_helper(const void* toString, const std::string prefix)…
1124 sh_funcs.append(" using namespace StreamControl;")
1125 sh_funcs.append(" using namespace std;")
1126 sh_funcs.append(" stringstream ss;")
1127 sh_funcs.append(' ss << toString;')
1128 sh_funcs.append(' string final_str = prefix + ss.str();')
1129 sh_funcs.append(" return final_str;")
1130 sh_funcs.append("}")
1131 sh_funcs.append('%s' % lineinfo.get())
1133 …sh_funcs.append("std::string string_convert_helper(const uint64_t toString, const std::string pref…
1134 sh_funcs.append(" using namespace StreamControl;")
1135 sh_funcs.append(" using namespace std;")
1136 sh_funcs.append(" stringstream ss;")
1137 sh_funcs.append(' ss << toString;')
1138 sh_funcs.append(' string final_str = prefix + ss.str();')
1139 sh_funcs.append(" return final_str;")
1140 sh_funcs.append("}")
1141 sh_funcs.append('%s' % lineinfo.get())
1143 …sh_funcs.append("std::string string_convert_helper(VkSurfaceFormatKHR toString, const std::string …
1144 sh_funcs.append(" using namespace std;")
1145 …sh_funcs.append(' string final_str = prefix + "format = " + string_VkFormat(toString.format) + …
1146 sh_funcs.append(" return final_str;")
1147 sh_funcs.append("}")
1148 sh_funcs.append('%s' % lineinfo.get())
1150 … sh_funcs.append("std::string dynamic_display(const void* pStruct, const std::string prefix)\n{")
1151 sh_funcs.append(" using namespace std;")
1152 sh_funcs.append(" // Cast to APP_INFO ptr initially just to pull sType off struct")
1153 sh_funcs.append(" if (pStruct == NULL) {\n")
1154 sh_funcs.append(" return string();")
1155 sh_funcs.append(" }\n")
1156 sh_funcs.append(" VkStructureType sType = ((VkApplicationInfo*)pStruct)->sType;")
1157 sh_funcs.append(' string indent = " ";')
1158 sh_funcs.append(' indent += prefix;')
1159 sh_funcs.append(" switch (sType)\n {")
1168 sh_funcs.append(' case %s:\n {' % (v))
1169 … sh_funcs.append(' return %s((%s*)pStruct, indent);' % (print_func_name, struct_name))
1170 sh_funcs.append(' }')
1171 sh_funcs.append(' break;')
1172 sh_funcs.append(" default:")
1173 sh_funcs.append(" return string();")
1174 sh_funcs.append('%s' % lineinfo.get())
1175 sh_funcs.append(" }")
1176 sh_funcs.append("}")
1196 disp_def.append("// Output 'structname = struct_address' on a single line")
1197 disp_def.append("void %s::display_single_txt()\n{" % self.get_class_name(s))
1198 …disp_def.append(' printf(" %%*s%s = 0x%%p", m_indent, "", (void*)m_origStructAddr);' % typedef_…
1199 disp_def.append("}\n")
1201 … disp_def.append("// Private helper function that displays the members of the wrapped struct")
1202 disp_def.append("void %s::display_struct_members()\n{" % self.get_class_name(s))
1212 disp_def.append(' uint32_t i;')
1214 … disp_def.append(' for (i = 0; i<%s; i++) {' % self.struct_dict[s][member]['array_size'])
1216 disp_def.append(return_str)
1217 disp_def.append(' }')
1220 disp_def.append(return_str)
1221 disp_def.append("}\n")
1224 disp_def.append("// Output all struct elements, each on their own line")
1225 disp_def.append("void %s::display_txt()\n{" % self.get_class_name(s))
1226 …disp_def.append(' printf("%%*s%s struct contents at 0x%%p:\\n", m_indent, "", (void*)m_origStru…
1227 disp_def.append(' this->display_struct_members();')
1228 disp_def.append("}\n")
1230 …disp_def.append("// Output all struct elements, and for any structs pointed to, print complete con…
1231 disp_def.append("void %s::display_full_txt()\n{" % self.get_class_name(s))
1232 …disp_def.append(' printf("%%*s%s struct contents at 0x%%p:\\n", m_indent, "", (void*)m_origStru…
1233 disp_def.append(' this->display_struct_members();')
1240 disp_def.append(' uint32_t i;')
1242 disp_def.append(' for (i = 0; i<%s; i++) {' % ms['array_size'])
1244 …disp_def.append(" %s %s(&(m_struct.%s[i]));" % (self.get_class_name(ms['type']), swc_na…
1245 disp_def.append(" %s.set_indent(m_indent + 4);" % (swc_name))
1246 disp_def.append(" %s.display_full_txt();" % (swc_name))
1248 disp_def.append(' }')
1254 disp_def.append(" if (m_struct.%s) {" % (ms['name']))
1256 … disp_def.append(' dynamic_display_full_txt(m_struct.%s, m_indent);' % (ms['name']))
1257 disp_def.append(" }")
1260 disp_def.append(" if (m_struct.%s) {" % (ms['name']))
1261 …disp_def.append(" %s %s(m_struct.%s);" % (self.get_class_name(ms['type']), swc_name, ms['na…
1263 disp_def.append(" if (&m_struct.%s) {" % (ms['name']))
1264 …disp_def.append(" %s %s(&m_struct.%s);" % (self.get_class_name(ms['type']), swc_name, ms['n…
1265 disp_def.append(" %s.set_indent(m_indent + 4);" % (swc_name))
1266 disp_def.append(" %s.display_full_txt();\n }" % (swc_name))
1268 disp_def.append("}\n")
1273 header.append("//#includes, #defines, globals and such...\n")
1276 header.append("#include <%s>\n" % f)
1277 header.append('#include "vk_enum_string_helper.h"\n\n// Function Prototypes\n')
1278 header.append("char* dynamic_display(const void* pStruct, const char* prefix);\n")
1283 header.append("//#includes, #defines, globals and such...\n")
1286 header.append("#include <%s>\n" % f)
1287 header.append('#include "vk_enum_string_helper.h"\n')
1288 header.append('namespace StreamControl\n')
1289 header.append('{\n')
1290 header.append('bool writeAddress = true;\n')
1291 header.append('template <typename T>\n')
1292 header.append('std::ostream& operator<< (std::ostream &out, T const* pointer)\n')
1293 header.append('{\n')
1294 header.append(' if(writeAddress)\n')
1295 header.append(' {\n')
1296 header.append(' out.operator<<(pointer);\n')
1297 header.append(' }\n')
1298 header.append(' else\n')
1299 header.append(' {\n')
1300 header.append(' std::operator<<(out, "address");\n')
1301 header.append(' }\n')
1302 header.append(' return out;\n')
1303 header.append('}\n')
1304 header.append('std::ostream& operator<<(std::ostream &out, char const*const s)\n')
1305 header.append('{\n')
1306 header.append(' return std::operator<<(out, s);\n')
1307 header.append('}\n')
1308 header.append('}\n')
1309 header.append('\n')
1310 … header.append("std::string dynamic_display(const void* pStruct, const std::string prefix);\n")
1320 …sh_funcs.append('uint32_t %s(const %s* pStruct);' % (self._get_vh_func_name(s), typedef_fwd_dict[s…
1323 sh_funcs.append('\n')
1329 …sh_funcs.append('uint32_t %s(const %s* pStruct)\n{' % (self._get_vh_func_name(s), typedef_fwd_dict…
1333 …sh_funcs.append(' if (!validate_%s(pStruct->%s))\n return 0;' % (self.struct_dict[s][m][…
1337 …sh_funcs.append(' if (pStruct->%s && !%s((const %s*)pStruct->%s))\n return 0;' % (self.s…
1339 …sh_funcs.append(' if (!%s((const %s*)&pStruct->%s))\n return 0;' % (self._get_vh_func_na…
1340 sh_funcs.append(" return 1;\n}")
1349 header.append("//#includes, #defines, globals and such...\n")
1352 header.append("#include <%s>\n" % f)
1353 header.append('#include "vk_enum_validate_helper.h"\n\n// Function Prototypes\n')
1364 …sh_funcs.append('size_t %s(const %s* pStruct);' % (self._get_size_helper_func_name(s), typedef_fwd…
1379 …sh_funcs.append('size_t %s(const %s* pStruct)\n{' % (self._get_size_helper_func_name(s), typedef_f…
1381 sh_funcs.append('%ssize_t structSize = 0;' % (indent))
1382 sh_funcs.append('%sif (pStruct) {' % (indent))
1384 sh_funcs.append('%sstructSize = sizeof(%s);' % (indent, typedef_fwd_dict[s]))
1394 …sh_funcs.append('%sstructSize += pStruct->%s*(sizeof(%s*) + sizeof(VkImageMemoryBarrier));' % (ind…
1396 …sh_funcs.append('%sstructSize += pStruct->%s*(sizeof(%s*) + sizeof(%s));' % (indent, self.struct_d…
1399 sh_funcs.append('%suint32_t i = 0;' % (indent))
1401 …sh_funcs.append('%sfor (i = 0; i < pStruct->%s; i++) {' % (indent, self.struct_dict[s][m]['array_s…
1404 …sh_funcs.append('%sstructSize += (sizeof(%s*) + %s(pStruct->%s[i]));' % (indent, self.struct_dict[…
1406 …sh_funcs.append('%sstructSize += (sizeof(char*) + (sizeof(char) * (1 + strlen(pStruct->%s[i]))));'…
1408 sh_funcs.append('%s}' % (indent))
1412 sh_funcs.append('%suint32_t i = 0;' % (indent))
1414 …sh_funcs.append('%sfor (i = 0; i < pStruct->%s; i++) {' % (indent, self.struct_dict[s][m]['array_s…
1416 …sh_funcs.append('%sstructSize += %s(&pStruct->%s[i]);' % (indent, self._get_size_helper_func_name(…
1418 sh_funcs.append('%s}' % (indent))
1420 …sh_funcs.append('%sstructSize += pStruct->%s*sizeof(%s);' % (indent, self.struct_dict[s][m]['array…
1423 …sh_funcs.append('%sstructSize += (pStruct->%s != NULL) ? sizeof(%s)*(1+strlen(pStruct->%s)) : 0;' …
1425 …sh_funcs.append('%sstructSize += %s(pStruct->%s);' % (indent, self._get_size_helper_func_name(self…
1428 … sh_funcs.append('%sstructSize += sizeof(%s);' % (indent, self.struct_dict[s][m]['type']))
1430 … sh_funcs.append('%sstructSize += pStruct->%s;' % (indent, self.struct_dict[s][m]['name']))
1431 skip_list.append(m+1)
1433 sh_funcs.append('%s}' % (indent))
1434 sh_funcs.append("%sreturn structSize;\n}" % (indent))
1442 sh_funcs.append('%s' % self.lineinfo.get())
1444 sh_funcs.append('size_t get_struct_chain_size(const void* pStruct)\n{')
1446 sh_funcs.append('size_t get_dynamic_struct_size(const void* pStruct)\n{')
1448 …sh_funcs.append('%s// Just use VkApplicationInfo as struct until actual type is resolved' % (inden…
1449 … sh_funcs.append('%sVkApplicationInfo* pNext = (VkApplicationInfo*)pStruct;' % (indent))
1450 sh_funcs.append('%ssize_t structSize = 0;' % (indent))
1452 sh_funcs.append('%swhile (pNext) {' % (indent))
1454 sh_funcs.append('%sswitch (pNext->sType) {' % (indent))
1463 sh_funcs.append('%scase %s:' % (indent, v))
1464 sh_funcs.append('%s{' % (indent))
1466 …sh_funcs.append('%sstructSize += %s((%s*)pNext);' % (indent, self._get_size_helper_func_name(struc…
1467 sh_funcs.append('%sbreak;' % (indent))
1469 sh_funcs.append('%s}' % (indent))
1470 sh_funcs.append('%sdefault:' % (indent))
1472 sh_funcs.append('%sassert(0);' % (indent))
1473 sh_funcs.append('%sstructSize += 0;' % (indent))
1476 sh_funcs.append('%s}' % (indent))
1478 sh_funcs.append('%spNext = (VkApplicationInfo*)pNext->pNext;' % (indent))
1480 sh_funcs.append('%s}' % (indent))
1481 sh_funcs.append('%sreturn structSize;\n}' % indent)
1486 header.append('\n#ifdef __cplusplus\n')
1487 header.append('extern "C" {\n')
1488 header.append('#endif\n')
1489 header.append("\n")
1490 header.append("//#includes, #defines, globals and such...\n")
1492 header.append("#include <%s>\n" % f)
1493 header.append('\n// Function Prototypes\n')
1494 header.append("size_t get_struct_chain_size(const void* pStruct);\n")
1495 header.append("size_t get_dynamic_struct_size(const void* pStruct);\n")
1500 header.append('#include "vk_struct_size_helper.h"')
1501 header.append('#include <string.h>')
1502 header.append('#include <assert.h>')
1503 header.append('\n// Function definitions\n')
1508 footer.append('\n\n#ifdef __cplusplus')
1509 footer.append('}')
1510 footer.append('#endif')
1515 header.append("//#includes, #defines, globals and such...\n")
1517 header.append("#include <%s>\n" % f)
1523 constructors.append(" %s();\n" % self.get_class_name(s))
1524 … constructors.append(" %s(%s* pInStruct);\n" % (self.get_class_name(s), typedef_fwd_dict[s]))
1525 …constructors.append(" %s(const %s* pInStruct);\n" % (self.get_class_name(s), typedef_fwd_dict[s…
1536 get_set.append(" void set_indent(uint32_t indent) { m_indent = indent; }\n")
1541 …get_set.append(" %s get_%s() { return m_struct.%s; }\n" % (self.struct_dict[s][member]['full_ty…
1543 …get_set.append(" void set_%s(%s inValue) { m_struct.%s = inValue; }\n" % (self.struct_dict[s][m…
1548 priv.append("\nprivate:\n")
1549 priv.append(" %s m_struct;\n" % typedef_fwd_dict[s])
1550 priv.append(" const %s* m_origStructAddr;\n" % typedef_fwd_dict[s])
1551 priv.append(" uint32_t m_indent;\n")
1552 priv.append(" const char m_dummy_prefix;\n")
1553 priv.append(" void display_struct_members();\n")
1559 class_decl.append("\n//class declaration")
1560 class_decl.append("class %s\n{\npublic:" % self.get_class_name(s))
1561 class_decl.append(self._generateConstructorDeclarations(s))
1562 class_decl.append(self._generateDestructorDeclarations(s))
1563 class_decl.append(self._generateDisplayDeclarations(s))
1564 class_decl.append(self._generateGetSetDeclarations(s))
1565 class_decl.append(self._generatePrivateMembers(s))
1566 class_decl.append("};\n")
1592 header.append("//#includes, #defines, globals and such...\n")
1593 header.append('#pragma once\n')
1594 header.append('#include "vulkan/vulkan.h"')
1613 ss_decls.append('#ifdef %s' % ifdef_dict[s])
1615 ss_decls.append("\nstruct %s {" % (ss_name))
1621 …ss_decls.append(" %s %s[%s];" % (m_type, self.struct_dict[s][m]['name'], self.struct_dict[s][m]…
1623 …ss_decls.append(" %s %s;" % (self.struct_dict[s][m]['full_type'], self.struct_dict[s][m]['name'…
1625 ss_decls.append(" %s* %s;" % (m_type, self.struct_dict[s][m]['name']))
1627 ss_decls.append(" %s* %s;" % (m_type, self.struct_dict[s][m]['name']))
1629 ss_decls.append(" %s %s;" % (m_type, self.struct_dict[s][m]['name']))
1630 ss_decls.append(" %s(const %s* pInStruct);" % (ss_name, s))
1631 ss_decls.append(" %s(const %s& src);" % (ss_name, ss_name)) # Copy constructor
1632 ss_decls.append(" %s();" % (ss_name)) # Default constructor
1633 ss_decls.append(" ~%s();" % (ss_name))
1634 ss_decls.append(" void initialize(const %s* pInStruct);" % (s))
1635 ss_decls.append(" void initialize(const %s* src);" % (ss_name))
1636 ss_decls.append(" %s *ptr() { return reinterpret_cast<%s *>(this); }" % (s, s))
1637 …ss_decls.append(" %s const *ptr() const { return reinterpret_cast<%s const *>(this); }" % (s, s…
1638 ss_decls.append("};")
1640 ss_decls.append('#endif')
1645 header.append("//#includes, #defines, globals and such...\n")
1646 header.append('#include "vk_safe_struct.h"\n#include <string.h>\n\n')
1655 ss_src.append('#ifdef %s' % ifdef_dict[s])
1773 …ss_src.append("\n%s::%s(const %s* pInStruct) : %s\n{\n%s}" % (ss_name, ss_name, s, init_list, cons…
1776 ss_src.append("\n%s::%s()%s\n{}" % (ss_name, ss_name, default_init_list))
1782 …ss_src.append("\n%s::%s(const %s& src)\n{\n%s%s}" % (ss_name, ss_name, ss_name, copy_construct_ini…
1783 ss_src.append("\n%s::~%s()\n{\n%s}" % (ss_name, ss_name, destruct_txt))
1784 …ss_src.append("\nvoid %s::initialize(const %s* pInStruct)\n{\n%s%s}" % (ss_name, s, init_func_txt,…
1788 …ss_src.append("\nvoid %s::initialize(const %s* src)\n{\n%s%s}" % (ss_name, ss_name, init_copy, ini…
1790 ss_src.append('#endif')
1818 body.append("static inline uint32_t validate_%s(%s input_value)\n{" % (fet, fet))
1821 body.append(' if (input_value > (%s))' % (' | '.join(self.et_dict[bet])))
1822 body.append(' return 0;')
1823 body.append(' return 1;')
1824 body.append('}\n\n')
1826 body.append(' switch ((%s)input_value)\n {' % (fet))
1829 body.append(' case %s:' % (e))
1830 … body.append(' return 1;\n default:\n return 0;\n }\n}\n\n')
1839 …body.append("static inline const char* string_%s(%s input_value)\n{\n switch ((%s)input_value)\…
1842 body.append(' case %s:\n return "%s";' % (e, e))
1843 … body.append(' default:\n return "Unhandled %s";\n }\n}\n\n' % (fet))
1848 header.append('#pragma once\n')
1849 header.append('#ifdef _WIN32\n')
1850 header.append('#pragma warning( disable : 4065 )\n')
1851 header.append('#endif\n')
1852 header.append('#include <vulkan/%s>\n\n\n' % self.in_file)
1871 body.append("project(%s)" % os.path.basename(self.out_dir))
1872 body.append("cmake_minimum_required(VERSION 2.8)\n")
1873 body.append("add_library(${PROJECT_NAME} %s)\n" % " ".join(self.add_lib_file_list))
1874 body.append('set(COMPILE_FLAGS "-fpermissive")')
1875 body.append('set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILE_FLAGS}")\n')
1876 body.append("include_directories(${SRC_DIR}/thirdparty/${GEN_API}/inc/)\n")
1877 …body.append("target_include_directories (%s PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})\n" % os.path.basen…
1903 header.append("//#includes, #defines, globals and such...\n")
1906 header.append("#include <%s>\n" % f)
1908 header.append("\nchar* dynamic_gv_display(const void* pStruct, const char* prefix);\n")
1978 array_func_list.append('vkbufferviewattachinfo')
1979 array_func_list.append('vkimageviewattachinfo')
1980 array_func_list.append('vksamplerimageviewinfo')
1981 array_func_list.append('vkdescriptortypecount')
1984 …gv_funcs.append('char* %s(const %s* pStruct, const char* myNodeName);\n' % (self._get_gv_func_name…
1987 …gv_funcs.append('char* %s_array(uint32_t count, const %s* const* pStruct, const char* myNodeName);…
1989 …gv_funcs.append('char* %s_array(uint32_t count, const %s* pStruct, const char* myNodeName);\n' % (…
1990 gv_funcs.append('\n')
2001 stp_list.append(self.struct_dict[s][m])
2007 …gv_funcs.append('char* %s(const %s* pStruct, const char* myNodeName)\n{\n char* str;\n' % (self…
2011 gv_funcs.append(" char* tmpStr;\n")
2012 gv_funcs.append(" char nodeName[100];\n")
2013 gv_funcs.append(' char* stp_strs[%i];\n' % num_stps)
2017 … gv_funcs.append(' if (pStruct->pDescriptorInfo && (0 != pStruct->descriptorCount)) {\n')
2019 gv_funcs.append(' if (pStruct->%s) {\n' % stp_list[index]['name'])
2021 … gv_funcs.append(' sprintf(nodeName, "pNext_0x%p", (void*)pStruct->pNext);\n')
2022 … gv_funcs.append(' tmpStr = dynamic_gv_display((void*)pStruct->pNext, nodeName);\n')
2023 …gv_funcs.append(' stp_strs[%i] = (char*)malloc(256+strlen(tmpStr)+strlen(nodeName)+strlen(m…
2024 …gv_funcs.append(' sprintf(stp_strs[%i], "%%s\\n\\"%%s\\":pNext -> \\"%%s\\" [];\\n", tmpStr…
2025 gv_funcs.append(' free(tmpStr);\n')
2027 …gv_funcs.append(' sprintf(nodeName, "%s_0x%%p", (void*)pStruct->%s);\n' % (stp_list[index][…
2029 …gv_funcs.append(' tmpStr = %s_array(pStruct->count, pStruct->%s, nodeName);\n' % (self._get…
2031 …gv_funcs.append(' tmpStr = %s(pStruct->%s, nodeName);\n' % (self._get_gv_func_name(stp_list…
2032 …gv_funcs.append(' stp_strs[%i] = (char*)malloc(256+strlen(tmpStr)+strlen(nodeName)+strlen(m…
2033 …gv_funcs.append(' sprintf(stp_strs[%i], "%%s\\n\\"%%s\\":struct%i -> \\"%%s\\" [];\\n", tmp…
2034 gv_funcs.append(' }\n')
2035 gv_funcs.append(" else\n stp_strs[%i] = \"\";\n" % (index))
2037 …gv_funcs.append(' sprintf(nodeName, "%s_0x%%p", (void*)&pStruct->%s[0]);\n' % (stp_list[index][…
2038 …gv_funcs.append(' tmpStr = %s(&pStruct->%s[0], nodeName);\n' % (self._get_gv_func_name(stp_list…
2039 …gv_funcs.append(' stp_strs[%i] = (char*)malloc(256+strlen(tmpStr)+strlen(nodeName)+strlen(myNod…
2040 …gv_funcs.append(' sprintf(stp_strs[%i], "%%s\\n\\"%%s\\":struct%i -> \\"%%s\\" [];\\n", tmpStr,…
2042 …gv_funcs.append(' sprintf(nodeName, "%s_0x%%p", (void*)&pStruct->%s);\n' % (stp_list[index]['na…
2043 …gv_funcs.append(' tmpStr = %s(&pStruct->%s, nodeName);\n' % (self._get_gv_func_name(stp_list[in…
2044 …gv_funcs.append(' stp_strs[%i] = (char*)malloc(256+strlen(tmpStr)+strlen(nodeName)+strlen(myNod…
2045 …gv_funcs.append(' sprintf(stp_strs[%i], "%%s\\n\\"%%s\\":struct%i -> \\"%%s\\" [];\\n", tmpStr,…
2047 gv_funcs.append(' str = (char*)malloc(%ssizeof(char)*2048);\n' % (total_strlen_str))
2048 …gv_funcs.append(' sprintf(str, "\\"%s\\" [\\nlabel = <<TABLE BORDER=\\"0\\" CELLBORDER=\\"1\\" …
2059 gv_funcs.append(p_out)
2060 gv_funcs.append(p_args)
2062 …gv_funcs.append(' for (int32_t stp_index = %i; stp_index >= 0; stp_index--) {\n' % (num_stps-1))
2063 gv_funcs.append(' if (0 < strlen(stp_strs[stp_index])) {\n')
2064 … gv_funcs.append(' strncat(str, stp_strs[stp_index], strlen(stp_strs[stp_index]));\n')
2065 gv_funcs.append(' free(stp_strs[stp_index]);\n')
2066 gv_funcs.append(' }\n')
2067 gv_funcs.append(' }\n')
2068 gv_funcs.append(" return str;\n}\n")
2073 …gv_funcs.append('char* %s_array(uint32_t count, const %s* const* pStruct, const char* myNodeName)\…
2075 …gv_funcs.append('char* %s_array(uint32_t count, const %s* pStruct, const char* myNodeName)\n{\n …
2076 gv_funcs.append(' str = (char*)malloc(sizeof(char)*1024*count);\n')
2077 …gv_funcs.append(' sprintf(str, "\\"%s\\" [\\nlabel = <<TABLE BORDER=\\"0\\" CELLBORDER=\\"1\\" …
2078 gv_funcs.append(' for (uint32_t i=0; i < count; i++) {\n')
2079 gv_funcs.append(' sprintf(tmpStr, "');
2096 gv_funcs.append(p_out);
2097 gv_funcs.append(p_args);
2098 gv_funcs.append(' strncat(str, tmpStr, strlen(tmpStr));\n')
2099 gv_funcs.append(' }\n')
2100 gv_funcs.append(' strncat(str, "</TABLE>>\\n];\\n\\n", 20);\n')
2101 gv_funcs.append(' return str;\n}\n')
2103 gv_funcs.append("char* dynamic_gv_display(const void* pStruct, const char* nodeName)\n{\n")
2104 gv_funcs.append(" // Cast to APP_INFO ptr initially just to pull sType off struct\n")
2105 gv_funcs.append(" VkStructureType sType = ((VkApplicationInfo*)pStruct)->sType;\n")
2106 gv_funcs.append(" switch (sType)\n {\n")
2124 gv_funcs.append(' case %s:\n' % (v))
2125 …gv_funcs.append(' return %s((%s*)pStruct, nodeName);\n' % (print_func_name, struct_name…
2128 gv_funcs.append(" default:\n")
2129 gv_funcs.append(" return NULL;\n")
2130 gv_funcs.append(" }\n")
2131 gv_funcs.append("}")