Merge and fix MAINT-9087 and MAINT-9084
parent
d1d248973d
commit
2e55eae9cc
|
|
@ -569,7 +569,7 @@ BOOL LLGLSLShader::mapAttributes(const std::vector<LLStaticHashedString> * attri
|
|||
mAttribute[i] = index;
|
||||
#endif
|
||||
mAttributeMask |= 1 << i;
|
||||
LL_DEBUGS("ShaderLoading") << "Attribute " << name << " assigned to channel " << index << LL_ENDL;
|
||||
LL_DEBUGS("ShaderUniform") << "Attribute " << name << " assigned to channel " << index << LL_ENDL;
|
||||
}
|
||||
}
|
||||
if (attributes != NULL)
|
||||
|
|
@ -581,7 +581,7 @@ BOOL LLGLSLShader::mapAttributes(const std::vector<LLStaticHashedString> * attri
|
|||
if (index != -1)
|
||||
{
|
||||
mAttribute[LLShaderMgr::instance()->mReservedAttribs.size() + i] = index;
|
||||
LL_DEBUGS("ShaderLoading") << "Attribute " << name << " assigned to channel " << index << LL_ENDL;
|
||||
LL_DEBUGS("ShaderUniform") << "Attribute " << name << " assigned to channel " << index << LL_ENDL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -666,7 +666,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector<LLStaticHashedString> *
|
|||
mUniformNameMap[location] = name;
|
||||
mUniformMap[hashedName] = location;
|
||||
|
||||
LL_DEBUGS("ShaderLoading") << "Uniform " << name << " is at location " << location << LL_ENDL;
|
||||
LL_DEBUGS("ShaderUniform") << "Uniform " << name << " is at location " << location << LL_ENDL;
|
||||
|
||||
//find the index of this uniform
|
||||
for (S32 i = 0; i < (S32) LLShaderMgr::instance()->mReservedUniforms.size(); i++)
|
||||
|
|
@ -714,7 +714,7 @@ GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type)
|
|||
type == GL_SAMPLER_2D_MULTISAMPLE)
|
||||
{ //this here is a texture
|
||||
glUniform1iARB(location, mActiveTextureChannels);
|
||||
LL_DEBUGS("ShaderLoading") << "Assigned to texture channel " << mActiveTextureChannels << LL_ENDL;
|
||||
LL_DEBUGS("ShaderUniform") << "Assigned to texture channel " << mActiveTextureChannels << LL_ENDL;
|
||||
return mActiveTextureChannels++;
|
||||
}
|
||||
return -1;
|
||||
|
|
@ -858,7 +858,7 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms)
|
|||
|
||||
unbind();
|
||||
|
||||
LL_DEBUGS("ShaderLoading") << "Total Uniform Size: " << mTotalUniformSize << LL_ENDL;
|
||||
LL_DEBUGS("ShaderUniform") << "Total Uniform Size: " << mTotalUniformSize << LL_ENDL;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,19 +26,26 @@
|
|||
/*[EXTRA_CODE_HERE]*/
|
||||
|
||||
#ifdef DEFINE_GL_FRAGCOLOR
|
||||
out vec4 frag_color;
|
||||
out vec4 frag_data[3];
|
||||
#else
|
||||
#define frag_color gl_FragColor
|
||||
#define frag_data gl_FragData
|
||||
#endif
|
||||
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
VARYING vec2 screenpos;
|
||||
|
||||
uniform sampler2D diffuseMap;
|
||||
uniform sampler2D altDiffuseMap;
|
||||
uniform float blend_factor;
|
||||
uniform float custom_alpha;
|
||||
uniform vec4 sunlight_color;
|
||||
uniform float time;
|
||||
|
||||
float twinkle(){
|
||||
float d = fract(screenpos.x + screenpos.y);
|
||||
return abs(d);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
|
|
@ -46,6 +53,12 @@ void main()
|
|||
vec4 col_b = texture2D(diffuseMap, vary_texcoord0.xy);
|
||||
vec4 col = mix(col_b, col_a, blend_factor);
|
||||
col.rgb *= vertex_color.rgb;
|
||||
col.a *= custom_alpha;
|
||||
frag_color = col;
|
||||
col.a = (col.a * custom_alpha) * 8.0f;
|
||||
col.a += twinkle() * 2.0f;
|
||||
col.a = max(0.0f, col.a);
|
||||
|
||||
frag_data[0] = col;
|
||||
frag_data[1] = vec4(0.0f);
|
||||
frag_data[2] = vec4(0.0, 1.0, 0.0, 1.0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
uniform mat4 texture_matrix0;
|
||||
uniform mat4 modelview_projection_matrix;
|
||||
uniform float time;
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
ATTRIBUTE vec4 diffuse_color;
|
||||
|
|
@ -32,11 +33,14 @@ ATTRIBUTE vec2 texcoord0;
|
|||
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
VARYING vec2 screenpos;
|
||||
|
||||
void main()
|
||||
{
|
||||
//transform vertex
|
||||
gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
float t = mod(time, 1.25f);
|
||||
screenpos = position.xy * vec2(t, t);
|
||||
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
|
||||
vertex_color = diffuse_color;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@ static LLGLSLShader* sky_shader = NULL;
|
|||
static LLGLSLShader* sun_shader = NULL;
|
||||
static LLGLSLShader* moon_shader = NULL;
|
||||
|
||||
static float sStarTime;
|
||||
|
||||
LLDrawPoolWLSky::LLDrawPoolWLSky(void) :
|
||||
LLDrawPool(POOL_WL_SKY)
|
||||
{
|
||||
|
|
@ -235,10 +237,9 @@ void LLDrawPoolWLSky::renderStars(void) const
|
|||
// clamping and allow the star_alpha param to brighten the stars.
|
||||
LLColor4 star_alpha(LLColor4::black);
|
||||
|
||||
// *LAPRAS
|
||||
star_alpha.mV[3] = LLEnvironment::instance().getCurrentSky()->getStarBrightness() / (2.f + ((rand() >> 16)/65535.0f)); // twinkle twinkle
|
||||
|
||||
// If start_brightness is not set, exit
|
||||
star_alpha.mV[3] = LLEnvironment::instance().getCurrentSky()->getStarBrightness() / 512.f;
|
||||
|
||||
// If star brightness is not set, exit
|
||||
if( star_alpha.mV[3] < 0.001 )
|
||||
{
|
||||
LL_DEBUGS("SKY") << "star_brightness below threshold." << LL_ENDL;
|
||||
|
|
@ -298,9 +299,8 @@ void LLDrawPoolWLSky::renderStarsDeferred(void) const
|
|||
LLGLSPipelineSkyBox gls_sky;
|
||||
LLGLEnable blend(GL_BLEND);
|
||||
gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA);
|
||||
|
||||
// *LAPRAS
|
||||
F32 star_alpha = LLEnvironment::instance().getCurrentSky()->getStarBrightness() / (2.f + ((rand() >> 16)/65535.0f)); // twinkle twinkle
|
||||
|
||||
F32 star_alpha = LLEnvironment::instance().getCurrentSky()->getStarBrightness() / 512.0f;
|
||||
|
||||
// If start_brightness is not set, exit
|
||||
if(star_alpha < 0.001f)
|
||||
|
|
@ -337,6 +337,11 @@ void LLDrawPoolWLSky::renderStarsDeferred(void) const
|
|||
|
||||
gDeferredStarProgram.uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor);
|
||||
gDeferredStarProgram.uniform1f(sCustomAlpha, star_alpha);
|
||||
|
||||
sStarTime = (F32)LLFrameTimer::getElapsedSeconds() * 0.5f;
|
||||
|
||||
gDeferredStarProgram.uniform1f(LLShaderMgr::WATER_TIME, sStarTime);
|
||||
|
||||
gSky.mVOWLSkyp->drawStars();
|
||||
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@
|
|||
#include "llenvironment.h"
|
||||
#include "llatmosphere.h"
|
||||
|
||||
#pragma optimize("", off)
|
||||
|
||||
#ifdef LL_RELEASE_FOR_DOWNLOAD
|
||||
#define UNIFORM_ERRS LL_WARNS_ONCE("Shader")
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -59,6 +59,8 @@
|
|||
#undef min
|
||||
#undef max
|
||||
|
||||
#pragma optimize("", off)
|
||||
|
||||
namespace
|
||||
{
|
||||
const S32 NUM_TILES_X = 8;
|
||||
|
|
@ -376,6 +378,9 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
|
|||
mbCanSelect = FALSE;
|
||||
mUpdateTimer.reset();
|
||||
|
||||
mForceUpdateThrottle.setTimerExpirySec(UPDATE_EXPRY);
|
||||
mForceUpdateThrottle.reset();
|
||||
|
||||
for (S32 i = 0; i < 6; i++)
|
||||
{
|
||||
mSkyTex[i].init();
|
||||
|
|
@ -585,8 +590,7 @@ void LLVOSky::idleUpdate(LLAgent &agent, const F64 &time)
|
|||
}
|
||||
|
||||
bool LLVOSky::updateSky()
|
||||
{
|
||||
LLTimer forceupdThrottle;
|
||||
{
|
||||
LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
|
||||
|
||||
LLColor4 total_ambient = psky->getTotalAmbient();
|
||||
|
|
@ -640,15 +644,29 @@ bool LLVOSky::updateSky()
|
|||
bool light_direction_changed = (dot_lighting < LIGHT_DIRECTION_THRESHOLD);
|
||||
bool color_changed = (delta_color.length() >= COLOR_CHANGE_THRESHOLD);
|
||||
|
||||
mForceUpdate = mForceUpdate || light_direction_changed;
|
||||
mForceUpdate = mForceUpdate || color_changed;
|
||||
mForceUpdate = mForceUpdate || !mInitialized;
|
||||
if (light_direction_changed)
|
||||
{
|
||||
mForceUpdate = true;
|
||||
}
|
||||
|
||||
if (mForceUpdate && forceupdThrottle.hasExpired())
|
||||
if (color_changed)
|
||||
{
|
||||
mForceUpdate = true;
|
||||
}
|
||||
|
||||
if (!mInitialized)
|
||||
{
|
||||
mForceUpdate = true;
|
||||
}
|
||||
//mForceUpdate = mForceUpdate || light_direction_changed;
|
||||
//mForceUpdate = mForceUpdate || color_changed;
|
||||
//mForceUpdate = mForceUpdate || !mInitialized;
|
||||
|
||||
if (mForceUpdate && mForceUpdateThrottle.hasExpired())
|
||||
{
|
||||
LL_RECORD_BLOCK_TIME(FTM_VOSKY_UPDATEFORCED);
|
||||
|
||||
forceupdThrottle.setTimerExpirySec(UPDATE_EXPRY);
|
||||
mForceUpdateThrottle.setTimerExpirySec(UPDATE_EXPRY);
|
||||
|
||||
LLSkyTex::stepCurrent();
|
||||
|
||||
|
|
|
|||
|
|
@ -338,7 +338,7 @@ protected:
|
|||
S32 mDrawRefl;
|
||||
|
||||
LLFrameTimer mUpdateTimer;
|
||||
|
||||
LLTimer mForceUpdateThrottle;
|
||||
bool mHeavenlyBodyUpdated ;
|
||||
|
||||
LLAtmospherics m_legacyAtmospherics;
|
||||
|
|
|
|||
|
|
@ -637,7 +637,7 @@ BOOL LLVOWLSky::updateStarGeometry(LLDrawable *drawable)
|
|||
LLVector3 left = at%LLVector3(0,0,1);
|
||||
LLVector3 up = at%left;
|
||||
|
||||
F32 sc = 0.5f+ll_frand()*1.25f;
|
||||
F32 sc = 0.8f + ll_frand()*2.5f;
|
||||
left *= sc;
|
||||
up *= sc;
|
||||
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@
|
|||
layout="topleft"
|
||||
left_delta="5"
|
||||
min_val="0"
|
||||
max_val="2"
|
||||
max_val="512"
|
||||
name="star_brightness"
|
||||
top_delta="15"
|
||||
width="250"
|
||||
|
|
|
|||
Loading…
Reference in New Issue