summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llrender/llcubemaparray.cpp4
-rw-r--r--indra/llrender/llglcommonfunc.cpp5
-rw-r--r--indra/llrender/llrendertarget.cpp6
-rw-r--r--indra/llwindow/llwindowwin32.cpp4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/irradianceGenF.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class1/interface/reflectionmipF.glsl26
-rw-r--r--indra/newview/app_settings/shaders/class2/environment/waterF.glsl17
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl66
-rw-r--r--indra/newview/lldrawpool.cpp2
-rw-r--r--indra/newview/lldrawpoolalpha.cpp6
-rw-r--r--indra/newview/lldrawpoolbump.cpp4
-rw-r--r--indra/newview/lldrawpoolmaterials.cpp2
-rw-r--r--indra/newview/lldrawpoolwater.cpp2
-rw-r--r--indra/newview/llface.cpp2
-rw-r--r--indra/newview/llhudeffectlookat.cpp2
-rw-r--r--indra/newview/llhudeffectpointat.cpp2
-rw-r--r--indra/newview/llhudicon.cpp2
-rw-r--r--indra/newview/llhudnametag.cpp2
-rw-r--r--indra/newview/llhudtext.cpp2
-rw-r--r--indra/newview/llmaniprotate.cpp2
-rw-r--r--indra/newview/llmanipscale.cpp2
-rw-r--r--indra/newview/llmaniptranslate.cpp22
-rw-r--r--indra/newview/llreflectionmapmanager.cpp37
-rw-r--r--indra/newview/llviewerdisplay.cpp12
-rw-r--r--indra/newview/llviewershadermgr.cpp1
-rw-r--r--indra/newview/llviewerwindow.cpp12
-rw-r--r--indra/newview/llvoicevisualizer.cpp2
-rw-r--r--indra/newview/pipeline.cpp90
-rw-r--r--indra/newview/skins/default/xui/en/floater_build_options.xml4
31 files changed, 240 insertions, 131 deletions
diff --git a/indra/llrender/llcubemaparray.cpp b/indra/llrender/llcubemaparray.cpp
index abb93093e0..a21f7d084e 100644
--- a/indra/llrender/llcubemaparray.cpp
+++ b/indra/llrender/llcubemaparray.cpp
@@ -122,7 +122,9 @@ void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count, BOOL us
bind(0);
- glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGB16F, resolution, resolution, count*6, 0,
+ U32 format = components == 4 ? GL_RGBA12 : GL_RGB10;
+
+ glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, format, resolution, resolution, count*6, 0,
GL_RGB, GL_UNSIGNED_BYTE, nullptr);
mImage->setAddressMode(LLTexUnit::TAM_CLAMP);
diff --git a/indra/llrender/llglcommonfunc.cpp b/indra/llrender/llglcommonfunc.cpp
index e9ec28927f..04d29b9430 100644
--- a/indra/llrender/llglcommonfunc.cpp
+++ b/indra/llrender/llglcommonfunc.cpp
@@ -31,7 +31,8 @@ namespace LLGLCommonFunc
{
void selected_stencil_test()
{
- glStencilFunc(GL_ALWAYS, 2, 0xffff);
- glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
+ // deprecated
+ //glStencilFunc(GL_ALWAYS, 2, 0xffff);
+ //glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
}
}
diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp
index 7fcb130ac6..01ccf3d314 100644
--- a/indra/llrender/llrendertarget.cpp
+++ b/indra/llrender/llrendertarget.cpp
@@ -150,6 +150,7 @@ bool LLRenderTarget::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth, boo
if (mDepth)
{
glBindFramebuffer(GL_FRAMEBUFFER, mFBO);
+ llassert(!mStencil); // use of stencil buffer is deprecated (performance penalty)
if (mStencil)
{
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, mDepth);
@@ -370,6 +371,7 @@ void LLRenderTarget::shareDepthBuffer(LLRenderTarget& target)
glBindFramebuffer(GL_FRAMEBUFFER, target.mFBO);
stop_glerror();
+ llassert(!mStencil); // deprecated -- performance penalty
if (mStencil)
{
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, mDepth);
@@ -417,6 +419,7 @@ void LLRenderTarget::release()
if (mUseDepth)
{ //detach shared depth buffer
+ llassert(!mStencil); //deprecated, performance penalty
if (mStencil)
{ //attached as a renderbuffer
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0);
@@ -515,7 +518,8 @@ void LLRenderTarget::clear(U32 mask_in)
U32 mask = GL_COLOR_BUFFER_BIT;
if (mUseDepth)
{
- mask |= GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
+ mask |= GL_DEPTH_BUFFER_BIT; // stencil buffer is deprecated, performance pnealty | GL_STENCIL_BUFFER_BIT;
+
}
if (mFBO)
{
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 553507bc0c..aadf895271 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -1376,8 +1376,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO
attrib_list[cur_attrib++] = WGL_DEPTH_BITS_ARB;
attrib_list[cur_attrib++] = 24;
- attrib_list[cur_attrib++] = WGL_STENCIL_BITS_ARB;
- attrib_list[cur_attrib++] = 8;
+ //attrib_list[cur_attrib++] = WGL_STENCIL_BITS_ARB; //stencil buffer is deprecated (performance penalty)
+ //attrib_list[cur_attrib++] = 8;
attrib_list[cur_attrib++] = WGL_DRAW_TO_WINDOW_ARB;
attrib_list[cur_attrib++] = GL_TRUE;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
index 1c2034de69..2ec859fdae 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
@@ -179,6 +179,13 @@ vec4 getNormalEnvIntensityFlags(vec2 screenpos, out vec3 n, out float envIntensi
return packedNormalEnvIntensityFlags;
}
+// get linear depth value given a depth buffer sample d and znear and zfar values
+float linearDepth(float d, float znear, float zfar)
+{
+ d = d * 2.0 - 1.0;
+ return znear * 2.0 * zfar / (zfar + znear - d * (zfar - znear));
+}
+
float getDepth(vec2 pos_screen)
{
float depth = texture2DRect(depthMap, pos_screen).r;
diff --git a/indra/newview/app_settings/shaders/class1/interface/irradianceGenF.glsl b/indra/newview/app_settings/shaders/class1/interface/irradianceGenF.glsl
index 63e2fce40f..b633813819 100644
--- a/indra/newview/app_settings/shaders/class1/interface/irradianceGenF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/irradianceGenF.glsl
@@ -177,10 +177,10 @@ float computeLod(float pdf)
return lod;
}
-vec3 filterColor(vec3 N)
+vec4 filterColor(vec3 N)
{
//return textureLod(uCubeMap, N, 3.0).rgb;
- vec3 color = vec3(0.f);
+ vec4 color = vec4(0.f);
float weight = 0.0f;
for(int i = 0; i < u_sampleCount; ++i)
@@ -198,7 +198,7 @@ vec3 filterColor(vec3 N)
lod = clamp(lod, 0, 7);
// sample lambertian at a lower resolution to avoid fireflies
- vec3 lambertian = textureLod(reflectionProbes, vec4(H, sourceIdx), lod).rgb;
+ vec4 lambertian = textureLod(reflectionProbes, vec4(H, sourceIdx), lod);
color += lambertian;
}
@@ -212,16 +212,16 @@ vec3 filterColor(vec3 N)
color /= float(u_sampleCount);
}
- return color.rgb ;
+ return color;
}
// entry point
void main()
{
- vec3 color = vec3(0);
+ vec4 color = vec4(0);
color = filterColor(vary_dir);
- frag_color = vec4(color,1.0);
+ frag_color = color;
}
diff --git a/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl b/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl
index bb4a79247d..f4879b52de 100644
--- a/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/radianceGenF.glsl
@@ -26,11 +26,7 @@
/*[EXTRA_CODE_HERE]*/
-#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
-#else
-#define frag_color gl_FragColor
-#endif
uniform samplerCubeArray reflectionProbes;
uniform int sourceIdx;
@@ -122,11 +118,11 @@ float D_GGX(float dotNH, float roughness)
return (alpha2)/(PI * denom*denom);
}
-vec3 prefilterEnvMap(vec3 R)
+vec4 prefilterEnvMap(vec3 R)
{
vec3 N = R;
vec3 V = R;
- vec3 color = vec3(0.0);
+ vec4 color = vec4(0.0);
float totalWeight = 0.0;
float envMapDim = 256.0;
int numSamples = 4;
@@ -157,7 +153,7 @@ vec3 prefilterEnvMap(vec3 R)
// Biased (+1.0) mip level for better result
float mip = roughness == 0.0 ? 0.0 : clamp(0.5 * log2(omegaS / omegaP) + 1.0, 0.0f, 7.f);
//float mip = clamp(0.5 * log2(omegaS / omegaP) + 1.0, 0.0f, 7.f);
- color += textureLod(reflectionProbes, vec4(L,sourceIdx), mip).rgb * dotNL;
+ color += textureLod(reflectionProbes, vec4(L,sourceIdx), mip) * dotNL;
totalWeight += dotNL;
}
@@ -168,6 +164,6 @@ vec3 prefilterEnvMap(vec3 R)
void main()
{
vec3 N = normalize(vary_dir);
- frag_color = vec4(prefilterEnvMap(N), 1.0);
+ frag_color = prefilterEnvMap(N);
}
// =============================================================================================================
diff --git a/indra/newview/app_settings/shaders/class1/interface/reflectionmipF.glsl b/indra/newview/app_settings/shaders/class1/interface/reflectionmipF.glsl
index e8452a9c14..9dd97a80b2 100644
--- a/indra/newview/app_settings/shaders/class1/interface/reflectionmipF.glsl
+++ b/indra/newview/app_settings/shaders/class1/interface/reflectionmipF.glsl
@@ -33,10 +33,20 @@ out vec4 frag_color;
#define frag_color gl_FragColor
#endif
-uniform sampler2DRect screenMap;
+// NOTE screenMap should always be texture channel 0 and
+// depthmap should always be channel 1
+uniform sampler2DRect diffuseRect;
+uniform sampler2DRect depthMap;
+
+uniform float resScale;
+uniform float znear;
+uniform float zfar;
VARYING vec2 vary_texcoord0;
+// get linear depth value given a depth buffer sample d and znear and zfar values
+float linearDepth(float d, float znear, float zfar);
+
void main()
{
#if 0
@@ -74,6 +84,18 @@ void main()
frag_color = vec4(color, 1.0);
#else
- frag_color = vec4(texture2DRect(screenMap, vary_texcoord0.xy).rgb, 1.0);
+ vec2 depth_tc = vary_texcoord0.xy * resScale;
+ float depth = texture(depthMap, depth_tc).r;
+ float dist = linearDepth(depth, znear, zfar);
+
+ // convert linear depth to distance
+ vec3 v;
+ v.xy = depth_tc / 512.0 * 2.0 - 1.0;
+ v.z = 1.0;
+ v = normalize(v);
+ dist /= v.z;
+
+ vec3 col = texture2DRect(diffuseRect, vary_texcoord0.xy).rgb;
+ frag_color = vec4(col, dist/256.0);
#endif
}
diff --git a/indra/newview/app_settings/shaders/class2/environment/waterF.glsl b/indra/newview/app_settings/shaders/class2/environment/waterF.glsl
index 59e7e64fbb..b51583de26 100644
--- a/indra/newview/app_settings/shaders/class2/environment/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class2/environment/waterF.glsl
@@ -163,7 +163,7 @@ void main()
float df1 = df.x + df.y + df.z;
- wavef = normalize(wavef + vary_normal);
+ //wavef = normalize(wavef - vary_normal);
//wavef = vary_normal;
vec3 waver = reflect(viewVec, -wavef)*3;
@@ -194,13 +194,13 @@ void main()
vec3 additive;
vec3 atten;
- calcAtmosphericVarsLinear(pos.xyz, wavef, lightDir, sunlit, amblit, additive, atten);
-
+ calcAtmosphericVarsLinear(pos.xyz, wavef, vary_light_dir, sunlit, amblit, additive, atten);
+ sunlit = vec3(1); // TODO -- figure out why sunlit is breaking at some view angles
vec3 v = -viewVec;
float NdotV = clamp(abs(dot(wavef.xyz, v)), 0.001, 1.0);
float metallic = fresnelOffset * 0.1; // fudge -- use fresnelOffset as metalness
- float roughness = 0.08;
+ float roughness = 0.1;
float gloss = 1.0 - roughness;
vec3 baseColor = vec3(0.25);
@@ -210,8 +210,8 @@ void main()
vec3 specularColor = mix(f0, baseColor.rgb, metallic);
- //vec3 refnorm = normalize(wavef + vary_normal);
- vec3 refnorm = wavef;
+ vec3 refnorm = normalize(wavef + vary_normal);
+ //vec3 refnorm = wavef;
vec3 irradiance = vec3(0);
@@ -221,7 +221,6 @@ void main()
irradiance = fb.rgb;
color.rgb = pbrIbl(diffuseColor, specularColor, radiance, irradiance, gloss, NdotV, 0.0);
-
// fudge -- for punctual lighting, pretend water is metallic
diffuseColor = vec3(0);
@@ -229,7 +228,7 @@ void main()
roughness = 0.1;
float scol = 1.0; // TODO -- incorporate shadow map
- //color.rgb += pbrPunctual(diffuseColor, specularColor, roughness, metallic, wavef, v, vary_light_dir) * sunlit * 2.75 * scol;
+ color.rgb += pbrPunctual(diffuseColor, specularColor, roughness, metallic, wavef, v, vary_light_dir) * sunlit * 2.75 * scol;
color.rgb = atmosFragLightingLinear(color.rgb, additive, atten);
color.rgb = scaleSoftClipFragLinear(color.rgb);
@@ -239,6 +238,8 @@ void main()
//color.rgb = srgb_to_linear(normalize(refPos) * 0.5 + 0.5);
//color.rgb = srgb_to_linear(normalize(pos) * 0.5 + 0.5);
//color.rgb = srgb_to_linear(wavef * 0.5 + 0.5);
+
+ //color.rgb = radiance;
frag_color = color;
#if defined(WATER_EDGE)
diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
index 80f9e29123..ec9218f00e 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
@@ -239,7 +239,7 @@ bool intersect(const Ray &ray) const
return true;
} */
-// adapted -- assume that origin is inside sphere, return distance from origin to edge of sphere
+// adapted -- assume that origin is inside sphere, return intersection of ray with edge of sphere
vec3 sphereIntersect(vec3 origin, vec3 dir, vec3 center, float radius2)
{
float t0, t1; // solutions for t if the ray intersects
@@ -310,17 +310,19 @@ vec3 boxIntersect(vec3 origin, vec3 dir, int i)
// Tap a reflection probe
// pos - position of pixel
// dir - pixel normal
+// vi - return value of intersection point with influence volume
+// wi - return value of approximate world space position of sampled pixel
// lod - which mip to bias towards (lower is higher res, sharper reflections)
// c - center of probe
// r2 - radius of probe squared
// i - index of probe
-// vi - point at which reflection vector struck the influence volume, in clip space
-vec3 tapRefMap(vec3 pos, vec3 dir, float lod, vec3 c, float r2, int i)
+vec3 tapRefMap(vec3 pos, vec3 dir, out vec3 vi, out vec3 wi, float lod, vec3 c, float r2, int i)
{
//lod = max(lod, 1);
// parallax adjustment
vec3 v;
+
if (refIndex[i].w < 0)
{
v = boxIntersect(pos, dir, i);
@@ -330,11 +332,18 @@ vec3 tapRefMap(vec3 pos, vec3 dir, float lod, vec3 c, float r2, int i)
v = sphereIntersect(pos, dir, c, r2);
}
+ vi = v;
+
v -= c;
+ vec3 d = normalize(v);
+
v = env_mat * v;
- {
- return textureLod(reflectionProbes, vec4(v.xyz, refIndex[i].x), lod).rgb;
- }
+
+ vec4 ret = textureLod(reflectionProbes, vec4(v.xyz, refIndex[i].x), lod);
+
+ wi = d * ret.a * 256.0+c;
+
+ return ret.rgb;
}
// Tap an irradiance map
@@ -343,7 +352,6 @@ vec3 tapRefMap(vec3 pos, vec3 dir, float lod, vec3 c, float r2, int i)
// c - center of probe
// r2 - radius of probe squared
// i - index of probe
-// vi - point at which reflection vector struck the influence volume, in clip space
vec3 tapIrradianceMap(vec3 pos, vec3 dir, vec3 c, float r2, int i)
{
//lod = max(lod, 1);
@@ -383,26 +391,48 @@ vec3 sampleProbes(vec3 pos, vec3 dir, float lod, float minweight)
float p = float(abs(refIndex[i].w)); // priority
float rr = r*r; // radius squred
- float r1 = r * 0.1; // 75% of radius (outer sphere to start interpolating down)
+ float r1 = r * 0.1; // 90% of radius (outer sphere to start interpolating down)
vec3 delta = pos.xyz-refSphere[i].xyz;
float d2 = dot(delta,delta);
float r2 = r1*r1;
{
- vec3 refcol = tapRefMap(pos, dir, lod, refSphere[i].xyz, rr, i);
-
- float w = 1.0/d2;
+ vec3 vi, wi;
+
+ vec3 refcol = tapRefMap(pos, dir, vi, wi, lod, refSphere[i].xyz, rr, i);
float atten = 1.0-max(d2-r2, 0.0)/(rr-r2);
+
+ if (refIndex[i].w >= 0)
+ {
+ //adjust lookup by distance result
+ float d = length(vi - wi);
+ vi += dir * d;
+
+ vi -= refSphere[i].xyz;
+
+ vi = env_mat * vi;
+
+ refcol = textureLod(reflectionProbes, vec4(vi, refIndex[i].x), lod).rgb;
+ }
+
+ //float w = 1.0 / max(d3, 1.0);
+ vec3 pi = normalize(wi - pos);
+ float w = max(dot(pi, dir), 0.1);
+ w = pow(w, 32.0);
+
w *= atten;
+
+
//w *= p; // boost weight based on priority
- col += refcol*w;
-
+ col += refcol.rgb*w;
+
wsum += w;
}
}
- if (probeInfluences <= 1)
+#if 1
+ if (probeInfluences < 1)
{ //edge-of-scene probe or no probe influence, mix in with embiggened version of probes closest to camera
for (int idx = 0; idx < 8; ++idx)
{
@@ -415,15 +445,17 @@ vec3 sampleProbes(vec3 pos, vec3 dir, float lod, float minweight)
float d2 = dot(delta,delta);
{
- vec3 refcol = tapRefMap(pos, dir, lod, refSphere[i].xyz, d2, i);
-
+ vec3 vi, wi;
+ vec3 refcol = tapRefMap(pos, dir, vi, wi, lod, refSphere[i].xyz, d2, i);
+
float w = 1.0/d2;
w *= w;
- col += refcol*w;
+ col += refcol.rgb*w;
wsum += w;
}
}
}
+#endif
if (wsum > 0.0)
{
diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp
index 074d223b59..015e520179 100644
--- a/indra/newview/lldrawpool.cpp
+++ b/indra/newview/lldrawpool.cpp
@@ -570,7 +570,7 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL ba
LLGLDisable cull(params.mGLTFMaterial && params.mGLTFMaterial->mDoubleSided ? GL_CULL_FACE : 0);
- LLGLEnableFunc stencil_test(GL_STENCIL_TEST, params.mSelected, &LLGLCommonFunc::selected_stencil_test);
+ //LLGLEnableFunc stencil_test(GL_STENCIL_TEST, params.mSelected, &LLGLCommonFunc::selected_stencil_test);
params.mVertexBuffer->setBufferFast(mask);
params.mVertexBuffer->drawRangeFast(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset);
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index a985807a38..fb2a4d78fc 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -167,10 +167,10 @@ void LLDrawPoolAlpha::renderPostDeferred(S32 pass)
if (!LLPipeline::sImpostorRender && gSavedSettings.getBOOL("RenderDepthOfField") && !gCubeSnapshot)
{
//update depth buffer sampler
- gPipeline.mRT->screen.flush();
+ /*gPipeline.mRT->screen.flush();
gPipeline.mRT->deferredDepth.copyContents(gPipeline.mRT->deferredScreen, 0, 0, gPipeline.mRT->deferredScreen.getWidth(), gPipeline.mRT->deferredScreen.getHeight(),
0, 0, gPipeline.mRT->deferredDepth.getWidth(), gPipeline.mRT->deferredDepth.getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST);
- gPipeline.mRT->deferredDepth.bindTarget();
+ gPipeline.mRT->deferredDepth.bindTarget();*/
simple_shader = fullbright_shader = &gObjectFullbrightAlphaMaskProgram;
simple_shader->bind();
@@ -798,7 +798,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
bool tex_setup = TexSetup(&params, (mat != nullptr));
{
- LLGLEnableFunc stencil_test(GL_STENCIL_TEST, params.mSelected, &LLGLCommonFunc::selected_stencil_test);
+ //LLGLEnableFunc stencil_test(GL_STENCIL_TEST, params.mSelected, &LLGLCommonFunc::selected_stencil_test);
gGL.blendFunc((LLRender::eBlendFactor) params.mBlendFuncSrc, (LLRender::eBlendFactor) params.mBlendFuncDst, mAlphaSFactor, mAlphaDFactor);
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index 235672b07a..75917d0ae3 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -1467,11 +1467,11 @@ void LLDrawPoolInvisible::render(S32 pass)
}
U32 invisi_mask = LLVertexBuffer::MAP_VERTEX;
- glStencilMask(0);
+ //glStencilMask(0); //deprecated
gGL.setColorMask(false, false);
pushBatches(LLRenderPass::PASS_INVISIBLE, invisi_mask, FALSE);
gGL.setColorMask(true, false);
- glStencilMask(0xFFFFFFFF);
+ //glStencilMask(0xFFFFFFFF); //deprecated
if (gPipeline.shadersLoaded())
{
diff --git a/indra/newview/lldrawpoolmaterials.cpp b/indra/newview/lldrawpoolmaterials.cpp
index 2b05f4c453..d97f0714ef 100644
--- a/indra/newview/lldrawpoolmaterials.cpp
+++ b/indra/newview/lldrawpoolmaterials.cpp
@@ -260,7 +260,7 @@ void LLDrawPoolMaterials::pushMaterialsBatch(LLDrawInfo& params, U32 mask, bool
(GLfloat*)&(mpc.mGLMp[0]));
}
- LLGLEnableFunc stencil_test(GL_STENCIL_TEST, params.mSelected, &LLGLCommonFunc::selected_stencil_test);
+ //LLGLEnableFunc stencil_test(GL_STENCIL_TEST, params.mSelected, &LLGLCommonFunc::selected_stencil_test);
params.mVertexBuffer->setBufferFast(mask);
params.mVertexBuffer->drawRangeFast(params.mDrawMode, params.mStart, params.mEnd, params.mCount, params.mOffset);
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp
index 0b9bca06db..fc8df01002 100644
--- a/indra/newview/lldrawpoolwater.cpp
+++ b/indra/newview/lldrawpoolwater.cpp
@@ -255,7 +255,7 @@ void LLDrawPoolWater::render(S32 pass)
glClearStencil(1);
glClear(GL_STENCIL_BUFFER_BIT);
- LLGLEnable gls_stencil(GL_STENCIL_TEST);
+ //LLGLEnable gls_stencil(GL_STENCIL_TEST);
glStencilOp(GL_KEEP, GL_REPLACE, GL_KEEP);
glStencilFunc(GL_ALWAYS, 0, 0xFFFFFFFF);
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index b24bc69791..431a9ebb29 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -666,7 +666,7 @@ void LLFace::renderOneWireframe(const LLColor4 &color, F32 fogCfx, bool wirefram
{
LLGLDisable depth(wireframe_selection ? 0 : GL_BLEND);
- LLGLEnable stencil(wireframe_selection ? 0 : GL_STENCIL_TEST);
+ //LLGLEnable stencil(wireframe_selection ? 0 : GL_STENCIL_TEST);
if (!wireframe_selection)
{ //modify wireframe into outline selection mode
diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp
index 6898dce7b1..0f230067bc 100644
--- a/indra/newview/llhudeffectlookat.cpp
+++ b/indra/newview/llhudeffectlookat.cpp
@@ -495,7 +495,7 @@ void LLHUDEffectLookAt::render()
{
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLGLDisable gls_stencil(GL_STENCIL_TEST);
+ //LLGLDisable gls_stencil(GL_STENCIL_TEST);
LLVector3 target = mTargetPos + ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->mHeadp->getWorldPosition();
gGL.matrixMode(LLRender::MM_MODELVIEW);
diff --git a/indra/newview/llhudeffectpointat.cpp b/indra/newview/llhudeffectpointat.cpp
index ecf6d42d69..dfa299528a 100644
--- a/indra/newview/llhudeffectpointat.cpp
+++ b/indra/newview/llhudeffectpointat.cpp
@@ -322,7 +322,7 @@ void LLHUDEffectPointAt::render()
update();
if (sDebugPointAt && mTargetType != POINTAT_TARGET_NONE)
{
- LLGLDisable gls_stencil(GL_STENCIL_TEST);
+ //LLGLDisable gls_stencil(GL_STENCIL_TEST);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
LLVector3 target = mTargetPos + mSourceObject->getRenderPosition();
diff --git a/indra/newview/llhudicon.cpp b/indra/newview/llhudicon.cpp
index 60294f6a51..38be2b69fd 100644
--- a/indra/newview/llhudicon.cpp
+++ b/indra/newview/llhudicon.cpp
@@ -79,7 +79,7 @@ void LLHUDIcon::render()
{
LLGLSUIDefault texture_state;
LLGLDepthTest gls_depth(GL_TRUE);
- LLGLDisable gls_stencil(GL_STENCIL_TEST);
+ //LLGLDisable gls_stencil(GL_STENCIL_TEST);
if (mHidden)
return;
diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp
index 952fbf8e4b..e2d63ecc0a 100644
--- a/indra/newview/llhudnametag.cpp
+++ b/indra/newview/llhudnametag.cpp
@@ -228,7 +228,7 @@ void LLHUDNameTag::render()
if (sDisplayText)
{
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
- LLGLDisable gls_stencil(GL_STENCIL_TEST);
+ //LLGLDisable gls_stencil(GL_STENCIL_TEST);
renderText(FALSE);
}
}
diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp
index 5952edfc44..7511dabd5b 100644
--- a/indra/newview/llhudtext.cpp
+++ b/indra/newview/llhudtext.cpp
@@ -102,7 +102,7 @@ void LLHUDText::render()
if (!mOnHUDAttachment && sDisplayText)
{
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
- LLGLDisable gls_stencil(GL_STENCIL_TEST);
+ //LLGLDisable gls_stencil(GL_STENCIL_TEST);
renderText();
}
}
diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp
index d85a846f4d..6b9543d433 100644
--- a/indra/newview/llmaniprotate.cpp
+++ b/indra/newview/llmaniprotate.cpp
@@ -277,7 +277,7 @@ void LLManipRotate::render()
LLGLEnable cull_face(GL_CULL_FACE);
LLGLEnable clip_plane0(GL_CLIP_PLANE0);
LLGLDepthTest gls_depth(GL_FALSE);
- LLGLDisable gls_stencil(GL_STENCIL_TEST);
+ //LLGLDisable gls_stencil(GL_STENCIL_TEST);
// First pass: centers. Second pass: sides.
for( S32 i=0; i<2; i++ )
diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp
index e74fd1241b..c15f1da26b 100644
--- a/indra/newview/llmanipscale.cpp
+++ b/indra/newview/llmanipscale.cpp
@@ -757,7 +757,7 @@ void LLManipScale::renderBoxHandle( F32 x, F32 y, F32 z )
{
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
LLGLDepthTest gls_depth(GL_FALSE);
- LLGLDisable gls_stencil(GL_STENCIL_TEST);
+ //LLGLDisable gls_stencil(GL_STENCIL_TEST);
gGL.pushMatrix();
{
diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp
index 0b2a1ef389..b9e68bd6a9 100644
--- a/indra/newview/llmaniptranslate.cpp
+++ b/indra/newview/llmaniptranslate.cpp
@@ -1063,7 +1063,7 @@ void LLManipTranslate::render()
renderGuidelines();
}
{
- LLGLDisable gls_stencil(GL_STENCIL_TEST);
+ //LLGLDisable gls_stencil(GL_STENCIL_TEST);
renderTranslationHandles();
renderSnapGuides();
}
@@ -1529,7 +1529,7 @@ void LLManipTranslate::renderSnapGuides()
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
{
- LLGLDisable stencil(GL_STENCIL_TEST);
+ //LLGLDisable stencil(GL_STENCIL_TEST);
{
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GREATER);
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, getGridTexName());
@@ -1628,6 +1628,7 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal,
LLQuaternion grid_rotation,
LLColor4 inner_color)
{
+#if 0 // DEPRECATED
if (!gSavedSettings.getBOOL("GridCrossSections"))
{
return;
@@ -1651,13 +1652,13 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal,
}
{
- glStencilMask(stencil_mask);
- glClearStencil(1);
- glClear(GL_STENCIL_BUFFER_BIT);
+ //glStencilMask(stencil_mask); //deprecated
+ //glClearStencil(1);
+ //glClear(GL_STENCIL_BUFFER_BIT);
LLGLEnable cull_face(GL_CULL_FACE);
- LLGLEnable stencil(GL_STENCIL_TEST);
+ //LLGLEnable stencil(GL_STENCIL_TEST);
LLGLDepthTest depth (GL_TRUE, GL_FALSE, GL_ALWAYS);
- glStencilFunc(GL_ALWAYS, 0, stencil_mask);
+ //glStencilFunc(GL_ALWAYS, 0, stencil_mask);
gGL.setColorMask(false, false);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -1690,14 +1691,14 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal,
}
//stencil in volumes
- glStencilOp(GL_INCR, GL_INCR, GL_INCR);
+ //glStencilOp(GL_INCR, GL_INCR, GL_INCR);
glCullFace(GL_FRONT);
for (U32 i = 0; i < num_types; i++)
{
gPipeline.renderObjects(types[i], LLVertexBuffer::MAP_VERTEX, FALSE);
}
- glStencilOp(GL_DECR, GL_DECR, GL_DECR);
+ //glStencilOp(GL_DECR, GL_DECR, GL_DECR);
glCullFace(GL_BACK);
for (U32 i = 0; i < num_types; i++)
{
@@ -1741,7 +1742,7 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal,
{
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
LLGLDepthTest depth(GL_FALSE);
- LLGLEnable stencil(GL_STENCIL_TEST);
+ //LLGLEnable stencil(GL_STENCIL_TEST);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
glStencilFunc(GL_EQUAL, 0, stencil_mask);
renderGrid(0,0,tiles,inner_color.mV[0], inner_color.mV[1], inner_color.mV[2], 0.25f);
@@ -1752,6 +1753,7 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal,
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
gGL.popMatrix();
+#endif
}
void LLManipTranslate::renderText()
diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp
index cbefb93ca9..8f1ee8f70b 100644
--- a/indra/newview/llreflectionmapmanager.cpp
+++ b/indra/newview/llreflectionmapmanager.cpp
@@ -83,7 +83,7 @@ void LLReflectionMapManager::update()
{
U32 color_fmt = GL_RGB16F;
const bool use_depth_buffer = true;
- const bool use_stencil_buffer = true;
+ const bool use_stencil_buffer = false;
U32 targetRes = LL_REFLECTION_PROBE_RESOLUTION * 2; // super sample
mRenderTarget.allocate(targetRes, targetRes, color_fmt, use_depth_buffer, use_stencil_buffer, LLTexUnit::TT_RECT_TEXTURE);
}
@@ -96,7 +96,7 @@ void LLReflectionMapManager::update()
mMipChain.resize(count);
for (int i = 0; i < count; ++i)
{
- mMipChain[i].allocate(res, res, GL_RGB16F, false, false, LLTexUnit::TT_RECT_TEXTURE);
+ mMipChain[i].allocate(res, res, GL_RGBA16F, false, false, LLTexUnit::TT_RECT_TEXTURE);
res /= 2;
}
}
@@ -385,12 +385,10 @@ void LLReflectionMapManager::doProbeUpdate()
void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face)
{
- mRenderTarget.bindTarget();
// hacky hot-swap of camera specific render targets
gPipeline.mRT = &gPipeline.mAuxillaryRT;
probe->update(mRenderTarget.getWidth(), face);
gPipeline.mRT = &gPipeline.mMainRT;
- mRenderTarget.flush();
S32 targetIdx = mReflectionProbeCount;
@@ -399,12 +397,15 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face)
targetIdx += 1;
}
+ gGL.setColorMask(true, true);
+
// downsample to placeholder map
{
LLGLDepthTest depth(GL_FALSE, GL_FALSE);
LLGLDisable cull(GL_CULL_FACE);
gReflectionMipProgram.bind();
+
gGL.matrixMode(gGL.MM_MODELVIEW);
gGL.pushMatrix();
gGL.loadIdentity();
@@ -418,6 +419,12 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face)
S32 mips = log2((F32)LL_REFLECTION_PROBE_RESOLUTION) + 0.5f;
+ S32 diffuseChannel = gReflectionMipProgram.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, LLTexUnit::TT_RECT_TEXTURE);
+ S32 depthChannel = gReflectionMipProgram.enableTexture(LLShaderMgr::DEFERRED_DEPTH, LLTexUnit::TT_RECT_TEXTURE);
+
+ LLRenderTarget* screen_rt = &gPipeline.mAuxillaryRT.screen;
+ LLRenderTarget* depth_rt = &gPipeline.mAuxillaryRT.deferredScreen;
+
for (int i = 0; i < mMipChain.size(); ++i)
{
LL_PROFILE_GPU_ZONE("probe mip");
@@ -425,13 +432,24 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face)
if (i == 0)
{
- gGL.getTexUnit(0)->bind(&mRenderTarget);
+
+ gGL.getTexUnit(diffuseChannel)->bind(screen_rt);
}
else
{
- gGL.getTexUnit(0)->bind(&(mMipChain[i - 1]));
+ gGL.getTexUnit(diffuseChannel)->bind(&(mMipChain[i - 1]));
}
+ gGL.getTexUnit(depthChannel)->bind(depth_rt, true);
+
+ static LLStaticHashedString resScale("resScale");
+ static LLStaticHashedString znear("znear");
+ static LLStaticHashedString zfar("zfar");
+
+ gReflectionMipProgram.uniform1f(resScale, (F32) (1 << i));
+ gReflectionMipProgram.uniform1f(znear, probe->getNearClip());
+ gReflectionMipProgram.uniform1f(zfar, MAX_FAR_CLIP);
+
gGL.begin(gGL.QUADS);
gGL.texCoord2f(0, 0);
@@ -471,6 +489,8 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face)
gGL.matrixMode(gGL.MM_MODELVIEW);
gGL.popMatrix();
+ gGL.getTexUnit(diffuseChannel)->unbind(LLTexUnit::TT_RECT_TEXTURE);
+ gGL.getTexUnit(depthChannel)->unbind(LLTexUnit::TT_RECT_TEXTURE);
gReflectionMipProgram.unbind();
}
@@ -851,10 +871,10 @@ void LLReflectionMapManager::initReflectionMaps()
mTexture = new LLCubeMapArray();
// store mReflectionProbeCount+2 cube maps, final two cube maps are used for render target and radiance map generation source)
- mTexture->allocate(LL_REFLECTION_PROBE_RESOLUTION, 3, mReflectionProbeCount + 2);
+ mTexture->allocate(LL_REFLECTION_PROBE_RESOLUTION, 4, mReflectionProbeCount + 2);
mIrradianceMaps = new LLCubeMapArray();
- mIrradianceMaps->allocate(LL_IRRADIANCE_MAP_RESOLUTION, 3, mReflectionProbeCount, FALSE);
+ mIrradianceMaps->allocate(LL_IRRADIANCE_MAP_RESOLUTION, 4, mReflectionProbeCount, FALSE);
}
if (mVertexBuffer.isNull())
@@ -875,6 +895,5 @@ void LLReflectionMapManager::initReflectionMaps()
buff->flush();
mVertexBuffer = buff;
-
}
}
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 118dbb833e..0d2a44867e 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -161,7 +161,7 @@ void display_startup()
LLGLState::checkStates();
LLGLState::checkTextureChannels();
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+ glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); // | GL_STENCIL_BUFFER_BIT);
LLGLSUIDefault gls_ui;
gPipeline.disableLights();
@@ -763,7 +763,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
LLGLState::checkTextureChannels();
}
- glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+ glClear(GL_DEPTH_BUFFER_BIT); // | GL_STENCIL_BUFFER_BIT);
}
LLGLState::checkStates();
@@ -998,12 +998,12 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
LLRenderTarget &rt = (gPipeline.sRenderDeferred ? gPipeline.mRT->deferredScreen : gPipeline.mRT->screen);
rt.flush();
- if (rt.sUseFBO)
+ /*if (rt.sUseFBO)
{
LLRenderTarget::copyContentsToFramebuffer(rt, 0, 0, rt.getWidth(), rt.getHeight(), 0, 0, rt.getWidth(),
rt.getHeight(), GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT,
GL_NEAREST);
- }
+ }*/
if (LLPipeline::sRenderDeferred)
{
@@ -1106,7 +1106,7 @@ void display_cube_face()
glClearColor(0, 0, 0, 0);
gPipeline.generateSunShadow(*LLViewerCamera::getInstance());
- glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+ glClear(GL_DEPTH_BUFFER_BIT); // | GL_STENCIL_BUFFER_BIT);
{
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
@@ -1151,7 +1151,7 @@ void display_cube_face()
LLPipeline::sUnderWaterRender = FALSE;
// Finalize scene
- gPipeline.renderFinalize();
+ //gPipeline.renderFinalize();
LLSpatialGroup::sNoDelete = FALSE;
gPipeline.clearReferences();
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 46abd83449..05978e1144 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -3807,6 +3807,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
if (success)
{
gReflectionMipProgram.mName = "Reflection Mip Shader";
+ gReflectionMipProgram.mFeatures.isDeferred = true;
gReflectionMipProgram.mShaderFiles.clear();
gReflectionMipProgram.mShaderFiles.push_back(make_pair("interface/splattexturerectV.glsl", GL_VERTEX_SHADER));
gReflectionMipProgram.mShaderFiles.push_back(make_pair("interface/reflectionmipF.glsl", GL_FRAGMENT_SHADER));
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index b2728b294e..8ef65b665d 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -4845,7 +4845,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);
+ glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); // stencil buffer is deprecated | GL_STENCIL_BUFFER_BIT);
setCursor(UI_CURSOR_WAIT);
// Hide all the UI widgets first and draw a frame
@@ -5144,7 +5144,7 @@ BOOL LLViewerWindow::simpleSnapshot(LLImageRaw* raw, S32 image_width, S32 image_
LL_PROFILE_ZONE_SCOPED_CATEGORY_APP;
gDisplaySwapBuffers = FALSE;
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+ glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); // stencil buffer is deprecated | GL_STENCIL_BUFFER_BIT);
setCursor(UI_CURSOR_WAIT);
BOOL prev_draw_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI) ? TRUE : FALSE;
@@ -5248,10 +5248,10 @@ BOOL LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubea
llassert(LLPipeline::sRenderDeferred);
llassert(!gCubeSnapshot); //assert a snapshot isn't already in progress
- U32 res = LLRenderTarget::sCurResX;
+ U32 res = gPipeline.mRT->deferredScreen.getWidth();
- llassert(res <= gPipeline.mRT->deferredScreen.getWidth());
- llassert(res <= gPipeline.mRT->deferredScreen.getHeight());
+ //llassert(res <= gPipeline.mRT->deferredScreen.getWidth());
+ //llassert(res <= gPipeline.mRT->deferredScreen.getHeight());
// save current view/camera settings so we can restore them afterwards
S32 old_occlusion = LLPipeline::sUseOcclusion;
@@ -5271,7 +5271,7 @@ BOOL LLViewerWindow::cubeSnapshot(const LLVector3& origin, LLCubeMapArray* cubea
camera->setOrigin(origin);
camera->setNear(near_clip);
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+ glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); // stencil buffer is deprecated | GL_STENCIL_BUFFER_BIT);
U32 dynamic_render_types[] = {
LLPipeline::RENDER_TYPE_AVATAR,
diff --git a/indra/newview/llvoicevisualizer.cpp b/indra/newview/llvoicevisualizer.cpp
index 6e08a2ff12..34e561174c 100644
--- a/indra/newview/llvoicevisualizer.cpp
+++ b/indra/newview/llvoicevisualizer.cpp
@@ -356,7 +356,7 @@ void LLVoiceVisualizer::render()
//---------------------------------------------------------------
LLGLSPipelineAlpha alpha_blend;
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
- LLGLDisable gls_stencil(GL_STENCIL_TEST);
+ //LLGLDisable gls_stencil(GL_STENCIL_TEST);
//-------------------------------------------------------------
// create coordinates of the geometry for the dot
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 08c99266f8..7eaa3a065c 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -885,14 +885,17 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
const U32 occlusion_divisor = 3;
//allocate deferred rendering color buffers
- if (!mRT->deferredScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
- if (!mRT->deferredDepth.allocate(resX, resY, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
+ if (!mRT->deferredScreen.allocate(resX, resY, GL_RGBA, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
+ //if (!mRT->deferredDepth.allocate(resX, resY, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
if (!mRT->occlusionDepth.allocate(resX/occlusion_divisor, resY/occlusion_divisor, 0, TRUE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
if (!addDeferredAttachments(mRT->deferredScreen)) return false;
GLuint screenFormat = GL_RGBA16;
if (!mRT->screen.allocate(resX, resY, screenFormat, FALSE, FALSE, LLTexUnit::TT_RECT_TEXTURE, FALSE, samples)) return false;
+
+ mRT->deferredScreen.shareDepthBuffer(mRT->screen);
+
if (samples > 0)
{
if (!mRT->fxaaBuffer.allocate(resX, resY, GL_RGBA, FALSE, FALSE, LLTexUnit::TT_TEXTURE, FALSE, samples)) return false;
@@ -929,17 +932,12 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
mRT->fxaaBuffer.release();
mRT->screen.release();
mRT->deferredScreen.release(); //make sure to release any render targets that share a depth buffer with mRT->deferredScreen first
- mRT->deferredDepth.release();
+ //mRT->deferredDepth.release();
mRT->occlusionDepth.release();
if (!mRT->screen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;
}
- if (LLPipeline::sRenderDeferred)
- { //share depth buffer between deferred targets
- mRT->deferredScreen.shareDepthBuffer(mRT->screen);
- }
-
gGL.getTexUnit(0)->disable();
stop_glerror();
@@ -2575,6 +2573,7 @@ void LLPipeline::downsampleDepthBuffer(LLRenderTarget& source, LLRenderTarget& d
if (scratch_space)
{
GLint bits = 0;
+ llassert(!source.hasStencil()); // stencil buffer usage is deprecated
bits |= (source.hasStencil() && dest.hasStencil()) ? GL_STENCIL_BUFFER_BIT : 0;
bits |= GL_DEPTH_BUFFER_BIT;
scratch_space->copyContents(source,
@@ -2632,10 +2631,17 @@ void LLPipeline::doOcclusion(LLCamera& camera, LLRenderTarget& source, LLRenderT
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY;
llassert(!gCubeSnapshot);
+#if 0
downsampleDepthBuffer(source, dest, scratch_space);
dest.bindTarget();
doOcclusion(camera);
dest.flush();
+#else
+ // none of the above shenanigans should matter (enough) because we've preserved hierarchical Z before issuing occlusion queries
+ //source.bindTarget();
+ doOcclusion(camera);
+ //source.flush();
+#endif
}
void LLPipeline::doOcclusion(LLCamera& camera)
@@ -4052,10 +4058,10 @@ void render_hud_elements()
LLGLDisable fog(GL_FOG);
LLGLSUIDefault gls_ui;
- LLGLEnable stencil(GL_STENCIL_TEST);
- glStencilFunc(GL_ALWAYS, 255, 0xFFFFFFFF);
- glStencilMask(0xFFFFFFFF);
- glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
+ //LLGLEnable stencil(GL_STENCIL_TEST);
+ //glStencilFunc(GL_ALWAYS, 255, 0xFFFFFFFF);
+ //glStencilMask(0xFFFFFFFF);
+ //glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
gGL.color4f(1,1,1,1);
@@ -4112,14 +4118,15 @@ void LLPipeline::renderHighlights()
LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS);
LLGLDisable test(GL_ALPHA_TEST);
- LLGLEnable stencil(GL_STENCIL_TEST);
+ //LLGLEnable stencil(GL_STENCIL_TEST);
gGL.flush();
- glStencilMask(0xFFFFFFFF);
- glClearStencil(1);
- glClear(GL_STENCIL_BUFFER_BIT);
+ // stencil ops are deprecated
+ //glStencilMask(0xFFFFFFFF);
+ //glClearStencil(1);
+ //glClear(GL_STENCIL_BUFFER_BIT);
- glStencilFunc(GL_ALWAYS, 0, 0xFFFFFFFF);
- glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
+ //glStencilFunc(GL_ALWAYS, 0, 0xFFFFFFFF);
+ //glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
gGL.setColorMask(false, false);
@@ -4131,8 +4138,8 @@ void LLPipeline::renderHighlights()
}
gGL.setColorMask(true, false);
- glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
- glStencilFunc(GL_NOTEQUAL, 0, 0xFFFFFFFF);
+ //glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); // deprecated
+ //glStencilFunc(GL_NOTEQUAL, 0, 0xFFFFFFFF);
//gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA);
@@ -4711,7 +4718,8 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera, bool do_occlusion)
gGLLastMatrix = NULL;
gGL.loadMatrix(gGLModelView);
LLGLSLShader::bindNoShader();
- doOcclusion(camera, mRT->screen, mRT->occlusionDepth, &mRT->deferredDepth);
+ //doOcclusion(camera, mRT->screen, mRT->occlusionDepth, &mRT->deferredDepth);
+ doOcclusion(camera, mRT->screen, mRT->occlusionDepth);
gGL.setColorMask(true, false);
}
@@ -4990,7 +4998,7 @@ void LLPipeline::renderDebug()
const LLColor4 clearColor = gSavedSettings.getColor4("PathfindingNavMeshClear");
gGL.setColorMask(true, true);
glClearColor(clearColor.mV[0],clearColor.mV[1],clearColor.mV[2],0);
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+ glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); // no stencil -- deprecated | GL_STENCIL_BUFFER_BIT);
gGL.setColorMask(true, false);
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
}
@@ -8063,6 +8071,7 @@ void LLPipeline::renderFinalize()
shader->unbind();
}
}
+#if 0 // DEPRECATED
else // not deferred
{
U32 mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1;
@@ -8105,7 +8114,7 @@ void LLPipeline::renderFinalize()
gGlowCombineProgram.unbind();
}
-
+#endif
gGL.setSceneBlendType(LLRender::BT_ALPHA);
if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES))
@@ -8139,12 +8148,12 @@ void LLPipeline::renderFinalize()
gSplatTextureRectProgram.unbind();
}
- if (LLRenderTarget::sUseFBO && !gCubeSnapshot)
+ /*if (LLRenderTarget::sUseFBO && !gCubeSnapshot)
{ // copy depth buffer from mRT->screen to framebuffer
LLRenderTarget::copyContentsToFramebuffer(mRT->screen, 0, 0, mRT->screen.getWidth(), mRT->screen.getHeight(), 0, 0,
mRT->screen.getWidth(), mRT->screen.getHeight(),
GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, GL_NEAREST);
- }
+ }*/
gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.popMatrix();
@@ -8162,7 +8171,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
LL_PROFILE_GPU_ZONE("bindDeferredShader");
LLRenderTarget* deferred_target = &mRT->deferredScreen;
- LLRenderTarget* deferred_depth_target = &mRT->deferredDepth;
+ //LLRenderTarget* deferred_depth_target = &mRT->deferredDepth;
LLRenderTarget* deferred_light_target = &mRT->deferredLight;
shader.bind();
@@ -8198,12 +8207,21 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
}
+#if 0
channel = shader.enableTexture(LLShaderMgr::DEFERRED_DEPTH, deferred_depth_target->getUsage());
if (channel > -1)
{
gGL.getTexUnit(channel)->bind(deferred_depth_target, TRUE);
stop_glerror();
}
+#else
+ channel = shader.enableTexture(LLShaderMgr::DEFERRED_DEPTH, deferred_target->getUsage());
+ if (channel > -1)
+ {
+ gGL.getTexUnit(channel)->bind(deferred_target, TRUE);
+ stop_glerror();
+ }
+#endif
glh::matrix4f projection = get_current_projection();
glh::matrix4f inv_proj = projection.inverse();
@@ -8452,13 +8470,15 @@ void LLPipeline::renderDeferredLighting()
}
LLRenderTarget *screen_target = &mRT->screen;
- LLRenderTarget *deferred_target = &mRT->deferredScreen;
- LLRenderTarget *deferred_depth_target = &mRT->deferredDepth;
- LLRenderTarget *deferred_light_target = &mRT->deferredLight;
+ //LLRenderTarget *deferred_target = &mRT->deferredScreen;
+ //LLRenderTarget *deferred_depth_target = &mRT->deferredDepth;
+ LLRenderTarget* deferred_light_target = &mRT->deferredLight;
{
LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("deferred"); //LL_RECORD_BLOCK_TIME(FTM_RENDER_DEFERRED);
LLViewerCamera *camera = LLViewerCamera::getInstance();
+
+#if 0
{
LLGLDepthTest depth(GL_TRUE);
deferred_depth_target->copyContents(*deferred_target,
@@ -8473,6 +8493,7 @@ void LLPipeline::renderDeferredLighting()
GL_DEPTH_BUFFER_BIT,
GL_NEAREST);
}
+#endif
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0);
@@ -8482,7 +8503,7 @@ void LLPipeline::renderDeferredLighting()
}
// ati doesn't seem to love actually using the stencil buffer on FBO's
- LLGLDisable stencil(GL_STENCIL_TEST);
+ //LLGLDisable stencil(GL_STENCIL_TEST);
// glStencilFunc(GL_EQUAL, 1, 0xFFFFFFFF);
// glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
@@ -8707,7 +8728,7 @@ void LLPipeline::renderDeferredLighting()
#if 0
{ // render non-deferred geometry (fullbright, alpha, etc)
LLGLDisable blend(GL_BLEND);
- LLGLDisable stencil(GL_STENCIL_TEST);
+ //LLGLDisable stencil(GL_STENCIL_TEST);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
gPipeline.pushRenderTypeMask();
@@ -8986,7 +9007,7 @@ void LLPipeline::renderDeferredLighting()
{ // render non-deferred geometry (alpha, fullbright, glow)
LLGLDisable blend(GL_BLEND);
- LLGLDisable stencil(GL_STENCIL_TEST);
+ //LLGLDisable stencil(GL_STENCIL_TEST);
pushRenderTypeMask();
andRenderTypeMask(LLPipeline::RENDER_TYPE_ALPHA,
@@ -9234,7 +9255,7 @@ void LLPipeline::setupSpotLight(LLGLSLShader& shader, LLDrawable* drawablep)
void LLPipeline::unbindDeferredShader(LLGLSLShader &shader)
{
LLRenderTarget* deferred_target = &mRT->deferredScreen;
- LLRenderTarget* deferred_depth_target = &mRT->deferredDepth;
+ //LLRenderTarget* deferred_depth_target = &mRT->deferredDepth;
LLRenderTarget* deferred_light_target = &mRT->deferredLight;
stop_glerror();
@@ -9243,7 +9264,8 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader)
shader.disableTexture(LLShaderMgr::DEFERRED_SPECULAR, deferred_target->getUsage());
shader.disableTexture(LLShaderMgr::DEFERRED_EMISSIVE, deferred_target->getUsage());
shader.disableTexture(LLShaderMgr::DEFERRED_BRDF_LUT);
- shader.disableTexture(LLShaderMgr::DEFERRED_DEPTH, deferred_depth_target->getUsage());
+ //shader.disableTexture(LLShaderMgr::DEFERRED_DEPTH, deferred_depth_target->getUsage());
+ shader.disableTexture(LLShaderMgr::DEFERRED_DEPTH, deferred_target->getUsage());
shader.disableTexture(LLShaderMgr::DEFERRED_LIGHT, deferred_light_target->getUsage());
shader.disableTexture(LLShaderMgr::DIFFUSE_MAP);
shader.disableTexture(LLShaderMgr::DEFERRED_BLOOM);
diff --git a/indra/newview/skins/default/xui/en/floater_build_options.xml b/indra/newview/skins/default/xui/en/floater_build_options.xml
index 38428b36fc..7278e55d57 100644
--- a/indra/newview/skins/default/xui/en/floater_build_options.xml
+++ b/indra/newview/skins/default/xui/en/floater_build_options.xml
@@ -46,14 +46,14 @@
name="GridSubUnit"
top_pad="0"
width="200" />
- <check_box
+ <!-- <check_box
control_name="GridCrossSections"
height="16"
label="View cross-sections"
layout="topleft"
name="GridCrossSection"
top_pad="5"
- width="200" />
+ width="200" />-->
<text
type="string"
length="1"