diff options
author | Erik Kundiman <erik@megapahit.org> | 2023-09-06 08:15:16 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2023-09-06 08:15:16 +0800 |
commit | 4b7e271dff7fa6ff813f9fc8f81cc2b6604de6db (patch) | |
tree | 1b74250c8f22f09a42d23ed5b7760e3d24ae69f7 /indra | |
parent | ed44bcf9f763a7d1f7549eb1f03d8aa7fb933ef7 (diff) |
Core profile glCreateShader & return type GLuint
to replace the less portable ARB versions.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llrender/llglslshader.cpp | 12 | ||||
-rw-r--r-- | indra/llrender/llglslshader.h | 8 | ||||
-rw-r--r-- | indra/llrender/llpostprocess.cpp | 4 | ||||
-rw-r--r-- | indra/llrender/llpostprocess.h | 4 | ||||
-rw-r--r-- | indra/llrender/llshadermgr.cpp | 12 | ||||
-rw-r--r-- | indra/llrender/llshadermgr.h | 12 |
6 files changed, 26 insertions, 26 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index cfc871e0c6..e310278955 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -47,7 +47,7 @@ using std::pair; using std::make_pair; using std::string; -GLhandleARB LLGLSLShader::sCurBoundShader = 0; +GLuint LLGLSLShader::sCurBoundShader = 0; LLGLSLShader* LLGLSLShader::sCurBoundShaderPtr = NULL; S32 LLGLSLShader::sIndexedTextureChannels = 0; bool LLGLSLShader::sProfileEnabled = false; @@ -347,7 +347,7 @@ void LLGLSLShader::unloadInternal() if (mProgramObject) { - GLhandleARB obj[1024]; + GLuint obj[1024]; GLsizei count; glGetAttachedObjectsARB(mProgramObject, 1024, &count, obj); @@ -425,7 +425,7 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes, vector< pair<string,GLenum> >::iterator fileIter = mShaderFiles.begin(); for ( ; fileIter != mShaderFiles.end(); fileIter++ ) { - GLhandleARB shaderhandle = LLShaderMgr::instance()->loadShaderFile((*fileIter).first, mShaderLevel, (*fileIter).second, &mDefines, mFeatures.mIndexedTextureChannels); + auto shaderhandle = LLShaderMgr::instance()->loadShaderFile((*fileIter).first, mShaderLevel, (*fileIter).second, &mDefines, mFeatures.mIndexedTextureChannels); LL_DEBUGS("ShaderLoading") << "SHADER FILE: " << (*fileIter).first << " mShaderLevel=" << mShaderLevel << LL_ENDL; if (shaderhandle) { @@ -505,7 +505,7 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes, } #if DEBUG_SHADER_INCLUDES -void dumpAttachObject( const char *func_name, GLhandleARB program_object, const std::string &object_path ) +void dumpAttachObject( const char *func_name, GLuint program_object, const std::string &object_path ) { GLcharARB* info_log; GLint info_len_expect = 0; @@ -563,7 +563,7 @@ BOOL LLGLSLShader::attachFragmentObject(std::string object_path) } } -void LLGLSLShader::attachObject(GLhandleARB object) +void LLGLSLShader::attachObject(GLuint object) { if (object != 0) { @@ -581,7 +581,7 @@ void LLGLSLShader::attachObject(GLhandleARB object) } } -void LLGLSLShader::attachObjects(GLhandleARB* objects, S32 count) +void LLGLSLShader::attachObjects(GLuint* objects, S32 count) { for (S32 i = 0; i < count; i++) { diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 85e83dbcb9..8f8834e80e 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -145,7 +145,7 @@ public: LLGLSLShader(); ~LLGLSLShader(); - static GLhandleARB sCurBoundShader; + static GLuint sCurBoundShader; static LLGLSLShader* sCurBoundShaderPtr; static S32 sIndexedTextureChannels; @@ -167,8 +167,8 @@ public: const char** varyings = NULL); BOOL attachFragmentObject(std::string object); BOOL attachVertexObject(std::string object); - void attachObject(GLhandleARB object); - void attachObjects(GLhandleARB* objects = NULL, S32 count = 0); + void attachObject(GLuint object); + void attachObjects(GLuint* objects = NULL, S32 count = 0); BOOL mapAttributes(const std::vector<LLStaticHashedString> * attributes); BOOL mapUniforms(const std::vector<LLStaticHashedString> *); void mapUniform(GLint index, const std::vector<LLStaticHashedString> *); @@ -239,7 +239,7 @@ public: U32 mMatHash[LLRender::NUM_MATRIX_MODES]; U32 mLightHash; - GLhandleARB mProgramObject; + GLuint mProgramObject; #if LL_RELEASE_WITH_DEBUG_INFO struct attr_name { diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index ce36942e1a..4e0d43c8b4 100644 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -345,7 +345,7 @@ void LLPostProcess::createBloomShader(void) bloomBlurUniforms[sBlurWidth] = 0; } -void LLPostProcess::getShaderUniforms(glslUniforms & uniforms, GLhandleARB & prog) +void LLPostProcess::getShaderUniforms(glslUniforms & uniforms, GLuint & prog) { /// Find uniform locations and insert into map glslUniforms::iterator i; @@ -569,7 +569,7 @@ bool LLPostProcess::checkError(void) return retCode; } -void LLPostProcess::checkShaderError(GLhandleARB shader) +void LLPostProcess::checkShaderError(GLuint shader) { GLint infologLength = 0; GLint charsWritten = 0; diff --git a/indra/llrender/llpostprocess.h b/indra/llrender/llpostprocess.h index ce17b6693d..bdfc632831 100644 --- a/indra/llrender/llpostprocess.h +++ b/indra/llrender/llpostprocess.h @@ -249,12 +249,12 @@ private: void applyColorFilterShader(void); /// OpenGL Helper Functions - void getShaderUniforms(glslUniforms & uniforms, GLhandleARB & prog); + void getShaderUniforms(glslUniforms & uniforms, GLuint & prog); void createTexture(LLPointer<LLImageGL>& texture, unsigned int width, unsigned int height); void copyFrameBuffer(U32 & texture, unsigned int width, unsigned int height); void createNoiseTexture(LLPointer<LLImageGL>& texture); bool checkError(void); - void checkShaderError(GLhandleARB shader); + void checkShaderError(GLuint shader); void drawOrthoQuad(unsigned int width, unsigned int height, QuadType type); void viewOrthogonal(unsigned int width, unsigned int height); void changeOrthogonal(unsigned int width, unsigned int height); diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index c64f46f38a..0f945dea42 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -550,7 +550,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) //============================================================================ // Load Shader -static std::string get_object_log(GLhandleARB ret) +static std::string get_object_log(GLuint ret) { std::string res; @@ -584,7 +584,7 @@ void LLShaderMgr::dumpShaderSource(U32 shader_code_count, GLcharARB** shader_cod LL_CONT << LL_ENDL; } -void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns, const std::string& filename) +void LLShaderMgr::dumpObjectLog(GLuint ret, BOOL warns, const std::string& filename) { std::string log = get_object_log(ret); std::string fname = filename; @@ -600,7 +600,7 @@ void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns, const std::string& } } -GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_map<std::string, std::string>* defines, S32 texture_index_channels) +GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_map<std::string, std::string>* defines, S32 texture_index_channels) { // endsure work-around for missing GLSL funcs gets propogated to feature shader files (e.g. srgbF.glsl) @@ -964,7 +964,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade fclose(file); //create shader object - GLhandleARB ret = glCreateShaderObjectARB(type); + auto ret = glCreateShader(type); error = glGetError(); if (error != GL_NO_ERROR) @@ -1042,7 +1042,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade return ret; } -BOOL LLShaderMgr::linkProgramObject(GLhandleARB obj, BOOL suppress_errors) +BOOL LLShaderMgr::linkProgramObject(GLuint obj, BOOL suppress_errors) { //check for errors glLinkProgramARB(obj); @@ -1065,7 +1065,7 @@ BOOL LLShaderMgr::linkProgramObject(GLhandleARB obj, BOOL suppress_errors) return success; } -BOOL LLShaderMgr::validateProgramObject(GLhandleARB obj) +BOOL LLShaderMgr::validateProgramObject(GLuint obj) { //check program validity against current GL glValidateProgramARB(obj); diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 67c0d6ab10..89d726d64a 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -260,11 +260,11 @@ public: virtual void initAttribsAndUniforms(void); BOOL attachShaderFeatures(LLGLSLShader * shader); - void dumpObjectLog(GLhandleARB ret, BOOL warns = TRUE, const std::string& filename = ""); + void dumpObjectLog(GLuint ret, BOOL warns = TRUE, const std::string& filename = ""); void dumpShaderSource(U32 shader_code_count, GLcharARB** shader_code_text); - BOOL linkProgramObject(GLhandleARB obj, BOOL suppress_errors = FALSE); - BOOL validateProgramObject(GLhandleARB obj); - GLhandleARB loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_map<std::string, std::string>* defines = NULL, S32 texture_index_channels = -1); + BOOL linkProgramObject(GLuint obj, BOOL suppress_errors = FALSE); + BOOL validateProgramObject(GLuint obj); + GLuint loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_map<std::string, std::string>* defines = NULL, S32 texture_index_channels = -1); // Implemented in the application to actually point to the shader directory. virtual std::string getShaderDirPrefix(void) = 0; // Pure Virtual @@ -274,8 +274,8 @@ public: public: // Map of shader names to compiled - std::map<std::string, GLhandleARB> mVertexShaderObjects; - std::map<std::string, GLhandleARB> mFragmentShaderObjects; + std::map<std::string, GLuint> mVertexShaderObjects; + std::map<std::string, GLuint> mFragmentShaderObjects; //global (reserved slot) shader parameters std::vector<std::string> mReservedAttribs; |