gles_builders.py 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. """Functions used to generate source files during build time
  2. All such functions are invoked in a subprocess on Windows to prevent build flakiness.
  3. """
  4. from platform_methods import subprocess_main
  5. class LegacyGLHeaderStruct:
  6. def __init__(self):
  7. self.vertex_lines = []
  8. self.fragment_lines = []
  9. self.uniforms = []
  10. self.attributes = []
  11. self.feedbacks = []
  12. self.fbos = []
  13. self.conditionals = []
  14. self.enums = {}
  15. self.texunits = []
  16. self.texunit_names = []
  17. self.ubos = []
  18. self.ubo_names = []
  19. self.vertex_included_files = []
  20. self.fragment_included_files = []
  21. self.reading = ""
  22. self.line_offset = 0
  23. self.vertex_offset = 0
  24. self.fragment_offset = 0
  25. def include_file_in_legacygl_header(filename, header_data, depth):
  26. fs = open(filename, "r")
  27. line = fs.readline()
  28. while line:
  29. if line.find("[vertex]") != -1:
  30. header_data.reading = "vertex"
  31. line = fs.readline()
  32. header_data.line_offset += 1
  33. header_data.vertex_offset = header_data.line_offset
  34. continue
  35. if line.find("[fragment]") != -1:
  36. header_data.reading = "fragment"
  37. line = fs.readline()
  38. header_data.line_offset += 1
  39. header_data.fragment_offset = header_data.line_offset
  40. continue
  41. while line.find("#include ") != -1:
  42. includeline = line.replace("#include ", "").strip()[1:-1]
  43. import os.path
  44. included_file = os.path.relpath(os.path.dirname(filename) + "/" + includeline)
  45. if not included_file in header_data.vertex_included_files and header_data.reading == "vertex":
  46. header_data.vertex_included_files += [included_file]
  47. if include_file_in_legacygl_header(included_file, header_data, depth + 1) is None:
  48. print("Error in file '" + filename + "': #include " + includeline + "could not be found!")
  49. elif not included_file in header_data.fragment_included_files and header_data.reading == "fragment":
  50. header_data.fragment_included_files += [included_file]
  51. if include_file_in_legacygl_header(included_file, header_data, depth + 1) is None:
  52. print("Error in file '" + filename + "': #include " + includeline + "could not be found!")
  53. line = fs.readline()
  54. if line.find("#ifdef ") != -1:
  55. if line.find("#ifdef ") != -1:
  56. ifdefline = line.replace("#ifdef ", "").strip()
  57. if line.find("_EN_") != -1:
  58. enumbase = ifdefline[: ifdefline.find("_EN_")]
  59. ifdefline = ifdefline.replace("_EN_", "_")
  60. line = line.replace("_EN_", "_")
  61. if enumbase not in header_data.enums:
  62. header_data.enums[enumbase] = []
  63. if ifdefline not in header_data.enums[enumbase]:
  64. header_data.enums[enumbase].append(ifdefline)
  65. elif not ifdefline in header_data.conditionals:
  66. header_data.conditionals += [ifdefline]
  67. if line.find("uniform") != -1 and line.lower().find("texunit:") != -1:
  68. # texture unit
  69. texunitstr = line[line.find(":") + 1 :].strip()
  70. if texunitstr == "auto":
  71. texunit = "-1"
  72. else:
  73. texunit = str(int(texunitstr))
  74. uline = line[: line.lower().find("//")]
  75. uline = uline.replace("uniform", "")
  76. uline = uline.replace("highp", "")
  77. uline = uline.replace(";", "")
  78. lines = uline.split(",")
  79. for x in lines:
  80. x = x.strip()
  81. x = x[x.rfind(" ") + 1 :]
  82. if x.find("[") != -1:
  83. # unfiorm array
  84. x = x[: x.find("[")]
  85. if not x in header_data.texunit_names:
  86. header_data.texunits += [(x, texunit)]
  87. header_data.texunit_names += [x]
  88. elif line.find("uniform") != -1 and line.lower().find("ubo:") != -1:
  89. # uniform buffer object
  90. ubostr = line[line.find(":") + 1 :].strip()
  91. ubo = str(int(ubostr))
  92. uline = line[: line.lower().find("//")]
  93. uline = uline[uline.find("uniform") + len("uniform") :]
  94. uline = uline.replace("highp", "")
  95. uline = uline.replace(";", "")
  96. uline = uline.replace("{", "").strip()
  97. lines = uline.split(",")
  98. for x in lines:
  99. x = x.strip()
  100. x = x[x.rfind(" ") + 1 :]
  101. if x.find("[") != -1:
  102. # unfiorm array
  103. x = x[: x.find("[")]
  104. if not x in header_data.ubo_names:
  105. header_data.ubos += [(x, ubo)]
  106. header_data.ubo_names += [x]
  107. elif line.find("uniform") != -1 and line.find("{") == -1 and line.find(";") != -1:
  108. uline = line.replace("uniform", "")
  109. uline = uline.replace(";", "")
  110. lines = uline.split(",")
  111. for x in lines:
  112. x = x.strip()
  113. x = x[x.rfind(" ") + 1 :]
  114. if x.find("[") != -1:
  115. # unfiorm array
  116. x = x[: x.find("[")]
  117. if not x in header_data.uniforms:
  118. header_data.uniforms += [x]
  119. if line.strip().find("attribute ") == 0 and line.find("attrib:") != -1:
  120. uline = line.replace("in ", "")
  121. uline = uline.replace("attribute ", "")
  122. uline = uline.replace("highp ", "")
  123. uline = uline.replace(";", "")
  124. uline = uline[uline.find(" ") :].strip()
  125. if uline.find("//") != -1:
  126. name, bind = uline.split("//")
  127. if bind.find("attrib:") != -1:
  128. name = name.strip()
  129. bind = bind.replace("attrib:", "").strip()
  130. header_data.attributes += [(name, bind)]
  131. if line.strip().find("out ") == 0 and line.find("tfb:") != -1:
  132. uline = line.replace("out ", "")
  133. uline = uline.replace("highp ", "")
  134. uline = uline.replace(";", "")
  135. uline = uline[uline.find(" ") :].strip()
  136. if uline.find("//") != -1:
  137. name, bind = uline.split("//")
  138. if bind.find("tfb:") != -1:
  139. name = name.strip()
  140. bind = bind.replace("tfb:", "").strip()
  141. header_data.feedbacks += [(name, bind)]
  142. line = line.replace("\r", "")
  143. line = line.replace("\n", "")
  144. if header_data.reading == "vertex":
  145. header_data.vertex_lines += [line]
  146. if header_data.reading == "fragment":
  147. header_data.fragment_lines += [line]
  148. line = fs.readline()
  149. header_data.line_offset += 1
  150. fs.close()
  151. return header_data
  152. def build_legacygl_header(filename, include, class_suffix, output_attribs, gles2=False):
  153. header_data = LegacyGLHeaderStruct()
  154. include_file_in_legacygl_header(filename, header_data, 0)
  155. out_file = filename + ".gen.h"
  156. fd = open(out_file, "w")
  157. enum_constants = []
  158. fd.write("/* WARNING, THIS FILE WAS GENERATED, DO NOT EDIT */\n")
  159. out_file_base = out_file
  160. out_file_base = out_file_base[out_file_base.rfind("/") + 1 :]
  161. out_file_base = out_file_base[out_file_base.rfind("\\") + 1 :]
  162. out_file_ifdef = out_file_base.replace(".", "_").upper()
  163. fd.write("#ifndef " + out_file_ifdef + class_suffix + "_120\n")
  164. fd.write("#define " + out_file_ifdef + class_suffix + "_120\n")
  165. out_file_class = (
  166. out_file_base.replace(".glsl.gen.h", "").title().replace("_", "").replace(".", "") + "Shader" + class_suffix
  167. )
  168. fd.write("\n\n")
  169. fd.write('#include "' + include + '"\n\n\n')
  170. fd.write("class " + out_file_class + " : public Shader" + class_suffix + " {\n\n")
  171. fd.write('\t virtual String get_shader_name() const { return "' + out_file_class + '"; }\n')
  172. fd.write("public:\n\n")
  173. if header_data.conditionals:
  174. fd.write("\tenum Conditionals {\n")
  175. for x in header_data.conditionals:
  176. fd.write("\t\t" + x.upper() + ",\n")
  177. fd.write("\t};\n\n")
  178. if header_data.uniforms:
  179. fd.write("\tenum Uniforms {\n")
  180. for x in header_data.uniforms:
  181. fd.write("\t\t" + x.upper() + ",\n")
  182. fd.write("\t};\n\n")
  183. fd.write("\t_FORCE_INLINE_ int get_uniform(Uniforms p_uniform) const { return _get_uniform(p_uniform); }\n\n")
  184. if header_data.conditionals:
  185. fd.write(
  186. "\t_FORCE_INLINE_ void set_conditional(Conditionals p_conditional,bool p_enable) { _set_conditional(p_conditional,p_enable); }\n\n"
  187. )
  188. fd.write("\t#ifdef DEBUG_ENABLED\n ")
  189. fd.write(
  190. "\t#define _FU if (get_uniform(p_uniform)<0) return; if (!is_version_valid()) return; ERR_FAIL_COND( get_active()!=this ); \n\n "
  191. )
  192. fd.write("\t#else\n ")
  193. fd.write("\t#define _FU if (get_uniform(p_uniform)<0) return; \n\n ")
  194. fd.write("\t#endif\n")
  195. fd.write(
  196. "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n"
  197. )
  198. fd.write(
  199. "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, double p_value) { _FU glUniform1f(get_uniform(p_uniform),p_value); }\n\n"
  200. )
  201. fd.write(
  202. "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n"
  203. )
  204. fd.write(
  205. "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int8_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n"
  206. )
  207. fd.write(
  208. "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n"
  209. )
  210. fd.write(
  211. "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int16_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n"
  212. )
  213. fd.write(
  214. "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, uint32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n"
  215. )
  216. fd.write(
  217. "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, int32_t p_value) { _FU glUniform1i(get_uniform(p_uniform),p_value); }\n\n"
  218. )
  219. fd.write(
  220. "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Color& p_color) { _FU GLfloat col[4]={p_color.r,p_color.g,p_color.b,p_color.a}; glUniform4fv(get_uniform(p_uniform),1,col); }\n\n"
  221. )
  222. fd.write(
  223. "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector2& p_vec2) { _FU GLfloat vec2[2]={p_vec2.x,p_vec2.y}; glUniform2fv(get_uniform(p_uniform),1,vec2); }\n\n"
  224. )
  225. fd.write(
  226. "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Size2i& p_vec2) { _FU GLint vec2[2]={p_vec2.x,p_vec2.y}; glUniform2iv(get_uniform(p_uniform),1,vec2); }\n\n"
  227. )
  228. fd.write(
  229. "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Vector3& p_vec3) { _FU GLfloat vec3[3]={p_vec3.x,p_vec3.y,p_vec3.z}; glUniform3fv(get_uniform(p_uniform),1,vec3); }\n\n"
  230. )
  231. fd.write(
  232. "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b) { _FU glUniform2f(get_uniform(p_uniform),p_a,p_b); }\n\n"
  233. )
  234. fd.write(
  235. "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c) { _FU glUniform3f(get_uniform(p_uniform),p_a,p_b,p_c); }\n\n"
  236. )
  237. fd.write(
  238. "\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, float p_a, float p_b, float p_c, float p_d) { _FU glUniform4f(get_uniform(p_uniform),p_a,p_b,p_c,p_d); }\n\n"
  239. )
  240. fd.write(
  241. """\t_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform& p_transform) { _FU
  242. const Transform &tr = p_transform;
  243. GLfloat matrix[16]={ /* build a 16x16 matrix */
  244. tr.basis.elements[0][0],
  245. tr.basis.elements[1][0],
  246. tr.basis.elements[2][0],
  247. 0,
  248. tr.basis.elements[0][1],
  249. tr.basis.elements[1][1],
  250. tr.basis.elements[2][1],
  251. 0,
  252. tr.basis.elements[0][2],
  253. tr.basis.elements[1][2],
  254. tr.basis.elements[2][2],
  255. 0,
  256. tr.origin.x,
  257. tr.origin.y,
  258. tr.origin.z,
  259. 1
  260. };
  261. glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
  262. }
  263. """
  264. )
  265. fd.write(
  266. """_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const Transform2D& p_transform) { _FU
  267. const Transform2D &tr = p_transform;
  268. GLfloat matrix[16]={ /* build a 16x16 matrix */
  269. tr.elements[0][0],
  270. tr.elements[0][1],
  271. 0,
  272. 0,
  273. tr.elements[1][0],
  274. tr.elements[1][1],
  275. 0,
  276. 0,
  277. 0,
  278. 0,
  279. 1,
  280. 0,
  281. tr.elements[2][0],
  282. tr.elements[2][1],
  283. 0,
  284. 1
  285. };
  286. glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
  287. }
  288. """
  289. )
  290. fd.write(
  291. """_FORCE_INLINE_ void set_uniform(Uniforms p_uniform, const CameraMatrix& p_matrix) { _FU
  292. GLfloat matrix[16];
  293. for (int i=0;i<4;i++) {
  294. for (int j=0;j<4;j++) {
  295. matrix[i*4+j]=p_matrix.matrix[i][j];
  296. }
  297. }
  298. glUniformMatrix4fv(get_uniform(p_uniform),1,false,matrix);
  299. }"""
  300. )
  301. fd.write("\n\n#undef _FU\n\n\n")
  302. fd.write("\tvirtual void init() {\n\n")
  303. enum_value_count = 0
  304. if header_data.enums:
  305. fd.write("\t\t//Written using math, given nonstandarity of 64 bits integer constants..\n")
  306. fd.write("\t\tstatic const Enum _enums[]={\n")
  307. bitofs = len(header_data.conditionals)
  308. enum_vals = []
  309. for xv in header_data.enums:
  310. x = header_data.enums[xv]
  311. bits = 1
  312. amt = len(x)
  313. while 2**bits < amt:
  314. bits += 1
  315. strs = "{"
  316. for i in range(amt):
  317. strs += '"#define ' + x[i] + '\\n",'
  318. c = {}
  319. c["set_mask"] = "uint64_t(" + str(i) + ")<<" + str(bitofs)
  320. c["clear_mask"] = (
  321. "((uint64_t(1)<<40)-1) ^ (((uint64_t(1)<<" + str(bits) + ") - 1)<<" + str(bitofs) + ")"
  322. )
  323. enum_vals.append(c)
  324. enum_constants.append(x[i])
  325. strs += "NULL}"
  326. fd.write(
  327. "\t\t\t{(uint64_t(1<<" + str(bits) + ")-1)<<" + str(bitofs) + "," + str(bitofs) + "," + strs + "},\n"
  328. )
  329. bitofs += bits
  330. fd.write("\t\t};\n\n")
  331. fd.write("\t\tstatic const EnumValue _enum_values[]={\n")
  332. enum_value_count = len(enum_vals)
  333. for x in enum_vals:
  334. fd.write("\t\t\t{" + x["set_mask"] + "," + x["clear_mask"] + "},\n")
  335. fd.write("\t\t};\n\n")
  336. conditionals_found = []
  337. if header_data.conditionals:
  338. fd.write("\t\tstatic const char* _conditional_strings[]={\n")
  339. if header_data.conditionals:
  340. for x in header_data.conditionals:
  341. fd.write('\t\t\t"#define ' + x + '\\n",\n')
  342. conditionals_found.append(x)
  343. fd.write("\t\t};\n\n")
  344. else:
  345. fd.write("\t\tstatic const char **_conditional_strings=NULL;\n")
  346. if header_data.uniforms:
  347. fd.write("\t\tstatic const char* _uniform_strings[]={\n")
  348. if header_data.uniforms:
  349. for x in header_data.uniforms:
  350. fd.write('\t\t\t"' + x + '",\n')
  351. fd.write("\t\t};\n\n")
  352. else:
  353. fd.write("\t\tstatic const char **_uniform_strings=NULL;\n")
  354. if output_attribs:
  355. if header_data.attributes:
  356. fd.write("\t\tstatic AttributePair _attribute_pairs[]={\n")
  357. for x in header_data.attributes:
  358. fd.write('\t\t\t{"' + x[0] + '",' + x[1] + "},\n")
  359. fd.write("\t\t};\n\n")
  360. else:
  361. fd.write("\t\tstatic AttributePair *_attribute_pairs=NULL;\n")
  362. feedback_count = 0
  363. if not gles2 and len(header_data.feedbacks):
  364. fd.write("\t\tstatic const Feedback _feedbacks[]={\n")
  365. for x in header_data.feedbacks:
  366. name = x[0]
  367. cond = x[1]
  368. if cond in conditionals_found:
  369. fd.write('\t\t\t{"' + name + '",' + str(conditionals_found.index(cond)) + "},\n")
  370. else:
  371. fd.write('\t\t\t{"' + name + '",-1},\n')
  372. feedback_count += 1
  373. fd.write("\t\t};\n\n")
  374. else:
  375. if gles2:
  376. pass
  377. else:
  378. fd.write("\t\tstatic const Feedback* _feedbacks=NULL;\n")
  379. if header_data.texunits:
  380. fd.write("\t\tstatic TexUnitPair _texunit_pairs[]={\n")
  381. for x in header_data.texunits:
  382. fd.write('\t\t\t{"' + x[0] + '",' + x[1] + "},\n")
  383. fd.write("\t\t};\n\n")
  384. else:
  385. fd.write("\t\tstatic TexUnitPair *_texunit_pairs=NULL;\n")
  386. if not gles2 and header_data.ubos:
  387. fd.write("\t\tstatic UBOPair _ubo_pairs[]={\n")
  388. for x in header_data.ubos:
  389. fd.write('\t\t\t{"' + x[0] + '",' + x[1] + "},\n")
  390. fd.write("\t\t};\n\n")
  391. else:
  392. if gles2:
  393. pass
  394. else:
  395. fd.write("\t\tstatic UBOPair *_ubo_pairs=NULL;\n")
  396. fd.write("\t\tstatic const char _vertex_code[]={\n")
  397. for x in header_data.vertex_lines:
  398. for c in x:
  399. fd.write(str(ord(c)) + ",")
  400. fd.write(str(ord("\n")) + ",")
  401. fd.write("\t\t0};\n\n")
  402. fd.write("\t\tstatic const int _vertex_code_start=" + str(header_data.vertex_offset) + ";\n")
  403. fd.write("\t\tstatic const char _fragment_code[]={\n")
  404. for x in header_data.fragment_lines:
  405. for c in x:
  406. fd.write(str(ord(c)) + ",")
  407. fd.write(str(ord("\n")) + ",")
  408. fd.write("\t\t0};\n\n")
  409. fd.write("\t\tstatic const int _fragment_code_start=" + str(header_data.fragment_offset) + ";\n")
  410. if output_attribs:
  411. if gles2:
  412. fd.write(
  413. "\t\tsetup(_conditional_strings,"
  414. + str(len(header_data.conditionals))
  415. + ",_uniform_strings,"
  416. + str(len(header_data.uniforms))
  417. + ",_attribute_pairs,"
  418. + str(len(header_data.attributes))
  419. + ", _texunit_pairs,"
  420. + str(len(header_data.texunits))
  421. + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n"
  422. )
  423. else:
  424. fd.write(
  425. "\t\tsetup(_conditional_strings,"
  426. + str(len(header_data.conditionals))
  427. + ",_uniform_strings,"
  428. + str(len(header_data.uniforms))
  429. + ",_attribute_pairs,"
  430. + str(len(header_data.attributes))
  431. + ", _texunit_pairs,"
  432. + str(len(header_data.texunits))
  433. + ",_ubo_pairs,"
  434. + str(len(header_data.ubos))
  435. + ",_feedbacks,"
  436. + str(feedback_count)
  437. + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n"
  438. )
  439. else:
  440. if gles2:
  441. fd.write(
  442. "\t\tsetup(_conditional_strings,"
  443. + str(len(header_data.conditionals))
  444. + ",_uniform_strings,"
  445. + str(len(header_data.uniforms))
  446. + ",_texunit_pairs,"
  447. + str(len(header_data.texunits))
  448. + ",_enums,"
  449. + str(len(header_data.enums))
  450. + ",_enum_values,"
  451. + str(enum_value_count)
  452. + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n"
  453. )
  454. else:
  455. fd.write(
  456. "\t\tsetup(_conditional_strings,"
  457. + str(len(header_data.conditionals))
  458. + ",_uniform_strings,"
  459. + str(len(header_data.uniforms))
  460. + ",_texunit_pairs,"
  461. + str(len(header_data.texunits))
  462. + ",_enums,"
  463. + str(len(header_data.enums))
  464. + ",_enum_values,"
  465. + str(enum_value_count)
  466. + ",_ubo_pairs,"
  467. + str(len(header_data.ubos))
  468. + ",_feedbacks,"
  469. + str(feedback_count)
  470. + ",_vertex_code,_fragment_code,_vertex_code_start,_fragment_code_start);\n"
  471. )
  472. fd.write("\t}\n\n")
  473. if enum_constants:
  474. fd.write("\tenum EnumConditionals {\n")
  475. for x in enum_constants:
  476. fd.write("\t\t" + x.upper() + ",\n")
  477. fd.write("\t};\n\n")
  478. fd.write("\tvoid set_enum_conditional(EnumConditionals p_cond) { _set_enum_conditional(p_cond); }\n")
  479. fd.write("};\n\n")
  480. fd.write("#endif\n\n")
  481. fd.close()
  482. def build_gles3_headers(target, source, env):
  483. for x in source:
  484. build_legacygl_header(str(x), include="drivers/gles3/shader_gles3.h", class_suffix="GLES3", output_attribs=True)
  485. def build_gles2_headers(target, source, env):
  486. for x in source:
  487. build_legacygl_header(
  488. str(x), include="drivers/gles2/shader_gles2.h", class_suffix="GLES2", output_attribs=True, gles2=True
  489. )
  490. if __name__ == "__main__":
  491. subprocess_main(globals())