From 50b383e5aa333d453e906ae2beb28fe1da549bef Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 1 Feb 2019 09:45:07 -0800 Subject: Fix issue with OSX shader compiler not implementing #if correctly (nice job, Timmy). --- indra/llinventory/llsettingssky.cpp | 4 ++-- indra/llrender/llrendertarget.cpp | 3 ++- indra/newview/app_settings/settings.xml | 2 +- .../shaders/class1/deferred/moonF.glsl | 2 ++ .../app_settings/shaders/class1/deferred/skyF.glsl | 28 ++++++++++++---------- .../shaders/class1/deferred/waterF.glsl | 4 ++-- .../shaders/class1/environment/waterF.glsl | 2 +- indra/newview/lldrawpoolwlsky.cpp | 2 +- indra/newview/llpaneleditwater.cpp | 2 +- indra/newview/llviewerdisplay.cpp | 2 ++ indra/newview/llviewerwindow.cpp | 2 +- 11 files changed, 30 insertions(+), 23 deletions(-) (limited to 'indra') diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index f3519dc7cb..44ed16e0f9 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -955,13 +955,13 @@ void LLSettingsSky::updateSettings() bool LLSettingsSky::getIsSunUp() const { LLVector3 sunDir = getSunDirection(); - return sunDir.mV[2] > NIGHTTIME_ELEVATION_SIN; + return sunDir.mV[2] > 0;//NIGHTTIME_ELEVATION_SIN; } bool LLSettingsSky::getIsMoonUp() const { LLVector3 moonDir = getMoonDirection(); - return moonDir.mV[2] > NIGHTTIME_ELEVATION_SIN; + return moonDir.mV[2] > 0;//NIGHTTIME_ELEVATION_SIN; } void LLSettingsSky::calculateHeavenlyBodyPositions() const diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp index cd484b4fe9..08924dd536 100644 --- a/indra/llrender/llrendertarget.cpp +++ b/indra/llrender/llrendertarget.cpp @@ -286,7 +286,7 @@ bool LLRenderTarget::allocateDepth() U32 internal_type = LLTexUnit::getInternalType(mUsage); stop_glerror(); clear_glerror(); - LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT24, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL, false); + LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT32F, mResX, mResY, GL_DEPTH_COMPONENT, GL_FLOAT, NULL, false); gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); } @@ -465,6 +465,7 @@ void LLRenderTarget::clear(U32 mask_in) U32 mask = GL_COLOR_BUFFER_BIT; if (mUseDepth) { + glClearDepth(1.25f); mask |= GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT; } if (mFBO) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index bb5ff19176..f591782694 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8763,7 +8763,7 @@ Type Boolean Value - 0 + 1 RenderLocalLights diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl index 7265275e36..379fdf8535 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl @@ -61,5 +61,7 @@ void main() frag_data[0] = vec4(c.rgb, c.a); frag_data[1] = vec4(0.0); frag_data[2] = vec4(0.0f); + + gl_FragDepth = 0.9998f; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl index 0613111632..f8172cae17 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl @@ -44,18 +44,20 @@ vec3 scaleSoftClip(vec3 light); void main() { - // Potential Fill-rate optimization. Add cloud calculation - // back in and output alpha of 0 (so that alpha culling kills - // the fragment) if the sky wouldn't show up because the clouds - // are fully opaque. - - vec4 color; - color = vary_HazeColor; - color *= 2.; - - /// Gamma correct for WL (soft clip effect). - frag_data[0] = vec4(scaleSoftClip(color.rgb), 1.0); - frag_data[1] = vec4(0.0,0.0,0.0,0.0); - frag_data[2] = vec4(0.5,0.5,0.0,1.0); //1.0 in norm.w masks off fog + // Potential Fill-rate optimization. Add cloud calculation + // back in and output alpha of 0 (so that alpha culling kills + // the fragment) if the sky wouldn't show up because the clouds + // are fully opaque. + + vec4 color; + color = vary_HazeColor; + color *= 2.; + + /// Gamma correct for WL (soft clip effect). + frag_data[0] = vec4(scaleSoftClip(color.rgb), 1.0); + frag_data[1] = vec4(0.0,0.0,0.0,0.0); + frag_data[2] = vec4(0.5,0.5,0.0,1.0); //1.0 in norm.w masks off fog + + gl_FragDepth = 0.999f; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl index 40d4c24d34..531425b588 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl @@ -165,11 +165,11 @@ void main() color.rgb = atmosTransport(color.rgb); color.rgb = scaleSoftClipFrag(color.rgb); - color.a = spec * sunAngle2; + color.a = (water_edge > 0) ? 1.0 : (spec * sunAngle2); vec3 screenspacewavef = normalize((norm_mat*vec4(wavef, 1.0)).xyz); - frag_data[0] = vec4(color.rgb, color); // diffuse + frag_data[0] = vec4(color.rgb, 1); // diffuse frag_data[1] = vec4(0); // speccolor, spec frag_data[2] = vec4(encode_normal(screenspacewavef.xyz*0.5+0.5), 0.05, 0);// normalxy, 0, 0 } diff --git a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl index f228deb938..a4e3f94816 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl @@ -157,7 +157,7 @@ void main() color.rgb = scaleSoftClip(color.rgb); color.a = spec * sunAngle2; -#if WATER_EDGE +#if defined(WATER_EDGE) gl_FragDepth = 0.9999847f; #endif diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index f9ab241988..7f82d38ced 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -248,7 +248,7 @@ void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 ca if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY)) { - LLGLSPipelineDepthTestSkyBox sky(true, false); + LLGLSPipelineDepthTestSkyBox sky(true, true); sky_shader->bind(); diff --git a/indra/newview/llpaneleditwater.cpp b/indra/newview/llpaneleditwater.cpp index 40d84d74bd..f639ad0d98 100644 --- a/indra/newview/llpaneleditwater.cpp +++ b/indra/newview/llpaneleditwater.cpp @@ -151,7 +151,7 @@ void LLPanelSettingsWaterMainTab::refresh() getChild(FIELD_WATER_NORMAL_SCALE_X)->setValue(vect3[0]); getChild(FIELD_WATER_NORMAL_SCALE_Y)->setValue(vect3[1]); getChild(FIELD_WATER_NORMAL_SCALE_Z)->setValue(vect3[2]); - getChild(FIELD_WATER_FRESNEL_SCALE)->setValue(mWaterSettings->getFresnelOffset()); + getChild(FIELD_WATER_FRESNEL_SCALE)->setValue(mWaterSettings->getFresnelScale()); getChild(FIELD_WATER_FRESNEL_OFFSET)->setValue(mWaterSettings->getFresnelOffset()); getChild(FIELD_WATER_SCALE_ABOVE)->setValue(mWaterSettings->getScaleAbove()); getChild(FIELD_WATER_SCALE_BELOW)->setValue(mWaterSettings->getScaleBelow()); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 2d4478bfdb..2445605f19 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -157,6 +157,7 @@ void display_startup() LLGLState::checkStates(); LLGLState::checkTextureChannels(); + glClearDepth(1.25f); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); LLGLSUIDefault gls_ui; gPipeline.disableLights(); @@ -752,6 +753,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) LLGLState::checkClientArrays(); } + glClearDepth(1.25f); glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 09b681ce74..56111e9495 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -4605,7 +4605,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei // PRE SNAPSHOT gDisplaySwapBuffers = FALSE; - + glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); setCursor(UI_CURSOR_WAIT); -- cgit v1.2.3