CFTTGraphicsDeviceOGLES.cpp 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. #include <dlfcn.h>
  2. #include <GLES2/gl2.h>
  3. #include <GLES3/gl3.h>
  4. #include <GLES2/gl2ext.h>
  5. #include <arm_neon.h>
  6. #include <dlfcn.h>
  7. #include "CFTTGraphicsDeviceOGLES.h"
  8. #include "CFTTShaderProgramOGLES.h"
  9. #include "CFTTAndroidDevice.h"
  10. #include "CFTTGraphicsBufferOGLES.h"
  11. #include "CFTTRenderTargetOGLES.h"
  12. #include "CFTTRenderToTextureOGLES.h"
  13. #include "FTTGraphics.h"
  14. #include "FTTFont.h"
  15. #include "CFTTCamera.h"
  16. //#include "memctrl.h"
  17. const GLenum GLenum_2FE084[] = {GL_LINES, GL_LINE_STRIP, GL_TRIANGLES, GL_TRIANGLE_STRIP};
  18. MYSTATIC const int dword_2FED60[] = {0x201, 0x202, 0x203, 0x204, 0x205, 0x206, 0x207, 0x203};
  19. const int dword_306400[] = {0, 0x1E01, 0x1E02, 0x1E03, 0x8507, 0x8508, 0x150A, 0};
  20. MYSTATIC GLuint dword_3063E0[] = {0x207, 0x202, 0x205, 0x201, 0x203, 0x204, 0x206, 0};
  21. uchar byte_5AA644;
  22. uchar byte_5AA684;
  23. uchar byte_5AA6C5;
  24. int g_iMainFBOWidth;
  25. int g_iMainFBOHeight;
  26. //-------------------------------------------------------------------------------------------------
  27. typedef void (*pfunc_glDiscardFramebufferEXT)(GLenum target,
  28. GLsizei numAttachments,
  29. const GLenum *attachments);
  30. pfunc_glDiscardFramebufferEXT func_glDiscardFramebufferEXT_5A9E80 = nullptr;
  31. //-------------------------------------------------------------------------------------------------
  32. const char *list_VENDOR_348A00[] = {
  33. "Imagination Technologies",
  34. "NVIDIA Corporation",
  35. "Broadcom",
  36. "ARM",
  37. "Qualcom",
  38. "Vivante Corporation",
  39. "\0",
  40. };
  41. //-------------------------------------------------------------------------------------------------
  42. const char *list_Imagination_3489C0[] = {
  43. "PowerVR SGX 544MP",
  44. "\0",
  45. };
  46. //-------------------------------------------------------------------------------------------------
  47. const char *list_NVIDIA_3489DC[] = {
  48. "NVIDIA Tegra 3",
  49. "NVIDIA Tegra 2",
  50. "NVIDIA Tegra",
  51. "\0",
  52. };
  53. //-------------------------------------------------------------------------------------------------
  54. const char *list_Qualcom_3489EC[] = {
  55. "Adreno (TM) 320",
  56. "Adreno 205",
  57. "Adreno (TM) 205",
  58. "Adreno (TM) 203",
  59. "\0",
  60. };
  61. //-------------------------------------------------------------------------------------------------
  62. const char *lsit_ARM_3489D0[] = {
  63. "Mali-400 MP",
  64. "Mali-400",
  65. "\0",
  66. };
  67. //-------------------------------------------------------------------------------------------------
  68. const char *list_Vivante_3489C8[] = {
  69. "GC1000 core",
  70. "\0",
  71. };
  72. //-------------------------------------------------------------------------------------------------
  73. //00203830 //^_^
  74. int findstr_203830(const char **list, const char *pName) {
  75. const char *v2 = pName;
  76. int i = 0;
  77. for (i = 0;; ++i) {
  78. const char *pr1 = list[i];
  79. if (!*pr1 || strstr(v2, pr1) == 0)
  80. break;
  81. }
  82. return i;
  83. }
  84. //-------------------------------------------------------------------------------------------------
  85. //0020289C -_- 经过单元测试,功能正常
  86. CFTTGraphicsDeviceOGLES::CFTTGraphicsDeviceOGLES() {
  87. }
  88. //-------------------------------------------------------------------------------------------------
  89. //002028E8 00202904 //^_^
  90. CFTTGraphicsDeviceOGLES::~CFTTGraphicsDeviceOGLES() {
  91. }
  92. //-------------------------------------------------------------------------------------------------
  93. //002038EC //^_^ 经过单元测试,功能正常
  94. uint CFTTGraphicsDeviceOGLES::ARGBToPlatform4444(uint a2) const {
  95. int dret = ((a2 >> 4) & 0xF00) | (a2 & 0xF0) | (a2 >> 28) | ((a2 >> 8) & 0xF000);
  96. return dret;
  97. }
  98. //-------------------------------------------------------------------------------------------------
  99. //002038CE //^_^
  100. ushort CFTTGraphicsDeviceOGLES::ARGBToPlatform4444(uint a2, uint a3, uint a4, uint a5) const {
  101. return (ushort)1;
  102. }
  103. //-------------------------------------------------------------------------------------------------
  104. //002038A8 //^_^
  105. uint CFTTGraphicsDeviceOGLES::ARGBToPlatformU32(uint a1) const {
  106. return 0;
  107. }
  108. //-------------------------------------------------------------------------------------------------
  109. //00203898 //^_^
  110. uint CFTTGraphicsDeviceOGLES::ARGBToPlatformU32(uint a2, uint a3, uint a4, uint a5) const {
  111. return 2;
  112. }
  113. //-------------------------------------------------------------------------------------------------
  114. //00203594 //^_- 经过单元测试,功能正常
  115. void CFTTGraphicsDeviceOGLES::AssessHardware() {
  116. }
  117. //-------------------------------------------------------------------------------------------------
  118. //0020387C //^_^
  119. bool CFTTGraphicsDeviceOGLES::DepthTextureSupported() const {
  120. return false;
  121. }
  122. //-------------------------------------------------------------------------------------------------
  123. //0020390A //^_^
  124. uint CFTTGraphicsDeviceOGLES::ExtractAFromPlatform4444(ushort a2) const {
  125. return 0;
  126. }
  127. //-------------------------------------------------------------------------------------------------
  128. //002038BA //^_^
  129. uint CFTTGraphicsDeviceOGLES::ExtractAFromPlatformU32(uint a2) const {
  130. return 0;
  131. }
  132. //-------------------------------------------------------------------------------------------------
  133. //0020391A //^_^
  134. uint CFTTGraphicsDeviceOGLES::ExtractBFromPlatform4444(ushort a2) const {
  135. return 0;
  136. }
  137. //-------------------------------------------------------------------------------------------------
  138. //002038C8 //^_^
  139. uint CFTTGraphicsDeviceOGLES::ExtractBFromPlatformU32(uint a2) const {
  140. return 0;
  141. }
  142. //-------------------------------------------------------------------------------------------------
  143. //00203914 //^_^
  144. uint CFTTGraphicsDeviceOGLES::ExtractGFromPlatform4444(ushort a2) const {
  145. return 1;
  146. }
  147. //-------------------------------------------------------------------------------------------------
  148. //002038C2 //^_^
  149. uint CFTTGraphicsDeviceOGLES::ExtractGFromPlatformU32(uint a2) const {
  150. return 1;
  151. }
  152. //-------------------------------------------------------------------------------------------------
  153. //00203910 //^_^
  154. uint CFTTGraphicsDeviceOGLES::ExtractRFromPlatform4444(ushort a2) const {
  155. return 1;
  156. }
  157. //-------------------------------------------------------------------------------------------------
  158. //002038BE //^_^
  159. uint CFTTGraphicsDeviceOGLES::ExtractRFromPlatformU32(uint8 a2) const {
  160. return a2;
  161. }
  162. //-------------------------------------------------------------------------------------------------
  163. //00202938 //^_^
  164. void CFTTGraphicsDeviceOGLES::GetGPUName(wchar_t *pCUPBuf, int len) const {
  165. LOGE("CFTTGraphicsDeviceOGLES::GetGPUName%p%x",pCUPBuf,len);
  166. }
  167. //-------------------------------------------------------------------------------------------------
  168. //00203868 //^_^
  169. int CFTTGraphicsDeviceOGLES::GetRendererFamily() const {
  170. return 0;
  171. }
  172. //-------------------------------------------------------------------------------------------------
  173. //0020386C //^_^
  174. int CFTTGraphicsDeviceOGLES::GetRendererType() const {
  175. return 0;
  176. }
  177. //-------------------------------------------------------------------------------------------------
  178. //00203870 //^_^
  179. int CFTTGraphicsDeviceOGLES::Matrices_FlipsRTT() const {
  180. return 1;
  181. }
  182. //-------------------------------------------------------------------------------------------------
  183. //00203874 //^_^
  184. int CFTTGraphicsDeviceOGLES::Matrices_FlipsY() const {
  185. return 0;
  186. }
  187. //-------------------------------------------------------------------------------------------------
  188. //00203878 //^_^
  189. int CFTTGraphicsDeviceOGLES::Matrices_NDCIsCube() const {
  190. return 1;
  191. }
  192. //-------------------------------------------------------------------------------------------------
  193. //00203920 //^_^
  194. int CFTTGraphicsDeviceOGLES::SupportsThreadedTextureLoading() {
  195. return 0;
  196. }
  197. //-------------------------------------------------------------------------------------------------
  198. //00203852 //^_- 经过单元测试,功能正常
  199. bool CFTTGraphicsDeviceOGLES::TrustGlGenerateMipmap() const {
  200. LOGI("CFTTGraphicsDeviceOGLES::TrustGlGenerateMipmap entry");
  201. bool bret = false;
  202. return bret;
  203. }
  204. //-------------------------------------------------------------------------------------------------
  205. //00202954 -_- 经过单元测试,功能正常
  206. bool CFTTGraphicsDeviceOGLES::beginScene(CFTTClearSettings const &pSetting,
  207. CFTTRenderTarget *pRenderTarget,
  208. bool a4) {
  209. LOGI("CFTTGraphicsDeviceOGLES::beginScene entry");
  210. bool r6_bool;
  211. LOGI("CFTTGraphicsDeviceOGLES::beginScene end");
  212. return true;
  213. }
  214. //-------------------------------------------------------------------------------------------------
  215. //00202924 //^_^
  216. int CFTTGraphicsDeviceOGLES::create() {
  217. AssessHardware();
  218. return 1;
  219. }
  220. //-------------------------------------------------------------------------------------------------
  221. //00203174 //^_^
  222. CFTTGraphicsBuffer *CFTTGraphicsDeviceOGLES::createGraphicsBuffer(EFTTGraphicsBufferType eType,
  223. EFTTGraphicsBufferVolatility eGbv,
  224. uint a3) {
  225. LOGI("CFTTGraphicsDeviceOGLES::createGraphicsBuffer: EFTTGraphicsBufferType=%d; EFTTGraphicsBufferVolatility=%d; a3=%d", eType, eGbv, a3);
  226. return nullptr;
  227. }
  228. //-------------------------------------------------------------------------------------------------
  229. //002030D4 //^_^
  230. CFTTRenderToTexture *CFTTGraphicsDeviceOGLES::createRenderToTexture(CFTTRTTSetup s) {
  231. return nullptr;
  232. }
  233. //-------------------------------------------------------------------------------------------------
  234. //00203090 //^_^
  235. CFTTRenderToTexture *CFTTGraphicsDeviceOGLES::createRenderToTexture(EFTTTexFormat eTexFormat,
  236. int a2,
  237. int a3,
  238. uint a4,
  239. int a5,
  240. EFTTRTTZBufMode eRTTZBufMode,
  241. bool b,
  242. EFTTTextureType eTextureType,
  243. uchar ub) {
  244. return nullptr;
  245. }
  246. //-------------------------------------------------------------------------------------------------
  247. //00203154 //^_^
  248. CFTTShaderProgram *CFTTGraphicsDeviceOGLES::createShaderProgram(CFTTUberShader const *pUberShader,
  249. uchar const *pShader,
  250. bool flag) {
  251. LOGI("CFTTGraphicsDeviceOGLES::createShaderProgram Entry");
  252. return nullptr;
  253. }
  254. //-------------------------------------------------------------------------------------------------
  255. //00203070 //^_^
  256. CFTTTexture *CFTTGraphicsDeviceOGLES::createTexture(int a2, int a3, int a4, EFTTTexFormat eTexFormat, EFTTTextureType eTextureType) {
  257. return nullptr;
  258. }
  259. //-------------------------------------------------------------------------------------------------
  260. //0020305C //^_^
  261. CFTTTexture *CFTTGraphicsDeviceOGLES::createTexture() {
  262. return nullptr;
  263. }
  264. //-------------------------------------------------------------------------------------------------
  265. //00202934
  266. void CFTTGraphicsDeviceOGLES::createVolatileResources() {
  267. //empty
  268. }
  269. //-------------------------------------------------------------------------------------------------
  270. //00202936
  271. void CFTTGraphicsDeviceOGLES::deleteVolatileResources() {
  272. //empty
  273. }
  274. //-------------------------------------------------------------------------------------------------
  275. //00202932
  276. void CFTTGraphicsDeviceOGLES::destroy() {
  277. //empty
  278. }
  279. //-------------------------------------------------------------------------------------------------
  280. //00203038 //^_^
  281. void CFTTGraphicsDeviceOGLES::disableScissorTest() {
  282. }
  283. //-------------------------------------------------------------------------------------------------
  284. //00203518 //^_- 经过单元测试,功能正常
  285. void CFTTGraphicsDeviceOGLES::drawIndexed(FTTPRIMTYPE eType, int a2, int a3, int dindex4, int a5) {
  286. LOGI("CFTTGraphicsDeviceOGLES::drawIndexed Entry");
  287. }
  288. //-------------------------------------------------------------------------------------------------
  289. //0020355C //^_^ 经过单元测试,功能正常
  290. void CFTTGraphicsDeviceOGLES::drawNonIndexed(FTTPRIMTYPE eType, int a2) {
  291. LOGI("CFTTGraphicsDeviceOGLES::drawNonIndexed Entry");
  292. LOGI("CFTTGraphicsDeviceOGLES::drawNonIndexed end");
  293. }
  294. //-------------------------------------------------------------------------------------------------
  295. //00202F54
  296. void CFTTGraphicsDeviceOGLES::enableScissorTest(GLint x, GLint y, GLint dWidth, GLint dHeight) {
  297. }
  298. //-------------------------------------------------------------------------------------------------
  299. //00202DC0 //^_^
  300. void CFTTGraphicsDeviceOGLES::enableStencilTest(bool a2) {
  301. }
  302. //-------------------------------------------------------------------------------------------------
  303. //00202C58 //^_^ 经过单元测试,功能正常
  304. void CFTTGraphicsDeviceOGLES::endScene() {
  305. }
  306. //-------------------------------------------------------------------------------------------------
  307. //00202CD4 //^_^
  308. int CFTTGraphicsDeviceOGLES::getDepthBufferBitDepth() const {
  309. return 1;
  310. }
  311. //-------------------------------------------------------------------------------------------------
  312. //00203114 //^_- 经过单元测试,功能正常
  313. int CFTTGraphicsDeviceOGLES::getTextureFormatSupport(EFTTTexFormat eFormat, bool a3, bool a4) {
  314. LOGI("CFTTGraphicsDeviceOGLES::getTextureFormatSupport entry");
  315. int result = 0;
  316. return result;
  317. }
  318. //-------------------------------------------------------------------------------------------------
  319. //00202CC4 //^_^
  320. int CFTTGraphicsDeviceOGLES::height() const {
  321. return 1;
  322. }
  323. //-------------------------------------------------------------------------------------------------
  324. //00202CE6 //^_^
  325. int CFTTGraphicsDeviceOGLES::resetDisplay(int, int, int, int) {
  326. return 1;
  327. }
  328. //-------------------------------------------------------------------------------------------------
  329. //00202D2C //^_- 经过单元测试,功能正常
  330. void CFTTGraphicsDeviceOGLES::setDepthTest(EFTTDepthTest eDepthTest, bool ba2) {
  331. LOGI("CFTTGraphicsDeviceOGLES::setDepthTest entry");
  332. LOGI("CFTTGraphicsDeviceOGLES::setDepthTest end");
  333. }
  334. //-------------------------------------------------------------------------------------------------
  335. //00202CF0 //^_^
  336. void CFTTGraphicsDeviceOGLES::setDither(bool ba2) {
  337. }
  338. //-------------------------------------------------------------------------------------------------
  339. //00203194 //^_^ 经过单元测试,功能正常
  340. void CFTTGraphicsDeviceOGLES::setIndexBuffer(CFTTGraphicsBuffer *pBuffer) {
  341. }
  342. //-------------------------------------------------------------------------------------------------
  343. //00202DFC //^_^
  344. void CFTTGraphicsDeviceOGLES::setStencilFunc(EFTTStencilFunc eFunc, GLuint a_ref, GLuint a_mask) {
  345. }
  346. //-------------------------------------------------------------------------------------------------
  347. //00202F38 //^_^
  348. void CFTTGraphicsDeviceOGLES::setStencilMask(GLuint a_mask) {
  349. }
  350. //-------------------------------------------------------------------------------------------------
  351. //00202E84
  352. void CFTTGraphicsDeviceOGLES::setStencilOp(EFTTStencilOp esfail,
  353. EFTTStencilOp ezfail,
  354. EFTTStencilOp ezpass) {
  355. //void glStencilOp(GLenum sfail, GLenum zfail, GLenum zpass)
  356. }
  357. //-------------------------------------------------------------------------------------------------
  358. //002031C4 //-_- 经过单元测试,功能正常
  359. /**
  360. * 它为当前绘制调用设置顶点缓冲区
  361. *
  362. * @param pGraphBuf 指向缓冲区对象的指针
  363. * @param a2 0x1000000
  364. * @param a3 大步
  365. * @param a4 偏移到缓冲区
  366. */
  367. void CFTTGraphicsDeviceOGLES::setVertexBuffer(CFTTGraphicsBuffer *pGraphBuf, uint a2, uint a3, uint a4) {
  368. /* 将缓冲区绑定到 GL_ARRAY_BUFFER。 */
  369. uchar *r4_pbuf = (uchar *)a4;
  370. CFTTGraphicsBufferOGLES *pBufOGLES = (CFTTGraphicsBufferOGLES *)pGraphBuf;
  371. if (CFTTGLES2Wrapper::s_uBoundArrayBuffer != pBufOGLES->bindBuf_10) {
  372. CFTTGLES2Wrapper::s_uBoundArrayBuffer = pBufOGLES->bindBuf_10;
  373. glBindBuffer(GL_ARRAY_BUFFER, pBufOGLES->bindBuf_10);
  374. }
  375. // loc_2031EA
  376. /* */
  377. if (!pBufOGLES->bindBuf_10)
  378. r4_pbuf = pBufOGLES->pBuf_C + a4; // 002031EE 04 44 ADD R4, R0
  379. // loc_2031F0
  380. uint r11_uint = a2 & 0xF00;
  381. uint r5_uint = a2 & 0xF000;
  382. uint r10_uint = r11_uint;
  383. if ((a2 & 0xF000000) != 0x2000000)
  384. r10_uint = 0;
  385. // 0020320C
  386. if (a2 & 0xF) {
  387. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]!=1) {
  388. // 0020321A
  389. CFTTGLES2Wrapper::s_bVertexAttribEnabled[0] = 1;
  390. glEnableVertexAttribArray(0);
  391. }
  392. // loc_203224
  393. switch (a2 & 0xF) {
  394. case 1:
  395. // loc_203238
  396. glVertexAttribPointer(0, 3, GL_FLOAT, false, a3, (const void *)r4_pbuf); // GL_FLOAT
  397. r4_pbuf += 12;
  398. break;
  399. case 2:
  400. // loc_20325C
  401. glVertexAttribPointer(0, 3, GL_SHORT, true, a3, (const void *)r4_pbuf);
  402. r4_pbuf += 8;
  403. break;
  404. case 3:
  405. // loc_203266
  406. glVertexAttribPointer(0, 3, GL_BYTE, false, a3, (const void *)r4_pbuf); // GL_BYTE
  407. r4_pbuf += 4;
  408. break;
  409. case 4:
  410. // loc_20327C
  411. glVertexAttribPointer(0, 2, GL_FLOAT, false, a3, (const void *)r4_pbuf); // GL_FLOAT
  412. r4_pbuf += 8;
  413. break;
  414. case 5:
  415. // loc_20328C
  416. glVertexAttribPointer(0, 4, GL_SHORT, true, a3, (const void *)r4_pbuf); // GL_SHORT
  417. r4_pbuf += 8;
  418. break;
  419. default:
  420. break;
  421. }
  422. } else if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]) { // loc_20324E
  423. // 00203250
  424. CFTTGLES2Wrapper::s_bVertexAttribEnabled[0] = false;
  425. glDisableVertexAttribArray(0);
  426. }
  427. // break_20322E
  428. if (r5_uint) {
  429. // 002032A8
  430. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[2]!=1) {
  431. // 002032AC
  432. CFTTGLES2Wrapper::s_bVertexAttribEnabled[2] = 1;
  433. glEnableVertexAttribArray(2);
  434. }
  435. // loc_2032B6
  436. switch (r5_uint) {
  437. case 0x3000:
  438. // loc_2032EC
  439. glVertexAttribPointer(2, 3, GL_BYTE, true, a3, (const void *)r4_pbuf);
  440. r4_pbuf += 4;
  441. break;
  442. case 0x2000u:
  443. // loc_203302
  444. glVertexAttribPointer(2, 4, GL_SHORT, true, a3, (const void *)r4_pbuf);
  445. r4_pbuf += 8;
  446. break;
  447. case 0x1000u:
  448. // 002032C8
  449. glVertexAttribPointer(2, 3, GL_FLOAT, false, a3, (const void *)r4_pbuf);
  450. r4_pbuf += 12;
  451. break;
  452. }
  453. } else if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[2]) { // loc_2032DE
  454. // 002032E0
  455. CFTTGLES2Wrapper::s_bVertexAttribEnabled[2] = false;
  456. glDisableVertexAttribArray(2);
  457. }
  458. // loc_203316
  459. uint r7_uint = a2 & 0xF0;
  460. if (r7_uint) {
  461. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[1]!=1) {
  462. CFTTGLES2Wrapper::s_bVertexAttribEnabled[1] = 1;
  463. glEnableVertexAttribArray(1);
  464. }
  465. // loc_203328
  466. if (r7_uint == 32) {
  467. // loc_203354
  468. glVertexAttribPointer(1, 4, GL_FLOAT, false, a3, (const void *)r4_pbuf);
  469. r4_pbuf += 16;
  470. } else if (r7_uint == 16) {
  471. // 00203330
  472. glVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE, true, a3, (const void *)r4_pbuf);
  473. r4_pbuf += 4;
  474. }
  475. } else if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[1]) { // loc_203346
  476. CFTTGLES2Wrapper::s_bVertexAttribEnabled[1] = 0;
  477. glDisableVertexAttribArray(1);
  478. }
  479. // loc_203368
  480. if (r11_uint) {
  481. // 00203370
  482. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[3]!=1) {
  483. // 00203374
  484. CFTTGLES2Wrapper::s_bVertexAttribEnabled[3] = 1;
  485. glEnableVertexAttribArray(3);
  486. }
  487. // loc_20337E
  488. r11_uint=r11_uint&0xFFF;
  489. if (r11_uint == 0x200) {
  490. // loc_2033B2
  491. glVertexAttribPointer(3, 2, GL_SHORT, true, a3, (const void *)r4_pbuf);
  492. r4_pbuf += 4;
  493. } else if (r11_uint == 0x100) {
  494. // 0020338E
  495. glVertexAttribPointer(3, 2, GL_FLOAT, false, a3, (const void *)r4_pbuf);
  496. r4_pbuf += 8;
  497. }
  498. } else if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[3]) { // loc_2033A4
  499. CFTTGLES2Wrapper::s_bVertexAttribEnabled[3] = false;
  500. glDisableVertexAttribArray(3);
  501. }
  502. // loc_2033C6
  503. if (r10_uint) {
  504. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[4]!=1) {
  505. CFTTGLES2Wrapper::s_bVertexAttribEnabled[4] = 1;
  506. glEnableVertexAttribArray(4);
  507. }
  508. // loc_2033E0
  509. if ((r10_uint & 0xFFF) == 0x200) {
  510. // loc_203414
  511. glVertexAttribPointer(4, 2, GL_SHORT, true, a3, (const void *)r4_pbuf);
  512. r4_pbuf += 4;
  513. } else if ((r10_uint & 0xFFF) == 0x100) {
  514. // loc_203428
  515. glVertexAttribPointer(4, 2, GL_FLOAT, false, a3, (const void *)r4_pbuf);
  516. r4_pbuf += 8;
  517. }
  518. } else if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[4]) { // loc_203406
  519. CFTTGLES2Wrapper::s_bVertexAttribEnabled[4] = false;
  520. glDisableVertexAttribArray(4);
  521. }
  522. // loc_203428
  523. r5_uint = a2 & 0xF00000; ////loc_2033C6
  524. if (r5_uint) {
  525. // 0020342C
  526. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[5]!=1) {
  527. // 00203430
  528. CFTTGLES2Wrapper::s_bVertexAttribEnabled[5] = true;
  529. glEnableVertexAttribArray(5);
  530. }
  531. // loc_20343A
  532. if ((r5_uint&0xffffff) == 0x300000) {
  533. // loc_203474
  534. glVertexAttribPointer(5, 3, GL_BYTE, true, a3, (const void *)r4_pbuf);
  535. r4_pbuf += 4;
  536. } else if ((r5_uint&0xffffff) == 0x200000) {
  537. // loc_20348A
  538. glVertexAttribPointer(5, 4, GL_SHORT, true, a3, (const void *)r4_pbuf);
  539. r4_pbuf += 8;
  540. } else if ((r5_uint&0xffffff) == 0x100000) {
  541. // 00203450
  542. glVertexAttribPointer(5, 3, GL_FLOAT, false, a3, (const void *)r4_pbuf);
  543. r4_pbuf += 12;
  544. }
  545. } else if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[5]) {
  546. CFTTGLES2Wrapper::s_bVertexAttribEnabled[5] = false;
  547. glDisableVertexAttribArray(5);
  548. }
  549. // loc_20349E
  550. if (a2 >= 0x10000000) {
  551. // 002034A6
  552. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[6]!=1) {
  553. // 002034AA
  554. CFTTGLES2Wrapper::s_bVertexAttribEnabled[6] = 1;
  555. glEnableVertexAttribArray(6);
  556. }
  557. // loc_2034B4
  558. glVertexAttribPointer(6, 4, GL_UNSIGNED_BYTE, false, a3, (const void *)r4_pbuf);
  559. r4_pbuf += 4; // 002034C8 04 34 ADDS R4, #4
  560. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[7]!=1) {
  561. CFTTGLES2Wrapper::s_bVertexAttribEnabled[7] = 1;
  562. glEnableVertexAttribArray(7);
  563. }
  564. // loc_2034D8
  565. glVertexAttribPointer(7, 4, GL_UNSIGNED_SHORT, true, a3, r4_pbuf);
  566. } else {
  567. // loc_2034EE
  568. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[6]) {
  569. CFTTGLES2Wrapper::s_bVertexAttribEnabled[6] = false;
  570. glDisableVertexAttribArray(6);
  571. }
  572. // loc_2034FA
  573. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[7]) {
  574. CFTTGLES2Wrapper::s_bVertexAttribEnabled[7] = false;
  575. glDisableVertexAttribArray(7);
  576. }
  577. }
  578. }
  579. //-------------------------------------------------------------------------------------------------
  580. //00202CE4
  581. void CFTTGraphicsDeviceOGLES::setWindowHandle(void *) {
  582. //empty
  583. }
  584. //-------------------------------------------------------------------------------------------------
  585. //00202CEA
  586. void CFTTGraphicsDeviceOGLES::setWireFrame(bool b) {
  587. }
  588. //-------------------------------------------------------------------------------------------------
  589. //00202CB4 //^_^
  590. int CFTTGraphicsDeviceOGLES::width() const {
  591. return 1;
  592. }
  593. //-------------------------------------------------------------------------------------------------
  594. /*
  595. 0020289C CFTTGraphicsDeviceOGLES::CFTTGraphicsDeviceOGLES()
  596. 00202938 CFTTGraphicsDeviceOGLES::GetGPUName(wchar_t *,int)
  597. 00202954 CFTTGraphicsDeviceOGLES::beginScene(CFTTClearSettings const&,CFTTRenderTarget *,bool)
  598. 00202D2C CFTTGraphicsDeviceOGLES::setDepthTest(EFTTDepthTest,bool)
  599. 00202DC0 CFTTGraphicsDeviceOGLES::enableStencilTest(bool)
  600. 0020305C CFTTGraphicsDeviceOGLES::createTexture()
  601. 00203070 CFTTGraphicsDeviceOGLES::createTexture(int,int,int,EFTTTexFormat,EFTTTextureType)
  602. 00203090 CFTTGraphicsDeviceOGLES::createRenderToTexture(EFTTTexFormat,int,int,uint,int,EFTTRTTZBufMode,bool,EFTTTextureType,uchar)
  603. 002030D4 CFTTGraphicsDeviceOGLES::createRenderToTexture(CFTTRTTSetup)
  604. 00203114 CFTTGraphicsDeviceOGLES::getTextureFormatSupport(EFTTTexFormat,bool,bool)
  605. 00203154 CFTTGraphicsDeviceOGLES::createShaderProgram(CFTTUberShader const*,uchar const*,bool)
  606. 00203174 CFTTGraphicsDeviceOGLES::createGraphicsBuffer(EFTTGraphicsBufferType,EFTTGraphicsBufferVolatility,uint)
  607. 00203194 CFTTGraphicsDeviceOGLES::setIndexBuffer(CFTTGraphicsBuffer *)
  608. 002031C4 CFTTGraphicsDeviceOGLES::setVertexBuffer(CFTTGraphicsBuffer *,uint,uint,uint)
  609. 00203518 CFTTGraphicsDeviceOGLES::drawIndexed(FTTPRIMTYPE,int,int,int,int)
  610. 00203594 CFTTGraphicsDeviceOGLES::AssessHardware()
  611. 00203852 CFTTGraphicsDeviceOGLES::TrustGlGenerateMipmap()
  612. 00203868 CFTTGraphicsDeviceOGLES::GetRendererFamily()
  613. 0020386C CFTTGraphicsDeviceOGLES::GetRendererType()
  614. 00203870 CFTTGraphicsDeviceOGLES::Matrices_FlipsRTT()
  615. 00203874 CFTTGraphicsDeviceOGLES::Matrices_FlipsY()
  616. 00203878 CFTTGraphicsDeviceOGLES::Matrices_NDCIsCube()
  617. 0020387C CFTTGraphicsDeviceOGLES::DepthTextureSupported()
  618. 00203898 CFTTGraphicsDeviceOGLES::ARGBToPlatformU32(uint,uint,uint,uint)
  619. 002038A8 CFTTGraphicsDeviceOGLES::ARGBToPlatformU32(uint)
  620. 002038EC CFTTGraphicsDeviceOGLES::ARGBToPlatform4444(uint)
  621. */