Lines Matching refs:append

205                             struct_order_list.append(base_type)
268 self.enum_type_dict[enum_type].append(enum_name)
570 copyright.append('/* THIS FILE IS GENERATED. DO NOT EDIT. */');
571 copyright.append('');
572 copyright.append('/*');
573 copyright.append(' * Vulkan');
574 copyright.append(' *');
575 copyright.append(' * Copyright (c) 2015-2016 The Khronos Group Inc.');
576 copyright.append(' * Copyright (c) 2015-2016 Valve Corporation.');
577 copyright.append(' * Copyright (c) 2015-2016 LunarG, Inc.');
578 copyright.append(' * Copyright (c) 2015-2016 Google Inc.');
579 copyright.append(' *');
580 … copyright.append(' * Permission is hereby granted, free of charge, to any person obtaining a');
581 …copyright.append(' * copy of this software and associated documentation files (the "Materials"),');
582 … copyright.append(' * to deal in the Materials without restriction, including without limitation');
583 … copyright.append(' * the rights to use, copy, modify, merge, publish, distribute, sublicense,');
584 … copyright.append(' * and/or sell copies of the Materials, and to permit persons to whom the');
585 … copyright.append(' * Materials is furnished to do so, subject to the following conditions:');
586 copyright.append(' *');
587 … copyright.append(' * The above copyright notice and this permission notice shall be included');
588 copyright.append(' * in all copies or substantial portions of the Materials.');
589 copyright.append(' *');
590 …copyright.append(' * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR'…
591 … copyright.append(' * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,');
592 copyright.append(' * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.');
593 copyright.append(' *');
594 …copyright.append(' * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,');
595 … copyright.append(' * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR');
596 … copyright.append(' * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE');
597 copyright.append(' * USE OR OTHER DEALINGS IN THE MATERIALS');
598 copyright.append(' *');
599 copyright.append(' * Author: Courtney Goeltzenleuchter <courtney@LunarG.com>');
600 copyright.append(' * Author: Tobin Ehlis <tobin@lunarg.com>');
601 copyright.append(' */');
602 copyright.append('');
607 header.append("//#includes, #defines, globals and such...\n")
608 …header.append("#include <stdio.h>\n#include <%s>\n#include <%s_enum_string_helper.h>\n" % (os.path…
614 class_def.append(self._generateDynamicPrintFunctions())
616 class_def.append("\n// %s class definition" % self.get_class_name(s))
617 class_def.append(self._generateConstructorDefinitions(s))
618 class_def.append(self._generateDestructorDefinitions(s))
619 class_def.append(self._generateDisplayDefinitions(s))
624 …con_defs.append("%s::%s() : m_struct(), m_indent(0), m_dummy_prefix('\\0'), m_origStructAddr(NULL)…
626 …con_defs.append("%s::%s(%s* pInStruct) : m_indent(0), m_dummy_prefix('\\0')\n{\n m_struct = *pI…
627 …con_defs.append("%s::%s(const %s* pInStruct) : m_indent(0), m_dummy_prefix('\\0')\n{\n m_struct…
635 …dp_funcs.append("\nvoid dynamic_display_full_txt(const void* pStruct, uint32_t indent)\n{\n // …
636 dp_funcs.append(" VkStructureType sType = ((VkApplicationInfo*)pStruct)->sType;\n")
637 dp_funcs.append(" switch (sType)\n {")
648 dp_funcs.append(" case %s:\n {" % (v))
649 … dp_funcs.append(" %s %s((%s*)pStruct);" % (class_name, instance_name, struct_name))
650 dp_funcs.append(" %s.set_indent(indent);" % (instance_name))
651 dp_funcs.append(" %s.display_full_txt();" % (instance_name))
652 dp_funcs.append(" }")
653 dp_funcs.append(" break;")
655 dp_funcs.append(" }")
656 dp_funcs.append("}\n")
736 …sh_funcs.append('char* %s(const %s* pStruct, const char* prefix);' % (self._get_sh_func_name(s), t…
737 sh_funcs.append('')
738 sh_funcs.append('#if defined(_WIN32)')
739 … sh_funcs.append('// Microsoft did not implement C99 in Visual Studio; but started adding it with')
740 … sh_funcs.append('// VS2013. However, VS2013 still did not have snprintf(). The following is a')
741 sh_funcs.append('// work-around.')
742 sh_funcs.append('#define snprintf _snprintf')
743 sh_funcs.append('#endif // _WIN32\n')
751 stp_list.append(self.struct_dict[s][m])
752 …sh_funcs.append('char* %s(const %s* pStruct, const char* prefix)\n{\n char* str;' % (self._get_…
753 sh_funcs.append(" size_t len;")
757 sh_funcs.append(" char* tmpStr;")
758 sh_funcs.append(' char* extra_indent = (char*)malloc(strlen(prefix) + 3);')
759 sh_funcs.append(' strcpy(extra_indent, " ");')
760 sh_funcs.append(' strncat(extra_indent, prefix, strlen(prefix));')
761 sh_funcs.append(' char* stp_strs[%i];' % num_stps)
770 sh_funcs.append(' if (pStruct->%s) {' % stp_list[index]['name'])
772 … sh_funcs.append(' tmpStr = dynamic_display((void*)pStruct->pNext, prefix);')
773 sh_funcs.append(' len = 256+strlen(tmpStr);')
774 sh_funcs.append(' stp_strs[%i] = (char*)malloc(len);' % index)
776 …sh_funcs.append(' snprintf(stp_strs[%i], len, " %%spNext (addr)\\n%%s", prefix, tmpStr);' %…
778 …sh_funcs.append(' snprintf(stp_strs[%i], len, " %%spNext (%%p)\\n%%s", prefix, (void*)pStru…
779 sh_funcs.append(' free(tmpStr);')
783 …sh_funcs.append(' tmpStr = %s(&pStruct->%s[0], extra_indent);' % (self._get_sh_func_name(st…
785 …sh_funcs.append(' tmpStr = %s(pStruct->%s, extra_indent);' % (self._get_sh_func_name(stp_li…
786 sh_funcs.append(' len = 256+strlen(tmpStr)+strlen(prefix);')
787 sh_funcs.append(' stp_strs[%i] = (char*)malloc(len);' % (index))
789 …sh_funcs.append(' snprintf(stp_strs[%i], len, " %%s%s (addr)\\n%%s", prefix, tmpStr);' % (i…
791 …sh_funcs.append(' snprintf(stp_strs[%i], len, " %%s%s (%%p)\\n%%s", prefix, (void*)pStruct-…
792 sh_funcs.append(' }')
793 sh_funcs.append(" else\n stp_strs[%i] = \"\";" % (index))
795 …sh_funcs.append(' tmpStr = %s(&pStruct->%s[0], extra_indent);' % (self._get_sh_func_name(stp_li…
796 sh_funcs.append(' len = 256+strlen(tmpStr);')
797 sh_funcs.append(' stp_strs[%i] = (char*)malloc(len);' % (index))
799 …sh_funcs.append(' snprintf(stp_strs[%i], len, " %%s%s[0] (addr)\\n%%s", prefix, tmpStr);' % (in…
801 …sh_funcs.append(' snprintf(stp_strs[%i], len, " %%s%s[0] (%%p)\\n%%s", prefix, (void*)&pStruct-…
803 …sh_funcs.append(' tmpStr = %s(&pStruct->%s, extra_indent);' % (self._get_sh_func_name(stp_list[…
804 sh_funcs.append(' len = 256+strlen(tmpStr);')
805 sh_funcs.append(' stp_strs[%i] = (char*)malloc(len);' % (index))
807 …sh_funcs.append(' snprintf(stp_strs[%i], len, " %%s%s (addr)\\n%%s", prefix, tmpStr);' % (index…
809 …sh_funcs.append(' snprintf(stp_strs[%i], len, " %%s%s (%%p)\\n%%s", prefix, (void*)&pStruct->%s…
811 sh_funcs.append(' len = %ssizeof(char)*1024;' % (total_strlen_str))
812 sh_funcs.append(' str = (char*)malloc(len);')
813 sh_funcs.append(' snprintf(str, len, "')
822 … sh_funcs.append(' for (int32_t stp_index = %i; stp_index >= 0; stp_index--) {' % (num_stps-1))
823 sh_funcs.append(' if (0 < strlen(stp_strs[stp_index])) {')
824 … sh_funcs.append(' strncat(str, stp_strs[stp_index], strlen(stp_strs[stp_index]));')
825 sh_funcs.append(' free(stp_strs[stp_index]);')
826 sh_funcs.append(' }')
827 sh_funcs.append(' }')
828 sh_funcs.append(' free(extra_indent);')
829 sh_funcs.append(" return str;\n}")
831 sh_funcs.append("char* dynamic_display(const void* pStruct, const char* prefix)\n{")
832 sh_funcs.append(" // Cast to APP_INFO ptr initially just to pull sType off struct")
833 sh_funcs.append(" if (pStruct == NULL) {")
834 sh_funcs.append(" return NULL;")
835 sh_funcs.append(" }")
836 sh_funcs.append(" VkStructureType sType = ((VkApplicationInfo*)pStruct)->sType;")
837 … sh_funcs.append(' char indent[100];\n strcpy(indent, " ");\n strcat(indent, prefix);')
838 sh_funcs.append(" switch (sType)\n {")
846 sh_funcs.append(' case %s:\n {' % (v))
847 … sh_funcs.append(' return %s((%s*)pStruct, indent);' % (print_func_name, struct_name))
848 sh_funcs.append(' }')
849 sh_funcs.append(' break;')
850 sh_funcs.append(" default:")
851 sh_funcs.append(" return NULL;")
852 sh_funcs.append(" }")
853 sh_funcs.append("}")
867 sh_funcs.append('%s' % lineinfo.get())
873 exclude_struct_list.append('VkXcbSurfaceCreateInfoKHR')
875 exclude_struct_list.append('VkWin32SurfaceCreateInfoKHR')
879 sh_funcs.append("#ifdef VK_USE_PLATFORM_XCB_KHR")
881 sh_funcs.append("#ifdef VK_USE_PLATFORM_WIN32_KHR")
882 …sh_funcs.append('string %s(const %s* pStruct, const string prefix);' % (self._get_sh_func_name(s),…
884 sh_funcs.append("#endif //VK_USE_PLATFORM_WIN32_KHR")
886 sh_funcs.append("#endif //VK_USE_PLATFORM_XCB_KHR")
887 sh_funcs.append('\n')
888 sh_funcs.append('%s' % lineinfo.get())
897 stp_list.append(self.struct_dict[s][m])
900 sh_funcs.append('%s' % lineinfo.get())
902 sh_funcs.append("#ifdef VK_USE_PLATFORM_XCB_KHR")
904 sh_funcs.append("#ifdef VK_USE_PLATFORM_WIN32_KHR")
905 …sh_funcs.append('string %s(const %s* pStruct, const string prefix)\n{' % (self._get_sh_func_name(s…
906 sh_funcs.append('%s' % lineinfo.get())
908 sh_funcs.append('%susing namespace StreamControl;' % (indent))
909 sh_funcs.append('%sstring final_str;' % (indent))
910 sh_funcs.append('%sstring tmp_str;' % (indent))
911 sh_funcs.append('%sstring extra_indent = " " + prefix;' % (indent))
913 sh_funcs.append('%sstringstream ss[%u];' % (indent, num_non_enum_elems))
917 sh_funcs.append('%sstring stp_strs[%u];' % (indent, num_stps))
924 sh_funcs.append('%s' % lineinfo.get())
926 sh_funcs.append('%s' % lineinfo.get())
929 sh_funcs.append('%s' % lineinfo.get())
931 sh_funcs.append('%s' % lineinfo.get())
932 sh_funcs.append('%sstp_strs[%u] = "";' % (indent, index))
934 sh_funcs.append('%sstringstream index_ss;' % (indent))
938 … sh_funcs.append('%sif (pStruct->imageSharingMode == VK_SHARING_MODE_CONCURRENT) {' % (indent))
940 … sh_funcs.append('%sif (pStruct->sharingMode == VK_SHARING_MODE_CONCURRENT) {' % (indent))
943 …sh_funcs.append('%sif ((pStruct->descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) ||' …
944 …sh_funcs.append('%s (pStruct->descriptorType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) ||' …
945 …sh_funcs.append('%s (pStruct->descriptorType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) ||' …
946 …sh_funcs.append('%s (pStruct->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE)) {'…
949 …sh_funcs.append('%sif ((pStruct->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER) ||' …
950 …sh_funcs.append('%s (pStruct->descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER) ||' …
951 …sh_funcs.append('%s (pStruct->descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC) ||' …
952 …sh_funcs.append('%s (pStruct->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC)) {'…
955 …sh_funcs.append('%sif ((pStruct->descriptorType == VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER) ||' % …
956 …sh_funcs.append('%s (pStruct->descriptorType == VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER)) {' %…
959 … sh_funcs.append('%sif (pStruct->%s) {' % (indent, stp_list[index]['name']))
961 … sh_funcs.append('%sfor (uint32_t i = 0; i < %s; i++) {' % (indent, array_count))
963 sh_funcs.append('%sindex_ss.str("");' % (indent))
964 sh_funcs.append('%sindex_ss << i;' % (indent))
966 sh_funcs.append('%s' % lineinfo.get())
969 …sh_funcs.append('%sss[%u] << string_%s(pStruct->%s[i]);' % (indent, index, stp_list[index]['type']…
970 …sh_funcs.append('%sstp_strs[%u] += " " + prefix + "%s[" + index_ss.str() + "] = " + ss[%u].str() +…
972 sh_funcs.append('%s' % lineinfo.get())
973 …sh_funcs.append('%sss[%u] << %spStruct->%s[i];' % (indent, index, addr_char, stp_list[index]['name…
974 …sh_funcs.append('%stmp_str = %s(%spStruct->%s[i], extra_indent);' % (indent, self._get_sh_func_nam…
976 sh_funcs.append('%s' % lineinfo.get())
977 …sh_funcs.append('%sstp_strs[%u] += " " + prefix + "%s[" + index_ss.str() + "] (addr)\\n" + tmp_str…
979 sh_funcs.append('%s' % lineinfo.get())
980 …sh_funcs.append('%sstp_strs[%u] += " " + prefix + "%s[" + index_ss.str() + "] (" + ss[%u].str() + …
982 sh_funcs.append('%s' % lineinfo.get())
984 …sh_funcs.append('%sss[%u] << %spStruct->%s[i];' % (indent, index, addr_char, stp_list[index]['name…
986 …sh_funcs.append('%sstp_strs[%u] += " " + prefix + "%s[" + index_ss.str() + "].handle = " + ss[%u].…
988 …sh_funcs.append('%sstp_strs[%u] += " " + prefix + "%s[" + index_ss.str() + "] = " + ss[%u].str() +…
989 sh_funcs.append('%s' % lineinfo.get())
990 sh_funcs.append('%sss[%u].str("");' % (indent, index))
992 sh_funcs.append('%s}' % (indent))
995 sh_funcs.append('%s}' % (indent))
999 sh_funcs.append('%s}' % (indent))
1001 sh_funcs.append('%s' % lineinfo.get())
1002 sh_funcs.append('%sif (pStruct->%s) {' % (indent, stp_list[index]['name']))
1005 sh_funcs.append('%s' % lineinfo.get())
1006 … sh_funcs.append(' tmp_str = dynamic_display((void*)pStruct->pNext, prefix);')
1010 sh_funcs.append('%s' % lineinfo.get())
1011 …sh_funcs.append(' tmp_str = %s(&pStruct->%s[0], extra_indent);' % (self._get_sh_func_name(s…
1013 sh_funcs.append('%s' % lineinfo.get())
1014 …sh_funcs.append(' tmp_str = %s(pStruct->%s, extra_indent);' % (self._get_sh_func_name(stp_l…
1015 … sh_funcs.append(' ss[%u] << %spStruct->%s;' % (index, addr_char, stp_list[index]['name']))
1017 sh_funcs.append('%s' % lineinfo.get())
1018 …sh_funcs.append(' stp_strs[%u] = " " + prefix + "%s (addr)\\n" + tmp_str;' % (index, stp_li…
1020 sh_funcs.append('%s' % lineinfo.get())
1021 …sh_funcs.append(' stp_strs[%u] = " " + prefix + "%s (" + ss[%u].str() + ")\\n" + tmp_str;' …
1022 sh_funcs.append(' ss[%u].str("");' % (index))
1023 sh_funcs.append(' }')
1024 sh_funcs.append(' else')
1025 sh_funcs.append(' stp_strs[%u] = "";' % index)
1027 sh_funcs.append('%s' % lineinfo.get())
1028 …sh_funcs.append(' tmp_str = %s(&pStruct->%s, extra_indent);' % (self._get_sh_func_name(stp_list…
1029 … sh_funcs.append(' ss[%u] << %spStruct->%s;' % (index, addr_char, stp_list[index]['name']))
1031 …sh_funcs.append(' stp_strs[%u] = " " + prefix + "%s (addr)\\n" + tmp_str;' % (index, stp_list[i…
1032 sh_funcs.append('%s' % lineinfo.get())
1034 …sh_funcs.append(' stp_strs[%u] = " " + prefix + "%s (" + ss[%u].str() + ")\\n" + tmp_str;' % (i…
1035 sh_funcs.append('%s' % lineinfo.get())
1036 sh_funcs.append(' ss[%u].str("");' % index)
1044 sh_funcs.append('%s' % lineinfo.get())
1045 sh_funcs.append(' ss[%u].str("addr");' % (index))
1047 sh_funcs.append('%s' % lineinfo.get())
1048 … sh_funcs.append(' ss[%u] << &pStruct->%s;' % (index, self.struct_dict[s][m]['name']))
1050 sh_funcs.append('%s' % lineinfo.get())
1051 … sh_funcs.append(' ss[%u] << (void*)pStruct->%s;' % (index, self.struct_dict[s][m]['name']))
1053 sh_funcs.append('%s' % lineinfo.get())
1054 …sh_funcs.append(' ss[%u].str(pStruct->%s ? "TRUE" : "FALSE");' % (index, self.struct_dict[s][m]…
1056 sh_funcs.append('%s' % lineinfo.get())
1057 … sh_funcs.append(' ss[%u] << pStruct->%s;' % (index, self.struct_dict[s][m]['name']))
1059 sh_funcs.append('%s' % lineinfo.get())
1060 sh_funcs.append(' if (StreamControl::writeAddress)')
1061 … sh_funcs.append(' ss[%u] << pStruct->%s;' % (index, self.struct_dict[s][m]['name']))
1062 sh_funcs.append(' else')
1063 sh_funcs.append(' ss[%u].str("address");' % (index))
1065 sh_funcs.append('%s' % lineinfo.get())
1066 … sh_funcs.append(' if (pStruct->%s != NULL) {' % self.struct_dict[s][m]['name'])
1067 … sh_funcs.append(' ss[%u] << pStruct->%s;' % (index, self.struct_dict[s][m]['name']))
1068 sh_funcs.append(' } else {')
1069 sh_funcs.append(' ss[%u] << "";' % index)
1070 sh_funcs.append(' }')
1072 sh_funcs.append('%s' % lineinfo.get())
1075 sh_funcs.append(' ss[%u].str("addr");' % (index))
1077 … sh_funcs.append(' ss[%u] << pStruct->%s;' % (index, self.struct_dict[s][m]['name']))
1079 … sh_funcs.append(' ss[%u] << pStruct->%s;' % (index, self.struct_dict[s][m]['name']))
1085 sh_funcs.append('%s' % lineinfo.get())
1086 sh_funcs.append(' if (pStruct->%s)' % (self.struct_dict[s][m]['name']))
1087 …sh_funcs.append(' ss[%u] << pStruct->%s << " (See individual array values below)";' % (inde…
1088 sh_funcs.append(' else')
1089 sh_funcs.append(' ss[%u].str("NULL");' % (index))
1099 sh_funcs.append('%s' % lineinfo.get())
1100 sh_funcs.append(' final_str = %s;' % final_str)
1101 sh_funcs.append(' return final_str;\n}')
1103 sh_funcs.append("#endif //VK_USE_PLATFORM_WIN32_KHR")
1105 sh_funcs.append("#endif //VK_USE_PLATFORM_XCB_KHR")
1107 sh_funcs.append('%s' % lineinfo.get())
1108 … sh_funcs.append("string string_convert_helper(const void* toString, const string prefix)\n{")
1109 sh_funcs.append(" using namespace StreamControl;")
1110 sh_funcs.append(" stringstream ss;")
1111 sh_funcs.append(' ss << toString;')
1112 sh_funcs.append(' string final_str = prefix + ss.str();')
1113 sh_funcs.append(" return final_str;")
1114 sh_funcs.append("}")
1115 sh_funcs.append('%s' % lineinfo.get())
1117 … sh_funcs.append("string string_convert_helper(const uint64_t toString, const string prefix)\n{")
1118 sh_funcs.append(" using namespace StreamControl;")
1119 sh_funcs.append(" stringstream ss;")
1120 sh_funcs.append(' ss << toString;')
1121 sh_funcs.append(' string final_str = prefix + ss.str();')
1122 sh_funcs.append(" return final_str;")
1123 sh_funcs.append("}")
1124 sh_funcs.append('%s' % lineinfo.get())
1126 …sh_funcs.append("string string_convert_helper(VkSurfaceFormatKHR toString, const string prefix)\n{…
1127 …sh_funcs.append(' string final_str = prefix + "format = " + string_VkFormat(toString.format) + …
1128 sh_funcs.append(" return final_str;")
1129 sh_funcs.append("}")
1130 sh_funcs.append('%s' % lineinfo.get())
1132 sh_funcs.append("string dynamic_display(const void* pStruct, const string prefix)\n{")
1133 sh_funcs.append(" // Cast to APP_INFO ptr initially just to pull sType off struct")
1134 sh_funcs.append(" if (pStruct == NULL) {\n")
1135 sh_funcs.append(" return string();")
1136 sh_funcs.append(" }\n")
1137 sh_funcs.append(" VkStructureType sType = ((VkApplicationInfo*)pStruct)->sType;")
1138 sh_funcs.append(' string indent = " ";')
1139 sh_funcs.append(' indent += prefix;')
1140 sh_funcs.append(" switch (sType)\n {")
1149 sh_funcs.append(' case %s:\n {' % (v))
1150 … sh_funcs.append(' return %s((%s*)pStruct, indent);' % (print_func_name, struct_name))
1151 sh_funcs.append(' }')
1152 sh_funcs.append(' break;')
1153 sh_funcs.append(" default:")
1154 sh_funcs.append(" return string();")
1155 sh_funcs.append('%s' % lineinfo.get())
1156 sh_funcs.append(" }")
1157 sh_funcs.append("}")
1177 disp_def.append("// Output 'structname = struct_address' on a single line")
1178 disp_def.append("void %s::display_single_txt()\n{" % self.get_class_name(s))
1179 …disp_def.append(' printf(" %%*s%s = %%p", m_indent, "", (void*)m_origStructAddr);' % typedef_fw…
1180 disp_def.append("}\n")
1182 … disp_def.append("// Private helper function that displays the members of the wrapped struct")
1183 disp_def.append("void %s::display_struct_members()\n{" % self.get_class_name(s))
1193 disp_def.append(' uint32_t i;')
1195 … disp_def.append(' for (i = 0; i<%s; i++) {' % self.struct_dict[s][member]['array_size'])
1197 disp_def.append(return_str)
1198 disp_def.append(' }')
1201 disp_def.append(return_str)
1202 disp_def.append("}\n")
1205 disp_def.append("// Output all struct elements, each on their own line")
1206 disp_def.append("void %s::display_txt()\n{" % self.get_class_name(s))
1207 …disp_def.append(' printf("%%*s%s struct contents at %%p:\\n", m_indent, "", (void*)m_origStruct…
1208 disp_def.append(' this->display_struct_members();')
1209 disp_def.append("}\n")
1211 …disp_def.append("// Output all struct elements, and for any structs pointed to, print complete con…
1212 disp_def.append("void %s::display_full_txt()\n{" % self.get_class_name(s))
1213 …disp_def.append(' printf("%%*s%s struct contents at %%p:\\n", m_indent, "", (void*)m_origStruct…
1214 disp_def.append(' this->display_struct_members();')
1221 disp_def.append(' uint32_t i;')
1223 disp_def.append(' for (i = 0; i<%s; i++) {' % ms['array_size'])
1225 …disp_def.append(" %s %s(&(m_struct.%s[i]));" % (self.get_class_name(ms['type']), swc_na…
1226 disp_def.append(" %s.set_indent(m_indent + 4);" % (swc_name))
1227 disp_def.append(" %s.display_full_txt();" % (swc_name))
1229 disp_def.append(' }')
1235 disp_def.append(" if (m_struct.%s) {" % (ms['name']))
1237 … disp_def.append(' dynamic_display_full_txt(m_struct.%s, m_indent);' % (ms['name']))
1238 disp_def.append(" }")
1241 disp_def.append(" if (m_struct.%s) {" % (ms['name']))
1242 …disp_def.append(" %s %s(m_struct.%s);" % (self.get_class_name(ms['type']), swc_name, ms['na…
1244 disp_def.append(" if (&m_struct.%s) {" % (ms['name']))
1245 …disp_def.append(" %s %s(&m_struct.%s);" % (self.get_class_name(ms['type']), swc_name, ms['n…
1246 disp_def.append(" %s.set_indent(m_indent + 4);" % (swc_name))
1247 disp_def.append(" %s.display_full_txt();\n }" % (swc_name))
1249 disp_def.append("}\n")
1254 header.append("//#includes, #defines, globals and such...\n")
1257 header.append("#include <%s>\n" % f)
1258 header.append('#include "vk_enum_string_helper.h"\n\n// Function Prototypes\n')
1259 header.append("char* dynamic_display(const void* pStruct, const char* prefix);\n")
1264 header.append("//#includes, #defines, globals and such...\n")
1267 header.append("#include <%s>\n" % f)
1268 header.append('#include "vk_enum_string_helper.h"\n')
1269 header.append('using namespace std;\n\n// Function Prototypes\n')
1270 header.append('\n')
1271 header.append('namespace StreamControl\n')
1272 header.append('{\n')
1273 header.append('bool writeAddress = true;\n')
1274 header.append('template <typename T>\n')
1275 header.append('std::ostream& operator<< (std::ostream &out, T const* pointer)\n')
1276 header.append('{\n')
1277 header.append(' if(writeAddress)\n')
1278 header.append(' {\n')
1279 header.append(' out.operator<<(pointer);\n')
1280 header.append(' }\n')
1281 header.append(' else\n')
1282 header.append(' {\n')
1283 header.append(' std::operator<<(out, "address");\n')
1284 header.append(' }\n')
1285 header.append(' return out;\n')
1286 header.append('}\n')
1287 header.append('std::ostream& operator<<(std::ostream &out, char const*const s)\n')
1288 header.append('{\n')
1289 header.append(' return std::operator<<(out, s);\n')
1290 header.append('}\n')
1291 header.append('}\n')
1292 header.append('\n')
1293 header.append("string dynamic_display(const void* pStruct, const string prefix);\n")
1304 exclude_struct_list.append('VkXcbSurfaceCreateInfoKHR')
1306 exclude_struct_list.append('VkWin32SurfaceCreateInfoKHR')
1310 sh_funcs.append("#ifdef VK_USE_PLATFORM_XCB_KHR")
1312 sh_funcs.append("#ifdef VK_USE_PLATFORM_WIN32_KHR")
1313 …sh_funcs.append('uint32_t %s(const %s* pStruct);' % (self._get_vh_func_name(s), typedef_fwd_dict[s…
1315 sh_funcs.append("#endif //VK_USE_PLATFORM_WIN32_KHR")
1317 sh_funcs.append("#endif //VK_USE_PLATFORM_XCB_KHR")
1318 sh_funcs.append('\n')
1323 sh_funcs.append("#ifdef VK_USE_PLATFORM_XCB_KHR")
1325 sh_funcs.append("#ifdef VK_USE_PLATFORM_WIN32_KHR")
1326 …sh_funcs.append('uint32_t %s(const %s* pStruct)\n{' % (self._get_vh_func_name(s), typedef_fwd_dict…
1330 …sh_funcs.append(' if (!validate_%s(pStruct->%s))\n return 0;' % (self.struct_dict[s][m][…
1334 …sh_funcs.append(' if (pStruct->%s && !%s((const %s*)pStruct->%s))\n return 0;' % (self.s…
1336 …sh_funcs.append(' if (!%s((const %s*)&pStruct->%s))\n return 0;' % (self._get_vh_func_na…
1337 sh_funcs.append(" return 1;\n}")
1339 sh_funcs.append("#endif //VK_USE_PLATFORM_WIN32_KHR")
1341 sh_funcs.append("#endif //VK_USE_PLATFORM_XCB_KHR")
1347 header.append("//#includes, #defines, globals and such...\n")
1350 header.append("#include <%s>\n" % f)
1351 header.append('#include "vk_enum_validate_helper.h"\n\n// Function Prototypes\n')
1363 exclude_struct_list.append('VkXcbSurfaceCreateInfoKHR')
1365 exclude_struct_list.append('VkWin32SurfaceCreateInfoKHR')
1369 sh_funcs.append("#ifdef VK_USE_PLATFORM_XCB_KHR")
1371 sh_funcs.append("#ifdef VK_USE_PLATFORM_WIN32_KHR")
1372 …sh_funcs.append('size_t %s(const %s* pStruct);' % (self._get_size_helper_func_name(s), typedef_fwd…
1374 sh_funcs.append("#endif //VK_USE_PLATFORM_WIN32_KHR")
1376 sh_funcs.append("#endif //VK_USE_PLATFORM_XCB_KHR")
1388 exclude_struct_list.append('VkXcbSurfaceCreateInfoKHR')
1390 exclude_struct_list.append('VkWin32SurfaceCreateInfoKHR')
1395 …sh_funcs.append('size_t %s(const %s* pStruct)\n{' % (self._get_size_helper_func_name(s), typedef_f…
1397 sh_funcs.append('%ssize_t structSize = 0;' % (indent))
1398 sh_funcs.append('%sif (pStruct) {' % (indent))
1400 sh_funcs.append('%sstructSize = sizeof(%s);' % (indent, typedef_fwd_dict[s]))
1410 …sh_funcs.append('%sstructSize += pStruct->%s*(sizeof(%s*) + sizeof(VkImageMemoryBarrier));' % (ind…
1412 …sh_funcs.append('%sstructSize += pStruct->%s*(sizeof(%s*) + sizeof(%s));' % (indent, self.struct_d…
1415 sh_funcs.append('%suint32_t i = 0;' % (indent))
1417 …sh_funcs.append('%sfor (i = 0; i < pStruct->%s; i++) {' % (indent, self.struct_dict[s][m]['array_s…
1420 …sh_funcs.append('%sstructSize += (sizeof(%s*) + %s(pStruct->%s[i]));' % (indent, self.struct_dict[…
1422 …sh_funcs.append('%sstructSize += (sizeof(char*) + (sizeof(char) * (1 + strlen(pStruct->%s[i]))));'…
1424 sh_funcs.append('%s}' % (indent))
1428 sh_funcs.append('%suint32_t i = 0;' % (indent))
1430 …sh_funcs.append('%sfor (i = 0; i < pStruct->%s; i++) {' % (indent, self.struct_dict[s][m]['array_s…
1432 …sh_funcs.append('%sstructSize += %s(&pStruct->%s[i]);' % (indent, self._get_size_helper_func_name(…
1434 sh_funcs.append('%s}' % (indent))
1436 …sh_funcs.append('%sstructSize += pStruct->%s*sizeof(%s);' % (indent, self.struct_dict[s][m]['array…
1439 …sh_funcs.append('%sstructSize += (pStruct->%s != NULL) ? sizeof(%s)*(1+strlen(pStruct->%s)) : 0;' …
1441 …sh_funcs.append('%sstructSize += %s(pStruct->%s);' % (indent, self._get_size_helper_func_name(self…
1444 … sh_funcs.append('%sstructSize += sizeof(%s);' % (indent, self.struct_dict[s][m]['type']))
1446 … sh_funcs.append('%sstructSize += pStruct->%s;' % (indent, self.struct_dict[s][m]['name']))
1447 skip_list.append(m+1)
1449 sh_funcs.append('%s}' % (indent))
1450 sh_funcs.append("%sreturn structSize;\n}" % (indent))
1454 sh_funcs.append('%s' % self.lineinfo.get())
1456 sh_funcs.append('size_t get_struct_chain_size(const void* pStruct)\n{')
1458 sh_funcs.append('size_t get_dynamic_struct_size(const void* pStruct)\n{')
1460 …sh_funcs.append('%s// Just use VkApplicationInfo as struct until actual type is resolved' % (inden…
1461 … sh_funcs.append('%sVkApplicationInfo* pNext = (VkApplicationInfo*)pStruct;' % (indent))
1462 sh_funcs.append('%ssize_t structSize = 0;' % (indent))
1464 sh_funcs.append('%swhile (pNext) {' % (indent))
1466 sh_funcs.append('%sswitch (pNext->sType) {' % (indent))
1475 sh_funcs.append('%scase %s:' % (indent, v))
1476 sh_funcs.append('%s{' % (indent))
1478 …sh_funcs.append('%sstructSize += %s((%s*)pNext);' % (indent, self._get_size_helper_func_name(struc…
1479 sh_funcs.append('%sbreak;' % (indent))
1481 sh_funcs.append('%s}' % (indent))
1482 sh_funcs.append('%sdefault:' % (indent))
1484 sh_funcs.append('%sassert(0);' % (indent))
1485 sh_funcs.append('%sstructSize += 0;' % (indent))
1488 sh_funcs.append('%s}' % (indent))
1490 sh_funcs.append('%spNext = (VkApplicationInfo*)pNext->pNext;' % (indent))
1492 sh_funcs.append('%s}' % (indent))
1493 sh_funcs.append('%sreturn structSize;\n}' % indent)
1498 header.append("//#includes, #defines, globals and such...\n")
1500 header.append("#include <%s>\n" % f)
1501 header.append('\n// Function Prototypes\n')
1502 header.append("size_t get_struct_chain_size(const void* pStruct);\n")
1503 header.append("size_t get_dynamic_struct_size(const void* pStruct);\n")
1508 header.append('#include "vk_struct_size_helper.h"')
1509 header.append('#include <string.h>')
1510 header.append('#include <assert.h>')
1511 header.append('\n// Function definitions\n')
1517 header.append("//#includes, #defines, globals and such...\n")
1519 header.append("#include <%s>\n" % f)
1525 constructors.append(" %s();\n" % self.get_class_name(s))
1526 … constructors.append(" %s(%s* pInStruct);\n" % (self.get_class_name(s), typedef_fwd_dict[s]))
1527 …constructors.append(" %s(const %s* pInStruct);\n" % (self.get_class_name(s), typedef_fwd_dict[s…
1538 get_set.append(" void set_indent(uint32_t indent) { m_indent = indent; }\n")
1543 …get_set.append(" %s get_%s() { return m_struct.%s; }\n" % (self.struct_dict[s][member]['full_ty…
1545 …get_set.append(" void set_%s(%s inValue) { m_struct.%s = inValue; }\n" % (self.struct_dict[s][m…
1550 priv.append("\nprivate:\n")
1551 priv.append(" %s m_struct;\n" % typedef_fwd_dict[s])
1552 priv.append(" const %s* m_origStructAddr;\n" % typedef_fwd_dict[s])
1553 priv.append(" uint32_t m_indent;\n")
1554 priv.append(" const char m_dummy_prefix;\n")
1555 priv.append(" void display_struct_members();\n")
1561 class_decl.append("\n//class declaration")
1562 class_decl.append("class %s\n{\npublic:" % self.get_class_name(s))
1563 class_decl.append(self._generateConstructorDeclarations(s))
1564 class_decl.append(self._generateDestructorDeclarations(s))
1565 class_decl.append(self._generateDisplayDeclarations(s))
1566 class_decl.append(self._generateGetSetDeclarations(s))
1567 class_decl.append(self._generatePrivateMembers(s))
1568 class_decl.append("};\n")
1591 header.append("//#includes, #defines, globals and such...\n")
1592 header.append('#include "vulkan/vulkan.h"')
1611 ss_decls.append('#ifdef %s' % ifdef_dict[s])
1613 ss_decls.append("\nstruct %s {" % (ss_name))
1619 …ss_decls.append(" %s %s[%s];" % (m_type, self.struct_dict[s][m]['name'], self.struct_dict[s][m]…
1621 …ss_decls.append(" %s %s;" % (self.struct_dict[s][m]['full_type'], self.struct_dict[s][m]['name'…
1623 ss_decls.append(" %s* %s;" % (m_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']))
1628 ss_decls.append(" %s(const %s* pInStruct);" % (ss_name, s))
1629 ss_decls.append(" %s();" % (ss_name))
1630 ss_decls.append(" ~%s();" % (ss_name))
1631 ss_decls.append(" void initialize(const %s* pInStruct);" % (s))
1632 ss_decls.append("};")
1634 ss_decls.append('#endif')
1639 header.append("//#includes, #defines, globals and such...\n")
1640 header.append('#include "vk_safe_struct.h"')
1649 ss_src.append('#ifdef %s' % ifdef_dict[s])
1737 …ss_src.append("\n%s::%s(const %s* pInStruct) : %s\n{\n%s}" % (ss_name, ss_name, s, init_list, cons…
1738 ss_src.append("\n%s::%s() {}" % (ss_name, ss_name))
1739 ss_src.append("\n%s::~%s()\n{\n%s}" % (ss_name, ss_name, destruct_txt))
1740 …ss_src.append("\nvoid %s::initialize(const %s* pInStruct)\n{\n%s%s}" % (ss_name, s, init_func_txt,…
1742 ss_src.append('#endif')
1770 body.append("static inline uint32_t validate_%s(%s input_value)\n{" % (fet, fet))
1773 body.append(' if (input_value > (%s))' % (' | '.join(self.et_dict[bet])))
1774 body.append(' return 0;')
1775 body.append(' return 1;')
1776 body.append('}\n\n')
1778 body.append(' switch ((%s)input_value)\n {' % (fet))
1781 body.append(' case %s:' % (e))
1782 … body.append(' return 1;\n default:\n return 0;\n }\n}\n\n')
1791 …body.append("static inline const char* string_%s(%s input_value)\n{\n switch ((%s)input_value)\…
1794 body.append(' case %s:\n return "%s";' % (e, e))
1795 … body.append(' default:\n return "Unhandled %s";\n }\n}\n\n' % (fet))
1800 header.append('#pragma once\n')
1801 header.append('#ifdef _WIN32\n')
1802 header.append('#pragma warning( disable : 4065 )\n')
1803 header.append('#endif\n')
1804 header.append('#include <vulkan/%s>\n\n\n' % self.in_file)
1823 body.append("project(%s)" % os.path.basename(self.out_dir))
1824 body.append("cmake_minimum_required(VERSION 2.8)\n")
1825 body.append("add_library(${PROJECT_NAME} %s)\n" % " ".join(self.add_lib_file_list))
1826 body.append('set(COMPILE_FLAGS "-fpermissive")')
1827 body.append('set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILE_FLAGS}")\n')
1828 body.append("include_directories(${SRC_DIR}/thirdparty/${GEN_API}/inc/)\n")
1829 …body.append("target_include_directories (%s PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})\n" % os.path.basen…
1855 header.append("//#includes, #defines, globals and such...\n")
1858 header.append("#include <%s>\n" % f)
1860 header.append("\nchar* dynamic_gv_display(const void* pStruct, const char* prefix);\n")
1926 array_func_list.append('vkbufferviewattachinfo')
1927 array_func_list.append('vkimageviewattachinfo')
1928 array_func_list.append('vksamplerimageviewinfo')
1929 array_func_list.append('vkdescriptortypecount')
1932 …gv_funcs.append('char* %s(const %s* pStruct, const char* myNodeName);\n' % (self._get_gv_func_name…
1935 …gv_funcs.append('char* %s_array(uint32_t count, const %s* const* pStruct, const char* myNodeName);…
1937 …gv_funcs.append('char* %s_array(uint32_t count, const %s* pStruct, const char* myNodeName);\n' % (…
1938 gv_funcs.append('\n')
1949 stp_list.append(self.struct_dict[s][m])
1955 …gv_funcs.append('char* %s(const %s* pStruct, const char* myNodeName)\n{\n char* str;\n' % (self…
1959 gv_funcs.append(" char* tmpStr;\n")
1960 gv_funcs.append(" char nodeName[100];\n")
1961 gv_funcs.append(' char* stp_strs[%i];\n' % num_stps)
1965 … gv_funcs.append(' if (pStruct->pDescriptorInfo && (0 != pStruct->descriptorCount)) {\n')
1967 gv_funcs.append(' if (pStruct->%s) {\n' % stp_list[index]['name'])
1969 … gv_funcs.append(' sprintf(nodeName, "pNext_%p", (void*)pStruct->pNext);\n')
1970 … gv_funcs.append(' tmpStr = dynamic_gv_display((void*)pStruct->pNext, nodeName);\n')
1971 …gv_funcs.append(' stp_strs[%i] = (char*)malloc(256+strlen(tmpStr)+strlen(nodeName)+strlen(m…
1972 …gv_funcs.append(' sprintf(stp_strs[%i], "%%s\\n\\"%%s\\":pNext -> \\"%%s\\" [];\\n", tmpStr…
1973 gv_funcs.append(' free(tmpStr);\n')
1975 …gv_funcs.append(' sprintf(nodeName, "%s_%%p", (void*)pStruct->%s);\n' % (stp_list[index]['n…
1977 …gv_funcs.append(' tmpStr = %s_array(pStruct->count, pStruct->%s, nodeName);\n' % (self._get…
1979 …gv_funcs.append(' tmpStr = %s(pStruct->%s, nodeName);\n' % (self._get_gv_func_name(stp_list…
1980 …gv_funcs.append(' stp_strs[%i] = (char*)malloc(256+strlen(tmpStr)+strlen(nodeName)+strlen(m…
1981 …gv_funcs.append(' sprintf(stp_strs[%i], "%%s\\n\\"%%s\\":struct%i -> \\"%%s\\" [];\\n", tmp…
1982 gv_funcs.append(' }\n')
1983 gv_funcs.append(" else\n stp_strs[%i] = \"\";\n" % (index))
1985 …gv_funcs.append(' sprintf(nodeName, "%s_%%p", (void*)&pStruct->%s[0]);\n' % (stp_list[index]['n…
1986 …gv_funcs.append(' tmpStr = %s(&pStruct->%s[0], nodeName);\n' % (self._get_gv_func_name(stp_list…
1987 …gv_funcs.append(' stp_strs[%i] = (char*)malloc(256+strlen(tmpStr)+strlen(nodeName)+strlen(myNod…
1988 …gv_funcs.append(' sprintf(stp_strs[%i], "%%s\\n\\"%%s\\":struct%i -> \\"%%s\\" [];\\n", tmpStr,…
1990 …gv_funcs.append(' sprintf(nodeName, "%s_%%p", (void*)&pStruct->%s);\n' % (stp_list[index]['name…
1991 …gv_funcs.append(' tmpStr = %s(&pStruct->%s, nodeName);\n' % (self._get_gv_func_name(stp_list[in…
1992 …gv_funcs.append(' stp_strs[%i] = (char*)malloc(256+strlen(tmpStr)+strlen(nodeName)+strlen(myNod…
1993 …gv_funcs.append(' sprintf(stp_strs[%i], "%%s\\n\\"%%s\\":struct%i -> \\"%%s\\" [];\\n", tmpStr,…
1995 gv_funcs.append(' str = (char*)malloc(%ssizeof(char)*2048);\n' % (total_strlen_str))
1996 …gv_funcs.append(' sprintf(str, "\\"%s\\" [\\nlabel = <<TABLE BORDER=\\"0\\" CELLBORDER=\\"1\\" …
2007 gv_funcs.append(p_out)
2008 gv_funcs.append(p_args)
2010 …gv_funcs.append(' for (int32_t stp_index = %i; stp_index >= 0; stp_index--) {\n' % (num_stps-1))
2011 gv_funcs.append(' if (0 < strlen(stp_strs[stp_index])) {\n')
2012 … gv_funcs.append(' strncat(str, stp_strs[stp_index], strlen(stp_strs[stp_index]));\n')
2013 gv_funcs.append(' free(stp_strs[stp_index]);\n')
2014 gv_funcs.append(' }\n')
2015 gv_funcs.append(' }\n')
2016 gv_funcs.append(" return str;\n}\n")
2021 …gv_funcs.append('char* %s_array(uint32_t count, const %s* const* pStruct, const char* myNodeName)\…
2023 …gv_funcs.append('char* %s_array(uint32_t count, const %s* pStruct, const char* myNodeName)\n{\n …
2024 gv_funcs.append(' str = (char*)malloc(sizeof(char)*1024*count);\n')
2025 …gv_funcs.append(' sprintf(str, "\\"%s\\" [\\nlabel = <<TABLE BORDER=\\"0\\" CELLBORDER=\\"1\\" …
2026 gv_funcs.append(' for (uint32_t i=0; i < count; i++) {\n')
2027 gv_funcs.append(' sprintf(tmpStr, "');
2044 gv_funcs.append(p_out);
2045 gv_funcs.append(p_args);
2046 gv_funcs.append(' strncat(str, tmpStr, strlen(tmpStr));\n')
2047 gv_funcs.append(' }\n')
2048 gv_funcs.append(' strncat(str, "</TABLE>>\\n];\\n\\n", 20);\n')
2049 gv_funcs.append(' return str;\n}\n')
2051 gv_funcs.append("char* dynamic_gv_display(const void* pStruct, const char* nodeName)\n{\n")
2052 gv_funcs.append(" // Cast to APP_INFO ptr initially just to pull sType off struct\n")
2053 gv_funcs.append(" VkStructureType sType = ((VkApplicationInfo*)pStruct)->sType;\n")
2054 gv_funcs.append(" switch (sType)\n {\n")
2072 gv_funcs.append(' case %s:\n' % (v))
2073 …gv_funcs.append(' return %s((%s*)pStruct, nodeName);\n' % (print_func_name, struct_name…
2076 gv_funcs.append(" default:\n")
2077 gv_funcs.append(" return NULL;\n")
2078 gv_funcs.append(" }\n")
2079 gv_funcs.append("}")