CFTTGraphicsDeviceOGLES.cpp 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  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. void CFTTGraphicsDeviceOGLES::setVertexBuffer(CFTTGraphicsBuffer *pGraphBuf, uint a2, uint a3, uint a4) {
  360. uchar *r4_pbuf = (uchar *)a4;
  361. CFTTGraphicsBufferOGLES *pBufOGLES = (CFTTGraphicsBufferOGLES *)pGraphBuf;
  362. if (CFTTGLES2Wrapper::s_uBoundArrayBuffer != pBufOGLES->bindBuf_10) {
  363. CFTTGLES2Wrapper::s_uBoundArrayBuffer = pBufOGLES->bindBuf_10;
  364. glBindBuffer(GL_ARRAY_BUFFER, pBufOGLES->bindBuf_10);
  365. }
  366. //LOGE("CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]=%x",CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]);
  367. // LOGE("CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]=%x",CFTTGLES2Wrapper::s_bVertexAttribEnabled[1]);
  368. // LOGE("CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]=%x",CFTTGLES2Wrapper::s_bVertexAttribEnabled[2]);
  369. // LOGE("CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]=%x",CFTTGLES2Wrapper::s_bVertexAttribEnabled[3]);
  370. // LOGE("CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]=%x",CFTTGLES2Wrapper::s_bVertexAttribEnabled[4]);
  371. // LOGE("CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]=%x",CFTTGLES2Wrapper::s_bVertexAttribEnabled[5]);
  372. // LOGE("CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]=%x",CFTTGLES2Wrapper::s_bVertexAttribEnabled[6]);
  373. // LOGE("CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]=%x",CFTTGLES2Wrapper::s_bVertexAttribEnabled[7]);
  374. // loc_2031EA
  375. if (!pBufOGLES->bindBuf_10)
  376. r4_pbuf = pBufOGLES->pBuf_C + a4; // 002031EE 04 44 ADD R4, R0
  377. // loc_2031F0
  378. uint r11_uint = a2 & 0xF00;
  379. uint r5_uint = a2 & 0xF000;
  380. uint r10_uint = r11_uint;
  381. if ((a2 & 0xF000000) != 0x2000000)
  382. r10_uint = 0;
  383. // 0020320C
  384. if (a2 & 0xF) {
  385. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]!=1) {
  386. // 0020321A
  387. CFTTGLES2Wrapper::s_bVertexAttribEnabled[0] = 1;
  388. glEnableVertexAttribArray(0);
  389. }
  390. // loc_203224
  391. switch (a2 & 0xF) {
  392. case 1:
  393. // loc_203238
  394. glVertexAttribPointer(0, 3, GL_FLOAT, false, a3, (const void *)r4_pbuf); // GL_FLOAT
  395. r4_pbuf += 12;
  396. break;
  397. case 2:
  398. // loc_20325C
  399. glVertexAttribPointer(0, 3, GL_SHORT, true, a3, (const void *)r4_pbuf);
  400. r4_pbuf += 8;
  401. break;
  402. case 3:
  403. // loc_203266
  404. glVertexAttribPointer(0, 3, GL_BYTE, false, a3, (const void *)r4_pbuf); // GL_BYTE
  405. r4_pbuf += 4;
  406. break;
  407. case 4:
  408. // loc_20327C
  409. glVertexAttribPointer(0, 2, GL_FLOAT, false, a3, (const void *)r4_pbuf); // GL_FLOAT
  410. r4_pbuf += 8;
  411. break;
  412. case 5:
  413. // loc_20328C
  414. glVertexAttribPointer(0, 4, GL_SHORT, true, a3, (const void *)r4_pbuf); // GL_SHORT
  415. r4_pbuf += 8;
  416. break;
  417. default:
  418. break;
  419. }
  420. } else if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]) { // loc_20324E
  421. // 00203250
  422. CFTTGLES2Wrapper::s_bVertexAttribEnabled[0] = false;
  423. glDisableVertexAttribArray(0);
  424. }
  425. // break_20322E
  426. if (r5_uint) {
  427. // 002032A8
  428. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[2]!=1) {
  429. // 002032AC
  430. CFTTGLES2Wrapper::s_bVertexAttribEnabled[2] = 1;
  431. glEnableVertexAttribArray(2);
  432. }
  433. // loc_2032B6
  434. switch (r5_uint) {
  435. case 0x3000:
  436. // loc_2032EC
  437. glVertexAttribPointer(2, 3, GL_BYTE, true, a3, (const void *)r4_pbuf);
  438. r4_pbuf += 4;
  439. break;
  440. case 0x2000u:
  441. // loc_203302
  442. glVertexAttribPointer(2, 4, GL_SHORT, true, a3, (const void *)r4_pbuf);
  443. r4_pbuf += 8;
  444. break;
  445. case 0x1000u:
  446. // 002032C8
  447. glVertexAttribPointer(2, 3, GL_FLOAT, false, a3, (const void *)r4_pbuf);
  448. r4_pbuf += 12;
  449. break;
  450. }
  451. } else if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[2]) { // loc_2032DE
  452. // 002032E0
  453. CFTTGLES2Wrapper::s_bVertexAttribEnabled[2] = false;
  454. glDisableVertexAttribArray(2);
  455. }
  456. // loc_203316
  457. uint r7_uint = a2 & 0xF0;
  458. if (r7_uint) {
  459. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[1]!=1) {
  460. CFTTGLES2Wrapper::s_bVertexAttribEnabled[1] = 1;
  461. glEnableVertexAttribArray(1);
  462. }
  463. // loc_203328
  464. if (r7_uint == 32) {
  465. // loc_203354
  466. glVertexAttribPointer(1, 4, GL_FLOAT, false, a3, (const void *)r4_pbuf);
  467. r4_pbuf += 16;
  468. } else if (r7_uint == 16) {
  469. // 00203330
  470. glVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE, true, a3, (const void *)r4_pbuf);
  471. r4_pbuf += 4;
  472. }
  473. } else if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[1]) { // loc_203346
  474. CFTTGLES2Wrapper::s_bVertexAttribEnabled[1] = false;
  475. glDisableVertexAttribArray(1);
  476. }
  477. // loc_203368
  478. if (r11_uint) {
  479. // 00203370
  480. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[3]!=1) {
  481. // 00203374
  482. CFTTGLES2Wrapper::s_bVertexAttribEnabled[3] = 1;
  483. glEnableVertexAttribArray(3);
  484. }
  485. // loc_20337E
  486. r11_uint=r11_uint&0xFFF;
  487. if (r11_uint == 0x200) {
  488. // loc_2033B2
  489. glVertexAttribPointer(3, 2, GL_SHORT, true, a3, (const void *)r4_pbuf);
  490. r4_pbuf += 4;
  491. } else if (r11_uint == 0x100) {
  492. // 0020338E
  493. glVertexAttribPointer(3, 2, GL_FLOAT, false, a3, (const void *)r4_pbuf);
  494. r4_pbuf += 8;
  495. }
  496. } else if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[3]) { // loc_2033A4
  497. CFTTGLES2Wrapper::s_bVertexAttribEnabled[3] = false;
  498. glDisableVertexAttribArray(3);
  499. }
  500. // loc_2033C6
  501. if (r10_uint) {
  502. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[4]!=1) {
  503. CFTTGLES2Wrapper::s_bVertexAttribEnabled[4] = 1;
  504. glEnableVertexAttribArray(4);
  505. }
  506. // loc_2033E0
  507. if ((r10_uint & 0xFFF) == 0x200) {
  508. // loc_203414
  509. glVertexAttribPointer(4, 2, GL_SHORT, true, a3, (const void *)r4_pbuf);
  510. r4_pbuf += 4;
  511. } else if ((r10_uint & 0xFFF) == 0x100) {
  512. // loc_203428
  513. glVertexAttribPointer(4, 2, GL_FLOAT, false, a3, (const void *)r4_pbuf);
  514. r4_pbuf += 8;
  515. }
  516. } else if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[4]) { // loc_203406
  517. CFTTGLES2Wrapper::s_bVertexAttribEnabled[4] = false;
  518. glDisableVertexAttribArray(4);
  519. }
  520. // loc_203428
  521. r5_uint = a2 & 0xF00000; ////loc_2033C6
  522. if (r5_uint) {
  523. // 0020342C
  524. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[5]!=1) {
  525. // 00203430
  526. CFTTGLES2Wrapper::s_bVertexAttribEnabled[5] = true;
  527. glEnableVertexAttribArray(5);
  528. }
  529. // loc_20343A
  530. if ((r5_uint&0xffffff) == 0x300000) {
  531. // loc_203474
  532. glVertexAttribPointer(5, 3, GL_BYTE, true, a3, (const void *)r4_pbuf);
  533. r4_pbuf += 4;
  534. } else if ((r5_uint&0xffffff) == 0x200000) {
  535. // loc_20348A
  536. glVertexAttribPointer(5, 4, GL_SHORT, true, a3, (const void *)r4_pbuf);
  537. r4_pbuf += 8;
  538. } else if ((r5_uint&0xffffff) == 0x100000) {
  539. // 00203450
  540. glVertexAttribPointer(5, 3, GL_FLOAT, false, a3, (const void *)r4_pbuf);
  541. r4_pbuf += 12;
  542. }
  543. } else if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[5]) {
  544. CFTTGLES2Wrapper::s_bVertexAttribEnabled[5] = false;
  545. glDisableVertexAttribArray(5);
  546. }
  547. // loc_20349E
  548. if (a3 >= 0x10000000) {
  549. // 002034A6
  550. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[6]!=1) {
  551. // 002034AA
  552. CFTTGLES2Wrapper::s_bVertexAttribEnabled[6] = 0;
  553. glEnableVertexAttribArray(6);
  554. }
  555. // loc_2034B4
  556. glVertexAttribPointer(6, 4, GL_UNSIGNED_BYTE, false, a3, (const void *)r4_pbuf);
  557. r4_pbuf += 4; // 002034C8 04 34 ADDS R4, #4
  558. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[7]!=1) {
  559. CFTTGLES2Wrapper::s_bVertexAttribEnabled[7] = 1;
  560. glEnableVertexAttribArray(7);
  561. }
  562. // loc_2034D8
  563. glVertexAttribPointer(7, 4, GL_UNSIGNED_SHORT, true, a3, r4_pbuf);
  564. } else {
  565. // loc_2034EE
  566. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[6]) {
  567. CFTTGLES2Wrapper::s_bVertexAttribEnabled[6] = false;
  568. glDisableVertexAttribArray(6);
  569. }
  570. // loc_2034FA
  571. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[7]) {
  572. CFTTGLES2Wrapper::s_bVertexAttribEnabled[7] = false;
  573. glDisableVertexAttribArray(7);
  574. }
  575. }
  576. }
  577. //-------------------------------------------------------------------------------------------------
  578. //00202CE4
  579. void CFTTGraphicsDeviceOGLES::setWindowHandle(void *) {
  580. //empty
  581. }
  582. //-------------------------------------------------------------------------------------------------
  583. //00202CEA
  584. void CFTTGraphicsDeviceOGLES::setWireFrame(bool b) {
  585. }
  586. //-------------------------------------------------------------------------------------------------
  587. //00202CB4 //^_^
  588. int CFTTGraphicsDeviceOGLES::width() const {
  589. return 1;
  590. }
  591. //-------------------------------------------------------------------------------------------------
  592. /*
  593. 0020289C CFTTGraphicsDeviceOGLES::CFTTGraphicsDeviceOGLES()
  594. 00202938 CFTTGraphicsDeviceOGLES::GetGPUName(wchar_t *,int)
  595. 00202954 CFTTGraphicsDeviceOGLES::beginScene(CFTTClearSettings const&,CFTTRenderTarget *,bool)
  596. 00202D2C CFTTGraphicsDeviceOGLES::setDepthTest(EFTTDepthTest,bool)
  597. 00202DC0 CFTTGraphicsDeviceOGLES::enableStencilTest(bool)
  598. 0020305C CFTTGraphicsDeviceOGLES::createTexture()
  599. 00203070 CFTTGraphicsDeviceOGLES::createTexture(int,int,int,EFTTTexFormat,EFTTTextureType)
  600. 00203090 CFTTGraphicsDeviceOGLES::createRenderToTexture(EFTTTexFormat,int,int,uint,int,EFTTRTTZBufMode,bool,EFTTTextureType,uchar)
  601. 002030D4 CFTTGraphicsDeviceOGLES::createRenderToTexture(CFTTRTTSetup)
  602. 00203114 CFTTGraphicsDeviceOGLES::getTextureFormatSupport(EFTTTexFormat,bool,bool)
  603. 00203154 CFTTGraphicsDeviceOGLES::createShaderProgram(CFTTUberShader const*,uchar const*,bool)
  604. 00203174 CFTTGraphicsDeviceOGLES::createGraphicsBuffer(EFTTGraphicsBufferType,EFTTGraphicsBufferVolatility,uint)
  605. 00203194 CFTTGraphicsDeviceOGLES::setIndexBuffer(CFTTGraphicsBuffer *)
  606. 002031C4 CFTTGraphicsDeviceOGLES::setVertexBuffer(CFTTGraphicsBuffer *,uint,uint,uint)
  607. 00203518 CFTTGraphicsDeviceOGLES::drawIndexed(FTTPRIMTYPE,int,int,int,int)
  608. 00203594 CFTTGraphicsDeviceOGLES::AssessHardware()
  609. 00203852 CFTTGraphicsDeviceOGLES::TrustGlGenerateMipmap()
  610. 00203868 CFTTGraphicsDeviceOGLES::GetRendererFamily()
  611. 0020386C CFTTGraphicsDeviceOGLES::GetRendererType()
  612. 00203870 CFTTGraphicsDeviceOGLES::Matrices_FlipsRTT()
  613. 00203874 CFTTGraphicsDeviceOGLES::Matrices_FlipsY()
  614. 00203878 CFTTGraphicsDeviceOGLES::Matrices_NDCIsCube()
  615. 0020387C CFTTGraphicsDeviceOGLES::DepthTextureSupported()
  616. 00203898 CFTTGraphicsDeviceOGLES::ARGBToPlatformU32(uint,uint,uint,uint)
  617. 002038A8 CFTTGraphicsDeviceOGLES::ARGBToPlatformU32(uint)
  618. 002038EC CFTTGraphicsDeviceOGLES::ARGBToPlatform4444(uint)
  619. */