diff options
Diffstat (limited to 'indra/llrender')
-rw-r--r-- | indra/llrender/llatmosphere.cpp | 8 | ||||
-rw-r--r-- | indra/llrender/llcubemap.cpp | 12 | ||||
-rw-r--r-- | indra/llrender/llcubemaparray.cpp | 16 | ||||
-rw-r--r-- | indra/llrender/llgl.cpp | 75 | ||||
-rw-r--r-- | indra/llrender/llglheaders.h | 5 | ||||
-rw-r--r-- | indra/llrender/llglslshader.cpp | 154 | ||||
-rw-r--r-- | indra/llrender/llglslshader.h | 8 | ||||
-rw-r--r-- | indra/llrender/llimagegl.cpp | 6 | ||||
-rw-r--r-- | indra/llrender/llpostprocess.cpp | 68 | ||||
-rw-r--r-- | indra/llrender/llpostprocess.h | 4 | ||||
-rw-r--r-- | indra/llrender/llrender.cpp | 26 | ||||
-rw-r--r-- | indra/llrender/llrendertarget.cpp | 2 | ||||
-rw-r--r-- | indra/llrender/llshadermgr.cpp | 65 | ||||
-rw-r--r-- | indra/llrender/llshadermgr.h | 14 | ||||
-rw-r--r-- | indra/llrender/llvertexbuffer.cpp | 128 |
15 files changed, 297 insertions, 294 deletions
diff --git a/indra/llrender/llatmosphere.cpp b/indra/llrender/llatmosphere.cpp index ffc17c89f8..8e37ca9b90 100644 --- a/indra/llrender/llatmosphere.cpp +++ b/indra/llrender/llatmosphere.cpp @@ -241,7 +241,7 @@ LLGLTexture* LLAtmosphere::getTransmittance() m_transmittance->generateGLTexture(); m_transmittance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); m_transmittance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); - m_transmittance->setExplicitFormat(GL_RGB32F_ARB, GL_RGB, GL_FLOAT); + m_transmittance->setExplicitFormat(GL_RGB32F, GL_RGB, GL_FLOAT); m_transmittance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE); } return m_transmittance; @@ -255,7 +255,7 @@ LLGLTexture* LLAtmosphere::getScattering() m_scattering->generateGLTexture(); m_scattering->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); m_scattering->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); - m_scattering->setExplicitFormat(GL_RGB16F_ARB, GL_RGB, GL_FLOAT); + m_scattering->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); m_scattering->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D); } return m_scattering; @@ -269,7 +269,7 @@ LLGLTexture* LLAtmosphere::getMieScattering() m_mie_scatter_texture->generateGLTexture(); m_mie_scatter_texture->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); m_mie_scatter_texture->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); - m_mie_scatter_texture->setExplicitFormat(GL_RGB16F_ARB, GL_RGB, GL_FLOAT); + m_mie_scatter_texture->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT); m_mie_scatter_texture->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D); } return m_mie_scatter_texture; @@ -283,7 +283,7 @@ LLGLTexture* LLAtmosphere::getIlluminance() m_illuminance->generateGLTexture(); m_illuminance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP); m_illuminance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR); - m_illuminance->setExplicitFormat(GL_RGB32F_ARB, GL_RGB, GL_FLOAT); + m_illuminance->setExplicitFormat(GL_RGB32F, GL_RGB, GL_FLOAT); m_illuminance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE); } return m_illuminance; diff --git a/indra/llrender/llcubemap.cpp b/indra/llrender/llcubemap.cpp index 473447ad72..e41765622f 100644 --- a/indra/llrender/llcubemap.cpp +++ b/indra/llrender/llcubemap.cpp @@ -51,12 +51,12 @@ LLCubeMap::LLCubeMap(bool init_as_srgb) mMatrixStage(0), mIssRGB(init_as_srgb) { - mTargets[0] = GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB; - mTargets[1] = GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB; - mTargets[2] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB; - mTargets[3] = GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB; - mTargets[4] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB; - mTargets[5] = GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB; + mTargets[0] = GL_TEXTURE_CUBE_MAP_NEGATIVE_X; + mTargets[1] = GL_TEXTURE_CUBE_MAP_POSITIVE_X; + mTargets[2] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y; + mTargets[3] = GL_TEXTURE_CUBE_MAP_POSITIVE_Y; + mTargets[4] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; + mTargets[5] = GL_TEXTURE_CUBE_MAP_POSITIVE_Z; } LLCubeMap::~LLCubeMap() diff --git a/indra/llrender/llcubemaparray.cpp b/indra/llrender/llcubemaparray.cpp index 438d92cdba..08ff7c9414 100644 --- a/indra/llrender/llcubemaparray.cpp +++ b/indra/llrender/llcubemaparray.cpp @@ -45,12 +45,12 @@ // MUST match order of OpenGL face-layers GLenum LLCubeMapArray::sTargets[6] = { - GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, - GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, - GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, - GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB + GL_TEXTURE_CUBE_MAP_POSITIVE_X, + GL_TEXTURE_CUBE_MAP_NEGATIVE_X, + GL_TEXTURE_CUBE_MAP_POSITIVE_Y, + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, + GL_TEXTURE_CUBE_MAP_POSITIVE_Z, + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z }; LLVector3 LLCubeMapArray::sLookVecs[6] = @@ -122,14 +122,14 @@ void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count) bind(0); - glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY_ARB, 0, GL_RGB, resolution, resolution, count*6, 0, + glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGB, resolution, resolution, count*6, 0, GL_RGB, GL_UNSIGNED_BYTE, nullptr); mImage->setAddressMode(LLTexUnit::TAM_CLAMP); mImage->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC); - glGenerateMipmap(GL_TEXTURE_CUBE_MAP_ARRAY_ARB); + glGenerateMipmap(GL_TEXTURE_CUBE_MAP_ARRAY); unbind(); } diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 771a218b6b..74d35a8dac 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -900,7 +900,7 @@ void LLGLManager::asLLSD(LLSD& info) info["has_compressed_textures"] = mHasCompressedTextures; info["has_framebuffer_object"] = mHasFramebufferObject; info["max_samples"] = mMaxSamples; - info["has_blend_func_separate"] = mHasBlendFuncSeparate; + info["has_blend_func_separate"] = mHasBlendFuncSeparate || LLRender::sGLCoreProfile; // ARB Extensions info["has_vertex_buffer_object"] = mHasVertexBufferObject; @@ -1031,12 +1031,16 @@ void LLGLManager::initExtensions() LL_DEBUGS("HRS") << "Explicit enumeration of " << num_extensions << " ext, before calling glh_init_extensions: " << all_extensions << LL_ENDL; // The following 3p code has the effect of initializing extensions in older versions, and does nothing on 3.2/4.1 on Mac. #endif - + /* FIXME mHasMultitexture = glh_init_extensions("GL_ARB_multitexture"); mHasCubeMap = glh_init_extensions("GL_ARB_texture_cube_map"); mHasCompressedTextures = glh_init_extensions("GL_ARB_texture_compression"); mHasSeparateSpecularColor = glh_init_extensions("GL_EXT_separate_specular_color"); mHasAnisotropic = glh_init_extensions("GL_EXT_texture_filter_anisotropic"); + */ + mHasMultitexture = TRUE; + mHasCubeMap = TRUE; + mHasCompressedTextures = TRUE; #if LL_DARWIN LL_DEBUGS("HRS") << "After glh_init_extensions (" << @@ -1063,45 +1067,42 @@ void LLGLManager::initExtensions() #endif // Recheck, because the glh_init_extensions might not have done anything. - mHasMultitexture = ExtensionExists("GL_ARB_multitexture", gGLHExts.mSysExts); - mHasCubeMap = ExtensionExists("GL_ARB_texture_cube_map", gGLHExts.mSysExts); - mHasCompressedTextures = ExtensionExists("GL_ARB_texture_compression", gGLHExts.mSysExts); + //mHasMultitexture = ExtensionExists("GL_ARB_multitexture", gGLHExts.mSysExts); + //mHasCubeMap = ExtensionExists("GL_ARB_texture_cube_map", gGLHExts.mSysExts); + //mHasCompressedTextures = ExtensionExists("GL_ARB_texture_compression", gGLHExts.mSysExts); mHasSeparateSpecularColor = ExtensionExists("GL_EXT_separate_specular_color", gGLHExts.mSysExts); mHasAnisotropic = ExtensionExists("GL_EXT_texture_filter_anisotropic", gGLHExts.mSysExts); + // In core profile + mHasARBEnvCombine = TRUE; //ExtensionExists("GL_ARB_texture_env_combine", gGLHExts.mSysExts); + mHasTimerQuery = FALSE; //FIXME //ExtensionExists("GL_ARB_timer_query", gGLHExts.mSysExts); + mHasOcclusionQuery = TRUE; //ExtensionExists("GL_ARB_occlusion_query", gGLHExts.mSysExts); + mHasOcclusionQuery2 = TRUE; // ExtensionExists("GL_ARB_occlusion_query2", gGLHExts.mSysExts); + mHasVertexBufferObject = TRUE; //ExtensionExists("GL_ARB_vertex_buffer_object", gGLHExts.mSysExts); + mHasVertexArrayObject = TRUE; //ExtensionExists("GL_ARB_vertex_array_object", gGLHExts.mSysExts); + mHasMapBufferRange = TRUE; ExtensionExists("GL_ARB_map_buffer_range", gGLHExts.mSysExts); + mHasFlushBufferRange = ExtensionExists("GL_APPLE_flush_buffer_range", gGLHExts.mSysExts); // Apple has mHasMapBufferRange now + mHasSync = TRUE; //ExtensionExists("GL_ARB_sync", gGLHExts.mSysExts); + mHasFramebufferObject = TRUE; //ExtensionExists("GL_ARB_framebuffer_object", gGLHExts.mSysExts); + mHassRGBFramebuffer = TRUE; //ExtensionExists("GL_ARB_framebuffer_sRGB", gGLHExts.mSysExts); + mHasDrawBuffers = TRUE; //ExtensionExists("GL_ARB_draw_buffers", gGLHExts.mSysExts); + mHasTextureRectangle = TRUE; //ExtensionExists("GL_ARB_texture_rectangle", gGLHExts.mSysExts); + mHasTextureMultisample = TRUE; //ExtensionExists("GL_ARB_texture_multisample", gGLHExts.mSysExts); + mHasUniformBufferObject = TRUE; //ExtensionExists("GL_ARB_uniform_buffer_object", gGLHExts.mSysExts); + mHasCubeMapArray = TRUE; //ExtensionExists("GL_ARB_texture_cube_map_array", gGLHExts.mSysExts); + mHasPointParameters = TRUE; //ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts); + mHasATIMemInfo = ExtensionExists("GL_ATI_meminfo", gGLHExts.mSysExts); //Basic AMD method, also see mHasAMDAssociations mHasNVXMemInfo = ExtensionExists("GL_NVX_gpu_memory_info", gGLHExts.mSysExts); - mHasCubeMap = ExtensionExists("GL_ARB_texture_cube_map", gGLHExts.mSysExts); - mHasARBEnvCombine = ExtensionExists("GL_ARB_texture_env_combine", gGLHExts.mSysExts); - mHasOcclusionQuery = ExtensionExists("GL_ARB_occlusion_query", gGLHExts.mSysExts); - mHasTimerQuery = ExtensionExists("GL_ARB_timer_query", gGLHExts.mSysExts); - mHasOcclusionQuery2 = ExtensionExists("GL_ARB_occlusion_query2", gGLHExts.mSysExts); - mHasVertexBufferObject = ExtensionExists("GL_ARB_vertex_buffer_object", gGLHExts.mSysExts); - mHasVertexArrayObject = ExtensionExists("GL_ARB_vertex_array_object", gGLHExts.mSysExts); - mHasSync = ExtensionExists("GL_ARB_sync", gGLHExts.mSysExts); - mHasMapBufferRange = ExtensionExists("GL_ARB_map_buffer_range", gGLHExts.mSysExts); - mHasFlushBufferRange = ExtensionExists("GL_APPLE_flush_buffer_range", gGLHExts.mSysExts); // NOTE: Using extensions breaks reflections when Shadows are set to projector. See: SL-16727 //mHasDepthClamp = ExtensionExists("GL_ARB_depth_clamp", gGLHExts.mSysExts) || ExtensionExists("GL_NV_depth_clamp", gGLHExts.mSysExts); mHasDepthClamp = FALSE; // mask out FBO support when packed_depth_stencil isn't there 'cause we need it for LLRenderTarget -Brad -#ifdef GL_ARB_framebuffer_object - mHasFramebufferObject = ExtensionExists("GL_ARB_framebuffer_object", gGLHExts.mSysExts); -#else - mHasFramebufferObject = ExtensionExists("GL_EXT_framebuffer_object", gGLHExts.mSysExts) && - ExtensionExists("GL_EXT_framebuffer_blit", gGLHExts.mSysExts) && - ExtensionExists("GL_EXT_framebuffer_multisample", gGLHExts.mSysExts) && - ExtensionExists("GL_EXT_packed_depth_stencil", gGLHExts.mSysExts); -#endif + #ifdef GL_EXT_texture_sRGB mHassRGBTexture = ExtensionExists("GL_EXT_texture_sRGB", gGLHExts.mSysExts); #endif -#ifdef GL_ARB_framebuffer_sRGB - mHassRGBFramebuffer = ExtensionExists("GL_ARB_framebuffer_sRGB", gGLHExts.mSysExts); -#else - mHassRGBFramebuffer = ExtensionExists("GL_EXT_framebuffer_sRGB", gGLHExts.mSysExts); -#endif #ifdef GL_EXT_texture_sRGB_decode mHasTexturesRGBDecode = ExtensionExists("GL_EXT_texture_sRGB_decode", gGLHExts.mSysExts); @@ -1111,17 +1112,9 @@ void LLGLManager::initExtensions() mHasMipMapGeneration = mHasFramebufferObject || mGLVersion >= 1.4f; - mHasDrawBuffers = ExtensionExists("GL_ARB_draw_buffers", gGLHExts.mSysExts); mHasBlendFuncSeparate = ExtensionExists("GL_EXT_blend_func_separate", gGLHExts.mSysExts); - mHasTextureRectangle = ExtensionExists("GL_ARB_texture_rectangle", gGLHExts.mSysExts); - mHasTextureMultisample = ExtensionExists("GL_ARB_texture_multisample", gGLHExts.mSysExts); mHasDebugOutput = ExtensionExists("GL_ARB_debug_output", gGLHExts.mSysExts); mHasTransformFeedback = mGLVersion >= 4.f ? TRUE : FALSE; - mHasUniformBufferObject = ExtensionExists("GL_ARB_uniform_buffer_object", gGLHExts.mSysExts); - mHasCubeMapArray = ExtensionExists("GL_ARB_texture_cube_map_array", gGLHExts.mSysExts); -#if !LL_DARWIN - mHasPointParameters = ExtensionExists("GL_ARB_point_parameters", gGLHExts.mSysExts); -#endif #endif #if LL_LINUX @@ -1223,7 +1216,7 @@ void LLGLManager::initExtensions() { LL_INFOS("RenderInit") << "Couldn't initialize GL_ARB_point_parameters" << LL_ENDL; } - if (!mHasBlendFuncSeparate) + if (!mHasBlendFuncSeparate && !LLRender::sGLCoreProfile) { LL_INFOS("RenderInit") << "Couldn't initialize GL_EXT_blend_func_separate" << LL_ENDL; } @@ -1687,7 +1680,7 @@ void LLGLState::resetTextureStates() for (S32 j = maxTextureUnits-1; j >=0; j--) { gGL.getTexUnit(j)->activate(); - glClientActiveTextureARB(GL_TEXTURE0_ARB+j); + glClientActiveTexture(GL_TEXTURE0+j); j == 0 ? gGL.getTexUnit(j)->enable(LLTexUnit::TT_TEXTURE) : gGL.getTexUnit(j)->disable(); } } @@ -1778,7 +1771,7 @@ void LLGLState::checkTextureChannels(const std::string& msg) BOOL error = FALSE; - if (activeTexture == GL_TEXTURE0_ARB) + if (activeTexture == GL_TEXTURE0) { GLint tex_env_mode = 0; @@ -1836,7 +1829,7 @@ void LLGLState::checkTextureChannels(const std::string& msg) if (i < gGLManager.mNumTextureUnits) { - glClientActiveTextureARB(GL_TEXTURE0_ARB+i); + glClientActiveTexture(GL_TEXTURE0+i); stop_glerror(); glGetIntegerv(GL_TEXTURE_STACK_DEPTH, &stackDepth); stop_glerror(); @@ -1921,7 +1914,7 @@ void LLGLState::checkTextureChannels(const std::string& msg) stop_glerror(); gGL.getTexUnit(0)->activate(); - glClientActiveTextureARB(GL_TEXTURE0_ARB); + glClientActiveTexture(GL_TEXTURE0); stop_glerror(); if (error) diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h index 154f1aa2bd..6e2dbd24f9 100644 --- a/indra/llrender/llglheaders.h +++ b/indra/llrender/llglheaders.h @@ -69,7 +69,7 @@ # include "GL/glxext.h" // Use glXGetProcAddressARB instead of glXGetProcAddress - the ARB symbol // is considered 'legacy' but works on more machines. -# define GLH_EXT_GET_PROC_ADDRESS(p) glXGetProcAddressARB((const GLubyte*)(p)) +# define GLH_EXT_GET_PROC_ADDRESS(p) glXGetProcAddress((const GLubyte*)(p)) #endif // LL_LINUX && !LL_MESA_HEADLESS #if LL_LINUX && defined(WINGDIAPI) @@ -618,9 +618,6 @@ extern void glGenerateMipmapEXT(GLenum target) AVAILABLE_MAC_OS_X_VERSION_10_4_A #define GL_MAX_SAMPLES 0x8D57 #endif -// GL_ARB_draw_buffers -extern void glDrawBuffersARB(GLsizei n, const GLenum* bufs) AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; - #ifdef __cplusplus extern "C" { #endif diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 67f82c9c5e..db70ba0c60 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -37,7 +37,7 @@ #include "OpenGL/OpenGL.h" #endif -// Print-print list of shader included source files that are linked together via glAttachObjectARB() +// Print-print list of shader included source files that are linked together via glAttachShader() // i.e. On macOS / OSX the AMD GLSL linker will display an error if a varying is left in an undefined state. #define DEBUG_SHADER_INCLUDES 0 @@ -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; @@ -227,11 +227,11 @@ void LLGLSLShader::stopProfile(U32 count, U32 mode) void LLGLSLShader::placeProfileQuery() { -#if !LL_DARWIN +#if 1 || !LL_DARWIN if (mTimerQuery == 0) { - glGenQueriesARB(1, &mSamplesQuery); - glGenQueriesARB(1, &mTimerQuery); + glGenQueries(1, &mSamplesQuery); + glGenQueries(1, &mTimerQuery); } if (!mTextureStateFetched) @@ -267,16 +267,16 @@ void LLGLSLShader::placeProfileQuery() } - glBeginQueryARB(GL_SAMPLES_PASSED, mSamplesQuery); - glBeginQueryARB(GL_TIME_ELAPSED, mTimerQuery); + glBeginQuery(GL_SAMPLES_PASSED, mSamplesQuery); + glBeginQuery(GL_TIME_ELAPSED, mTimerQuery); #endif } void LLGLSLShader::readProfileQuery(U32 count, U32 mode) { #if !LL_DARWIN - glEndQueryARB(GL_TIME_ELAPSED); - glEndQueryARB(GL_SAMPLES_PASSED); + glEndQuery(GL_TIME_ELAPSED); + glEndQuery(GL_SAMPLES_PASSED); U64 time_elapsed = 0; glGetQueryObjectui64v(mTimerQuery, GL_QUERY_RESULT, &time_elapsed); @@ -347,30 +347,30 @@ void LLGLSLShader::unloadInternal() if (mProgramObject) { - GLhandleARB obj[1024]; + GLuint obj[1024]; GLsizei count; - glGetAttachedObjectsARB(mProgramObject, 1024, &count, obj); + glGetAttachedShaders(mProgramObject, 1024, &count, obj); for (GLsizei i = 0; i < count; i++) { - glDetachObjectARB(mProgramObject, obj[i]); - glDeleteObjectARB(obj[i]); + glDetachShader(mProgramObject, obj[i]); + glDeleteShader(obj[i]); } - glDeleteObjectARB(mProgramObject); + glDeleteProgram(mProgramObject); mProgramObject = 0; } if (mTimerQuery) { - glDeleteQueriesARB(1, &mTimerQuery); + glDeleteQueries(1, &mTimerQuery); mTimerQuery = 0; } if (mSamplesQuery) { - glDeleteQueriesARB(1, &mSamplesQuery); + glDeleteQueries(1, &mSamplesQuery); mSamplesQuery = 0; } @@ -401,7 +401,7 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes, llassert_always(!mShaderFiles.empty()); // Create program - mProgramObject = glCreateProgramObjectARB(); + mProgramObject = glCreateProgram(); if (mProgramObject == 0) { // Shouldn't happen if shader related extensions, like ARB_vertex_shader, exist. @@ -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); + GLuint 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,20 +505,20 @@ 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; + GLchar* info_log; GLint info_len_expect = 0; GLint info_len_actual = 0; - glGetObjectParameterivARB(program_object, GL_OBJECT_INFO_LOG_LENGTH_ARB, &info_len_expect); + glGetShaderiv(program_object, GL_INFO_LOG_LENGTH,, &info_len_expect); fprintf(stderr, " * %-20s(), log size: %d, %s\n", func_name, info_len_expect, object_path.c_str()); if (info_len_expect > 0) { fprintf(stderr, " ========== %s() ========== \n", func_name); - info_log = new GLcharARB [ info_len_expect ]; - glGetInfoLogARB(program_object, info_len_expect, &info_len_actual, info_log); + info_log = new GLchar [ info_len_expect ]; + glGetProgramInfoLog(program_object, info_len_expect, &info_len_actual, info_log); fprintf(stderr, "%s\n", info_log); delete [] info_log; } @@ -530,7 +530,7 @@ BOOL LLGLSLShader::attachVertexObject(std::string object_path) if (LLShaderMgr::instance()->mVertexShaderObjects.count(object_path) > 0) { stop_glerror(); - glAttachObjectARB(mProgramObject, LLShaderMgr::instance()->mVertexShaderObjects[object_path]); + glAttachShader(mProgramObject, LLShaderMgr::instance()->mVertexShaderObjects[object_path]); #if DEBUG_SHADER_INCLUDES dumpAttachObject("attachVertexObject", mProgramObject, object_path); #endif // DEBUG_SHADER_INCLUDES @@ -549,7 +549,7 @@ BOOL LLGLSLShader::attachFragmentObject(std::string object_path) if (LLShaderMgr::instance()->mFragmentShaderObjects.count(object_path) > 0) { stop_glerror(); - glAttachObjectARB(mProgramObject, LLShaderMgr::instance()->mFragmentShaderObjects[object_path]); + glAttachShader(mProgramObject, LLShaderMgr::instance()->mFragmentShaderObjects[object_path]); #if DEBUG_SHADER_INCLUDES dumpAttachObject("attachFragmentObject", mProgramObject, object_path); #endif // DEBUG_SHADER_INCLUDES @@ -563,12 +563,12 @@ BOOL LLGLSLShader::attachFragmentObject(std::string object_path) } } -void LLGLSLShader::attachObject(GLhandleARB object) +void LLGLSLShader::attachObject(GLuint object) { if (object != 0) { stop_glerror(); - glAttachObjectARB(mProgramObject, object); + glAttachShader(mProgramObject, object); #if DEBUG_SHADER_INCLUDES std::string object_path("???"); dumpAttachObject("attachObject", mProgramObject, object_path); @@ -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++) { @@ -597,7 +597,7 @@ BOOL LLGLSLShader::mapAttributes(const std::vector<LLStaticHashedString> * attri for (U32 i = 0; i < LLShaderMgr::instance()->mReservedAttribs.size(); i++) { const char* name = LLShaderMgr::instance()->mReservedAttribs[i].c_str(); - glBindAttribLocationARB(mProgramObject, i, (const GLcharARB *) name); + glBindAttribLocation(mProgramObject, i, (const GLchar *) name); } //link the program @@ -620,7 +620,7 @@ BOOL LLGLSLShader::mapAttributes(const std::vector<LLStaticHashedString> * attri for (U32 i = 0; i < LLShaderMgr::instance()->mReservedAttribs.size(); i++) { const char* name = LLShaderMgr::instance()->mReservedAttribs[i].c_str(); - S32 index = glGetAttribLocationARB(mProgramObject, (const GLcharARB *)name); + S32 index = glGetAttribLocation(mProgramObject, (const GLchar *)name); if (index != -1) { #if LL_RELEASE_WITH_DEBUG_INFO @@ -637,7 +637,7 @@ BOOL LLGLSLShader::mapAttributes(const std::vector<LLStaticHashedString> * attri for (U32 i = 0; i < numAttributes; i++) { const char* name = (*attributes)[i].String().c_str(); - S32 index = glGetAttribLocationARB(mProgramObject, name); + S32 index = glGetAttribLocation(mProgramObject, name); if (index != -1) { mAttribute[LLShaderMgr::instance()->mReservedAttribs.size() + i] = index; @@ -668,7 +668,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector<LLStaticHashedString> * name[0] = 0; - glGetActiveUniformARB(mProgramObject, index, 1024, &length, &size, &type, (GLcharARB *)name); + glGetActiveUniform(mProgramObject, index, 1024, &length, &size, &type, (GLchar *)name); #if !LL_DARWIN if (size > 0) { @@ -713,7 +713,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector<LLStaticHashedString> * } #endif - S32 location = glGetUniformLocationARB(mProgramObject, name); + S32 location = glGetUniformLocation(mProgramObject, name); if (location != -1) { //chop off "[0]" so we can always access the first element @@ -779,14 +779,14 @@ GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type, GLint { LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; - if ((type >= GL_SAMPLER_1D_ARB && type <= GL_SAMPLER_2D_RECT_SHADOW_ARB) || + if ((type >= GL_SAMPLER_1D && type <= GL_SAMPLER_2D_RECT_SHADOW) || type == GL_SAMPLER_2D_MULTISAMPLE || - type == GL_SAMPLER_CUBE_MAP_ARRAY_ARB) + type == GL_SAMPLER_CUBE_MAP_ARRAY) { //this here is a texture GLint ret = mActiveTextureChannels; if (size == 1) { - glUniform1iARB(location, mActiveTextureChannels); + glUniform1i(location, mActiveTextureChannels); LL_DEBUGS("ShaderUniform") << "Assigned to texture channel " << mActiveTextureChannels << LL_ENDL; mActiveTextureChannels++; } @@ -800,7 +800,7 @@ GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type, GLint { channel[i] = mActiveTextureChannels++; } - glUniform1ivARB(location, size, channel); + glUniform1iv(location, size, channel); LL_DEBUGS("ShaderUniform") << "Assigned to texture channel " << (mActiveTextureChannels-size) << " through " << (mActiveTextureChannels-1) << LL_ENDL; } @@ -833,7 +833,7 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms) //get the number of active uniforms GLint activeCount; - glGetObjectParameterivARB(mProgramObject, GL_OBJECT_ACTIVE_UNIFORMS_ARB, &activeCount); + glGetProgramiv(mProgramObject, GL_ACTIVE_UNIFORMS, &activeCount); //........................................................................................................................................ //........................................................................................ @@ -860,12 +860,12 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms) */ - S32 diffuseMap = glGetUniformLocationARB(mProgramObject, "diffuseMap"); - S32 specularMap = glGetUniformLocationARB(mProgramObject, "specularMap"); - S32 bumpMap = glGetUniformLocationARB(mProgramObject, "bumpMap"); - S32 altDiffuseMap = glGetUniformLocationARB(mProgramObject, "altDiffuseMap"); - S32 environmentMap = glGetUniformLocationARB(mProgramObject, "environmentMap"); - S32 reflectionMap = glGetUniformLocationARB(mProgramObject, "reflectionMap"); + S32 diffuseMap = glGetUniformLocation(mProgramObject, "diffuseMap"); + S32 specularMap = glGetUniformLocation(mProgramObject, "specularMap"); + S32 bumpMap = glGetUniformLocation(mProgramObject, "bumpMap"); + S32 altDiffuseMap = glGetUniformLocation(mProgramObject, "altDiffuseMap"); + S32 environmentMap = glGetUniformLocation(mProgramObject, "environmentMap"); + S32 reflectionMap = glGetUniformLocation(mProgramObject, "reflectionMap"); std::set<S32> skip_index; @@ -882,7 +882,7 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms) { name[0] = '\0'; - glGetActiveUniformARB(mProgramObject, i, 1024, &length, &size, &type, (GLcharARB *)name); + glGetActiveUniform(mProgramObject, i, 1024, &length, &size, &type, (GLchar *)name); if (-1 == diffuseMap && std::string(name) == "diffuseMap") { @@ -995,7 +995,7 @@ void LLGLSLShader::bind() if (sCurBoundShader != mProgramObject) // Don't re-bind current shader { LLVertexBuffer::unbind(); - glUseProgramObjectARB(mProgramObject); + glUseProgram(mProgramObject); sCurBoundShader = mProgramObject; sCurBoundShaderPtr = this; } @@ -1027,7 +1027,7 @@ void LLGLSLShader::unbind() gGL.flush(); stop_glerror(); LLVertexBuffer::unbind(); - glUseProgramObjectARB(0); + glUseProgram(0); sCurBoundShader = 0; sCurBoundShaderPtr = NULL; stop_glerror(); @@ -1038,7 +1038,7 @@ void LLGLSLShader::bindNoShader(void) LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; LLVertexBuffer::unbind(); - glUseProgramObjectARB(0); + glUseProgram(0); sCurBoundShader = 0; sCurBoundShaderPtr = NULL; } @@ -1168,7 +1168,7 @@ void LLGLSLShader::uniform1i(U32 index, GLint x) const auto& iter = mValue.find(mUniform[index]); if (iter == mValue.end() || iter->second.mV[0] != x) { - glUniform1iARB(mUniform[index], x); + glUniform1i(mUniform[index], x); mValue[mUniform[index]] = LLVector4(x,0.f,0.f,0.f); } } @@ -1191,7 +1191,7 @@ void LLGLSLShader::uniform1f(U32 index, GLfloat x) const auto& iter = mValue.find(mUniform[index]); if (iter == mValue.end() || iter->second.mV[0] != x) { - glUniform1fARB(mUniform[index], x); + glUniform1f(mUniform[index], x); mValue[mUniform[index]] = LLVector4(x,0.f,0.f,0.f); } } @@ -1214,7 +1214,7 @@ void LLGLSLShader::uniform2f(U32 index, GLfloat x, GLfloat y) LLVector4 vec(x,y,0.f,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec)) { - glUniform2fARB(mUniform[index], x, y); + glUniform2f(mUniform[index], x, y); mValue[mUniform[index]] = vec; } } @@ -1237,7 +1237,7 @@ void LLGLSLShader::uniform3f(U32 index, GLfloat x, GLfloat y, GLfloat z) LLVector4 vec(x,y,z,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec)) { - glUniform3fARB(mUniform[index], x, y, z); + glUniform3f(mUniform[index], x, y, z); mValue[mUniform[index]] = vec; } } @@ -1260,7 +1260,7 @@ void LLGLSLShader::uniform4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat LLVector4 vec(x,y,z,w); if (iter == mValue.end() || shouldChange(iter->second,vec)) { - glUniform4fARB(mUniform[index], x, y, z, w); + glUniform4f(mUniform[index], x, y, z, w); mValue[mUniform[index]] = vec; } } @@ -1283,7 +1283,7 @@ void LLGLSLShader::uniform1iv(U32 index, U32 count, const GLint* v) LLVector4 vec(v[0],0.f,0.f,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) { - glUniform1ivARB(mUniform[index], count, v); + glUniform1iv(mUniform[index], count, v); mValue[mUniform[index]] = vec; } } @@ -1306,7 +1306,7 @@ void LLGLSLShader::uniform4iv(U32 index, U32 count, const GLint* v) LLVector4 vec(v[0], v[1], v[2], v[3]); if (iter == mValue.end() || shouldChange(iter->second, vec) || count != 1) { - glUniform1ivARB(mUniform[index], count, v); + glUniform1iv(mUniform[index], count, v); mValue[mUniform[index]] = vec; } } @@ -1330,7 +1330,7 @@ void LLGLSLShader::uniform1fv(U32 index, U32 count, const GLfloat* v) LLVector4 vec(v[0],0.f,0.f,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) { - glUniform1fvARB(mUniform[index], count, v); + glUniform1fv(mUniform[index], count, v); mValue[mUniform[index]] = vec; } } @@ -1353,7 +1353,7 @@ void LLGLSLShader::uniform2fv(U32 index, U32 count, const GLfloat* v) LLVector4 vec(v[0],v[1],0.f,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) { - glUniform2fvARB(mUniform[index], count, v); + glUniform2fv(mUniform[index], count, v); mValue[mUniform[index]] = vec; } } @@ -1376,7 +1376,7 @@ void LLGLSLShader::uniform3fv(U32 index, U32 count, const GLfloat* v) LLVector4 vec(v[0],v[1],v[2],0.f); if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) { - glUniform3fvARB(mUniform[index], count, v); + glUniform3fv(mUniform[index], count, v); mValue[mUniform[index]] = vec; } } @@ -1400,7 +1400,7 @@ void LLGLSLShader::uniform4fv(U32 index, U32 count, const GLfloat* v) if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) { LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; - glUniform4fvARB(mUniform[index], count, v); + glUniform4fv(mUniform[index], count, v); mValue[mUniform[index]] = vec; } } @@ -1419,7 +1419,7 @@ void LLGLSLShader::uniformMatrix2fv(U32 index, U32 count, GLboolean transpose, c if (mUniform[index] >= 0) { - glUniformMatrix2fvARB(mUniform[index], count, transpose, v); + glUniformMatrix2fv(mUniform[index], count, transpose, v); } } } @@ -1436,7 +1436,7 @@ void LLGLSLShader::uniformMatrix3fv(U32 index, U32 count, GLboolean transpose, c if (mUniform[index] >= 0) { - glUniformMatrix3fvARB(mUniform[index], count, transpose, v); + glUniformMatrix3fv(mUniform[index], count, transpose, v); } } } @@ -1472,7 +1472,7 @@ void LLGLSLShader::uniformMatrix4fv(U32 index, U32 count, GLboolean transpose, c if (mUniform[index] >= 0) { - glUniformMatrix4fvARB(mUniform[index], count, transpose, v); + glUniformMatrix4fv(mUniform[index], count, transpose, v); } } } @@ -1490,7 +1490,7 @@ GLint LLGLSLShader::getUniformLocation(const LLStaticHashedString& uniform) if (gDebugGL) { stop_glerror(); - if (iter->second != glGetUniformLocationARB(mProgramObject, uniform.String().c_str())) + if (iter->second != glGetUniformLocation(mProgramObject, uniform.String().c_str())) { LL_ERRS() << "Uniform does not match." << LL_ENDL; } @@ -1545,7 +1545,7 @@ void LLGLSLShader::uniform1i(const LLStaticHashedString& uniform, GLint v) LLVector4 vec(v,0.f,0.f,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec)) { - glUniform1iARB(location, v); + glUniform1i(location, v); mValue[location] = vec; } } @@ -1562,7 +1562,7 @@ void LLGLSLShader::uniform1iv(const LLStaticHashedString& uniform, U32 count, co if (iter == mValue.end() || shouldChange(iter->second, vec) || count != 1) { LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; - glUniform1ivARB(location, count, v); + glUniform1iv(location, count, v); mValue[location] = vec; } } @@ -1579,7 +1579,7 @@ void LLGLSLShader::uniform4iv(const LLStaticHashedString& uniform, U32 count, co if (iter == mValue.end() || shouldChange(iter->second, vec) || count != 1) { LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; - glUniform4ivARB(location, count, v); + glUniform4iv(location, count, v); mValue[location] = vec; } } @@ -1595,7 +1595,7 @@ void LLGLSLShader::uniform2i(const LLStaticHashedString& uniform, GLint i, GLint LLVector4 vec(i,j,0.f,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec)) { - glUniform2iARB(location, i, j); + glUniform2i(location, i, j); mValue[location] = vec; } } @@ -1612,7 +1612,7 @@ void LLGLSLShader::uniform1f(const LLStaticHashedString& uniform, GLfloat v) LLVector4 vec(v,0.f,0.f,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec)) { - glUniform1fARB(location, v); + glUniform1f(location, v); mValue[location] = vec; } } @@ -1628,7 +1628,7 @@ void LLGLSLShader::uniform2f(const LLStaticHashedString& uniform, GLfloat x, GLf LLVector4 vec(x,y,0.f,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec)) { - glUniform2fARB(location, x,y); + glUniform2f(location, x,y); mValue[location] = vec; } } @@ -1645,7 +1645,7 @@ void LLGLSLShader::uniform3f(const LLStaticHashedString& uniform, GLfloat x, GLf LLVector4 vec(x,y,z,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec)) { - glUniform3fARB(location, x,y,z); + glUniform3f(location, x,y,z); mValue[location] = vec; } } @@ -1661,7 +1661,7 @@ void LLGLSLShader::uniform1fv(const LLStaticHashedString& uniform, U32 count, co LLVector4 vec(v[0],0.f,0.f,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) { - glUniform1fvARB(location, count, v); + glUniform1fv(location, count, v); mValue[location] = vec; } } @@ -1677,7 +1677,7 @@ void LLGLSLShader::uniform2fv(const LLStaticHashedString& uniform, U32 count, co LLVector4 vec(v[0],v[1],0.f,0.f); if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) { - glUniform2fvARB(location, count, v); + glUniform2fv(location, count, v); mValue[location] = vec; } } @@ -1693,7 +1693,7 @@ void LLGLSLShader::uniform3fv(const LLStaticHashedString& uniform, U32 count, co LLVector4 vec(v[0],v[1],v[2],0.f); if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) { - glUniform3fvARB(location, count, v); + glUniform3fv(location, count, v); mValue[location] = vec; } } @@ -1710,7 +1710,7 @@ void LLGLSLShader::uniform4fv(const LLStaticHashedString& uniform, U32 count, co if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1) { LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; - glUniform4fvARB(location, count, v); + glUniform4fv(location, count, v); mValue[location] = vec; } } @@ -1723,7 +1723,7 @@ void LLGLSLShader::uniformMatrix4fv(const LLStaticHashedString& uniform, U32 cou if (location >= 0) { stop_glerror(); - glUniformMatrix4fvARB(location, count, transpose, v); + glUniformMatrix4fv(location, count, transpose, v); stop_glerror(); } } @@ -1733,7 +1733,7 @@ void LLGLSLShader::vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GL { if (mAttribute[index] > 0) { - glVertexAttrib4fARB(mAttribute[index], x, y, z, w); + glVertexAttrib4f(mAttribute[index], x, y, z, w); } } @@ -1741,7 +1741,7 @@ void LLGLSLShader::vertexAttrib4fv(U32 index, GLfloat* v) { if (mAttribute[index] > 0) { - glVertexAttrib4fvARB(mAttribute[index], v); + glVertexAttrib4fv(mAttribute[index], v); } } diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h index 68e1a8954d..c26ee014cb 100644 --- a/indra/llrender/llglslshader.h +++ b/indra/llrender/llglslshader.h @@ -146,7 +146,7 @@ public: LLGLSLShader(); ~LLGLSLShader(); - static GLhandleARB sCurBoundShader; + static GLuint sCurBoundShader; static LLGLSLShader* sCurBoundShaderPtr; static S32 sIndexedTextureChannels; @@ -168,8 +168,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> *); @@ -243,7 +243,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/llimagegl.cpp b/indra/llrender/llimagegl.cpp index 6215727de0..d8e312106c 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -794,7 +794,7 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32 if (is_compressed) { S32 tex_size = dataFormatBytes(mFormatPrimary, w, h); - glCompressedTexImage2DARB(mTarget, gl_level, mFormatPrimary, w, h, 0, tex_size, (GLvoid *)data_in); + glCompressedTexImage2D(mTarget, gl_level, mFormatPrimary, w, h, 0, tex_size, (GLvoid *)data_in); stop_glerror(); } else @@ -990,7 +990,7 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32 if (is_compressed) { S32 tex_size = dataFormatBytes(mFormatPrimary, w, h); - glCompressedTexImage2DARB(mTarget, 0, mFormatPrimary, w, h, 0, tex_size, (GLvoid *)data_in); + glCompressedTexImage2D(mTarget, 0, mFormatPrimary, w, h, 0, tex_size, (GLvoid *)data_in); stop_glerror(); } else @@ -1838,7 +1838,7 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre return FALSE ; } - glGetCompressedTexImageARB(mTarget, gl_discard, (GLvoid*)(imageraw->getData())); + glGetCompressedTexImage(mTarget, gl_discard, (GLvoid*)(imageraw->getData())); //stop_glerror(); } else diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index b6ea5aa7f1..74154e5676 100644 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -239,17 +239,17 @@ void LLPostProcess::applyColorFilterShader(void) gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, sceneRenderTexture); getShaderUniforms(colorFilterUniforms, gPostColorFilterProgram.mProgramObject); - glUniform1iARB(colorFilterUniforms["RenderTexture"], 0); - glUniform1fARB(colorFilterUniforms["brightness"], tweaks.getBrightness()); - glUniform1fARB(colorFilterUniforms["contrast"], tweaks.getContrast()); + glUniform1i(colorFilterUniforms["RenderTexture"], 0); + glUniform1f(colorFilterUniforms["brightness"], tweaks.getBrightness()); + glUniform1f(colorFilterUniforms["contrast"], tweaks.getContrast()); float baseI = (tweaks.getContrastBaseR() + tweaks.getContrastBaseG() + tweaks.getContrastBaseB()) / 3.0f; baseI = tweaks.getContrastBaseIntensity() / ((baseI < 0.001f) ? 0.001f : baseI); float baseR = tweaks.getContrastBaseR() * baseI; float baseG = tweaks.getContrastBaseG() * baseI; float baseB = tweaks.getContrastBaseB() * baseI; - glUniform3fARB(colorFilterUniforms["contrastBase"], baseR, baseG, baseB); - glUniform1fARB(colorFilterUniforms["saturation"], tweaks.getSaturation()); - glUniform3fARB(colorFilterUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B); + glUniform3f(colorFilterUniforms["contrastBase"], baseR, baseG, baseB); + glUniform1f(colorFilterUniforms["saturation"], tweaks.getSaturation()); + glUniform3f(colorFilterUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B); LLGLEnable blend(GL_BLEND); gGL.setSceneBlendType(LLRender::BT_REPLACE); @@ -282,22 +282,22 @@ void LLPostProcess::applyNightVisionShader(void) getShaderUniforms(nightVisionUniforms, gPostNightVisionProgram.mProgramObject); gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, sceneRenderTexture); - glUniform1iARB(nightVisionUniforms["RenderTexture"], 0); + glUniform1i(nightVisionUniforms["RenderTexture"], 0); gGL.getTexUnit(1)->activate(); gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(1)->bindManual(LLTexUnit::TT_TEXTURE, noiseTexture); - glUniform1iARB(nightVisionUniforms["NoiseTexture"], 1); + glUniform1i(nightVisionUniforms["NoiseTexture"], 1); - glUniform1fARB(nightVisionUniforms["brightMult"], tweaks.getBrightMult()); - glUniform1fARB(nightVisionUniforms["noiseStrength"], tweaks.getNoiseStrength()); + glUniform1f(nightVisionUniforms["brightMult"], tweaks.getBrightMult()); + glUniform1f(nightVisionUniforms["noiseStrength"], tweaks.getNoiseStrength()); noiseTextureScale = 0.01f + ((101.f - tweaks.getNoiseSize()) / 100.f); noiseTextureScale *= (screenH / NOISE_SIZE); - glUniform3fARB(nightVisionUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B); + glUniform3f(nightVisionUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B); LLGLEnable blend(GL_BLEND); gGL.setSceneBlendType(LLRender::BT_REPLACE); @@ -345,12 +345,12 @@ 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; for (i = uniforms.begin(); i != uniforms.end(); ++i){ - i->second = glGetUniformLocationARB(prog, i->first.String().c_str()); + i->second = glGetUniformLocation(prog, i->first.String().c_str()); } } @@ -391,7 +391,7 @@ void LLPostProcess::doEffects(void) void LLPostProcess::copyFrameBuffer(U32 & texture, unsigned int width, unsigned int height) { gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, texture); - glCopyTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, 0, 0, width, height, 0); + glCopyTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA, 0, 0, width, height, 0); } void LLPostProcess::drawOrthoQuad(unsigned int width, unsigned int height, QuadType type) @@ -410,60 +410,60 @@ void LLPostProcess::drawOrthoQuad(unsigned int width, unsigned int height, QuadT glBegin(GL_QUADS); if (type != QUAD_BLOOM_EXTRACT){ - glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, (GLfloat) height); + glMultiTexCoord2f(GL_TEXTURE0, 0.f, (GLfloat) height); } else { - glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, (GLfloat) height * 2.0f); + glMultiTexCoord2f(GL_TEXTURE0, 0.f, (GLfloat) height * 2.0f); } if (type == QUAD_NOISE){ - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, + glMultiTexCoord2f(GL_TEXTURE1, noiseX, noiseTextureScale + noiseY); } else if (type == QUAD_BLOOM_COMBINE){ - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.f, (GLfloat) height * 0.5f); + glMultiTexCoord2f(GL_TEXTURE1, 0.f, (GLfloat) height * 0.5f); } glVertex2f(0.f, (GLfloat) screenH - height); if (type != QUAD_BLOOM_EXTRACT){ - glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, 0.f); + glMultiTexCoord2f(GL_TEXTURE0, 0.f, 0.f); } else { - glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, 0.f); + glMultiTexCoord2f(GL_TEXTURE0, 0.f, 0.f); } if (type == QUAD_NOISE){ - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, + glMultiTexCoord2f(GL_TEXTURE1, noiseX, noiseY); } else if (type == QUAD_BLOOM_COMBINE){ - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.f, 0.f); + glMultiTexCoord2f(GL_TEXTURE1, 0.f, 0.f); } glVertex2f(0.f, (GLfloat) height + (screenH - height)); if (type != QUAD_BLOOM_EXTRACT){ - glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width, 0.f); + glMultiTexCoord2f(GL_TEXTURE0, (GLfloat) width, 0.f); } else { - glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width * 2.0f, 0.f); + glMultiTexCoord2f(GL_TEXTURE0, (GLfloat) width * 2.0f, 0.f); } if (type == QUAD_NOISE){ - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, + glMultiTexCoord2f(GL_TEXTURE1, screenRatio * noiseTextureScale + noiseX, noiseY); } else if (type == QUAD_BLOOM_COMBINE){ - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, (GLfloat) width * 0.5f, 0.f); + glMultiTexCoord2f(GL_TEXTURE1, (GLfloat) width * 0.5f, 0.f); } glVertex2f((GLfloat) width, (GLfloat) height + (screenH - height)); if (type != QUAD_BLOOM_EXTRACT){ - glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width, (GLfloat) height); + glMultiTexCoord2f(GL_TEXTURE0, (GLfloat) width, (GLfloat) height); } else { - glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width * 2.0f, (GLfloat) height * 2.0f); + glMultiTexCoord2f(GL_TEXTURE0, (GLfloat) width * 2.0f, (GLfloat) height * 2.0f); } if (type == QUAD_NOISE){ - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, + glMultiTexCoord2f(GL_TEXTURE1, screenRatio * noiseTextureScale + noiseX, noiseTextureScale + noiseY); } else if (type == QUAD_BLOOM_COMBINE){ - glMultiTexCoord2fARB(GL_TEXTURE1_ARB, (GLfloat) width * 0.5f, (GLfloat) height * 0.5f); + glMultiTexCoord2f(GL_TEXTURE1, (GLfloat) width * 0.5f, (GLfloat) height * 0.5f); } glVertex2f((GLfloat) width, (GLfloat) screenH - height); glEnd(); @@ -503,7 +503,7 @@ void LLPostProcess::createTexture(LLPointer<LLImageGL>& texture, unsigned int wi if(texture->createGLTexture()) { gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, texture->getTexName()); - glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 4, width, height, 0, + glTexImage2D(GL_TEXTURE_RECTANGLE, 0, 4, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data[0]); gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); @@ -557,7 +557,7 @@ bool LLPostProcess::checkError(void) return retCode; } -void LLPostProcess::checkShaderError(GLhandleARB shader) +void LLPostProcess::checkShaderError(GLuint shader) { GLint infologLength = 0; GLint charsWritten = 0; @@ -565,7 +565,7 @@ void LLPostProcess::checkShaderError(GLhandleARB shader) checkError(); // Check for OpenGL errors - glGetObjectParameterivARB(shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &infologLength); + glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infologLength); checkError(); // Check for OpenGL errors @@ -577,7 +577,7 @@ void LLPostProcess::checkShaderError(GLhandleARB shader) /// Could not allocate infolog buffer return; } - glGetInfoLogARB(shader, infologLength, &charsWritten, infoLog); + glGetProgramInfoLog(shader, infologLength, &charsWritten, infoLog); // shaderErrorLog << (char *) infoLog << std::endl; mShaderErrorString = (char *) infoLog; free(infoLog); 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/llrender.cpp b/indra/llrender/llrender.cpp index e5bd19e91c..821109ba99 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -123,7 +123,7 @@ void LLTexUnit::refreshState(void) gGL.flush(); - glActiveTextureARB(GL_TEXTURE0_ARB + mIndex); + glActiveTexture(GL_TEXTURE0 + mIndex); if (mCurrTexType != TT_NONE) { @@ -144,7 +144,7 @@ void LLTexUnit::activate(void) if ((S32)gGL.mCurrTextureUnitIndex != mIndex || gGL.mDirty) { gGL.flush(); - glActiveTextureARB(GL_TEXTURE0_ARB + mIndex); + glActiveTexture(GL_TEXTURE0 + mIndex); gGL.mCurrTextureUnitIndex = mIndex; } } @@ -188,7 +188,7 @@ void LLTexUnit::bindFast(LLTexture* texture) { LLImageGL* gl_tex = texture->getGLTexture(); - glActiveTextureARB(GL_TEXTURE0_ARB + mIndex); + glActiveTexture(GL_TEXTURE0 + mIndex); gGL.mCurrTextureUnitIndex = mIndex; mCurrTexture = gl_tex->getTexName(); if (!mCurrTexture) @@ -640,9 +640,9 @@ void LLTexUnit::debugTextureUnit(void) GLint activeTexture; glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &activeTexture); - if ((GL_TEXTURE0_ARB + mIndex) != activeTexture) + if ((GL_TEXTURE0 + mIndex) != activeTexture) { - U32 set_unit = (activeTexture - GL_TEXTURE0_ARB); + U32 set_unit = (activeTexture - GL_TEXTURE0); LL_WARNS() << "Incorrect Texture Unit! Expected: " << set_unit << " Actual: " << mIndex << LL_ENDL; } } @@ -875,8 +875,8 @@ void LLRender::init() #if LL_WINDOWS if (gGLManager.mHasDebugOutput && gDebugGL) { //setup debug output callback - //glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW_ARB, 0, NULL, GL_TRUE); - glDebugMessageCallbackARB((GLDEBUGPROCARB) gl_debug_callback, NULL); + //glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW_ARB, 0, NULL, GL_TRUE); + glDebugMessageCallback((GLDEBUGPROCARB) gl_debug_callback, NULL); glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); } #endif @@ -1471,7 +1471,7 @@ void LLRender::blendFunc(eBlendFactor color_sfactor, eBlendFactor color_dfactor, llassert(color_dfactor < BF_UNDEF); llassert(alpha_sfactor < BF_UNDEF); llassert(alpha_dfactor < BF_UNDEF); - if (!gGLManager.mHasBlendFuncSeparate) + if (!LLRender::sGLCoreProfile && !gGLManager.mHasBlendFuncSeparate) { LL_WARNS_ONCE("render") << "no glBlendFuncSeparateEXT(), using color-only blend func" << LL_ENDL; blendFunc(color_sfactor, color_dfactor); @@ -1485,8 +1485,16 @@ void LLRender::blendFunc(eBlendFactor color_sfactor, eBlendFactor color_dfactor, mCurrBlendColorDFactor = color_dfactor; mCurrBlendAlphaDFactor = alpha_dfactor; flush(); - glBlendFuncSeparateEXT(sGLBlendFactor[color_sfactor], sGLBlendFactor[color_dfactor], + if (LLRender::sGLCoreProfile) + { + glBlendFuncSeparate(sGLBlendFactor[color_sfactor], sGLBlendFactor[color_dfactor], + sGLBlendFactor[alpha_sfactor], sGLBlendFactor[alpha_dfactor]); + } + else + { + glBlendFuncSeparateEXT(sGLBlendFactor[color_sfactor], sGLBlendFactor[color_dfactor], sGLBlendFactor[alpha_sfactor], sGLBlendFactor[alpha_dfactor]); + } } } diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index fa46e0f7d0..fa23654978 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -490,7 +490,7 @@ void LLRenderTarget::bindTarget() GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3}; - glDrawBuffersARB(mTex.size(), drawbuffers); + glDrawBuffers(mTex.size(), drawbuffers); } if (mTex.empty()) diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 96fb764f75..43d59f7b43 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -558,18 +558,18 @@ 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; //get log length GLint length; - glGetObjectParameterivARB(ret, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length); + glGetShaderiv(ret, GL_INFO_LOG_LENGTH, &length); if (length > 0) { //the log could be any size, so allocate appropriately - GLcharARB* log = new GLcharARB[length]; - glGetInfoLogARB(ret, length, &length, log); + GLchar* log = new GLchar[length]; + glGetProgramInfoLog(ret, length, &length, log); res = std::string((char *)log); delete[] log; } @@ -577,7 +577,7 @@ static std::string get_object_log(GLhandleARB ret) } //dump shader source for debugging -void LLShaderMgr::dumpShaderSource(U32 shader_code_count, GLcharARB** shader_code_text) +void LLShaderMgr::dumpShaderSource(U32 shader_code_count, GLchar** shader_code_text) { char num_str[16]; // U32 = max 10 digits @@ -592,7 +592,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; @@ -608,7 +608,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) @@ -679,9 +679,9 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade //we can't have any lines longer than 1024 characters //or any shaders longer than 4096 lines... deal - DaveP - GLcharARB buff[1024]; - GLcharARB *extra_code_text[1024]; - GLcharARB *shader_code_text[4096 + LL_ARRAY_SIZE(extra_code_text)] = { NULL }; + GLchar buff[1024]; + GLchar *extra_code_text[1024]; + GLchar *shader_code_text[4096 + LL_ARRAY_SIZE(extra_code_text)] = { NULL }; GLuint extra_code_count = 0, shader_code_count = 0; BOOST_STATIC_ASSERT(LL_ARRAY_SIZE(extra_code_text) < LL_ARRAY_SIZE(shader_code_text)); @@ -763,7 +763,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade extra_code_text[extra_code_count++] = strdup("#define ATTRIBUTE in\n"); - if (type == GL_VERTEX_SHADER_ARB) + if (type == GL_VERTEX_SHADER) { //"varying" state is "out" in a vertex program, "in" in a fragment program // ("varying" is deprecated after version 1.20) extra_code_text[extra_code_count++] = strdup("#define VARYING out\n"); @@ -800,7 +800,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade for (std::unordered_map<std::string,std::string>::iterator iter = defines->begin(); iter != defines->end(); ++iter) { std::string define = "#define " + iter->first + " " + iter->second + "\n"; - extra_code_text[extra_code_count++] = (GLcharARB *) strdup(define.c_str()); + extra_code_text[extra_code_count++] = (GLchar *) strdup(define.c_str()); } } @@ -809,7 +809,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade extra_code_text[extra_code_count++] = strdup( "#define IS_AMD_CARD 1\n" ); } - if (texture_index_channels > 0 && type == GL_FRAGMENT_SHADER_ARB) + if (texture_index_channels > 0 && type == GL_FRAGMENT_SHADER) { //use specified number of texture channels for indexed texture rendering @@ -949,7 +949,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade } else { - shader_code_text[shader_code_count] = (GLcharARB *)strdup((char *)buff); + shader_code_text[shader_code_count] = (GLchar *)strdup((char *)buff); if(flag_write_to_out_of_extra_block_area & flags) { @@ -985,41 +985,46 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade fclose(file); + error = glGetError(); + if (error != GL_NO_ERROR) + { + LL_WARNS("HRS") << "WTF? Should be no error here: " << error << LL_ENDL; + } //create shader object - GLhandleARB ret = glCreateShaderObjectARB(type); + GLuint ret = glCreateShader(type); error = glGetError(); if (error != GL_NO_ERROR) { - LL_WARNS("ShaderLoading") << "GL ERROR in glCreateShaderObjectARB: " << error << " for file: " << open_file_name << LL_ENDL; + LL_WARNS("ShaderLoading") << "GL ERROR in glCreateShader: " << error << " for file: " << open_file_name << LL_ENDL; } //load source - glShaderSourceARB(ret, shader_code_count, (const GLcharARB**) shader_code_text, NULL); + glShaderSource(ret, shader_code_count, (const GLchar**) shader_code_text, NULL); error = glGetError(); if (error != GL_NO_ERROR) { - LL_WARNS("ShaderLoading") << "GL ERROR in glShaderSourceARB: " << error << " for file: " << open_file_name << LL_ENDL; + LL_WARNS("ShaderLoading") << "GL ERROR in glShaderSource: " << error << " for file: " << open_file_name << LL_ENDL; } //compile source - glCompileShaderARB(ret); + glCompileShader(ret); error = glGetError(); if (error != GL_NO_ERROR) { - LL_WARNS("ShaderLoading") << "GL ERROR in glCompileShaderARB: " << error << " for file: " << open_file_name << LL_ENDL; + LL_WARNS("ShaderLoading") << "GL ERROR in glCompileShader: " << error << " for file: " << open_file_name << LL_ENDL; } if (error == GL_NO_ERROR) { //check for errors GLint success = GL_TRUE; - glGetObjectParameterivARB(ret, GL_OBJECT_COMPILE_STATUS_ARB, &success); + glGetShaderiv(ret, GL_COMPILE_STATUS, &success); error = glGetError(); - if (error != GL_NO_ERROR || success == GL_FALSE) + if (error != GL_NO_ERROR || success == GL_FALSE) { //an error occured, print log LL_WARNS("ShaderLoading") << "GLSL Compilation Error:" << LL_ENDL; @@ -1044,10 +1049,10 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade if (ret) { // Add shader file to map - if (type == GL_VERTEX_SHADER_ARB) { + if (type == GL_VERTEX_SHADER) { mVertexShaderObjects[filename] = ret; } - else if (type == GL_FRAGMENT_SHADER_ARB) { + else if (type == GL_FRAGMENT_SHADER) { mFragmentShaderObjects[filename] = ret; } shader_level = try_gpu_class; @@ -1064,12 +1069,12 @@ 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); + glLinkProgram(obj); GLint success = GL_TRUE; - glGetObjectParameterivARB(obj, GL_OBJECT_LINK_STATUS_ARB, &success); + glGetProgramiv(obj, GL_LINK_STATUS, &success); if (!suppress_errors && success == GL_FALSE) { //an error occured, print log @@ -1087,12 +1092,12 @@ 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); + glValidateProgram(obj); GLint success = GL_TRUE; - glGetObjectParameterivARB(obj, GL_OBJECT_VALIDATE_STATUS_ARB, &success); + glGetProgramiv(obj, GL_LINK_STATUS, &success); if (success == GL_FALSE) { LL_SHADER_LOADING_WARNS() << "GLSL program not valid: " << LL_ENDL; diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 9e8f848491..008e3dafa6 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -269,11 +269,11 @@ public: virtual void initAttribsAndUniforms(void); BOOL attachShaderFeatures(LLGLSLShader * shader); - void dumpObjectLog(GLhandleARB 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); + void dumpObjectLog(GLuint ret, BOOL warns = TRUE, const std::string& filename = ""); + void dumpShaderSource(U32 shader_code_count, GLchar** shader_code_text); + 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 @@ -283,8 +283,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; diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index b1b69f1508..f2c863d057 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -127,7 +127,7 @@ U32 LLVBOPool::genBuffer() if (sNameIdx == 0) { - glGenBuffersARB(1024, sNamePool); + glGenBuffers(1024, sNamePool); sNameIdx = 1024; } @@ -141,11 +141,11 @@ void LLVBOPool::deleteBuffer(U32 name) { LLVertexBuffer::unbind(); - glBindBufferARB(mType, name); - glBufferDataARB(mType, 0, NULL, mUsage); - glBindBufferARB(mType, 0); + glBindBuffer(mType, name); + glBufferData(mType, 0, NULL, mUsage); + glBindBuffer(mType, 0); - glDeleteBuffersARB(1, &name); + glDeleteBuffers(1, &name); } } @@ -176,7 +176,7 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) //make a new buffer name = genBuffer(); - glBindBufferARB(mType, name); + glBindBuffer(mType, name); if (!for_seed && i < LL_VBO_POOL_SEED_COUNT) { //record this miss @@ -194,7 +194,7 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) if (LLVertexBuffer::sDisableVBOMapping || mUsage != GL_DYNAMIC_DRAW_ARB) { - glBufferDataARB(mType, size, 0, mUsage); + glBufferData(mType, size, 0, mUsage); if (mUsage != GL_DYNAMIC_COPY_ARB) { //data will be provided by application ret = (U8*) ll_aligned_malloc<64>(size); @@ -212,10 +212,10 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed) } else { //always use a true hint of static draw when allocating non-client-backed buffers - glBufferDataARB(mType, size, 0, GL_STATIC_DRAW_ARB); + glBufferData(mType, size, 0, GL_STATIC_DRAW_ARB); } - glBindBufferARB(mType, 0); + glBindBuffer(mType, 0); if (for_seed) { //put into pool for future use @@ -451,14 +451,14 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask) { //was enabled if (!(data_mask & mask)) { //needs to be disabled - glDisableVertexAttribArrayARB(loc); + glDisableVertexAttribArray(loc); } } else { //was disabled if (data_mask & mask) { //needs to be enabled - glEnableVertexAttribArrayARB(loc); + glEnableVertexAttribArray(loc); } } } @@ -763,12 +763,12 @@ void LLVertexBuffer::unbind() if (sVBOActive) { - glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + glBindBuffer(GL_ARRAY_BUFFER_ARB, 0); sVBOActive = false; } if (sIBOActive) { - glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); sIBOActive = false; } @@ -1334,7 +1334,7 @@ void LLVertexBuffer::setupVertexArray() { if (mTypeMask & (1 << i)) { - glEnableVertexAttribArrayARB(i); + glEnableVertexAttribArray(i); if (attrib_integer[i]) { @@ -1360,14 +1360,14 @@ void LLVertexBuffer::setupVertexArray() // pointer value. Ruslan asserts that in this case the last // param is interpreted as an array data offset within the VBO // rather than as an actual pointer, so it's okay. - glVertexAttribPointerARB(i, attrib_size[i], attrib_type[i], + glVertexAttribPointer(i, attrib_size[i], attrib_type[i], attrib_normalized[i], sTypeSize[i], reinterpret_cast<GLvoid*>(intptr_t(mOffsets[i]))); } } else { - glDisableVertexAttribArrayARB(i); + glDisableVertexAttribArray(i); } } @@ -1512,7 +1512,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran if (gDebugGL) { GLint size = 0; - glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size); + glGetBufferParameteriv(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size); if (size < mSize) { @@ -1534,17 +1534,17 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran glBufferParameteriAPPLE(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE); glBufferParameteriAPPLE(GL_ARRAY_BUFFER_ARB, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE); #endif - src = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); + src = (U8*) glMapBuffer(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); } else { - src = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); + src = (U8*) glMapBuffer(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); } } else { map_range = false; - src = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); + src = (U8*) glMapBuffer(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); } llassert(src != NULL); @@ -1568,7 +1568,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran //print out more debug info before crash LL_INFOS() << "vertex buffer size: (num verts : num indices) = " << getNumVerts() << " : " << getNumIndices() << LL_ENDL; GLint size; - glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size); + glGetBufferParameteriv(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size); LL_INFOS() << "GL_ARRAY_BUFFER_ARB size is " << size << LL_ENDL; //-------------------- @@ -1707,17 +1707,17 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range) glBufferParameteriAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE); glBufferParameteriAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE); #endif - src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); + src = (U8*) glMapBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); } else { - src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); + src = (U8*) glMapBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); } } else { map_range = false; - src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); + src = (U8*) glMapBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB); } llassert(src != NULL); @@ -1793,12 +1793,12 @@ void LLVertexBuffer::unmapBuffer() S32 length = sTypeSize[region.mType]*region.mCount; if (mSize >= length + offset) { - glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, offset, length, (U8*)mMappedData + offset); + glBufferSubData(GL_ARRAY_BUFFER_ARB, offset, length, (U8*)mMappedData + offset); } else { GLint size = 0; - glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size); + glGetBufferParameteriv(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size); LL_WARNS() << "Attempted to map regions to a buffer that is too small, " << "mapped size: " << mSize << ", gl buffer size: " << size @@ -1814,7 +1814,7 @@ void LLVertexBuffer::unmapBuffer() else { stop_glerror(); - glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, getSize(), (U8*) mMappedData); + glBufferSubData(GL_ARRAY_BUFFER_ARB, 0, getSize(), (U8*) mMappedData); stop_glerror(); } } @@ -1848,7 +1848,7 @@ void LLVertexBuffer::unmapBuffer() } } stop_glerror(); - glUnmapBufferARB(GL_ARRAY_BUFFER_ARB); + glUnmapBuffer(GL_ARRAY_BUFFER_ARB); stop_glerror(); mMappedData = NULL; @@ -1873,12 +1873,12 @@ void LLVertexBuffer::unmapBuffer() S32 length = sizeof(U16)*region.mCount; if (mIndicesSize >= length + offset) { - glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length, (U8*) mMappedIndexData+offset); + glBufferSubData(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length, (U8*) mMappedIndexData+offset); } else { GLint size = 0; - glGetBufferParameterivARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size); + glGetBufferParameteriv(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size); LL_WARNS() << "Attempted to map regions to a buffer that is too small, " << "mapped size: " << mIndicesSize << ", gl buffer size: " << size @@ -1894,7 +1894,7 @@ void LLVertexBuffer::unmapBuffer() else { stop_glerror(); - glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, getIndicesSize(), (U8*) mMappedIndexData); + glBufferSubData(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, getIndicesSize(), (U8*) mMappedIndexData); stop_glerror(); } } @@ -1931,7 +1931,7 @@ void LLVertexBuffer::unmapBuffer() } } - glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB); + glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB); mMappedIndexData = NULL; } @@ -2085,7 +2085,7 @@ bool LLVertexBuffer::bindGLBuffer(bool force_bind) if (useVBOs() && (force_bind || (mGLBuffer && (mGLBuffer != sGLRenderBuffer || !sVBOActive)))) { LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX; - glBindBufferARB(GL_ARRAY_BUFFER_ARB, mGLBuffer); + glBindBuffer(GL_ARRAY_BUFFER_ARB, mGLBuffer); sGLRenderBuffer = mGLBuffer; sBindCount++; sVBOActive = true; @@ -2102,7 +2102,7 @@ bool LLVertexBuffer::bindGLBufferFast() { if (mGLBuffer != sGLRenderBuffer || !sVBOActive) { - glBindBufferARB(GL_ARRAY_BUFFER_ARB, mGLBuffer); + glBindBuffer(GL_ARRAY_BUFFER_ARB, mGLBuffer); sGLRenderBuffer = mGLBuffer; sBindCount++; sVBOActive = true; @@ -2125,7 +2125,7 @@ bool LLVertexBuffer::bindGLIndices(bool force_bind) { LL_ERRS() << "VBO bound while another VBO mapped!" << LL_ENDL; }*/ - glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mGLIndices); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, mGLIndices); sGLRenderIndices = mGLIndices; stop_glerror(); sBindCount++; @@ -2140,7 +2140,7 @@ bool LLVertexBuffer::bindGLIndicesFast() { if (mGLIndices != sGLRenderIndices || !sIBOActive) { - glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mGLIndices); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, mGLIndices); sGLRenderIndices = mGLIndices; sBindCount++; sIBOActive = true; @@ -2302,7 +2302,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask) { if (sVBOActive) { - glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + glBindBuffer(GL_ARRAY_BUFFER_ARB, 0); sBindCount++; sVBOActive = false; setup = true; // ... or a VBO is deactivated @@ -2317,7 +2317,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask) { if (sIBOActive) { - glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); sBindCount++; sIBOActive = false; } @@ -2392,74 +2392,74 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask) { S32 loc = TYPE_NORMAL; void* ptr = (void*)(base + mOffsets[TYPE_NORMAL]); - glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], ptr); + glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], ptr); } if (data_mask & MAP_TEXCOORD3) { S32 loc = TYPE_TEXCOORD3; void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD3]); - glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], ptr); + glVertexAttribPointer(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], ptr); } if (data_mask & MAP_TEXCOORD2) { S32 loc = TYPE_TEXCOORD2; void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD2]); - glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], ptr); + glVertexAttribPointer(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], ptr); } if (data_mask & MAP_TEXCOORD1) { S32 loc = TYPE_TEXCOORD1; void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD1]); - glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], ptr); + glVertexAttribPointer(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], ptr); } if (data_mask & MAP_TANGENT) { S32 loc = TYPE_TANGENT; void* ptr = (void*)(base + mOffsets[TYPE_TANGENT]); - glVertexAttribPointerARB(loc, 4,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TANGENT], ptr); + glVertexAttribPointer(loc, 4,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TANGENT], ptr); } if (data_mask & MAP_TEXCOORD0) { S32 loc = TYPE_TEXCOORD0; void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD0]); - glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], ptr); + glVertexAttribPointer(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], ptr); } if (data_mask & MAP_COLOR) { S32 loc = TYPE_COLOR; //bind emissive instead of color pointer if emissive is present void* ptr = (data_mask & MAP_EMISSIVE) ? (void*)(base + mOffsets[TYPE_EMISSIVE]) : (void*)(base + mOffsets[TYPE_COLOR]); - glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], ptr); + glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], ptr); } if (data_mask & MAP_EMISSIVE) { S32 loc = TYPE_EMISSIVE; void* ptr = (void*)(base + mOffsets[TYPE_EMISSIVE]); - glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr); + glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr); if (!(data_mask & MAP_COLOR)) { //map emissive to color channel when color is not also being bound to avoid unnecessary shader swaps loc = TYPE_COLOR; - glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr); + glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr); } } if (data_mask & MAP_WEIGHT) { S32 loc = TYPE_WEIGHT; void* ptr = (void*)(base + mOffsets[TYPE_WEIGHT]); - glVertexAttribPointerARB(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr); + glVertexAttribPointer(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr); } if (data_mask & MAP_WEIGHT4) { S32 loc = TYPE_WEIGHT4; void* ptr = (void*)(base+mOffsets[TYPE_WEIGHT4]); - glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr); + glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr); } if (data_mask & MAP_CLOTHWEIGHT) { S32 loc = TYPE_CLOTHWEIGHT; void* ptr = (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]); - glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr); + glVertexAttribPointer(loc, 4, GL_FLOAT, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr); } if (data_mask & MAP_TEXTURE_INDEX && (gGLManager.mGLSLVersionMajor >= 2 || gGLManager.mGLSLVersionMinor >= 30)) //indexed texture rendering requires GLSL 1.30 or later @@ -2474,7 +2474,7 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask) { S32 loc = TYPE_VERTEX; void* ptr = (void*)(base + mOffsets[TYPE_VERTEX]); - glVertexAttribPointerARB(loc, 3,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr); + glVertexAttribPointer(loc, 3,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr); } llglassertok(); @@ -2488,74 +2488,74 @@ void LLVertexBuffer::setupVertexBufferFast(U32 data_mask) { S32 loc = TYPE_NORMAL; void* ptr = (void*)(base + mOffsets[TYPE_NORMAL]); - glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], ptr); + glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], ptr); } if (data_mask & MAP_TEXCOORD3) { S32 loc = TYPE_TEXCOORD3; void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD3]); - glVertexAttribPointerARB(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], ptr); + glVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], ptr); } if (data_mask & MAP_TEXCOORD2) { S32 loc = TYPE_TEXCOORD2; void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD2]); - glVertexAttribPointerARB(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], ptr); + glVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], ptr); } if (data_mask & MAP_TEXCOORD1) { S32 loc = TYPE_TEXCOORD1; void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD1]); - glVertexAttribPointerARB(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], ptr); + glVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], ptr); } if (data_mask & MAP_TANGENT) { S32 loc = TYPE_TANGENT; void* ptr = (void*)(base + mOffsets[TYPE_TANGENT]); - glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TANGENT], ptr); + glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TANGENT], ptr); } if (data_mask & MAP_TEXCOORD0) { S32 loc = TYPE_TEXCOORD0; void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD0]); - glVertexAttribPointerARB(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], ptr); + glVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], ptr); } if (data_mask & MAP_COLOR) { S32 loc = TYPE_COLOR; //bind emissive instead of color pointer if emissive is present void* ptr = (data_mask & MAP_EMISSIVE) ? (void*)(base + mOffsets[TYPE_EMISSIVE]) : (void*)(base + mOffsets[TYPE_COLOR]); - glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], ptr); + glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], ptr); } if (data_mask & MAP_EMISSIVE) { S32 loc = TYPE_EMISSIVE; void* ptr = (void*)(base + mOffsets[TYPE_EMISSIVE]); - glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr); + glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr); if (!(data_mask & MAP_COLOR)) { //map emissive to color channel when color is not also being bound to avoid unnecessary shader swaps loc = TYPE_COLOR; - glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr); + glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr); } } if (data_mask & MAP_WEIGHT) { S32 loc = TYPE_WEIGHT; void* ptr = (void*)(base + mOffsets[TYPE_WEIGHT]); - glVertexAttribPointerARB(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr); + glVertexAttribPointer(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr); } if (data_mask & MAP_WEIGHT4) { S32 loc = TYPE_WEIGHT4; void* ptr = (void*)(base + mOffsets[TYPE_WEIGHT4]); - glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr); + glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr); } if (data_mask & MAP_CLOTHWEIGHT) { S32 loc = TYPE_CLOTHWEIGHT; void* ptr = (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]); - glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr); + glVertexAttribPointer(loc, 4, GL_FLOAT, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr); } if (data_mask & MAP_TEXTURE_INDEX) { @@ -2569,7 +2569,7 @@ void LLVertexBuffer::setupVertexBufferFast(U32 data_mask) { S32 loc = TYPE_VERTEX; void* ptr = (void*)(base + mOffsets[TYPE_VERTEX]); - glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr); + glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr); } } |