diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llrender/llgl.cpp | 126 | ||||
-rw-r--r-- | indra/llwindow/llopenglview-objc.mm | 1 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl | 18 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl | 9 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl | 2 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.cpp | 4 |
6 files changed, 112 insertions, 48 deletions
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 8ebaf77eec..771a218b6b 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -594,12 +594,14 @@ bool LLGLManager::initGL() { parse_glsl_version(mGLSLVersionMajor, mGLSLVersionMinor); -#if LL_DARWIN +#if 0 && LL_DARWIN + // TODO maybe switch to using a core profile for GL 3.2? + // https://stackoverflow.com/a/19868861 //never use GLSL greater than 1.20 on OSX - if (mGLSLVersionMajor > 1 || mGLSLVersionMinor >= 30) + if (mGLSLVersionMajor > 1 || mGLSLVersionMinor > 30) { mGLSLVersionMajor = 1; - mGLSLVersionMinor = 20; + mGLSLVersionMinor = 30; } #endif } @@ -1012,59 +1014,109 @@ void LLGLManager::initExtensions() mHasPointParameters = FALSE; mHasTextureRectangle = FALSE; #else // LL_MESA_HEADLESS //important, gGLHExts.mSysExts is uninitialized until after glh_init_extensions is called + +#if LL_DARWIN + // Just reporting here. Nothing effecting setup. + LL_DEBUGS("HRS") << "Before any init, mSysExts reports NULL with any profiles: " << (!gGLHExts.mSysExts ? "NULL" : gGLHExts.mSysExts) << LL_ENDL; + + LL_DEBUGS("HRS") << "The following fails on legacy profiles, and enumerates 46 extensions on 3.2/4.1" << LL_ENDL; + GLint num_extensions(0); // Must be initialized, because the next line may silently fail (which will cause crashes if we go on to glGetStringi + glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions); + std::string all_extensions(""); // "GL_ARB_multitexture " + for(GLint i = 0; i < num_extensions; ++i) { + char const * extension = (char const *)glGetStringi(GL_EXTENSIONS, i); + all_extensions += extension; + all_extensions += ' '; + } + 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 + mHasMultitexture = glh_init_extensions("GL_ARB_multitexture"); - mHasATIMemInfo = ExtensionExists("GL_ATI_meminfo", gGLHExts.mSysExts); //Basic AMD method, also see mHasAMDAssociations - mHasNVXMemInfo = ExtensionExists("GL_NVX_gpu_memory_info", gGLHExts.mSysExts); - mHasSeparateSpecularColor = glh_init_extensions("GL_EXT_separate_specular_color"); - mHasAnisotropic = glh_init_extensions("GL_EXT_texture_filter_anisotropic"); - glh_init_extensions("GL_ARB_texture_cube_map"); - mHasCubeMap = ExtensionExists("GL_ARB_texture_cube_map", gGLHExts.mSysExts); - mHasARBEnvCombine = ExtensionExists("GL_ARB_texture_env_combine", gGLHExts.mSysExts); - mHasCompressedTextures = glh_init_extensions("GL_ARB_texture_compression"); - 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); + 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"); + +#if LL_DARWIN + LL_DEBUGS("HRS") << "After glh_init_extensions (" << + " GL_ARB_multitexture:" << mHasMultitexture << + " GL_ARB_texture_cube_map:" << mHasCubeMap << + " GL_ARB_texture_compression:" << mHasCompressedTextures << + " GL_EXT_separate_specular_color:" << mHasSeparateSpecularColor << + " GL_EXT_texture_filter_anisotropic:" << mHasAnisotropic << + "), mSysExts is initialized only on legacy: " << (!gGLHExts.mSysExts ? "NULL" : gGLHExts.mSysExts) << + LL_ENDL; + num_extensions = 0; all_extensions.clear(); + glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions); + for(GLint i = 0; i < num_extensions; ++i) { + char const * extension = (char const *)glGetStringi(GL_EXTENSIONS, i); + all_extensions += extension; + all_extensions += ' '; + } + LL_DEBUGS("HRS") << "Explicit enumeration works after init, on 3.2/4.1 only, producing " << num_extensions << " exts: " << all_extensions << LL_ENDL; + if (num_extensions) + { + all_extensions += "GL_ARB_multitexture GL_ARB_texture_cube_map GL_ARB_texture_compression "; // These are in 3.2 core, but not listed by OSX + gGLHExts.mSysExts = strdup(all_extensions.data()); + } +#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); + mHasSeparateSpecularColor = ExtensionExists("GL_EXT_separate_specular_color", gGLHExts.mSysExts); + mHasAnisotropic = ExtensionExists("GL_EXT_texture_filter_anisotropic", 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 + // 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); + 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); + 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); + mHassRGBTexture = ExtensionExists("GL_EXT_texture_sRGB", gGLHExts.mSysExts); #endif - + #ifdef GL_ARB_framebuffer_sRGB - mHassRGBFramebuffer = ExtensionExists("GL_ARB_framebuffer_sRGB", gGLHExts.mSysExts); + mHassRGBFramebuffer = ExtensionExists("GL_ARB_framebuffer_sRGB", gGLHExts.mSysExts); #else - mHassRGBFramebuffer = ExtensionExists("GL_EXT_framebuffer_sRGB", gGLHExts.mSysExts); + mHassRGBFramebuffer = ExtensionExists("GL_EXT_framebuffer_sRGB", gGLHExts.mSysExts); #endif - + #ifdef GL_EXT_texture_sRGB_decode mHasTexturesRGBDecode = ExtensionExists("GL_EXT_texture_sRGB_decode", gGLHExts.mSysExts); #else mHasTexturesRGBDecode = ExtensionExists("GL_ARB_texture_sRGB_decode", gGLHExts.mSysExts); #endif - mHasMipMapGeneration = mHasFramebufferObject || mGLVersion >= 1.4f; + 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; + 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 diff --git a/indra/llwindow/llopenglview-objc.mm b/indra/llwindow/llopenglview-objc.mm index 8d064ec86c..c4cdb45677 100644 --- a/indra/llwindow/llopenglview-objc.mm +++ b/indra/llwindow/llopenglview-objc.mm @@ -261,6 +261,7 @@ attributedStringInfo getSegments(NSAttributedString *str) NSOpenGLPFADepthSize, 24, NSOpenGLPFAAlphaSize, 8, NSOpenGLPFAColorSize, 24, + NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core, 0 }; diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl index 68a57d12f0..449cbeaa28 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl @@ -161,7 +161,11 @@ float getDepth(vec2 pos_screen) vec4 getTexture2DLodAmbient(vec2 tc, float lod) { - vec4 ret = texture2DLod(projectionMap, tc, lod); +#ifndef FXAA_GLSL_120 + vec4 ret = textureLod(projectionMap, tc, lod); +#else + vec4 ret = texture2D(projectionMap, tc); +#endif ret.rgb = srgb_to_linear(ret.rgb); vec2 dist = tc-vec2(0.5); @@ -173,7 +177,11 @@ vec4 getTexture2DLodAmbient(vec2 tc, float lod) vec4 getTexture2DLodDiffuse(vec2 tc, float lod) { - vec4 ret = texture2DLod(projectionMap, tc, lod); +#ifndef FXAA_GLSL_120 + vec4 ret = textureLod(projectionMap, tc, lod); +#else + vec4 ret = texture2D(projectionMap, tc); +#endif ret.rgb = srgb_to_linear(ret.rgb); vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); @@ -216,7 +224,11 @@ vec3 getProjectedLightDiffuseColor(float light_distance, vec2 projected_uv) vec4 texture2DLodSpecular(vec2 tc, float lod) { - vec4 ret = texture2DLod(projectionMap, tc, lod); +#ifndef FXAA_GLSL_120 + vec4 ret = textureLod(projectionMap, tc, lod); +#else + vec4 ret = texture2D(projectionMap, tc); +#endif ret.rgb = srgb_to_linear(ret.rgb); vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index 998ebf8836..8a04a8a6a6 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -28,8 +28,8 @@ #define PBR_USE_SUN 1 #define DEBUG_PBR_LIGHT_TYPE 0 // Output no global light to make it easier to see pointLight and spotLight -#define DEBUG_PBR_PACKORM0 0 // Rough=0, Metal=0 -#define DEBUG_PBR_PACKORM1 0 // Rough=1, Metal=1 +#define DEBUG_PBR_PACK_ORM0 0 // Rough=0, Metal=0 +#define DEBUG_PBR_PACK_ORM1 0 // Rough=1, Metal=1 #define DEBUG_PBR_TANGENT1 1 // Tangent = 1,0,0 #define DEBUG_PBR_VERT2CAM1 0 // vertex2camera = 0,0,1 #define DEBUG_PBR_SPECLIGHT051 0 // Force specLigh to be 0,0.5,1 @@ -72,6 +72,7 @@ #define DEBUG_PBR_IRRADIANCE 0 // Output: Diffuse Irradiance, NOTE: SSAO is factored in #define DEBUG_PBR_FSS_ESS_LAMBERT 0 // Output: FssEssLambert #define DEBUG_PBR_EMS 0 // Output: Ems = (1 - BRDF Scale + BRDF Bias) +#define DEBUG_PBR_EMS_AVG 0 // Output: Avg Ems #define DEBUG_PBR_AVG 0 // Output: Avg #define DEBUG_PBR_FMS_EMS 0 // Output: FmsEms #define DEBUG_PBR_DIFFUSE_K 0 // Output: diffuse FssEssLambert + FmsEms @@ -110,6 +111,7 @@ #define DEBUG_PBR_SUN_SPEC_FV 0 // F() * V() #define DEBUG_PBR_SUN_SPEC_DFV 0 // D() * F() * V() #define DEBUG_PBR_SUN_SPEC_NL_DFV 0 // nl * D() * F() * V() +#define DEBUG_PBR_SUN_FINAL 0 // LAMBERT_NL + BRDF() #define DEBUG_PBR_IOR 0 // Output: grayscale IOR #define DEBUG_PBR_REFLECT0_BASE 0 // Output: black reflect0 default from ior @@ -327,9 +329,6 @@ void main() specLight = vec3(0,0.5,1.0); irradiance = specLight; #endif -#if HAS_IBL - kSpec = mix( kSpec, iridescenceFresnel, iridescenceFactor); -#endif vec3 FssEssGGX = kSpec*vScaleBias.x + vScaleBias.y; #if DEBUG_PBR_SPEC_IBL vec3 debug_color_spec = specWeight * specLight * FssEssGGX; diff --git a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl index 41e40a07e7..769589eff1 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl @@ -278,7 +278,7 @@ void main() } } -#if DEBUG_SPOT_DIFFUSE +#if DEBUG_PBR_SPOT_DIFFUSE final_color = vec3(nl * dist_atten); #endif #if DEBUG_SPOT_NL diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 0d9670d9ca..1c6e659aed 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -3789,7 +3789,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() } } - if (success) + if (success && gGLManager.mHasCubeMapArray) { gRadianceGenProgram.mName = "Radiance Gen Shader"; gRadianceGenProgram.mShaderFiles.clear(); @@ -3799,7 +3799,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface() success = gRadianceGenProgram.createShader(NULL, NULL); } - if (success) + if (success && gGLManager.mHasCubeMapArray) { gIrradianceGenProgram.mName = "Irradiance Gen Shader"; gIrradianceGenProgram.mShaderFiles.clear(); |