Optimization pass.

This commit is contained in:
Shyotl
2018-08-07 01:09:53 -05:00
parent 71f3002717
commit d11899561b
25 changed files with 108 additions and 104 deletions

View File

@@ -1116,7 +1116,7 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8
LLVector3 source_to_target = target_pos - keyframe_source_pos;
S32 max_iteration_count = ll_round(clamp_rescale(
S32 max_iteration_count = ll_pos_round(clamp_rescale(
mCharacter->getPixelArea(),
MAX_PIXEL_AREA_CONSTRAINTS,
MIN_PIXEL_AREA_CONSTRAINTS,

View File

@@ -879,7 +879,7 @@ void LLMotionController::updateMotions(bool force_update)
// Moreover, just rounding off to the nearest integer with ll_round(update_time / mTimeStep) makes a lot more sense:
// it is the best we can do to get as close to what we should draw as possible.
// However, mAnimTime may only be incremented; therefore make sure of that with the llmax.
S32 quantum_count = llmax(ll_round(update_time / mTimeStep), llceil(mAnimTime / mTimeStep));
S32 quantum_count = llmax(ll_pos_round(update_time / mTimeStep), llceil(mAnimTime / mTimeStep));
//</singu>
if (quantum_count == mTimeStepCount)
{

View File

@@ -34,6 +34,17 @@
#include "stdtypes.h"
template<typename T>
inline void copyArray(T* dst, const T* src, const U32 bytes)
{
memcpy(dst, src, bytes);
}
template<>
inline void copyArray<>(LLVector4a* dst, const LLVector4a* src, const U32 bytes)
{
LLVector4a::memcpyNonAliased16(dst->getF32ptr(), src->getF32ptr(), bytes);
}
template <class Object> class LLStrider
{
union
@@ -69,7 +80,21 @@ public:
Object* operator +=(int i) { mBytep += mSkip*i; return mObjectp; }
Object& operator[](size_t index) { return *(Object*)(mBytep + (mSkip * index)); }
void copyArray(const U32 offset, const Object* src, const U32 length)
{
if (mSkip == sizeof(Object))
{
::copyArray(mObjectp + offset, src, length * sizeof(Object));
}
else
{
for (U32 i = 0; i < length; i++)
{
(*this)[offset + i] = src[i];
}
}
}
};
#endif // LL_LLSTRIDER_H

View File

@@ -1084,6 +1084,7 @@ void LLImageRaw::copyLineScaled( U8* in, U8* out, S32 in_pixel_len, S32 out_pixe
S32 goff = components >= 2 ? 1 : 0;
S32 boff = components >= 3 ? 2 : 0;
// This loop is awful.
for( S32 x = 0; x < out_pixel_len; x++ )
{
// Sample input pixels in range from sample0 to sample1.
@@ -1172,19 +1173,15 @@ void LLImageRaw::copyLineScaled( U8* in, U8* out, S32 in_pixel_len, S32 out_pixe
}
}
r *= norm_factor;
g *= norm_factor;
b *= norm_factor;
a *= norm_factor; // skip conditional
U8 arr[] = {
U8(ll_pos_round(r * norm_factor)),
U8(ll_pos_round(g * norm_factor)),
U8(ll_pos_round(b * norm_factor)),
U8(ll_pos_round(a * norm_factor))
}; // skip conditional
S32 t4 = x * out_pixel_step * components;
out[t4 + 0] = U8(ll_round(r));
if (components >= 2)
out[t4 + 1] = U8(ll_round(g));
if (components >= 3)
out[t4 + 2] = U8(ll_round(b));
if( components == 4)
out[t4 + 3] = U8(ll_round(a));
memcpy(out + t4, arr, sizeof(U8) * components);
}
}
}
@@ -1259,10 +1256,10 @@ void LLImageRaw::compositeRowScaled4onto3( U8* in, U8* out, S32 in_pixel_len, S3
b *= norm_factor;
a *= norm_factor;
in_scaled_r = U8(ll_round(r));
in_scaled_g = U8(ll_round(g));
in_scaled_b = U8(ll_round(b));
in_scaled_a = U8(ll_round(a));
in_scaled_r = U8(ll_pos_round(r));
in_scaled_g = U8(ll_pos_round(g));
in_scaled_b = U8(ll_pos_round(b));
in_scaled_a = U8(ll_pos_round(a));
}
if( in_scaled_a )

View File

@@ -179,6 +179,12 @@ inline S32 ll_round(const F32 val)
return (S32)round(val);
}
// Singu Note: Quick round for values that are known to be >= 0.
inline S32 ll_pos_round(const F32 val)
{
return val + .5f;
}
inline F32 ll_round(F32 val, F32 nearest)
{
return F32(round(val * (1.0f / nearest))) * nearest;

View File

@@ -559,7 +559,7 @@ void LLProfile::genNGon(const LLProfileParams& params, S32 sides, F32 offset, F3
// Scale to have size "match" scale. Compensates to get object to generally fill bounding box.
S32 total_sides = ll_round(sides / ang_scale); // Total number of sides all around
S32 total_sides = ll_pos_round(sides / ang_scale); // Total number of sides all around
if (total_sides < 8)
{

View File

@@ -124,11 +124,12 @@ LLColor4 LLColor4::cyan6(0.2f, 0.6f, 0.6f, 1.0f);
// conversion
LLColor4::operator const LLColor4U() const
{
// Singu Note: Some optimization has been done here.
return LLColor4U(
(U8)llclampb(ll_round(mV[VRED]*255.f)),
(U8)llclampb(ll_round(mV[VGREEN]*255.f)),
(U8)llclampb(ll_round(mV[VBLUE]*255.f)),
(U8)llclampb(ll_round(mV[VALPHA]*255.f)));
(U8)llmin((S32)(llmax(0.f,mV[VRED]*255.f) + .5f), 255),
(U8)llmin((S32)(llmax(0.f,mV[VGREEN]*255.f) + .5f), 255),
(U8)llmin((S32)(llmax(0.f,mV[VBLUE]*255.f) + .5f), 255),
(U8)llmin((S32)(llmax(0.f,mV[VALPHA]*255.f) + .5f), 255));
}
LLColor4::LLColor4(const LLColor3 &vec, F32 a)

View File

@@ -353,10 +353,10 @@ inline LLColor4U LLColor4U::multAll(const F32 k)
{
// Round to nearest
return LLColor4U(
(U8)ll_round(mV[VX] * k),
(U8)ll_round(mV[VY] * k),
(U8)ll_round(mV[VZ] * k),
(U8)ll_round(mV[VW] * k));
(U8)ll_pos_round(mV[VX] * k),
(U8)ll_pos_round(mV[VY] * k),
(U8)ll_pos_round(mV[VZ] * k),
(U8)ll_pos_round(mV[VW] * k));
}
/*
inline LLColor4U operator*(const LLColor4U &a, U8 k)
@@ -471,7 +471,7 @@ void LLColor4U::setVecScaleClamp(const LLColor4& color)
color_scale_factor /= max_color;
}
const S32 MAX_COLOR = 255;
S32 r = ll_round(color.mV[0] * color_scale_factor);
S32 r = ll_pos_round(color.mV[0] * color_scale_factor);
if (r > MAX_COLOR)
{
r = MAX_COLOR;
@@ -482,7 +482,7 @@ void LLColor4U::setVecScaleClamp(const LLColor4& color)
}
mV[0] = r;
S32 g = ll_round(color.mV[1] * color_scale_factor);
S32 g = ll_pos_round(color.mV[1] * color_scale_factor);
if (g > MAX_COLOR)
{
g = MAX_COLOR;
@@ -493,7 +493,7 @@ void LLColor4U::setVecScaleClamp(const LLColor4& color)
}
mV[1] = g;
S32 b = ll_round(color.mV[2] * color_scale_factor);
S32 b = ll_pos_round(color.mV[2] * color_scale_factor);
if (b > MAX_COLOR)
{
b = MAX_COLOR;
@@ -505,7 +505,7 @@ void LLColor4U::setVecScaleClamp(const LLColor4& color)
mV[2] = b;
// Alpha shouldn't be scaled, just clamped...
S32 a = ll_round(color.mV[3] * MAX_COLOR);
S32 a = ll_pos_round(color.mV[3] * MAX_COLOR);
if (a > MAX_COLOR)
{
a = MAX_COLOR;
@@ -527,7 +527,7 @@ void LLColor4U::setVecScaleClamp(const LLColor3& color)
}
const S32 MAX_COLOR = 255;
S32 r = ll_round(color.mV[0] * color_scale_factor);
S32 r = ll_pos_round(color.mV[0] * color_scale_factor);
if (r > MAX_COLOR)
{
r = MAX_COLOR;
@@ -539,7 +539,7 @@ void LLColor4U::setVecScaleClamp(const LLColor3& color)
}
mV[0] = r;
S32 g = ll_round(color.mV[1] * color_scale_factor);
S32 g = ll_pos_round(color.mV[1] * color_scale_factor);
if (g > MAX_COLOR)
{
g = MAX_COLOR;
@@ -551,7 +551,7 @@ void LLColor4U::setVecScaleClamp(const LLColor3& color)
}
mV[1] = g;
S32 b = ll_round(color.mV[2] * color_scale_factor);
S32 b = ll_pos_round(color.mV[2] * color_scale_factor);
if (b > MAX_COLOR)
{
b = MAX_COLOR;

View File

@@ -391,7 +391,7 @@ BOOL LLThrottleGroup::dynamicAdjust()
}
mBitsSentThisPeriod[i] = 0;
total += ll_round(mBitsSentHistory[i]);
total += ll_pos_round(mBitsSentHistory[i]);
}
// Look for busy channels

View File

@@ -184,8 +184,8 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, const F32 point_size,
mDescender = -mFTFace->descender * pixels_per_unit;
mLineHeight = mFTFace->height * pixels_per_unit;
S32 max_char_width = ll_round(0.5f + (x_max - x_min));
S32 max_char_height = ll_round(0.5f + (y_max - y_min));
S32 max_char_width = ll_pos_round(0.5f + (x_max - x_min));
S32 max_char_height = ll_pos_round(0.5f + (y_max - y_min));
mFontBitmapCachep->init(components, max_char_width, max_char_height);

View File

@@ -54,7 +54,7 @@ F32 LLFontGL::sScaleY = 1.f;
BOOL LLFontGL::sDisplayFont = TRUE ;
std::string LLFontGL::sAppDir;
LLColor4 LLFontGL::sShadowColor(0.f, 0.f, 0.f, 1.f);
LLColor4U LLFontGL::sShadowColor(0, 0, 0, 255);
LLFontRegistry* LLFontGL::sFontRegistry = NULL;
LLCoordGL LLFontGL::sCurOrigin;
@@ -218,10 +218,10 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
case LEFT:
break;
case RIGHT:
cur_x -= llmin(scaled_max_pixels, ll_round(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX));
cur_x -= llmin(scaled_max_pixels, ll_pos_round(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX));
break;
case HCENTER:
cur_x -= llmin(scaled_max_pixels, ll_round(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX)) / 2;
cur_x -= llmin(scaled_max_pixels, ll_pos_round(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX)) / 2;
break;
default:
break;
@@ -244,12 +244,12 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
if (use_ellipses && halign == LEFT)
{
// check for too long of a string
S32 string_width = ll_round(getWidthF32(wstr, begin_offset, max_chars) * sScaleX);
S32 string_width = ll_pos_round(getWidthF32(wstr, begin_offset, max_chars) * sScaleX);
if (string_width > scaled_max_pixels)
{
// use four dots for ellipsis width to generate padding
const LLWString dots(utf8str_to_wstring(std::string("....")));
scaled_max_pixels = llmax(0, scaled_max_pixels - ll_round(getWidthF32(dots.c_str())));
scaled_max_pixels = llmax(0, scaled_max_pixels - ll_pos_round(getWidthF32(dots.c_str())));
draw_ellipses = TRUE;
}
}
@@ -497,7 +497,7 @@ F32 LLFontGL::getDescenderHeight() const
F32 LLFontGL::getLineHeight() const
{
return (F32)ll_round(mFontFreetype->getLineHeight() / sScaleY);
return (F32)ll_pos_round(mFontFreetype->getLineHeight() / sScaleY);
}
S32 LLFontGL::getWidth(const std::string& utf8text, const S32 begin_offset, const S32 max_chars, BOOL use_embedded) const
@@ -508,7 +508,7 @@ S32 LLFontGL::getWidth(const std::string& utf8text, const S32 begin_offset, cons
S32 LLFontGL::getWidth(const LLWString& utf32text, const S32 begin_offset, const S32 max_chars, BOOL use_embedded) const
{
F32 width = getWidthF32(utf32text, begin_offset, max_chars, use_embedded);
return ll_round(width);
return ll_pos_round(width);
}
F32 LLFontGL::getWidthF32(const std::string& utf8text, const S32 begin_offset, const S32 max_chars, BOOL use_embedded) const
@@ -573,7 +573,7 @@ F32 LLFontGL::getWidthF32(const LLWString& utf32text, const S32 begin_offset, co
}
}
// Round after kerning.
cur_x = (F32)ll_round(cur_x);
cur_x = (F32)ll_pos_round(cur_x);
}
}
@@ -689,7 +689,7 @@ S32 LLFontGL::maxDrawableChars(const LLWString& utf32text, F32 max_pixels, S32 m
}
}
// Round after kerning.
cur_x = (F32)ll_round(cur_x);
cur_x = (F32)ll_pos_round(cur_x);
drawn_x = cur_x;
}
@@ -776,7 +776,7 @@ S32 LLFontGL::firstDrawableChar(const LLWString& utf32text, F32 max_pixels, S32
}
// Round after kerning.
total_width = (F32)ll_round(total_width);
total_width = (F32)ll_pos_round(total_width);
}
if (drawable_chars == 0)
@@ -863,7 +863,7 @@ S32 LLFontGL::charFromPixelOffset(const LLWString& utf32text, const S32 begin_of
// Round after kerning.
cur_x = (F32)ll_round(cur_x);
cur_x = (F32)ll_pos_round(cur_x);
}
@@ -1324,7 +1324,7 @@ void LLFontGL::drawGlyph(S32& glyph_count, LLVector4a* vertex_out, LLVector2* uv
}
else if (shadow == DROP_SHADOW_SOFT)
{
LLColor4U shadow_color = LLFontGL::sShadowColor;
LLColor4U& shadow_color = LLFontGL::sShadowColor;
shadow_color.mV[VALPHA] = U8(color.mV[VALPHA] * drop_shadow_strength * DROP_SHADOW_SOFT_STRENGTH);
for (S32 pass = 0; pass < 5; pass++)
{
@@ -1359,7 +1359,7 @@ void LLFontGL::drawGlyph(S32& glyph_count, LLVector4a* vertex_out, LLVector2* uv
}
else if (shadow == DROP_SHADOW)
{
LLColor4U shadow_color = LLFontGL::sShadowColor;
LLColor4U& shadow_color = LLFontGL::sShadowColor;
shadow_color.mV[VALPHA] = U8(color.mV[VALPHA] * drop_shadow_strength);
LLRectf screen_rect_shadow = screen_rect;
screen_rect_shadow.translate(1.f, -1.f);

View File

@@ -206,7 +206,8 @@ public:
static F32 sCurDepth;
static std::vector<std::pair<LLCoordGL, F32> > sOriginStack;
static LLColor4 sShadowColor;
// Singu Note: LLColor4U to avoid converting from LLColor4 to LLColor4U for every glyph(batch).
static LLColor4U sShadowColor;
static F32 sVertDPI;
static F32 sHorizDPI;

View File

@@ -2422,14 +2422,11 @@ void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, LLCo
mTexcoordsp[mCount] = mTexcoordsp[mCount - 1];
}
for (S32 i = 0; i < vert_count; i++)
{
mVerticesp[mCount] = verts[i];
mTexcoordsp[mCount] = uvs[i];
mColorsp[mCount] = colors[i];
mCount++;
}
// Singu Note: Batch copies instead of iterating.
mVerticesp.copyArray(mCount, verts, vert_count);
mTexcoordsp.copyArray(mCount, uvs, vert_count);
mColorsp.copyArray(mCount, colors, vert_count);
mCount += vert_count;
mVerticesp[mCount] = mVerticesp[mCount-1];
mTexcoordsp[mCount] = mTexcoordsp[mCount-1];

View File

@@ -440,8 +440,8 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex
F32 image_width = image->getWidth(0);
F32 image_height = image->getHeight(0);
S32 image_natural_width = ll_round(image_width * uv_width);
S32 image_natural_height = ll_round(image_height * uv_height);
S32 image_natural_width = ll_pos_round(image_width * uv_width);
S32 image_natural_height = ll_pos_round(image_height * uv_height);
LLRectf draw_center_rect( uv_center_rect.mLeft * image_width,
uv_center_rect.mTop * image_height,
@@ -680,8 +680,8 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
ui_translation.mV[VY] += y;
ui_translation.scaleVec(ui_scale);
S32 index = 0;
S32 scaled_width = ll_round(width * ui_scale.mV[VX]);
S32 scaled_height = ll_round(height * ui_scale.mV[VY]);
S32 scaled_width = ll_pos_round(width * ui_scale.mV[VX]);
S32 scaled_height = ll_pos_round(height * ui_scale.mV[VY]);
uv[index] = LLVector2(uv_rect.mLeft, uv_rect.mTop);
pos[index].set(ui_translation.mV[VX], ui_translation.mV[VY] + scaled_height, 0.f);

View File

@@ -149,13 +149,13 @@ void LLUIImage::draw3D(const LLVector3& origin_agent, const LLVector3& x_axis, c
S32 LLUIImage::getWidth() const
{
// return clipped dimensions of actual image area
return ll_round((F32)mImage->getWidth(0) * mClipRegion.getWidth());
return ll_pos_round((F32)mImage->getWidth(0) * mClipRegion.getWidth());
}
S32 LLUIImage::getHeight() const
{
// return clipped dimensions of actual image area
return ll_round((F32)mImage->getHeight(0) * mClipRegion.getHeight());
return ll_pos_round((F32)mImage->getHeight(0) * mClipRegion.getHeight());
}
S32 LLUIImage::getTextureWidth() const

View File

@@ -594,7 +594,7 @@ BOOL LLAccordionCtrl::autoScroll (S32 x, S32 y)
// autoscroll region should take up no more than one third of visible scroller area
S32 auto_scroll_region_height = llmin(rect_local.getHeight() / 3, 10);
S32 auto_scroll_speed = ll_round(mAutoScrollRate * LLFrameTimer::getFrameDeltaTimeF32());
S32 auto_scroll_speed = ll_pos_round(mAutoScrollRate * LLFrameTimer::getFrameDeltaTimeF32());
LLRect bottom_scroll_rect = screen_local_extents;
bottom_scroll_rect.mTop = rect_local.mBottom + auto_scroll_region_height;

View File

@@ -158,8 +158,8 @@ void LLUI::cleanupClass()
void LLUI::setMousePositionScreen(S32 x, S32 y)
{
S32 screen_x, screen_y;
screen_x = ll_round((F32)x * getScaleFactor().mV[VX]);
screen_y = ll_round((F32)y * getScaleFactor().mV[VY]);
screen_x = ll_pos_round((F32)x * getScaleFactor().mV[VX]);
screen_y = ll_pos_round((F32)y * getScaleFactor().mV[VY]);
LLView::getWindow()->setCursorPosition(LLCoordGL(screen_x, screen_y).convert());
}
@@ -170,8 +170,8 @@ void LLUI::getMousePositionScreen(S32 *x, S32 *y)
LLCoordWindow cursor_pos_window;
getWindow()->getCursorPosition(&cursor_pos_window);
LLCoordGL cursor_pos_gl(cursor_pos_window.convert());
*x = ll_round((F32)cursor_pos_gl.mX / getScaleFactor().mV[VX]);
*y = ll_round((F32)cursor_pos_gl.mY / getScaleFactor().mV[VX]);
*x = ll_pos_round((F32)cursor_pos_gl.mX / getScaleFactor().mV[VX]);
*y = ll_pos_round((F32)cursor_pos_gl.mY / getScaleFactor().mV[VX]);
}
//static

View File

@@ -69,23 +69,6 @@ vec3 decode_normal(vec2 enc);
vec4 getPosition(vec2 pos_screen);
float calcShadow( sampler2DShadow shadowMap, vec4 stc, vec2 res, vec2 pos_screen )
{
//stc.x += (((texture2D(noiseMap, pos_screen/128.0).x)-.5)/shadow_res.x); //Random dither.
vec2 off = vec2(1,1.5)/res;
stc.x = floor(stc.x*res.x + fract(pos_screen.y*(1.0/kern_scale.y)*0.5))*off.x;
float shadow = shadow2D(shadowMap, stc.xyz).x; // cs
shadow += shadow2D(shadowMap, stc.xyz+vec3(off.x*2.0, off.y, 0.0)).x;
shadow += shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x;
shadow += shadow2D(shadowMap, stc.xyz+vec3(-off.x*2.0, off.y, 0.0)).x;
shadow += shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)).x;
return shadow;
}
float calcShadow( sampler2DShadow shadowMap, vec4 stc, vec2 res, vec2 pos_screen )
{
//stc.x += (((texture2D(noiseMap, pos_screen/128.0).x)-.5)/shadow_res.x); //Random dither.

View File

@@ -1355,16 +1355,10 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
if(mShinyInAlpha)
{
GLfloat alpha[4] =
{
0.00f,
0.25f,
0.5f,
0.75f
};
// Singu Note: Avoid casing. Store as LLColor4U.
static const LLColor4U shine_steps(LLColor4(0.f, .25f, .5f, 7.5f));
llassert(tep->getShiny() <= 3);
color.mV[3] = U8 (alpha[tep->getShiny()] * 255);
color.mV[3] = shine_steps.mV[tep->getShiny()];
}
}

View File

@@ -565,7 +565,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
if(std::find(LLFloaterBlacklist::blacklist_objects.begin(),
LLFloaterBlacklist::blacklist_objects.end(),fullid) != LLFloaterBlacklist::blacklist_objects.end())
{
LL_INFOS() << "Blacklisted object asset " << fullid.asString() << " blocked." << LL_ENDL;
//LL_INFOS() << "Blacklisted object asset " << fullid.asString() << " blocked." << LL_ENDL;
continue;
}

View File

@@ -5786,7 +5786,6 @@ void LLViewerWindow::calcDisplayScale()
LLVector2 LLViewerWindow::getUIScale() const
{
LL_INFOS() << "getUIScale" << LL_ENDL;
static LLCachedControl<F32> ui_scale_factor("UIScaleFactor");
if (mWindow->getFullscreen())
{

View File

@@ -2647,7 +2647,7 @@ void LLVivoxVoiceClient::sendPositionalUpdate(void)
if(!p->mIsSelf)
{
// scale from the range 0.0-1.0 to vivox volume in the range 0-100
S32 volume = ll_round(p->mVolume / VOLUME_SCALE_VIVOX);
S32 volume = ll_pos_round(p->mVolume / VOLUME_SCALE_VIVOX);
bool mute = p->mOnMuteList;
if(mute)

View File

@@ -216,7 +216,8 @@ LLSkyTex::LLSkyTex() :
void LLSkyTex::init()
{
mSkyData = new LLColor4[sResolution * sResolution];
// Singu Note: Store as unsigned to avoid casting.
mSkyData = new LLColor4U[sResolution * sResolution];
mSkyDirs = new LLVector3[sResolution * sResolution];
for (S32 i = 0; i < 2; ++i)
@@ -286,8 +287,7 @@ void LLSkyTex::create(const F32 brightness)
const S32 basic_offset = (i * sResolution + j);
S32 offset = basic_offset * sComponents;
U32* pix = (U32*)(data + offset);
LLColor4U temp = LLColor4U(mSkyData[basic_offset]);
*pix = temp.mAll;
*pix = mSkyData[basic_offset].mAll;
}
}
createGLImage(sCurrent);

View File

@@ -118,7 +118,8 @@ private:
static S32 sComponents;
LLPointer<LLViewerTexture> mTexture[2];
LLPointer<LLImageRaw> mImageRaw[2];
LLColor4 *mSkyData;
// Singu Note: Store as unsigned to avoid casting.
LLColor4U *mSkyData;
LLVector3 *mSkyDirs; // Cache of sky direction vectors
static S32 sCurrent;
static F32 sInterpVal;

View File

@@ -267,7 +267,7 @@ std::string LLWLAnimator::timeToString(F32 curTime)
// get hours and minutes
hours = (S32) (24.0 * curTime);
curTime -= ((F32) hours / 24.0f);
min = ll_round(24.0f * 60.0f * curTime);
min = ll_pos_round(24.0f * 60.0f * curTime);
// handle case where it's 60
if(min == 60)