CFTTGraphicsDeviceOGLES.cpp 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  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. }
  166. //-------------------------------------------------------------------------------------------------
  167. //00203868 //^_^
  168. int CFTTGraphicsDeviceOGLES::GetRendererFamily() const {
  169. return 0;
  170. }
  171. //-------------------------------------------------------------------------------------------------
  172. //0020386C //^_^
  173. int CFTTGraphicsDeviceOGLES::GetRendererType() const {
  174. return 0;
  175. }
  176. //-------------------------------------------------------------------------------------------------
  177. //00203870 //^_^
  178. int CFTTGraphicsDeviceOGLES::Matrices_FlipsRTT() const {
  179. return 1;
  180. }
  181. //-------------------------------------------------------------------------------------------------
  182. //00203874 //^_^
  183. int CFTTGraphicsDeviceOGLES::Matrices_FlipsY() const {
  184. return 0;
  185. }
  186. //-------------------------------------------------------------------------------------------------
  187. //00203878 //^_^
  188. int CFTTGraphicsDeviceOGLES::Matrices_NDCIsCube() const {
  189. return 1;
  190. }
  191. //-------------------------------------------------------------------------------------------------
  192. //00203920 //^_^
  193. int CFTTGraphicsDeviceOGLES::SupportsThreadedTextureLoading() {
  194. return 0;
  195. }
  196. //-------------------------------------------------------------------------------------------------
  197. //00203852 //^_- 经过单元测试,功能正常
  198. bool CFTTGraphicsDeviceOGLES::TrustGlGenerateMipmap() const {
  199. LOGI("CFTTGraphicsDeviceOGLES::TrustGlGenerateMipmap entry");
  200. bool bret = false;
  201. return bret;
  202. }
  203. //-------------------------------------------------------------------------------------------------
  204. //00202954 -_- 经过单元测试,功能正常
  205. bool CFTTGraphicsDeviceOGLES::beginScene(CFTTClearSettings const &pSetting,
  206. CFTTRenderTarget *pRenderTarget,
  207. bool a4) {
  208. LOGI("CFTTGraphicsDeviceOGLES::beginScene entry");
  209. bool r6_bool;
  210. LOGI("CFTTGraphicsDeviceOGLES::beginScene end");
  211. return true;
  212. }
  213. //-------------------------------------------------------------------------------------------------
  214. //00202924 //^_^
  215. int CFTTGraphicsDeviceOGLES::create() {
  216. AssessHardware();
  217. return 1;
  218. }
  219. //-------------------------------------------------------------------------------------------------
  220. //00203174 //^_^
  221. CFTTGraphicsBuffer *CFTTGraphicsDeviceOGLES::createGraphicsBuffer(EFTTGraphicsBufferType eType,
  222. EFTTGraphicsBufferVolatility eGbv,
  223. uint a3) {
  224. LOGI("CFTTGraphicsDeviceOGLES::createGraphicsBuffer: EFTTGraphicsBufferType=%d; EFTTGraphicsBufferVolatility=%d; a3=%d", eType, eGbv, a3);
  225. return nullptr;
  226. }
  227. //-------------------------------------------------------------------------------------------------
  228. //002030D4 //^_^
  229. CFTTRenderToTexture *CFTTGraphicsDeviceOGLES::createRenderToTexture(CFTTRTTSetup s) {
  230. return nullptr;
  231. }
  232. //-------------------------------------------------------------------------------------------------
  233. //00203090 //^_^
  234. CFTTRenderToTexture *CFTTGraphicsDeviceOGLES::createRenderToTexture(EFTTTexFormat eTexFormat,
  235. int a2,
  236. int a3,
  237. uint a4,
  238. int a5,
  239. EFTTRTTZBufMode eRTTZBufMode,
  240. bool b,
  241. EFTTTextureType eTextureType,
  242. uchar ub) {
  243. return nullptr;
  244. }
  245. //-------------------------------------------------------------------------------------------------
  246. //00203154 //^_^
  247. CFTTShaderProgram *CFTTGraphicsDeviceOGLES::createShaderProgram(CFTTUberShader const *pUberShader,
  248. uchar const *pShader,
  249. bool flag) {
  250. LOGI("CFTTGraphicsDeviceOGLES::createShaderProgram Entry");
  251. return nullptr;
  252. }
  253. //-------------------------------------------------------------------------------------------------
  254. //00203070 //^_^
  255. CFTTTexture *CFTTGraphicsDeviceOGLES::createTexture(int a2, int a3, int a4, EFTTTexFormat eTexFormat, EFTTTextureType eTextureType) {
  256. return nullptr;
  257. }
  258. //-------------------------------------------------------------------------------------------------
  259. //0020305C //^_^
  260. CFTTTexture *CFTTGraphicsDeviceOGLES::createTexture() {
  261. return nullptr;
  262. }
  263. //-------------------------------------------------------------------------------------------------
  264. //00202934
  265. void CFTTGraphicsDeviceOGLES::createVolatileResources() {
  266. //empty
  267. }
  268. //-------------------------------------------------------------------------------------------------
  269. //00202936
  270. void CFTTGraphicsDeviceOGLES::deleteVolatileResources() {
  271. //empty
  272. }
  273. //-------------------------------------------------------------------------------------------------
  274. //00202932
  275. void CFTTGraphicsDeviceOGLES::destroy() {
  276. //empty
  277. }
  278. //-------------------------------------------------------------------------------------------------
  279. //00203038 //^_^
  280. void CFTTGraphicsDeviceOGLES::disableScissorTest() {
  281. }
  282. //-------------------------------------------------------------------------------------------------
  283. //00203518 //^_- 经过单元测试,功能正常
  284. void CFTTGraphicsDeviceOGLES::drawIndexed(FTTPRIMTYPE eType, int a2, int a3, int dindex4, int a5) {
  285. LOGI("CFTTGraphicsDeviceOGLES::drawIndexed Entry");
  286. }
  287. //-------------------------------------------------------------------------------------------------
  288. //0020355C //^_^ 经过单元测试,功能正常
  289. void CFTTGraphicsDeviceOGLES::drawNonIndexed(FTTPRIMTYPE eType, int a2) {
  290. LOGI("CFTTGraphicsDeviceOGLES::drawNonIndexed Entry");
  291. LOGI("CFTTGraphicsDeviceOGLES::drawNonIndexed end");
  292. }
  293. //-------------------------------------------------------------------------------------------------
  294. //00202F54
  295. void CFTTGraphicsDeviceOGLES::enableScissorTest(GLint x, GLint y, GLint dWidth, GLint dHeight) {
  296. }
  297. //-------------------------------------------------------------------------------------------------
  298. //00202DC0 //^_^
  299. void CFTTGraphicsDeviceOGLES::enableStencilTest(bool a2) {
  300. }
  301. //-------------------------------------------------------------------------------------------------
  302. //00202C58 //^_^ 经过单元测试,功能正常
  303. void CFTTGraphicsDeviceOGLES::endScene() {
  304. }
  305. //-------------------------------------------------------------------------------------------------
  306. //00202CD4 //^_^
  307. int CFTTGraphicsDeviceOGLES::getDepthBufferBitDepth() const {
  308. return 1;
  309. }
  310. //-------------------------------------------------------------------------------------------------
  311. //00203114 //^_- 经过单元测试,功能正常
  312. int CFTTGraphicsDeviceOGLES::getTextureFormatSupport(EFTTTexFormat eFormat, bool a3, bool a4) {
  313. LOGI("CFTTGraphicsDeviceOGLES::getTextureFormatSupport entry");
  314. int result = 0;
  315. return result;
  316. }
  317. //-------------------------------------------------------------------------------------------------
  318. //00202CC4 //^_^
  319. int CFTTGraphicsDeviceOGLES::height() const {
  320. return 1;
  321. }
  322. //-------------------------------------------------------------------------------------------------
  323. //00202CE6 //^_^
  324. int CFTTGraphicsDeviceOGLES::resetDisplay(int, int, int, int) {
  325. return 1;
  326. }
  327. //-------------------------------------------------------------------------------------------------
  328. //00202D2C //^_- 经过单元测试,功能正常
  329. void CFTTGraphicsDeviceOGLES::setDepthTest(EFTTDepthTest eDepthTest, bool ba2) {
  330. LOGI("CFTTGraphicsDeviceOGLES::setDepthTest entry");
  331. LOGI("CFTTGraphicsDeviceOGLES::setDepthTest end");
  332. }
  333. //-------------------------------------------------------------------------------------------------
  334. //00202CF0 //^_^
  335. void CFTTGraphicsDeviceOGLES::setDither(bool ba2) {
  336. }
  337. //-------------------------------------------------------------------------------------------------
  338. //00203194 //^_^ 经过单元测试,功能正常
  339. void CFTTGraphicsDeviceOGLES::setIndexBuffer(CFTTGraphicsBuffer *pBuffer) {
  340. }
  341. //-------------------------------------------------------------------------------------------------
  342. //00202DFC //^_^
  343. void CFTTGraphicsDeviceOGLES::setStencilFunc(EFTTStencilFunc eFunc, GLuint a_ref, GLuint a_mask) {
  344. }
  345. //-------------------------------------------------------------------------------------------------
  346. //00202F38 //^_^
  347. void CFTTGraphicsDeviceOGLES::setStencilMask(GLuint a_mask) {
  348. }
  349. //-------------------------------------------------------------------------------------------------
  350. //00202E84
  351. void CFTTGraphicsDeviceOGLES::setStencilOp(EFTTStencilOp esfail,
  352. EFTTStencilOp ezfail,
  353. EFTTStencilOp ezpass) {
  354. //void glStencilOp(GLenum sfail, GLenum zfail, GLenum zpass)
  355. }
  356. //-------------------------------------------------------------------------------------------------
  357. //002031C4 //-_- 经过单元测试,功能正常
  358. void CFTTGraphicsDeviceOGLES::setVertexBuffer(CFTTGraphicsBuffer *pGraphBuf, uint a2, uint a3, uint a4) {
  359. uchar *r4_pbuf = (uchar *)a4;
  360. CFTTGraphicsBufferOGLES *pBufOGLES = (CFTTGraphicsBufferOGLES *)pGraphBuf;
  361. if (CFTTGLES2Wrapper::s_uBoundArrayBuffer != pBufOGLES->bindBuf_10) {
  362. CFTTGLES2Wrapper::s_uBoundArrayBuffer = pBufOGLES->bindBuf_10;
  363. glBindBuffer(GL_ARRAY_BUFFER, pBufOGLES->bindBuf_10);
  364. }
  365. //LOGE("CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]=%x",CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]);
  366. // LOGE("CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]=%x",CFTTGLES2Wrapper::s_bVertexAttribEnabled[1]);
  367. // LOGE("CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]=%x",CFTTGLES2Wrapper::s_bVertexAttribEnabled[2]);
  368. // LOGE("CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]=%x",CFTTGLES2Wrapper::s_bVertexAttribEnabled[3]);
  369. // LOGE("CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]=%x",CFTTGLES2Wrapper::s_bVertexAttribEnabled[4]);
  370. // LOGE("CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]=%x",CFTTGLES2Wrapper::s_bVertexAttribEnabled[5]);
  371. // LOGE("CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]=%x",CFTTGLES2Wrapper::s_bVertexAttribEnabled[6]);
  372. // LOGE("CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]=%x",CFTTGLES2Wrapper::s_bVertexAttribEnabled[7]);
  373. // loc_2031EA
  374. if (!pBufOGLES->bindBuf_10)
  375. r4_pbuf = pBufOGLES->pBuf_C + a4; // 002031EE 04 44 ADD R4, R0
  376. // loc_2031F0
  377. uint r11_uint = a2 & 0xF00;
  378. uint r5_uint = a2 & 0xF000;
  379. uint r10_uint = r11_uint;
  380. if ((a2 & 0xF000000) != 0x2000000)
  381. r10_uint = 0;
  382. // 0020320C
  383. if (a2 & 0xF) {
  384. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]!=1) {
  385. // 0020321A
  386. CFTTGLES2Wrapper::s_bVertexAttribEnabled[0] = 1;
  387. glEnableVertexAttribArray(0);
  388. }
  389. // loc_203224
  390. switch (a2 & 0xF) {
  391. case 1:
  392. // loc_203238
  393. glVertexAttribPointer(0, 3, GL_FLOAT, false, a3, (const void *)r4_pbuf); // GL_FLOAT
  394. r4_pbuf += 12;
  395. break;
  396. case 2:
  397. // loc_20325C
  398. glVertexAttribPointer(0, 3, GL_SHORT, true, a3, (const void *)r4_pbuf);
  399. r4_pbuf += 8;
  400. break;
  401. case 3:
  402. // loc_203266
  403. glVertexAttribPointer(0, 3, GL_BYTE, false, a3, (const void *)r4_pbuf); // GL_BYTE
  404. r4_pbuf += 4;
  405. break;
  406. case 4:
  407. // loc_20327C
  408. glVertexAttribPointer(0, 2, GL_FLOAT, false, a3, (const void *)r4_pbuf); // GL_FLOAT
  409. r4_pbuf += 8;
  410. break;
  411. case 5:
  412. // loc_20328C
  413. glVertexAttribPointer(0, 4, GL_SHORT, true, a3, (const void *)r4_pbuf); // GL_SHORT
  414. r4_pbuf += 8;
  415. break;
  416. default:
  417. break;
  418. }
  419. } else if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[0]) { // loc_20324E
  420. // 00203250
  421. CFTTGLES2Wrapper::s_bVertexAttribEnabled[0] = false;
  422. glDisableVertexAttribArray(0);
  423. }
  424. // break_20322E
  425. if (r5_uint) {
  426. // 002032A8
  427. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[2]!=1) {
  428. // 002032AC
  429. CFTTGLES2Wrapper::s_bVertexAttribEnabled[2] = 1;
  430. glEnableVertexAttribArray(2);
  431. }
  432. // loc_2032B6
  433. switch (r5_uint) {
  434. case 0x3000:
  435. // loc_2032EC
  436. glVertexAttribPointer(2, 3, GL_BYTE, true, a3, (const void *)r4_pbuf);
  437. r4_pbuf += 4;
  438. break;
  439. case 0x2000u:
  440. // loc_203302
  441. glVertexAttribPointer(2, 4, GL_SHORT, true, a3, (const void *)r4_pbuf);
  442. r4_pbuf += 8;
  443. break;
  444. case 0x1000u:
  445. // 002032C8
  446. glVertexAttribPointer(2, 3, GL_FLOAT, false, a3, (const void *)r4_pbuf);
  447. r4_pbuf += 12;
  448. break;
  449. }
  450. } else if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[2]) { // loc_2032DE
  451. // 002032E0
  452. CFTTGLES2Wrapper::s_bVertexAttribEnabled[2] = false;
  453. glDisableVertexAttribArray(2);
  454. }
  455. // loc_203316
  456. uint r7_uint = a2 & 0xF0;
  457. if (r7_uint) {
  458. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[1]!=1) {
  459. CFTTGLES2Wrapper::s_bVertexAttribEnabled[1] = 1;
  460. glEnableVertexAttribArray(1);
  461. }
  462. // loc_203328
  463. if (r7_uint == 32) {
  464. // loc_203354
  465. glVertexAttribPointer(1, 4, GL_FLOAT, false, a3, (const void *)r4_pbuf);
  466. r4_pbuf += 16;
  467. } else if (r7_uint == 16) {
  468. // 00203330
  469. glVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE, true, a3, (const void *)r4_pbuf);
  470. r4_pbuf += 4;
  471. }
  472. } else if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[1]) { // loc_203346
  473. CFTTGLES2Wrapper::s_bVertexAttribEnabled[1] = false;
  474. glDisableVertexAttribArray(1);
  475. }
  476. // loc_203368
  477. if (r11_uint) {
  478. // 00203370
  479. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[3]!=1) {
  480. // 00203374
  481. CFTTGLES2Wrapper::s_bVertexAttribEnabled[3] = 1;
  482. glEnableVertexAttribArray(3);
  483. }
  484. // loc_20337E
  485. r11_uint=r11_uint&0xFFF;
  486. if (r11_uint == 0x200) {
  487. // loc_2033B2
  488. glVertexAttribPointer(3, 2, GL_SHORT, true, a3, (const void *)r4_pbuf);
  489. r4_pbuf += 4;
  490. } else if (r11_uint == 0x100) {
  491. // 0020338E
  492. glVertexAttribPointer(3, 2, GL_FLOAT, false, a3, (const void *)r4_pbuf);
  493. r4_pbuf += 8;
  494. }
  495. } else if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[3]) { // loc_2033A4
  496. CFTTGLES2Wrapper::s_bVertexAttribEnabled[3] = false;
  497. glDisableVertexAttribArray(3);
  498. }
  499. // loc_2033C6
  500. if (r10_uint) {
  501. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[4]!=1) {
  502. CFTTGLES2Wrapper::s_bVertexAttribEnabled[4] = 1;
  503. glEnableVertexAttribArray(4);
  504. }
  505. // loc_2033E0
  506. if ((r10_uint & 0xFFF) == 0x200) {
  507. // loc_203414
  508. glVertexAttribPointer(4, 2, GL_SHORT, true, a3, (const void *)r4_pbuf);
  509. r4_pbuf += 4;
  510. } else if ((r10_uint & 0xFFF) == 0x100) {
  511. // loc_203428
  512. glVertexAttribPointer(4, 2, GL_FLOAT, false, a3, (const void *)r4_pbuf);
  513. r4_pbuf += 8;
  514. }
  515. } else if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[4]) { // loc_203406
  516. CFTTGLES2Wrapper::s_bVertexAttribEnabled[4] = false;
  517. glDisableVertexAttribArray(4);
  518. }
  519. // loc_203428
  520. r5_uint = a2 & 0xF00000; ////loc_2033C6
  521. if (r5_uint) {
  522. // 0020342C
  523. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[5]!=1) {
  524. // 00203430
  525. CFTTGLES2Wrapper::s_bVertexAttribEnabled[5] = true;
  526. glEnableVertexAttribArray(5);
  527. }
  528. // loc_20343A
  529. if ((r5_uint&0xffffff) == 0x300000) {
  530. // loc_203474
  531. glVertexAttribPointer(5, 3, GL_BYTE, true, a3, (const void *)r4_pbuf);
  532. r4_pbuf += 4;
  533. } else if ((r5_uint&0xffffff) == 0x200000) {
  534. // loc_20348A
  535. glVertexAttribPointer(5, 4, GL_SHORT, true, a3, (const void *)r4_pbuf);
  536. r4_pbuf += 8;
  537. } else if ((r5_uint&0xffffff) == 0x100000) {
  538. // 00203450
  539. glVertexAttribPointer(5, 3, GL_FLOAT, false, a3, (const void *)r4_pbuf);
  540. r4_pbuf += 12;
  541. }
  542. } else if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[5]) {
  543. CFTTGLES2Wrapper::s_bVertexAttribEnabled[5] = false;
  544. glDisableVertexAttribArray(5);
  545. }
  546. // loc_20349E
  547. if (a3 >= 0x10000000) {
  548. // 002034A6
  549. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[6]!=1) {
  550. // 002034AA
  551. CFTTGLES2Wrapper::s_bVertexAttribEnabled[6] = 0;
  552. glEnableVertexAttribArray(6);
  553. }
  554. // loc_2034B4
  555. glVertexAttribPointer(6, 4, GL_UNSIGNED_BYTE, false, a3, (const void *)r4_pbuf);
  556. r4_pbuf += 4; // 002034C8 04 34 ADDS R4, #4
  557. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[7]!=1) {
  558. CFTTGLES2Wrapper::s_bVertexAttribEnabled[7] = 1;
  559. glEnableVertexAttribArray(7);
  560. }
  561. // loc_2034D8
  562. glVertexAttribPointer(7, 4, GL_UNSIGNED_SHORT, true, a3, r4_pbuf);
  563. } else {
  564. // loc_2034EE
  565. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[6]) {
  566. CFTTGLES2Wrapper::s_bVertexAttribEnabled[6] = false;
  567. glDisableVertexAttribArray(6);
  568. }
  569. // loc_2034FA
  570. if (CFTTGLES2Wrapper::s_bVertexAttribEnabled[7]) {
  571. CFTTGLES2Wrapper::s_bVertexAttribEnabled[7] = false;
  572. glDisableVertexAttribArray(7);
  573. }
  574. }
  575. }
  576. //-------------------------------------------------------------------------------------------------
  577. //00202CE4
  578. void CFTTGraphicsDeviceOGLES::setWindowHandle(void *) {
  579. //empty
  580. }
  581. //-------------------------------------------------------------------------------------------------
  582. //00202CEA
  583. void CFTTGraphicsDeviceOGLES::setWireFrame(bool b) {
  584. }
  585. //-------------------------------------------------------------------------------------------------
  586. //00202CB4 //^_^
  587. int CFTTGraphicsDeviceOGLES::width() const {
  588. return 1;
  589. }
  590. //-------------------------------------------------------------------------------------------------
  591. /*
  592. 0020289C CFTTGraphicsDeviceOGLES::CFTTGraphicsDeviceOGLES()
  593. 00202938 CFTTGraphicsDeviceOGLES::GetGPUName(wchar_t *,int)
  594. 00202954 CFTTGraphicsDeviceOGLES::beginScene(CFTTClearSettings const&,CFTTRenderTarget *,bool)
  595. 00202D2C CFTTGraphicsDeviceOGLES::setDepthTest(EFTTDepthTest,bool)
  596. 00202DC0 CFTTGraphicsDeviceOGLES::enableStencilTest(bool)
  597. 0020305C CFTTGraphicsDeviceOGLES::createTexture()
  598. 00203070 CFTTGraphicsDeviceOGLES::createTexture(int,int,int,EFTTTexFormat,EFTTTextureType)
  599. 00203090 CFTTGraphicsDeviceOGLES::createRenderToTexture(EFTTTexFormat,int,int,uint,int,EFTTRTTZBufMode,bool,EFTTTextureType,uchar)
  600. 002030D4 CFTTGraphicsDeviceOGLES::createRenderToTexture(CFTTRTTSetup)
  601. 00203114 CFTTGraphicsDeviceOGLES::getTextureFormatSupport(EFTTTexFormat,bool,bool)
  602. 00203154 CFTTGraphicsDeviceOGLES::createShaderProgram(CFTTUberShader const*,uchar const*,bool)
  603. 00203174 CFTTGraphicsDeviceOGLES::createGraphicsBuffer(EFTTGraphicsBufferType,EFTTGraphicsBufferVolatility,uint)
  604. 00203194 CFTTGraphicsDeviceOGLES::setIndexBuffer(CFTTGraphicsBuffer *)
  605. 002031C4 CFTTGraphicsDeviceOGLES::setVertexBuffer(CFTTGraphicsBuffer *,uint,uint,uint)
  606. 00203518 CFTTGraphicsDeviceOGLES::drawIndexed(FTTPRIMTYPE,int,int,int,int)
  607. 00203594 CFTTGraphicsDeviceOGLES::AssessHardware()
  608. 00203852 CFTTGraphicsDeviceOGLES::TrustGlGenerateMipmap()
  609. 00203868 CFTTGraphicsDeviceOGLES::GetRendererFamily()
  610. 0020386C CFTTGraphicsDeviceOGLES::GetRendererType()
  611. 00203870 CFTTGraphicsDeviceOGLES::Matrices_FlipsRTT()
  612. 00203874 CFTTGraphicsDeviceOGLES::Matrices_FlipsY()
  613. 00203878 CFTTGraphicsDeviceOGLES::Matrices_NDCIsCube()
  614. 0020387C CFTTGraphicsDeviceOGLES::DepthTextureSupported()
  615. 00203898 CFTTGraphicsDeviceOGLES::ARGBToPlatformU32(uint,uint,uint,uint)
  616. 002038A8 CFTTGraphicsDeviceOGLES::ARGBToPlatformU32(uint)
  617. 002038EC CFTTGraphicsDeviceOGLES::ARGBToPlatform4444(uint)
  618. */