From bc7856098f70371dd392c74689df267cce819aa7 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 2 Mar 2023 16:36:03 -0600 Subject: SL-19281 Unify handling of haze and gamma between fullbright and not and move haze back to sRGB color space to stay consistent with sky colors. Also fix broken "roughness" stuck at 0.2. --- indra/newview/pipeline.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index b5b5d9ef7f..fffccc72ea 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -8119,6 +8119,8 @@ void LLPipeline::renderDeferredLighting() soften_shader.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0); soften_shader.uniform3fv(LLShaderMgr::LIGHTNORM, 1, environment.getClampedLightNorm().mV); + soften_shader.uniform4fv(LLShaderMgr::WATER_WATERPLANE, 1, LLDrawPoolAlpha::sWaterPlane.mV); + { LLGLDepthTest depth(GL_FALSE); LLGLDisable blend(GL_BLEND); -- cgit v1.2.3 From b9b913a60ada97fc61bf2176e443dc72c8359ccb Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 7 Mar 2023 09:38:43 -0600 Subject: SL-19349 Fix for hang on bulk upload of materials, add bulk upload option to material selector, incidental decruft. --- indra/newview/pipeline.cpp | 50 ---------------------------------------------- 1 file changed, 50 deletions(-) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index fffccc72ea..deafa6900e 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -335,18 +335,6 @@ static LLCullResult* sCull = NULL; void validate_framebuffer_object(); -// override the projection_matrix uniform on the given shader to that which would be set by the main camera -void set_camera_projection_matrix(LLGLSLShader& shader) -{ - auto camProj = LLViewerCamera::getInstance()->getProjection(); - glh::matrix4f projection = get_current_projection(); - projection.set_row(0, glh::vec4f(camProj.mMatrix[0][0], camProj.mMatrix[0][1], camProj.mMatrix[0][2], camProj.mMatrix[0][3])); - projection.set_row(0, glh::vec4f(camProj.mMatrix[1][0], camProj.mMatrix[1][1], camProj.mMatrix[1][2], camProj.mMatrix[1][3])); - projection.set_row(0, glh::vec4f(camProj.mMatrix[2][0], camProj.mMatrix[2][1], camProj.mMatrix[2][2], camProj.mMatrix[2][3])); - projection.set_row(0, glh::vec4f(camProj.mMatrix[3][0], camProj.mMatrix[3][1], camProj.mMatrix[3][2], camProj.mMatrix[3][3])); - shader.uniformMatrix4fv(LLShaderMgr::PROJECTION_MATRIX, 1, FALSE, projection.m); -} - // Add color attachments for deferred rendering // target -- RenderTarget to add attachments to bool addDeferredAttachments(LLRenderTarget& target, bool for_impostor = false) @@ -4716,9 +4704,6 @@ void LLPipeline::renderDebug() bindDeferredShader(gReflectionProbeDisplayProgram, NULL); mScreenTriangleVB->setBuffer(); - // Provide our projection matrix. - set_camera_projection_matrix(gReflectionProbeDisplayProgram); - LLGLEnable blend(GL_BLEND); LLGLDepthTest depth(GL_FALSE); @@ -7410,40 +7395,6 @@ void LLPipeline::renderFinalize() if (RenderScreenSpaceReflections && !gCubeSnapshot) { -#if 0 - LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("renderDeferredLighting - screen space reflections"); - LL_PROFILE_GPU_ZONE("screen space reflections"); - - bindDeferredShader(gPostScreenSpaceReflectionProgram, NULL); - mScreenTriangleVB->setBuffer(); - - set_camera_projection_matrix(gPostScreenSpaceReflectionProgram); - - // We need linear depth. - static LLStaticHashedString zfar("zFar"); - static LLStaticHashedString znear("zNear"); - float nearClip = LLViewerCamera::getInstance()->getNear(); - float farClip = LLViewerCamera::getInstance()->getFar(); - gPostScreenSpaceReflectionProgram.uniform1f(zfar, farClip); - gPostScreenSpaceReflectionProgram.uniform1f(znear, nearClip); - - S32 channel = gPostScreenSpaceReflectionProgram.enableTexture(LLShaderMgr::DIFFUSE_MAP, screenTarget()->getUsage()); - if (channel > -1) - { - screenTarget()->bindTexture(0, channel, LLTexUnit::TFO_POINT); - } - - { - LLGLDisable blend(GL_BLEND); - LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS); - - stop_glerror(); - mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3); - stop_glerror(); - } - - unbindDeferredShader(gPostScreenSpaceReflectionProgram); -#else LL_PROFILE_GPU_ZONE("ssr copy"); LLGLDepthTest depth(GL_TRUE, GL_TRUE, GL_ALWAYS); @@ -7465,7 +7416,6 @@ void LLPipeline::renderFinalize() mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3); dst.flush(); -#endif } screenTarget()->bindTarget(); -- cgit v1.2.3 From 25ede8638209fac8dde5b71bece4bc1dfa30ea16 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 10 Mar 2023 10:52:35 -0600 Subject: SL-19172 Texture streaming tune up. Incidental decruft. --- indra/newview/pipeline.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index deafa6900e..b053af3f96 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -4319,6 +4319,8 @@ extern std::set visible_selected_groups; void LLPipeline::renderDebug() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; + assertInitialized(); bool hud_only = hasRenderType(LLPipeline::RENDER_TYPE_HUD); -- cgit v1.2.3 From bd4b03de8b73ecb888f8e3111bada7c643f7fcfd Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 10 Mar 2023 13:33:36 -0600 Subject: DRTVWR-559 Fix for assert in LLVertexBuffer, incidental decruft. --- indra/newview/pipeline.cpp | 172 ++++++++++++++++++++------------------------- 1 file changed, 77 insertions(+), 95 deletions(-) (limited to 'indra/newview/pipeline.cpp') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index b053af3f96..ffb314c013 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -308,7 +308,6 @@ bool LLPipeline::sDelayVBUpdate = true; bool LLPipeline::sAutoMaskAlphaDeferred = true; bool LLPipeline::sAutoMaskAlphaNonDeferred = false; bool LLPipeline::sRenderTransparentWater = true; -bool LLPipeline::sRenderBump = true; bool LLPipeline::sBakeSunlight = false; bool LLPipeline::sNoAlpha = false; bool LLPipeline::sUseFarClip = true; @@ -400,7 +399,6 @@ void LLPipeline::init() gOctreeMaxCapacity = gSavedSettings.getU32("OctreeMaxNodeCapacity"); gOctreeMinSize = gSavedSettings.getF32("OctreeMinimumNodeSize"); sDynamicLOD = gSavedSettings.getBOOL("RenderDynamicLOD"); - sRenderBump = TRUE; // DEPRECATED -- gSavedSettings.getBOOL("RenderObjectBump"); sRenderAttachedLights = gSavedSettings.getBOOL("RenderAttachedLights"); sRenderAttachedParticles = gSavedSettings.getBOOL("RenderAttachedParticles"); @@ -968,12 +966,6 @@ void LLPipeline::updateRenderTransparentWater() sRenderTransparentWater = gSavedSettings.getBOOL("RenderTransparentWater"); } -//static -void LLPipeline::updateRenderBump() -{ - sRenderBump = TRUE; // DEPRECATED -- gSavedSettings.getBOOL("RenderObjectBump"); -} - // static void LLPipeline::refreshCachedSettings() { @@ -1183,46 +1175,44 @@ void LLPipeline::createGLBuffers() mRT->width = 0; mRT->height = 0; - if (sRenderDeferred) - { - if (!mNoiseMap) - { - const U32 noiseRes = 128; - LLVector3 noise[noiseRes*noiseRes]; + + if (!mNoiseMap) + { + const U32 noiseRes = 128; + LLVector3 noise[noiseRes*noiseRes]; - F32 scaler = gSavedSettings.getF32("RenderDeferredNoise")/100.f; - for (U32 i = 0; i < noiseRes*noiseRes; ++i) - { - noise[i] = LLVector3(ll_frand()-0.5f, ll_frand()-0.5f, 0.f); - noise[i].normVec(); - noise[i].mV[2] = ll_frand()*scaler+1.f-scaler/2.f; - } + F32 scaler = gSavedSettings.getF32("RenderDeferredNoise")/100.f; + for (U32 i = 0; i < noiseRes*noiseRes; ++i) + { + noise[i] = LLVector3(ll_frand()-0.5f, ll_frand()-0.5f, 0.f); + noise[i].normVec(); + noise[i].mV[2] = ll_frand()*scaler+1.f-scaler/2.f; + } - LLImageGL::generateTextures(1, &mNoiseMap); + LLImageGL::generateTextures(1, &mNoiseMap); - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseMap); - LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB16F, noiseRes, noiseRes, GL_RGB, GL_FLOAT, noise, false); - gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); - } + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseMap); + LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB16F, noiseRes, noiseRes, GL_RGB, GL_FLOAT, noise, false); + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); + } - if (!mTrueNoiseMap) + if (!mTrueNoiseMap) + { + const U32 noiseRes = 128; + F32 noise[noiseRes*noiseRes*3]; + for (U32 i = 0; i < noiseRes*noiseRes*3; i++) { - const U32 noiseRes = 128; - F32 noise[noiseRes*noiseRes*3]; - for (U32 i = 0; i < noiseRes*noiseRes*3; i++) - { - noise[i] = ll_frand()*2.0-1.0; - } - - LLImageGL::generateTextures(1, &mTrueNoiseMap); - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mTrueNoiseMap); - LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB16F, noiseRes, noiseRes, GL_RGB,GL_FLOAT, noise, false); - gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); + noise[i] = ll_frand()*2.0-1.0; } - createLUTBuffers(); + LLImageGL::generateTextures(1, &mTrueNoiseMap); + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mTrueNoiseMap); + LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB16F, noiseRes, noiseRes, GL_RGB,GL_FLOAT, noise, false); + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT); } + createLUTBuffers(); + gBumpImageList.restoreGL(); } @@ -1233,70 +1223,67 @@ F32 lerpf(F32 a, F32 b, F32 w) void LLPipeline::createLUTBuffers() { - if (sRenderDeferred) + if (!mLightFunc) { - if (!mLightFunc) + U32 lightResX = gSavedSettings.getU32("RenderSpecularResX"); + U32 lightResY = gSavedSettings.getU32("RenderSpecularResY"); + F32* ls = new F32[lightResX*lightResY]; + F32 specExp = gSavedSettings.getF32("RenderSpecularExponent"); + // Calculate the (normalized) blinn-phong specular lookup texture. (with a few tweaks) + for (U32 y = 0; y < lightResY; ++y) { - U32 lightResX = gSavedSettings.getU32("RenderSpecularResX"); - U32 lightResY = gSavedSettings.getU32("RenderSpecularResY"); - F32* ls = new F32[lightResX*lightResY]; - F32 specExp = gSavedSettings.getF32("RenderSpecularExponent"); - // Calculate the (normalized) blinn-phong specular lookup texture. (with a few tweaks) - for (U32 y = 0; y < lightResY; ++y) + for (U32 x = 0; x < lightResX; ++x) { - for (U32 x = 0; x < lightResX; ++x) - { - ls[y*lightResX+x] = 0; - F32 sa = (F32) x/(lightResX-1); - F32 spec = (F32) y/(lightResY-1); - F32 n = spec * spec * specExp; + ls[y*lightResX+x] = 0; + F32 sa = (F32) x/(lightResX-1); + F32 spec = (F32) y/(lightResY-1); + F32 n = spec * spec * specExp; - // Nothing special here. Just your typical blinn-phong term. - spec = powf(sa, n); + // Nothing special here. Just your typical blinn-phong term. + spec = powf(sa, n); - // Apply our normalization function. - // Note: This is the full equation that applies the full normalization curve, not an approximation. - // This is fine, given we only need to create our LUT once per buffer initialization. - spec *= (((n + 2) * (n + 4)) / (8 * F_PI * (powf(2, -n/2) + n))); - - // Since we use R16F, we no longer have a dynamic range issue we need to work around here. - // Though some older drivers may not like this, newer drivers shouldn't have this problem. - ls[y*lightResX+x] = spec; - } + // Apply our normalization function. + // Note: This is the full equation that applies the full normalization curve, not an approximation. + // This is fine, given we only need to create our LUT once per buffer initialization. + spec *= (((n + 2) * (n + 4)) / (8 * F_PI * (powf(2, -n/2) + n))); + + // Since we use R16F, we no longer have a dynamic range issue we need to work around here. + // Though some older drivers may not like this, newer drivers shouldn't have this problem. + ls[y*lightResX+x] = spec; } + } - U32 pix_format = GL_R16F; + U32 pix_format = GL_R16F; #if LL_DARWIN - // Need to work around limited precision with 10.6.8 and older drivers - // - pix_format = GL_R32F; + // Need to work around limited precision with 10.6.8 and older drivers + // + pix_format = GL_R32F; #endif - LLImageGL::generateTextures(1, &mLightFunc); - gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mLightFunc); - LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, pix_format, lightResX, lightResY, GL_RED, GL_FLOAT, ls, false); - gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); - gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_TRILINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + LLImageGL::generateTextures(1, &mLightFunc); + gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mLightFunc); + LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, pix_format, lightResX, lightResY, GL_RED, GL_FLOAT, ls, false); + gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP); + gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_TRILINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - delete [] ls; - } + delete [] ls; + } - mPbrBrdfLut.allocate(512, 512, GL_RG16F); - mPbrBrdfLut.bindTarget(); - gDeferredGenBrdfLutProgram.bind(); + mPbrBrdfLut.allocate(512, 512, GL_RG16F); + mPbrBrdfLut.bindTarget(); + gDeferredGenBrdfLutProgram.bind(); - gGL.begin(LLRender::TRIANGLE_STRIP); - gGL.vertex2f(-1, -1); - gGL.vertex2f(-1, 1); - gGL.vertex2f(1, -1); - gGL.vertex2f(1, 1); - gGL.end(); - gGL.flush(); + gGL.begin(LLRender::TRIANGLE_STRIP); + gGL.vertex2f(-1, -1); + gGL.vertex2f(-1, 1); + gGL.vertex2f(1, -1); + gGL.vertex2f(1, 1); + gGL.end(); + gGL.flush(); - gDeferredGenBrdfLutProgram.unbind(); - mPbrBrdfLut.flush(); - } + gDeferredGenBrdfLutProgram.unbind(); + mPbrBrdfLut.flush(); } @@ -1331,11 +1318,6 @@ bool LLPipeline::canUseWindLightShaders() const return true; } -bool LLPipeline::canUseWindLightShadersOnObjects() const -{ - return true; -} - bool LLPipeline::canUseAntiAliasing() const { return true; -- cgit v1.2.3