CFTTGraphicsDevice.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. //CFTTGraphicsDevice - [2020-04-13 11:57:46]
  2. #ifndef _CFTTGRAPHICSDEVICE_H_
  3. #define _CFTTGRAPHICSDEVICE_H_
  4. #include <GLES/egl.h>
  5. #include "CFTTRenderTarget.h"
  6. #include "CFTTGraphicsBuffer.h"
  7. #include "CFTTTexture.h"
  8. #include "CFTTShaderProgram.h"
  9. #include "CFTTGLES2Wrapper.h"
  10. #include "CFTTRenderToTexture.h"
  11. /*
  12. 00203924 CFTTGraphicsDevice::CreateThreadedTextureLoadingContext()
  13. 0020388C CFTTGraphicsDevice::DepthMultisampleSupported()
  14. 00203880 CFTTGraphicsDevice::FloatTextureSupported()
  15. 00203888 CFTTGraphicsDevice::MultisampleSupported()
  16. 00203926 CFTTGraphicsDevice::ReleaseThreadedTextureLoadingContext()
  17. 00203892 CFTTGraphicsDevice::StencilMultisampleSupported()
  18. 002052BE CFTTGraphicsDevice::SupportsThreadedTextureLoading()
  19. 00203884 CFTTGraphicsDevice::TextureLODSupported()
  20. 00203928 CFTTGraphicsDevice::savePipelineCache()
  21. 0x3C
  22. */
  23. enum EFTTStencilOp {
  24. EFTTStencilOp_0,
  25. EFTTStencilOp_1,
  26. EFTTStencilOp_2,
  27. EFTTStencilOp_3,
  28. EFTTStencilOp_4,
  29. EFTTStencilOp_5,
  30. EFTTStencilOp_6,
  31. EFTTStencilOp_7,
  32. };
  33. enum EFTTDepthTest {
  34. EFTTDepthTest_0,
  35. EFTTDepthTest_1,
  36. EFTTDepthTest_2,
  37. EFTTDepthTest_3,
  38. EFTTDepthTest_4,
  39. EFTTDepthTest_5,
  40. EFTTDepthTest_6,
  41. EFTTDepthTest_7,
  42. EFTTDepthTest_8,
  43. };
  44. struct CFTTRTTSetup {
  45. EFTTTextureType eTextureType_0;
  46. EFTTTexFormat eTexFormat_4;
  47. EFTTRTTZBufMode eRTTZBufMode_8;
  48. bool bool_C;
  49. int dWidth_10;
  50. int dheight_14;
  51. uint dCount_18;
  52. int field_1C;
  53. uchar byte_20;
  54. CFTTRenderToTexture *pRenderToTexture_24;
  55. };
  56. enum GraphicsState {
  57. GraphicsState_0,
  58. GraphicsState_1,
  59. GraphicsState_2,
  60. GraphicsState_3,
  61. GraphicsState_4,
  62. GraphicsState_5,
  63. };
  64. extern GraphicsState FTT_eGraphicsState;
  65. class CFTTGraphicsDevice {
  66. public:
  67. //CFTTGraphicsDevice();
  68. virtual ~CFTTGraphicsDevice();
  69. virtual int create() = 0;
  70. virtual void destroy() = 0;
  71. virtual void createVolatileResources() = 0;
  72. virtual void deleteVolatileResources() = 0;
  73. virtual int GetRendererFamily() const = 0;
  74. virtual int GetRendererType() const = 0;
  75. virtual int Matrices_FlipsRTT() const = 0;
  76. virtual int Matrices_FlipsY() const = 0;
  77. virtual int Matrices_NDCIsCube() const = 0;
  78. virtual bool DepthTextureSupported() const = 0;
  79. virtual void GetGPUName(wchar_t *, int) const = 0;
  80. virtual bool FloatTextureSupported() const; //00203880
  81. virtual bool TextureLODSupported() const; //00203884
  82. virtual bool MultisampleSupported() const; //00203888
  83. virtual bool DepthMultisampleSupported(); //0020388C
  84. virtual bool StencilMultisampleSupported() const; //00203892
  85. virtual uint ARGBToPlatformU32(uint, uint, uint, uint) const = 0;
  86. virtual uint ARGBToPlatformU32(uint) const = 0;
  87. virtual uint ExtractAFromPlatformU32(uint) const = 0;
  88. virtual uint ExtractRFromPlatformU32(uint8) const = 0;
  89. virtual uint ExtractGFromPlatformU32(uint) const = 0;
  90. virtual uint ExtractBFromPlatformU32(uint) const = 0;
  91. virtual ushort ARGBToPlatform4444(uint, uint, uint, uint) const = 0;
  92. virtual uint ARGBToPlatform4444(uint) const = 0;
  93. virtual uint ExtractAFromPlatform4444(ushort) const = 0;
  94. virtual uint ExtractRFromPlatform4444(ushort) const = 0;
  95. virtual uint ExtractGFromPlatform4444(ushort) const = 0;
  96. virtual uint ExtractBFromPlatform4444(ushort) const = 0;
  97. virtual bool beginScene(CFTTClearSettings const &, CFTTRenderTarget *, bool) = 0;
  98. virtual void endScene() = 0;
  99. virtual int width() const = 0;
  100. virtual int height() const = 0;
  101. virtual int getDepthBufferBitDepth() const = 0;
  102. virtual void setWindowHandle(void *) = 0;
  103. virtual int resetDisplay(int, int, int, int) = 0;
  104. virtual int SupportsThreadedTextureLoading(); //002052BE
  105. virtual void CreateThreadedTextureLoadingContext(); //00203924
  106. virtual void ReleaseThreadedTextureLoadingContext(); //00203926
  107. virtual void savePipelineCache(); //00203928
  108. virtual void setWireFrame(bool) = 0;
  109. virtual void setDither(bool) = 0;
  110. virtual void setDepthTest(EFTTDepthTest, bool) = 0;
  111. virtual void enableStencilTest(bool) = 0;
  112. virtual void setStencilFunc(EFTTStencilFunc, GLuint, GLuint) = 0;
  113. virtual void setStencilOp(EFTTStencilOp, EFTTStencilOp, EFTTStencilOp) = 0;
  114. virtual void setStencilMask(uint) = 0;
  115. virtual void enableScissorTest(int, int, int, int) = 0;
  116. virtual void disableScissorTest() = 0;
  117. virtual CFTTTexture *createTexture() = 0;
  118. virtual CFTTTexture *createTexture(int, int, int, EFTTTexFormat, EFTTTextureType) = 0;
  119. virtual CFTTRenderToTexture *createRenderToTexture(EFTTTexFormat eFormat1,
  120. int a2,
  121. int a3,
  122. uint a4,
  123. int a5,
  124. EFTTRTTZBufMode eMode6,
  125. bool b7,
  126. EFTTTextureType eType8,
  127. uchar c9) = 0;
  128. virtual CFTTRenderToTexture *createRenderToTexture(CFTTRTTSetup) = 0;
  129. virtual int getTextureFormatSupport(EFTTTexFormat, bool, bool) = 0;
  130. virtual CFTTShaderProgram *createShaderProgram(CFTTUberShader const *, uchar const *, bool) = 0;
  131. virtual CFTTGraphicsBuffer *createGraphicsBuffer(EFTTGraphicsBufferType, EFTTGraphicsBufferVolatility, uint) = 0;
  132. virtual void setIndexBuffer(CFTTGraphicsBuffer *) = 0;
  133. virtual void setVertexBuffer(CFTTGraphicsBuffer *, uint, uint, uint) = 0;
  134. virtual void drawIndexed(FTTPRIMTYPE, int, int, int, int) = 0;
  135. virtual void drawNonIndexed(FTTPRIMTYPE, int) = 0;
  136. virtual void AssessHardware() = 0;
  137. uint8 field_4;
  138. uint8 reserve_5; //以下三个是对齐用的
  139. uint8 reserve_6;
  140. uint8 reserve_7;
  141. uint8 byte_8;
  142. bool bMapbuffer_9;
  143. uint8 byte_A;
  144. bool bIsGLES3_B; //是否支持 gles3
  145. bool bHighFloat_C; //gles3 高精度浮点格式
  146. bool bGL_OES_depth_texture_D;
  147. bool bGL_OES_depth24_E;
  148. uint8 field_F;
  149. bool bGL_EXT_discard_framebuffer_10;
  150. bool bGL_OES_packed_depth_stencil_11;
  151. bool bGL_OES_compressed_ETC1_RGB8_texture_12;
  152. bool bGL_EXT_texture_rg_13;
  153. bool bMali_14;
  154. uint8 byte_15;
  155. uint8 byte_16;
  156. uint8 byte_17;
  157. GLint iGL_MAX_TEXTURE_SIZE_18;
  158. GLfloat fGL_MAX_TEXTURE_MAX_ANISOTROPY_EXT_1C;
  159. int field_20;
  160. int field_24;
  161. GLsizei numAttachments_28;
  162. GLenum attachments_2C[3];
  163. bool bWireFrame_38;
  164. uint8 reserve_39; //以下三个是对齐用的
  165. uint8 reserve_3A;
  166. uint8 reserve_3B;
  167. void *pBuf_3C;
  168. };
  169. extern CFTTGraphicsDevice *g_pGraphicsDevice;
  170. #endif //_CFTTGRAPHICSDEVICE_H_