Custom Anbox installation files & patches, including patched Android OS image file.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

246 lines
10 KiB

4 years ago
  1. --- a/scripts/gen-emugl-entries.py 2020-06-05 13:21:54.450753270 +0300
  2. +++ b/scripts/gen-emugl-entries.py 2020-06-05 13:32:35.194087281 +0300
  3. @@ -1,4 +1,4 @@
  4. -#!/usr/bin/env python2
  5. +#!/usr/bin/env python
  6. # Copyright 2015 The Android Open Source Project
  7. #
  8. @@ -25,7 +25,6 @@
  9. #
  10. # Anything else is an error.
  11. -from __future__ import print_function
  12. import re
  13. import sys
  14. import argparse
  15. @@ -43,7 +42,7 @@
  16. |return_type| its return type, and |parameters| is a list of
  17. (type,name) tuples from the entry's signature.
  18. """
  19. - self.func_name = func_name
  20. + self.__name__ = func_name
  21. self.return_type = return_type
  22. self.parameters = ""
  23. self.vartypes = []
  24. @@ -145,11 +144,11 @@
  25. for entry in entries:
  26. if with_args:
  27. print(" X(%s, %s, (%s), (%s)) \\" % \
  28. - (entry.return_type, entry.func_name, entry.parameters,
  29. + (entry.return_type, entry.__name__, entry.parameters,
  30. entry.call))
  31. else:
  32. print(" X(%s, %s, (%s)) \\" % \
  33. - (entry.return_type, entry.func_name, entry.parameters))
  34. + (entry.return_type, entry.__name__, entry.parameters))
  35. print("")
  36. print("")
  37. @@ -170,27 +169,27 @@
  38. from gles3translatorgen import gles31_custom
  39. translator_custom_share_processing = { }
  40. - for (k, v) in gles30_custom.custom_share_processing.items():
  41. + for (k, v) in list(gles30_custom.custom_share_processing.items()):
  42. translator_custom_share_processing[k] = v
  43. - for (k, v) in gles31_custom.custom_share_processing.items():
  44. + for (k, v) in list(gles31_custom.custom_share_processing.items()):
  45. translator_custom_share_processing[k] = v
  46. translator_custom_pre = { }
  47. - for (k, v) in gles30_custom.custom_preprocesses.items():
  48. + for (k, v) in list(gles30_custom.custom_preprocesses.items()):
  49. translator_custom_pre[k] = v
  50. - for (k, v) in gles31_custom.custom_preprocesses.items():
  51. + for (k, v) in list(gles31_custom.custom_preprocesses.items()):
  52. translator_custom_pre[k] = v
  53. translator_custom_post = { }
  54. - for (k, v) in gles30_custom.custom_postprocesses.items():
  55. + for (k, v) in list(gles30_custom.custom_postprocesses.items()):
  56. translator_custom_post[k] = v
  57. - for (k, v) in gles31_custom.custom_postprocesses.items():
  58. + for (k, v) in list(gles31_custom.custom_postprocesses.items()):
  59. translator_custom_post[k] = v
  60. translator_no_passthrough = {}
  61. - for (k, v) in gles30_custom.no_passthrough.items():
  62. + for (k, v) in list(gles30_custom.no_passthrough.items()):
  63. translator_no_passthrough[k] = v
  64. - for (k, v) in gles31_custom.no_passthrough.items():
  65. + for (k, v) in list(gles31_custom.no_passthrough.items()):
  66. translator_no_passthrough[k] = v
  67. translator_needexternc = {
  68. @@ -208,13 +207,13 @@
  69. "glClientWaitSync" : "GL_WAIT_FAILED",
  70. }
  71. def needExternC(entry):
  72. - if translator_needexternc.has_key(entry.func_name):
  73. + if entry.__name__ in translator_needexternc:
  74. return "extern \"C\" "
  75. else:
  76. return ""
  77. def get_fail_code(entry):
  78. - if translator_nocontext_fail_codes.has_key(entry.func_name):
  79. - return translator_nocontext_fail_codes[entry.func_name]
  80. + if entry.__name__ in translator_nocontext_fail_codes:
  81. + return translator_nocontext_fail_codes[entry.__name__]
  82. else:
  83. return "0"
  84. def gen_cxt_getter(entry):
  85. @@ -224,9 +223,9 @@
  86. print(" GET_CTX_V2_RET(%s);" % get_fail_code(entry))
  87. def gen_validations_custom_impl(entry):
  88. - isGen = entry.func_name.startswith("glGen")
  89. - isDelete = entry.func_name.startswith("glDelete")
  90. - isBufferOp = "Buffer" in entry.func_name
  91. + isGen = entry.__name__.startswith("glGen")
  92. + isDelete = entry.__name__.startswith("glDelete")
  93. + isBufferOp = "Buffer" in entry.__name__
  94. hasTargetArg = "target" in entry.varnames
  95. hasProgramArg = "program" in entry.varnames
  96. @@ -241,8 +240,8 @@
  97. print(" %s;" % mySetError("n < 0", "GL_INVALID_VALUE"))
  98. if (isBufferOp and hasTargetArg):
  99. print(" %s;" % mySetError("!GLESv2Validate::bufferTarget(ctx, target)", "GL_INVALID_ENUM"))
  100. - if translator_custom_pre.has_key(entry.func_name):
  101. - print(translator_custom_pre[entry.func_name],)
  102. + if entry.__name__ in translator_custom_pre:
  103. + print(translator_custom_pre[entry.__name__],)
  104. def gen_call_ret(entry):
  105. globalNameTypes = {
  106. @@ -262,44 +261,44 @@
  107. needsShareGroup = False
  108. for v in zip(entry.vartypes, entry.varnames):
  109. - if v in globalNameTypes.keys():
  110. + if v in list(globalNameTypes.keys()):
  111. needsShareGroup = True
  112. if needsShareGroup:
  113. print(" if (ctx->shareGroup().get()) {")
  114. for key in zip(entry.vartypes, entry.varnames):
  115. vartype, varname = key
  116. - if globalNames.has_key(key):
  117. + if key in globalNames:
  118. print(" const GLuint %s = ctx->shareGroup()->getGlobalName(%s, %s);" % (globalNames[key], globalNameTypes[key], varname))
  119. - globalCall = ", ".join(map(lambda k: globalNames.get(k, k[1]), zip(entry.vartypes, entry.varnames)))
  120. + globalCall = ", ".join([globalNames.get(k, k[1]) for k in zip(entry.vartypes, entry.varnames)])
  121. - if needsShareGroup and translator_custom_share_processing.has_key(entry.func_name):
  122. - print(translator_custom_share_processing[entry.func_name])
  123. + if needsShareGroup and entry.__name__ in translator_custom_share_processing:
  124. + print(translator_custom_share_processing[entry.__name__])
  125. if (entry.return_type == "void"):
  126. if (needsShareGroup):
  127. print(" "),
  128. - if not translator_no_passthrough.has_key(entry.func_name):
  129. - print(" ctx->dispatcher().%s(%s);" % (entry.func_name, globalCall))
  130. + if entry.__name__ not in translator_no_passthrough:
  131. + print(" ctx->dispatcher().%s(%s);" % (entry.__name__, globalCall))
  132. if needsShareGroup:
  133. print(" }")
  134. - if translator_custom_post.has_key(entry.func_name):
  135. - print(translator_custom_post[entry.func_name])
  136. + if entry.__name__ in translator_custom_post:
  137. + print(translator_custom_post[entry.__name__])
  138. else:
  139. if (needsShareGroup):
  140. print(" "),
  141. - if not translator_no_passthrough.has_key(entry.func_name):
  142. - print(" %s %s = ctx->dispatcher().%s(%s);" % (entry.return_type, entry.func_name + "RET", entry.func_name, globalCall))
  143. + if entry.__name__ not in translator_no_passthrough:
  144. + print(" %s %s = ctx->dispatcher().%s(%s);" % (entry.return_type, entry.__name__ + "RET", entry.__name__, globalCall))
  145. else:
  146. print(") %s %s = %s" % (entry.return_type, entry_func_name + "RET", get_fail_code(entry)))
  147. - if translator_custom_post.has_key(entry.func_name):
  148. - print(translator_custom_post[entry.func_name])
  149. + if entry.__name__ in translator_custom_post:
  150. + print(translator_custom_post[entry.__name__])
  151. - print(" return %s;" % (entry.func_name + "RET"))
  152. + print(" return %s;" % (entry.__name__ + "RET"))
  153. if needsShareGroup:
  154. print(" } else return %s;" % (get_fail_code(entry)))
  155. @@ -308,7 +307,7 @@
  156. print("// Try to make changes through gen_translator in gen-entries.py,")
  157. print("// and/or parcel out custom functionality in separate code.")
  158. for entry in entries:
  159. - print("%sGL_APICALL %s GL_APIENTRY %s(%s) {" % (needExternC(entry), entry.return_type, entry.func_name, entry.parameters))
  160. + print("%sGL_APICALL %s GL_APIENTRY %s(%s) {" % (needExternC(entry), entry.return_type, entry.__name__, entry.parameters))
  161. gen_cxt_getter(entry)
  162. gen_validations_custom_impl(entry)
  163. gen_call_ret(entry)
  164. @@ -339,7 +338,7 @@
  165. print("///")
  166. print("")
  167. for entry in entries:
  168. - ptr_name = ENTRY_PREFIX + entry.func_name
  169. + ptr_name = ENTRY_PREFIX + entry.__name__
  170. print("static %s (*%s)(%s) = 0;" % \
  171. (entry.return_type, ptr_name, entry.parameters))
  172. @@ -351,8 +350,8 @@
  173. for entry in entries:
  174. print ("%s %s(%s) {" % \
  175. - (entry.return_type, entry.func_name, entry.parameters))
  176. - ptr_name = ENTRY_PREFIX + entry.func_name
  177. + (entry.return_type, entry.__name__, entry.parameters))
  178. + ptr_name = ENTRY_PREFIX + entry.__name__
  179. if entry.return_type != "void":
  180. print(" return %s(%s);" % (ptr_name, entry.call))
  181. else:
  182. @@ -367,12 +366,12 @@
  183. print("int %s_dynlink_init(void* lib) {" % prefix_name)
  184. for entry in entries:
  185. - ptr_name = ENTRY_PREFIX + entry.func_name
  186. + ptr_name = ENTRY_PREFIX + entry.__name__
  187. print(" %s = (%s(*)(%s))dlsym(lib, \"%s\");" % \
  188. (ptr_name,
  189. entry.return_type,
  190. entry.parameters,
  191. - entry.func_name))
  192. + entry.__name__))
  193. print(" if (!%s) return -1;" % ptr_name)
  194. print(" return 0;")
  195. print("}")
  196. @@ -383,7 +382,7 @@
  197. """
  198. print("EXPORTS")
  199. for entry in entries:
  200. - print(" %s" % entry.func_name)
  201. + print(" %s" % entry.__name__)
  202. def gen_unix_sym_file(entries):
  203. @@ -393,7 +392,7 @@
  204. print("VERSION {")
  205. print("\tglobal:")
  206. for entry in entries:
  207. - print("\t\t%s;" % entry.func_name)
  208. + print("\t\t%s;" % entry.__name__)
  209. print("\tlocal:")
  210. print("\t\t*;")
  211. print("};")
  212. @@ -407,7 +406,7 @@
  213. if underscore:
  214. prefix = "_"
  215. for entry in entries:
  216. - print("%s%s" % (prefix, entry.func_name))
  217. + print("%s%s" % (prefix, entry.__name__))
  218. def parse_file(filename, lines, mode):
  219. """Generate one of possible outputs from |filename|. |lines| must be a list