//CFTTGLES2Wrapper - [2020-04-13 11:57:46]
#ifndef _CFTTGLES2WRAPPER_H_
#define _CFTTGLES2WRAPPER_H_

#include "common.h"
#include <GLES3/gl3.h>

/*
00202BEC CFTTGLES2Wrapper::CheckUpdateClearColour(float,float,float,float)
00202E38 CFTTGLES2Wrapper::CheckUpdateStencilFunc(uint,int,uint)
00202EEC CFTTGLES2Wrapper::CheckUpdateStencilOp(uint,uint,uint)
00202FFC CFTTGLES2Wrapper::CheckUpdateScissor(int,int,int,int)
00204304 CFTTGLES2Wrapper::CheckUpdateBlendFunc(uint,uint,uint,uint)
0020BA54 CFTTGLES2Wrapper::CheckUpdateBindBuffer(uint,uint)
0020BAC4 CFTTGLES2Wrapper::OnDeleteBuffers(int,uint const*)
002247A8 CFTTGLES2Wrapper::OnDeleteTextures(int,uint const*)
*/

enum EBlendSFactorRGB {
  BF_RGB_UN1,
  BF_RGB_UN2,
  BF_RGB_UN3,
  BF_RGB_UN4
};

enum EBlendDFactorRGB {
  EBlendDFactorRGB_0,
  EBlendDFactorRGB_1,
  EBlendDFactorRGB_2,
  EBlendDFactorRGB_3,
  EBlendDFactorRGB_4,
  EBlendDFactorRGB_5,
};

enum EBlendSFactorAlpha {
  EBlendSFactorAlpha_0,
  EBlendSFactorAlpha_1,
  EBlendSFactorAlpha_2,
  EBlendSFactorAlpha_3,
  EBlendSFactorAlpha_4,
  EBlendSFactorAlpha_5,
};

enum EBlendDFactorAlpha {
  EBlendDFactorAlpha_0,
  EBlendDFactorAlpha_1,
  EBlendDFactorAlpha_2,
  EBlendDFactorAlpha_3,
  EBlendDFactorAlpha_4,
  EBlendDFactorAlpha_5,
};

enum EFTTStencilFunc {
  EFTTStencilFunc_0,
  EFTTStencilFunc_1,
  EFTTStencilFunc_2,
  EFTTStencilFunc_3,
  EFTTStencilFunc_4,
  EFTTStencilFunc_5,
  EFTTStencilFunc_6,
  EFTTStencilFunc_7,
};

struct str_line_BoundTextures {
  GLuint field_0[8];
};

class CFTTGLES2Wrapper {
public:
  static bool CheckUpdateBindBuffer(GLenum target, GLuint a2);  //0020BA54
  static bool CheckUpdateBlendFunc(uint eSRGB,
                                   uint eDRGB,
                                   uint eSAlpha,
                                   uint eDAlpha);                             //00204304
  static bool CheckUpdateClearColour(float fred, float fgreen, float fblue, float falpha);  //00202BEC
  static bool CheckUpdateScissor(GLint x, GLint y, GLint width, GLint height);              //00202FFC
  static bool CheckUpdateStencilFunc(uint u0, int u1, uint u2);                            //00202E38
  static bool CheckUpdateStencilOp(GLenum eOpFail, GLenum eOpZFail, GLenum eOpZPass);       //00202EEC
  static void OnDeleteBuffers(int len, const GLuint *pBuf);                                 //0020BAC4
  static void OnDeleteTextures(int len, const GLuint *pBuf);                                //002247A8

  //005AA6C8
  volatile static uint32_t s_uActiveTextureIndex;  //005AA6C8
  static str_line_BoundTextures s_uBoundTextures[2];
  static uint32_t s_eBlendDFactorRGB;    //??? enum
  static uint32_t s_eBlendDFactorAlpha;  //??? enum
  static GLuint s_uBoundArrayBuffer;
  static uint32_t s_uBoundElementBuffer;
  static float s_fClearColour[4];
  static int s_iClearStencil;
  static uint32_t s_uProgram;
  static int s_iStencilFuncRef;
  static bool s_bVertexAttribEnabled[8];

  //00348A50
  static bool s_bDepthMask;
  static uint32_t s_uDepthFunc;
  static int s_eBlendEquationRGB;
  static int s_eBlendEquationAlpha;
  static int s_eBlendSFactorRGB;
  static int s_eBlendSFactorAlpha;
  static GLenum s_eFrontFace;
  static int s_eStencilFunc;
  static uint32_t s_uStencilFuncMask;
  static GLuint s_uStencilWriteMask;
  static int s_eStencilOpFail;
  static int s_eStencilOpZFail;
  static int s_eStencilOpZPass;
  static int s_iScissorRect[4];
  static uint32_t dword_348A88;
  static uint32_t dword_348A8C;
  static uint32_t dword_348A90;
  static int s_iPixelStorePack;
  static int s_iPixelStoreUnpack;

  static uchar s_cEnabledState[206];  //005AA5F8
};

#endif  //_CFTTGLES2WRAPPER_H_