| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,244 @@ | ||
| #include "glsl_shader_compiler.h" | ||
|
|
||
| #include <base/system.h> | ||
| #include <engine/client/backend_sdl.h> | ||
|
|
||
| CGLSLCompiler::CGLSLCompiler(int OpenGLVersionMajor, int OpenGLVersionMinor, int OpenGLVersionPatch, bool IsOpenGLES, float TextureLODBias) | ||
| { | ||
| m_OpenGLVersionMajor = OpenGLVersionMajor; | ||
| m_OpenGLVersionMinor = OpenGLVersionMinor; | ||
| m_OpenGLVersionPatch = OpenGLVersionPatch; | ||
|
|
||
| m_IsOpenGLES = IsOpenGLES; | ||
|
|
||
| m_TextureLODBias = TextureLODBias; | ||
|
|
||
| m_HasTextureArray = false; | ||
| m_TextureReplaceType = 0; | ||
| } | ||
|
|
||
| void CGLSLCompiler::AddDefine(const std::string &DefineName, const std::string &DefineValue) | ||
| { | ||
| m_Defines.emplace_back(SGLSLCompilerDefine(DefineName, DefineValue)); | ||
| } | ||
|
|
||
| void CGLSLCompiler::AddDefine(const char *pDefineName, const char *pDefineValue) | ||
| { | ||
| AddDefine(std::string(pDefineName), std::string(pDefineValue)); | ||
| } | ||
|
|
||
| void CGLSLCompiler::ClearDefines() | ||
| { | ||
| m_Defines.clear(); | ||
| } | ||
|
|
||
| void CGLSLCompiler::ParseLine(std::string &Line, const char *pReadLine, EGLSLShaderCompilerType Type) | ||
| { | ||
| EBackendType BackendType = m_IsOpenGLES ? BACKEND_TYPE_OPENGL_ES : BACKEND_TYPE_OPENGL; | ||
| bool IsNewOpenGL = (BackendType == BACKEND_TYPE_OPENGL ? (m_OpenGLVersionMajor >= 4 || (m_OpenGLVersionMajor == 3 && m_OpenGLVersionMinor == 3)) : m_OpenGLVersionMajor >= 3); | ||
| if(!IsNewOpenGL) | ||
| { | ||
| const char *pBuff = pReadLine; | ||
| char aTmpStr[1024]; | ||
| size_t TmpStrSize = 0; | ||
| while(*pBuff) | ||
| { | ||
| while(*pBuff && str_isspace(*pBuff)) | ||
| { | ||
| Line.append(1, *pBuff); | ||
| ++pBuff; | ||
| } | ||
|
|
||
| while(*pBuff && !str_isspace(*pBuff) && *pBuff != '(' && *pBuff != '.') | ||
| { | ||
| aTmpStr[TmpStrSize++] = *pBuff; | ||
| ++pBuff; | ||
| } | ||
|
|
||
| if(TmpStrSize > 0) | ||
| { | ||
| aTmpStr[TmpStrSize] = 0; | ||
| TmpStrSize = 0; | ||
| if(str_comp(aTmpStr, "layout") == 0) | ||
| { | ||
| //search for ' in' | ||
| while(*pBuff && (*pBuff != ' ' || (*(pBuff + 1) && *(pBuff + 1) != 'i') || *(pBuff + 2) != 'n')) | ||
| { | ||
| ++pBuff; | ||
| } | ||
|
|
||
| if(*pBuff == ' ' && *(pBuff + 1) && *(pBuff + 1) == 'i' && *(pBuff + 2) == 'n') | ||
| { | ||
| pBuff += 3; | ||
| Line.append("attribute"); | ||
| Line.append(pBuff); | ||
| return; | ||
| } | ||
| else | ||
| { | ||
| dbg_msg("shadercompiler", "Fix shader for older OpenGL versions."); | ||
| } | ||
| } | ||
| else if(str_comp(aTmpStr, "noperspective") == 0 || str_comp(aTmpStr, "smooth") == 0 || str_comp(aTmpStr, "flat") == 0) | ||
| { | ||
| //search for 'in' or 'out' | ||
| while(*pBuff && ((*pBuff != 'i' || *(pBuff + 1) != 'n') && (*pBuff != 'o' || (*(pBuff + 1) && *(pBuff + 1) != 'u') || *(pBuff + 2) != 't'))) | ||
| { | ||
| ++pBuff; | ||
| } | ||
|
|
||
| bool Found = false; | ||
| if(*pBuff) | ||
| { | ||
| if(*pBuff == 'i' && *(pBuff + 1) == 'n') | ||
| { | ||
| pBuff += 2; | ||
| Found = true; | ||
| } | ||
| else if(*pBuff == 'o' && *(pBuff + 1) && *(pBuff + 1) == 'u' && *(pBuff + 2) == 't') | ||
| { | ||
| pBuff += 3; | ||
| Found = true; | ||
| } | ||
| } | ||
|
|
||
| if(!Found) | ||
| { | ||
| dbg_msg("shadercompiler", "Fix shader for older OpenGL versions."); | ||
| } | ||
|
|
||
| Line.append("varying"); | ||
| Line.append(pBuff); | ||
| return; | ||
| } | ||
| else if(str_comp(aTmpStr, "out") == 0 || str_comp(aTmpStr, "in") == 0) | ||
| { | ||
| if(Type == GLSL_SHADER_COMPILER_TYPE_FRAGMENT && str_comp(aTmpStr, "out") == 0) | ||
| return; | ||
| Line.append("varying"); | ||
| Line.append(pBuff); | ||
| return; | ||
| } | ||
| else if(str_comp(aTmpStr, "FragClr") == 0) | ||
| { | ||
| Line.append("gl_FragColor"); | ||
| Line.append(pBuff); | ||
| return; | ||
| } | ||
| else if(str_comp(aTmpStr, "texture") == 0) | ||
| { | ||
| if(m_TextureReplaceType == GLSL_COMPILER_TEXTURE_REPLACE_TYPE_2D) | ||
| Line.append("texture2D"); | ||
| else if(m_TextureReplaceType == GLSL_COMPILER_TEXTURE_REPLACE_TYPE_3D) | ||
| Line.append("texture3D"); | ||
| else if(m_TextureReplaceType == GLSL_COMPILER_TEXTURE_REPLACE_TYPE_2D_ARRAY) | ||
| Line.append("texture2DArray"); | ||
| std::string RestLine; | ||
| ParseLine(RestLine, pBuff, Type); | ||
| Line.append(RestLine); | ||
| return; | ||
| } | ||
| else | ||
| { | ||
| Line.append(aTmpStr); | ||
| } | ||
| } | ||
|
|
||
| if(*pBuff) | ||
| { | ||
| Line.append(1, *pBuff); | ||
| ++pBuff; | ||
| } | ||
| } | ||
| } | ||
| else | ||
| { | ||
| if(BackendType == BACKEND_TYPE_OPENGL_ES) | ||
| { | ||
| const char *pBuff = pReadLine; | ||
| char aTmpStr[1024]; | ||
| size_t TmpStrSize = 0; | ||
| while(*pBuff) | ||
| { | ||
| while(*pBuff && str_isspace(*pBuff)) | ||
| { | ||
| Line.append(1, *pBuff); | ||
| ++pBuff; | ||
| } | ||
|
|
||
| while(*pBuff && !str_isspace(*pBuff) && *pBuff != '(' && *pBuff != '.') | ||
| { | ||
| aTmpStr[TmpStrSize++] = *pBuff; | ||
| ++pBuff; | ||
| } | ||
|
|
||
| if(TmpStrSize > 0) | ||
| { | ||
| aTmpStr[TmpStrSize] = 0; | ||
| TmpStrSize = 0; | ||
|
|
||
| if(str_comp(aTmpStr, "noperspective") == 0) | ||
| { | ||
| Line.append("smooth"); | ||
| Line.append(pBuff); | ||
| return; | ||
| } | ||
| // since GLES doesnt support texture LOD bias as global state, use the shader function instead(since GLES 3.0 uses shaders only anyway) | ||
| else if(str_comp(aTmpStr, "texture") == 0) | ||
| { | ||
| Line.append("texture"); | ||
| // check opening and closing brackets to find the end | ||
| int CurBrackets = 1; | ||
| while(*pBuff && *pBuff != '(') | ||
| { | ||
| Line.append(1, *pBuff); | ||
|
|
||
| ++pBuff; | ||
| } | ||
|
|
||
| if(*pBuff) | ||
| { | ||
| Line.append(1, *pBuff); | ||
| ++pBuff; | ||
| } | ||
|
|
||
| while(*pBuff) | ||
| { | ||
| if(*pBuff == '(') | ||
| ++CurBrackets; | ||
| if(*pBuff == ')') | ||
| --CurBrackets; | ||
|
|
||
| if(CurBrackets == 0) | ||
| { | ||
| // found end | ||
| Line.append(std::string(", ") + std::to_string(m_TextureLODBias) + ")"); | ||
| ++pBuff; | ||
| break; | ||
| } | ||
| else | ||
| Line.append(1, *pBuff); | ||
| ++pBuff; | ||
| } | ||
|
|
||
| Line.append(pBuff); | ||
|
|
||
| return; | ||
| } | ||
| else | ||
| { | ||
| Line.append(aTmpStr); | ||
| } | ||
| } | ||
|
|
||
| if(*pBuff) | ||
| { | ||
| Line.append(1, *pBuff); | ||
| ++pBuff; | ||
| } | ||
| } | ||
| } | ||
| else | ||
| Line = pReadLine; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,219 @@ | ||
| // This file can be included several times. | ||
| #if(!defined(BACKEND_AS_OPENGL_ES) && !defined(ENGINE_CLIENT_BACKEND_OPENGL_BACKEND_OPENGL_H)) || \ | ||
| (defined(BACKEND_AS_OPENGL_ES) && !defined(ENGINE_CLIENT_BACKEND_OPENGL_BACKEND_OPENGL_H_AS_ES)) | ||
|
|
||
| #if !defined(BACKEND_AS_OPENGL_ES) && !defined(ENGINE_CLIENT_BACKEND_OPENGL_BACKEND_OPENGL_H) | ||
| #define ENGINE_CLIENT_BACKEND_OPENGL_BACKEND_OPENGL_H | ||
| #endif | ||
|
|
||
| #if defined(BACKEND_AS_OPENGL_ES) && !defined(ENGINE_CLIENT_BACKEND_OPENGL_BACKEND_OPENGL_H_AS_ES) | ||
| #define ENGINE_CLIENT_BACKEND_OPENGL_BACKEND_OPENGL_H_AS_ES | ||
| #endif | ||
|
|
||
| #include <engine/client/backend_sdl.h> | ||
|
|
||
| class CGLSLProgram; | ||
| class CGLSLTWProgram; | ||
| class CGLSLPrimitiveProgram; | ||
| class CGLSLQuadProgram; | ||
| class CGLSLTileProgram; | ||
| class CGLSLTextProgram; | ||
| class CGLSLPrimitiveExProgram; | ||
| class CGLSLSpriteMultipleProgram; | ||
|
|
||
| #if defined(BACKEND_AS_OPENGL_ES) && defined(CONF_BACKEND_OPENGL_ES3) | ||
| #define BACKEND_GL_MODERN_API 1 | ||
| #endif | ||
|
|
||
| // takes care of opengl related rendering | ||
| class CCommandProcessorFragment_OpenGL : public CCommandProcessorFragment_OpenGLBase | ||
| { | ||
| protected: | ||
| struct CTexture | ||
| { | ||
| CTexture() : | ||
| m_Tex(0), m_Tex2DArray(0), m_Sampler(0), m_Sampler2DArray(0), m_LastWrapMode(CCommandBuffer::WRAP_REPEAT), m_MemSize(0), m_Width(0), m_Height(0), m_RescaleCount(0), m_ResizeWidth(0), m_ResizeHeight(0) | ||
| { | ||
| } | ||
|
|
||
| TWGLuint m_Tex; | ||
| TWGLuint m_Tex2DArray; //or 3D texture as fallback | ||
| TWGLuint m_Sampler; | ||
| TWGLuint m_Sampler2DArray; //or 3D texture as fallback | ||
| int m_LastWrapMode; | ||
|
|
||
| int m_MemSize; | ||
|
|
||
| int m_Width; | ||
| int m_Height; | ||
| int m_RescaleCount; | ||
| float m_ResizeWidth; | ||
| float m_ResizeHeight; | ||
| }; | ||
| std::vector<CTexture> m_Textures; | ||
| std::atomic<int> *m_pTextureMemoryUsage; | ||
|
|
||
| TWGLint m_MaxTexSize; | ||
|
|
||
| bool m_Has2DArrayTextures; | ||
| bool m_Has2DArrayTexturesAsExtension; | ||
| TWGLenum m_2DArrayTarget; | ||
| bool m_Has3DTextures; | ||
| bool m_HasMipMaps; | ||
| bool m_HasNPOTTextures; | ||
|
|
||
| bool m_HasShaders; | ||
| int m_LastBlendMode; //avoid all possible opengl state changes | ||
| bool m_LastClipEnable; | ||
|
|
||
| int m_OpenGLTextureLodBIAS; | ||
|
|
||
| bool m_IsOpenGLES; | ||
|
|
||
| protected: | ||
| bool IsTexturedState(const CCommandBuffer::SState &State); | ||
| static bool Texture2DTo3D(void *pImageBuffer, int ImageWidth, int ImageHeight, int ImageColorChannelCount, int SplitCountWidth, int SplitCountHeight, void *pTarget3DImageData, int &Target3DImageWidth, int &Target3DImageHeight); | ||
|
|
||
| bool InitOpenGL(const SCommand_Init *pCommand); | ||
|
|
||
| void SetState(const CCommandBuffer::SState &State, bool Use2DArrayTexture = false); | ||
| virtual bool IsNewApi() { return false; } | ||
| void DestroyTexture(int Slot); | ||
|
|
||
| static int TexFormatToOpenGLFormat(int TexFormat); | ||
| static int TexFormatToImageColorChannelCount(int TexFormat); | ||
| static void *Resize(int Width, int Height, int NewWidth, int NewHeight, int Format, const unsigned char *pData); | ||
|
|
||
| virtual bool Cmd_Init(const SCommand_Init *pCommand); | ||
| virtual void Cmd_Shutdown(const SCommand_Shutdown *pCommand) {} | ||
| virtual void Cmd_Texture_Update(const CCommandBuffer::SCommand_Texture_Update *pCommand); | ||
| virtual void Cmd_Texture_Destroy(const CCommandBuffer::SCommand_Texture_Destroy *pCommand); | ||
| virtual void Cmd_Texture_Create(const CCommandBuffer::SCommand_Texture_Create *pCommand); | ||
| virtual void Cmd_Clear(const CCommandBuffer::SCommand_Clear *pCommand); | ||
| virtual void Cmd_Render(const CCommandBuffer::SCommand_Render *pCommand); | ||
| virtual void Cmd_RenderTex3D(const CCommandBuffer::SCommand_RenderTex3D *pCommand) {} | ||
| virtual void Cmd_Screenshot(const CCommandBuffer::SCommand_Screenshot *pCommand); | ||
|
|
||
| virtual void Cmd_Update_Viewport(const CCommandBuffer::SCommand_Update_Viewport *pCommand); | ||
| virtual void Cmd_Finish(const CCommandBuffer::SCommand_Finish *pCommand); | ||
|
|
||
| virtual void Cmd_CreateBufferObject(const CCommandBuffer::SCommand_CreateBufferObject *pCommand) {} | ||
| virtual void Cmd_RecreateBufferObject(const CCommandBuffer::SCommand_RecreateBufferObject *pCommand) {} | ||
| virtual void Cmd_UpdateBufferObject(const CCommandBuffer::SCommand_UpdateBufferObject *pCommand) {} | ||
| virtual void Cmd_CopyBufferObject(const CCommandBuffer::SCommand_CopyBufferObject *pCommand) {} | ||
| virtual void Cmd_DeleteBufferObject(const CCommandBuffer::SCommand_DeleteBufferObject *pCommand) {} | ||
|
|
||
| virtual void Cmd_CreateBufferContainer(const CCommandBuffer::SCommand_CreateBufferContainer *pCommand) {} | ||
| virtual void Cmd_UpdateBufferContainer(const CCommandBuffer::SCommand_UpdateBufferContainer *pCommand) {} | ||
| virtual void Cmd_DeleteBufferContainer(const CCommandBuffer::SCommand_DeleteBufferContainer *pCommand) {} | ||
| virtual void Cmd_IndicesRequiredNumNotify(const CCommandBuffer::SCommand_IndicesRequiredNumNotify *pCommand) {} | ||
|
|
||
| virtual void Cmd_RenderTileLayer(const CCommandBuffer::SCommand_RenderTileLayer *pCommand) {} | ||
| virtual void Cmd_RenderBorderTile(const CCommandBuffer::SCommand_RenderBorderTile *pCommand) {} | ||
| virtual void Cmd_RenderBorderTileLine(const CCommandBuffer::SCommand_RenderBorderTileLine *pCommand) {} | ||
| virtual void Cmd_RenderQuadLayer(const CCommandBuffer::SCommand_RenderQuadLayer *pCommand) {} | ||
| virtual void Cmd_RenderText(const CCommandBuffer::SCommand_RenderText *pCommand) {} | ||
| virtual void Cmd_RenderTextStream(const CCommandBuffer::SCommand_RenderTextStream *pCommand) {} | ||
| virtual void Cmd_RenderQuadContainer(const CCommandBuffer::SCommand_RenderQuadContainer *pCommand) {} | ||
| virtual void Cmd_RenderQuadContainerEx(const CCommandBuffer::SCommand_RenderQuadContainerEx *pCommand) {} | ||
| virtual void Cmd_RenderQuadContainerAsSpriteMultiple(const CCommandBuffer::SCommand_RenderQuadContainerAsSpriteMultiple *pCommand) {} | ||
|
|
||
| public: | ||
| CCommandProcessorFragment_OpenGL(); | ||
| virtual ~CCommandProcessorFragment_OpenGL() = default; | ||
|
|
||
| virtual bool RunCommand(const CCommandBuffer::SCommand *pBaseCommand); | ||
| }; | ||
|
|
||
| class CCommandProcessorFragment_OpenGL2 : public CCommandProcessorFragment_OpenGL | ||
| { | ||
| struct SBufferContainer | ||
| { | ||
| SBufferContainer() {} | ||
| SBufferContainerInfo m_ContainerInfo; | ||
| }; | ||
| std::vector<SBufferContainer> m_BufferContainers; | ||
|
|
||
| GL_SVertexTex3D m_aStreamVertices[1024 * 4]; | ||
|
|
||
| struct SBufferObject | ||
| { | ||
| SBufferObject(TWGLuint BufferObjectID) : | ||
| m_BufferObjectID(BufferObjectID) | ||
| { | ||
| m_pData = NULL; | ||
| m_DataSize = 0; | ||
| } | ||
| TWGLuint m_BufferObjectID; | ||
| void *m_pData; | ||
| size_t m_DataSize; | ||
| }; | ||
|
|
||
| std::vector<SBufferObject> m_BufferObjectIndices; | ||
|
|
||
| #ifndef BACKEND_GL_MODERN_API | ||
| bool DoAnalyzeStep(size_t StepN, size_t CheckCount, size_t VerticesCount, uint8_t aFakeTexture[], size_t SingleImageSize); | ||
| bool IsTileMapAnalysisSucceeded(); | ||
|
|
||
| void RenderBorderTileEmulation(SBufferContainer &BufferContainer, const CCommandBuffer::SState &State, const float *pColor, const char *pBuffOffset, unsigned int DrawNum, const float *pOffset, const float *pDir, int JumpIndex); | ||
| void RenderBorderTileLineEmulation(SBufferContainer &BufferContainer, const CCommandBuffer::SState &State, const float *pColor, const char *pBuffOffset, unsigned int IndexDrawNum, unsigned int DrawNum, const float *pOffset, const float *pDir); | ||
| #endif | ||
|
|
||
| void UseProgram(CGLSLTWProgram *pProgram); | ||
|
|
||
| protected: | ||
| void SetState(const CCommandBuffer::SState &State, CGLSLTWProgram *pProgram, bool Use2DArrayTextures = false); | ||
|
|
||
| #ifndef BACKEND_GL_MODERN_API | ||
| bool Cmd_Init(const SCommand_Init *pCommand) override; | ||
|
|
||
| void Cmd_RenderTex3D(const CCommandBuffer::SCommand_RenderTex3D *pCommand) override; | ||
|
|
||
| void Cmd_CreateBufferObject(const CCommandBuffer::SCommand_CreateBufferObject *pCommand) override; | ||
| void Cmd_RecreateBufferObject(const CCommandBuffer::SCommand_RecreateBufferObject *pCommand) override; | ||
| void Cmd_UpdateBufferObject(const CCommandBuffer::SCommand_UpdateBufferObject *pCommand) override; | ||
| void Cmd_CopyBufferObject(const CCommandBuffer::SCommand_CopyBufferObject *pCommand) override; | ||
| void Cmd_DeleteBufferObject(const CCommandBuffer::SCommand_DeleteBufferObject *pCommand) override; | ||
|
|
||
| void Cmd_CreateBufferContainer(const CCommandBuffer::SCommand_CreateBufferContainer *pCommand) override; | ||
| void Cmd_UpdateBufferContainer(const CCommandBuffer::SCommand_UpdateBufferContainer *pCommand) override; | ||
| void Cmd_DeleteBufferContainer(const CCommandBuffer::SCommand_DeleteBufferContainer *pCommand) override; | ||
| void Cmd_IndicesRequiredNumNotify(const CCommandBuffer::SCommand_IndicesRequiredNumNotify *pCommand) override; | ||
|
|
||
| void Cmd_RenderTileLayer(const CCommandBuffer::SCommand_RenderTileLayer *pCommand) override; | ||
| void Cmd_RenderBorderTile(const CCommandBuffer::SCommand_RenderBorderTile *pCommand) override; | ||
| void Cmd_RenderBorderTileLine(const CCommandBuffer::SCommand_RenderBorderTileLine *pCommand) override; | ||
| #endif | ||
|
|
||
| CGLSLTileProgram *m_pTileProgram; | ||
| CGLSLTileProgram *m_pTileProgramTextured; | ||
| CGLSLPrimitiveProgram *m_pPrimitive3DProgram; | ||
| CGLSLPrimitiveProgram *m_pPrimitive3DProgramTextured; | ||
|
|
||
| bool m_UseMultipleTextureUnits; | ||
|
|
||
| TWGLint m_MaxTextureUnits; | ||
|
|
||
| struct STextureBound | ||
| { | ||
| int m_TextureSlot; | ||
| bool m_Is2DArray; | ||
| }; | ||
| std::vector<STextureBound> m_TextureSlotBoundToUnit; //the texture index generated by loadtextureraw is stored in an index calculated by max texture units | ||
|
|
||
| bool IsAndUpdateTextureSlotBound(int IDX, int Slot, bool Is2DArray = false); | ||
|
|
||
| public: | ||
| CCommandProcessorFragment_OpenGL2() : | ||
| CCommandProcessorFragment_OpenGL(), m_UseMultipleTextureUnits(false) {} | ||
| }; | ||
|
|
||
| class CCommandProcessorFragment_OpenGL3 : public CCommandProcessorFragment_OpenGL2 | ||
| { | ||
| }; | ||
|
|
||
| #if defined(BACKEND_AS_OPENGL_ES) && defined(CONF_BACKEND_OPENGL_ES3) | ||
| #undef BACKEND_GL_MODERN_API | ||
| #endif | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| // This file can be included several times. | ||
| #if(!defined(BACKEND_AS_OPENGL_ES) && !defined(ENGINE_CLIENT_BACKEND_OPENGL_BACKEND_OPENGL3_H)) || \ | ||
| (defined(BACKEND_AS_OPENGL_ES) && !defined(ENGINE_CLIENT_BACKEND_OPENGL_BACKEND_OPENGL3_H_AS_ES)) | ||
|
|
||
| #if !defined(BACKEND_AS_OPENGL_ES) && !defined(ENGINE_CLIENT_BACKEND_OPENGL_BACKEND_OPENGL3_H) | ||
| #define ENGINE_CLIENT_BACKEND_OPENGL_BACKEND_OPENGL3_H | ||
| #endif | ||
|
|
||
| #if defined(BACKEND_AS_OPENGL_ES) && !defined(ENGINE_CLIENT_BACKEND_OPENGL_BACKEND_OPENGL3_H_AS_ES) | ||
| #define ENGINE_CLIENT_BACKEND_OPENGL_BACKEND_OPENGL3_H_AS_ES | ||
| #endif | ||
|
|
||
| #include <engine/client/backend_sdl.h> | ||
|
|
||
| #include "backend_opengl.h" | ||
|
|
||
| #define MAX_STREAM_BUFFER_COUNT 30 | ||
|
|
||
| // takes care of opengl 3.3+ related rendering | ||
| class CCommandProcessorFragment_OpenGL3_3 : public CCommandProcessorFragment_OpenGL3 | ||
| { | ||
| protected: | ||
| bool m_UsePreinitializedVertexBuffer; | ||
|
|
||
| int m_MaxQuadsAtOnce; | ||
| static const int m_MaxQuadsPossible = 256; | ||
|
|
||
| CGLSLPrimitiveProgram *m_pPrimitiveProgram; | ||
| CGLSLPrimitiveProgram *m_pPrimitiveProgramTextured; | ||
| CGLSLTileProgram *m_pBorderTileProgram; | ||
| CGLSLTileProgram *m_pBorderTileProgramTextured; | ||
| CGLSLTileProgram *m_pBorderTileLineProgram; | ||
| CGLSLTileProgram *m_pBorderTileLineProgramTextured; | ||
| CGLSLQuadProgram *m_pQuadProgram; | ||
| CGLSLQuadProgram *m_pQuadProgramTextured; | ||
| CGLSLTextProgram *m_pTextProgram; | ||
| CGLSLPrimitiveExProgram *m_pPrimitiveExProgram; | ||
| CGLSLPrimitiveExProgram *m_pPrimitiveExProgramTextured; | ||
| CGLSLPrimitiveExProgram *m_pPrimitiveExProgramRotationless; | ||
| CGLSLPrimitiveExProgram *m_pPrimitiveExProgramTexturedRotationless; | ||
| CGLSLSpriteMultipleProgram *m_pSpriteProgramMultiple; | ||
|
|
||
| TWGLuint m_LastProgramID; | ||
|
|
||
| TWGLuint m_PrimitiveDrawVertexID[MAX_STREAM_BUFFER_COUNT]; | ||
| TWGLuint m_PrimitiveDrawVertexIDTex3D; | ||
| TWGLuint m_PrimitiveDrawBufferID[MAX_STREAM_BUFFER_COUNT]; | ||
| TWGLuint m_PrimitiveDrawBufferIDTex3D; | ||
|
|
||
| TWGLuint m_LastIndexBufferBound[MAX_STREAM_BUFFER_COUNT]; | ||
|
|
||
| int m_LastStreamBuffer; | ||
|
|
||
| TWGLuint m_QuadDrawIndexBufferID; | ||
| unsigned int m_CurrentIndicesInBuffer; | ||
|
|
||
| void DestroyBufferContainer(int Index, bool DeleteBOs = true); | ||
|
|
||
| void AppendIndices(unsigned int NewIndicesCount); | ||
|
|
||
| struct SBufferContainer | ||
| { | ||
| SBufferContainer() : | ||
| m_VertArrayID(0), m_LastIndexBufferBound(0) {} | ||
| TWGLuint m_VertArrayID; | ||
| TWGLuint m_LastIndexBufferBound; | ||
| SBufferContainerInfo m_ContainerInfo; | ||
| }; | ||
| std::vector<SBufferContainer> m_BufferContainers; | ||
|
|
||
| std::vector<TWGLuint> m_BufferObjectIndices; | ||
|
|
||
| CCommandBuffer::SColorf m_ClearColor; | ||
|
|
||
| void InitPrimExProgram(CGLSLPrimitiveExProgram *pProgram, class CGLSLCompiler *pCompiler, class IStorage *pStorage, bool Textured, bool Rotationless); | ||
|
|
||
| static int TexFormatToNewOpenGLFormat(int TexFormat); | ||
| bool IsNewApi() override { return true; } | ||
|
|
||
| void UseProgram(CGLSLTWProgram *pProgram); | ||
| void UploadStreamBufferData(unsigned int PrimitiveType, const void *pVertices, size_t VertSize, unsigned int PrimitiveCount, bool AsTex3D = false); | ||
| void RenderText(const CCommandBuffer::SState &State, int DrawNum, int TextTextureIndex, int TextOutlineTextureIndex, int TextureSize, const float *pTextColor, const float *pTextOutlineColor); | ||
|
|
||
| bool Cmd_Init(const SCommand_Init *pCommand) override; | ||
| void Cmd_Shutdown(const SCommand_Shutdown *pCommand) override; | ||
| void Cmd_Texture_Update(const CCommandBuffer::SCommand_Texture_Update *pCommand) override; | ||
| void Cmd_Texture_Destroy(const CCommandBuffer::SCommand_Texture_Destroy *pCommand) override; | ||
| void Cmd_Texture_Create(const CCommandBuffer::SCommand_Texture_Create *pCommand) override; | ||
| void Cmd_Clear(const CCommandBuffer::SCommand_Clear *pCommand) override; | ||
| void Cmd_Render(const CCommandBuffer::SCommand_Render *pCommand) override; | ||
| void Cmd_RenderTex3D(const CCommandBuffer::SCommand_RenderTex3D *pCommand) override; | ||
|
|
||
| void Cmd_CreateBufferObject(const CCommandBuffer::SCommand_CreateBufferObject *pCommand) override; | ||
| void Cmd_RecreateBufferObject(const CCommandBuffer::SCommand_RecreateBufferObject *pCommand) override; | ||
| void Cmd_UpdateBufferObject(const CCommandBuffer::SCommand_UpdateBufferObject *pCommand) override; | ||
| void Cmd_CopyBufferObject(const CCommandBuffer::SCommand_CopyBufferObject *pCommand) override; | ||
| void Cmd_DeleteBufferObject(const CCommandBuffer::SCommand_DeleteBufferObject *pCommand) override; | ||
|
|
||
| void Cmd_CreateBufferContainer(const CCommandBuffer::SCommand_CreateBufferContainer *pCommand) override; | ||
| void Cmd_UpdateBufferContainer(const CCommandBuffer::SCommand_UpdateBufferContainer *pCommand) override; | ||
| void Cmd_DeleteBufferContainer(const CCommandBuffer::SCommand_DeleteBufferContainer *pCommand) override; | ||
| void Cmd_IndicesRequiredNumNotify(const CCommandBuffer::SCommand_IndicesRequiredNumNotify *pCommand) override; | ||
|
|
||
| void Cmd_RenderTileLayer(const CCommandBuffer::SCommand_RenderTileLayer *pCommand) override; | ||
| void Cmd_RenderBorderTile(const CCommandBuffer::SCommand_RenderBorderTile *pCommand) override; | ||
| void Cmd_RenderBorderTileLine(const CCommandBuffer::SCommand_RenderBorderTileLine *pCommand) override; | ||
| void Cmd_RenderQuadLayer(const CCommandBuffer::SCommand_RenderQuadLayer *pCommand) override; | ||
| void Cmd_RenderText(const CCommandBuffer::SCommand_RenderText *pCommand) override; | ||
| void Cmd_RenderTextStream(const CCommandBuffer::SCommand_RenderTextStream *pCommand) override; | ||
| void Cmd_RenderQuadContainer(const CCommandBuffer::SCommand_RenderQuadContainer *pCommand) override; | ||
| void Cmd_RenderQuadContainerEx(const CCommandBuffer::SCommand_RenderQuadContainerEx *pCommand) override; | ||
| void Cmd_RenderQuadContainerAsSpriteMultiple(const CCommandBuffer::SCommand_RenderQuadContainerAsSpriteMultiple *pCommand) override; | ||
|
|
||
| public: | ||
| CCommandProcessorFragment_OpenGL3_3() = default; | ||
| }; | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,159 @@ | ||
| #include "opengl_sl.h" | ||
| #include <engine/shared/linereader.h> | ||
| #include <engine/storage.h> | ||
| #include <stdio.h> | ||
| #include <string> | ||
| #include <vector> | ||
|
|
||
| #include <engine/client/backend_sdl.h> | ||
|
|
||
| #include <engine/client/backend/glsl_shader_compiler.h> | ||
|
|
||
| #ifndef BACKEND_AS_OPENGL_ES | ||
| #include <GL/glew.h> | ||
| #else | ||
| #include <GLES3/gl3.h> | ||
| #endif | ||
|
|
||
| bool CGLSL::LoadShader(CGLSLCompiler *pCompiler, IStorage *pStorage, const char *pFile, int Type) | ||
| { | ||
| if(m_IsLoaded) | ||
| return true; | ||
| IOHANDLE f = pStorage->OpenFile(pFile, IOFLAG_READ, IStorage::TYPE_ALL); | ||
|
|
||
| std::vector<std::string> Lines; | ||
| if(f) | ||
| { | ||
| EBackendType BackendType = pCompiler->m_IsOpenGLES ? BACKEND_TYPE_OPENGL_ES : BACKEND_TYPE_OPENGL; | ||
| bool IsNewOpenGL = (BackendType == BACKEND_TYPE_OPENGL ? (pCompiler->m_OpenGLVersionMajor >= 4 || (pCompiler->m_OpenGLVersionMajor == 3 && pCompiler->m_OpenGLVersionMinor == 3)) : pCompiler->m_OpenGLVersionMajor >= 3); | ||
| std::string GLShaderStringPostfix = std::string(" core\r\n"); | ||
| if(BackendType == BACKEND_TYPE_OPENGL_ES) | ||
| GLShaderStringPostfix = std::string(" es\r\n"); | ||
| //add compiler specific values | ||
| if(IsNewOpenGL) | ||
| Lines.push_back(std::string("#version ") + std::string(std::to_string(pCompiler->m_OpenGLVersionMajor)) + std::string(std::to_string(pCompiler->m_OpenGLVersionMinor)) + std::string(std::to_string(pCompiler->m_OpenGLVersionPatch)) + GLShaderStringPostfix); | ||
| else | ||
| { | ||
| if(pCompiler->m_OpenGLVersionMajor == 3) | ||
| { | ||
| if(pCompiler->m_OpenGLVersionMinor == 0) | ||
| Lines.push_back(std::string("#version 130 \r\n")); | ||
| if(pCompiler->m_OpenGLVersionMinor == 1) | ||
| Lines.push_back(std::string("#version 140 \r\n")); | ||
| if(pCompiler->m_OpenGLVersionMinor == 2) | ||
| Lines.push_back(std::string("#version 150 \r\n")); | ||
| } | ||
| else if(pCompiler->m_OpenGLVersionMajor == 2) | ||
| { | ||
| if(pCompiler->m_OpenGLVersionMinor == 0) | ||
| Lines.push_back(std::string("#version 110 \r\n")); | ||
| if(pCompiler->m_OpenGLVersionMinor == 1) | ||
| Lines.push_back(std::string("#version 120 \r\n")); | ||
| } | ||
| } | ||
|
|
||
| if(BackendType == BACKEND_TYPE_OPENGL_ES) | ||
| { | ||
| if(Type == GL_FRAGMENT_SHADER) | ||
| { | ||
| Lines.push_back("precision highp float; \r\n"); | ||
| Lines.push_back("precision highp sampler2D; \r\n"); | ||
| Lines.push_back("precision highp sampler3D; \r\n"); | ||
| Lines.push_back("precision highp samplerCube; \r\n"); | ||
| Lines.push_back("precision highp samplerCubeShadow; \r\n"); | ||
| Lines.push_back("precision highp sampler2DShadow; \r\n"); | ||
| Lines.push_back("precision highp sampler2DArray; \r\n"); | ||
| Lines.push_back("precision highp sampler2DArrayShadow; \r\n"); | ||
| } | ||
| } | ||
|
|
||
| for(CGLSLCompiler::SGLSLCompilerDefine &Define : pCompiler->m_Defines) | ||
| { | ||
| Lines.push_back(std::string("#define ") + Define.m_DefineName + std::string(" ") + Define.m_DefineValue + std::string("\r\n")); | ||
| } | ||
|
|
||
| if(Type == GL_FRAGMENT_SHADER && !IsNewOpenGL && pCompiler->m_OpenGLVersionMajor <= 3 && pCompiler->m_HasTextureArray) | ||
| { | ||
| Lines.push_back(std::string("#extension GL_EXT_texture_array : enable\r\n")); | ||
| } | ||
|
|
||
| CLineReader LineReader; | ||
| LineReader.Init(f); | ||
| char *ReadLine = NULL; | ||
| while((ReadLine = LineReader.Get())) | ||
| { | ||
| std::string Line; | ||
| pCompiler->ParseLine(Line, ReadLine, Type == GL_FRAGMENT_SHADER ? GLSL_SHADER_COMPILER_TYPE_FRAGMENT : GLSL_SHADER_COMPILER_TYPE_VERTEX); | ||
| Line.append("\r\n"); | ||
| Lines.push_back(Line); | ||
| } | ||
| io_close(f); | ||
|
|
||
| const char **ShaderCode = new const char *[Lines.size()]; | ||
|
|
||
| for(size_t i = 0; i < Lines.size(); ++i) | ||
| { | ||
| ShaderCode[i] = Lines[i].c_str(); | ||
| } | ||
|
|
||
| TWGLuint shader = glCreateShader(Type); | ||
|
|
||
| glShaderSource(shader, Lines.size(), ShaderCode, NULL); | ||
| glCompileShader(shader); | ||
|
|
||
| delete[] ShaderCode; | ||
|
|
||
| int CompilationStatus; | ||
| glGetShaderiv(shader, GL_COMPILE_STATUS, &CompilationStatus); | ||
|
|
||
| if(CompilationStatus == GL_FALSE) | ||
| { | ||
| char buff[3000]; | ||
|
|
||
| TWGLint maxLength = 0; | ||
| glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &maxLength); | ||
|
|
||
| glGetShaderInfoLog(shader, maxLength, &maxLength, buff); | ||
|
|
||
| dbg_msg("glsl", "%s: %s", pFile, buff); | ||
| glDeleteShader(shader); | ||
| return false; | ||
| } | ||
| m_Type = Type; | ||
| m_IsLoaded = true; | ||
|
|
||
| m_ShaderID = shader; | ||
|
|
||
| return true; | ||
| } | ||
| else | ||
| return false; | ||
| } | ||
|
|
||
| void CGLSL::DeleteShader() | ||
| { | ||
| if(!IsLoaded()) | ||
| return; | ||
| m_IsLoaded = false; | ||
| glDeleteShader(m_ShaderID); | ||
| } | ||
|
|
||
| bool CGLSL::IsLoaded() | ||
| { | ||
| return m_IsLoaded; | ||
| } | ||
|
|
||
| TWGLuint CGLSL::GetShaderID() | ||
| { | ||
| return m_ShaderID; | ||
| } | ||
|
|
||
| CGLSL::CGLSL() | ||
| { | ||
| m_IsLoaded = false; | ||
| } | ||
|
|
||
| CGLSL::~CGLSL() | ||
| { | ||
| DeleteShader(); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| // This file can be included several times. | ||
| #if(!defined(BACKEND_AS_OPENGL_ES) && !defined(ENGINE_CLIENT_BACKEND_OPENGL_OPENGL_SL_H)) || \ | ||
| (defined(BACKEND_AS_OPENGL_ES) && !defined(ENGINE_CLIENT_BACKEND_OPENGL_OPENGL_SL_H_AS_ES)) | ||
|
|
||
| #if !defined(BACKEND_AS_OPENGL_ES) && !defined(ENGINE_CLIENT_BACKEND_OPENGL_OPENGL_SL_H) | ||
| #define ENGINE_CLIENT_BACKEND_OPENGL_OPENGL_SL_H | ||
| #endif | ||
|
|
||
| #if defined(BACKEND_AS_OPENGL_ES) && !defined(ENGINE_CLIENT_BACKEND_OPENGL_OPENGL_SL_H_AS_ES) | ||
| #define ENGINE_CLIENT_BACKEND_OPENGL_OPENGL_SL_H_AS_ES | ||
| #endif | ||
|
|
||
| #include <base/detect.h> | ||
|
|
||
| #include <engine/client/graphics_defines.h> | ||
|
|
||
| #include <string> | ||
| #include <vector> | ||
|
|
||
| class CGLSLCompiler; | ||
|
|
||
| class CGLSL | ||
| { | ||
| public: | ||
| bool LoadShader(CGLSLCompiler *pCompiler, class IStorage *pStorage, const char *pFile, int Type); | ||
| void DeleteShader(); | ||
|
|
||
| bool IsLoaded(); | ||
| TWGLuint GetShaderID(); | ||
|
|
||
| CGLSL(); | ||
| virtual ~CGLSL(); | ||
|
|
||
| private: | ||
| TWGLuint m_ShaderID; | ||
| int m_Type; | ||
| bool m_IsLoaded; | ||
| }; | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #include <base/detect.h> | ||
|
|
||
| #if defined(CONF_BACKEND_OPENGL_ES) || defined(CONF_BACKEND_OPENGL_ES3) | ||
|
|
||
| #define GLES_CLASS_DEFINES_DO_DEFINE | ||
| #include "gles_class_defines.h" | ||
| #undef GLES_CLASS_DEFINES_DO_DEFINE | ||
|
|
||
| #define BACKEND_AS_OPENGL_ES 1 | ||
|
|
||
| #include <engine/client/backend/opengl/backend_opengl.cpp> | ||
|
|
||
| #undef BACKEND_AS_OPENGL_ES | ||
|
|
||
| #include "gles_class_defines.h" | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #ifndef ENGINE_CLIENT_BACKEND_OPENGLES_BACKEND_OPENGLES_H | ||
| #define ENGINE_CLIENT_BACKEND_OPENGLES_BACKEND_OPENGLES_H | ||
|
|
||
| #include <base/detect.h> | ||
|
|
||
| #if defined(CONF_BACKEND_OPENGL_ES) || defined(CONF_BACKEND_OPENGL_ES3) | ||
| #include <engine/client/backend_sdl.h> | ||
|
|
||
| #define GLES_CLASS_DEFINES_DO_DEFINE | ||
| #include "gles_class_defines.h" | ||
| #undef GLES_CLASS_DEFINES_DO_DEFINE | ||
|
|
||
| #define BACKEND_AS_OPENGL_ES 1 | ||
|
|
||
| #include <engine/client/backend/opengl/backend_opengl.h> | ||
|
|
||
| #undef BACKEND_AS_OPENGL_ES | ||
|
|
||
| #include "gles_class_defines.h" | ||
|
|
||
| #endif | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #include <base/detect.h> | ||
|
|
||
| #if defined(CONF_BACKEND_OPENGL_ES) || defined(CONF_BACKEND_OPENGL_ES3) | ||
|
|
||
| #define GLES_CLASS_DEFINES_DO_DEFINE | ||
| #include "gles_class_defines.h" | ||
| #undef GLES_CLASS_DEFINES_DO_DEFINE | ||
|
|
||
| #define BACKEND_AS_OPENGL_ES 1 | ||
|
|
||
| #include <engine/client/backend/opengl/backend_opengl3.cpp> | ||
|
|
||
| #undef BACKEND_AS_OPENGL_ES | ||
|
|
||
| #include "gles_class_defines.h" | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #ifndef ENGINE_CLIENT_BACKEND_OPENGLES_BACKEND_OPENGLES3_H | ||
| #define ENGINE_CLIENT_BACKEND_OPENGLES_BACKEND_OPENGLES3_H | ||
|
|
||
| #include <base/detect.h> | ||
|
|
||
| #if defined(CONF_BACKEND_OPENGL_ES) || defined(CONF_BACKEND_OPENGL_ES3) | ||
| #include <engine/client/backend_sdl.h> | ||
|
|
||
| #define GLES_CLASS_DEFINES_DO_DEFINE | ||
| #include "gles_class_defines.h" | ||
| #undef GLES_CLASS_DEFINES_DO_DEFINE | ||
|
|
||
| #define BACKEND_AS_OPENGL_ES 1 | ||
|
|
||
| #include <engine/client/backend/opengl/backend_opengl3.h> | ||
|
|
||
| #undef BACKEND_AS_OPENGL_ES | ||
|
|
||
| #include "gles_class_defines.h" | ||
|
|
||
| #endif | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #ifndef ENGINE_CLIENT_BACKEND_OPENGLES_GLES_CLASS_DEFINES_H | ||
| #define ENGINE_CLIENT_BACKEND_OPENGLES_GLES_CLASS_DEFINES_H | ||
| #undef ENGINE_CLIENT_BACKEND_OPENGLES_GLES_CLASS_DEFINES_H | ||
| #endif | ||
|
|
||
| #ifdef GLES_CLASS_DEFINES_DO_DEFINE | ||
| #define CCommandProcessorFragment_OpenGL3_3 CCommandProcessorFragment_OpenGLES3 | ||
| #define CCommandProcessorFragment_OpenGL3 CCommandProcessorFragment_OpenGLES3Wrapper | ||
| #define CCommandProcessorFragment_OpenGL2 CCommandProcessorFragment_OpenGLES2 | ||
| #define CCommandProcessorFragment_OpenGL CCommandProcessorFragment_OpenGLES | ||
|
|
||
| #define CGLSL CGLSL_ES | ||
| #define CGLSLProgram CGLSL_ESProgram | ||
| #define CGLSLTWProgram CGLSL_ESTWProgram | ||
| #define CGLSLTextProgram CGLSL_ESTextProgram | ||
| #define CGLSLPrimitiveProgram CGLSL_ESPrimitiveProgram | ||
| #define CGLSLPrimitiveExProgram CGLSL_ESPrimitiveExProgram | ||
| #define CGLSLSpriteMultipleProgram CGLSL_ESSpriteMultipleProgram | ||
| #define CGLSLQuadProgram CGLSL_ESQuadProgram | ||
| #define CGLSLTileProgram CGLSL_ESTileProgram | ||
| #else | ||
| #undef CCommandProcessorFragment_OpenGL3_3 | ||
| #undef CCommandProcessorFragment_OpenGL3 | ||
| #undef CCommandProcessorFragment_OpenGL2 | ||
| #undef CCommandProcessorFragment_OpenGL | ||
|
|
||
| #undef CGLSL | ||
| #undef CGLSLProgram | ||
| #undef CGLSLTWProgram | ||
| #undef CGLSLTextProgram | ||
| #undef CGLSLPrimitiveProgram | ||
| #undef CGLSLPrimitiveExProgram | ||
| #undef CGLSLSpriteMultipleProgram | ||
| #undef CGLSLQuadProgram | ||
| #undef CGLSLTileProgram | ||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #include <base/detect.h> | ||
|
|
||
| #if defined(CONF_BACKEND_OPENGL_ES) || defined(CONF_BACKEND_OPENGL_ES3) | ||
| #define GLES_CLASS_DEFINES_DO_DEFINE | ||
| #include "gles_class_defines.h" | ||
| #undef GLES_CLASS_DEFINES_DO_DEFINE | ||
|
|
||
| #define BACKEND_AS_OPENGL_ES 1 | ||
|
|
||
| #include <engine/client/backend/opengl/opengl_sl.cpp> | ||
|
|
||
| #undef BACKEND_AS_OPENGL_ES | ||
|
|
||
| #include "gles_class_defines.h" | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #include <base/detect.h> | ||
|
|
||
| #if defined(CONF_BACKEND_OPENGL_ES) || defined(CONF_BACKEND_OPENGL_ES3) | ||
| #define GLES_CLASS_DEFINES_DO_DEFINE | ||
| #include "gles_class_defines.h" | ||
| #undef GLES_CLASS_DEFINES_DO_DEFINE | ||
|
|
||
| #define BACKEND_AS_OPENGL_ES 1 | ||
|
|
||
| #include <engine/client/backend/opengl/opengl_sl_program.cpp> | ||
|
|
||
| #undef BACKEND_AS_OPENGL_ES | ||
|
|
||
| #include "gles_class_defines.h" | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| #ifndef ENGINE_CLIENT_BLOCKLIST_DRIVER_H | ||
| #define ENGINE_CLIENT_BLOCKLIST_DRIVER_H | ||
|
|
||
| const char *ParseBlocklistDriverVersions(const char *pVendorStr, const char *pVersionStr, int &BlocklistMajor, int &BlocklistMinor, int &BlocklistPatch, bool &RequiresWarning); | ||
|
|
||
| #endif // ENGINE_CLIENT_BLOCKLIST_DRIVER_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #ifndef ENGINE_CLIENT_GRAPHICS_DEFINES_H | ||
| #define ENGINE_CLIENT_GRAPHICS_DEFINES_H | ||
|
|
||
| #include <stddef.h> | ||
| #include <stdint.h> | ||
|
|
||
| typedef uint32_t TWGLuint; | ||
| typedef int32_t TWGLint; | ||
| typedef uint32_t TWGLenum; | ||
| typedef uint8_t TWGLubyte; | ||
|
|
||
| #endif |