diff --git a/doc/contributions.txt b/doc/contributions.txt index 9cb8db433e..008a9b44f9 100755 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -1362,7 +1362,10 @@ Sovereign Engineer SL-11625 BUG-229030 SL-14705 + SL-14706 SL-14707 + SL-14731 + SL-14732 SpacedOut Frye VWR-34 VWR-45 diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 9ea4ed19c9..7277717206 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -1020,7 +1020,6 @@ void LLGLManager::asLLSD(LLSD& info) // Other fields info["has_requirements"] = mHasRequirements; info["has_separate_specular_color"] = mHasSeparateSpecularColor; - info["debug_gpu"] = mDebugGPU; info["max_vertex_range"] = mGLMaxVertexRange; info["max_index_range"] = mGLMaxIndexRange; info["max_texture_size"] = mGLMaxTextureSize; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 1c1a586b59..ad9c5a70e0 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -11980,7 +11980,7 @@ Change of this parameter will affect the layout of buttons in notification toast Type F32 Value - 0.03 + 0.1 RenderDebugPipeline diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl index 454af2a9bc..b2fa5d8a25 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl @@ -49,10 +49,6 @@ void main() vec4 sunDiscB = texture2D(altDiffuseMap, vary_texcoord0.xy); vec4 c = mix(sunDiscA, sunDiscB, blend_factor); - c.rgb = srgb_to_linear(c.rgb); - c.rgb = clamp(c.rgb, vec3(0), vec3(1)); - c.rgb = pow(c.rgb, vec3(0.7f)); - //c.rgb = fullbrightAtmosTransport(c.rgb); c.rgb = fullbrightScaleSoftClip(c.rgb); diff --git a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl index b9ae7a0226..5a41dc644a 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl @@ -51,7 +51,6 @@ void main() // SL-9806 stars poke through // c.a *= sun_fade; - c.rgb = pow(c.rgb, vec3(0.7f)); c.rgb = fullbrightAtmosTransport(c.rgb); c.rgb = fullbrightScaleSoftClip(c.rgb); frag_color = c; diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl index 75bf8730df..fa928d993e 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl @@ -26,9 +26,9 @@ /*[EXTRA_CODE_HERE]*/ #ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_data[3]; +out vec4 frag_color; #else -#define frag_data gl_FragData +#define frag_color gl_FragColor #endif ///////////////////////////////////////////////////////////////////////// @@ -126,8 +126,6 @@ void main() color.rgb = scaleSoftClip(color.rgb); /// Gamma correct for WL (soft clip effect). - frag_data[0] = vec4(color.rgb, alpha1); - frag_data[1] = vec4(0.0,0.0,0.0,0.0); - frag_data[2] = vec4(0,0,0,1); + frag_color = vec4(color.rgb, alpha1); } diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 8a540f7b59..9ea165dd21 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -226,7 +226,7 @@ void LLDrawPoolWLSky::renderSkyHaze(const LLVector3& camPosLocal, F32 camHeightL } } -void LLDrawPoolWLSky::renderStars(void) const +void LLDrawPoolWLSky::renderStars(const LLVector3& camPosLocal) const { LLGLSPipelineBlendSkyBox gls_skybox(true, false); @@ -266,6 +266,7 @@ void LLDrawPoolWLSky::renderStars(void) const } gGL.pushMatrix(); + gGL.translatef(camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]); gGL.rotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f); if (LLGLSLShader::sNoFixedFunction) { @@ -296,7 +297,7 @@ void LLDrawPoolWLSky::renderStars(void) const } } -void LLDrawPoolWLSky::renderStarsDeferred(void) const +void LLDrawPoolWLSky::renderStarsDeferred(const LLVector3& camPosLocal) const { LLGLSPipelineBlendSkyBox gls_sky(true, false); @@ -340,6 +341,8 @@ void LLDrawPoolWLSky::renderStarsDeferred(void) const gGL.getTexUnit(1)->bind(tex_b); } + gGL.pushMatrix(); + gGL.translatef(camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]); gDeferredStarProgram.uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor); if (LLPipeline::sReflectionRender) @@ -358,6 +361,8 @@ void LLDrawPoolWLSky::renderStarsDeferred(void) const gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE); gDeferredStarProgram.unbind(); + + gGL.popMatrix(); } void LLDrawPoolWLSky::renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const @@ -608,7 +613,7 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass) if (gPipeline.canUseWindLightShaders()) { renderSkyHazeDeferred(origin, camHeightLocal); - renderStarsDeferred(); + renderStarsDeferred(origin); renderHeavenlyBodies(); renderSkyCloudsDeferred(origin, camHeightLocal, cloud_shader); } @@ -627,7 +632,7 @@ void LLDrawPoolWLSky::render(S32 pass) LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin(); renderSkyHaze(origin, camHeightLocal); - renderStars(); + renderStars(origin); renderHeavenlyBodies(); renderSkyClouds(origin, camHeightLocal, cloud_shader); diff --git a/indra/newview/lldrawpoolwlsky.h b/indra/newview/lldrawpoolwlsky.h index a4f176d6db..324886ed42 100644 --- a/indra/newview/lldrawpoolwlsky.h +++ b/indra/newview/lldrawpoolwlsky.h @@ -78,8 +78,8 @@ private: void renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 camHeightLocal) const; void renderSkyCloudsDeferred(const LLVector3& camPosLocal, F32 camHeightLocal, LLGLSLShader* cloudshader) const; - void renderStarsDeferred(void) const; - void renderStars(void) const; + void renderStarsDeferred(const LLVector3& camPosLocal) const; + void renderStars(const LLVector3& camPosLocal) const; void renderHeavenlyBodies(); }; diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 8a470cc97d..307931404c 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -950,6 +950,7 @@ void LLSpatialGroup::destroyGL(bool keep_occlusion) releaseOcclusionQueryObjectNames(); } + for (LLSpatialGroup::element_iter i = getDataBegin(); i != getDataEnd(); ++i) { LLDrawable* drawable = (LLDrawable*)(*i)->getDrawable(); @@ -2270,138 +2271,100 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE) } } -void renderNormals(LLDrawable* drawablep) +void renderNormals(LLDrawable *drawablep) { - LLVertexBuffer::unbind(); - // FIX and improve renderNormals debug - static LLCachedControl showSelectedOnly(*LLUI::getInstance()->mSettingGroups["config"], "OnlyShowSelectedNormals"); - // - LLVOVolume* vol = drawablep->getVOVolume(); - if (vol) - { - // FIX and improve renderNormals debug - if(showSelectedOnly && !drawablep->getVObj()->isSelected()) - { - drawablep->getVObj()->setDebugText(""); - return; - } - // - LLVolume* volume = vol->getVolume(); - gGL.pushMatrix(); - gGL.multMatrix((F32*) vol->getRelativeXform().mMatrix); - - // FIX and improve renderNormals debug - // LLMatrix3 mat_norm {vol->getRelativeXformInvTrans()}; - LLMatrix3 scale_inverse; - auto scale = drawablep->getScale(); - // We need something like an inverse transpose, however - // we do not use the object rotation as it will be applied in the world transform - // but we do need to apply the inverse scale^2(1) as the world transform does a scale too. - // transpose of a scale only matrix is a lot of nothing, so skip it. - scale_inverse.setRows(LLVector3(1.0, 0.0, 0.0) / scale.mV[VX], - LLVector3(0.0, 1.0, 0.0) / scale.mV[VY], - LLVector3(0.0, 0.0, 1.0) / scale.mV[VZ]); - LLMatrix4a inv_scale_mat; - inv_scale_mat.loadu(scale_inverse); - LLMatrix3 mat_norm = scale_inverse * scale_inverse; - LLMatrix4a invtranspose; - invtranspose.loadu(mat_norm); - // + if (!drawablep->isVisible()) + return; - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + LLVertexBuffer::unbind(); - // FIX and improve renderNormals debug - // LLVector4a scale(gSavedSettings.getF32("RenderDebugNormalScale")); - static LLCachedControl hairlen(*LLUI::getInstance()->mSettingGroups["config"], "RenderDebugNormalScale"); + LLVOVolume *vol = drawablep->getVOVolume(); - LLSelectNode* selectionNode = nullptr; - auto face_select = LLSelectMgr::getInstance()->getTEMode(); - if(showSelectedOnly) - { - auto objp = drawablep->getVObj(); - if(!objp) - { - return; - } - objp->setDebugText( - llformat( - "obj scale = <%.3f,%.3f,%.3f>", - scale.mV[VX],scale.mV[VY],scale.mV[VZ])); - if(face_select) - { - LLObjectSelectionHandle sel = LLSelectMgr::getInstance()->getSelection(); - selectionNode = sel.get()->findNode(objp); - } - } - // + if (vol) + { + // FIX and improve renderNormals debug + static LLCachedControl showSelectedOnly(gSavedSettings, "OnlyShowSelectedNormals"); + if(showSelectedOnly && !drawablep->getVObj()->isSelected()) + { + drawablep->getVObj()->setDebugText(""); + return; + } + // - for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) - { - // FIX and improve renderNormals debug - if(face_select && !selectionNode->isTESelected(i)) - { - continue; - } - // - const LLVolumeFace& face = volume->getVolumeFace(i); + LLVolume *volume = vol->getVolume(); - // FIX and improve renderNormals debug - gGL.begin(LLRender::LINES); - gGL.diffuseColor4f(1,1,0,1); // Yellow normals - // - for (S32 j = 0; j < face.mNumVertices; ++j) - { - // FIX and improve renderNormals debug - // gGL.begin(LLRender::LINES); - // LLVector4a n,p; - - // n.setMul(face.mNormals[j], scale); - // p.setAdd(face.mPositions[j], n); - - // gGL.diffuseColor4f(1,1,1,1); - // gGL.vertex3fv(face.mPositions[j].getF32ptr()); - // gGL.vertex3fv(p.getF32ptr()); - // - // if (face.mTangents) - // { - // n.setMul(face.mTangents[j], scale); - // p.setAdd(face.mPositions[j], n); - // gGL.vertex3fv(face.mPositions[j].getF32ptr()); - // gGL.vertex3fv(p.getF32ptr()); - // } - LLVector4a n,ni,p; - n = face.mNormals[j]; - invtranspose.affineTransform(n, ni); - ni.normalize3fast(); - n.setMul(ni, (F32)hairlen); - inv_scale_mat.affineTransform(n, ni); // overcompensate for the fact we draw "through" the model transform - p.setAdd(face.mPositions[j], ni); - gGL.vertex3fv(face.mPositions[j].getF32ptr()); - gGL.vertex3fv(p.getF32ptr()); - } - gGL.flush(); - if (face.mTangents) - { - // gGL.begin(LLRender::LINES); - gGL.diffuseColor4f(0,0,1,1); // blue tangents. - for (S32 j = 0; j < face.mNumVertices; ++j) - { - LLVector4a t,ti,p; - t = face.mTangents[j]; - // invtranspose.affineTransform(t, ti); - t.mul((F32)hairlen); - inv_scale_mat.affineTransform(t, ti); // overcompensate for the fact we draw "through" the model transform - p.setAdd(face.mPositions[j], ti); - gGL.vertex3fv(face.mPositions[j].getF32ptr()); - gGL.vertex3fv(p.getF32ptr()); - } - } - gGL.end(); - // - } + // Drawable's normals & tangents are stored in model space, i.e. before any scaling is applied. + // + // SL-13490, using pos + normal to compute the 2nd vertex of a normal line segment doesn't + // work when there's a non-uniform scale in the mix. Normals require MVP-inverse-transpose + // transform. We get that effect here by pre-applying the inverse scale (twice, because + // one forward scale will be re-applied via the MVP in the vertex shader) - gGL.popMatrix(); - } + LLVector3 scale_v3 = vol->getScale(); + float scale_len = scale_v3.length(); + LLVector4a obj_scale(scale_v3.mV[VX], scale_v3.mV[VY], scale_v3.mV[VZ]); + obj_scale.normalize3(); + + // Normals &tangent line segments get scaled along with the object. Divide by scale length + // to keep the as-viewed lengths (relatively) constant with the debug setting length + float draw_length = gSavedSettings.getF32("RenderDebugNormalScale") / scale_len; + + // Create inverse-scale vector for normals + LLVector4a inv_scale(1.0 / scale_v3.mV[VX], 1.0 / scale_v3.mV[VY], 1.0 / scale_v3.mV[VZ]); + inv_scale.mul(inv_scale); // Squared, to apply inverse scale twice + inv_scale.normalize3fast(); + + gGL.pushMatrix(); + gGL.multMatrix((F32 *) vol->getRelativeXform().mMatrix); + + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + + for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) + { + const LLVolumeFace &face = volume->getVolumeFace(i); + + gGL.flush(); + gGL.diffuseColor4f(1, 1, 0, 1); + gGL.begin(LLRender::LINES); + for (S32 j = 0; j < face.mNumVertices; ++j) + { + LLVector4a n, p; + + n.setMul(face.mNormals[j], 1.0); + n.mul(inv_scale); // Pre-scale normal, so it's left with an inverse-transpose xform after MVP + n.normalize3fast(); + n.mul(draw_length); + p.setAdd(face.mPositions[j], n); + + gGL.vertex3fv(face.mPositions[j].getF32ptr()); + gGL.vertex3fv(p.getF32ptr()); + } + gGL.end(); + + // Tangents are simple vectors and do not require reorientation via pre-scaling + if (face.mTangents) + { + gGL.flush(); + gGL.diffuseColor4f(0, 1, 1, 1); + gGL.begin(LLRender::LINES); + for (S32 j = 0; j < face.mNumVertices; ++j) + { + LLVector4a t, p; + + t.setMul(face.mTangents[j], 1.0f); + t.normalize3fast(); + t.mul(draw_length); + p.setAdd(face.mPositions[j], t); + + gGL.vertex3fv(face.mPositions[j].getF32ptr()); + gGL.vertex3fv(p.getF32ptr()); + } + gGL.end(); + } + } + + gGL.popMatrix(); + } } S32 get_physics_detail(const LLVolumeParams& volume_params, const LLVector3& scale)