2590 mac intel and radeon pro 5300m horrible fps 2 (#3030)
* OpenGL 3.3 compatibility pass. Fix for FBO driven downscaling corrupting textures. * Increase maximum texture bias, immediately scale down when textures are loaded higher resolution than desired * #2590 Fix for some frame stalls on Intel Macsmaster
parent
13c0708cc7
commit
2b255535ef
|
|
@ -2452,41 +2452,32 @@ bool LLImageGL::scaleDown(S32 desired_discard)
|
|||
|
||||
if (gGLManager.mDownScaleMethod == 0)
|
||||
{ // use an FBO to downscale the texture
|
||||
// allocate new texture
|
||||
U32 temp_texname = 0;
|
||||
generateTextures(1, &temp_texname);
|
||||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, temp_texname, true);
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("scaleDown - glTexImage2D");
|
||||
glTexImage2D(mTarget, 0, mFormatInternal, desired_width, desired_height, 0, mFormatPrimary, mFormatType, NULL);
|
||||
}
|
||||
|
||||
// account for new texture getting created
|
||||
alloc_tex_image(desired_width, desired_height, mFormatInternal, 1);
|
||||
|
||||
// Use render-to-texture to scale down the texture
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("scaleDown - glFramebufferTexture2D");
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, mTarget, temp_texname, 0);
|
||||
}
|
||||
|
||||
glViewport(0, 0, desired_width, desired_height);
|
||||
|
||||
// draw a full screen triangle
|
||||
gGL.getTexUnit(0)->bind(this);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
if (gGL.getTexUnit(0)->bind(this, true, true))
|
||||
{
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
|
||||
// delete old texture and assign new texture name
|
||||
deleteTextures(1, &mTexName);
|
||||
mTexName = temp_texname;
|
||||
free_tex_image(mTexName);
|
||||
glTexImage2D(mTarget, 0, mFormatInternal, desired_width, desired_height, 0, mFormatPrimary, mFormatType, nullptr);
|
||||
glCopyTexSubImage2D(mTarget, 0, 0, 0, 0, 0, desired_width, desired_height);
|
||||
alloc_tex_image(desired_width, desired_height, mFormatInternal, 1);
|
||||
|
||||
if (mHasMipMaps)
|
||||
{ // generate mipmaps if needed
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("scaleDown - glGenerateMipmap");
|
||||
gGL.getTexUnit(0)->bind(this);
|
||||
glGenerateMipmap(mTarget);
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
mTexOptionsDirty = true;
|
||||
|
||||
if (mHasMipMaps)
|
||||
{ // generate mipmaps if needed
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("scaleDown - glGenerateMipmap");
|
||||
gGL.getTexUnit(0)->bind(this);
|
||||
glGenerateMipmap(mTarget);
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS_ONCE("LLImageGL") << "Failed to bind texture for downscaling." << LL_ENDL;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -272,11 +272,13 @@ static GLuint gen_buffer()
|
|||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("gen buffer");
|
||||
sIndex = pool_size;
|
||||
#if !LL_DARWIN
|
||||
if (!gGLManager.mIsAMD)
|
||||
{
|
||||
glGenBuffers(pool_size, sNamePool);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{ // work around for AMD driver bug
|
||||
for (U32 i = 0; i < pool_size; ++i)
|
||||
{
|
||||
|
|
@ -942,6 +944,10 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
|
|||
void LLVertexBuffer::initClass(LLWindow* window)
|
||||
{
|
||||
llassert(sVBOPool == nullptr);
|
||||
|
||||
LL_INFOS() << "VBO Pooling Disabled" << LL_ENDL;
|
||||
sVBOPool = new LLAppleVBOPool();
|
||||
|
||||
if (gGLManager.mIsApple)
|
||||
{
|
||||
LL_INFOS() << "VBO Pooling Disabled" << LL_ENDL;
|
||||
|
|
|
|||
|
|
@ -7836,7 +7836,7 @@
|
|||
<key>Type</key>
|
||||
<string>U32</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>RenderDebugTextureBind</key>
|
||||
<map>
|
||||
|
|
@ -16038,5 +16038,16 @@
|
|||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>RenderHDREnabled</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Enable HDR rendering.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
</map>
|
||||
</llsd>
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ in vec2 vary_texcoord0;
|
|||
in vec3 vary_position;
|
||||
|
||||
void mirrorClip(vec3 pos);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -51,7 +52,7 @@ void main()
|
|||
frag_data[0] = vec4(diff.rgb, 0.0);
|
||||
frag_data[1] = vec4(0,0,0,0);
|
||||
vec3 nvn = normalize(vary_normal);
|
||||
frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[3] = vec4(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ in vec2 vary_texcoord0;
|
|||
in vec3 vary_position;
|
||||
|
||||
void mirrorClip(vec3 pos);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
|
||||
void main()
|
||||
{
|
||||
mirrorClip(vary_position);
|
||||
|
|
@ -62,6 +64,6 @@ void main()
|
|||
frag_data[1] = vertex_color.aaaa; // spec
|
||||
//frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
|
||||
vec3 nvn = normalize(tnorm);
|
||||
frag_data[2] = vec4(nvn, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[2] = encodeNormal(nvn, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[3] = vec4(vertex_color.a, 0, 0, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,6 +75,9 @@ const float ONE_OVER_PI = 0.3183098861;
|
|||
vec3 srgb_to_linear(vec3 cs);
|
||||
vec3 atmosFragLightingLinear(vec3 light, vec3 additive, vec3 atten);
|
||||
|
||||
vec4 decodeNormal(vec4 norm);
|
||||
|
||||
|
||||
float calcLegacyDistanceAttenuation(float distance, float falloff)
|
||||
{
|
||||
float dist_atten = 1.0 - clamp((distance + falloff)/(1.0 + falloff), 0.0, 1.0);
|
||||
|
|
@ -145,8 +148,7 @@ vec2 getScreenCoordinate(vec2 screenpos)
|
|||
|
||||
vec4 getNorm(vec2 screenpos)
|
||||
{
|
||||
vec4 norm = texture(normalMap, screenpos.xy);
|
||||
norm.xyz = normalize(norm.xyz);
|
||||
vec4 norm = decodeNormal(texture(normalMap, screenpos.xy));
|
||||
return norm;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ in vec2 vary_texcoord0;
|
|||
|
||||
void mirrorClip(vec3 pos);
|
||||
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
|
||||
void main()
|
||||
{
|
||||
mirrorClip(vary_position);
|
||||
|
|
@ -53,7 +55,7 @@ void main()
|
|||
frag_data[0] = vec4(col.rgb, 0.0);
|
||||
frag_data[1] = vec4(0,0,0,0); // spec
|
||||
vec3 nvn = normalize(vary_normal);
|
||||
frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[3] = vec4(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ in vec4 vertex_color;
|
|||
in vec2 vary_texcoord0;
|
||||
|
||||
void mirrorClip(vec3 pos);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -51,6 +52,6 @@ void main()
|
|||
frag_data[0] = vec4(col.rgb, 0.0);
|
||||
frag_data[1] = vec4(0,0,0,0);
|
||||
vec3 nvn = normalize(vary_normal);
|
||||
frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[3] = vec4(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ uniform sampler2D diffuseMap;
|
|||
|
||||
in vec3 vary_normal;
|
||||
in vec2 vary_texcoord0;
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -46,7 +47,7 @@ void main()
|
|||
frag_data[0] = vec4(col.rgb, 0.0);
|
||||
frag_data[1] = vec4(0,0,0,0); // spec
|
||||
vec3 nvn = normalize(vary_normal);
|
||||
frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[3] = vec4(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ in vec2 vary_texcoord0;
|
|||
in vec3 vary_position;
|
||||
|
||||
void mirrorClip(vec3 pos);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -42,9 +43,8 @@ void main()
|
|||
vec3 col = vertex_color.rgb * texture(diffuseMap, vary_texcoord0.xy).rgb;
|
||||
frag_data[0] = vec4(col, 0.0);
|
||||
frag_data[1] = vertex_color.aaaa; // spec
|
||||
//frag_data[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested
|
||||
vec3 nvn = normalize(vary_normal);
|
||||
frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[3] = vec4(vertex_color.a, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ in vec2 vary_texcoord0;
|
|||
in vec3 vary_position;
|
||||
|
||||
void mirrorClip(vec3 pos);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
|
||||
vec3 linear_to_srgb(vec3 c);
|
||||
|
||||
void main()
|
||||
|
|
@ -46,6 +48,6 @@ void main()
|
|||
frag_data[0] = vec4(col, 0.0);
|
||||
frag_data[1] = vec4(spec, vertex_color.a); // spec
|
||||
vec3 nvn = normalize(vary_normal);
|
||||
frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[3] = vec4(vertex_color.a, 0, 0, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,3 +43,15 @@ void mirrorClip(vec3 pos)
|
|||
}
|
||||
}
|
||||
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag)
|
||||
{
|
||||
return vec4(norm * 0.5 + 0.5, gbuffer_flag);
|
||||
}
|
||||
|
||||
vec4 decodeNormal(vec4 norm)
|
||||
{
|
||||
norm.xyz = norm.xyz * 2.0 - 1.0;
|
||||
return norm;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ in vec2 vary_texcoord0;
|
|||
|
||||
vec3 linear_to_srgb(vec3 c);
|
||||
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 col = texture(diffuseMap, vary_texcoord0.xy);
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ uniform vec4 clipPlane;
|
|||
uniform float clipSign;
|
||||
|
||||
void mirrorClip(vec3 pos);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
|
||||
uniform mat3 normal_matrix;
|
||||
|
||||
|
|
@ -113,7 +114,7 @@ void main()
|
|||
// See: C++: addDeferredAttachments(), GLSL: softenLightF
|
||||
frag_data[0] = max(vec4(col, 0.0), vec4(0)); // Diffuse
|
||||
frag_data[1] = max(vec4(spec.rgb,0.0), vec4(0)); // PBR linear packed Occlusion, Roughness, Metal.
|
||||
frag_data[2] = vec4(tnorm, GBUFFER_FLAG_HAS_PBR); // normal, environment intensity, flags
|
||||
frag_data[2] = encodeNormal(tnorm, GBUFFER_FLAG_HAS_PBR); // normal, environment intensity, flags
|
||||
frag_data[3] = max(vec4(emissive,0), vec4(0)); // PBR sRGB Emissive
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -162,6 +162,7 @@ in vec4[2] vary_coords;
|
|||
#endif
|
||||
|
||||
void mirrorClip(vec3 position);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
|
||||
float terrain_mix(TerrainMix tm, vec4 tms4);
|
||||
|
||||
|
|
@ -429,7 +430,7 @@ void main()
|
|||
#endif
|
||||
frag_data[0] = max(vec4(pbr_mix.col.xyz, 0.0), vec4(0)); // Diffuse
|
||||
frag_data[1] = max(vec4(mix_orm.rgb, base_color_factor_alpha), vec4(0)); // PBR linear packed Occlusion, Roughness, Metal.
|
||||
frag_data[2] = vec4(tnorm, GBUFFER_FLAG_HAS_PBR); // normal, flags
|
||||
frag_data[2] = encodeNormal(tnorm, GBUFFER_FLAG_HAS_PBR); // normal, flags
|
||||
frag_data[3] = max(vec4(mix_emissive,0), vec4(0)); // PBR sRGB Emissive
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ in vec4 vary_texcoord0;
|
|||
in vec4 vary_texcoord1;
|
||||
|
||||
void mirrorClip(vec3 position);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -60,7 +61,7 @@ void main()
|
|||
frag_data[0] = max(outColor, vec4(0));
|
||||
frag_data[1] = vec4(0.0,0.0,0.0,-1.0);
|
||||
vec3 nvn = normalize(vary_normal);
|
||||
frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[3] = vec4(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ in vec3 vary_position;
|
|||
uniform float minimum_alpha;
|
||||
|
||||
void mirrorClip(vec3 pos);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
|
||||
void main()
|
||||
{
|
||||
mirrorClip(vary_position);
|
||||
|
|
@ -49,6 +51,6 @@ void main()
|
|||
frag_data[0] = vec4(vertex_color.rgb*col.rgb, 0.0);
|
||||
frag_data[1] = vec4(0,0,0,0);
|
||||
vec3 nvn = normalize(vary_normal);
|
||||
frag_data[2] = vec4(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[2] = encodeNormal(nvn.xyz, GBUFFER_FLAG_HAS_ATMOS);
|
||||
frag_data[3] = vec4(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@ in vec2 base_color_uv;
|
|||
in vec2 emissive_uv;
|
||||
|
||||
void mirrorClip(vec3 pos);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
|
||||
vec3 linear_to_srgb(vec3 c);
|
||||
vec3 srgb_to_linear(vec3 c);
|
||||
// ==================================
|
||||
|
|
@ -241,7 +243,7 @@ void main()
|
|||
#else
|
||||
frag_data[0] = max(vec4(basecolor.rgb, 0.0), vec4(0));
|
||||
frag_data[1] = max(vec4(orm.rgb,0.0), vec4(0));
|
||||
frag_data[2] = vec4(norm, GBUFFER_FLAG_HAS_PBR);
|
||||
frag_data[2] = encodeNormal(norm, GBUFFER_FLAG_HAS_PBR);
|
||||
frag_data[3] = max(vec4(emissive,0), vec4(0));
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ uniform mat3 normal_matrix;
|
|||
in vec3 vary_position;
|
||||
|
||||
void mirrorClip(vec3 pos);
|
||||
vec4 encodeNormal(vec3 norm, float gbuffer_flag);
|
||||
|
||||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
|
||||
|
||||
|
|
@ -414,7 +415,7 @@ void main()
|
|||
|
||||
frag_data[0] = max(vec4(diffcol.rgb, emissive), vec4(0)); // gbuffer is sRGB for legacy materials
|
||||
frag_data[1] = max(vec4(spec.rgb, glossiness), vec4(0)); // XYZ = Specular color. W = Specular exponent.
|
||||
frag_data[2] = vec4(norm, flag); // XY = Normal. Z = Env. intensity. W = 1 skip atmos (mask off fog)
|
||||
frag_data[2] = encodeNormal(norm, flag); // XY = Normal. Z = Env. intensity. W = 1 skip atmos (mask off fog)
|
||||
frag_data[3] = vec4(env, 0, 0, 0);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
out vec4 frag_color;
|
||||
|
||||
vec4 decodeNormal(vec4 norm);
|
||||
|
||||
uniform sampler2D diffuseRect;
|
||||
uniform sampler2D specularRect;
|
||||
uniform sampler2D emissiveRect; // PBR linear packed Occlusion, Roughness, Metal. See: pbropaqueF.glsl
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ RenderHeroProbeResolution 1 2048
|
|||
RenderHeroProbeDistance 1 16
|
||||
RenderHeroProbeUpdateRate 1 6
|
||||
RenderHeroProbeConservativeUpdateMultiplier 1 16
|
||||
RenderDownScaleMethod 1 1
|
||||
RenderDownScaleMethod 1 0
|
||||
RenderCASSharpness 1 1
|
||||
RenderExposure 1 4
|
||||
RenderTonemapType 1 1
|
||||
|
|
|
|||
|
|
@ -463,6 +463,11 @@ void LLReflectionMapManager::update()
|
|||
|
||||
LLReflectionMap* LLReflectionMapManager::addProbe(LLSpatialGroup* group)
|
||||
{
|
||||
if (gGLManager.mGLVersion < 4.05f)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
LLReflectionMap* probe = new LLReflectionMap();
|
||||
probe->mGroup = group;
|
||||
|
||||
|
|
|
|||
|
|
@ -1303,12 +1303,15 @@ void LLViewerRegion::updateReflectionProbes(bool full_update)
|
|||
mReflectionMaps[idx] = gPipeline.mReflectionMapManager.addProbe();
|
||||
}
|
||||
|
||||
LLVector3 probe_origin = LLVector3(x, y, llmax(water_height, mImpl->mLandp->resolveHeightRegion(x, y)));
|
||||
probe_origin.mV[2] += hover_height;
|
||||
probe_origin += origin;
|
||||
if (mReflectionMaps[idx])
|
||||
{
|
||||
LLVector3 probe_origin = LLVector3(x, y, llmax(water_height, mImpl->mLandp->resolveHeightRegion(x, y)));
|
||||
probe_origin.mV[2] += hover_height;
|
||||
probe_origin += origin;
|
||||
|
||||
mReflectionMaps[idx]->mOrigin.load3(probe_origin.mV);
|
||||
mReflectionMaps[idx]->mRadius = probe_radius;
|
||||
mReflectionMaps[idx]->mOrigin.load3(probe_origin.mV);
|
||||
mReflectionMaps[idx]->mRadius = probe_radius;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2493,7 +2493,7 @@ bool LLViewerShaderMgr::loadShadersDeferred()
|
|||
}
|
||||
}
|
||||
|
||||
if (success)
|
||||
if (success && gGLManager.mGLVersion > 4.05f)
|
||||
{
|
||||
gCASProgram.mName = "Contrast Adaptive Sharpening Shader";
|
||||
gCASProgram.mFeatures.hasSrgb = true;
|
||||
|
|
|
|||
|
|
@ -546,7 +546,9 @@ void LLViewerTexture::updateClass()
|
|||
if (sEvaluationTimer.getElapsedTimeF32() > MEMORY_CHECK_WAIT_TIME)
|
||||
{
|
||||
static LLCachedControl<F32> low_mem_min_discard_increment(gSavedSettings, "RenderLowMemMinDiscardIncrement", .1f);
|
||||
sDesiredDiscardBias += (F32) low_mem_min_discard_increment * (F32) gFrameIntervalSeconds;
|
||||
|
||||
F32 increment = low_mem_min_discard_increment + llmax(over_pct, 0.f);
|
||||
sDesiredDiscardBias += increment * gFrameIntervalSeconds;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -605,7 +607,7 @@ void LLViewerTexture::updateClass()
|
|||
last_desired_discard_bias = sDesiredDiscardBias;
|
||||
was_backgrounded = true;
|
||||
}
|
||||
sDesiredDiscardBias = 4.f;
|
||||
sDesiredDiscardBias = 5.f;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -619,7 +621,7 @@ void LLViewerTexture::updateClass()
|
|||
}
|
||||
}
|
||||
|
||||
sDesiredDiscardBias = llclamp(sDesiredDiscardBias, 1.f, 4.f);
|
||||
sDesiredDiscardBias = llclamp(sDesiredDiscardBias, 1.f, 5.f);
|
||||
|
||||
LLViewerTexture::sFreezeImageUpdates = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -410,6 +410,8 @@ public:
|
|||
|
||||
/*virtual*/bool isActiveFetching() override; //is actively in fetching by the fetching pipeline.
|
||||
|
||||
virtual bool scaleDown() { return false; };
|
||||
|
||||
bool mCreatePending = false; // if true, this is in gTextureList.mCreateTextureList
|
||||
mutable bool mDownScalePending = false; // if true, this is in gTextureList.mDownScaleQueue
|
||||
|
||||
|
|
@ -527,12 +529,12 @@ public:
|
|||
LLViewerLODTexture(const LLUUID& id, FTType f_type, const LLHost& host = LLHost(), bool usemipmaps = true);
|
||||
LLViewerLODTexture(const std::string& url, FTType f_type, const LLUUID& id, bool usemipmaps = true);
|
||||
|
||||
/*virtual*/ S8 getType() const;
|
||||
S8 getType() const override;
|
||||
// Process image stats to determine priority/quality requirements.
|
||||
/*virtual*/ void processTextureStats();
|
||||
void processTextureStats() override;
|
||||
bool isUpdateFrozen() ;
|
||||
|
||||
bool scaleDown();
|
||||
bool scaleDown() override;
|
||||
|
||||
private:
|
||||
void init(bool firstinit) ;
|
||||
|
|
|
|||
|
|
@ -1052,8 +1052,32 @@ F32 LLViewerTextureList::updateImagesCreateTextures(F32 max_time)
|
|||
|
||||
LLTimer create_timer;
|
||||
|
||||
while (!mCreateTextureList.empty())
|
||||
{
|
||||
LLViewerFetchedTexture* imagep = mCreateTextureList.front();
|
||||
llassert(imagep->mCreatePending);
|
||||
imagep->createTexture();
|
||||
imagep->postCreateTexture();
|
||||
imagep->mCreatePending = false;
|
||||
mCreateTextureList.pop();
|
||||
|
||||
if (imagep->getDiscardLevel() < imagep->getDesiredDiscardLevel())
|
||||
{
|
||||
LL_WARNS_ONCE("Texture") << "Texture will be downscaled immediately after loading." << LL_ENDL;
|
||||
imagep->scaleDown();
|
||||
}
|
||||
|
||||
if (create_timer.getElapsedTimeF32() > max_time)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mDownScaleQueue.empty() && gPipeline.mDownResMap.isComplete())
|
||||
{
|
||||
LLGLDisable blend(GL_BLEND);
|
||||
gGL.setColorMask(true, true);
|
||||
|
||||
// just in case we downres textures, bind downresmap and copy program
|
||||
gPipeline.mDownResMap.bindTarget();
|
||||
gCopyProgram.bind();
|
||||
|
|
@ -1067,6 +1091,7 @@ F32 LLViewerTextureList::updateImagesCreateTextures(F32 max_time)
|
|||
// freeze.
|
||||
S32 min_count = (S32)mCreateTextureList.size() / 20 + 5;
|
||||
|
||||
create_timer.reset();
|
||||
while (!mDownScaleQueue.empty())
|
||||
{
|
||||
LLViewerFetchedTexture* image = mDownScaleQueue.front();
|
||||
|
|
@ -1091,25 +1116,6 @@ F32 LLViewerTextureList::updateImagesCreateTextures(F32 max_time)
|
|||
gPipeline.mDownResMap.flush();
|
||||
}
|
||||
|
||||
// do at least 5 and make sure we don't get too far behind even if it violates
|
||||
// the time limit. Textures pending creation have a copy of their texture data
|
||||
// in system memory, so we don't want to let them pile up.
|
||||
S32 min_count = (S32) mCreateTextureList.size() / 20 + 5;
|
||||
|
||||
while (!mCreateTextureList.empty())
|
||||
{
|
||||
LLViewerFetchedTexture *imagep = mCreateTextureList.front();
|
||||
llassert(imagep->mCreatePending);
|
||||
imagep->createTexture();
|
||||
imagep->postCreateTexture();
|
||||
imagep->mCreatePending = false;
|
||||
mCreateTextureList.pop();
|
||||
|
||||
if (create_timer.getElapsedTimeF32() > max_time && --min_count <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return create_timer.getElapsedTimeF32();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -345,10 +345,22 @@ void validate_framebuffer_object();
|
|||
// target -- RenderTarget to add attachments to
|
||||
bool addDeferredAttachments(LLRenderTarget& target, bool for_impostor = false)
|
||||
{
|
||||
U32 orm = GL_RGBA;
|
||||
U32 norm = GL_RGBA16F;
|
||||
U32 emissive = GL_RGB16F;
|
||||
|
||||
bool hdr = gSavedSettings.getBOOL("RenderHDREnabled") && gGLManager.mGLVersion > 4.05f;
|
||||
|
||||
if (!hdr)
|
||||
{
|
||||
norm = GL_RGBA;
|
||||
emissive = GL_RGB;
|
||||
}
|
||||
|
||||
bool valid = true
|
||||
&& target.addColorAttachment(GL_RGBA) // frag-data[1] specular OR PBR ORM
|
||||
&& target.addColorAttachment(GL_RGBA16F) // frag_data[2] normal+fogmask, See: class1\deferred\materialF.glsl & softenlight
|
||||
&& target.addColorAttachment(GL_RGB16F); // frag_data[3] PBR emissive OR material env intensity
|
||||
&& target.addColorAttachment(orm) // frag-data[1] specular OR PBR ORM
|
||||
&& target.addColorAttachment(norm) // frag_data[2] normal+fogmask, See: class1\deferred\materialF.glsl & softenlight
|
||||
&& target.addColorAttachment(emissive); // frag_data[3] PBR emissive OR material env intensity
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
|
@ -785,6 +797,9 @@ LLPipeline::eFBOStatus LLPipeline::doAllocateScreenBuffer(U32 resX, U32 resY)
|
|||
bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY;
|
||||
|
||||
bool hdr = gGLManager.mGLVersion > 4.05f && gSavedSettings.getBOOL("RenderHDREnabled");
|
||||
|
||||
if (mRT == &mMainRT)
|
||||
{ // hacky -- allocate auxillary buffer
|
||||
|
||||
|
|
@ -830,7 +845,7 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY)
|
|||
if (!mRT->deferredScreen.allocate(resX, resY, GL_RGBA, true)) return false;
|
||||
if (!addDeferredAttachments(mRT->deferredScreen)) return false;
|
||||
|
||||
GLuint screenFormat = GL_RGBA16F;
|
||||
GLuint screenFormat = hdr ? GL_RGBA16F : GL_RGBA;
|
||||
|
||||
if (!mRT->screen.allocate(resX, resY, screenFormat)) return false;
|
||||
|
||||
|
|
@ -838,7 +853,7 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY)
|
|||
|
||||
if (shadow_detail > 0 || ssao || RenderDepthOfField)
|
||||
{ //only need mRT->deferredLight for shadows OR ssao OR dof
|
||||
if (!mRT->deferredLight.allocate(resX, resY, GL_RGBA16F)) return false;
|
||||
if (!mRT->deferredLight.allocate(resX, resY, screenFormat)) return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -872,22 +887,22 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY)
|
|||
}
|
||||
|
||||
//water reflection texture (always needed as scratch space whether or not transparent water is enabled)
|
||||
mWaterDis.allocate(resX, resY, GL_RGBA16F, true);
|
||||
mWaterDis.allocate(resX, resY, screenFormat, true);
|
||||
|
||||
if(RenderScreenSpaceReflections)
|
||||
{
|
||||
mSceneMap.allocate(resX, resY, GL_RGBA16F, true);
|
||||
mSceneMap.allocate(resX, resY, screenFormat, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
mSceneMap.release();
|
||||
}
|
||||
|
||||
mPostMap.allocate(resX, resY, GL_RGBA16F);
|
||||
mPostMap.allocate(resX, resY, screenFormat);
|
||||
|
||||
// used to scale down textures
|
||||
// See LLViwerTextureList::updateImagesCreateTextures and LLImageGL::scaleDown
|
||||
mDownResMap.allocate(4, 4, GL_RGBA);
|
||||
mDownResMap.allocate(1024, 1024, GL_RGBA);
|
||||
|
||||
mBakeMap.allocate(LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH, LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT, GL_RGBA);
|
||||
}
|
||||
|
|
@ -4073,6 +4088,13 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
|
|||
LLGLState::checkStates(GL_FALSE);
|
||||
}
|
||||
|
||||
// turn off atmospherics and water haze for low detail reflection probe
|
||||
static LLCachedControl<S32> probe_level(gSavedSettings, "RenderReflectionProbeLevel", 0);
|
||||
bool low_detail_probe = probe_level == 0 && gCubeSnapshot;
|
||||
done_atmospherics = done_atmospherics || low_detail_probe;
|
||||
done_water_haze = done_water_haze || low_detail_probe;
|
||||
|
||||
|
||||
while ( iter1 != mPools.end() )
|
||||
{
|
||||
LLDrawPool *poolp = *iter1;
|
||||
|
|
@ -7853,15 +7875,20 @@ void LLPipeline::renderFinalize()
|
|||
gGL.setColorMask(true, true);
|
||||
glClearColor(0, 0, 0, 0);
|
||||
|
||||
copyScreenSpaceReflections(&mRT->screen, &mSceneMap);
|
||||
bool hdr = gGLManager.mGLVersion > 4.05f && gSavedSettings.getBOOL("RenderHDREnabled");
|
||||
|
||||
generateLuminance(&mRT->screen, &mLuminanceMap);
|
||||
if (hdr)
|
||||
{
|
||||
copyScreenSpaceReflections(&mRT->screen, &mSceneMap);
|
||||
|
||||
generateExposure(&mLuminanceMap, &mExposureMap);
|
||||
generateLuminance(&mRT->screen, &mLuminanceMap);
|
||||
|
||||
tonemap(&mRT->screen, &mPostMap);
|
||||
generateExposure(&mLuminanceMap, &mExposureMap);
|
||||
|
||||
applyCAS(&mPostMap, &mRT->screen);
|
||||
tonemap(&mRT->screen, &mPostMap);
|
||||
|
||||
applyCAS(&mPostMap, &mRT->screen);
|
||||
}
|
||||
|
||||
generateSMAABuffers(&mRT->screen);
|
||||
|
||||
|
|
@ -8463,8 +8490,9 @@ void LLPipeline::renderDeferredLighting()
|
|||
}
|
||||
|
||||
static LLCachedControl<S32> local_light_count(gSavedSettings, "RenderLocalLightCount", 256);
|
||||
static LLCachedControl<S32> probe_level(gSavedSettings, "RenderReflectionProbeLevel", 0);
|
||||
|
||||
if (local_light_count > 0)
|
||||
if (local_light_count > 0 && (!gCubeSnapshot || probe_level > 0))
|
||||
{
|
||||
gGL.setSceneBlendType(LLRender::BT_ADD);
|
||||
std::list<LLVector4> fullscreen_lights;
|
||||
|
|
|
|||
Loading…
Reference in New Issue