summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl61
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pbrterrainV.glsl77
-rw-r--r--indra/newview/lldrawpoolterrain.cpp152
-rw-r--r--indra/newview/lldrawpoolterrain.h2
-rw-r--r--indra/newview/llviewershadermgr.cpp53
-rw-r--r--indra/newview/llviewershadermgr.h2
-rw-r--r--indra/newview/llvlcomposition.cpp11
-rw-r--r--indra/newview/llvlcomposition.h1
8 files changed, 303 insertions, 56 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl
new file mode 100644
index 0000000000..96903aeba8
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainF.glsl
@@ -0,0 +1,61 @@
+/**
+ * @file class1\deferred\terrainF.glsl
+ *
+ * $LicenseInfo:firstyear=2023&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2023, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+out vec4 frag_data[4];
+
+uniform sampler2D detail_0;
+uniform sampler2D detail_1;
+uniform sampler2D detail_2;
+uniform sampler2D detail_3;
+uniform sampler2D alpha_ramp;
+
+in vec3 pos;
+in vec3 vary_normal;
+in vec4 vary_texcoord0;
+in vec4 vary_texcoord1;
+
+vec2 encode_normal(vec3 n);
+
+void main()
+{
+ vec4 color0 = texture2D(detail_0, vary_texcoord0.xy);
+ vec4 color1 = texture2D(detail_1, vary_texcoord0.xy);
+ vec4 color2 = texture2D(detail_2, vary_texcoord0.xy);
+ vec4 color3 = texture2D(detail_3, vary_texcoord0.xy);
+
+ float alpha1 = texture2D(alpha_ramp, vary_texcoord0.zw).a;
+ float alpha2 = texture2D(alpha_ramp,vary_texcoord1.xy).a;
+ float alphaFinal = texture2D(alpha_ramp, vary_texcoord1.zw).a;
+ vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal );
+
+ outColor.a = 0.0; // yes, downstream atmospherics
+
+ frag_data[0] = outColor;
+ frag_data[1] = vec4(0.0,0.0,0.0,-1.0);
+ vec3 nvn = normalize(vary_normal);
+ frag_data[2] = vec4(encode_normal(nvn.xyz), 0.0, GBUFFER_FLAG_HAS_ATMOS);
+ frag_data[3] = vec4(0);
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrterrainV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainV.glsl
new file mode 100644
index 0000000000..e8747a1f6b
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/deferred/pbrterrainV.glsl
@@ -0,0 +1,77 @@
+/**
+ * @file class1\environment\pbrterrainV.glsl
+ *
+ * $LicenseInfo:firstyear=2023&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2023, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+uniform mat3 normal_matrix;
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_projection_matrix;
+
+in vec3 position;
+in vec3 normal;
+in vec4 diffuse_color;
+in vec2 texcoord0;
+in vec2 texcoord1;
+
+out vec3 pos;
+out vec3 vary_normal;
+out vec4 vary_texcoord0;
+out vec4 vary_texcoord1;
+
+uniform vec4 object_plane_s;
+uniform vec4 object_plane_t;
+
+vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)
+{
+ vec4 tcoord;
+
+ tcoord.x = dot(vpos, tp0);
+ tcoord.y = dot(vpos, tp1);
+ tcoord.z = tc.z;
+ tcoord.w = tc.w;
+
+ tcoord = mat * tcoord;
+
+ return tcoord;
+}
+
+void main()
+{
+ //transform vertex
+ vec4 pre_pos = vec4(position.xyz, 1.0);
+ vec4 t_pos = modelview_projection_matrix * pre_pos;
+
+ gl_Position = t_pos;
+ pos = t_pos.xyz;
+
+ vary_normal = normalize(normal_matrix * normal);
+
+ // Transform and pass tex coords
+ vary_texcoord0.xy = texgen_object(vec4(position, 1.0), vec4(texcoord0,0,1), texture_matrix0, object_plane_s, object_plane_t).xy;
+
+ vec4 t = vec4(texcoord1,0,1);
+
+ vary_texcoord0.zw = t.xy;
+ vary_texcoord1.xy = t.xy-vec2(2.0, 0.0);
+ vary_texcoord1.zw = t.xy-vec2(1.0, 0.0);
+}
diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp
index 9f0f9fd1b2..16d982ea90 100644
--- a/indra/newview/lldrawpoolterrain.cpp
+++ b/indra/newview/lldrawpoolterrain.cpp
@@ -158,10 +158,6 @@ void LLDrawPoolTerrain::beginDeferredPass(S32 pass)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN);
LLFacePool::beginRenderPass(pass);
-
- sShader = &gDeferredTerrainProgram;
-
- sShader->bind();
}
void LLDrawPoolTerrain::endDeferredPass(S32 pass)
@@ -256,31 +252,139 @@ void LLDrawPoolTerrain::renderFullShader()
// Hack! Get the region that this draw pool is rendering from!
LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
LLVLComposition *compp = regionp->getComposition();
-
- LLViewerTexture *detail_texture0p;
- LLViewerTexture *detail_texture1p;
- LLViewerTexture *detail_texture2p;
- LLViewerTexture *detail_texture3p;
- BOOL use_textures = compp->texturesReady() || !compp->materialsReady();
+ const BOOL use_textures = compp->useTextures();
+
if (use_textures)
{
- detail_texture0p = compp->mDetailTextures[0];
- detail_texture1p = compp->mDetailTextures[1];
- detail_texture2p = compp->mDetailTextures[2];
- detail_texture3p = compp->mDetailTextures[3];
+ // Use textures
+ sShader = &gDeferredTerrainProgram;
+ sShader->bind();
+ renderFullShaderTextures();
}
- else // use materials
+ else
{
- detail_texture0p = compp->mDetailMaterials[0]->mBaseColorTexture;
- detail_texture1p = compp->mDetailMaterials[1]->mBaseColorTexture;
- detail_texture2p = compp->mDetailMaterials[2]->mBaseColorTexture;
- detail_texture3p = compp->mDetailMaterials[3]->mBaseColorTexture;
- LLViewerTexture* blank = LLViewerFetchedTexture::sWhiteImagep;
- if (!detail_texture0p) { detail_texture0p = blank; }
- if (!detail_texture1p) { detail_texture1p = blank; }
- if (!detail_texture2p) { detail_texture2p = blank; }
- if (!detail_texture3p) { detail_texture3p = blank; }
+ // Use materials
+ sShader = &gDeferredPBRTerrainProgram;
+ sShader->bind();
+ renderFullShaderPBR();
}
+}
+
+void LLDrawPoolTerrain::renderFullShaderTextures()
+{
+ // Hack! Get the region that this draw pool is rendering from!
+ LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
+ LLVLComposition *compp = regionp->getComposition();
+
+ LLViewerTexture *detail_texture0p = compp->mDetailTextures[0];
+ LLViewerTexture *detail_texture1p = compp->mDetailTextures[1];
+ LLViewerTexture *detail_texture2p = compp->mDetailTextures[2];
+ LLViewerTexture *detail_texture3p = compp->mDetailTextures[3];
+
+ LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal();
+ F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale;
+ F32 offset_y = (F32)fmod(region_origin_global.mdV[VY], 1.0/(F64)sDetailScale)*sDetailScale;
+
+ LLVector4 tp0, tp1;
+
+ tp0.setVec(sDetailScale, 0.0f, 0.0f, offset_x);
+ tp1.setVec(0.0f, sDetailScale, 0.0f, offset_y);
+
+ //
+ // detail texture 0
+ //
+ S32 detail0 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL0);
+ gGL.getTexUnit(detail0)->bind(detail_texture0p);
+ gGL.getTexUnit(detail0)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
+ gGL.getTexUnit(detail0)->activate();
+
+ LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
+ llassert(shader);
+
+ shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0.mV);
+ shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1.mV);
+
+ LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater();
+
+ //
+ // detail texture 1
+ //
+ S32 detail1 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL1);
+ gGL.getTexUnit(detail1)->bind(detail_texture1p);
+ gGL.getTexUnit(detail1)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
+ gGL.getTexUnit(detail1)->activate();
+
+ // detail texture 2
+ //
+ S32 detail2 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL2);
+ gGL.getTexUnit(detail2)->bind(detail_texture2p);
+ gGL.getTexUnit(detail2)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
+ gGL.getTexUnit(detail2)->activate();
+
+
+ // detail texture 3
+ //
+ S32 detail3 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL3);
+ gGL.getTexUnit(detail3)->bind(detail_texture3p);
+ gGL.getTexUnit(detail3)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
+ gGL.getTexUnit(detail3)->activate();
+
+ //
+ // Alpha Ramp
+ //
+ S32 alpha_ramp = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_ALPHARAMP);
+ gGL.getTexUnit(alpha_ramp)->bind(m2DAlphaRampImagep);
+ gGL.getTexUnit(alpha_ramp)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
+
+ // GL_BLEND disabled by default
+ drawLoop();
+
+ // Disable multitexture
+ sShader->disableTexture(LLViewerShaderMgr::TERRAIN_ALPHARAMP);
+ sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL0);
+ sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL1);
+ sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL2);
+ sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL3);
+
+ gGL.getTexUnit(alpha_ramp)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(alpha_ramp)->disable();
+ gGL.getTexUnit(alpha_ramp)->activate();
+
+ gGL.getTexUnit(detail3)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(detail3)->disable();
+ gGL.getTexUnit(detail3)->activate();
+
+ gGL.getTexUnit(detail2)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(detail2)->disable();
+ gGL.getTexUnit(detail2)->activate();
+
+ gGL.getTexUnit(detail1)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(detail1)->disable();
+ gGL.getTexUnit(detail1)->activate();
+
+ //----------------------------------------------------------------------------
+ // Restore Texture Unit 0 defaults
+
+ gGL.getTexUnit(detail0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(detail0)->enable(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(detail0)->activate();
+}
+
+void LLDrawPoolTerrain::renderFullShaderPBR()
+{
+ // Hack! Get the region that this draw pool is rendering from!
+ LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
+ LLVLComposition *compp = regionp->getComposition();
+
+ LLViewerTexture *detail_texture0p = compp->mDetailMaterials[0]->mBaseColorTexture;
+ LLViewerTexture *detail_texture1p = compp->mDetailMaterials[1]->mBaseColorTexture;
+ LLViewerTexture *detail_texture2p = compp->mDetailMaterials[2]->mBaseColorTexture;
+ LLViewerTexture *detail_texture3p = compp->mDetailMaterials[3]->mBaseColorTexture;
+ LLViewerTexture* blank = LLViewerFetchedTexture::sWhiteImagep;
+ if (!detail_texture0p) { detail_texture0p = blank; }
+ if (!detail_texture1p) { detail_texture1p = blank; }
+ if (!detail_texture2p) { detail_texture2p = blank; }
+ if (!detail_texture3p) { detail_texture3p = blank; }
LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal();
F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale;
diff --git a/indra/newview/lldrawpoolterrain.h b/indra/newview/lldrawpoolterrain.h
index 03bef31541..fbf6a8d917 100644
--- a/indra/newview/lldrawpoolterrain.h
+++ b/indra/newview/lldrawpoolterrain.h
@@ -79,6 +79,8 @@ protected:
void renderFull2TU();
void renderFull4TU();
void renderFullShader();
+ void renderFullShaderTextures();
+ void renderFullShaderPBR();
void drawLoop();
private:
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 4559d71d6d..19b3c59cae 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -138,7 +138,6 @@ LLGLSLShader gDeferredSkinnedDiffuseProgram;
LLGLSLShader gDeferredSkinnedBumpProgram;
LLGLSLShader gDeferredBumpProgram;
LLGLSLShader gDeferredTerrainProgram;
-LLGLSLShader gDeferredTerrainWaterProgram;
LLGLSLShader gDeferredTreeProgram;
LLGLSLShader gDeferredTreeShadowProgram;
LLGLSLShader gDeferredSkinnedTreeShadowProgram;
@@ -226,6 +225,7 @@ LLGLSLShader gDeferredPBRAlphaProgram;
LLGLSLShader gDeferredSkinnedPBRAlphaProgram;
LLGLSLShader gDeferredPBRAlphaWaterProgram;
LLGLSLShader gDeferredSkinnedPBRAlphaWaterProgram;
+LLGLSLShader gDeferredPBRTerrainProgram;
//helper for making a rigged variant of a given shader
bool make_rigged_variant(LLGLSLShader& shader, LLGLSLShader& riggedShader)
@@ -291,7 +291,6 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
mShaderList.push_back(&gDeferredEmissiveProgram);
mShaderList.push_back(&gDeferredSkinnedEmissiveProgram);
mShaderList.push_back(&gDeferredAvatarEyesProgram);
- mShaderList.push_back(&gDeferredTerrainWaterProgram);
mShaderList.push_back(&gDeferredAvatarAlphaProgram);
mShaderList.push_back(&gDeferredWLSkyProgram);
mShaderList.push_back(&gDeferredWLCloudProgram);
@@ -939,7 +938,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSkinnedBumpProgram.unload();
gDeferredImpostorProgram.unload();
gDeferredTerrainProgram.unload();
- gDeferredTerrainWaterProgram.unload();
gDeferredLightProgram.unload();
for (U32 i = 0; i < LL_DEFERRED_MULTI_LIGHT_COUNT; ++i)
{
@@ -1026,6 +1024,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSkinnedPBRAlphaProgram.unload();
gDeferredPBRAlphaWaterProgram.unload();
gDeferredSkinnedPBRAlphaWaterProgram.unload();
+ gDeferredPBRTerrainProgram.unload();
return TRUE;
}
@@ -1492,6 +1491,27 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
success = shader->createShader(NULL, NULL);
llassert(success);
}
+
+ if (success)
+ {
+ gDeferredPBRTerrainProgram.mName = "Deferred PBR Terrain Shader";
+ gDeferredPBRTerrainProgram.mFeatures.encodesNormal = true;
+ gDeferredPBRTerrainProgram.mFeatures.hasSrgb = true;
+ gDeferredPBRTerrainProgram.mFeatures.isAlphaLighting = true;
+ gDeferredPBRTerrainProgram.mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels
+ gDeferredPBRTerrainProgram.mFeatures.hasWaterFog = true;
+ gDeferredPBRTerrainProgram.mFeatures.calculatesAtmospherics = true;
+ gDeferredPBRTerrainProgram.mFeatures.hasAtmospherics = true;
+ gDeferredPBRTerrainProgram.mFeatures.hasGamma = true;
+ gDeferredPBRTerrainProgram.mFeatures.hasTransport = true;
+
+ gDeferredPBRTerrainProgram.mShaderFiles.clear();
+ gDeferredPBRTerrainProgram.mShaderFiles.push_back(make_pair("deferred/pbrterrainV.glsl", GL_VERTEX_SHADER));
+ gDeferredPBRTerrainProgram.mShaderFiles.push_back(make_pair("deferred/pbrterrainF.glsl", GL_FRAGMENT_SHADER));
+ gDeferredPBRTerrainProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+ success = gDeferredPBRTerrainProgram.createShader(NULL, NULL);
+ llassert(success);
+ }
if (success)
{
@@ -2430,8 +2450,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredTerrainProgram.mName = "Deferred Terrain Shader";
gDeferredTerrainProgram.mFeatures.encodesNormal = true;
gDeferredTerrainProgram.mFeatures.hasSrgb = true;
- gDeferredTerrainProgram.mFeatures.calculatesLighting = false;
- gDeferredTerrainProgram.mFeatures.hasLighting = false;
gDeferredTerrainProgram.mFeatures.isAlphaLighting = true;
gDeferredTerrainProgram.mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels
gDeferredTerrainProgram.mFeatures.hasWaterFog = true;
@@ -2449,31 +2467,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
if (success)
{
- gDeferredTerrainWaterProgram.mName = "Deferred Terrain Underwater Shader";
- gDeferredTerrainWaterProgram.mFeatures.encodesNormal = true;
- gDeferredTerrainWaterProgram.mFeatures.hasSrgb = true;
- gDeferredTerrainWaterProgram.mFeatures.calculatesLighting = false;
- gDeferredTerrainWaterProgram.mFeatures.hasLighting = false;
- gDeferredTerrainWaterProgram.mFeatures.isAlphaLighting = true;
- gDeferredTerrainWaterProgram.mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels
- gDeferredTerrainWaterProgram.mFeatures.hasWaterFog = true;
- gDeferredTerrainWaterProgram.mFeatures.calculatesAtmospherics = true;
- gDeferredTerrainWaterProgram.mFeatures.hasAtmospherics = true;
- gDeferredTerrainWaterProgram.mFeatures.hasGamma = true;
-
- gDeferredTerrainWaterProgram.mShaderFiles.clear();
- gDeferredTerrainWaterProgram.mShaderFiles.push_back(make_pair("deferred/terrainV.glsl", GL_VERTEX_SHADER));
- gDeferredTerrainWaterProgram.mShaderFiles.push_back(make_pair("deferred/terrainF.glsl", GL_FRAGMENT_SHADER));
- gDeferredTerrainWaterProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
- gDeferredTerrainWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
- gDeferredTerrainWaterProgram.clearPermutations();
- gDeferredTerrainWaterProgram.addPermutation("WATER_FOG", "1");
- success = gDeferredTerrainWaterProgram.createShader(NULL, NULL);
- llassert(success);
- }
-
- if (success)
- {
gDeferredAvatarProgram.mName = "Deferred Avatar Shader";
gDeferredAvatarProgram.mFeatures.hasSkinning = true;
gDeferredAvatarProgram.mFeatures.encodesNormal = true;
diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h
index b0b9719d76..6765703ab8 100644
--- a/indra/newview/llviewershadermgr.h
+++ b/indra/newview/llviewershadermgr.h
@@ -211,7 +211,6 @@ extern LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram;
extern LLGLSLShader gDeferredNonIndexedDiffuseProgram;
extern LLGLSLShader gDeferredBumpProgram;
extern LLGLSLShader gDeferredTerrainProgram;
-extern LLGLSLShader gDeferredTerrainWaterProgram;
extern LLGLSLShader gDeferredTreeProgram;
extern LLGLSLShader gDeferredTreeShadowProgram;
extern LLGLSLShader gDeferredLightProgram;
@@ -279,4 +278,5 @@ extern LLGLSLShader gDeferredPBROpaqueProgram;
extern LLGLSLShader gDeferredPBRAlphaProgram;
extern LLGLSLShader gDeferredPBRAlphaWaterProgram;
extern LLGLSLShader gHUDPBRAlphaProgram;
+extern LLGLSLShader gDeferredPBRTerrainProgram;
#endif
diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp
index 9ad1a3dd17..5d711f4e5d 100644
--- a/indra/newview/llvlcomposition.cpp
+++ b/indra/newview/llvlcomposition.cpp
@@ -228,6 +228,8 @@ static const U32 BASE_SIZE = 128;
// static
BOOL LLVLComposition::textureReady(LLPointer<LLViewerFetchedTexture>& tex, BOOL boost)
{
+ llassert(tex.notNull());
+
if (tex->getDiscardLevel() < 0)
{
if (boost)
@@ -306,6 +308,13 @@ BOOL LLVLComposition::materialReady(LLPointer<LLFetchedGLTFMaterial>& mat, bool&
return TRUE;
}
+BOOL LLVLComposition::useTextures()
+{
+ LL_PROFILE_ZONE_SCOPED;
+
+ return texturesReady() || !materialsReady();
+}
+
BOOL LLVLComposition::texturesReady(BOOL boost)
{
for (S32 i = 0; i < ASSET_COUNT; i++)
@@ -371,7 +380,7 @@ BOOL LLVLComposition::generateTexture(const F32 x, const F32 y,
U8* st_data[ASSET_COUNT];
S32 st_data_size[ASSET_COUNT]; // for debugging
- const bool use_textures = texturesReady();
+ const bool use_textures = useTextures();
for (S32 i = 0; i < ASSET_COUNT; i++)
{
diff --git a/indra/newview/llvlcomposition.h b/indra/newview/llvlcomposition.h
index af0cf9323c..504441d0f2 100644
--- a/indra/newview/llvlcomposition.h
+++ b/indra/newview/llvlcomposition.h
@@ -77,6 +77,7 @@ public:
friend class LLDrawPoolTerrain;
void setParamsReady() { mParamsReady = TRUE; }
BOOL getParamsReady() const { return mParamsReady; }
+ BOOL useTextures();
BOOL texturesReady(BOOL boost = FALSE);
BOOL materialsReady(BOOL boost = FALSE);