Merge branch 'DRTVWR-559' of https://github.com/secondlife/viewer
# Conflicts: # indra/llrender/llimagegl.cpp # indra/llrender/llrender.cpp # indra/llrender/llvertexbuffer.cpp # indra/llrender/llvertexbuffer.h # indra/newview/app_settings/settings.xml # indra/newview/llappviewer.cpp # indra/newview/lldrawpool.cpp # indra/newview/lldrawpoolalpha.cpp # indra/newview/lldrawpoolavatar.cpp # indra/newview/lldrawpoolbump.cpp # indra/newview/lldrawpooltree.cpp # indra/newview/llface.cpp # indra/newview/llmodelpreview.cpp # indra/newview/llspatialpartition.h # indra/newview/llviewerdisplay.cpp # indra/newview/llviewertexturelist.cpp # indra/newview/llviewerwindow.cpp # indra/newview/llvovolume.cpp # indra/newview/pipeline.cppmaster
commit
b4fde14f09
|
|
@ -27,6 +27,7 @@
|
|||
#include "linden_common.h"
|
||||
|
||||
#include "llmaterial.h"
|
||||
#include "llmd5.h"
|
||||
|
||||
/**
|
||||
* Materials cap parameters
|
||||
|
|
@ -475,4 +476,16 @@ U32 LLMaterial::getShaderMask(U32 alpha_mode)
|
|||
return ret;
|
||||
}
|
||||
|
||||
LLUUID LLMaterial::getHash() const
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
|
||||
LLMD5 md5;
|
||||
// HACK - hash the bytes of this LLMaterial, but trim off the S32 in LLRefCount
|
||||
md5.update((unsigned char*)this + sizeof(S32), sizeof(this) - sizeof(S32));
|
||||
md5.finalize();
|
||||
LLUUID id;
|
||||
md5.raw_digest(id.mData);
|
||||
// *TODO: Hash the overrides
|
||||
return id;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@ public:
|
|||
bool operator != (const LLMaterial& rhs) const;
|
||||
|
||||
U32 getShaderMask(U32 alpha_mode = DIFFUSE_ALPHA_MODE_DEFAULT);
|
||||
LLUUID getHash() const;
|
||||
|
||||
protected:
|
||||
LLUUID mNormalID;
|
||||
|
|
|
|||
|
|
@ -2398,234 +2398,39 @@ void LLGLState::dumpStates()
|
|||
}
|
||||
}
|
||||
|
||||
void LLGLState::checkStates(const std::string& msg)
|
||||
void LLGLState::checkStates(GLboolean writeAlpha)
|
||||
{
|
||||
if (!gDebugGL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
stop_glerror();
|
||||
|
||||
GLint src;
|
||||
GLint dst;
|
||||
glGetIntegerv(GL_BLEND_SRC, &src);
|
||||
glGetIntegerv(GL_BLEND_DST, &dst);
|
||||
|
||||
stop_glerror();
|
||||
|
||||
BOOL error = FALSE;
|
||||
|
||||
/*if (src != GL_SRC_ALPHA || dst != GL_ONE_MINUS_SRC_ALPHA)
|
||||
{
|
||||
if (gDebugSession)
|
||||
{
|
||||
gFailLog << "Blend function corrupted: " << std::hex << src << " " << std::hex << dst << " " << msg << std::dec << std::endl;
|
||||
error = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_GL_ERRS << "Blend function corrupted: " << std::hex << src << " " << std::hex << dst << " " << msg << std::dec << LL_ENDL;
|
||||
}
|
||||
}*/
|
||||
llassert_always(src == GL_SRC_ALPHA);
|
||||
llassert_always(dst == GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
GLboolean colorMask[4];
|
||||
glGetBooleanv(GL_COLOR_WRITEMASK, colorMask);
|
||||
llassert_always(colorMask[0]);
|
||||
llassert_always(colorMask[1]);
|
||||
llassert_always(colorMask[2]);
|
||||
llassert_always(colorMask[3] == writeAlpha);
|
||||
|
||||
for (boost::unordered_map<LLGLenum, LLGLboolean>::iterator iter = sStateMap.begin();
|
||||
iter != sStateMap.end(); ++iter)
|
||||
{
|
||||
LLGLenum state = iter->first;
|
||||
LLGLboolean cur_state = iter->second;
|
||||
stop_glerror();
|
||||
LLGLboolean gl_state = glIsEnabled(state);
|
||||
stop_glerror();
|
||||
if(cur_state != gl_state)
|
||||
{
|
||||
dumpStates();
|
||||
if (gDebugSession)
|
||||
{
|
||||
gFailLog << llformat("LLGLState error. State: 0x%04x",state) << std::endl;
|
||||
error = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_GL_ERRS << llformat("LLGLState error. State: 0x%04x",state) << LL_ENDL;
|
||||
}
|
||||
LL_GL_ERRS << llformat("LLGLState error. State: 0x%04x",state) << LL_ENDL;
|
||||
}
|
||||
}
|
||||
|
||||
if (error)
|
||||
{
|
||||
ll_fail("LLGLState::checkStates failed.");
|
||||
}
|
||||
stop_glerror();
|
||||
}
|
||||
|
||||
void LLGLState::checkTextureChannels(const std::string& msg)
|
||||
{
|
||||
#if 0
|
||||
if (!gDebugGL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
stop_glerror();
|
||||
|
||||
GLint activeTexture;
|
||||
glGetIntegerv(GL_ACTIVE_TEXTURE, &activeTexture);
|
||||
stop_glerror();
|
||||
|
||||
BOOL error = FALSE;
|
||||
|
||||
if (activeTexture == GL_TEXTURE0)
|
||||
{
|
||||
GLint tex_env_mode = 0;
|
||||
|
||||
glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &tex_env_mode);
|
||||
stop_glerror();
|
||||
|
||||
if (tex_env_mode != GL_MODULATE)
|
||||
{
|
||||
error = TRUE;
|
||||
LL_WARNS("RenderState") << "GL_TEXTURE_ENV_MODE invalid: " << std::hex << tex_env_mode << std::dec << LL_ENDL;
|
||||
if (gDebugSession)
|
||||
{
|
||||
gFailLog << "GL_TEXTURE_ENV_MODE invalid: " << std::hex << tex_env_mode << std::dec << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const char* label[] =
|
||||
{
|
||||
"GL_TEXTURE_2D",
|
||||
"GL_TEXTURE_COORD_ARRAY",
|
||||
"GL_TEXTURE_1D",
|
||||
"GL_TEXTURE_CUBE_MAP",
|
||||
"GL_TEXTURE_GEN_S",
|
||||
"GL_TEXTURE_GEN_T",
|
||||
"GL_TEXTURE_GEN_Q",
|
||||
"GL_TEXTURE_GEN_R",
|
||||
"GL_TEXTURE_RECTANGLE",
|
||||
"GL_TEXTURE_2D_MULTISAMPLE"
|
||||
};
|
||||
|
||||
static GLint value[] =
|
||||
{
|
||||
GL_TEXTURE_2D,
|
||||
GL_TEXTURE_COORD_ARRAY,
|
||||
GL_TEXTURE_1D,
|
||||
GL_TEXTURE_CUBE_MAP,
|
||||
GL_TEXTURE_GEN_S,
|
||||
GL_TEXTURE_GEN_T,
|
||||
GL_TEXTURE_GEN_Q,
|
||||
GL_TEXTURE_GEN_R,
|
||||
GL_TEXTURE_RECTANGLE,
|
||||
GL_TEXTURE_2D_MULTISAMPLE
|
||||
};
|
||||
|
||||
GLint stackDepth = 0;
|
||||
|
||||
glh::matrix4f mat;
|
||||
glh::matrix4f identity;
|
||||
identity.identity();
|
||||
|
||||
for (GLint i = 1; i < gGLManager.mNumTextureImageUnits; i++)
|
||||
{
|
||||
gGL.getTexUnit(i)->activate();
|
||||
|
||||
if (i < gGLManager.mNumTextureUnits)
|
||||
{
|
||||
glClientActiveTexture(GL_TEXTURE0+i);
|
||||
stop_glerror();
|
||||
glGetIntegerv(GL_TEXTURE_STACK_DEPTH, &stackDepth);
|
||||
stop_glerror();
|
||||
|
||||
if (stackDepth != 1)
|
||||
{
|
||||
error = TRUE;
|
||||
LL_WARNS("RenderState") << "Texture matrix stack corrupted." << LL_ENDL;
|
||||
|
||||
if (gDebugSession)
|
||||
{
|
||||
gFailLog << "Texture matrix stack corrupted." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
glGetFloatv(GL_TEXTURE_MATRIX, (GLfloat*) mat.m);
|
||||
stop_glerror();
|
||||
|
||||
if (mat != identity)
|
||||
{
|
||||
error = TRUE;
|
||||
LL_WARNS("RenderState") << "Texture matrix in channel " << i << " corrupt." << LL_ENDL;
|
||||
if (gDebugSession)
|
||||
{
|
||||
gFailLog << "Texture matrix in channel " << i << " corrupt." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
for (S32 j = (i == 0 ? 1 : 0);
|
||||
j < 9; j++)
|
||||
{
|
||||
if (glIsEnabled(value[j]))
|
||||
{
|
||||
error = TRUE;
|
||||
LL_WARNS("RenderState") << "Texture channel " << i << " still has " << label[j] << " enabled." << LL_ENDL;
|
||||
if (gDebugSession)
|
||||
{
|
||||
gFailLog << "Texture channel " << i << " still has " << label[j] << " enabled." << std::endl;
|
||||
}
|
||||
}
|
||||
stop_glerror();
|
||||
}
|
||||
|
||||
glGetFloatv(GL_TEXTURE_MATRIX, mat.m);
|
||||
stop_glerror();
|
||||
|
||||
if (mat != identity)
|
||||
{
|
||||
error = TRUE;
|
||||
LL_WARNS("RenderState") << "Texture matrix " << i << " is not identity." << LL_ENDL;
|
||||
if (gDebugSession)
|
||||
{
|
||||
gFailLog << "Texture matrix " << i << " is not identity." << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
GLint tex = 0;
|
||||
stop_glerror();
|
||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, &tex);
|
||||
stop_glerror();
|
||||
|
||||
if (tex != 0)
|
||||
{
|
||||
error = TRUE;
|
||||
LL_WARNS("RenderState") << "Texture channel " << i << " still has texture " << tex << " bound." << LL_ENDL;
|
||||
|
||||
if (gDebugSession)
|
||||
{
|
||||
gFailLog << "Texture channel " << i << " still has texture " << tex << " bound." << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stop_glerror();
|
||||
gGL.getTexUnit(0)->activate();
|
||||
glClientActiveTexture(GL_TEXTURE0);
|
||||
stop_glerror();
|
||||
|
||||
if (error)
|
||||
{
|
||||
if (gDebugSession)
|
||||
{
|
||||
ll_fail("LLGLState::checkTextureChannels failed.");
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_GL_ERRS << "GL texture state corruption detected. " << msg << LL_ENDL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -241,9 +241,12 @@ public:
|
|||
|
||||
static void resetTextureStates();
|
||||
static void dumpStates();
|
||||
static void checkStates(const std::string& msg = "");
|
||||
static void checkTextureChannels(const std::string& msg = "");
|
||||
|
||||
|
||||
// make sure GL blend function, GL states, and GL color mask match
|
||||
// what we expect
|
||||
// writeAlpha - whether or not writing to alpha channel is expected
|
||||
static void checkStates(GLboolean writeAlpha = GL_TRUE);
|
||||
|
||||
protected:
|
||||
static boost::unordered_map<LLGLenum, LLGLboolean> sStateMap;
|
||||
|
||||
|
|
|
|||
|
|
@ -154,15 +154,33 @@ void LLGLSLShader::finishProfile(bool emit_report)
|
|||
|
||||
std::sort(sorted.begin(), sorted.end(), LLGLSLShaderCompareTimeElapsed());
|
||||
|
||||
bool unbound = false;
|
||||
for (std::vector<LLGLSLShader*>::iterator iter = sorted.begin(); iter != sorted.end(); ++iter)
|
||||
{
|
||||
(*iter)->dumpStats();
|
||||
if ((*iter)->mBinds == 0)
|
||||
{
|
||||
unbound = true;
|
||||
}
|
||||
}
|
||||
|
||||
LL_INFOS() << "-----------------------------------" << LL_ENDL;
|
||||
LL_INFOS() << "Total rendering time: " << llformat("%.4f ms", sTotalTimeElapsed / 1000000.f) << LL_ENDL;
|
||||
LL_INFOS() << "Total samples drawn: " << llformat("%.4f million", sTotalSamplesDrawn / 1000000.f) << LL_ENDL;
|
||||
LL_INFOS() << "Total triangles drawn: " << llformat("%.3f million", sTotalTrianglesDrawn / 1000000.f) << LL_ENDL;
|
||||
LL_INFOS() << "-----------------------------------" << LL_ENDL;
|
||||
|
||||
if (unbound)
|
||||
{
|
||||
LL_INFOS() << "The following shaders were unused: " << LL_ENDL;
|
||||
for (std::vector<LLGLSLShader*>::iterator iter = sorted.begin(); iter != sorted.end(); ++iter)
|
||||
{
|
||||
if ((*iter)->mBinds == 0)
|
||||
{
|
||||
LL_INFOS() << (*iter)->mName << LL_ENDL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -987,6 +1005,8 @@ void LLGLSLShader::bind()
|
|||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
|
||||
|
||||
llassert(mProgramObject != 0);
|
||||
|
||||
gGL.flush();
|
||||
|
||||
if (sCurBoundShader != mProgramObject) // Don't re-bind current shader
|
||||
|
|
@ -1000,6 +1020,7 @@ void LLGLSLShader::bind()
|
|||
sCurBoundShader = mProgramObject;
|
||||
sCurBoundShaderPtr = this;
|
||||
placeProfileQuery();
|
||||
LLVertexBuffer::setupClientArrays(mAttributeMask);
|
||||
}
|
||||
|
||||
if (mUniformsDirty)
|
||||
|
|
|
|||
|
|
@ -1404,9 +1404,53 @@ void LLImageGL::setManualImage(U32 target, S32 miplevel, S32 intformat, S32 widt
|
|||
stop_glerror();
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_TEXTURE("glTexImage2D");
|
||||
LL_PROFILE_ZONE_NUM(width);
|
||||
LL_PROFILE_ZONE_NUM(height);
|
||||
|
||||
free_cur_tex_image();
|
||||
#if 0
|
||||
glTexImage2D(target, miplevel, intformat, width, height, 0, pixformat, pixtype, use_scratch ? scratch : pixels);
|
||||
#else
|
||||
// break up calls to a manageable size for the GL command buffer
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED("glTexImage2D alloc");
|
||||
glTexImage2D(target, miplevel, intformat, width, height, 0, pixformat, pixtype, nullptr);
|
||||
}
|
||||
|
||||
U8* src = (U8*)(use_scratch ? scratch : pixels);
|
||||
if (src)
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED("glTexImage2D copy");
|
||||
U32 components = dataFormatComponents(pixformat);
|
||||
U32 type_width = 0;
|
||||
|
||||
switch (pixtype)
|
||||
{
|
||||
case GL_UNSIGNED_BYTE:
|
||||
case GL_BYTE:
|
||||
type_width = 1;
|
||||
break;
|
||||
case GL_UNSIGNED_SHORT:
|
||||
case GL_SHORT:
|
||||
type_width = 2;
|
||||
break;
|
||||
case GL_UNSIGNED_INT:
|
||||
case GL_INT:
|
||||
case GL_FLOAT:
|
||||
type_width = 4;
|
||||
break;
|
||||
default:
|
||||
LL_ERRS() << "Unknown type: " << pixtype << LL_ENDL;
|
||||
}
|
||||
|
||||
U32 line_width = width * components * type_width;
|
||||
for (U32 y = 0; y < height; ++y)
|
||||
{
|
||||
glTexSubImage2D(target, miplevel, 0, y, width, 1, pixformat, pixtype, src);
|
||||
src += line_width;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
alloc_tex_image(width, height, pixformat);
|
||||
}
|
||||
stop_glerror();
|
||||
|
|
|
|||
|
|
@ -164,13 +164,10 @@ void LLTexUnit::enable(eTextureType type)
|
|||
|
||||
if ( (mCurrTexType != type || gGL.mDirty) && (type != TT_NONE) )
|
||||
{
|
||||
stop_glerror();
|
||||
activate();
|
||||
stop_glerror();
|
||||
if (mCurrTexType != TT_NONE && !gGL.mDirty)
|
||||
{
|
||||
disable(); // Force a disable of a previous texture type if it's enabled.
|
||||
stop_glerror();
|
||||
}
|
||||
mCurrTexType = type;
|
||||
|
||||
|
|
@ -184,11 +181,7 @@ void LLTexUnit::disable(void)
|
|||
|
||||
if (mCurrTexType != TT_NONE)
|
||||
{
|
||||
activate();
|
||||
unbind(mCurrTexType);
|
||||
gGL.flush();
|
||||
setTextureColorSpace(TCS_LINEAR);
|
||||
|
||||
mCurrTexType = TT_NONE;
|
||||
}
|
||||
}
|
||||
|
|
@ -196,7 +189,7 @@ void LLTexUnit::disable(void)
|
|||
void LLTexUnit::bindFast(LLTexture* texture)
|
||||
{
|
||||
LLImageGL* gl_tex = texture->getGLTexture();
|
||||
|
||||
texture->setActive();
|
||||
glActiveTexture(GL_TEXTURE0 + mIndex);
|
||||
gGL.mCurrTextureUnitIndex = mIndex;
|
||||
mCurrTexture = gl_tex->getTexName();
|
||||
|
|
@ -894,12 +887,11 @@ void LLRender::init(bool needs_vertex_buffer)
|
|||
// necessary for reflection maps
|
||||
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
|
||||
|
||||
if (sGLCoreProfile && !LLVertexBuffer::sUseVAO)
|
||||
{ //bind a dummy vertex array object so we're core profile compliant
|
||||
U32 ret;
|
||||
glGenVertexArrays(1, &ret);
|
||||
glBindVertexArray(ret);
|
||||
}
|
||||
{ //bind a dummy vertex array object so we're core profile compliant
|
||||
U32 ret;
|
||||
glGenVertexArrays(1, &ret);
|
||||
glBindVertexArray(ret);
|
||||
}
|
||||
|
||||
if (needs_vertex_buffer)
|
||||
{
|
||||
|
|
@ -921,10 +913,10 @@ void LLRender::initVertexBuffer()
|
|||
{
|
||||
llassert_always(mBuffer.isNull()) ;
|
||||
stop_glerror();
|
||||
mBuffer = new LLVertexBuffer(immediate_mask, 0);
|
||||
mBuffer = new LLVertexBuffer(immediate_mask);
|
||||
// <FS:Ansariel> Warn in case of allocation failure
|
||||
//mBuffer->allocateBuffer(4096, 0, TRUE);
|
||||
if (!mBuffer->allocateBuffer(4096, 0, true))
|
||||
//mBuffer->allocateBuffer(4096, 0);
|
||||
if (!mBuffer->allocateBuffer(4096, 0))
|
||||
{
|
||||
// If this doesn't work, we're knee-deep in trouble!
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer for common rendering" << LL_ENDL;
|
||||
|
|
@ -1646,6 +1638,7 @@ void LLRender::flush()
|
|||
if (mCount > 0)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE;
|
||||
llassert(LLGLSLShader::sCurBoundShaderPtr != nullptr);
|
||||
if (!mUIOffset.empty())
|
||||
{
|
||||
sUICalls++;
|
||||
|
|
@ -1735,8 +1728,11 @@ void LLRender::flush()
|
|||
else
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("vb cache miss");
|
||||
vb = new LLVertexBuffer(attribute_mask, GL_STATIC_DRAW);
|
||||
vb->allocateBuffer(count, 0, true);
|
||||
vb = new LLVertexBuffer(attribute_mask);
|
||||
vb->allocateBuffer(count, 0);
|
||||
|
||||
vb->setBuffer();
|
||||
|
||||
vb->setPositionData((LLVector4a*) mVerticesp.get());
|
||||
|
||||
if (attribute_mask & LLVertexBuffer::MAP_TEXCOORD0)
|
||||
|
|
@ -1777,7 +1773,7 @@ void LLRender::flush()
|
|||
}
|
||||
}
|
||||
|
||||
vb->setBuffer(attribute_mask);
|
||||
vb->setBuffer();
|
||||
|
||||
// <FS:Ansariel> Remove QUADS rendering mode
|
||||
//if (mMode == LLRender::QUADS && sGLCoreProfile)
|
||||
|
|
@ -2089,8 +2085,7 @@ void LLRender::texCoord2fv(const GLfloat* tc)
|
|||
|
||||
void LLRender::color4ub(const GLubyte& r, const GLubyte& g, const GLubyte& b, const GLubyte& a)
|
||||
{
|
||||
if (!LLGLSLShader::sCurBoundShaderPtr ||
|
||||
LLGLSLShader::sCurBoundShaderPtr->mAttributeMask & LLVertexBuffer::MAP_COLOR)
|
||||
if (!LLGLSLShader::sCurBoundShaderPtr || LLGLSLShader::sCurBoundShaderPtr->mAttributeMask & LLVertexBuffer::MAP_COLOR)
|
||||
{
|
||||
mColorsp[mCount] = LLColor4U(r,g,b,a);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ class LLRender
|
|||
friend class LLTexUnit;
|
||||
public:
|
||||
|
||||
enum eTexIndex
|
||||
enum eTexIndex : U8
|
||||
{
|
||||
DIFFUSE_MAP = 0,
|
||||
ALTERNATE_DIFFUSE_MAP = 1,
|
||||
|
|
@ -296,14 +296,15 @@ public:
|
|||
NUM_TEXTURE_CHANNELS = 3,
|
||||
};
|
||||
|
||||
enum eVolumeTexIndex
|
||||
enum eVolumeTexIndex : U8
|
||||
{
|
||||
LIGHT_TEX = 0,
|
||||
SCULPT_TEX,
|
||||
NUM_VOLUME_TEXTURE_CHANNELS,
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
enum eGeomModes : U8
|
||||
{
|
||||
TRIANGLES = 0,
|
||||
TRIANGLE_STRIP,
|
||||
TRIANGLE_FAN,
|
||||
|
|
@ -314,9 +315,9 @@ public:
|
|||
//QUADS,
|
||||
LINE_LOOP,
|
||||
NUM_MODES
|
||||
} eGeomModes;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
enum eCompareFunc : U8
|
||||
{
|
||||
CF_NEVER = 0,
|
||||
CF_ALWAYS,
|
||||
|
|
@ -327,9 +328,9 @@ public:
|
|||
CF_GREATER_EQUAL,
|
||||
CF_GREATER,
|
||||
CF_DEFAULT
|
||||
} eCompareFunc;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
enum eBlendType : U8
|
||||
{
|
||||
BT_ALPHA = 0,
|
||||
BT_ADD,
|
||||
|
|
@ -338,25 +339,26 @@ public:
|
|||
BT_MULT_ALPHA,
|
||||
BT_MULT_X2,
|
||||
BT_REPLACE
|
||||
} eBlendType;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
// WARNING: this MUST match the LL_PART_BF enum in LLPartData, so set values explicitly in case someone
|
||||
// decides to add more or reorder them
|
||||
enum eBlendFactor : U8
|
||||
{
|
||||
BF_ONE = 0,
|
||||
BF_ZERO,
|
||||
BF_DEST_COLOR,
|
||||
BF_SOURCE_COLOR,
|
||||
BF_ONE_MINUS_DEST_COLOR,
|
||||
BF_ONE_MINUS_SOURCE_COLOR,
|
||||
BF_DEST_ALPHA,
|
||||
BF_SOURCE_ALPHA,
|
||||
BF_ONE_MINUS_DEST_ALPHA,
|
||||
BF_ONE_MINUS_SOURCE_ALPHA,
|
||||
|
||||
BF_ZERO = 1,
|
||||
BF_DEST_COLOR = 2,
|
||||
BF_SOURCE_COLOR = 3,
|
||||
BF_ONE_MINUS_DEST_COLOR = 4,
|
||||
BF_ONE_MINUS_SOURCE_COLOR = 5,
|
||||
BF_DEST_ALPHA = 6,
|
||||
BF_SOURCE_ALPHA = 7,
|
||||
BF_ONE_MINUS_DEST_ALPHA = 8,
|
||||
BF_ONE_MINUS_SOURCE_ALPHA = 9,
|
||||
BF_UNDEF
|
||||
} eBlendFactor;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
enum eMatrixMode : U8
|
||||
{
|
||||
MM_MODELVIEW = 0,
|
||||
MM_PROJECTION,
|
||||
|
|
@ -366,7 +368,7 @@ public:
|
|||
MM_TEXTURE3,
|
||||
NUM_MATRIX_MODES,
|
||||
MM_TEXTURE
|
||||
} eMatrixMode;
|
||||
};
|
||||
|
||||
LLRender();
|
||||
~LLRender();
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ void LLRenderNavPrim::renderLLTri( const LLVector3& a, const LLVector3& b, const
|
|||
//=============================================================================
|
||||
void LLRenderNavPrim::renderNavMeshVB( U32 mode, LLVertexBuffer* pVBO, int vertCnt )
|
||||
{
|
||||
pVBO->setBuffer( LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_NORMAL );
|
||||
pVBO->setBuffer();
|
||||
pVBO->drawArrays( mode, 0, vertCnt );
|
||||
}
|
||||
//=============================================================================
|
||||
|
|
|
|||
|
|
@ -596,6 +596,7 @@ static std::string get_shader_log(GLuint ret)
|
|||
|
||||
static std::string get_program_log(GLuint ret)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
|
||||
std::string res;
|
||||
|
||||
//get log length
|
||||
|
|
@ -1119,16 +1120,24 @@ GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_lev
|
|||
BOOL LLShaderMgr::linkProgramObject(GLuint obj, BOOL suppress_errors)
|
||||
{
|
||||
//check for errors
|
||||
glLinkProgram(obj);
|
||||
GLint success = GL_TRUE;
|
||||
glGetProgramiv(obj, GL_LINK_STATUS, &success);
|
||||
if (!suppress_errors && success == GL_FALSE)
|
||||
{
|
||||
//an error occured, print log
|
||||
LL_SHADER_LOADING_WARNS() << "GLSL Linker Error:" << LL_ENDL;
|
||||
dumpObjectLog(obj, TRUE, "linker");
|
||||
return success;
|
||||
}
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_SHADER("glLinkProgram");
|
||||
glLinkProgram(obj);
|
||||
}
|
||||
|
||||
GLint success = GL_TRUE;
|
||||
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_SHADER("glsl check link status");
|
||||
glGetProgramiv(obj, GL_LINK_STATUS, &success);
|
||||
if (!suppress_errors && success == GL_FALSE)
|
||||
{
|
||||
//an error occured, print log
|
||||
LL_SHADER_LOADING_WARNS() << "GLSL Linker Error:" << LL_ENDL;
|
||||
dumpObjectLog(obj, TRUE, "linker");
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
std::string log = get_program_log(obj);
|
||||
LLStringUtil::toLower(log);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -53,17 +53,16 @@
|
|||
//============================================================================
|
||||
// base class
|
||||
class LLPrivateMemoryPool;
|
||||
class LLVertexBuffer : public LLRefCount
|
||||
class LLVertexBuffer final : public LLRefCount
|
||||
{
|
||||
public:
|
||||
struct MappedRegion
|
||||
{
|
||||
S32 mStart;
|
||||
S32 mEnd;
|
||||
U32 mStart;
|
||||
U32 mEnd;
|
||||
};
|
||||
|
||||
LLVertexBuffer(const LLVertexBuffer& rhs)
|
||||
: mUsage(rhs.mUsage)
|
||||
{
|
||||
*this = rhs;
|
||||
}
|
||||
|
|
@ -74,42 +73,31 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
static std::list<U32> sAvailableVAOName;
|
||||
static U32 sCurVAOName;
|
||||
|
||||
static bool sUseStreamDraw;
|
||||
static bool sUseVAO;
|
||||
static bool sPreferStreamDraw;
|
||||
|
||||
static U32 getVAOName();
|
||||
static void releaseVAOName(U32 name);
|
||||
|
||||
static void initClass(LLWindow* window);
|
||||
static void cleanupClass();
|
||||
static void setupClientArrays(U32 data_mask);
|
||||
static void drawArrays(U32 mode, const std::vector<LLVector3>& pos);
|
||||
static void drawElements(U32 mode, const LLVector4a* pos, const LLVector2* tc, S32 num_indices, const U16* indicesp);
|
||||
static void drawElements(U32 mode, const LLVector4a* pos, const LLVector2* tc, U32 num_indices, const U16* indicesp);
|
||||
|
||||
static void unbind(); //unbind any bound vertex buffer
|
||||
|
||||
//get the size of a vertex with the given typemask
|
||||
static S32 calcVertexSize(const U32& typemask);
|
||||
static U32 calcVertexSize(const U32& typemask);
|
||||
|
||||
//get the size of a buffer with the given typemask and vertex count
|
||||
//fill offsets with the offset of each vertex component array into the buffer
|
||||
// indexed by the following enum
|
||||
static S32 calcOffsets(const U32& typemask, S32* offsets, S32 num_vertices);
|
||||
static U32 calcOffsets(const U32& typemask, U32* offsets, U32 num_vertices);
|
||||
|
||||
//WARNING -- when updating these enums you MUST
|
||||
// 1 - update LLVertexBuffer::sTypeSize
|
||||
// 2 - update LLVertexBuffer::vb_type_name
|
||||
// 3 - add a strider accessor
|
||||
// 4 - modify LLVertexBuffer::setupVertexBuffer
|
||||
// 5 - modify LLVertexBuffer::setupVertexBufferFast
|
||||
// 6 - modify LLViewerShaderMgr::mReservedAttribs
|
||||
|
||||
// clang-format off
|
||||
enum { // Shader attribute name, set in LLShaderMgr::initAttribsAndUniforms()
|
||||
enum AttributeType { // Shader attribute name, set in LLShaderMgr::initAttribsAndUniforms()
|
||||
TYPE_VERTEX = 0, // "position"
|
||||
TYPE_NORMAL, // "normal"
|
||||
TYPE_TEXCOORD0, // "texcoord0"
|
||||
|
|
@ -147,45 +135,37 @@ public:
|
|||
protected:
|
||||
friend class LLRender;
|
||||
|
||||
virtual ~LLVertexBuffer(); // use unref()
|
||||
~LLVertexBuffer(); // use unref()
|
||||
|
||||
virtual void setupVertexBuffer(U32 data_mask);
|
||||
void setupVertexBufferFast(U32 data_mask);
|
||||
void setupVertexBuffer();
|
||||
|
||||
void genBuffer(U32 size);
|
||||
void genIndices(U32 size);
|
||||
bool bindGLBuffer(bool force_bind = false);
|
||||
bool bindGLBufferFast();
|
||||
bool bindGLIndices(bool force_bind = false);
|
||||
bool bindGLIndicesFast();
|
||||
void releaseBuffer();
|
||||
void releaseIndices();
|
||||
bool createGLBuffer(U32 size);
|
||||
bool createGLIndices(U32 size);
|
||||
void destroyGLBuffer();
|
||||
void destroyGLIndices();
|
||||
bool updateNumVerts(S32 nverts);
|
||||
bool updateNumIndices(S32 nindices);
|
||||
void unmapBuffer();
|
||||
|
||||
public:
|
||||
LLVertexBuffer(U32 typemask, S32 usage);
|
||||
|
||||
// map for data access
|
||||
U8* mapVertexBuffer(S32 type, S32 index, S32 count, bool map_range);
|
||||
U8* mapIndexBuffer(S32 index, S32 count, bool map_range);
|
||||
bool updateNumVerts(U32 nverts);
|
||||
bool updateNumIndices(U32 nindices);
|
||||
|
||||
void bindForFeedback(U32 channel, U32 type, U32 index, U32 count);
|
||||
public:
|
||||
LLVertexBuffer(U32 typemask);
|
||||
|
||||
// allocate buffer
|
||||
bool allocateBuffer(U32 nverts, U32 nindices);
|
||||
|
||||
// map for data access (see also getFooStrider below)
|
||||
U8* mapVertexBuffer(AttributeType type, U32 index, S32 count = -1);
|
||||
U8* mapIndexBuffer(U32 index, S32 count = -1);
|
||||
void unmapBuffer();
|
||||
|
||||
// set for rendering
|
||||
virtual void setBuffer(U32 data_mask); // calls setupVertexBuffer() if data_mask is not 0
|
||||
void setBufferFast(U32 data_mask); // calls setupVertexBufferFast(), assumes data_mask is not 0 among other assumptions
|
||||
|
||||
void flush(bool discard = false); //flush pending data to GL memory, if discard is true, discard previous VBO
|
||||
// allocate buffer
|
||||
bool allocateBuffer(S32 nverts, S32 nindices, bool create);
|
||||
virtual bool resizeBuffer(S32 newnverts, S32 newnindices);
|
||||
|
||||
// assumes (and will assert on) the following:
|
||||
// - this buffer has no pending unampBuffer call
|
||||
// - a shader is currently bound
|
||||
// - This buffer has sufficient attributes within it to satisfy the needs of the currently bound shader
|
||||
void setBuffer();
|
||||
|
||||
// Only call each getVertexPointer, etc, once before calling unmapBuffer()
|
||||
// call unmapBuffer() after calls to getXXXStrider() before any cals to setBuffer()
|
||||
// example:
|
||||
|
|
@ -193,61 +173,53 @@ public:
|
|||
// vb->getNormalStrider(norms);
|
||||
// setVertsNorms(verts, norms);
|
||||
// vb->unmapBuffer();
|
||||
bool getVertexStrider(LLStrider<LLVector3>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getVertexStrider(LLStrider<LLVector4a>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getIndexStrider(LLStrider<U16>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getTexCoord0Strider(LLStrider<LLVector2>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getTexCoord1Strider(LLStrider<LLVector2>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getTexCoord2Strider(LLStrider<LLVector2>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getNormalStrider(LLStrider<LLVector3>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getTangentStrider(LLStrider<LLVector3>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getTangentStrider(LLStrider<LLVector4a>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getColorStrider(LLStrider<LLColor4U>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getEmissiveStrider(LLStrider<LLColor4U>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getWeightStrider(LLStrider<F32>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getVertexStrider(LLStrider<LLVector3>& strider, U32 index=0, S32 count = -1);
|
||||
bool getVertexStrider(LLStrider<LLVector4a>& strider, U32 index=0, S32 count = -1);
|
||||
bool getIndexStrider(LLStrider<U16>& strider, U32 index=0, S32 count = -1);
|
||||
bool getTexCoord0Strider(LLStrider<LLVector2>& strider, U32 index=0, S32 count = -1);
|
||||
bool getTexCoord1Strider(LLStrider<LLVector2>& strider, U32 index=0, S32 count = -1);
|
||||
bool getTexCoord2Strider(LLStrider<LLVector2>& strider, U32 index=0, S32 count = -1);
|
||||
bool getNormalStrider(LLStrider<LLVector3>& strider, U32 index=0, S32 count = -1);
|
||||
bool getTangentStrider(LLStrider<LLVector3>& strider, U32 index=0, S32 count = -1);
|
||||
bool getTangentStrider(LLStrider<LLVector4a>& strider, U32 index=0, S32 count = -1);
|
||||
bool getColorStrider(LLStrider<LLColor4U>& strider, U32 index=0, S32 count = -1);
|
||||
bool getEmissiveStrider(LLStrider<LLColor4U>& strider, U32 index=0, S32 count = -1);
|
||||
bool getWeightStrider(LLStrider<F32>& strider, U32 index=0, S32 count = -1);
|
||||
// <FS:Ansariel> Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis
|
||||
//bool getWeight4Strider(LLStrider<LLVector4>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
//bool getClothWeightStrider(LLStrider<LLVector4>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getWeight4Strider(LLStrider<LLVector4a>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getClothWeightStrider(LLStrider<LLVector4a>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
//bool getWeight4Strider(LLStrider<LLVector4>& strider, U32 index=0, S32 count = -1);
|
||||
//bool getClothWeightStrider(LLStrider<LLVector4>& strider, U32 index=0, S32 count = -1);
|
||||
bool getWeight4Strider(LLStrider<LLVector4a>& strider, U32 index=0, S32 count = -1);
|
||||
bool getClothWeightStrider(LLStrider<LLVector4a>& strider, U32 index=0, S32 count = -1);
|
||||
// </FS:Ansariel>
|
||||
bool getBasecolorTexcoordStrider(LLStrider<LLVector2>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getNormalTexcoordStrider(LLStrider<LLVector2>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getMetallicRoughnessTexcoordStrider(LLStrider<LLVector2>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getEmissiveTexcoordStrider(LLStrider<LLVector2>& strider, S32 index=0, S32 count = -1, bool map_range = false);
|
||||
bool getBasecolorTexcoordStrider(LLStrider<LLVector2>& strider, U32 index=0, S32 count = -1);
|
||||
bool getNormalTexcoordStrider(LLStrider<LLVector2>& strider, U32 index=0, S32 count = -1);
|
||||
bool getMetallicRoughnessTexcoordStrider(LLStrider<LLVector2>& strider, U32 index=0, S32 count = -1);
|
||||
bool getEmissiveTexcoordStrider(LLStrider<LLVector2>& strider, U32 index=0, S32 count = -1);
|
||||
|
||||
void setPositionData(const LLVector4a* data);
|
||||
void setTexCoordData(const LLVector2* data);
|
||||
void setColorData(const LLColor4U* data);
|
||||
|
||||
|
||||
bool useVBOs() const;
|
||||
bool isEmpty() const { return mEmpty; }
|
||||
bool isLocked() const { return mVertexLocked || mIndexLocked; }
|
||||
S32 getNumVerts() const { return mNumVerts; }
|
||||
S32 getNumIndices() const { return mNumIndices; }
|
||||
U32 getNumVerts() const { return mNumVerts; }
|
||||
U32 getNumIndices() const { return mNumIndices; }
|
||||
|
||||
U8* getIndicesPointer() const { return useVBOs() ? nullptr : mMappedIndexData; }
|
||||
U8* getVerticesPointer() const { return useVBOs() ? nullptr : mMappedData; }
|
||||
U32 getTypeMask() const { return mTypeMask; }
|
||||
bool hasDataType(S32 type) const { return ((1 << type) & getTypeMask()); }
|
||||
S32 getSize() const;
|
||||
S32 getIndicesSize() const { return mIndicesSize; }
|
||||
bool hasDataType(AttributeType type) const { return ((1 << type) & getTypeMask()); }
|
||||
U32 getSize() const { return mSize; }
|
||||
U32 getIndicesSize() const { return mIndicesSize; }
|
||||
U8* getMappedData() const { return mMappedData; }
|
||||
U8* getMappedIndices() const { return mMappedIndexData; }
|
||||
S32 getOffset(S32 type) const { return mOffsets[type]; }
|
||||
S32 getUsage() const { return mUsage; }
|
||||
bool isWriteable() const { return (mUsage == GL_STREAM_DRAW) ? true : false; }
|
||||
|
||||
U32 getOffset(AttributeType type) const { return mOffsets[type]; }
|
||||
|
||||
// these functions assume (and assert on) the current VBO being bound
|
||||
// Detailed error checking can be enabled by setting gDebugGL to true
|
||||
void draw(U32 mode, U32 count, U32 indices_offset) const;
|
||||
void drawArrays(U32 mode, U32 offset, U32 count) const;
|
||||
void drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indices_offset) const;
|
||||
|
||||
//implementation for inner loops that does no safety checking
|
||||
void drawRangeFast(U32 mode, U32 start, U32 end, U32 count, U32 indices_offset) const;
|
||||
void drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indices_offset) const;
|
||||
|
||||
//for debugging, validate data in given range is valid
|
||||
void validateRange(U32 start, U32 end, U32 count, U32 offset) const;
|
||||
bool validateRange(U32 start, U32 end, U32 count, U32 offset) const;
|
||||
|
||||
#ifdef LL_PROFILER_ENABLE_RENDER_DOC
|
||||
void setLabel(const char* label);
|
||||
|
|
@ -255,62 +227,45 @@ public:
|
|||
|
||||
|
||||
protected:
|
||||
U32 mGLBuffer; // GL VBO handle
|
||||
U32 mGLIndices; // GL IBO handle
|
||||
U32 mGLBuffer = 0; // GL VBO handle
|
||||
U32 mGLIndices = 0; // GL IBO handle
|
||||
U32 mNumVerts = 0; // Number of vertices allocated
|
||||
U32 mNumIndices = 0; // Number of indices allocated
|
||||
U32 mOffsets[TYPE_MAX]; // byte offsets into mMappedData of each attribute
|
||||
|
||||
U32 mTypeMask;
|
||||
U8* mMappedData = nullptr; // pointer to currently mapped data (NULL if unmapped)
|
||||
U8* mMappedIndexData = nullptr; // pointer to currently mapped indices (NULL if unmapped)
|
||||
|
||||
S32 mNumVerts; // Number of vertices allocated
|
||||
S32 mNumIndices; // Number of indices allocated
|
||||
|
||||
S32 mSize;
|
||||
S32 mIndicesSize;
|
||||
|
||||
const S32 mUsage; // GL usage
|
||||
|
||||
U8* mMappedData; // pointer to currently mapped data (NULL if unmapped)
|
||||
U8* mMappedIndexData; // pointer to currently mapped indices (NULL if unmapped)
|
||||
|
||||
U32 mMappedDataUsingVBOs : 1;
|
||||
U32 mMappedIndexDataUsingVBOs : 1;
|
||||
U32 mVertexLocked : 1; // if true, vertex buffer is being or has been written to in client memory
|
||||
U32 mIndexLocked : 1; // if true, index buffer is being or has been written to in client memory
|
||||
U32 mFinal : 1; // if true, buffer can not be mapped again
|
||||
U32 mEmpty : 1; // if true, client buffer is empty (or NULL). Old values have been discarded.
|
||||
U32 mTypeMask = 0; // bitmask of present vertex attributes
|
||||
|
||||
S32 mOffsets[TYPE_MAX];
|
||||
U32 mSize = 0; // size in bytes of mMappedData
|
||||
U32 mIndicesSize = 0; // size in bytes of mMappedIndexData
|
||||
|
||||
std::vector<MappedRegion> mMappedVertexRegions;
|
||||
std::vector<MappedRegion> mMappedIndexRegions;
|
||||
|
||||
static S32 determineUsage(S32 usage);
|
||||
std::vector<MappedRegion> mMappedVertexRegions; // list of mMappedData byte ranges that must be sent to GL
|
||||
std::vector<MappedRegion> mMappedIndexRegions; // list of mMappedIndexData byte ranges that must be sent to GL
|
||||
|
||||
private:
|
||||
static LLPrivateMemoryPool* sPrivatePoolp;
|
||||
// DEPRECATED
|
||||
// These function signatures are deprecated, but for some reason
|
||||
// there are classes in an external package that depend on LLVertexBuffer
|
||||
|
||||
// TODO: move these classes into viewer repository
|
||||
friend class LLNavShapeVBOManager;
|
||||
friend class LLNavMeshVBOManager;
|
||||
|
||||
LLVertexBuffer(U32 typemask, U32 usage)
|
||||
: LLVertexBuffer(typemask)
|
||||
{}
|
||||
|
||||
bool allocateBuffer(S32 nverts, S32 nindices, BOOL create) { return allocateBuffer(nverts, nindices); }
|
||||
|
||||
public:
|
||||
static S32 sCount;
|
||||
static S32 sGLCount;
|
||||
static S32 sMappedCount;
|
||||
static bool sMapped;
|
||||
typedef std::list<LLVertexBuffer*> buffer_list_t;
|
||||
|
||||
static bool sDisableVBOMapping; //disable glMapBufferARB
|
||||
static bool sEnableVBOs;
|
||||
static const S32 sTypeSize[TYPE_MAX];
|
||||
static const U32 sTypeSize[TYPE_MAX];
|
||||
static const U32 sGLMode[LLRender::NUM_MODES];
|
||||
static U32 sGLRenderBuffer;
|
||||
static U32 sGLRenderArray;
|
||||
static U32 sGLRenderIndices;
|
||||
static bool sVBOActive;
|
||||
static bool sIBOActive;
|
||||
static U32 sLastMask;
|
||||
static U32 sAllocatedBytes;
|
||||
static U32 sAllocatedIndexBytes;
|
||||
static U32 sVertexCount;
|
||||
static U32 sIndexCount;
|
||||
static U32 sBindCount;
|
||||
static U32 sSetCount;
|
||||
};
|
||||
|
||||
#ifdef LL_PROFILER_ENABLE_RENDER_DOC
|
||||
|
|
|
|||
|
|
@ -1064,16 +1064,19 @@ BOOL LLWindowWin32::maximize()
|
|||
BOOL success = FALSE;
|
||||
if (!mWindowHandle) return success;
|
||||
|
||||
WINDOWPLACEMENT placement;
|
||||
placement.length = sizeof(WINDOWPLACEMENT);
|
||||
mWindowThread->post([=]
|
||||
{
|
||||
WINDOWPLACEMENT placement;
|
||||
placement.length = sizeof(WINDOWPLACEMENT);
|
||||
|
||||
success = GetWindowPlacement(mWindowHandle, &placement);
|
||||
if (!success) return success;
|
||||
if (GetWindowPlacement(mWindowHandle, &placement))
|
||||
{
|
||||
placement.showCmd = SW_MAXIMIZE;
|
||||
SetWindowPlacement(mWindowHandle, &placement);
|
||||
}
|
||||
});
|
||||
|
||||
placement.showCmd = SW_MAXIMIZE;
|
||||
|
||||
success = SetWindowPlacement(mWindowHandle, &placement);
|
||||
return success;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL LLWindowWin32::getFullscreen()
|
||||
|
|
@ -1421,14 +1424,6 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (pfd.cAlphaBits < 8)
|
||||
{
|
||||
OSMessageBox(mCallbacks->translateString("MBAlpha"),
|
||||
mCallbacks->translateString("MBError"), OSMB_OK);
|
||||
close();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!SetPixelFormat(mhDC, pixel_format, &pfd))
|
||||
{
|
||||
OSMessageBox(mCallbacks->translateString("MBPixelFmtSetErr"),
|
||||
|
|
@ -1487,7 +1482,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO
|
|||
attrib_list[cur_attrib++] = 24;
|
||||
|
||||
attrib_list[cur_attrib++] = WGL_ALPHA_BITS_ARB;
|
||||
attrib_list[cur_attrib++] = 8;
|
||||
attrib_list[cur_attrib++] = 0;
|
||||
|
||||
U32 end_attrib = 0;
|
||||
if (mFSAASamples > 0)
|
||||
|
|
@ -1718,13 +1713,6 @@ const S32 max_format = (S32)num_formats - 1;
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (pfd.cAlphaBits < 8)
|
||||
{
|
||||
OSMessageBox(mCallbacks->translateString("MBAlpha"), mCallbacks->translateString("MBError"), OSMB_OK);
|
||||
close();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
mhRC = 0;
|
||||
if (wglCreateContextAttribsARB)
|
||||
{ //attempt to create a specific versioned context
|
||||
|
|
|
|||
|
|
@ -11643,7 +11643,7 @@ Change of this parameter will affect the layout of buttons in notification toast
|
|||
<string>Vector3</string>
|
||||
<key>Value</key>
|
||||
<array>
|
||||
<real>0.01</real>
|
||||
<real>0.25</real>
|
||||
<real>0.0</real>
|
||||
<real>0.0</real>
|
||||
</array>
|
||||
|
|
|
|||
|
|
@ -505,7 +505,7 @@ vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, vec3 c, int i)
|
|||
v -= c;
|
||||
v = env_mat * v;
|
||||
{
|
||||
return texture(irradianceProbes, vec4(v.xyz, refIndex[i].x)).rgb * refParams[i].x;
|
||||
return textureLod(irradianceProbes, vec4(v.xyz, refIndex[i].x), 0).rgb * refParams[i].x;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -676,14 +676,15 @@ void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout
|
|||
|
||||
vec3 refnormpersp = reflect(pos.xyz, norm.xyz);
|
||||
|
||||
|
||||
ambenv = sampleProbeAmbient(pos, norm);
|
||||
|
||||
|
||||
if (glossiness > 0.0)
|
||||
{
|
||||
float lod = (1.0-glossiness)*reflection_lods;
|
||||
glossenv = sampleProbes(pos, normalize(refnormpersp), lod, false);
|
||||
}
|
||||
|
||||
|
||||
if (envIntensity > 0.0)
|
||||
{
|
||||
legacyenv = sampleProbes(pos, normalize(refnormpersp), 0.0, false);
|
||||
|
|
|
|||
|
|
@ -66,11 +66,11 @@ void exoPostProcess::ExodusRenderPostUpdate()
|
|||
void exoPostProcess::initVB()
|
||||
{
|
||||
destroyVB();
|
||||
mExoPostBuffer = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1, 0);
|
||||
mExoPostBuffer = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1);
|
||||
|
||||
if (!gPipeline.sRenderDeferred)
|
||||
{
|
||||
if (mExoPostBuffer->allocateBuffer(3, 0, true))
|
||||
if (mExoPostBuffer->allocateBuffer(3, 0))
|
||||
{
|
||||
LLStrider<LLVector3> v;
|
||||
LLStrider<LLVector2> uv1;
|
||||
|
|
@ -92,7 +92,7 @@ void exoPostProcess::initVB()
|
|||
v[1] = LLVector3(-1.f, 3.f, 0.f);
|
||||
v[2] = LLVector3(3.f, -1.f, 0.f);
|
||||
|
||||
mExoPostBuffer->flush();
|
||||
mExoPostBuffer->unmapBuffer();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -102,7 +102,7 @@ void exoPostProcess::initVB()
|
|||
}
|
||||
else
|
||||
{
|
||||
if (mExoPostBuffer->allocateBuffer(8, 0, true))
|
||||
if (mExoPostBuffer->allocateBuffer(8, 0))
|
||||
{
|
||||
LLStrider<LLVector3> vert;
|
||||
mExoPostBuffer->getVertexStrider(vert);
|
||||
|
|
@ -144,7 +144,7 @@ void exoPostProcess::ExodusRenderVignette(LLRenderTarget* src, LLRenderTarget* d
|
|||
LLGLSLShader *shader = &gPostVignetteProgram;
|
||||
shader->bind();
|
||||
|
||||
mExoPostBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
||||
mExoPostBuffer->setBuffer();
|
||||
|
||||
exoShader::BindRenderTarget(dst, shader, LLShaderMgr::EXO_RENDER_SCREEN);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
version 43
|
||||
version 45
|
||||
// The version number above should be incremented IF AND ONLY IF some
|
||||
// change has been made that is sufficiently important to justify
|
||||
// resetting the graphics preferences of all users to the recommended
|
||||
|
|
@ -55,7 +55,7 @@ RenderVBOEnable 1 1
|
|||
RenderVBOMappingDisable 1 1
|
||||
RenderVolumeLODFactor 1 4.0
|
||||
UseStartScreen 1 1
|
||||
UseOcclusion 1 0
|
||||
UseOcclusion 1 1
|
||||
WindLightUseAtmosShaders 1 1
|
||||
WLSkyDetail 1 128
|
||||
Disregard128DefaultDrawDistance 1 1
|
||||
|
|
@ -72,7 +72,7 @@ RenderUseStreamVBO 1 1
|
|||
RenderFSAASamples 1 16
|
||||
RenderMaxTextureIndex 1 16
|
||||
RenderGLContextCoreProfile 1 1
|
||||
RenderGLMultiThreaded 1 1
|
||||
RenderGLMultiThreaded 1 0
|
||||
|
||||
|
||||
//
|
||||
|
|
@ -290,12 +290,10 @@ RenderReflectionProbeDetail 0 -1
|
|||
list Intel
|
||||
RenderAnisotropic 1 0
|
||||
RenderFSAASamples 1 0
|
||||
RenderGLMultiThreaded 1 0
|
||||
RenderGLContextCoreProfile 1 0
|
||||
|
||||
list GL3
|
||||
RenderFSAASamples 0 0
|
||||
RenderReflectionsEnabled 0 0
|
||||
RenderReflectionProbeDetail 0 0
|
||||
RenderGLMultiThreaded 0 0
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ RenderVBOEnable 1 1
|
|||
RenderVBOMappingDisable 1 1
|
||||
RenderVolumeLODFactor 1 4.0
|
||||
UseStartScreen 1 1
|
||||
UseOcclusion 1 0
|
||||
UseOcclusion 1 1
|
||||
WindLightUseAtmosShaders 1 1
|
||||
WLSkyDetail 1 128
|
||||
Disregard128DefaultDrawDistance 1 1
|
||||
|
|
@ -72,7 +72,7 @@ RenderUseStreamVBO 1 1
|
|||
RenderFSAASamples 1 16
|
||||
RenderMaxTextureIndex 1 16
|
||||
RenderGLContextCoreProfile 1 1
|
||||
RenderGLMultiThreaded 1 1
|
||||
RenderGLMultiThreaded 1 0
|
||||
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
version 42
|
||||
version 43
|
||||
// The version number above should be incremented IF AND ONLY IF some
|
||||
// change has been made that is sufficiently important to justify
|
||||
// resetting the graphics preferences of all users to the recommended
|
||||
|
|
@ -53,7 +53,7 @@ RenderVBOEnable 1 1
|
|||
RenderVBOMappingDisable 1 1
|
||||
RenderVolumeLODFactor 1 4.0
|
||||
UseStartScreen 1 1
|
||||
UseOcclusion 1 0
|
||||
UseOcclusion 1 1
|
||||
WindLightUseAtmosShaders 1 1
|
||||
WLSkyDetail 1 128
|
||||
Disregard128DefaultDrawDistance 1 1
|
||||
|
|
|
|||
|
|
@ -610,10 +610,6 @@ static void settings_to_globals()
|
|||
LLRender::sGLCoreProfile = gSavedSettings.getBOOL("RenderGLContextCoreProfile");
|
||||
#endif
|
||||
LLRender::sNsightDebugSupport = gSavedSettings.getBOOL("RenderNsightDebugSupport");
|
||||
// <FS:Ansariel> Vertex Array Objects are required in OpenGL core profile
|
||||
LLVertexBuffer::sUseVAO = gSavedSettings.getBOOL("RenderUseVAO");
|
||||
//LLVertexBuffer::sUseVAO = LLRender::sGLCoreProfile ? TRUE : gSavedSettings.getBOOL("RenderUseVAO");
|
||||
// </FS:Ansariel>
|
||||
LLImageGL::sGlobalUseAnisotropic = gSavedSettings.getBOOL("RenderAnisotropic");
|
||||
LLImageGL::sCompressTextures = gSavedSettings.getBOOL("RenderCompressTextures");
|
||||
LLVOVolume::sLODFactor = llclamp(gSavedSettings.getF32("RenderVolumeLODFactor"), 0.01f, MAX_LOD_FACTOR);
|
||||
|
|
|
|||
|
|
@ -709,7 +709,8 @@ F32 LLDrawable::updateXform(BOOL undamped)
|
|||
((dist_vec_squared(old_pos, target_pos) > 0.f)
|
||||
|| (1.f - dot(old_rot, target_rot)) > 0.f))
|
||||
{ //fix for BUG-840, MAINT-2275, MAINT-1742, MAINT-2247
|
||||
gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION, TRUE);
|
||||
mVObjp->shrinkWrap();
|
||||
gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION, TRUE);
|
||||
}
|
||||
else if (!getVOVolume() && !isAvatar())
|
||||
{
|
||||
|
|
@ -1267,10 +1268,10 @@ LLSpatialPartition* LLDrawable::getSpatialPartition()
|
|||
|
||||
LLSpatialBridge::LLSpatialBridge(LLDrawable* root, BOOL render_by_group, U32 data_mask, LLViewerRegion* regionp) :
|
||||
LLDrawable(root->getVObj(), true),
|
||||
LLSpatialPartition(data_mask, render_by_group, GL_STREAM_DRAW, regionp)
|
||||
LLSpatialPartition(data_mask, render_by_group, regionp)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
|
||||
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE;
|
||||
mOcclusionEnabled = false;
|
||||
mBridge = this;
|
||||
mDrawable = root;
|
||||
root->setSpatialBridge(this);
|
||||
|
|
@ -1779,7 +1780,7 @@ LLDrawable* LLDrawable::getRoot()
|
|||
}
|
||||
|
||||
LLBridgePartition::LLBridgePartition(LLViewerRegion* regionp)
|
||||
: LLSpatialPartition(0, FALSE, 0, regionp)
|
||||
: LLSpatialPartition(0, false, regionp)
|
||||
{
|
||||
mDrawableType = LLPipeline::RENDER_TYPE_VOLUME;
|
||||
mPartitionType = LLViewerRegion::PARTITION_BRIDGE;
|
||||
|
|
|
|||
|
|
@ -386,55 +386,54 @@ LLRenderPass::~LLRenderPass()
|
|||
|
||||
}
|
||||
|
||||
void LLRenderPass::renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL texture)
|
||||
void LLRenderPass::renderGroup(LLSpatialGroup* group, U32 type, bool texture)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
|
||||
LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[type];
|
||||
|
||||
std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{}; // <FS:Beq/> Perf stats
|
||||
//std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{}; // <FS:Beq/> Perf stats
|
||||
for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
|
||||
{
|
||||
LLDrawInfo *pparams = *k;
|
||||
if (pparams)
|
||||
{
|
||||
// <FS:Beq> Capture render times
|
||||
if (pparams->mFace)
|
||||
{
|
||||
LLViewerObject* vobj = pparams->mFace->getViewerObject();
|
||||
if (vobj->isAttachment())
|
||||
{
|
||||
trackAttachments(vobj, false,&ratPtr);
|
||||
}
|
||||
}
|
||||
// <FS:Beq> Capture render times - BEQFIXMEPLEASE
|
||||
//if (pparams->mFace)
|
||||
//{
|
||||
// LLViewerObject* vobj = pparams->mFace->getViewerObject();
|
||||
// if (vobj->isAttachment())
|
||||
// {
|
||||
// trackAttachments(vobj, false, &ratPtr);
|
||||
// }
|
||||
//}
|
||||
// </FS:Beq>
|
||||
pushBatch(*pparams, mask, texture);
|
||||
pushBatch(*pparams, texture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLRenderPass::renderRiggedGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL texture)
|
||||
void LLRenderPass::renderRiggedGroup(LLSpatialGroup* group, U32 type, bool texture)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
|
||||
LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[type];
|
||||
LLVOAvatar* lastAvatar = nullptr;
|
||||
U64 lastMeshId = 0;
|
||||
mask |= LLVertexBuffer::MAP_WEIGHT4;
|
||||
|
||||
std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{}; // <FS:Beq/> Perf stats
|
||||
|
||||
//std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{}; // <FS:Beq/> Perf stats
|
||||
for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
|
||||
{
|
||||
LLDrawInfo* pparams = *k;
|
||||
if (pparams)
|
||||
{
|
||||
// <FS:Beq> Capture render times
|
||||
if (pparams->mFace)
|
||||
{
|
||||
LLViewerObject* vobj = pparams->mFace->getViewerObject();
|
||||
if (vobj->isAttachment())
|
||||
{
|
||||
trackAttachments(vobj, true ,&ratPtr);
|
||||
}
|
||||
}
|
||||
// <FS:Beq> Capture render times - BEQFIXMEPLEASE
|
||||
//if (pparams->mFace)
|
||||
//{
|
||||
// LLViewerObject* vobj = pparams->mFace->getViewerObject();
|
||||
// if (vobj->isAttachment())
|
||||
// {
|
||||
// trackAttachments(vobj, true, &ratPtr);
|
||||
// }
|
||||
//}
|
||||
// </FS:Beq>
|
||||
if (lastAvatar != pparams->mAvatar || lastMeshId != pparams->mSkinInfo->mHash)
|
||||
{
|
||||
|
|
@ -443,7 +442,7 @@ void LLRenderPass::renderRiggedGroup(LLSpatialGroup* group, U32 type, U32 mask,
|
|||
lastMeshId = pparams->mSkinInfo->mHash;
|
||||
}
|
||||
|
||||
pushBatch(*pparams, mask, texture);
|
||||
pushBatch(*pparams, texture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -469,7 +468,7 @@ void teardown_texture_matrix(LLDrawInfo& params)
|
|||
}
|
||||
}
|
||||
|
||||
void LLRenderPass::pushGLTFBatches(U32 type, U32 mask)
|
||||
void LLRenderPass::pushGLTFBatches(U32 type)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
|
||||
auto* begin = gPipeline.beginRenderMap(type);
|
||||
|
|
@ -490,19 +489,19 @@ void LLRenderPass::pushGLTFBatches(U32 type, U32 mask)
|
|||
|
||||
applyModelMatrix(params);
|
||||
|
||||
params.mVertexBuffer->setBufferFast(mask);
|
||||
params.mVertexBuffer->drawRangeFast(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
|
||||
params.mVertexBuffer->setBuffer();
|
||||
params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
|
||||
|
||||
teardown_texture_matrix(params);
|
||||
}
|
||||
}
|
||||
|
||||
void LLRenderPass::pushRiggedGLTFBatches(U32 type, U32 mask)
|
||||
void LLRenderPass::pushRiggedGLTFBatches(U32 type)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
|
||||
LLVOAvatar* lastAvatar = nullptr;
|
||||
U64 lastMeshId = 0;
|
||||
mask |= LLVertexBuffer::MAP_WEIGHT4;
|
||||
|
||||
auto* begin = gPipeline.beginRenderMap(type);
|
||||
auto* end = gPipeline.endRenderMap(type);
|
||||
for (LLCullResult::drawinfo_iterator i = begin; i != end; )
|
||||
|
|
@ -528,45 +527,44 @@ void LLRenderPass::pushRiggedGLTFBatches(U32 type, U32 mask)
|
|||
lastMeshId = params.mSkinInfo->mHash;
|
||||
}
|
||||
|
||||
params.mVertexBuffer->setBufferFast(mask);
|
||||
params.mVertexBuffer->drawRangeFast(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
|
||||
params.mVertexBuffer->setBuffer();
|
||||
params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
|
||||
|
||||
teardown_texture_matrix(params);
|
||||
}
|
||||
}
|
||||
|
||||
void LLRenderPass::pushBatches(U32 type, U32 mask, BOOL texture, BOOL batch_textures)
|
||||
void LLRenderPass::pushBatches(U32 type, bool texture, bool batch_textures)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
|
||||
std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{};
|
||||
//std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{};
|
||||
auto* begin = gPipeline.beginRenderMap(type);
|
||||
auto* end = gPipeline.endRenderMap(type);
|
||||
for (LLCullResult::drawinfo_iterator i = begin; i != end; )
|
||||
{
|
||||
LLDrawInfo* pparams = *i;
|
||||
LLCullResult::increment_iterator(i, end);
|
||||
// <FS:Beq> Capture render times
|
||||
if (pparams && pparams->mFace)
|
||||
{
|
||||
LLViewerObject* vobj = pparams->mFace->getViewerObject();
|
||||
if (vobj->isAttachment())
|
||||
{
|
||||
trackAttachments(vobj, false, &ratPtr);
|
||||
}
|
||||
}
|
||||
// <FS:Beq> Capture render times - BEQFIXMEPLEASE
|
||||
//if (pparams && pparams->mFace)
|
||||
//{
|
||||
// LLViewerObject* vobj = pparams->mFace->getViewerObject();
|
||||
// if (vobj->isAttachment())
|
||||
// {
|
||||
// trackAttachments(vobj, false, &ratPtr);
|
||||
// }
|
||||
//}
|
||||
// </FS:Beq>
|
||||
|
||||
pushBatch(*pparams, mask, texture, batch_textures);
|
||||
pushBatch(*pparams, texture, batch_textures);
|
||||
}
|
||||
}
|
||||
|
||||
void LLRenderPass::pushRiggedBatches(U32 type, U32 mask, BOOL texture, BOOL batch_textures)
|
||||
void LLRenderPass::pushRiggedBatches(U32 type, bool texture, bool batch_textures)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
|
||||
LLVOAvatar* lastAvatar = nullptr;
|
||||
U64 lastMeshId = 0;
|
||||
mask |= LLVertexBuffer::MAP_WEIGHT4;
|
||||
std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{}; // <FS:Beq/> Perf stats
|
||||
//std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{}; // <FS:Beq/> Perf stats
|
||||
auto* begin = gPipeline.beginRenderMap(type);
|
||||
auto* end = gPipeline.endRenderMap(type);
|
||||
for (LLCullResult::drawinfo_iterator i = begin; i != end; )
|
||||
|
|
@ -574,15 +572,15 @@ void LLRenderPass::pushRiggedBatches(U32 type, U32 mask, BOOL texture, BOOL batc
|
|||
LLDrawInfo* pparams = *i;
|
||||
LLCullResult::increment_iterator(i, end);
|
||||
|
||||
// <FS:Beq> Capture render times
|
||||
if (pparams && pparams->mFace)
|
||||
{
|
||||
LLViewerObject* vobj = pparams->mFace->getViewerObject();
|
||||
if (vobj->isAttachment())
|
||||
{
|
||||
trackAttachments(vobj, true, &ratPtr);
|
||||
}
|
||||
}
|
||||
// <FS:Beq> Capture render times - BEQFIXMEPLEASE
|
||||
//if (pparams && pparams->mFace)
|
||||
//{
|
||||
// LLViewerObject* vobj = pparams->mFace->getViewerObject();
|
||||
// if (vobj->isAttachment())
|
||||
// {
|
||||
// trackAttachments(vobj, true, &ratPtr);
|
||||
// }
|
||||
//}
|
||||
// </FS:Beq>
|
||||
|
||||
if (pparams->mAvatar.notNull() && (lastAvatar != pparams->mAvatar || lastMeshId != pparams->mSkinInfo->mHash))
|
||||
|
|
@ -592,41 +590,41 @@ void LLRenderPass::pushRiggedBatches(U32 type, U32 mask, BOOL texture, BOOL batc
|
|||
lastMeshId = pparams->mSkinInfo->mHash;
|
||||
}
|
||||
|
||||
pushBatch(*pparams, mask, texture, batch_textures);
|
||||
pushBatch(*pparams, texture, batch_textures);
|
||||
}
|
||||
}
|
||||
|
||||
void LLRenderPass::pushMaskBatches(U32 type, U32 mask, BOOL texture, BOOL batch_textures)
|
||||
void LLRenderPass::pushMaskBatches(U32 type, bool texture, bool batch_textures)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
|
||||
std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{};
|
||||
//std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{};
|
||||
auto* begin = gPipeline.beginRenderMap(type);
|
||||
auto* end = gPipeline.endRenderMap(type);
|
||||
for (LLCullResult::drawinfo_iterator i = begin; i != end; )
|
||||
{
|
||||
LLDrawInfo* pparams = *i;
|
||||
LLCullResult::increment_iterator(i, end);
|
||||
// <FS:Beq> Capture render times
|
||||
if (pparams && pparams->mFace)
|
||||
{
|
||||
LLViewerObject* vobj = pparams->mFace->getViewerObject();
|
||||
if (vobj->isAttachment())
|
||||
{
|
||||
trackAttachments(vobj, false, &ratPtr);
|
||||
}
|
||||
}
|
||||
// <FS:Beq> Capture render times - BEQFIXMEPLEASE
|
||||
//if (pparams && pparams->mFace)
|
||||
//{
|
||||
// LLViewerObject* vobj = pparams->mFace->getViewerObject();
|
||||
// if (vobj->isAttachment())
|
||||
// {
|
||||
// trackAttachments(vobj, false, &ratPtr);
|
||||
// }
|
||||
//}
|
||||
// </FS:Beq>
|
||||
LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(pparams->mAlphaMaskCutoff);
|
||||
pushBatch(*pparams, mask, texture, batch_textures);
|
||||
pushBatch(*pparams, texture, batch_textures);
|
||||
}
|
||||
}
|
||||
|
||||
void LLRenderPass::pushRiggedMaskBatches(U32 type, U32 mask, BOOL texture, BOOL batch_textures)
|
||||
void LLRenderPass::pushRiggedMaskBatches(U32 type, bool texture, bool batch_textures)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
|
||||
LLVOAvatar* lastAvatar = nullptr;
|
||||
U64 lastMeshId = 0;
|
||||
std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{};
|
||||
//std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{};
|
||||
auto* begin = gPipeline.beginRenderMap(type);
|
||||
auto* end = gPipeline.endRenderMap(type);
|
||||
for (LLCullResult::drawinfo_iterator i = begin; i != end; )
|
||||
|
|
@ -635,15 +633,15 @@ void LLRenderPass::pushRiggedMaskBatches(U32 type, U32 mask, BOOL texture, BOOL
|
|||
|
||||
LLCullResult::increment_iterator(i, end);
|
||||
|
||||
// <FS:Beq> Capture render times
|
||||
if (pparams && pparams->mFace)
|
||||
{
|
||||
LLViewerObject* vobj = pparams->mFace->getViewerObject();
|
||||
if (vobj->isAttachment())
|
||||
{
|
||||
trackAttachments(vobj, true, &ratPtr);
|
||||
}
|
||||
}
|
||||
// <FS:Beq> Capture render times - BEQFIXMEPLEASE
|
||||
//if (pparams && pparams->mFace)
|
||||
//{
|
||||
// LLViewerObject* vobj = pparams->mFace->getViewerObject();
|
||||
// if (vobj->isAttachment())
|
||||
// {
|
||||
// trackAttachments(vobj, true, &ratPtr);
|
||||
// }
|
||||
//}
|
||||
// </FS:Beq>
|
||||
|
||||
if (LLGLSLShader::sCurBoundShaderPtr)
|
||||
|
|
@ -662,7 +660,7 @@ void LLRenderPass::pushRiggedMaskBatches(U32 type, U32 mask, BOOL texture, BOOL
|
|||
lastMeshId = pparams->mSkinInfo->mHash;
|
||||
}
|
||||
|
||||
pushBatch(*pparams, mask | LLVertexBuffer::MAP_WEIGHT4, texture, batch_textures);
|
||||
pushBatch(*pparams, texture, batch_textures);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -681,7 +679,7 @@ void LLRenderPass::applyModelMatrix(const LLDrawInfo& params)
|
|||
}
|
||||
}
|
||||
|
||||
void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL batch_textures)
|
||||
void LLRenderPass::pushBatch(LLDrawInfo& params, bool texture, bool batch_textures)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
|
||||
if (!params.mCount)
|
||||
|
|
@ -731,8 +729,8 @@ void LLRenderPass::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL ba
|
|||
// params.mGroup->rebuildMesh();
|
||||
//}
|
||||
|
||||
params.mVertexBuffer->setBufferFast(mask);
|
||||
params.mVertexBuffer->drawRangeFast(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
|
||||
params.mVertexBuffer->setBuffer();
|
||||
params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
|
||||
|
||||
if (tex_setup)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -333,7 +333,6 @@ public:
|
|||
return "PASS_GLTF_PBR";
|
||||
case PASS_GLTF_PBR_RIGGED:
|
||||
return "PASS_GLTF_PBR_RIGGED";
|
||||
|
||||
default:
|
||||
return "Unknown pass";
|
||||
}
|
||||
|
|
@ -350,17 +349,17 @@ public:
|
|||
void resetDrawOrders() { }
|
||||
|
||||
static void applyModelMatrix(const LLDrawInfo& params);
|
||||
virtual void pushBatches(U32 type, U32 mask, BOOL texture = TRUE, BOOL batch_textures = FALSE);
|
||||
virtual void pushRiggedBatches(U32 type, U32 mask, BOOL texture = TRUE, BOOL batch_textures = FALSE);
|
||||
void pushGLTFBatches(U32 type, U32 mask);
|
||||
void pushRiggedGLTFBatches(U32 type, U32 mask);
|
||||
virtual void pushMaskBatches(U32 type, U32 mask, BOOL texture = TRUE, BOOL batch_textures = FALSE);
|
||||
virtual void pushRiggedMaskBatches(U32 type, U32 mask, BOOL texture = TRUE, BOOL batch_textures = FALSE);
|
||||
virtual void pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL batch_textures = FALSE);
|
||||
virtual void pushBatches(U32 type, bool texture = true, bool batch_textures = false);
|
||||
virtual void pushRiggedBatches(U32 type, bool texture = true, bool batch_textures = false);
|
||||
void pushGLTFBatches(U32 type);
|
||||
void pushRiggedGLTFBatches(U32 type);
|
||||
virtual void pushMaskBatches(U32 type, bool texture = true, bool batch_textures = false);
|
||||
virtual void pushRiggedMaskBatches(U32 type, bool texture = true, bool batch_textures = false);
|
||||
virtual void pushBatch(LLDrawInfo& params, bool texture, bool batch_textures = false);
|
||||
static bool uploadMatrixPalette(LLDrawInfo& params);
|
||||
static bool uploadMatrixPalette(LLVOAvatar* avatar, LLMeshSkinInfo* skinInfo);
|
||||
virtual void renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL texture = TRUE);
|
||||
virtual void renderRiggedGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL texture = TRUE);
|
||||
virtual void renderGroup(LLSpatialGroup* group, U32 type, bool texture = true);
|
||||
virtual void renderRiggedGroup(LLSpatialGroup* group, U32 type, bool texture = true);
|
||||
};
|
||||
|
||||
class LLFacePool : public LLDrawPool
|
||||
|
|
|
|||
|
|
@ -383,26 +383,21 @@ void LLDrawPoolAlpha::renderAlphaHighlight(U32 mask)
|
|||
{
|
||||
LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[LLRenderPass::PASS_ALPHA+pass]; // <-- hacky + pass to use PASS_ALPHA_RIGGED on second pass
|
||||
|
||||
std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{}; // <FS:Beq/> Render time Stats collection
|
||||
//std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{}; // <FS:Beq/> Render time Stats collection
|
||||
for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
|
||||
{
|
||||
LLDrawInfo& params = **k;
|
||||
|
||||
if (params.mParticle)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
bool rigged = (params.mAvatar != nullptr);
|
||||
// <FS:Beq> Capture render times
|
||||
if(params.mFace)
|
||||
{
|
||||
LLViewerObject* vobj = (LLViewerObject *)params.mFace->getViewerObject();
|
||||
if(vobj->isAttachment())
|
||||
{
|
||||
trackAttachments( vobj, rigged, &ratPtr );
|
||||
}
|
||||
}
|
||||
// <FS:Beq> Capture render times - BEQFIXMEPLEASE
|
||||
//if(params.mFace)
|
||||
//{
|
||||
// LLViewerObject* vobj = (LLViewerObject *)params.mFace->getViewerObject();
|
||||
// if(vobj->isAttachment())
|
||||
// {
|
||||
// trackAttachments( vobj, rigged, &ratPtr );
|
||||
// }
|
||||
//}
|
||||
// </FS:Beq>
|
||||
gHighlightProgram.bind(rigged);
|
||||
// <FS:Beq> FIRE-32132 et al. Allow rigged mesh transparency highlights to be toggled
|
||||
|
|
@ -435,12 +430,8 @@ void LLDrawPoolAlpha::renderAlphaHighlight(U32 mask)
|
|||
}
|
||||
|
||||
LLRenderPass::applyModelMatrix(params);
|
||||
if (params.mGroup)
|
||||
{
|
||||
params.mGroup->rebuildMesh();
|
||||
}
|
||||
params.mVertexBuffer->setBufferFast(rigged ? mask | LLVertexBuffer::MAP_WEIGHT4 : mask);
|
||||
params.mVertexBuffer->drawRangeFast(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
|
||||
params.mVertexBuffer->setBuffer();
|
||||
params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -467,9 +458,9 @@ inline bool IsEmissive(LLDrawInfo& params)
|
|||
|
||||
inline void Draw(LLDrawInfo* draw, U32 mask)
|
||||
{
|
||||
draw->mVertexBuffer->setBufferFast(mask);
|
||||
draw->mVertexBuffer->setBuffer();
|
||||
LLRenderPass::applyModelMatrix(*draw);
|
||||
draw->mVertexBuffer->drawRangeFast(LLRender::TRIANGLES, draw->mStart, draw->mEnd, draw->mCount, draw->mOffset);
|
||||
draw->mVertexBuffer->drawRange(LLRender::TRIANGLES, draw->mStart, draw->mEnd, draw->mCount, draw->mOffset);
|
||||
}
|
||||
|
||||
bool LLDrawPoolAlpha::TexSetup(LLDrawInfo* draw, bool use_material)
|
||||
|
|
@ -562,8 +553,8 @@ void LLDrawPoolAlpha::RestoreTexSetup(bool tex_setup)
|
|||
void LLDrawPoolAlpha::drawEmissive(U32 mask, LLDrawInfo* draw)
|
||||
{
|
||||
LLGLSLShader::sCurBoundShaderPtr->uniform1f(LLShaderMgr::EMISSIVE_BRIGHTNESS, 1.f);
|
||||
draw->mVertexBuffer->setBufferFast((mask & ~LLVertexBuffer::MAP_COLOR) | LLVertexBuffer::MAP_EMISSIVE);
|
||||
draw->mVertexBuffer->drawRangeFast(LLRender::TRIANGLES, draw->mStart, draw->mEnd, draw->mCount, draw->mOffset);
|
||||
draw->mVertexBuffer->setBuffer();
|
||||
draw->mVertexBuffer->drawRange(LLRender::TRIANGLES, draw->mStart, draw->mEnd, draw->mCount, draw->mOffset);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -592,17 +583,17 @@ void LLDrawPoolAlpha::renderRiggedEmissives(U32 mask, std::vector<LLDrawInfo*>&
|
|||
|
||||
mask |= LLVertexBuffer::MAP_WEIGHT4;
|
||||
|
||||
std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{}; // <FS:Beq/> Render time Stats collection
|
||||
//std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{}; // <FS:Beq/> Render time Stats collection
|
||||
for (LLDrawInfo* draw : emissives)
|
||||
{
|
||||
// <FS:Beq> Capture render times
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("Emissives");
|
||||
auto vobj = draw->mFace?draw->mFace->getViewerObject():nullptr;
|
||||
if(vobj && vobj->isAttachment())
|
||||
{
|
||||
trackAttachments( vobj, draw->mFace->isState(LLFace::RIGGED), &ratPtr );
|
||||
}
|
||||
// </FS:Beq>
|
||||
// <FS:Beq> Capture render times - BEQFIXMEPLEASE
|
||||
//LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("Emissives");
|
||||
//auto vobj = draw->mFace ? draw->mFace->getViewerObject() : nullptr;
|
||||
//if (vobj && vobj->isAttachment())
|
||||
//{
|
||||
// trackAttachments(vobj, draw->mFace->isState(LLFace::RIGGED), &ratPtr);
|
||||
//}
|
||||
// </FS:Beq>
|
||||
|
||||
bool tex_setup = TexSetup(draw, false);
|
||||
if (lastAvatar != draw->mAvatar || lastMeshId != draw->mSkinInfo->mHash)
|
||||
|
|
@ -706,7 +697,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
|
|||
|
||||
LLSpatialGroup::drawmap_elem_t& draw_info = rigged ? group->mDrawMap[LLRenderPass::PASS_ALPHA_RIGGED] : group->mDrawMap[LLRenderPass::PASS_ALPHA];
|
||||
|
||||
std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{}; // <FS:Beq/> Render time Stats collection
|
||||
//std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{}; // <FS:Beq/> Render time Stats collection
|
||||
for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
|
||||
{
|
||||
LLDrawInfo& params = **k;
|
||||
|
|
@ -717,45 +708,18 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
|
|||
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("ra - push batch");
|
||||
|
||||
U32 have_mask = params.mVertexBuffer->getTypeMask() & mask;
|
||||
if (have_mask != mask)
|
||||
{ //FIXME!
|
||||
// <FS:Beq> Remove useless logging info from critical path (can be called many times per frame)
|
||||
// TODO(Beq) Determine whether this can be intercepted earlier
|
||||
// LL_WARNS_ONCE() << "Missing required components, expected mask: " << mask
|
||||
// << " present: " << have_mask
|
||||
// << ". Skipping render batch." << LL_ENDL;
|
||||
// </FS:Beq>
|
||||
continue;
|
||||
}
|
||||
|
||||
// <FS:Beq> Capture render times
|
||||
if(params.mFace)
|
||||
{
|
||||
LLViewerObject* vobj = (LLViewerObject *)params.mFace->getViewerObject();
|
||||
|
||||
if(vobj->isAttachment())
|
||||
{
|
||||
trackAttachments( vobj, params.mFace->isState(LLFace::RIGGED), &ratPtr );
|
||||
}
|
||||
}
|
||||
// <FS:Beq> Capture render times - BEQFIXMEPLEASE
|
||||
//if (params.mFace)
|
||||
//{
|
||||
// LLViewerObject* vobj = (LLViewerObject *)params.mFace->getViewerObject();
|
||||
//
|
||||
// if (vobj->isAttachment())
|
||||
// {
|
||||
// trackAttachments(vobj, params.mFace->isState(LLFace::RIGGED), &ratPtr);
|
||||
// }
|
||||
//}
|
||||
// </FS:Beq>
|
||||
|
||||
if(depth_only)
|
||||
{
|
||||
// when updating depth buffer, discard faces that are more than 90% transparent
|
||||
LLFace* face = params.mFace;
|
||||
if(face)
|
||||
{
|
||||
const LLTextureEntry* tep = face->getTextureEntry();
|
||||
if(tep)
|
||||
{ // don't render faces that are more than 90% transparent
|
||||
if(tep->getColor().mV[3] < MINIMUM_IMPOSTOR_ALPHA)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LLRenderPass::applyModelMatrix(params);
|
||||
|
||||
LLMaterial* mat = NULL;
|
||||
|
|
@ -902,18 +866,8 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
|
|||
reset_minimum_alpha = true;
|
||||
}
|
||||
|
||||
U32 drawMask = mask;
|
||||
if (params.mFullbright)
|
||||
{
|
||||
drawMask &= ~(LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2);
|
||||
}
|
||||
if (params.mAvatar != nullptr)
|
||||
{
|
||||
drawMask |= LLVertexBuffer::MAP_WEIGHT4;
|
||||
}
|
||||
|
||||
params.mVertexBuffer->setBufferFast(drawMask);
|
||||
params.mVertexBuffer->drawRangeFast(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
|
||||
params.mVertexBuffer->setBuffer();
|
||||
params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
|
||||
|
||||
if (reset_minimum_alpha)
|
||||
{
|
||||
|
|
@ -923,11 +877,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
|
|||
|
||||
// If this alpha mesh has glow, then draw it a second time to add the destination-alpha (=glow). Interleaving these state-changing calls is expensive, but glow must be drawn Z-sorted with alpha.
|
||||
if (draw_glow_for_this_partition &&
|
||||
// <FS:Ansariel> Re-add particle rendering optimization
|
||||
//params.mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE))
|
||||
params.mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE) &&
|
||||
(!params.mParticle || params.mHasGlow))
|
||||
// </FS:Ansariel>
|
||||
params.mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_EMISSIVE))
|
||||
{
|
||||
if (params.mAvatar != nullptr)
|
||||
{
|
||||
|
|
@ -948,7 +898,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
|
|||
}
|
||||
}
|
||||
// <FS:Beq> performance stats
|
||||
ratPtr.reset(); // force the final batch to terminate to avoid double counting on the subsidiary batches for FB and Emmissives
|
||||
//ratPtr.reset(); // force the final batch to terminate to avoid double counting on the subsidiary batches for FB and Emmissives - BEQFIXMEPLEASE
|
||||
// </FS:Beq>
|
||||
|
||||
// render emissive faces into alpha channel for bloom effects
|
||||
|
|
|
|||
|
|
@ -62,8 +62,6 @@
|
|||
#include "fsperfstats.h" // <FS:Beq> performance stats support
|
||||
|
||||
|
||||
static U32 sDataMask = LLDrawPoolAvatar::VERTEX_DATA_MASK;
|
||||
static U32 sBufferUsage = GL_STREAM_DRAW;
|
||||
static U32 sShaderLevel = 0;
|
||||
|
||||
LLGLSLShader* LLDrawPoolAvatar::sVertexProgram = NULL;
|
||||
|
|
@ -152,15 +150,6 @@ void LLDrawPoolAvatar::prerender()
|
|||
mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_AVATAR);
|
||||
|
||||
sShaderLevel = mShaderLevel;
|
||||
|
||||
if (sShaderLevel > 0)
|
||||
{
|
||||
sBufferUsage = GL_DYNAMIC_DRAW;
|
||||
}
|
||||
else
|
||||
{
|
||||
sBufferUsage = GL_STREAM_DRAW;
|
||||
}
|
||||
}
|
||||
|
||||
LLMatrix4& LLDrawPoolAvatar::getModelView()
|
||||
|
|
@ -1050,11 +1039,3 @@ LLColor3 LLDrawPoolAvatar::getDebugColor() const
|
|||
}
|
||||
|
||||
|
||||
LLVertexBufferAvatar::LLVertexBufferAvatar()
|
||||
: LLVertexBuffer(sDataMask,
|
||||
GL_STREAM_DRAW) //avatars are always stream draw due to morph targets
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -130,12 +130,6 @@ typedef enum
|
|||
static LLGLSLShader* sVertexProgram;
|
||||
};
|
||||
|
||||
class LLVertexBufferAvatar : public LLVertexBuffer
|
||||
{
|
||||
public:
|
||||
LLVertexBufferAvatar();
|
||||
};
|
||||
|
||||
extern S32 AVATAR_OFFSET_POS;
|
||||
extern S32 AVATAR_OFFSET_NORMAL;
|
||||
extern S32 AVATAR_OFFSET_TEX0;
|
||||
|
|
|
|||
|
|
@ -357,22 +357,22 @@ void LLDrawPoolBump::renderShiny()
|
|||
{
|
||||
if (mRigged)
|
||||
{
|
||||
LLRenderPass::pushRiggedBatches(LLRenderPass::PASS_SHINY_RIGGED, sVertexMask | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
LLRenderPass::pushRiggedBatches(LLRenderPass::PASS_SHINY_RIGGED, true, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLRenderPass::pushBatches(LLRenderPass::PASS_SHINY, sVertexMask | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
LLRenderPass::pushBatches(LLRenderPass::PASS_SHINY, true, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mRigged)
|
||||
{
|
||||
gPipeline.renderRiggedGroups(this, LLRenderPass::PASS_SHINY_RIGGED, sVertexMask, TRUE);
|
||||
gPipeline.renderRiggedGroups(this, LLRenderPass::PASS_SHINY_RIGGED, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
gPipeline.renderGroups(this, LLRenderPass::PASS_SHINY, sVertexMask, TRUE);
|
||||
gPipeline.renderGroups(this, LLRenderPass::PASS_SHINY, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -512,22 +512,22 @@ void LLDrawPoolBump::renderFullbrightShiny()
|
|||
{
|
||||
if (mRigged)
|
||||
{
|
||||
LLRenderPass::pushRiggedBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY_RIGGED, sVertexMask | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
LLRenderPass::pushRiggedBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY_RIGGED, true, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLRenderPass::pushBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY, sVertexMask | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
LLRenderPass::pushBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY, true, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mRigged)
|
||||
{
|
||||
LLRenderPass::pushRiggedBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY_RIGGED, sVertexMask);
|
||||
LLRenderPass::pushRiggedBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY_RIGGED);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLRenderPass::pushBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY, sVertexMask);
|
||||
LLRenderPass::pushBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -553,30 +553,26 @@ void LLDrawPoolBump::endFullbrightShiny()
|
|||
mShiny = FALSE;
|
||||
}
|
||||
|
||||
void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL texture = TRUE)
|
||||
void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, bool texture = true)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
|
||||
LLSpatialGroup::drawmap_elem_t& draw_info = group->mDrawMap[type];
|
||||
|
||||
std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{}; // <FS:Beq/> render time capture
|
||||
//std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{}; // <FS:Beq/> render time capture
|
||||
for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k)
|
||||
{
|
||||
LLDrawInfo& params = **k;
|
||||
// <FS:Beq> Capture render times
|
||||
LLViewerObject* vobj = (LLViewerObject *)params.mFace->getViewerObject();
|
||||
|
||||
if( vobj && vobj->isAttachment() )
|
||||
{
|
||||
trackAttachments( vobj, params.mFace->isState(LLFace::RIGGED), &ratPtr );
|
||||
}
|
||||
// </FS:Beq>
|
||||
// <FS:Beq> Capture render times - BEQFIXMEPLEASE
|
||||
//LLViewerObject* vobj = (LLViewerObject *)params.mFace->getViewerObject();
|
||||
//
|
||||
//if (vobj && vobj->isAttachment())
|
||||
//{
|
||||
// trackAttachments(vobj, params.mFace->isState(LLFace::RIGGED), &ratPtr);
|
||||
//}
|
||||
// </FS:Beq>
|
||||
applyModelMatrix(params);
|
||||
|
||||
if (params.mGroup)
|
||||
{
|
||||
params.mGroup->rebuildMesh();
|
||||
}
|
||||
params.mVertexBuffer->setBuffer(mask);
|
||||
params.mVertexBuffer->setBuffer();
|
||||
params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
|
||||
}
|
||||
}
|
||||
|
|
@ -587,7 +583,7 @@ BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params, S32 channel)
|
|||
{
|
||||
U8 bump_code = params.mBump;
|
||||
|
||||
return bindBumpMap(bump_code, params.mTexture, params.mVSize, channel);
|
||||
return bindBumpMap(bump_code, params.mTexture, channel);
|
||||
}
|
||||
|
||||
//static
|
||||
|
|
@ -597,14 +593,14 @@ BOOL LLDrawPoolBump::bindBumpMap(LLFace* face, S32 channel)
|
|||
if (te)
|
||||
{
|
||||
U8 bump_code = te->getBumpmap();
|
||||
return bindBumpMap(bump_code, face->getTexture(), face->getVirtualSize(), channel);
|
||||
return bindBumpMap(bump_code, face->getTexture(), channel);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//static
|
||||
BOOL LLDrawPoolBump::bindBumpMap(U8 bump_code, LLViewerTexture* texture, F32 vsize, S32 channel)
|
||||
BOOL LLDrawPoolBump::bindBumpMap(U8 bump_code, LLViewerTexture* texture, S32 channel)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
|
||||
//Note: texture atlas does not support bump texture now.
|
||||
|
|
@ -630,7 +626,7 @@ BOOL LLDrawPoolBump::bindBumpMap(U8 bump_code, LLViewerTexture* texture, F32 vsi
|
|||
if( bump_code < LLStandardBumpmap::sStandardBumpmapCount )
|
||||
{
|
||||
bump = gStandardBumpmapList[bump_code].mImage;
|
||||
gBumpImageList.addTextureStats(bump_code, tex->getID(), vsize);
|
||||
gBumpImageList.addTextureStats(bump_code, tex->getID(), tex->getMaxVirtualSize());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -687,7 +683,7 @@ void LLDrawPoolBump::renderBump(U32 pass)
|
|||
/// Get rid of z-fighting with non-bump pass.
|
||||
LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
|
||||
glPolygonOffset(-1.0f, -1.0f);
|
||||
renderBump(pass, sVertexMask);
|
||||
pushBumpBatches(pass);
|
||||
}
|
||||
|
||||
//static
|
||||
|
|
@ -736,27 +732,25 @@ void LLDrawPoolBump::renderDeferred(S32 pass)
|
|||
LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type);
|
||||
LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type);
|
||||
|
||||
U32 mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_COLOR;
|
||||
|
||||
LLVOAvatar* avatar = nullptr;
|
||||
U64 skin = 0;
|
||||
|
||||
std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{}; // <FS:Beq/> render time capture
|
||||
//std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{}; // <FS:Beq/> render time capture
|
||||
for (LLCullResult::drawinfo_iterator i = begin; i != end; )
|
||||
{
|
||||
LLDrawInfo& params = **i;
|
||||
|
||||
LLCullResult::increment_iterator(i, end);
|
||||
// <FS:Beq> Capture render times
|
||||
if (params.mFace)
|
||||
{
|
||||
LLViewerObject* vobj = (LLViewerObject *)params.mFace->getViewerObject();
|
||||
// <FS:Beq> Capture render times - BEQFIXMEPLEASE
|
||||
//if (params.mFace)
|
||||
//{
|
||||
// LLViewerObject* vobj = (LLViewerObject *)params.mFace->getViewerObject();
|
||||
|
||||
if (vobj && vobj->isAttachment())
|
||||
{
|
||||
trackAttachments(vobj, params.mFace->isState(LLFace::RIGGED), &ratPtr );
|
||||
}
|
||||
}
|
||||
// if (vobj && vobj->isAttachment())
|
||||
// {
|
||||
// trackAttachments(vobj, params.mFace->isState(LLFace::RIGGED), &ratPtr);
|
||||
// }
|
||||
//}
|
||||
// </FS:Beq>
|
||||
LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(params.mAlphaMaskCutoff);
|
||||
LLDrawPoolBump::bindBumpMap(params, bump_channel);
|
||||
|
|
@ -769,11 +763,11 @@ void LLDrawPoolBump::renderDeferred(S32 pass)
|
|||
avatar = params.mAvatar;
|
||||
skin = params.mSkinInfo->mHash;
|
||||
}
|
||||
pushBatch(params, mask | LLVertexBuffer::MAP_WEIGHT4, TRUE, FALSE);
|
||||
pushBatch(params, true, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
pushBatch(params, mask, TRUE, FALSE);
|
||||
pushBatch(params, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1374,7 +1368,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
|
|||
}
|
||||
}
|
||||
|
||||
void LLDrawPoolBump::renderBump(U32 type, U32 mask)
|
||||
void LLDrawPoolBump::pushBumpBatches(U32 type)
|
||||
{
|
||||
LLVOAvatar* avatar = nullptr;
|
||||
U64 skin = 0;
|
||||
|
|
@ -1382,26 +1376,25 @@ void LLDrawPoolBump::renderBump(U32 type, U32 mask)
|
|||
if (mRigged)
|
||||
{ // nudge type enum and include skinweights for rigged pass
|
||||
type += 1;
|
||||
mask |= LLVertexBuffer::MAP_WEIGHT4;
|
||||
}
|
||||
|
||||
LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type);
|
||||
LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type);
|
||||
|
||||
std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{}; // <FS:Beq/> render time capture
|
||||
//std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{}; // <FS:Beq/> render time capture
|
||||
for (LLCullResult::drawinfo_iterator i = begin; i != end; ++i)
|
||||
{
|
||||
LLDrawInfo& params = **i;
|
||||
// <FS:Beq> Capture render times
|
||||
if(params.mFace)
|
||||
{
|
||||
LLViewerObject* vobj = (LLViewerObject *)params.mFace->getViewerObject();
|
||||
|
||||
if( vobj && vobj->isAttachment() )
|
||||
{
|
||||
trackAttachments( vobj, params.mFace->isState(LLFace::RIGGED), &ratPtr );
|
||||
}
|
||||
}
|
||||
// <FS:Beq> Capture render times - BEQFIXMEPLEASE
|
||||
//if (params.mFace)
|
||||
//{
|
||||
// LLViewerObject* vobj = (LLViewerObject *)params.mFace->getViewerObject();
|
||||
//
|
||||
// if (vobj && vobj->isAttachment())
|
||||
// {
|
||||
// trackAttachments(vobj, params.mFace->isState(LLFace::RIGGED), &ratPtr);
|
||||
// }
|
||||
//}
|
||||
// </FS:Beq>
|
||||
|
||||
if (LLDrawPoolBump::bindBumpMap(params))
|
||||
|
|
@ -1421,12 +1414,12 @@ void LLDrawPoolBump::renderBump(U32 type, U32 mask)
|
|||
}
|
||||
}
|
||||
}
|
||||
pushBatch(params, mask, FALSE);
|
||||
pushBatch(params, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL batch_textures)
|
||||
void LLDrawPoolBump::pushBatch(LLDrawInfo& params, bool texture, bool batch_textures)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
|
||||
applyModelMatrix(params);
|
||||
|
|
@ -1479,12 +1472,8 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL
|
|||
}
|
||||
}
|
||||
|
||||
if (params.mGroup)
|
||||
{
|
||||
params.mGroup->rebuildMesh();
|
||||
}
|
||||
params.mVertexBuffer->setBufferFast(mask);
|
||||
params.mVertexBuffer->drawRangeFast(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
|
||||
params.mVertexBuffer->setBuffer();
|
||||
params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
|
||||
|
||||
if (tex_setup)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -55,10 +55,10 @@ public:
|
|||
virtual void render(S32 pass = 0) override;
|
||||
virtual S32 getNumPasses() override;
|
||||
/*virtual*/ void prerender() override;
|
||||
void pushBatch(LLDrawInfo& params, U32 mask, BOOL texture, BOOL batch_textures = FALSE) override;
|
||||
void pushBatch(LLDrawInfo& params, bool texture, bool batch_textures = false) override;
|
||||
|
||||
void renderBump(U32 type, U32 mask);
|
||||
void renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL texture) override;
|
||||
void pushBumpBatches(U32 type);
|
||||
void renderGroup(LLSpatialGroup* group, U32 type, bool texture) override;
|
||||
|
||||
S32 numBumpPasses();
|
||||
|
||||
|
|
@ -87,7 +87,7 @@ public:
|
|||
static BOOL bindBumpMap(LLFace* face, S32 channel = -2);
|
||||
|
||||
private:
|
||||
static BOOL bindBumpMap(U8 bump_code, LLViewerTexture* tex, F32 vsize, S32 channel);
|
||||
static BOOL bindBumpMap(U8 bump_code, LLViewerTexture* tex, S32 channel);
|
||||
bool mRigged = false; // if true, doing a rigged pass
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -157,8 +157,6 @@ void LLDrawPoolMaterials::renderDeferred(S32 pass)
|
|||
type += 1;
|
||||
}
|
||||
|
||||
U32 mask = mShader->mAttributeMask;
|
||||
|
||||
LLCullResult::drawinfo_iterator begin = gPipeline.beginRenderMap(type);
|
||||
LLCullResult::drawinfo_iterator end = gPipeline.endRenderMap(type);
|
||||
|
||||
|
|
@ -204,22 +202,22 @@ void LLDrawPoolMaterials::renderDeferred(S32 pass)
|
|||
|
||||
LLVOAvatar* lastAvatar = nullptr;
|
||||
|
||||
std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{}; // <FS:Beq/> render time capture
|
||||
//std::unique_ptr<FSPerfStats::RecordAttachmentTime> ratPtr{}; // <FS:Beq/> render time capture
|
||||
for (LLCullResult::drawinfo_iterator i = begin; i != end; )
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_MATERIAL("materials draw loop");
|
||||
LLDrawInfo& params = **i;
|
||||
|
||||
// <FS:Beq> Capture render times
|
||||
if (params.mFace)
|
||||
{
|
||||
LLViewerObject* vobj = (LLViewerObject *)params.mFace->getViewerObject();
|
||||
|
||||
if (vobj && vobj->isAttachment() )
|
||||
{
|
||||
trackAttachments(vobj, params.mFace->isState(LLFace::RIGGED), &ratPtr);
|
||||
}
|
||||
}
|
||||
// <FS:Beq> Capture render times - BEQFIXMEPLEASE
|
||||
//if (params.mFace)
|
||||
//{
|
||||
// LLViewerObject* vobj = (LLViewerObject *)params.mFace->getViewerObject();
|
||||
//
|
||||
// if (vobj && vobj->isAttachment() )
|
||||
// {
|
||||
// trackAttachments(vobj, params.mFace->isState(LLFace::RIGGED), &ratPtr);
|
||||
// }
|
||||
//}
|
||||
// </FS:Beq>
|
||||
|
||||
LLCullResult::increment_iterator(i, end);
|
||||
|
|
@ -318,8 +316,8 @@ void LLDrawPoolMaterials::renderDeferred(S32 pass)
|
|||
params.mGroup->rebuildMesh();
|
||||
}*/
|
||||
|
||||
params.mVertexBuffer->setBufferFast(mask);
|
||||
params.mVertexBuffer->drawRangeFast(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
|
||||
params.mVertexBuffer->setBuffer();
|
||||
params.mVertexBuffer->drawRange(LLRender::TRIANGLES, params.mStart, params.mEnd, params.mCount, params.mOffset);
|
||||
|
||||
if (tex_setup)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -43,13 +43,11 @@ void LLDrawPoolGLTFPBR::renderDeferred(S32 pass)
|
|||
for (U32 type : types)
|
||||
{
|
||||
gDeferredPBROpaqueProgram.bind();
|
||||
pushGLTFBatches(type, getVertexDataMask());
|
||||
pushGLTFBatches(type);
|
||||
|
||||
gDeferredPBROpaqueProgram.bind(true);
|
||||
pushRiggedGLTFBatches(type+1, getVertexDataMask());
|
||||
pushRiggedGLTFBatches(type+1);
|
||||
}
|
||||
|
||||
LLGLSLShader::sCurBoundShaderPtr->unbind();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -99,12 +99,12 @@ void LLDrawPoolGlow::render(LLGLSLShader* shader)
|
|||
|
||||
//first pass -- static objects
|
||||
setup_glow_shader(shader);
|
||||
pushBatches(LLRenderPass::PASS_GLOW, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
pushBatches(LLRenderPass::PASS_GLOW, true, true);
|
||||
|
||||
// second pass -- rigged objects
|
||||
shader = shader->mRiggedVariant;
|
||||
setup_glow_shader(shader);
|
||||
pushRiggedBatches(LLRenderPass::PASS_GLOW_RIGGED, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
pushRiggedBatches(LLRenderPass::PASS_GLOW_RIGGED, true, true);
|
||||
|
||||
gGL.setColorMask(true, false);
|
||||
gGL.setSceneBlendType(LLRender::BT_ALPHA);
|
||||
|
|
@ -161,21 +161,19 @@ void LLDrawPoolSimple::render(S32 pass)
|
|||
|
||||
gPipeline.enableLightsDynamic();
|
||||
|
||||
U32 mask = getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX;
|
||||
|
||||
// first pass -- static objects
|
||||
{
|
||||
setup_simple_shader(shader);
|
||||
pushBatches(LLRenderPass::PASS_SIMPLE, mask, TRUE, TRUE);
|
||||
pushBatches(LLRenderPass::PASS_SIMPLE, true, true);
|
||||
|
||||
if (LLPipeline::sRenderDeferred)
|
||||
{ //if deferred rendering is enabled, bump faces aren't registered as simple
|
||||
//render bump faces here as simple so bump faces will appear under water
|
||||
pushBatches(LLRenderPass::PASS_BUMP, mask, TRUE, TRUE);
|
||||
pushBatches(LLRenderPass::PASS_MATERIAL, mask, TRUE, TRUE);
|
||||
pushBatches(LLRenderPass::PASS_SPECMAP, mask, TRUE, TRUE);
|
||||
pushBatches(LLRenderPass::PASS_NORMMAP, mask, TRUE, TRUE);
|
||||
pushBatches(LLRenderPass::PASS_NORMSPEC, mask, TRUE, TRUE);
|
||||
pushBatches(LLRenderPass::PASS_BUMP, true, true);
|
||||
pushBatches(LLRenderPass::PASS_MATERIAL, true, true);
|
||||
pushBatches(LLRenderPass::PASS_SPECMAP, true, true);
|
||||
pushBatches(LLRenderPass::PASS_NORMMAP, true, true);
|
||||
pushBatches(LLRenderPass::PASS_NORMSPEC, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -183,16 +181,16 @@ void LLDrawPoolSimple::render(S32 pass)
|
|||
{
|
||||
shader = shader->mRiggedVariant;
|
||||
setup_simple_shader(shader);
|
||||
pushRiggedBatches(LLRenderPass::PASS_SIMPLE_RIGGED, mask, TRUE, TRUE);
|
||||
pushRiggedBatches(LLRenderPass::PASS_SIMPLE_RIGGED, true, true);
|
||||
|
||||
if (LLPipeline::sRenderDeferred)
|
||||
{ //if deferred rendering is enabled, bump faces aren't registered as simple
|
||||
//render bump faces here as simple so bump faces will appear under water
|
||||
pushRiggedBatches(LLRenderPass::PASS_BUMP_RIGGED, mask, TRUE, TRUE);
|
||||
pushRiggedBatches(LLRenderPass::PASS_MATERIAL_RIGGED, mask, TRUE, TRUE);
|
||||
pushRiggedBatches(LLRenderPass::PASS_SPECMAP_RIGGED, mask, TRUE, TRUE);
|
||||
pushRiggedBatches(LLRenderPass::PASS_NORMMAP_RIGGED, mask, TRUE, TRUE);
|
||||
pushRiggedBatches(LLRenderPass::PASS_NORMSPEC_RIGGED, mask, TRUE, TRUE);
|
||||
pushRiggedBatches(LLRenderPass::PASS_BUMP_RIGGED, true, true);
|
||||
pushRiggedBatches(LLRenderPass::PASS_MATERIAL_RIGGED, true, true);
|
||||
pushRiggedBatches(LLRenderPass::PASS_SPECMAP_RIGGED, true, true);
|
||||
pushRiggedBatches(LLRenderPass::PASS_NORMMAP_RIGGED, true, true);
|
||||
pushRiggedBatches(LLRenderPass::PASS_NORMSPEC_RIGGED, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -228,19 +226,19 @@ void LLDrawPoolAlphaMask::render(S32 pass)
|
|||
|
||||
// render static
|
||||
setup_simple_shader(shader);
|
||||
pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
pushMaskBatches(LLRenderPass::PASS_MATERIAL_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
pushMaskBatches(LLRenderPass::PASS_SPECMAP_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
pushMaskBatches(LLRenderPass::PASS_NORMMAP_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
pushMaskBatches(LLRenderPass::PASS_NORMSPEC_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, true, true);
|
||||
pushMaskBatches(LLRenderPass::PASS_MATERIAL_ALPHA_MASK, true, true);
|
||||
pushMaskBatches(LLRenderPass::PASS_SPECMAP_MASK, true, true);
|
||||
pushMaskBatches(LLRenderPass::PASS_NORMMAP_MASK, true, true);
|
||||
pushMaskBatches(LLRenderPass::PASS_NORMSPEC_MASK, true, true);
|
||||
|
||||
// render rigged
|
||||
setup_simple_shader(shader->mRiggedVariant);
|
||||
pushRiggedMaskBatches(LLRenderPass::PASS_ALPHA_MASK_RIGGED, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
pushRiggedMaskBatches(LLRenderPass::PASS_MATERIAL_ALPHA_MASK_RIGGED, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
pushRiggedMaskBatches(LLRenderPass::PASS_SPECMAP_MASK_RIGGED, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
pushRiggedMaskBatches(LLRenderPass::PASS_NORMMAP_MASK_RIGGED, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
pushRiggedMaskBatches(LLRenderPass::PASS_NORMSPEC_MASK_RIGGED, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
pushRiggedMaskBatches(LLRenderPass::PASS_ALPHA_MASK_RIGGED, true, true);
|
||||
pushRiggedMaskBatches(LLRenderPass::PASS_MATERIAL_ALPHA_MASK_RIGGED, true, true);
|
||||
pushRiggedMaskBatches(LLRenderPass::PASS_SPECMAP_MASK_RIGGED, true, true);
|
||||
pushRiggedMaskBatches(LLRenderPass::PASS_NORMMAP_MASK_RIGGED, true, true);
|
||||
pushRiggedMaskBatches(LLRenderPass::PASS_NORMSPEC_MASK_RIGGED, true, true);
|
||||
}
|
||||
|
||||
LLDrawPoolFullbrightAlphaMask::LLDrawPoolFullbrightAlphaMask() :
|
||||
|
|
@ -269,11 +267,11 @@ void LLDrawPoolFullbrightAlphaMask::render(S32 pass)
|
|||
|
||||
// render static
|
||||
setup_fullbright_shader(shader);
|
||||
pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, true, true);
|
||||
|
||||
// render rigged
|
||||
setup_fullbright_shader(shader->mRiggedVariant);
|
||||
pushRiggedMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK_RIGGED, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
pushRiggedMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK_RIGGED, true, true);
|
||||
}
|
||||
|
||||
//===============================
|
||||
|
|
@ -293,11 +291,11 @@ void LLDrawPoolSimple::renderDeferred(S32 pass)
|
|||
|
||||
//render static
|
||||
setup_simple_shader(&gDeferredDiffuseProgram);
|
||||
pushBatches(LLRenderPass::PASS_SIMPLE, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
pushBatches(LLRenderPass::PASS_SIMPLE, true, true);
|
||||
|
||||
//render rigged
|
||||
setup_simple_shader(gDeferredDiffuseProgram.mRiggedVariant);
|
||||
pushRiggedBatches(LLRenderPass::PASS_SIMPLE_RIGGED, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
pushRiggedBatches(LLRenderPass::PASS_SIMPLE_RIGGED, true, true);
|
||||
}
|
||||
|
||||
static LLTrace::BlockTimerStatHandle FTM_RENDER_ALPHA_MASK_DEFERRED("Deferred Alpha Mask");
|
||||
|
|
@ -310,11 +308,11 @@ void LLDrawPoolAlphaMask::renderDeferred(S32 pass)
|
|||
|
||||
//render static
|
||||
setup_simple_shader(shader);
|
||||
pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, true, true);
|
||||
|
||||
//render rigged
|
||||
setup_simple_shader(shader->mRiggedVariant);
|
||||
pushRiggedMaskBatches(LLRenderPass::PASS_ALPHA_MASK_RIGGED, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
|
||||
pushRiggedMaskBatches(LLRenderPass::PASS_ALPHA_MASK_RIGGED, true, true);
|
||||
}
|
||||
|
||||
// grass drawpool
|
||||
|
|
@ -453,15 +451,14 @@ void LLDrawPoolFullbright::renderPostDeferred(S32 pass)
|
|||
}
|
||||
|
||||
gGL.setSceneBlendType(LLRender::BT_ALPHA);
|
||||
U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXTURE_INDEX;
|
||||
|
||||
// render static
|
||||
setup_fullbright_shader(shader);
|
||||
pushBatches(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask, TRUE, TRUE);
|
||||
pushBatches(LLRenderPass::PASS_FULLBRIGHT, true, true);
|
||||
|
||||
// render rigged
|
||||
setup_fullbright_shader(shader->mRiggedVariant);
|
||||
pushRiggedBatches(LLRenderPass::PASS_FULLBRIGHT_RIGGED, fullbright_mask, TRUE, TRUE);
|
||||
pushRiggedBatches(LLRenderPass::PASS_FULLBRIGHT_RIGGED, true, true);
|
||||
}
|
||||
|
||||
void LLDrawPoolFullbright::render(S32 pass)
|
||||
|
|
@ -480,24 +477,21 @@ void LLDrawPoolFullbright::render(S32 pass)
|
|||
shader = &gObjectFullbrightProgram;
|
||||
}
|
||||
|
||||
|
||||
U32 mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXTURE_INDEX;
|
||||
|
||||
// render static
|
||||
setup_fullbright_shader(shader);
|
||||
pushBatches(LLRenderPass::PASS_FULLBRIGHT, mask, TRUE, TRUE);
|
||||
pushBatches(LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE, mask, TRUE, TRUE);
|
||||
pushBatches(LLRenderPass::PASS_SPECMAP_EMISSIVE, mask, TRUE, TRUE);
|
||||
pushBatches(LLRenderPass::PASS_NORMMAP_EMISSIVE, mask, TRUE, TRUE);
|
||||
pushBatches(LLRenderPass::PASS_NORMSPEC_EMISSIVE, mask, TRUE, TRUE);
|
||||
pushBatches(LLRenderPass::PASS_FULLBRIGHT, true, true);
|
||||
pushBatches(LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE, true, true);
|
||||
pushBatches(LLRenderPass::PASS_SPECMAP_EMISSIVE, true, true);
|
||||
pushBatches(LLRenderPass::PASS_NORMMAP_EMISSIVE, true, true);
|
||||
pushBatches(LLRenderPass::PASS_NORMSPEC_EMISSIVE, true, true);
|
||||
|
||||
// render rigged
|
||||
setup_fullbright_shader(shader->mRiggedVariant);
|
||||
pushRiggedBatches(LLRenderPass::PASS_FULLBRIGHT_RIGGED, mask, TRUE, TRUE);
|
||||
pushRiggedBatches(LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE_RIGGED, mask, TRUE, TRUE);
|
||||
pushRiggedBatches(LLRenderPass::PASS_SPECMAP_EMISSIVE_RIGGED, mask, TRUE, TRUE);
|
||||
pushRiggedBatches(LLRenderPass::PASS_NORMMAP_EMISSIVE_RIGGED, mask, TRUE, TRUE);
|
||||
pushRiggedBatches(LLRenderPass::PASS_NORMSPEC_EMISSIVE_RIGGED, mask, TRUE, TRUE);
|
||||
pushRiggedBatches(LLRenderPass::PASS_FULLBRIGHT_RIGGED, true, true);
|
||||
pushRiggedBatches(LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE_RIGGED, true, true);
|
||||
pushRiggedBatches(LLRenderPass::PASS_SPECMAP_EMISSIVE_RIGGED, true, true);
|
||||
pushRiggedBatches(LLRenderPass::PASS_NORMMAP_EMISSIVE_RIGGED, true, true);
|
||||
pushRiggedBatches(LLRenderPass::PASS_NORMSPEC_EMISSIVE_RIGGED, true, true);
|
||||
}
|
||||
|
||||
S32 LLDrawPoolFullbright::getNumPasses()
|
||||
|
|
@ -531,14 +525,13 @@ void LLDrawPoolFullbrightAlphaMask::renderPostDeferred(S32 pass)
|
|||
}
|
||||
|
||||
LLGLDisable blend(GL_BLEND);
|
||||
U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXTURE_INDEX;
|
||||
|
||||
|
||||
// render static
|
||||
setup_fullbright_shader(shader);
|
||||
pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, fullbright_mask, TRUE, TRUE);
|
||||
pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, true, true);
|
||||
|
||||
// render rigged
|
||||
setup_fullbright_shader(shader->mRiggedVariant);
|
||||
pushRiggedMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK_RIGGED, fullbright_mask, TRUE, TRUE);
|
||||
pushRiggedMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK_RIGGED, true, true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ void LLDrawPoolTerrain::boostTerrainDetailTextures()
|
|||
for (S32 i = 0; i < 4; i++)
|
||||
{
|
||||
compp->mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_TERRAIN);
|
||||
gPipeline.touchTexture(compp->mDetailTextures[i], 1024.f * 1024.f);
|
||||
compp->mDetailTextures[i]->addTextureStats(1024.f * 1024.f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -859,8 +859,7 @@ void LLDrawPoolTerrain::renderOwnership()
|
|||
iter != mDrawFace.end(); iter++)
|
||||
{
|
||||
LLFace *facep = *iter;
|
||||
facep->renderIndexed(LLVertexBuffer::MAP_VERTEX |
|
||||
LLVertexBuffer::MAP_TEXCOORD0);
|
||||
facep->renderIndexed();
|
||||
}
|
||||
|
||||
gGL.matrixMode(LLRender::MM_TEXTURE);
|
||||
|
|
|
|||
|
|
@ -33,14 +33,12 @@ class LLDrawPoolTerrain : public LLFacePool
|
|||
{
|
||||
LLPointer<LLViewerTexture> mTexturep;
|
||||
public:
|
||||
enum
|
||||
{
|
||||
VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
|
||||
LLVertexBuffer::MAP_NORMAL |
|
||||
LLVertexBuffer::MAP_TEXCOORD0 |
|
||||
LLVertexBuffer::MAP_TEXCOORD1 |
|
||||
LLVertexBuffer::MAP_TEXCOORD2 |
|
||||
LLVertexBuffer::MAP_TEXCOORD3
|
||||
enum
|
||||
{
|
||||
VERTEX_DATA_MASK = LLVertexBuffer::MAP_VERTEX |
|
||||
LLVertexBuffer::MAP_NORMAL |
|
||||
LLVertexBuffer::MAP_TEXCOORD0 |
|
||||
LLVertexBuffer::MAP_TEXCOORD1
|
||||
};
|
||||
|
||||
virtual U32 getVertexDataMask();
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ void LLDrawPoolTree::render(S32 pass)
|
|||
gGL.getTexUnit(sDiffTex)->bindFast( LLViewerFetchedTexture::sDefaultDiffuseImagep );
|
||||
// [/SL:KB]
|
||||
// gGL.getTexUnit(sDiffTex)->bindFast(mTexturep);
|
||||
gPipeline.touchTexture(mTexturep, 1024.f * 1024.f); // <=== keep Linden tree textures at full res
|
||||
mTexturep->addTextureStats(1024.f * 1024.f); // <=== keep Linden tree textures at full res
|
||||
|
||||
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
|
||||
iter != mDrawFace.end(); iter++)
|
||||
|
|
@ -123,8 +123,8 @@ void LLDrawPoolTree::render(S32 pass)
|
|||
gPipeline.mMatrixOpCount++;
|
||||
}
|
||||
|
||||
buff->setBufferFast(LLDrawPoolTree::VERTEX_DATA_MASK);
|
||||
buff->drawRangeFast(LLRender::TRIANGLES, 0, buff->getNumVerts()-1, buff->getNumIndices(), 0);
|
||||
buff->setBuffer();
|
||||
buff->drawRange(LLRender::TRIANGLES, 0, buff->getNumVerts()-1, buff->getNumIndices(), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,36 +96,19 @@ void LLDrawPoolWater::setNormalMaps(const LLUUID& normalMapId, const LLUUID& nex
|
|||
mWaterNormp[1]->addTextureStats(1024.f*1024.f);
|
||||
}
|
||||
|
||||
//static
|
||||
void LLDrawPoolWater::restoreGL()
|
||||
{
|
||||
/*LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater();
|
||||
if (pwater)
|
||||
{
|
||||
setTransparentTextures(pwater->getTransparentTextureID(), pwater->getNextTransparentTextureID());
|
||||
setOpaqueTexture(pwater->GetDefaultOpaqueTextureAssetId());
|
||||
setNormalMaps(pwater->getNormalMapID(), pwater->getNextNormalMapID());
|
||||
}*/
|
||||
}
|
||||
|
||||
void LLDrawPoolWater::prerender()
|
||||
{
|
||||
mShaderLevel = LLCubeMap::sUseCubeMaps ? LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_WATER) : 0;
|
||||
}
|
||||
|
||||
S32 LLDrawPoolWater::getNumPasses()
|
||||
{
|
||||
if (LLViewerCamera::getInstance()->getOrigin().mV[2] < 1024.f)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
S32 LLDrawPoolWater::getNumPostDeferredPasses()
|
||||
{
|
||||
return 1;
|
||||
if (LLViewerCamera::getInstance()->getOrigin().mV[2] < 1024.f)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void LLDrawPoolWater::beginPostDeferredPass(S32 pass)
|
||||
|
|
@ -138,13 +121,6 @@ void LLDrawPoolWater::beginPostDeferredPass(S32 pass)
|
|||
LLRenderTarget& src = gPipeline.mRT->screen;
|
||||
LLRenderTarget& dst = gPipeline.mWaterDis;
|
||||
|
||||
#if 0
|
||||
dst.copyContents(src,
|
||||
0, 0, src.getWidth(), src.getHeight(),
|
||||
0, 0, dst.getWidth(), dst.getHeight(),
|
||||
GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT,
|
||||
GL_NEAREST);
|
||||
#else
|
||||
dst.bindTarget();
|
||||
gCopyDepthProgram.bind();
|
||||
|
||||
|
|
@ -154,369 +130,14 @@ void LLDrawPoolWater::beginPostDeferredPass(S32 pass)
|
|||
gGL.getTexUnit(diff_map)->bind(&src);
|
||||
gGL.getTexUnit(depth_map)->bind(&src, true);
|
||||
|
||||
gPipeline.mScreenTriangleVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
||||
gPipeline.mScreenTriangleVB->setBuffer();
|
||||
gPipeline.mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
|
||||
|
||||
dst.flush();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void LLDrawPoolWater::renderPostDeferred(S32 pass)
|
||||
{
|
||||
renderWater();
|
||||
}
|
||||
|
||||
|
||||
S32 LLDrawPoolWater::getNumDeferredPasses()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//===============================
|
||||
//DEFERRED IMPLEMENTATION
|
||||
//===============================
|
||||
void LLDrawPoolWater::renderDeferred(S32 pass)
|
||||
{
|
||||
#if 0
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_WATER);
|
||||
|
||||
if (!LLPipeline::sRenderTransparentWater)
|
||||
{
|
||||
// Will render opaque water without use of ALM
|
||||
render(pass);
|
||||
return;
|
||||
}
|
||||
|
||||
deferred_render = TRUE;
|
||||
renderWater();
|
||||
deferred_render = FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
//=========================================
|
||||
|
||||
void LLDrawPoolWater::render(S32 pass)
|
||||
{
|
||||
#if 0
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_WATER);
|
||||
if (mDrawFace.empty() || LLDrawable::getCurrentFrame() <= 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//do a quick 'n dirty depth sort
|
||||
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
|
||||
iter != mDrawFace.end(); iter++)
|
||||
{
|
||||
LLFace* facep = *iter;
|
||||
facep->mDistance = -facep->mCenterLocal.mV[2];
|
||||
}
|
||||
|
||||
std::sort(mDrawFace.begin(), mDrawFace.end(), LLFace::CompareDistanceGreater());
|
||||
|
||||
// See if we are rendering water as opaque or not
|
||||
if (!LLPipeline::sRenderTransparentWater)
|
||||
{
|
||||
// render water for low end hardware
|
||||
renderOpaqueLegacyWater();
|
||||
return;
|
||||
}
|
||||
|
||||
LLGLEnable blend(GL_BLEND);
|
||||
|
||||
if ((mShaderLevel > 0) && !sSkipScreenCopy)
|
||||
{
|
||||
renderWater();
|
||||
return;
|
||||
}
|
||||
|
||||
LLVOSky *voskyp = gSky.mVOSkyp;
|
||||
|
||||
stop_glerror();
|
||||
|
||||
LLFace* refl_face = voskyp->getReflFace();
|
||||
|
||||
gPipeline.disableLights();
|
||||
|
||||
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
|
||||
|
||||
LLGLDisable cullFace(GL_CULL_FACE);
|
||||
|
||||
// Set up second pass first
|
||||
gGL.getTexUnit(1)->activate();
|
||||
gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
|
||||
gGL.getTexUnit(1)->bind(mWaterImagep[0]) ;
|
||||
|
||||
gGL.getTexUnit(2)->activate();
|
||||
gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE);
|
||||
gGL.getTexUnit(2)->bind(mWaterImagep[1]) ;
|
||||
|
||||
LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis();
|
||||
F32 up_dot = camera_up * LLVector3::z_axis;
|
||||
|
||||
LLColor4 water_color;
|
||||
if (LLViewerCamera::getInstance()->cameraUnderWater())
|
||||
{
|
||||
water_color.setVec(1.f, 1.f, 1.f, 0.4f);
|
||||
}
|
||||
else
|
||||
{
|
||||
water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot));
|
||||
}
|
||||
|
||||
gGL.diffuseColor4fv(water_color.mV);
|
||||
|
||||
// Automatically generate texture coords for detail map
|
||||
glEnable(GL_TEXTURE_GEN_S); //texture unit 1
|
||||
glEnable(GL_TEXTURE_GEN_T); //texture unit 1
|
||||
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
|
||||
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
|
||||
|
||||
// Slowly move over time.
|
||||
F32 offset = fmod(gFrameTimeSeconds*2.f, 100.f);
|
||||
F32 tp0[4] = {16.f/256.f, 0.0f, 0.0f, offset*0.01f};
|
||||
F32 tp1[4] = {0.0f, 16.f/256.f, 0.0f, offset*0.01f};
|
||||
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0);
|
||||
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1);
|
||||
|
||||
gGL.getTexUnit(0)->activate();
|
||||
|
||||
glClearStencil(1);
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
//LLGLEnable gls_stencil(GL_STENCIL_TEST);
|
||||
glStencilOp(GL_KEEP, GL_REPLACE, GL_KEEP);
|
||||
glStencilFunc(GL_ALWAYS, 0, 0xFFFFFFFF);
|
||||
|
||||
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
|
||||
iter != mDrawFace.end(); iter++)
|
||||
{
|
||||
LLFace *face = *iter;
|
||||
if (voskyp->isReflFace(face))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
gGL.getTexUnit(0)->bind(face->getTexture());
|
||||
face->renderIndexed();
|
||||
}
|
||||
|
||||
// Now, disable texture coord generation on texture state 1
|
||||
gGL.getTexUnit(1)->activate();
|
||||
gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
gGL.getTexUnit(1)->disable();
|
||||
|
||||
glDisable(GL_TEXTURE_GEN_S); //texture unit 1
|
||||
glDisable(GL_TEXTURE_GEN_T); //texture unit 1
|
||||
|
||||
gGL.getTexUnit(2)->activate();
|
||||
gGL.getTexUnit(2)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
gGL.getTexUnit(2)->disable();
|
||||
|
||||
glDisable(GL_TEXTURE_GEN_S); //texture unit 1
|
||||
glDisable(GL_TEXTURE_GEN_T); //texture unit 1
|
||||
|
||||
// Disable texture coordinate and color arrays
|
||||
gGL.getTexUnit(0)->activate();
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
|
||||
stop_glerror();
|
||||
|
||||
if (gSky.mVOSkyp->getCubeMap() && !LLPipeline::sReflectionProbesEnabled)
|
||||
{
|
||||
gSky.mVOSkyp->getCubeMap()->enable(0);
|
||||
gSky.mVOSkyp->getCubeMap()->bind();
|
||||
|
||||
gGL.matrixMode(LLRender::MM_TEXTURE);
|
||||
gGL.loadIdentity();
|
||||
LLMatrix4 camera_mat = LLViewerCamera::getInstance()->getModelview();
|
||||
LLMatrix4 camera_rot(camera_mat.getMat3());
|
||||
camera_rot.invert();
|
||||
|
||||
gGL.loadMatrix((F32 *)camera_rot.mMatrix);
|
||||
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
LLOverrideFaceColor overrid(this, 1.f, 1.f, 1.f, 0.5f*up_dot);
|
||||
|
||||
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
|
||||
iter != mDrawFace.end(); iter++)
|
||||
{
|
||||
LLFace *face = *iter;
|
||||
if (voskyp->isReflFace(face))
|
||||
{
|
||||
//refl_face = face;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (face->getGeomCount() > 0)
|
||||
{
|
||||
face->renderIndexed();
|
||||
}
|
||||
}
|
||||
|
||||
gSky.mVOSkyp->getCubeMap()->disable();
|
||||
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
|
||||
gGL.matrixMode(LLRender::MM_TEXTURE);
|
||||
gGL.loadIdentity();
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
|
||||
}
|
||||
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
||||
|
||||
if (refl_face)
|
||||
{
|
||||
glStencilFunc(GL_NOTEQUAL, 0, 0xFFFFFFFF);
|
||||
renderReflection(refl_face);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// for low end hardware
|
||||
void LLDrawPoolWater::renderOpaqueLegacyWater()
|
||||
{
|
||||
#if 0
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
|
||||
LLVOSky *voskyp = gSky.mVOSkyp;
|
||||
|
||||
if (voskyp == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LLGLSLShader* shader = NULL;
|
||||
if (LLPipeline::sUnderWaterRender)
|
||||
{
|
||||
shader = &gObjectSimpleNonIndexedTexGenWaterProgram;
|
||||
}
|
||||
else
|
||||
{
|
||||
shader = &gObjectSimpleNonIndexedTexGenProgram;
|
||||
}
|
||||
|
||||
shader->bind();
|
||||
|
||||
stop_glerror();
|
||||
|
||||
// Depth sorting and write to depth buffer
|
||||
// since this is opaque, we should see nothing
|
||||
// behind the water. No blending because
|
||||
// of no transparency. And no face culling so
|
||||
// that the underside of the water is also opaque.
|
||||
LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE);
|
||||
LLGLDisable no_cull(GL_CULL_FACE);
|
||||
LLGLDisable no_blend(GL_BLEND);
|
||||
|
||||
gPipeline.disableLights();
|
||||
|
||||
// Activate the texture binding and bind one
|
||||
// texture since all images will have the same texture
|
||||
gGL.getTexUnit(0)->activate();
|
||||
gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
|
||||
gGL.getTexUnit(0)->bind(mOpaqueWaterImagep);
|
||||
|
||||
// Automatically generate texture coords for water texture
|
||||
if (!shader)
|
||||
{
|
||||
glEnable(GL_TEXTURE_GEN_S); //texture unit 0
|
||||
glEnable(GL_TEXTURE_GEN_T); //texture unit 0
|
||||
glTexGenf(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
|
||||
glTexGenf(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
|
||||
}
|
||||
|
||||
// Use the fact that we know all water faces are the same size
|
||||
// to save some computation
|
||||
|
||||
// Slowly move texture coordinates over time so the watter appears
|
||||
// to be moving.
|
||||
F32 movement_period_secs = 50.f;
|
||||
|
||||
F32 offset = fmod(gFrameTimeSeconds, movement_period_secs);
|
||||
|
||||
if (movement_period_secs != 0)
|
||||
{
|
||||
offset /= movement_period_secs;
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
F32 tp0[4] = { 16.f / 256.f, 0.0f, 0.0f, offset };
|
||||
F32 tp1[4] = { 0.0f, 16.f / 256.f, 0.0f, offset };
|
||||
|
||||
if (!shader)
|
||||
{
|
||||
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0);
|
||||
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1);
|
||||
}
|
||||
else
|
||||
{
|
||||
shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0);
|
||||
shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1);
|
||||
}
|
||||
|
||||
gGL.diffuseColor3f(1.f, 1.f, 1.f);
|
||||
|
||||
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
|
||||
iter != mDrawFace.end(); iter++)
|
||||
{
|
||||
LLFace *face = *iter;
|
||||
if (voskyp->isReflFace(face))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
face->renderIndexed();
|
||||
}
|
||||
|
||||
stop_glerror();
|
||||
|
||||
if (!shader)
|
||||
{
|
||||
// Reset the settings back to expected values
|
||||
glDisable(GL_TEXTURE_GEN_S); //texture unit 0
|
||||
glDisable(GL_TEXTURE_GEN_T); //texture unit 0
|
||||
}
|
||||
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void LLDrawPoolWater::renderReflection(LLFace* face)
|
||||
{
|
||||
#if 0
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
|
||||
LLVOSky *voskyp = gSky.mVOSkyp;
|
||||
|
||||
if (!voskyp)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!face->getGeomCount())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
S8 dr = voskyp->getDrawRefl();
|
||||
if (dr < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LLGLSNoFog noFog;
|
||||
|
||||
gGL.getTexUnit(0)->bind((dr == 0) ? voskyp->getSunTex() : voskyp->getMoonTex());
|
||||
|
||||
LLOverrideFaceColor override(this, LLColor4(face->getFaceColor().mV));
|
||||
face->renderIndexed();
|
||||
#endif
|
||||
}
|
||||
|
||||
void LLDrawPoolWater::renderWater()
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
|
||||
if (!deferred_render)
|
||||
|
|
|
|||
|
|
@ -61,25 +61,15 @@ public:
|
|||
LLDrawPoolWater();
|
||||
/*virtual*/ ~LLDrawPoolWater();
|
||||
|
||||
static void restoreGL();
|
||||
|
||||
|
||||
S32 getNumPostDeferredPasses() override;
|
||||
void beginPostDeferredPass(S32 pass) override;
|
||||
void renderPostDeferred(S32 pass) override;
|
||||
S32 getNumDeferredPasses() override;
|
||||
void renderDeferred(S32 pass = 0) override;
|
||||
|
||||
S32 getNumPasses() override;
|
||||
void render(S32 pass = 0) override;
|
||||
void prerender() override;
|
||||
|
||||
LLViewerTexture *getDebugTexture() override;
|
||||
LLColor3 getDebugColor() const; // For AGP debug display
|
||||
|
||||
void renderReflection(LLFace* face);
|
||||
void renderWater();
|
||||
|
||||
void setTransparentTextures(const LLUUID& transparentTextureId, const LLUUID& nextTransparentTextureId);
|
||||
void setOpaqueTexture(const LLUUID& opaqueTextureId);
|
||||
void setNormalMaps(const LLUUID& normalMapId, const LLUUID& nextNormalMapId);
|
||||
|
|
|
|||
|
|
@ -200,7 +200,6 @@ void LLFace::destroy()
|
|||
|
||||
if (isState(LLFace::PARTICLE))
|
||||
{
|
||||
LLVOPartGroup::freeVBSlot(getGeomIndex()/4);
|
||||
clearState(LLFace::PARTICLE);
|
||||
}
|
||||
|
||||
|
|
@ -563,6 +562,7 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color)
|
|||
|
||||
if (mDrawablep->isState(LLDrawable::RIGGED))
|
||||
{
|
||||
#if 0 // TODO -- there is no way this won't destroy our GL machine as implemented, rewrite it to not rely on software skinning
|
||||
LLVOVolume* volume = mDrawablep->getVOVolume();
|
||||
if (volume)
|
||||
{
|
||||
|
|
@ -589,12 +589,13 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color)
|
|||
// </FS:Ansariel>
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// cheaters sometimes prosper...
|
||||
//
|
||||
mVertexBuffer->setBuffer(mVertexBuffer->getTypeMask());
|
||||
mVertexBuffer->setBuffer();
|
||||
mVertexBuffer->draw(LLRender::TRIANGLES, mIndicesCount, mIndicesIndex);
|
||||
}
|
||||
|
||||
|
|
@ -688,54 +689,8 @@ void LLFace::renderOneWireframe(const LLColor4 &color, F32 fogCfx, bool wirefram
|
|||
}
|
||||
}
|
||||
|
||||
/* removed in lieu of raycast uv detection
|
||||
void LLFace::renderSelectedUV()
|
||||
{
|
||||
LLViewerTexture* red_blue_imagep = LLViewerTextureManager::getFetchedTextureFromFile("uv_test1.j2c", TRUE, LLGLTexture::BOOST_UI);
|
||||
LLViewerTexture* green_imagep = LLViewerTextureManager::getFetchedTextureFromFile("uv_test2.tga", TRUE, LLGLTexture::BOOST_UI);
|
||||
|
||||
LLGLSUVSelect object_select;
|
||||
|
||||
// use red/blue gradient to get coarse UV coordinates
|
||||
renderSelected(red_blue_imagep, LLColor4::white);
|
||||
|
||||
static F32 bias = 0.f;
|
||||
static F32 factor = -10.f;
|
||||
glPolygonOffset(factor, bias);
|
||||
|
||||
// add green dither pattern on top of red/blue gradient
|
||||
gGL.blendFunc(LLRender::BF_ONE, LLRender::BF_ONE);
|
||||
gGL.matrixMode(LLRender::MM_TEXTURE);
|
||||
gGL.pushMatrix();
|
||||
// make green pattern repeat once per texel in red/blue texture
|
||||
gGL.scalef(256.f, 256.f, 1.f);
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
|
||||
renderSelected(green_imagep, LLColor4::white);
|
||||
|
||||
gGL.matrixMode(LLRender::MM_TEXTURE);
|
||||
gGL.popMatrix();
|
||||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, LLRender::BF_ONE_MINUS_SOURCE_ALPHA);
|
||||
}
|
||||
*/
|
||||
|
||||
void LLFace::setDrawInfo(LLDrawInfo* draw_info)
|
||||
{
|
||||
if (draw_info)
|
||||
{
|
||||
if (draw_info->mFace)
|
||||
{
|
||||
draw_info->mFace->setDrawInfo(NULL);
|
||||
}
|
||||
draw_info->mFace = this;
|
||||
}
|
||||
|
||||
if (mDrawInfo)
|
||||
{
|
||||
mDrawInfo->mFace = NULL;
|
||||
}
|
||||
|
||||
mDrawInfo = draw_info;
|
||||
}
|
||||
|
||||
|
|
@ -1290,13 +1245,8 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
|
||||
num_vertices = llclamp( num_vertices, (S32)0, (S32)mGeomCount );
|
||||
num_indices = llclamp( num_indices, (S32)0, (S32)mIndicesCount );
|
||||
|
||||
// </FS:ND>
|
||||
|
||||
|
||||
//don't use map range (generates many redundant unmap calls)
|
||||
bool map_range = false;
|
||||
|
||||
if (mVertexBuffer.notNull())
|
||||
{
|
||||
if (num_indices + (S32) mIndicesIndex > mVertexBuffer->getNumIndices())
|
||||
|
|
@ -1428,7 +1378,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
if (full_rebuild)
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - indices");
|
||||
mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex, mIndicesCount, map_range);
|
||||
mVertexBuffer->getIndexStrider(indicesp, mIndicesIndex, mIndicesCount);
|
||||
|
||||
volatile __m128i* dst = (__m128i*) indicesp.get();
|
||||
__m128i* src = (__m128i*) vf.mIndices;
|
||||
|
|
@ -1451,11 +1401,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
*idx++ = vf.mIndices[i]+index_offset;
|
||||
}
|
||||
}
|
||||
|
||||
if (map_range)
|
||||
{
|
||||
mVertexBuffer->flush();
|
||||
}
|
||||
}
|
||||
|
||||
F32 r = 0, os = 0, ot = 0, ms = 0, mt = 0, cos_ang = 0, sin_ang = 0;
|
||||
|
|
@ -1781,11 +1726,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (map_range)
|
||||
{
|
||||
mVertexBuffer->flush();
|
||||
}
|
||||
}
|
||||
else
|
||||
{ //bump mapped or has material, just do the whole expensive loop
|
||||
|
|
@ -1805,12 +1745,12 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
switch (ch)
|
||||
{
|
||||
case 0:
|
||||
mVertexBuffer->getTexCoord0Strider(dst, mGeomIndex, mGeomCount, map_range);
|
||||
mVertexBuffer->getTexCoord0Strider(dst, mGeomIndex, mGeomCount);
|
||||
break;
|
||||
case 1:
|
||||
if (mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD1))
|
||||
{
|
||||
mVertexBuffer->getTexCoord1Strider(dst, mGeomIndex, mGeomCount, map_range);
|
||||
mVertexBuffer->getTexCoord1Strider(dst, mGeomIndex, mGeomCount);
|
||||
if (mat && !tex_anim)
|
||||
{
|
||||
r = mat->getNormalRotation();
|
||||
|
|
@ -1830,7 +1770,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
case 2:
|
||||
if (mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD2))
|
||||
{
|
||||
mVertexBuffer->getTexCoord2Strider(dst, mGeomIndex, mGeomCount, map_range);
|
||||
mVertexBuffer->getTexCoord2Strider(dst, mGeomIndex, mGeomCount);
|
||||
if (mat && !tex_anim)
|
||||
{
|
||||
r = mat->getSpecularRotation();
|
||||
|
|
@ -1889,14 +1829,9 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
}
|
||||
}
|
||||
|
||||
if (map_range)
|
||||
{
|
||||
mVertexBuffer->flush();
|
||||
}
|
||||
|
||||
if ((!mat && !gltf_mat) && do_bump)
|
||||
{
|
||||
mVertexBuffer->getTexCoord1Strider(tex_coords1, mGeomIndex, mGeomCount, map_range);
|
||||
mVertexBuffer->getTexCoord1Strider(tex_coords1, mGeomIndex, mGeomCount);
|
||||
|
||||
mVObjp->getVolume()->genTangents(f);
|
||||
|
||||
|
|
@ -1931,11 +1866,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
|
||||
*tex_coords1++ = tc;
|
||||
}
|
||||
|
||||
if (map_range)
|
||||
{
|
||||
mVertexBuffer->flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1951,7 +1881,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
|
||||
llassert(num_vertices > 0);
|
||||
|
||||
mVertexBuffer->getVertexStrider(vert, mGeomIndex, mGeomCount, map_range);
|
||||
mVertexBuffer->getVertexStrider(vert, mGeomIndex, mGeomCount);
|
||||
|
||||
|
||||
F32* dst = (F32*) vert.get();
|
||||
|
|
@ -1997,18 +1927,13 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
res0.store4a((F32*) dst);
|
||||
dst += 4;
|
||||
}
|
||||
|
||||
if (map_range)
|
||||
{
|
||||
mVertexBuffer->flush();
|
||||
}
|
||||
}
|
||||
|
||||
if (rebuild_normal)
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - normal");
|
||||
|
||||
mVertexBuffer->getNormalStrider(norm, mGeomIndex, mGeomCount, map_range);
|
||||
mVertexBuffer->getNormalStrider(norm, mGeomIndex, mGeomCount);
|
||||
F32* normals = (F32*) norm.get();
|
||||
LLVector4a* src = vf.mNormals;
|
||||
LLVector4a* end = src+num_vertices;
|
||||
|
|
@ -2020,17 +1945,12 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
normal.store4a(normals);
|
||||
normals += 4;
|
||||
}
|
||||
|
||||
if (map_range)
|
||||
{
|
||||
mVertexBuffer->flush();
|
||||
}
|
||||
}
|
||||
|
||||
if (rebuild_tangent)
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - tangent");
|
||||
mVertexBuffer->getTangentStrider(tangent, mGeomIndex, mGeomCount, map_range);
|
||||
mVertexBuffer->getTangentStrider(tangent, mGeomIndex, mGeomCount);
|
||||
F32* tangents = (F32*) tangent.get();
|
||||
|
||||
mVObjp->getVolume()->genTangents(f);
|
||||
|
|
@ -2052,17 +1972,12 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
src++;
|
||||
tangents += 4;
|
||||
}
|
||||
|
||||
if (map_range)
|
||||
{
|
||||
mVertexBuffer->flush();
|
||||
}
|
||||
}
|
||||
|
||||
if (rebuild_weights && vf.mWeights)
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - weight");
|
||||
mVertexBuffer->getWeight4Strider(wght, mGeomIndex, mGeomCount, map_range);
|
||||
mVertexBuffer->getWeight4Strider(wght, mGeomIndex, mGeomCount);
|
||||
// <FS:Ansariel> Vectorized Weight4Strider and ClothWeightStrider by Drake Arconis
|
||||
//F32* weights = (F32*) wght.get();
|
||||
//LLVector4a::memcpyNonAliased16(weights, (F32*) vf.mWeights, num_vertices*4*sizeof(F32));
|
||||
|
|
@ -2071,16 +1986,12 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
*(wght++) = vf.mWeights[i];
|
||||
}
|
||||
// </FS:Ansariel>
|
||||
if (map_range)
|
||||
{
|
||||
mVertexBuffer->flush();
|
||||
}
|
||||
}
|
||||
|
||||
if (rebuild_color && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_COLOR) )
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - color");
|
||||
mVertexBuffer->getColorStrider(colors, mGeomIndex, mGeomCount, map_range);
|
||||
mVertexBuffer->getColorStrider(colors, mGeomIndex, mGeomCount);
|
||||
|
||||
LLVector4a src;
|
||||
|
||||
|
|
@ -2101,18 +2012,13 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
src.store4a(dst);
|
||||
dst += 4;
|
||||
}
|
||||
|
||||
if (map_range)
|
||||
{
|
||||
mVertexBuffer->flush();
|
||||
}
|
||||
}
|
||||
|
||||
if (rebuild_emissive)
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("getGeometryVolume - emissive");
|
||||
LLStrider<LLColor4U> emissive;
|
||||
mVertexBuffer->getEmissiveStrider(emissive, mGeomIndex, mGeomCount, map_range);
|
||||
mVertexBuffer->getEmissiveStrider(emissive, mGeomIndex, mGeomCount);
|
||||
|
||||
U8 glow = (U8) llclamp((S32) (getTextureEntry()->getGlow()*255), 0, 255);
|
||||
|
||||
|
|
@ -2140,11 +2046,6 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
src.store4a(dst);
|
||||
dst += 4;
|
||||
}
|
||||
|
||||
if (map_range)
|
||||
{
|
||||
mVertexBuffer->flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2167,6 +2068,15 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void LLFace::renderIndexed()
|
||||
{
|
||||
if (mVertexBuffer.notNull())
|
||||
{
|
||||
mVertexBuffer->setBuffer();
|
||||
mVertexBuffer->drawRange(LLRender::TRIANGLES, getGeomIndex(), getGeomIndex() + getGeomCount()-1, getIndicesCount(), getIndicesStart());
|
||||
}
|
||||
}
|
||||
|
||||
//check if the face has a media
|
||||
BOOL LLFace::hasMedia() const
|
||||
{
|
||||
|
|
@ -2498,92 +2408,12 @@ void LLFace::setViewerObject(LLViewerObject* objp)
|
|||
mVObjp = objp;
|
||||
}
|
||||
|
||||
const LLColor4& LLFace::getRenderColor() const
|
||||
{
|
||||
if (isState(USE_FACE_COLOR))
|
||||
{
|
||||
return mFaceColor; // Face Color
|
||||
}
|
||||
else
|
||||
{
|
||||
const LLTextureEntry* tep = getTextureEntry();
|
||||
return (tep ? tep->getColor() : LLColor4::white);
|
||||
}
|
||||
}
|
||||
|
||||
void LLFace::renderSetColor() const
|
||||
{
|
||||
if (!LLFacePool::LLOverrideFaceColor::sOverrideFaceColor)
|
||||
{
|
||||
const LLColor4* color = &(getRenderColor());
|
||||
|
||||
gGL.diffuseColor4fv(color->mV);
|
||||
}
|
||||
}
|
||||
|
||||
S32 LLFace::pushVertices(const U16* index_array) const
|
||||
{
|
||||
if (mIndicesCount)
|
||||
{
|
||||
mVertexBuffer->drawRange(LLRender::TRIANGLES, mGeomIndex, mGeomIndex+mGeomCount-1, mIndicesCount, mIndicesIndex);
|
||||
gPipeline.addTrianglesDrawn(mIndicesCount);
|
||||
}
|
||||
|
||||
return mIndicesCount;
|
||||
}
|
||||
|
||||
const LLMatrix4& LLFace::getRenderMatrix() const
|
||||
{
|
||||
return mDrawablep->getRenderMatrix();
|
||||
}
|
||||
|
||||
S32 LLFace::renderElements(const U16 *index_array) const
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE
|
||||
|
||||
S32 ret = 0;
|
||||
|
||||
if (isState(GLOBAL))
|
||||
{
|
||||
ret = pushVertices(index_array);
|
||||
}
|
||||
else
|
||||
{
|
||||
gGL.pushMatrix();
|
||||
gGL.multMatrix((float*)getRenderMatrix().mMatrix);
|
||||
ret = pushVertices(index_array);
|
||||
gGL.popMatrix();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
S32 LLFace::renderIndexed()
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE
|
||||
|
||||
if(mDrawablep == NULL || mDrawPoolp == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return renderIndexed(mDrawPoolp->getVertexDataMask());
|
||||
}
|
||||
|
||||
S32 LLFace::renderIndexed(U32 mask)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE
|
||||
|
||||
if (mVertexBuffer.isNull())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
mVertexBuffer->setBuffer(mask);
|
||||
U16* index_array = (U16*) mVertexBuffer->getIndicesPointer();
|
||||
return renderElements(index_array);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
// From llface.inl
|
||||
|
||||
|
|
|
|||
|
|
@ -126,12 +126,6 @@ public:
|
|||
|
||||
S32 getIndexInTex(U32 ch) const {llassert(ch < LLRender::NUM_TEXTURE_CHANNELS); return mIndexInTex[ch];}
|
||||
void setIndexInTex(U32 ch, S32 index) { llassert(ch < LLRender::NUM_TEXTURE_CHANNELS); mIndexInTex[ch] = index ;}
|
||||
|
||||
void renderSetColor() const;
|
||||
S32 renderElements(const U16 *index_array) const;
|
||||
S32 renderIndexed ();
|
||||
S32 renderIndexed (U32 mask);
|
||||
S32 pushVertices(const U16* index_array) const;
|
||||
|
||||
void setWorldMatrix(const LLMatrix4& mat);
|
||||
const LLTextureEntry* getTextureEntry() const { return mVObjp->getTE(mTEOffset); }
|
||||
|
|
@ -152,11 +146,12 @@ public:
|
|||
void setDrawable(LLDrawable *drawable);
|
||||
void setTEOffset(const S32 te_offset);
|
||||
|
||||
void renderIndexed();
|
||||
|
||||
void setFaceColor(const LLColor4& color); // override material color
|
||||
void unsetFaceColor(); // switch back to material color
|
||||
const LLColor4& getFaceColor() const { return mFaceColor; }
|
||||
const LLColor4& getRenderColor() const;
|
||||
|
||||
|
||||
//for volumes
|
||||
void updateRebuildFlags();
|
||||
|
|
|
|||
|
|
@ -399,6 +399,7 @@ void LLVolumeImplFlexible::doIdleUpdate()
|
|||
|
||||
updateRenderRes();
|
||||
|
||||
mVO->shrinkWrap();
|
||||
gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_POSITION, FALSE);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -864,8 +864,8 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance)
|
|||
U32 num_indices = vf.mNumIndices;
|
||||
U32 num_vertices = vf.mNumVertices;
|
||||
|
||||
mVertexBuffer = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0, 0);
|
||||
if (!mVertexBuffer->allocateBuffer(num_vertices, num_indices, TRUE))
|
||||
mVertexBuffer = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0);
|
||||
if (!mVertexBuffer->allocateBuffer(num_vertices, num_indices))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer for image preview to"
|
||||
<< num_vertices << " vertices and "
|
||||
|
|
@ -973,7 +973,7 @@ BOOL LLImagePreviewSculpted::render()
|
|||
const F32 BRIGHTNESS = 0.9f;
|
||||
gGL.diffuseColor3f(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS);
|
||||
|
||||
mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0);
|
||||
mVertexBuffer->setBuffer();
|
||||
mVertexBuffer->draw(LLRender::TRIANGLES, num_indices, 0);
|
||||
|
||||
gGL.popMatrix();
|
||||
|
|
|
|||
|
|
@ -2099,13 +2099,6 @@ void LLFloaterPreference::refreshEnabledState()
|
|||
childSetEnabled("FSRestrictMaxTextureSize", false);
|
||||
#endif
|
||||
|
||||
#if LL_DARWIN
|
||||
getChildView("vbo_stream")->setEnabled(FALSE); //Hardcoded disable on mac
|
||||
getChild<LLUICtrl>("vbo_stream")->setValue((LLSD::Boolean) FALSE);
|
||||
#else
|
||||
getChildView("vbo_stream")->setEnabled(LLVertexBuffer::sEnableVBOs);
|
||||
#endif
|
||||
|
||||
if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderCompressTextures"))
|
||||
{
|
||||
getChildView("texture compression")->setEnabled(FALSE);
|
||||
|
|
|
|||
|
|
@ -1233,9 +1233,9 @@ F32 gpu_benchmark()
|
|||
delete [] pixels;
|
||||
|
||||
//make a dummy triangle to draw with
|
||||
LLPointer<LLVertexBuffer> buff = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX, GL_STREAM_DRAW);
|
||||
LLPointer<LLVertexBuffer> buff = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX);
|
||||
|
||||
if (!buff->allocateBuffer(3, 0, true))
|
||||
if (!buff->allocateBuffer(3, 0))
|
||||
{
|
||||
LL_WARNS("Benchmark") << "Failed to allocate buffer during benchmark." << LL_ENDL;
|
||||
// abandon the benchmark test
|
||||
|
|
@ -1259,12 +1259,12 @@ F32 gpu_benchmark()
|
|||
v[1].set(-1, -3, 0);
|
||||
v[2].set(3, 1, 0);
|
||||
|
||||
buff->flush();
|
||||
buff->unmapBuffer();
|
||||
|
||||
// ensure matched pair of bind() and unbind() calls
|
||||
ShaderBinder binder(gBenchmarkProgram);
|
||||
|
||||
buff->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
||||
buff->setBuffer();
|
||||
glFinish();
|
||||
|
||||
F32 time_passed = 0.f; // seconds
|
||||
|
|
|
|||
|
|
@ -269,9 +269,9 @@ void LLHUDObject::renderAll()
|
|||
{
|
||||
LLGLSUIDefault gls_ui;
|
||||
|
||||
gUIProgram.bind();
|
||||
gGL.color4f(1, 1, 1, 1);
|
||||
|
||||
gUIProgram.bind();
|
||||
LLGLDepthTest depth(GL_FALSE, GL_FALSE);
|
||||
|
||||
LLHUDObject *hud_objp;
|
||||
|
|
|
|||
|
|
@ -614,7 +614,6 @@ void LLHUDText::markDead()
|
|||
void LLHUDText::renderAllHUD()
|
||||
{
|
||||
LLGLState::checkStates();
|
||||
LLGLState::checkTextureChannels();
|
||||
|
||||
{
|
||||
LLGLEnable color_mat(GL_COLOR_MATERIAL);
|
||||
|
|
@ -631,7 +630,6 @@ void LLHUDText::renderAllHUD()
|
|||
LLVertexBuffer::unbind();
|
||||
|
||||
LLGLState::checkStates();
|
||||
LLGLState::checkTextureChannels();
|
||||
}
|
||||
|
||||
void LLHUDText::shiftAll(const LLVector3& offset)
|
||||
|
|
|
|||
|
|
@ -2899,19 +2899,14 @@ void LLMaterialEditor::loadAsset()
|
|||
|
||||
setEnableEditing(false); // wait for it to load
|
||||
|
||||
// request the asset.
|
||||
gAssetStorage->getInvItemAsset(source_sim,
|
||||
gAgent.getID(),
|
||||
gAgent.getSessionID(),
|
||||
item->getPermissions().getOwner(),
|
||||
mObjectUUID,
|
||||
item->getUUID(),
|
||||
item->getAssetUUID(),
|
||||
item->getType(),
|
||||
mAssetStatus = PREVIEW_ASSET_LOADING;
|
||||
|
||||
// May callback immediately
|
||||
gAssetStorage->getAssetData(item->getAssetUUID(),
|
||||
LLAssetType::AT_MATERIAL,
|
||||
&onLoadComplete,
|
||||
(void*)user_data,
|
||||
TRUE);
|
||||
mAssetStatus = PREVIEW_ASSET_LOADING;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2962,7 +2957,7 @@ void LLMaterialEditor::onLoadComplete(const LLUUID& asset_uuid,
|
|||
{
|
||||
if (asset_uuid != editor->mAssetID)
|
||||
{
|
||||
LL_WARNS() << "Asset id mismatch, expected: " << editor->mAssetID << " got: " << asset_uuid << LL_ENDL;
|
||||
LL_WARNS("MaterialEditor") << "Asset id mismatch, expected: " << editor->mAssetID << " got: " << asset_uuid << LL_ENDL;
|
||||
}
|
||||
if (0 == status)
|
||||
{
|
||||
|
|
@ -2991,6 +2986,8 @@ void LLMaterialEditor::onLoadComplete(const LLUUID& asset_uuid,
|
|||
}
|
||||
else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status)
|
||||
{
|
||||
// Not supposed to happen?
|
||||
LL_WARNS("MaterialEditor") << "No permission to view material " << asset_uuid << LL_ENDL;
|
||||
LLNotificationsUtil::add("MaterialNoPermissions");
|
||||
}
|
||||
else
|
||||
|
|
@ -2999,7 +2996,7 @@ void LLMaterialEditor::onLoadComplete(const LLUUID& asset_uuid,
|
|||
}
|
||||
editor->setEnableEditing(false);
|
||||
|
||||
LL_WARNS() << "Problem loading material: " << status << LL_ENDL;
|
||||
LL_WARNS("MaterialEditor") << "Problem loading material: " << status << LL_ENDL;
|
||||
editor->mAssetStatus = PREVIEW_ASSET_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1731,7 +1731,7 @@ void LLModelPreview::genGlodLODs(S32 which_lod, U32 decimation, bool enforce_tri
|
|||
for (U32 i = 0; i < mVertexBuffer[5][mdl].size(); ++i)
|
||||
{
|
||||
LLVertexBuffer* buff = mVertexBuffer[5][mdl][i];
|
||||
buff->setBuffer(type_mask & buff->getTypeMask());
|
||||
buff->setBuffer();
|
||||
|
||||
U32 num_indices = mVertexBuffer[5][mdl][i]->getNumIndices();
|
||||
if (num_indices > 2)
|
||||
|
|
@ -1885,18 +1885,18 @@ void LLModelPreview::genGlodLODs(S32 which_lod, U32 decimation, bool enforce_tri
|
|||
{
|
||||
type_mask = mVertexBuffer[5][base][i]->getTypeMask();
|
||||
|
||||
LLPointer<LLVertexBuffer> buff = new LLVertexBuffer(type_mask, 0);
|
||||
LLPointer<LLVertexBuffer> buff = new LLVertexBuffer(type_mask);
|
||||
|
||||
if (sizes[i * 2 + 1] > 0 && sizes[i * 2] > 0)
|
||||
{
|
||||
if (!buff->allocateBuffer(sizes[i * 2 + 1], sizes[i * 2], true))
|
||||
if (!buff->allocateBuffer(sizes[i * 2 + 1], sizes[i * 2]))
|
||||
{
|
||||
// Todo: find a way to stop preview in this case instead of crashing
|
||||
LL_ERRS() << "Failed buffer allocation during preview LOD generation."
|
||||
<< " Vertices: " << sizes[i * 2 + 1]
|
||||
<< " Indices: " << sizes[i * 2] << LL_ENDL;
|
||||
}
|
||||
buff->setBuffer(type_mask);
|
||||
buff->setBuffer();
|
||||
// <FS:ND> Fix glod so it works when just using the opengl core profile
|
||||
//glodFillElements(mObject[base], names[i], GL_UNSIGNED_SHORT, (U8*)buff->getIndicesPointer());
|
||||
LLStrider<LLVector3> vertex_strider;
|
||||
|
|
@ -1940,7 +1940,7 @@ void LLModelPreview::genGlodLODs(S32 which_lod, U32 decimation, bool enforce_tri
|
|||
{
|
||||
// This face was eliminated or we failed to allocate buffer,
|
||||
// attempt to create a dummy triangle (one vertex, 3 indices, all 0)
|
||||
buff->allocateBuffer(1, 3, true);
|
||||
buff->allocateBuffer(1, 3);
|
||||
memset((U8*)buff->getMappedData(), 0, buff->getSize());
|
||||
// <FS:ND> Fix when running with opengl core profile
|
||||
//memset((U8*)buff->getIndicesPointer(), 0, buff->getIndicesSize());
|
||||
|
|
@ -3792,9 +3792,9 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights)
|
|||
mask |= LLVertexBuffer::MAP_WEIGHT4;
|
||||
}
|
||||
|
||||
vb = new LLVertexBuffer(mask, 0);
|
||||
vb = new LLVertexBuffer(mask);
|
||||
|
||||
if (!vb->allocateBuffer(num_vertices, num_indices, TRUE))
|
||||
if (!vb->allocateBuffer(num_vertices, num_indices))
|
||||
{
|
||||
// We are likely to crash due this failure, if this happens, find a way to gracefully stop preview
|
||||
std::ostringstream out;
|
||||
|
|
@ -3869,7 +3869,7 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights)
|
|||
*(index_strider++) = vf.mIndices[i];
|
||||
}
|
||||
|
||||
vb->flush();
|
||||
vb->unmapBuffer();
|
||||
|
||||
mVertexBuffer[lod][mdl].push_back(vb);
|
||||
|
||||
|
|
@ -4091,19 +4091,11 @@ void LLModelPreview::addEmptyFace(LLModel* pTarget)
|
|||
{
|
||||
U32 type_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0;
|
||||
|
||||
LLPointer<LLVertexBuffer> buff = new LLVertexBuffer(type_mask, 0);
|
||||
LLPointer<LLVertexBuffer> buff = new LLVertexBuffer(type_mask);
|
||||
|
||||
buff->allocateBuffer(1, 3, true);
|
||||
buff->allocateBuffer(1, 3);
|
||||
memset((U8*)buff->getMappedData(), 0, buff->getSize());
|
||||
// <FS:ND> Fix when running with opengl core profile
|
||||
//memset((U8*)buff->getIndicesPointer(), 0, buff->getIndicesSize());
|
||||
{
|
||||
LLStrider< U16 > index_strider;
|
||||
buff->getIndexStrider( index_strider );
|
||||
|
||||
memset( (U8*)index_strider.get(), 0, buff->getIndicesSize() );
|
||||
}
|
||||
// </FS:ND>
|
||||
memset((U8*)buff->getMappedIndices(), 0, buff->getIndicesSize());
|
||||
|
||||
buff->validateRange(0, buff->getNumVerts() - 1, buff->getNumIndices(), 0);
|
||||
|
||||
|
|
@ -4408,8 +4400,6 @@ BOOL LLModelPreview::render()
|
|||
gGL.pushMatrix();
|
||||
gGL.color4fv(edge_col().mV); // <FS:Beq/> restore changes removed by the lab
|
||||
|
||||
const U32 type_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0;
|
||||
|
||||
LLGLEnable normalize(GL_NORMALIZE);
|
||||
|
||||
if (!mBaseModel.empty() && mVertexBuffer[5].empty())
|
||||
|
|
@ -4472,7 +4462,7 @@ BOOL LLModelPreview::render()
|
|||
{
|
||||
LLVertexBuffer* buffer = mVertexBuffer[mPreviewLOD][model][i];
|
||||
|
||||
buffer->setBuffer(type_mask & buffer->getTypeMask());
|
||||
buffer->setBuffer();
|
||||
|
||||
if (textures)
|
||||
{
|
||||
|
|
@ -4523,7 +4513,7 @@ BOOL LLModelPreview::render()
|
|||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
gGL.setLineWidth(1.f); // <FS> Line width OGL core profile fix by Rye Mutt
|
||||
}
|
||||
buffer->flush();
|
||||
buffer->unmapBuffer();
|
||||
}
|
||||
gGL.popMatrix();
|
||||
}
|
||||
|
|
@ -4637,7 +4627,7 @@ BOOL LLModelPreview::render()
|
|||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
gGL.diffuseColor4fv(phys_fill_col().mV); // <FS:Beq/> restore changes removed by the lab
|
||||
|
||||
buffer->setBuffer(type_mask & buffer->getTypeMask());
|
||||
buffer->setBuffer();
|
||||
buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts() - 1, buffer->getNumIndices(), 0);
|
||||
// <FS:Beq> restore changes removed by the lab
|
||||
// gGL.diffuseColor4fv(PREVIEW_PSYH_EDGE_COL.mV);
|
||||
|
|
@ -4651,7 +4641,7 @@ BOOL LLModelPreview::render()
|
|||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
gGL.setLineWidth(1.f); // <FS> Line width OGL core profile fix by Rye Mutt
|
||||
|
||||
buffer->flush();
|
||||
buffer->unmapBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4707,7 +4697,7 @@ BOOL LLModelPreview::render()
|
|||
{
|
||||
LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][v];
|
||||
|
||||
buffer->setBuffer(type_mask & buffer->getTypeMask());
|
||||
buffer->setBuffer();
|
||||
|
||||
LLStrider<LLVector3> pos_strider;
|
||||
buffer->getVertexStrider(pos_strider, 0);
|
||||
|
|
@ -4737,7 +4727,7 @@ BOOL LLModelPreview::render()
|
|||
}
|
||||
}
|
||||
|
||||
buffer->flush();
|
||||
buffer->unmapBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4878,7 +4868,7 @@ BOOL LLModelPreview::render()
|
|||
const std::string& binding = instance.mModel->mMaterialList[i];
|
||||
const LLImportMaterial& material = instance.mMaterial[binding];
|
||||
|
||||
buffer->setBuffer(type_mask & buffer->getTypeMask());
|
||||
buffer->setBuffer();
|
||||
gGL.diffuseColor4fv(material.mDiffuseColor.mV);
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
|
||||
|
|
@ -4891,7 +4881,7 @@ BOOL LLModelPreview::render()
|
|||
}
|
||||
} else // <FS:ND> FIRE-13465 Make sure there's a material set before dereferencing it, if none, set buffer type and unbind texture.
|
||||
{
|
||||
buffer->setBuffer(type_mask & buffer->getTypeMask());
|
||||
buffer->setBuffer();
|
||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||
} // </FS:ND>
|
||||
|
||||
|
|
|
|||
|
|
@ -531,7 +531,7 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face)
|
|||
{
|
||||
//generate radiance map
|
||||
gRadianceGenProgram.bind();
|
||||
mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
||||
mVertexBuffer->setBuffer();
|
||||
|
||||
S32 channel = gRadianceGenProgram.enableTexture(LLShaderMgr::REFLECTION_PROBES, LLTexUnit::TT_CUBE_MAP_ARRAY);
|
||||
mTexture->bind(channel);
|
||||
|
|
@ -581,7 +581,7 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face)
|
|||
mTexture->bind(channel);
|
||||
|
||||
gIrradianceGenProgram.uniform1i(sSourceIdx, targetIdx);
|
||||
mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
||||
mVertexBuffer->setBuffer();
|
||||
int start_mip = 0;
|
||||
// find the mip target to start with based on irradiance map resolution
|
||||
for (start_mip = 0; start_mip < mMipChain.size(); ++start_mip)
|
||||
|
|
@ -918,8 +918,8 @@ void LLReflectionMapManager::initReflectionMaps()
|
|||
if (mVertexBuffer.isNull())
|
||||
{
|
||||
U32 mask = LLVertexBuffer::MAP_VERTEX;
|
||||
LLPointer<LLVertexBuffer> buff = new LLVertexBuffer(mask, GL_STATIC_DRAW);
|
||||
buff->allocateBuffer(4, 0, TRUE);
|
||||
LLPointer<LLVertexBuffer> buff = new LLVertexBuffer(mask);
|
||||
buff->allocateBuffer(4, 0);
|
||||
|
||||
LLStrider<LLVector3> v;
|
||||
|
||||
|
|
@ -930,7 +930,7 @@ void LLReflectionMapManager::initReflectionMaps()
|
|||
v[2] = LLVector3(-1, 1, -1);
|
||||
v[3] = LLVector3(1, 1, -1);
|
||||
|
||||
buff->flush();
|
||||
buff->unmapBuffer();
|
||||
|
||||
mVertexBuffer = buff;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,12 +65,12 @@ extern bool gShiftFrame;
|
|||
static U32 sZombieGroups = 0;
|
||||
U32 LLSpatialGroup::sNodeCount = 0;
|
||||
|
||||
BOOL LLSpatialGroup::sNoDelete = FALSE;
|
||||
bool LLSpatialGroup::sNoDelete = false;
|
||||
|
||||
static F32 sLastMaxTexPriority = 1.f;
|
||||
static F32 sCurMaxTexPriority = 1.f;
|
||||
|
||||
BOOL LLSpatialPartition::sTeleportRequested = FALSE;
|
||||
bool LLSpatialPartition::sTeleportRequested = false;
|
||||
|
||||
//static counter for frame to switch LOD on
|
||||
|
||||
|
|
@ -315,14 +315,13 @@ void LLSpatialPartition::rebuildGeom(LLSpatialGroup* group)
|
|||
if (vertex_count > 0 && index_count > 0)
|
||||
{ //create vertex buffer containing volume geometry for this node
|
||||
{
|
||||
|
||||
group->mBuilt = 1.f;
|
||||
if (group->mVertexBuffer.isNull() ||
|
||||
!group->mVertexBuffer->isWriteable() ||
|
||||
(group->mBufferUsage != group->mVertexBuffer->getUsage() && LLVertexBuffer::sEnableVBOs))
|
||||
if (group->mVertexBuffer.isNull() ||
|
||||
group->mVertexBuffer->getNumVerts() != vertex_count ||
|
||||
group->mVertexBuffer->getNumVerts() != index_count)
|
||||
{
|
||||
group->mVertexBuffer = createVertexBuffer(mVertexDataMask, group->mBufferUsage);
|
||||
if (!group->mVertexBuffer->allocateBuffer(vertex_count, index_count, true))
|
||||
group->mVertexBuffer = new LLVertexBuffer(mVertexDataMask);
|
||||
if (!group->mVertexBuffer->allocateBuffer(vertex_count, index_count))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer on rebuild to "
|
||||
<< vertex_count << " vertices and "
|
||||
|
|
@ -331,18 +330,6 @@ void LLSpatialPartition::rebuildGeom(LLSpatialGroup* group)
|
|||
group->mBufferMap.clear();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!group->mVertexBuffer->resizeBuffer(vertex_count, index_count))
|
||||
{
|
||||
// Is likely to cause a crash. If this gets triggered find a way to avoid it (don't forget to reset face)
|
||||
LL_WARNS() << "Failed to resize Vertex Buffer on rebuild to "
|
||||
<< vertex_count << " vertices and "
|
||||
<< index_count << " indices" << LL_ENDL;
|
||||
group->mVertexBuffer = NULL;
|
||||
group->mBufferMap.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (group->mVertexBuffer)
|
||||
|
|
@ -544,7 +531,6 @@ LLSpatialGroup::LLSpatialGroup(OctreeNode* node, LLSpatialPartition* part) : LLO
|
|||
mSurfaceArea(0.f),
|
||||
mBuilt(0.f),
|
||||
mVertexBuffer(NULL),
|
||||
mBufferUsage(part->mBufferUsage),
|
||||
mDistance(0.f),
|
||||
mDepth(0.f),
|
||||
mLastUpdateDistance(-1.f),
|
||||
|
|
@ -573,6 +559,7 @@ void LLSpatialGroup::updateDistance(LLCamera &camera)
|
|||
if (LLViewerCamera::sCurCameraID != LLViewerCamera::CAMERA_WORLD)
|
||||
{
|
||||
LL_WARNS() << "Attempted to update distance for camera other than world camera!" << LL_ENDL;
|
||||
llassert(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -858,13 +845,12 @@ void LLSpatialGroup::destroyGL(bool keep_occlusion)
|
|||
|
||||
//==============================================
|
||||
|
||||
LLSpatialPartition::LLSpatialPartition(U32 data_mask, BOOL render_by_group, U32 buffer_usage, LLViewerRegion* regionp)
|
||||
LLSpatialPartition::LLSpatialPartition(U32 data_mask, BOOL render_by_group, LLViewerRegion* regionp)
|
||||
: mRenderByGroup(render_by_group), mBridge(NULL)
|
||||
{
|
||||
mRegionp = regionp;
|
||||
mPartitionType = LLViewerRegion::PARTITION_NONE;
|
||||
mVertexDataMask = data_mask;
|
||||
mBufferUsage = buffer_usage;
|
||||
mDepthMask = FALSE;
|
||||
mSlopRatio = 0.25f;
|
||||
mInfiniteFarClip = FALSE;
|
||||
|
|
@ -1460,15 +1446,15 @@ S32 LLSpatialPartition::cull(LLCamera &camera, bool do_occlusion)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void pushVerts(LLDrawInfo* params, U32 mask)
|
||||
void pushVerts(LLDrawInfo* params)
|
||||
{
|
||||
LLRenderPass::applyModelMatrix(*params);
|
||||
params->mVertexBuffer->setBuffer(mask);
|
||||
params->mVertexBuffer->drawRange(params->mParticle ? LLRender::POINTS : LLRender::TRIANGLES,
|
||||
params->mVertexBuffer->setBuffer();
|
||||
params->mVertexBuffer->drawRange(LLRender::TRIANGLES,
|
||||
params->mStart, params->mEnd, params->mCount, params->mOffset);
|
||||
}
|
||||
|
||||
void pushVerts(LLSpatialGroup* group, U32 mask)
|
||||
void pushVerts(LLSpatialGroup* group)
|
||||
{
|
||||
LLDrawInfo* params = NULL;
|
||||
|
||||
|
|
@ -1477,36 +1463,25 @@ void pushVerts(LLSpatialGroup* group, U32 mask)
|
|||
for (LLSpatialGroup::drawmap_elem_t::iterator j = i->second.begin(); j != i->second.end(); ++j)
|
||||
{
|
||||
params = *j;
|
||||
pushVerts(params, mask);
|
||||
pushVerts(params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void pushVerts(LLFace* face, U32 mask)
|
||||
void pushVerts(LLFace* face)
|
||||
{
|
||||
if (face)
|
||||
{
|
||||
llassert(face->verify());
|
||||
|
||||
LLVertexBuffer* buffer = face->getVertexBuffer();
|
||||
|
||||
if (buffer && (face->getGeomCount() >= 3))
|
||||
{
|
||||
buffer->setBuffer(mask);
|
||||
U16 start = face->getGeomStart();
|
||||
U16 end = start + face->getGeomCount()-1;
|
||||
U32 count = face->getIndicesCount();
|
||||
U16 offset = face->getIndicesStart();
|
||||
buffer->drawRange(LLRender::TRIANGLES, start, end, count, offset);
|
||||
}
|
||||
face->renderIndexed();
|
||||
}
|
||||
}
|
||||
|
||||
void pushVerts(LLDrawable* drawable, U32 mask)
|
||||
void pushVerts(LLDrawable* drawable)
|
||||
{
|
||||
for (S32 i = 0; i < drawable->getNumFaces(); ++i)
|
||||
{
|
||||
pushVerts(drawable->getFace(i), mask);
|
||||
pushVerts(drawable->getFace(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1520,16 +1495,16 @@ void pushVerts(LLVolume* volume)
|
|||
}
|
||||
}
|
||||
|
||||
void pushBufferVerts(LLVertexBuffer* buffer, U32 mask)
|
||||
void pushBufferVerts(LLVertexBuffer* buffer)
|
||||
{
|
||||
if (buffer)
|
||||
{
|
||||
buffer->setBuffer(mask);
|
||||
buffer->setBuffer();
|
||||
buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts()-1, buffer->getNumIndices(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
void pushBufferVerts(LLSpatialGroup* group, U32 mask, bool push_alpha = true)
|
||||
void pushBufferVerts(LLSpatialGroup* group, bool push_alpha = true)
|
||||
{
|
||||
if (group->getSpatialPartition()->mRenderByGroup)
|
||||
{
|
||||
|
|
@ -1540,7 +1515,7 @@ void pushBufferVerts(LLSpatialGroup* group, U32 mask, bool push_alpha = true)
|
|||
|
||||
if (push_alpha)
|
||||
{
|
||||
pushBufferVerts(group->mVertexBuffer, mask);
|
||||
pushBufferVerts(group->mVertexBuffer);
|
||||
}
|
||||
|
||||
for (LLSpatialGroup::buffer_map_t::iterator i = group->mBufferMap.begin(); i != group->mBufferMap.end(); ++i)
|
||||
|
|
@ -1549,7 +1524,7 @@ void pushBufferVerts(LLSpatialGroup* group, U32 mask, bool push_alpha = true)
|
|||
{
|
||||
for (LLSpatialGroup::buffer_list_t::iterator k = j->second.begin(); k != j->second.end(); ++k)
|
||||
{
|
||||
pushBufferVerts(*k, mask);
|
||||
pushBufferVerts(*k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1562,7 +1537,7 @@ void pushBufferVerts(LLSpatialGroup* group, U32 mask, bool push_alpha = true)
|
|||
}*/
|
||||
}
|
||||
|
||||
void pushVertsColorCoded(LLSpatialGroup* group, U32 mask)
|
||||
void pushVertsColorCoded(LLSpatialGroup* group)
|
||||
{
|
||||
LLDrawInfo* params = NULL;
|
||||
|
||||
|
|
@ -1587,8 +1562,8 @@ void pushVertsColorCoded(LLSpatialGroup* group, U32 mask)
|
|||
params = *j;
|
||||
LLRenderPass::applyModelMatrix(*params);
|
||||
gGL.diffuseColor4f(colors[col].mV[0], colors[col].mV[1], colors[col].mV[2], 0.5f);
|
||||
params->mVertexBuffer->setBuffer(mask);
|
||||
params->mVertexBuffer->drawRange(params->mParticle ? LLRender::POINTS : LLRender::TRIANGLES,
|
||||
params->mVertexBuffer->setBuffer();
|
||||
params->mVertexBuffer->drawRange(LLRender::TRIANGLES,
|
||||
params->mStart, params->mEnd, params->mCount, params->mOffset);
|
||||
col = (col+1)%col_count;
|
||||
}
|
||||
|
|
@ -1660,17 +1635,8 @@ void renderOctree(LLSpatialGroup* group)
|
|||
if (group->mBuilt > 0.f)
|
||||
{
|
||||
group->mBuilt -= 2.f * gFrameIntervalSeconds.value();
|
||||
if (group->mBufferUsage == GL_STATIC_DRAW)
|
||||
{
|
||||
col.setVec(1.0f, 0, 0, group->mBuilt*0.5f);
|
||||
}
|
||||
else
|
||||
{
|
||||
col.setVec(0.1f,0.1f,1,0.1f);
|
||||
//col.setVec(1.0f, 1.0f, 0, sinf(group->mBuilt*3.14159f)*0.5f);
|
||||
}
|
||||
|
||||
if (group->mBufferUsage != GL_STATIC_DRAW)
|
||||
col.setVec(0.1f,0.1f,1,0.1f);
|
||||
|
||||
{
|
||||
LLGLDepthTest gl_depth(FALSE, FALSE);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
|
|
@ -1731,20 +1697,36 @@ void renderOctree(LLSpatialGroup* group)
|
|||
LLFace* face = drawable->getFace(j);
|
||||
if (face && face->getVertexBuffer())
|
||||
{
|
||||
if (gFrameTimeSeconds - face->mLastUpdateTime < 0.5f)
|
||||
{
|
||||
gGL.diffuseColor4f(0, 1, 0, group->mBuilt);
|
||||
}
|
||||
else if (gFrameTimeSeconds - face->mLastMoveTime < 0.5f)
|
||||
{
|
||||
gGL.diffuseColor4f(1, 0, 0, group->mBuilt);
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
LLVOVolume* vol = drawable->getVOVolume();
|
||||
|
||||
face->getVertexBuffer()->setBuffer(LLVertexBuffer::MAP_VERTEX | (rigged ? LLVertexBuffer::MAP_WEIGHT4 : 0));
|
||||
if (gFrameTimeSeconds - face->mLastUpdateTime < 0.5f)
|
||||
{
|
||||
if (vol && vol->isShrinkWrapped())
|
||||
{
|
||||
gGL.diffuseColor4f(0, 1, 1, group->mBuilt);
|
||||
}
|
||||
else
|
||||
{
|
||||
gGL.diffuseColor4f(0, 1, 0, group->mBuilt);
|
||||
}
|
||||
}
|
||||
else if (gFrameTimeSeconds - face->mLastMoveTime < 0.5f)
|
||||
{
|
||||
if (vol && vol->isShrinkWrapped())
|
||||
{
|
||||
gGL.diffuseColor4f(1, 1, 0, group->mBuilt);
|
||||
}
|
||||
else
|
||||
{
|
||||
gGL.diffuseColor4f(1, 0, 0, group->mBuilt);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
face->getVertexBuffer()->setBuffer();
|
||||
//drawBox((face->mExtents[0] + face->mExtents[1])*0.5f,
|
||||
// (face->mExtents[1]-face->mExtents[0])*0.5f);
|
||||
face->getVertexBuffer()->draw(LLRender::TRIANGLES, face->getIndicesCount(), face->getIndicesStart());
|
||||
|
|
@ -1766,18 +1748,6 @@ void renderOctree(LLSpatialGroup* group)
|
|||
gGL.diffuseColor4f(1,1,1,1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (group->mBufferUsage == GL_STATIC_DRAW && !group->isEmpty()
|
||||
&& group->getSpatialPartition()->mRenderByGroup)
|
||||
{
|
||||
col.setVec(0.8f, 0.4f, 0.1f, 0.1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
col.setVec(0.1f, 0.1f, 1.f, 0.1f);
|
||||
}
|
||||
}
|
||||
|
||||
gGL.diffuseColor4fv(col.mV);
|
||||
LLVector4a fudge;
|
||||
|
|
@ -1930,7 +1900,7 @@ void renderXRay(LLSpatialGroup* group, LLCamera* camera)
|
|||
|
||||
if (render_objects)
|
||||
{
|
||||
pushBufferVerts(group, LLVertexBuffer::MAP_VERTEX, false);
|
||||
pushBufferVerts(group, false);
|
||||
|
||||
bool selected = false;
|
||||
|
||||
|
|
@ -2012,7 +1982,7 @@ void renderUpdateType(LLDrawable* drawablep)
|
|||
{
|
||||
for (S32 i = 0; i < num_faces; ++i)
|
||||
{
|
||||
pushVerts(drawablep->getFace(i), LLVertexBuffer::MAP_VERTEX);
|
||||
pushVerts(drawablep->getFace(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2103,7 +2073,7 @@ void renderComplexityDisplay(LLDrawable* drawablep)
|
|||
{
|
||||
for (S32 i = 0; i < num_faces; ++i)
|
||||
{
|
||||
pushVerts(drawablep->getFace(i), LLVertexBuffer::MAP_VERTEX);
|
||||
pushVerts(drawablep->getFace(i));
|
||||
}
|
||||
}
|
||||
LLViewerObject::const_child_list_t children = voVol->getChildren();
|
||||
|
|
@ -2117,7 +2087,7 @@ void renderComplexityDisplay(LLDrawable* drawablep)
|
|||
{
|
||||
for (S32 i = 0; i < num_faces; ++i)
|
||||
{
|
||||
pushVerts(child->mDrawable->getFace(i), LLVertexBuffer::MAP_VERTEX);
|
||||
pushVerts(child->mDrawable->getFace(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2788,7 +2758,7 @@ void renderPhysicsShapes(LLSpatialGroup* group, bool wireframe)
|
|||
{
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
|
||||
buff->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
||||
buff->setBuffer();
|
||||
gGL.diffuseColor4f(0.2f, 0.5f, 0.3f, 0.5f);
|
||||
buff->draw(LLRender::TRIANGLES, buff->getNumIndices(), 0);
|
||||
|
||||
|
|
@ -2894,7 +2864,7 @@ void renderTextureAnim(LLDrawInfo* params)
|
|||
|
||||
LLGLEnable blend(GL_BLEND);
|
||||
gGL.diffuseColor4f(1,1,0,0.5f);
|
||||
pushVerts(params, LLVertexBuffer::MAP_VERTEX);
|
||||
pushVerts(params);
|
||||
}
|
||||
|
||||
void renderBatchSize(LLDrawInfo* params)
|
||||
|
|
@ -2902,7 +2872,6 @@ void renderBatchSize(LLDrawInfo* params)
|
|||
LLGLEnable offset(GL_POLYGON_OFFSET_FILL);
|
||||
glPolygonOffset(-1.f, 1.f);
|
||||
LLGLSLShader* old_shader = LLGLSLShader::sCurBoundShaderPtr;
|
||||
U32 mask = LLVertexBuffer::MAP_VERTEX;
|
||||
bool bind = false;
|
||||
if (params->mAvatar)
|
||||
{
|
||||
|
|
@ -2911,11 +2880,11 @@ void renderBatchSize(LLDrawInfo* params)
|
|||
bind = true;
|
||||
old_shader->mRiggedVariant->bind();
|
||||
LLRenderPass::uploadMatrixPalette(*params);
|
||||
mask |= LLVertexBuffer::MAP_WEIGHT4;
|
||||
}
|
||||
|
||||
gGL.diffuseColor4ubv((GLubyte*)&(params->mDebugColor));
|
||||
pushVerts(params, mask);
|
||||
|
||||
gGL.diffuseColor4ubv(params->getDebugColor().mV);
|
||||
pushVerts(params);
|
||||
|
||||
if (bind)
|
||||
{
|
||||
|
|
@ -2971,7 +2940,7 @@ void renderTexelDensity(LLDrawable* drawable)
|
|||
|
||||
if (buffer && (facep->getGeomCount() >= 3))
|
||||
{
|
||||
buffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0);
|
||||
buffer->setBuffer();
|
||||
U16 start = facep->getGeomStart();
|
||||
U16 end = start + facep->getGeomCount()-1;
|
||||
U32 count = facep->getIndicesCount();
|
||||
|
|
@ -3046,7 +3015,7 @@ void renderLights(LLDrawable* drawablep)
|
|||
LLFace * face = drawablep->getFace(i);
|
||||
if (face)
|
||||
{
|
||||
pushVerts(face, LLVertexBuffer::MAP_VERTEX);
|
||||
pushVerts(face);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4160,58 +4129,46 @@ LLDrawable* LLSpatialGroup::lineSegmentIntersect(const LLVector4a& start, const
|
|||
|
||||
LLDrawInfo::LLDrawInfo(U16 start, U16 end, U32 count, U32 offset,
|
||||
LLViewerTexture* texture, LLVertexBuffer* buffer,
|
||||
bool selected,
|
||||
BOOL fullbright, U8 bump, BOOL particle, F32 part_size)
|
||||
bool fullbright, U8 bump)
|
||||
: mVertexBuffer(buffer),
|
||||
mTexture(texture),
|
||||
mTextureMatrix(NULL),
|
||||
mModelMatrix(NULL),
|
||||
mStart(start),
|
||||
mEnd(end),
|
||||
mCount(count),
|
||||
mOffset(offset),
|
||||
mFullbright(fullbright),
|
||||
mBump(bump),
|
||||
mParticle(particle),
|
||||
mPartSize(part_size),
|
||||
mVSize(0.f),
|
||||
mGroup(NULL),
|
||||
mFace(NULL),
|
||||
mDistance(0.f),
|
||||
mMaterial(NULL),
|
||||
mShaderMask(0),
|
||||
mSpecColor(1.0f, 1.0f, 1.0f, 0.5f),
|
||||
mBlendFuncSrc(LLRender::BF_SOURCE_ALPHA),
|
||||
mBlendFuncDst(LLRender::BF_ONE_MINUS_SOURCE_ALPHA),
|
||||
mHasGlow(FALSE),
|
||||
mHasGlow(false),
|
||||
mEnvIntensity(0.0f),
|
||||
mAlphaMaskCutoff(0.5f),
|
||||
mDiffuseAlphaMode(0)
|
||||
mAlphaMaskCutoff(0.5f)
|
||||
{
|
||||
mVertexBuffer->validateRange(mStart, mEnd, mCount, mOffset);
|
||||
|
||||
mDebugColor = (rand() << 16) + rand();
|
||||
((U8*)&mDebugColor)[3] = 200;
|
||||
}
|
||||
|
||||
LLDrawInfo::~LLDrawInfo()
|
||||
{
|
||||
/*if (LLSpatialGroup::sNoDelete)
|
||||
{
|
||||
LL_ERRS() << "LLDrawInfo deleted illegally!" << LL_ENDL;
|
||||
}*/
|
||||
|
||||
if (mFace)
|
||||
{
|
||||
mFace->setDrawInfo(NULL);
|
||||
}
|
||||
|
||||
if (gDebugGL)
|
||||
{
|
||||
gPipeline.checkReferences(this);
|
||||
}
|
||||
}
|
||||
|
||||
LLColor4U LLDrawInfo::getDebugColor() const
|
||||
{
|
||||
LLColor4U color;
|
||||
|
||||
LLCRC hash;
|
||||
hash.update((U8*)this + sizeof(S32), sizeof(LLDrawInfo) - sizeof(S32));
|
||||
|
||||
*((U32*) color.mV) = hash.getCRC();
|
||||
|
||||
color.mV[3] = 200;
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
void LLDrawInfo::validate()
|
||||
{
|
||||
mVertexBuffer->validateRange(mStart, mEnd, mCount, mOffset);
|
||||
|
|
@ -4222,11 +4179,6 @@ U64 LLDrawInfo::getSkinHash()
|
|||
return mSkinInfo ? mSkinInfo->mHash : 0;
|
||||
}
|
||||
|
||||
LLVertexBuffer* LLGeometryManager::createVertexBuffer(U32 type_mask, U32 usage)
|
||||
{
|
||||
return new LLVertexBuffer(type_mask, usage);
|
||||
}
|
||||
|
||||
LLCullResult::LLCullResult()
|
||||
{
|
||||
mVisibleGroupsAllocated = 0;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class LLSpatialGroup;
|
|||
class LLViewerRegion;
|
||||
class LLReflectionMap;
|
||||
|
||||
void pushVerts(LLFace* face, U32 mask);
|
||||
void pushVerts(LLFace* face);
|
||||
//<FS:BEQ> Make helper functions externally visible for use from viewerwindow
|
||||
void pushVerts(LLVolume* volume);
|
||||
void drawBoxOutline(const LLVector3& pos, const LLVector3& size);
|
||||
|
|
@ -69,7 +69,13 @@ void renderMeshBaseHull(LLVOVolume* volume, U32 data_mask, LLColor4& color);
|
|||
void render_hull(LLModel::PhysicsMesh& mesh, const LLColor4& color);
|
||||
//</FS:BEQ>
|
||||
|
||||
class LLDrawInfo : public LLRefCount
|
||||
/*
|
||||
Class that represents a single Draw Call
|
||||
|
||||
Make every effort to keep size minimal.
|
||||
Member ordering is important for cache coherency
|
||||
*/
|
||||
class LLDrawInfo final : public LLRefCount
|
||||
{
|
||||
LL_ALIGN_NEW;
|
||||
protected:
|
||||
|
|
@ -86,11 +92,13 @@ public:
|
|||
LL_ERRS() << "Illegal operation!" << LL_ENDL;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// return a hash of this LLDrawInfo as a debug color
|
||||
LLColor4U getDebugColor() const;
|
||||
|
||||
LLDrawInfo(U16 start, U16 end, U32 count, U32 offset,
|
||||
LLViewerTexture* image, LLVertexBuffer* buffer,
|
||||
bool selected,
|
||||
BOOL fullbright = FALSE, U8 bump = 0, BOOL particle = FALSE, F32 part_size = 0);
|
||||
LLViewerTexture* image, LLVertexBuffer* buffer,
|
||||
bool fullbright = false, U8 bump = 0);
|
||||
|
||||
|
||||
void validate();
|
||||
|
|
@ -99,55 +107,47 @@ public:
|
|||
U64 getSkinHash();
|
||||
|
||||
LLPointer<LLVertexBuffer> mVertexBuffer;
|
||||
U16 mStart = 0;
|
||||
U16 mEnd = 0;
|
||||
U32 mCount = 0;
|
||||
U32 mOffset = 0;
|
||||
|
||||
LLPointer<LLViewerTexture> mTexture;
|
||||
std::vector<LLPointer<LLViewerTexture> > mTextureList;
|
||||
LLPointer<LLViewerTexture> mSpecularMap;
|
||||
LLPointer<LLViewerTexture> mNormalMap;
|
||||
|
||||
// virtual size of mTexture and mTextureList textures
|
||||
// used to update the decode priority of textures in this DrawInfo
|
||||
std::vector<F32> mTextureListVSize;
|
||||
const LLMatrix4* mSpecularMapMatrix = nullptr;
|
||||
const LLMatrix4* mNormalMapMatrix = nullptr;
|
||||
const LLMatrix4* mTextureMatrix = nullptr;
|
||||
const LLMatrix4* mModelMatrix = nullptr;
|
||||
|
||||
const LLMatrix4* mTextureMatrix;
|
||||
const LLMatrix4* mModelMatrix;
|
||||
U16 mStart;
|
||||
U16 mEnd;
|
||||
U32 mCount;
|
||||
U32 mOffset;
|
||||
BOOL mFullbright;
|
||||
U8 mBump;
|
||||
U8 mShiny;
|
||||
U8 mTextureTimer = 1;
|
||||
BOOL mParticle;
|
||||
F32 mPartSize;
|
||||
F32 mVSize;
|
||||
LLSpatialGroup* mGroup;
|
||||
LL_ALIGN_16(LLFace* mFace); //associated face
|
||||
F32 mDistance;
|
||||
S32 mDebugColor;
|
||||
|
||||
// Material pointer here is likely for debugging only and are immaterial (zing!)
|
||||
LLMaterialPtr mMaterial;
|
||||
|
||||
// PBR material parameters
|
||||
LLPointer<LLFetchedGLTFMaterial> mGLTFMaterial;
|
||||
|
||||
LLUUID mMaterialID; // id of LLGLTFMaterial or LLMaterial applied to this draw info
|
||||
|
||||
U32 mShaderMask;
|
||||
U32 mBlendFuncSrc;
|
||||
U32 mBlendFuncDst;
|
||||
BOOL mHasGlow;
|
||||
LLPointer<LLViewerTexture> mSpecularMap;
|
||||
const LLMatrix4* mSpecularMapMatrix;
|
||||
LLPointer<LLViewerTexture> mNormalMap;
|
||||
const LLMatrix4* mNormalMapMatrix;
|
||||
|
||||
LLVector4 mSpecColor; // XYZ = Specular RGB, W = Specular Exponent
|
||||
F32 mEnvIntensity;
|
||||
F32 mAlphaMaskCutoff;
|
||||
U8 mDiffuseAlphaMode;
|
||||
LLPointer<LLVOAvatar> mAvatar = nullptr;
|
||||
LLMeshSkinInfo* mSkinInfo = nullptr;
|
||||
|
||||
// Material pointer here is likely for debugging only and are immaterial (zing!)
|
||||
LLPointer<LLMaterial> mMaterial;
|
||||
|
||||
// PBR material parameters
|
||||
LLPointer<LLFetchedGLTFMaterial> mGLTFMaterial;
|
||||
|
||||
LLVector4 mSpecColor = LLVector4(1.f, 1.f, 1.f, 0.5f); // XYZ = Specular RGB, W = Specular Exponent
|
||||
|
||||
std::vector<LLPointer<LLViewerTexture> > mTextureList;
|
||||
|
||||
LLUUID mMaterialID; // id of LLGLTFMaterial or LLMaterial applied to this draw info
|
||||
|
||||
U32 mShaderMask = 0;
|
||||
F32 mEnvIntensity = 0.f;
|
||||
F32 mAlphaMaskCutoff = 0.5f;
|
||||
|
||||
LLRender::eBlendFactor mBlendFuncSrc = LLRender::BF_SOURCE_ALPHA;
|
||||
LLRender::eBlendFactor mBlendFuncDst = LLRender::BF_ONE_MINUS_SOURCE_ALPHA;
|
||||
U8 mDiffuseAlphaMode = 0;
|
||||
U8 mBump = 0;
|
||||
U8 mShiny = 0;
|
||||
bool mFullbright = false;
|
||||
bool mHasGlow = false;
|
||||
|
||||
struct CompareTexture
|
||||
{
|
||||
bool operator()(const LLDrawInfo& lhs, const LLDrawInfo& rhs)
|
||||
|
|
@ -207,19 +207,9 @@ public:
|
|||
&& (lhs.isNull() || (rhs.notNull() && lhs->mBump > rhs->mBump));
|
||||
}
|
||||
};
|
||||
|
||||
struct CompareDistanceGreater
|
||||
{
|
||||
bool operator()(const LLPointer<LLDrawInfo>& lhs, const LLPointer<LLDrawInfo>& rhs)
|
||||
{
|
||||
// sort by mBump value, sort NULL down to the end
|
||||
return lhs.get() != rhs.get()
|
||||
&& (lhs.isNull() || (rhs.notNull() && lhs->mDistance > rhs->mDistance));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
LL_ALIGN_PREFIX(64)
|
||||
LL_ALIGN_PREFIX(16)
|
||||
class LLSpatialGroup : public LLOcclusionCullingGroup
|
||||
{
|
||||
friend class LLSpatialPartition;
|
||||
|
|
@ -238,7 +228,7 @@ public:
|
|||
}
|
||||
|
||||
static U32 sNodeCount;
|
||||
static BOOL sNoDelete; //deletion of spatial groups and draw info not allowed if TRUE
|
||||
static bool sNoDelete; //deletion of spatial groups and draw info not allowed if TRUE
|
||||
|
||||
typedef std::vector<LLPointer<LLSpatialGroup> > sg_vector_t;
|
||||
typedef std::vector<LLPointer<LLSpatialBridge> > bridge_list_t;
|
||||
|
|
@ -354,25 +344,21 @@ public:
|
|||
LL_ALIGN_16(LLVector4a mViewAngle);
|
||||
LL_ALIGN_16(LLVector4a mLastUpdateViewAngle);
|
||||
|
||||
F32 mObjectBoxSize; //cached mObjectBounds[1].getLength3()
|
||||
|
||||
protected:
|
||||
virtual ~LLSpatialGroup();
|
||||
|
||||
public:
|
||||
LLPointer<LLVertexBuffer> mVertexBuffer;
|
||||
draw_map_t mDrawMap;
|
||||
|
||||
bridge_list_t mBridgeList;
|
||||
buffer_map_t mBufferMap; //used by volume buffers to attempt to reuse vertex buffers
|
||||
|
||||
F32 mObjectBoxSize; //cached mObjectBounds[1].getLength3()
|
||||
U32 mGeometryBytes; //used by volumes to track how many bytes of geometry data are in this node
|
||||
F32 mSurfaceArea; //used by volumes to track estimated surface area of geometry in this node
|
||||
|
||||
F32 mBuilt;
|
||||
|
||||
LLPointer<LLVertexBuffer> mVertexBuffer;
|
||||
|
||||
U32 mBufferUsage;
|
||||
draw_map_t mDrawMap;
|
||||
|
||||
F32 mDistance;
|
||||
F32 mDepth;
|
||||
F32 mLastUpdateDistance;
|
||||
|
|
@ -386,8 +372,7 @@ public:
|
|||
U32 mRenderOrder = 0;
|
||||
// Reflection Probe associated with this node (if any)
|
||||
LLPointer<LLReflectionMap> mReflectionProbe = nullptr;
|
||||
|
||||
} LL_ALIGN_POSTFIX(64);
|
||||
} LL_ALIGN_POSTFIX(16);
|
||||
|
||||
class LLGeometryManager
|
||||
{
|
||||
|
|
@ -398,14 +383,12 @@ public:
|
|||
virtual void rebuildMesh(LLSpatialGroup* group) = 0;
|
||||
virtual void getGeometry(LLSpatialGroup* group) = 0;
|
||||
virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32 &index_count);
|
||||
|
||||
virtual LLVertexBuffer* createVertexBuffer(U32 type_mask, U32 usage);
|
||||
};
|
||||
|
||||
class LLSpatialPartition: public LLViewerOctreePartition, public LLGeometryManager
|
||||
{
|
||||
public:
|
||||
LLSpatialPartition(U32 data_mask, BOOL render_by_group, U32 mBufferUsage, LLViewerRegion* regionp);
|
||||
LLSpatialPartition(U32 data_mask, BOOL render_by_group, LLViewerRegion* regionp);
|
||||
virtual ~LLSpatialPartition();
|
||||
|
||||
LLSpatialGroup *put(LLDrawable *drawablep, BOOL was_visible = FALSE);
|
||||
|
|
@ -456,14 +439,13 @@ public:
|
|||
// use a pointer instead of making "isBridge" and "asBridge" virtual so it's safe
|
||||
// to call asBridge() from the destructor
|
||||
|
||||
BOOL mInfiniteFarClip; // if TRUE, frustum culling ignores far clip plane
|
||||
U32 mBufferUsage;
|
||||
const BOOL mRenderByGroup;
|
||||
bool mInfiniteFarClip; // if TRUE, frustum culling ignores far clip plane
|
||||
const bool mRenderByGroup;
|
||||
U32 mVertexDataMask;
|
||||
F32 mSlopRatio; //percentage distance must change before drawables receive LOD update (default is 0.25);
|
||||
BOOL mDepthMask; //if TRUE, objects in this partition will be written to depth during alpha rendering
|
||||
bool mDepthMask; //if TRUE, objects in this partition will be written to depth during alpha rendering
|
||||
|
||||
static BOOL sTeleportRequested; //started to issue a teleport request
|
||||
static bool sTeleportRequested; //started to issue a teleport request
|
||||
};
|
||||
|
||||
// class for creating bridges between spatial partitions
|
||||
|
|
@ -642,7 +624,6 @@ class LLTerrainPartition : public LLSpatialPartition
|
|||
public:
|
||||
LLTerrainPartition(LLViewerRegion* regionp);
|
||||
virtual void getGeometry(LLSpatialGroup* group);
|
||||
virtual LLVertexBuffer* createVertexBuffer(U32 type_mask, U32 usage);
|
||||
};
|
||||
|
||||
//spatial partition for trees
|
||||
|
|
|
|||
|
|
@ -189,9 +189,8 @@ void LLSprite::updateFace(LLFace &face)
|
|||
if (!face.getVertexBuffer())
|
||||
{
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX |
|
||||
LLVertexBuffer::MAP_TEXCOORD0,
|
||||
GL_STREAM_DRAW);
|
||||
buff->allocateBuffer(4, 12, TRUE);
|
||||
LLVertexBuffer::MAP_TEXCOORD0 );
|
||||
buff->allocateBuffer(4, 12);
|
||||
face.setGeomIndex(0);
|
||||
face.setIndicesIndex(0);
|
||||
face.setVertexBuffer(buff);
|
||||
|
|
@ -243,7 +242,7 @@ void LLSprite::updateFace(LLFace &face)
|
|||
*indicesp++ = 3 + index_offset;
|
||||
}
|
||||
|
||||
face.getVertexBuffer()->flush();
|
||||
face.getVertexBuffer()->unmapBuffer();
|
||||
face.mCenterAgent = mPosition;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2286,12 +2286,10 @@ bool idle_startup()
|
|||
LL_DEBUGS("AppInit") << "Initializing sky..." << LL_ENDL;
|
||||
// Initialize all of the viewer object classes for the first time (doing things like texture fetches.
|
||||
LLGLState::checkStates();
|
||||
LLGLState::checkTextureChannels();
|
||||
|
||||
gSky.init();
|
||||
|
||||
LLGLState::checkStates();
|
||||
LLGLState::checkTextureChannels();
|
||||
|
||||
display_startup();
|
||||
|
||||
|
|
|
|||
|
|
@ -164,7 +164,6 @@ void display_startup()
|
|||
static S32 frame_count = 0;
|
||||
|
||||
LLGLState::checkStates();
|
||||
LLGLState::checkTextureChannels();
|
||||
|
||||
if (frame_count++ > 1) // make sure we have rendered a frame first
|
||||
{
|
||||
|
|
@ -176,7 +175,6 @@ void display_startup()
|
|||
}
|
||||
|
||||
LLGLState::checkStates();
|
||||
LLGLState::checkTextureChannels();
|
||||
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); // | GL_STENCIL_BUFFER_BIT);
|
||||
LLGLSUIDefault gls_ui;
|
||||
|
|
@ -184,7 +182,6 @@ void display_startup()
|
|||
|
||||
if (gViewerWindow)
|
||||
gViewerWindow->setup2DRender();
|
||||
gGL.color4f(1,1,1,1);
|
||||
if (gViewerWindow)
|
||||
gViewerWindow->draw();
|
||||
gGL.flush();
|
||||
|
|
@ -192,7 +189,6 @@ void display_startup()
|
|||
LLVertexBuffer::unbind();
|
||||
|
||||
LLGLState::checkStates();
|
||||
LLGLState::checkTextureChannels();
|
||||
|
||||
if (gViewerWindow && gViewerWindow->getWindow())
|
||||
gViewerWindow->getWindow()->swapBuffers();
|
||||
|
|
@ -316,7 +312,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
|
|||
LLVertexBuffer::unbind();
|
||||
|
||||
LLGLState::checkStates();
|
||||
LLGLState::checkTextureChannels();
|
||||
|
||||
stop_glerror();
|
||||
|
||||
|
|
@ -373,7 +368,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
|
|||
|
||||
LLAppViewer::instance()->pingMainloopTimeout("Display:CheckStates");
|
||||
LLGLState::checkStates();
|
||||
LLGLState::checkTextureChannels();
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
//
|
||||
|
|
@ -815,7 +809,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
|
|||
gDepthDirty = FALSE;
|
||||
|
||||
LLGLState::checkStates();
|
||||
LLGLState::checkTextureChannels();
|
||||
|
||||
static LLCullResult result;
|
||||
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
|
||||
|
|
@ -824,7 +817,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
|
|||
stop_glerror();
|
||||
|
||||
LLGLState::checkStates();
|
||||
LLGLState::checkTextureChannels();
|
||||
|
||||
LLAppViewer::instance()->pingMainloopTimeout("Display:Swap");
|
||||
|
||||
|
|
@ -840,7 +832,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
|
|||
glClearColor(0,0,0,0);
|
||||
|
||||
LLGLState::checkStates();
|
||||
LLGLState::checkTextureChannels();
|
||||
|
||||
if (!for_snapshot)
|
||||
{
|
||||
|
|
@ -853,7 +844,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
|
|||
LLVertexBuffer::unbind();
|
||||
|
||||
LLGLState::checkStates();
|
||||
LLGLState::checkTextureChannels();
|
||||
|
||||
glh::matrix4f proj = get_current_projection();
|
||||
glh::matrix4f mod = get_current_modelview();
|
||||
|
|
@ -870,10 +860,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
|
|||
gViewerWindow->setup3DViewport();
|
||||
|
||||
LLGLState::checkStates();
|
||||
LLGLState::checkTextureChannels();
|
||||
|
||||
}
|
||||
glClear(GL_DEPTH_BUFFER_BIT); // | GL_STENCIL_BUFFER_BIT);
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
|
|
@ -1069,19 +1057,11 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
|
|||
}
|
||||
|
||||
gOcclusionProgram.unbind();
|
||||
|
||||
}
|
||||
|
||||
|
||||
gGL.setColorMask(true, false);
|
||||
if (LLPipeline::sRenderDeferred)
|
||||
{
|
||||
gPipeline.renderGeomDeferred(camera, true); // <FS:Ansariel> Factor out calls to getInstance
|
||||
}
|
||||
else
|
||||
{
|
||||
gPipeline.renderGeom(camera, TRUE); // <FS:Ansariel> Factor out calls to getInstance
|
||||
}
|
||||
gGL.setColorMask(true, true);
|
||||
gPipeline.renderGeomDeferred(*LLViewerCamera::getInstance(), true);
|
||||
|
||||
//store this frame's modelview matrix for use
|
||||
//when rendering next frame's occlusion queries
|
||||
|
|
@ -1244,14 +1224,10 @@ void display_cube_face()
|
|||
}
|
||||
gPipeline.mRT->deferredScreen.clear();
|
||||
|
||||
gGL.setColorMask(true, false);
|
||||
|
||||
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
|
||||
|
||||
gPipeline.renderGeomDeferred(*LLViewerCamera::getInstance());
|
||||
|
||||
gGL.setColorMask(true, true);
|
||||
|
||||
gPipeline.mRT->deferredScreen.flush();
|
||||
|
||||
gPipeline.renderDeferredLighting();
|
||||
|
|
@ -1503,9 +1479,12 @@ void render_ui(F32 zoom_factor, int subfield)
|
|||
}
|
||||
|
||||
{
|
||||
LLGLState::checkStates();
|
||||
|
||||
// Render our post process prior to the HUD, UI, etc.
|
||||
gPipeline.renderPostProcess();
|
||||
|
||||
LLGLState::checkStates();
|
||||
// draw hud and 3D ui elements into screen render target so they'll be able to use
|
||||
// the depth buffer (avoids extra copy of depth buffer per frame)
|
||||
gPipeline.screenTarget()->bindTarget();
|
||||
|
|
@ -1523,6 +1502,7 @@ void render_ui(F32 zoom_factor, int subfield)
|
|||
LLVfxManager::instance().runEffect(EVisualEffect::RlvOverlay);
|
||||
}
|
||||
// [/RLVa:KB]
|
||||
LLGLState::checkStates();
|
||||
render_hud_attachments();
|
||||
|
||||
LLGLState::checkStates();
|
||||
|
|
@ -1533,8 +1513,6 @@ void render_ui(F32 zoom_factor, int subfield)
|
|||
gPipeline.disableLights();
|
||||
}
|
||||
|
||||
gGL.color4f(1,1,1,1);
|
||||
|
||||
bool render_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI);
|
||||
if (render_ui)
|
||||
{
|
||||
|
|
@ -1677,6 +1655,7 @@ void render_ui_3d()
|
|||
stop_glerror();
|
||||
|
||||
gUIProgram.bind();
|
||||
gGL.color4f(1, 1, 1, 1);
|
||||
|
||||
// Coordinate axes
|
||||
// <FS:Ansariel> gSavedSettings replacement
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/**
|
||||
* @file llviewerjointmesh.cpp
|
||||
* @brief Implementation of LLViewerJointMesh class
|
||||
*
|
||||
|
|
@ -63,10 +63,6 @@ extern PFNGLWEIGHTFVARBPROC glWeightfvARB;
|
|||
extern PFNGLVERTEXBLENDARBPROC glVertexBlendARB;
|
||||
#endif
|
||||
|
||||
static const U32 sRenderMask = LLVertexBuffer::MAP_VERTEX |
|
||||
LLVertexBuffer::MAP_NORMAL |
|
||||
LLVertexBuffer::MAP_TEXCOORD0;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
// LLViewerJointMesh
|
||||
|
|
@ -298,8 +294,6 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
|
|||
gGL.getTexUnit(diffuse_channel)->bind(LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT));
|
||||
}
|
||||
|
||||
U32 mask = sRenderMask;
|
||||
|
||||
U32 start = mMesh->mFaceVertexOffset;
|
||||
U32 end = start + mMesh->mFaceVertexCount - 1;
|
||||
U32 count = mMesh->mFaceIndexCount;
|
||||
|
|
@ -315,14 +309,9 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
|
|||
{
|
||||
uploadJointMatrices();
|
||||
}
|
||||
mask = mask | LLVertexBuffer::MAP_WEIGHT;
|
||||
if (mFace->getPool()->getShaderLevel() > 1)
|
||||
{
|
||||
mask = mask | LLVertexBuffer::MAP_CLOTHWEIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
buff->setBuffer(mask);
|
||||
buff->setBuffer();
|
||||
buff->drawRange(LLRender::TRIANGLES, start, end, count, offset);
|
||||
}
|
||||
else
|
||||
|
|
@ -330,7 +319,7 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
|
|||
gGL.pushMatrix();
|
||||
LLMatrix4 jointToWorld = getWorldMatrix();
|
||||
gGL.multMatrix((GLfloat*)jointToWorld.mMatrix);
|
||||
buff->setBuffer(mask);
|
||||
buff->setBuffer();
|
||||
buff->drawRange(LLRender::TRIANGLES, start, end, count, offset);
|
||||
gGL.popMatrix();
|
||||
}
|
||||
|
|
@ -519,7 +508,7 @@ void LLViewerJointMesh::updateGeometry(LLFace *mFace, LLPolyMesh *mMesh)
|
|||
}
|
||||
}
|
||||
|
||||
buffer->flush();
|
||||
buffer->unmapBuffer();
|
||||
}
|
||||
|
||||
void LLViewerJointMesh::updateJointGeometry()
|
||||
|
|
|
|||
|
|
@ -5650,6 +5650,7 @@ S32 LLViewerObject::setTERotation(const U8 te, const F32 r)
|
|||
if (mDrawable.notNull() && retval)
|
||||
{
|
||||
gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_TCOORD);
|
||||
shrinkWrap();
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
|
@ -7049,7 +7050,7 @@ F32 LLAlphaObject::getPartSize(S32 idx)
|
|||
return 0.f;
|
||||
}
|
||||
|
||||
void LLAlphaObject::getBlendFunc(S32 face, U32& src, U32& dst)
|
||||
void LLAlphaObject::getBlendFunc(S32 face, LLRender::eBlendFactor& src, LLRender::eBlendFactor& dst)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -7465,6 +7466,18 @@ void LLViewerObject::setRenderMaterialIDs(const LLRenderMaterialParams* material
|
|||
}
|
||||
}
|
||||
|
||||
void LLViewerObject::shrinkWrap()
|
||||
{
|
||||
if (!mShouldShrinkWrap)
|
||||
{
|
||||
mShouldShrinkWrap = true;
|
||||
if (mDrawable)
|
||||
{ // we weren't shrink wrapped before but we are now, update the spatial partition
|
||||
gPipeline.markPartitionMove(mDrawable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ObjectPhysicsProperties : public LLHTTPNode
|
||||
{
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -619,6 +619,14 @@ public:
|
|||
virtual void parameterChanged(U16 param_type, bool local_origin);
|
||||
virtual void parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_use, bool local_origin);
|
||||
|
||||
bool isShrinkWrapped() const { return mShouldShrinkWrap; }
|
||||
|
||||
// Used to improve performance. If an object is likely to rebuild its vertex buffer often
|
||||
// as a side effect of some update (color update, scale, etc), setting this to true
|
||||
// will cause it to be pushed deeper into the octree and isolate it from other nodes
|
||||
// so that nearby objects won't attempt to share a vertex buffer with this object.
|
||||
void shrinkWrap();
|
||||
|
||||
friend class LLViewerObjectList;
|
||||
friend class LLViewerMediaList;
|
||||
|
||||
|
|
@ -886,6 +894,9 @@ protected:
|
|||
F32 mPhysicsCost;
|
||||
F32 mLinksetPhysicsCost;
|
||||
|
||||
// If true, "shrink wrap" this volume in its spatial partition. See "shrinkWrap"
|
||||
bool mShouldShrinkWrap = false;
|
||||
|
||||
bool mCostStale;
|
||||
mutable bool mPhysicsShapeUnknown;
|
||||
|
||||
|
|
@ -1005,7 +1016,7 @@ public:
|
|||
LLStrider<LLColor4U>& emissivep,
|
||||
LLStrider<U16>& indicesp) = 0;
|
||||
|
||||
virtual void getBlendFunc(S32 face, U32& src, U32& dst);
|
||||
virtual void getBlendFunc(S32 face, LLRender::eBlendFactor& src, LLRender::eBlendFactor& dst);
|
||||
|
||||
F32 mDepth;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -103,11 +103,11 @@ U8* get_box_fan_indices_ptr(LLCamera* camera, const LLVector4a& center)
|
|||
}
|
||||
|
||||
//create a vertex buffer for efficiently rendering cubes
|
||||
LLVertexBuffer* ll_create_cube_vb(U32 type_mask, U32 usage)
|
||||
LLVertexBuffer* ll_create_cube_vb(U32 type_mask)
|
||||
{
|
||||
LLVertexBuffer* ret = new LLVertexBuffer(type_mask, usage);
|
||||
LLVertexBuffer* ret = new LLVertexBuffer(type_mask);
|
||||
|
||||
ret->allocateBuffer(8, 64, true);
|
||||
ret->allocateBuffer(8, 64);
|
||||
|
||||
LLStrider<LLVector3> pos;
|
||||
LLStrider<U16> idx;
|
||||
|
|
@ -129,7 +129,7 @@ LLVertexBuffer* ll_create_cube_vb(U32 type_mask, U32 usage)
|
|||
idx[i] = sOcclusionIndices[i];
|
||||
}
|
||||
|
||||
ret->flush();
|
||||
ret->unmapBuffer();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -193,7 +193,6 @@ LLGLSLShader gDeferredUnderWaterProgram;
|
|||
LLGLSLShader gDeferredDiffuseProgram;
|
||||
LLGLSLShader gDeferredDiffuseAlphaMaskProgram;
|
||||
LLGLSLShader gDeferredSkinnedDiffuseAlphaMaskProgram;
|
||||
LLGLSLShader gDeferredNonIndexedDiffuseProgram;
|
||||
LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskProgram;
|
||||
LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram;
|
||||
LLGLSLShader gDeferredSkinnedDiffuseProgram;
|
||||
|
|
@ -442,6 +441,7 @@ S32 LLViewerShaderMgr::getShaderLevel(S32 type)
|
|||
|
||||
void LLViewerShaderMgr::setShaders()
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED;
|
||||
//setShaders might be called redundantly by gSavedSettings, so return on reentrance
|
||||
static bool reentrance = false;
|
||||
|
||||
|
|
@ -800,7 +800,6 @@ void LLViewerShaderMgr::unloadShaders()
|
|||
gDeferredSkinnedDiffuseAlphaMaskProgram.unload();
|
||||
gDeferredNonIndexedDiffuseAlphaMaskProgram.unload();
|
||||
gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.unload();
|
||||
gDeferredNonIndexedDiffuseProgram.unload();
|
||||
gDeferredSkinnedDiffuseProgram.unload();
|
||||
gDeferredSkinnedBumpProgram.unload();
|
||||
|
||||
|
|
@ -977,6 +976,7 @@ std::string LLViewerShaderMgr::loadBasicShaders()
|
|||
|
||||
BOOL LLViewerShaderMgr::loadShadersEnvironment()
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED;
|
||||
#if 1 // DEPRECATED -- forward rendering is deprecated
|
||||
BOOL success = TRUE;
|
||||
|
||||
|
|
@ -1047,6 +1047,7 @@ BOOL LLViewerShaderMgr::loadShadersEnvironment()
|
|||
|
||||
BOOL LLViewerShaderMgr::loadShadersWater()
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED;
|
||||
#if 1 // DEPRECATED -- forward rendering is deprecated
|
||||
BOOL success = TRUE;
|
||||
BOOL terrainWaterSuccess = TRUE;
|
||||
|
|
@ -1187,6 +1188,7 @@ BOOL LLViewerShaderMgr::loadShadersWater()
|
|||
|
||||
BOOL LLViewerShaderMgr::loadShadersEffects()
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED;
|
||||
BOOL success = TRUE;
|
||||
|
||||
if (mShaderLevel[SHADER_EFFECT] == 0)
|
||||
|
|
@ -1245,6 +1247,7 @@ BOOL LLViewerShaderMgr::loadShadersEffects()
|
|||
|
||||
BOOL LLViewerShaderMgr::loadShadersDeferred()
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED;
|
||||
bool use_sun_shadow = mShaderLevel[SHADER_DEFERRED] > 1 &&
|
||||
gSavedSettings.getS32("RenderShadowDetail") > 0;
|
||||
|
||||
|
|
@ -1258,14 +1261,13 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||
gDeferredTreeShadowProgram.unload();
|
||||
gDeferredSkinnedTreeShadowProgram.unload();
|
||||
gDeferredDiffuseProgram.unload();
|
||||
gDeferredSkinnedDiffuseProgram.unload();
|
||||
gDeferredDiffuseAlphaMaskProgram.unload();
|
||||
gDeferredSkinnedDiffuseAlphaMaskProgram.unload();
|
||||
gDeferredNonIndexedDiffuseAlphaMaskProgram.unload();
|
||||
gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram.unload();
|
||||
gDeferredNonIndexedDiffuseProgram.unload();
|
||||
gDeferredSkinnedDiffuseProgram.unload();
|
||||
gDeferredSkinnedBumpProgram.unload();
|
||||
gDeferredBumpProgram.unload();
|
||||
gDeferredSkinnedBumpProgram.unload();
|
||||
gDeferredImpostorProgram.unload();
|
||||
gDeferredTerrainProgram.unload();
|
||||
gDeferredTerrainWaterProgram.unload();
|
||||
|
|
@ -1431,19 +1433,6 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||
llassert(success);
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
gDeferredNonIndexedDiffuseProgram.mName = "Non Indexed Deferred Diffuse Shader";
|
||||
gDeferredNonIndexedDiffuseProgram.mShaderFiles.clear();
|
||||
gDeferredNonIndexedDiffuseProgram.mFeatures.encodesNormal = true;
|
||||
gDeferredNonIndexedDiffuseProgram.mFeatures.hasSrgb = true;
|
||||
gDeferredNonIndexedDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseV.glsl", GL_VERTEX_SHADER));
|
||||
gDeferredNonIndexedDiffuseProgram.mShaderFiles.push_back(make_pair("deferred/diffuseF.glsl", GL_FRAGMENT_SHADER));
|
||||
gDeferredNonIndexedDiffuseProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
|
||||
success = gDeferredNonIndexedDiffuseProgram.createShader(NULL, NULL);
|
||||
llassert(success);
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
gDeferredBumpProgram.mName = "Deferred Bump Shader";
|
||||
|
|
@ -2983,6 +2972,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
|
|||
|
||||
BOOL LLViewerShaderMgr::loadShadersObject()
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED;
|
||||
BOOL success = TRUE;
|
||||
|
||||
if (success)
|
||||
|
|
@ -3509,6 +3499,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()
|
|||
|
||||
BOOL LLViewerShaderMgr::loadShadersAvatar()
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED;
|
||||
#if 1 // DEPRECATED -- forward rendering is deprecated
|
||||
BOOL success = TRUE;
|
||||
|
||||
|
|
@ -3607,6 +3598,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar()
|
|||
|
||||
BOOL LLViewerShaderMgr::loadShadersInterface()
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED;
|
||||
BOOL success = TRUE;
|
||||
|
||||
if (success)
|
||||
|
|
@ -3986,6 +3978,7 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
|
|||
|
||||
BOOL LLViewerShaderMgr::loadShadersWindLight()
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED;
|
||||
BOOL success = TRUE;
|
||||
#if 1 // DEPRECATED -- forward rendering is deprecated
|
||||
if (mShaderLevel[SHADER_WINDLIGHT] < 2)
|
||||
|
|
|
|||
|
|
@ -1065,7 +1065,7 @@ LLViewerFetchedTexture* LLViewerFetchedTexture::getSmokeImage()
|
|||
sSmokeImagep = LLViewerTextureManager::getFetchedTexture(IMG_SMOKE);
|
||||
}
|
||||
|
||||
gPipeline.touchTexture(sSmokeImagep, 1024.f * 1024.f);
|
||||
sSmokeImagep->addTextureStats(1024.f * 1024.f);
|
||||
|
||||
return sSmokeImagep;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -814,19 +814,20 @@ void LLViewerTextureList::updateImages(F32 max_time)
|
|||
sample(FORMATTED_MEM, F64Bytes(LLImageFormatted::sGlobalFormattedMemory));
|
||||
}
|
||||
|
||||
//loading from fast cache
|
||||
// <FS:Ansariel> Don't let the fast cache choke image processing
|
||||
//max_time -= updateImagesLoadingFastCache(max_time);
|
||||
F32 fastcache_time = updateImagesLoadingFastCache(max_time / 3);
|
||||
max_time = llmax(max_time * 2/3, max_time - fastcache_time); // at least 66% for update fetch & create
|
||||
// </FS:Ansariel>
|
||||
// make sure each call below gets at least its "fair share" of time
|
||||
F32 min_time = max_time * 0.33f;
|
||||
F32 remaining_time = max_time;
|
||||
|
||||
F32 total_max_time = max_time;
|
||||
//loading from fast cache
|
||||
remaining_time -= updateImagesLoadingFastCache(remaining_time);
|
||||
remaining_time = llmax(remaining_time, min_time);
|
||||
|
||||
max_time -= updateImagesFetchTextures(max_time);
|
||||
|
||||
max_time = llmax(max_time, total_max_time*.50f); // at least 50% of max_time
|
||||
max_time -= updateImagesCreateTextures(max_time);
|
||||
//dispatch to texture fetch threads
|
||||
remaining_time -= updateImagesFetchTextures(remaining_time);
|
||||
remaining_time = llmax(remaining_time, min_time);
|
||||
|
||||
//handle results from decode threads
|
||||
updateImagesCreateTextures(remaining_time);
|
||||
|
||||
if (!mDirtyTextureList.empty())
|
||||
{
|
||||
|
|
@ -873,6 +874,14 @@ void LLViewerTextureList::clearFetchingRequests()
|
|||
}
|
||||
}
|
||||
|
||||
static void touch_texture(LLViewerFetchedTexture* tex, F32 vsize)
|
||||
{
|
||||
if (tex)
|
||||
{
|
||||
tex->addTextureStats(vsize);
|
||||
}
|
||||
}
|
||||
|
||||
void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imagep)
|
||||
{
|
||||
if (imagep->isInDebug() || imagep->isUnremovable())
|
||||
|
|
@ -881,6 +890,39 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag
|
|||
return; //is in debug, ignore.
|
||||
}
|
||||
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE
|
||||
{
|
||||
for (U32 i = 0; i < LLRender::NUM_TEXTURE_CHANNELS; ++i)
|
||||
{
|
||||
for (U32 fi = 0; fi < imagep->getNumFaces(i); ++fi)
|
||||
{
|
||||
const LLFace* face = (*(imagep->getFaceList(i)))[fi];
|
||||
|
||||
if (face && face->getViewerObject() && face->getTextureEntry())
|
||||
{
|
||||
F32 vsize = face->getVirtualSize();
|
||||
|
||||
// if a GLTF material is present, ignore that face
|
||||
// as far as this texture stats go, but update the GLTF material
|
||||
// stats
|
||||
const LLTextureEntry* te = face->getTextureEntry();
|
||||
LLFetchedGLTFMaterial* mat = te ? (LLFetchedGLTFMaterial*)te->getGLTFRenderMaterial() : nullptr;
|
||||
if (mat)
|
||||
{
|
||||
touch_texture(mat->mBaseColorTexture, vsize);
|
||||
touch_texture(mat->mNormalTexture, vsize);
|
||||
touch_texture(mat->mMetallicRoughnessTexture, vsize);
|
||||
touch_texture(mat->mEmissiveTexture, vsize);
|
||||
}
|
||||
else
|
||||
{
|
||||
imagep->addTextureStats(vsize);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
F32 lazy_flush_timeout = 30.f; // stop decoding
|
||||
F32 max_inactive_time = 20.f; // actually delete
|
||||
S32 min_refs = 3; // 1 for mImageList, 1 for mUUIDMap, 1 for local reference
|
||||
|
|
@ -1008,6 +1050,11 @@ F32 LLViewerTextureList::updateImagesCreateTextures(F32 max_time)
|
|||
LLViewerFetchedTexture *imagep = *curiter;
|
||||
imagep->createTexture();
|
||||
imagep->postCreateTexture();
|
||||
|
||||
if (create_timer.getElapsedTimeF32() > max_time)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
mCreateTextureList.erase(mCreateTextureList.begin(), enditer);
|
||||
return create_timer.getElapsedTimeF32();
|
||||
|
|
@ -1065,8 +1112,6 @@ void LLViewerTextureList::forceImmediateUpdate(LLViewerFetchedTexture* imagep)
|
|||
F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
|
||||
LLTimer image_op_timer;
|
||||
|
||||
typedef std::vector<LLPointer<LLViewerFetchedTexture> > entries_list_t;
|
||||
entries_list_t entries;
|
||||
|
||||
|
|
@ -1099,6 +1144,10 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time)
|
|||
}
|
||||
}
|
||||
|
||||
LLTimer timer;
|
||||
|
||||
LLPointer<LLViewerTexture> last_imagep = nullptr;
|
||||
|
||||
for (auto& imagep : entries)
|
||||
{
|
||||
if (imagep->getNumRefs() > 1) // make sure this image hasn't been deleted before attempting to update (may happen as a side effect of some other image updating)
|
||||
|
|
@ -1106,15 +1155,21 @@ F32 LLViewerTextureList::updateImagesFetchTextures(F32 max_time)
|
|||
updateImageDecodePriority(imagep);
|
||||
imagep->updateFetch();
|
||||
}
|
||||
|
||||
last_imagep = imagep;
|
||||
|
||||
if (timer.getElapsedTimeF32() > max_time)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (entries.size() > 0)
|
||||
if (last_imagep)
|
||||
{
|
||||
LLViewerFetchedTexture* imagep = *entries.rbegin();
|
||||
mLastUpdateKey = LLTextureKey(imagep->getID(), (ETexListType)imagep->getTextureListType());
|
||||
mLastUpdateKey = LLTextureKey(last_imagep->getID(), (ETexListType)last_imagep->getTextureListType());
|
||||
}
|
||||
|
||||
return image_op_timer.getElapsedTimeF32();
|
||||
return timer.getElapsedTimeF32();
|
||||
}
|
||||
|
||||
void LLViewerTextureList::updateImagesUpdateStats()
|
||||
|
|
|
|||
|
|
@ -707,18 +707,6 @@ public:
|
|||
|
||||
}
|
||||
|
||||
addText(xpos, ypos, llformat("%d Vertex Buffers", LLVertexBuffer::sGLCount));
|
||||
ypos += y_inc;
|
||||
|
||||
addText(xpos, ypos, llformat("%d Mapped Buffers", LLVertexBuffer::sMappedCount));
|
||||
ypos += y_inc;
|
||||
|
||||
addText(xpos, ypos, llformat("%d Vertex Buffer Binds", LLVertexBuffer::sBindCount));
|
||||
ypos += y_inc;
|
||||
|
||||
addText(xpos, ypos, llformat("%d Vertex Buffer Sets", LLVertexBuffer::sSetCount));
|
||||
ypos += y_inc;
|
||||
|
||||
addText(xpos, ypos, llformat("%d Texture Binds", LLImageGL::sBindCount));
|
||||
ypos += y_inc;
|
||||
|
||||
|
|
@ -805,9 +793,7 @@ public:
|
|||
ypos += y_inc;
|
||||
}
|
||||
// </FS:Beq>
|
||||
LLVertexBuffer::sBindCount = LLImageGL::sBindCount =
|
||||
LLVertexBuffer::sSetCount = LLImageGL::sUniqueCount =
|
||||
gPipeline.mNumVisibleNodes = LLPipeline::sVisibleLightCount = 0;
|
||||
gPipeline.mNumVisibleNodes = LLPipeline::sVisibleLightCount = 0;
|
||||
}
|
||||
static LLCachedControl<bool> sDebugShowAvatarRenderInfo(gSavedSettings, "DebugShowAvatarRenderInfo");
|
||||
if (sDebugShowAvatarRenderInfo)
|
||||
|
|
@ -2962,10 +2948,10 @@ void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid)
|
|||
|
||||
void LLViewerWindow::drawDebugText()
|
||||
{
|
||||
gUIProgram.bind();
|
||||
gGL.color4f(1,1,1,1);
|
||||
gGL.pushMatrix();
|
||||
gGL.pushUIMatrix();
|
||||
gUIProgram.bind();
|
||||
{
|
||||
// scale view by UI global scale factor and aspect ratio correction factor
|
||||
gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
|
||||
|
|
@ -3025,6 +3011,7 @@ void LLViewerWindow::draw()
|
|||
// No translation needed, this view is glued to 0,0
|
||||
|
||||
gUIProgram.bind();
|
||||
gGL.color4f(1, 1, 1, 1);
|
||||
|
||||
gGL.pushMatrix();
|
||||
LLUI::pushMatrix();
|
||||
|
|
@ -6940,7 +6927,6 @@ void LLViewerWindow::restoreGL(const std::string& progress_message)
|
|||
|
||||
gSky.restoreGL();
|
||||
gPipeline.restoreGL();
|
||||
LLDrawPoolWater::restoreGL();
|
||||
LLManipTranslate::restoreGL();
|
||||
|
||||
gBumpImageList.restoreGL();
|
||||
|
|
|
|||
|
|
@ -2500,15 +2500,15 @@ void LLVOAvatar::updateMeshData()
|
|||
LLVertexBuffer* buff = facep->getVertexBuffer();
|
||||
if(!facep->getVertexBuffer())
|
||||
{
|
||||
buff = new LLVertexBufferAvatar();
|
||||
if (!buff->allocateBuffer(num_vertices, num_indices, TRUE))
|
||||
buff = new LLVertexBuffer(LLDrawPoolAvatar::VERTEX_DATA_MASK);
|
||||
if (!buff->allocateBuffer(num_vertices, num_indices))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer for Mesh to "
|
||||
<< num_vertices << " vertices and "
|
||||
<< num_indices << " indices" << LL_ENDL;
|
||||
// Attempt to create a dummy triangle (one vertex, 3 indices, all 0)
|
||||
facep->setSize(1, 3);
|
||||
buff->allocateBuffer(1, 3, true);
|
||||
buff->allocateBuffer(1, 3);
|
||||
memset((U8*) buff->getMappedData(), 0, buff->getSize());
|
||||
memset((U8*) buff->getMappedIndices(), 0, buff->getIndicesSize());
|
||||
}
|
||||
|
|
@ -2523,12 +2523,13 @@ void LLVOAvatar::updateMeshData()
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!buff->resizeBuffer(num_vertices, num_indices))
|
||||
{
|
||||
buff = new LLVertexBuffer(buff->getTypeMask());
|
||||
if (!buff->allocateBuffer(num_vertices, num_indices))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate vertex buffer for Mesh, Substituting" << LL_ENDL;
|
||||
// Attempt to create a dummy triangle (one vertex, 3 indices, all 0)
|
||||
facep->setSize(1, 3);
|
||||
buff->resizeBuffer(1, 3);
|
||||
buff->allocateBuffer(1, 3);
|
||||
memset((U8*) buff->getMappedData(), 0, buff->getSize());
|
||||
memset((U8*) buff->getMappedIndices(), 0, buff->getIndicesSize());
|
||||
}
|
||||
|
|
@ -2565,7 +2566,7 @@ void LLVOAvatar::updateMeshData()
|
|||
}
|
||||
|
||||
stop_glerror();
|
||||
buff->flush();
|
||||
buff->unmapBuffer();
|
||||
|
||||
if(!f_num)
|
||||
{
|
||||
|
|
@ -5713,7 +5714,7 @@ U32 LLVOAvatar::renderSkinned()
|
|||
LLVertexBuffer* vb = face->getVertexBuffer();
|
||||
if (vb)
|
||||
{
|
||||
vb->flush();
|
||||
vb->unmapBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -604,7 +604,7 @@ U32 LLVOGrass::getPartitionType() const
|
|||
}
|
||||
|
||||
LLGrassPartition::LLGrassPartition(LLViewerRegion* regionp)
|
||||
: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, GL_STREAM_DRAW, regionp)
|
||||
: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, regionp)
|
||||
{
|
||||
mDrawableType = LLPipeline::RENDER_TYPE_GRASS;
|
||||
mPartitionType = LLViewerRegion::PARTITION_GRASS;
|
||||
|
|
@ -612,13 +612,10 @@ LLGrassPartition::LLGrassPartition(LLViewerRegion* regionp)
|
|||
mDepthMask = TRUE;
|
||||
mSlopRatio = 0.1f;
|
||||
mRenderPass = LLRenderPass::PASS_GRASS;
|
||||
mBufferUsage = GL_DYNAMIC_DRAW;
|
||||
}
|
||||
|
||||
void LLGrassPartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_count, U32& index_count)
|
||||
{
|
||||
group->mBufferUsage = mBufferUsage;
|
||||
|
||||
mFaceList.clear();
|
||||
|
||||
LLViewerCamera* camera = LLViewerCamera::getInstance();
|
||||
|
|
@ -647,11 +644,6 @@ void LLGrassPartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_count
|
|||
|
||||
obj->mDepth = 0.f;
|
||||
|
||||
if (drawablep->isAnimating())
|
||||
{
|
||||
group->mBufferUsage = GL_STREAM_DRAW;
|
||||
}
|
||||
|
||||
U32 count = 0;
|
||||
for (S32 j = 0; j < drawablep->getNumFaces(); ++j)
|
||||
{
|
||||
|
|
@ -752,8 +744,7 @@ void LLGrassPartition::getGeometry(LLSpatialGroup* group)
|
|||
|
||||
S32 idx = draw_vec.size()-1;
|
||||
|
||||
BOOL fullbright = facep->isState(LLFace::FULLBRIGHT);
|
||||
F32 vsize = facep->getVirtualSize();
|
||||
bool fullbright = facep->isState(LLFace::FULLBRIGHT);
|
||||
|
||||
if (idx >= 0 && draw_vec[idx]->mEnd == facep->getGeomIndex()-1 &&
|
||||
draw_vec[idx]->mTexture == facep->getTexture() &&
|
||||
|
|
@ -764,7 +755,6 @@ void LLGrassPartition::getGeometry(LLSpatialGroup* group)
|
|||
{
|
||||
draw_vec[idx]->mCount += facep->getIndicesCount();
|
||||
draw_vec[idx]->mEnd += facep->getGeomCount();
|
||||
draw_vec[idx]->mVSize = llmax(draw_vec[idx]->mVSize, vsize);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -776,14 +766,13 @@ void LLGrassPartition::getGeometry(LLSpatialGroup* group)
|
|||
//facep->getTexture(),
|
||||
buffer, object->isSelected(), fullbright);
|
||||
|
||||
info->mVSize = vsize;
|
||||
draw_vec.push_back(info);
|
||||
//for alpha sorting
|
||||
facep->setDrawInfo(info);
|
||||
}
|
||||
}
|
||||
|
||||
buffer->flush();
|
||||
buffer->unmapBuffer();
|
||||
mFaceList.clear();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,8 +93,8 @@ BOOL LLVOGround::updateGeometry(LLDrawable *drawable)
|
|||
if (!face->getVertexBuffer())
|
||||
{
|
||||
face->setSize(5, 12);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolGround::VERTEX_DATA_MASK, GL_STREAM_DRAW);
|
||||
if (!buff->allocateBuffer(face->getGeomCount(), face->getIndicesCount(), TRUE))
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolGround::VERTEX_DATA_MASK);
|
||||
if (!buff->allocateBuffer(face->getGeomCount(), face->getIndicesCount()))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer for VOGround to "
|
||||
<< face->getGeomCount() << " vertices and "
|
||||
|
|
@ -160,7 +160,7 @@ BOOL LLVOGround::updateGeometry(LLDrawable *drawable)
|
|||
*(texCoordsp++) = LLVector2(0.f, 1.f);
|
||||
*(texCoordsp++) = LLVector2(0.5f, 0.5f);
|
||||
|
||||
face->getVertexBuffer()->flush();
|
||||
face->getVertexBuffer()->unmapBuffer();
|
||||
LLPipeline::sCompiles++;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,18 +46,8 @@
|
|||
|
||||
extern U64MicrosecondsImplicit gFrameTime;
|
||||
|
||||
LLPointer<LLVertexBuffer> LLVOPartGroup::sVB = NULL;
|
||||
S32 LLVOPartGroup::sVBSlotFree[];
|
||||
S32* LLVOPartGroup::sVBSlotCursor = NULL;
|
||||
|
||||
void LLVOPartGroup::initClass()
|
||||
{
|
||||
for (S32 i = 0; i < LL_MAX_PARTICLE_COUNT; ++i)
|
||||
{
|
||||
sVBSlotFree[i] = i;
|
||||
}
|
||||
|
||||
sVBSlotCursor = sVBSlotFree;
|
||||
}
|
||||
|
||||
//static
|
||||
|
|
@ -65,9 +55,10 @@ void LLVOPartGroup::restoreGL()
|
|||
{
|
||||
|
||||
//TODO: optimize out binormal mask here. Specular and normal coords as well.
|
||||
sVB = new LLVertexBuffer(VERTEX_DATA_MASK | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2, GL_STREAM_DRAW);
|
||||
#if 0
|
||||
sVB = new LLVertexBuffer(VERTEX_DATA_MASK | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2);
|
||||
U32 count = LL_MAX_PARTICLE_COUNT;
|
||||
if (!sVB->allocateBuffer(count*4, count*6, true))
|
||||
if (!sVB->allocateBuffer(count*4, count*6))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer to "
|
||||
<< count*4 << " vertices and "
|
||||
|
|
@ -117,27 +108,14 @@ void LLVOPartGroup::restoreGL()
|
|||
*texcoordsp++ = LLVector2(1.f, 0.f);
|
||||
}
|
||||
|
||||
sVB->flush();
|
||||
sVB->unmapBuffer();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//static
|
||||
void LLVOPartGroup::destroyGL()
|
||||
{
|
||||
sVB = NULL;
|
||||
}
|
||||
|
||||
//static
|
||||
S32 LLVOPartGroup::findAvailableVBSlot()
|
||||
{
|
||||
if (sVBSlotCursor >= sVBSlotFree + LL_MAX_PARTICLE_COUNT)
|
||||
{ //no more available slots
|
||||
return -1;
|
||||
}
|
||||
|
||||
S32 ret = *sVBSlotCursor;
|
||||
sVBSlotCursor++;
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ll_is_part_idx_allocated(S32 idx, S32* start, S32* end)
|
||||
|
|
@ -169,20 +147,6 @@ bool ll_is_part_idx_allocated(S32 idx, S32* start, S32* end)
|
|||
// </FS>
|
||||
}
|
||||
|
||||
//static
|
||||
void LLVOPartGroup::freeVBSlot(S32 idx)
|
||||
{
|
||||
llassert(idx < LL_MAX_PARTICLE_COUNT && idx >= 0);
|
||||
//llassert(sVBSlotCursor > sVBSlotFree);
|
||||
//llassert(ll_is_part_idx_allocated(idx, sVBSlotCursor, sVBSlotFree+LL_MAX_PARTICLE_COUNT));
|
||||
|
||||
if (sVBSlotCursor > sVBSlotFree)
|
||||
{
|
||||
sVBSlotCursor--;
|
||||
*sVBSlotCursor = idx;
|
||||
}
|
||||
}
|
||||
|
||||
LLVOPartGroup::LLVOPartGroup(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
|
||||
: LLAlphaObject(id, pcode, regionp),
|
||||
mViewerPartGroupp(NULL)
|
||||
|
|
@ -305,13 +269,13 @@ F32 LLVOPartGroup::getPartSize(S32 idx)
|
|||
return 0.f;
|
||||
}
|
||||
|
||||
void LLVOPartGroup::getBlendFunc(S32 idx, U32& src, U32& dst)
|
||||
void LLVOPartGroup::getBlendFunc(S32 idx, LLRender::eBlendFactor& src, LLRender::eBlendFactor& dst)
|
||||
{
|
||||
if (idx < (S32) mViewerPartGroupp->mParticles.size())
|
||||
{
|
||||
LLViewerPart* part = mViewerPartGroupp->mParticles[idx];
|
||||
src = part->mBlendFuncSource;
|
||||
dst = part->mBlendFuncDest;
|
||||
src = (LLRender::eBlendFactor) part->mBlendFuncSource;
|
||||
dst = (LLRender::eBlendFactor) part->mBlendFuncDest;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -752,7 +716,7 @@ U32 LLVOPartGroup::getPartitionType() const
|
|||
}
|
||||
|
||||
LLParticlePartition::LLParticlePartition(LLViewerRegion* regionp)
|
||||
: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, GL_STREAM_DRAW, regionp)
|
||||
: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, regionp)
|
||||
{
|
||||
mRenderPass = LLRenderPass::PASS_ALPHA;
|
||||
mDrawableType = LLPipeline::RENDER_TYPE_PARTICLES;
|
||||
|
|
@ -772,32 +736,68 @@ void LLParticlePartition::rebuildGeom(LLSpatialGroup* group)
|
|||
{
|
||||
LL_PROFILE_ZONE_SCOPED;
|
||||
LL_PROFILE_GPU_ZONE("particle vbo");
|
||||
if (group->isDead() || !group->hasState(LLSpatialGroup::GEOM_DIRTY))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (group->isDead() || !group->hasState(LLSpatialGroup::GEOM_DIRTY))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (group->changeLOD())
|
||||
{
|
||||
group->mLastUpdateDistance = group->mDistance;
|
||||
group->mLastUpdateViewAngle = group->mViewAngle;
|
||||
}
|
||||
|
||||
group->clearDrawMap();
|
||||
|
||||
//get geometry count
|
||||
U32 index_count = 0;
|
||||
U32 vertex_count = 0;
|
||||
if (group->changeLOD())
|
||||
{
|
||||
group->mLastUpdateDistance = group->mDistance;
|
||||
group->mLastUpdateViewAngle = group->mViewAngle;
|
||||
}
|
||||
|
||||
addGeometryCount(group, vertex_count, index_count);
|
||||
|
||||
group->clearDrawMap();
|
||||
|
||||
if (vertex_count > 0 && index_count > 0 && LLVOPartGroup::sVB)
|
||||
{
|
||||
group->mBuilt = 1.f;
|
||||
//use one vertex buffer for all groups
|
||||
group->mVertexBuffer = LLVOPartGroup::sVB;
|
||||
getGeometry(group);
|
||||
//get geometry count
|
||||
U32 index_count = 0;
|
||||
U32 vertex_count = 0;
|
||||
|
||||
addGeometryCount(group, vertex_count, index_count);
|
||||
|
||||
|
||||
if (vertex_count > 0 && index_count > 0)
|
||||
{
|
||||
group->mBuilt = 1.f;
|
||||
if (group->mVertexBuffer.isNull() ||
|
||||
group->mVertexBuffer->getNumVerts() < vertex_count || group->mVertexBuffer->getNumIndices() < index_count)
|
||||
{
|
||||
group->mVertexBuffer = new LLVertexBuffer(LLVOPartGroup::VERTEX_DATA_MASK);
|
||||
group->mVertexBuffer->allocateBuffer(vertex_count, index_count);
|
||||
|
||||
// initialize index and texture coordinates only when buffer is reallocated
|
||||
U16* indicesp = (U16*)group->mVertexBuffer->mapIndexBuffer(0, index_count);
|
||||
|
||||
U16 geom_idx = 0;
|
||||
for (U32 i = 0; i < index_count; i += 6)
|
||||
{
|
||||
*indicesp++ = geom_idx + 0;
|
||||
*indicesp++ = geom_idx + 1;
|
||||
*indicesp++ = geom_idx + 2;
|
||||
|
||||
*indicesp++ = geom_idx + 1;
|
||||
*indicesp++ = geom_idx + 3;
|
||||
*indicesp++ = geom_idx + 2;
|
||||
|
||||
geom_idx += 4;
|
||||
}
|
||||
|
||||
LLStrider<LLVector2> texcoordsp;
|
||||
|
||||
group->mVertexBuffer->getTexCoord0Strider(texcoordsp);
|
||||
|
||||
for (U32 i = 0; i < vertex_count; i += 4)
|
||||
{
|
||||
*texcoordsp++ = LLVector2(0.f, 1.f);
|
||||
*texcoordsp++ = LLVector2(0.f, 0.f);
|
||||
*texcoordsp++ = LLVector2(1.f, 1.f);
|
||||
*texcoordsp++ = LLVector2(1.f, 0.f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
getGeometry(group);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -811,8 +811,6 @@ void LLParticlePartition::rebuildGeom(LLSpatialGroup* group)
|
|||
|
||||
void LLParticlePartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_count, U32& index_count)
|
||||
{
|
||||
group->mBufferUsage = mBufferUsage;
|
||||
|
||||
mFaceList.clear();
|
||||
|
||||
LLViewerCamera* camera = LLViewerCamera::getInstance();
|
||||
|
|
@ -865,10 +863,8 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)
|
|||
|
||||
LLVertexBuffer* buffer = group->mVertexBuffer;
|
||||
|
||||
LLStrider<U16> indicesp;
|
||||
LLStrider<LLVector4a> verticesp;
|
||||
LLStrider<LLVector3> normalsp;
|
||||
LLStrider<LLVector2> texcoordsp;
|
||||
LLStrider<LLColor4U> colorsp;
|
||||
LLStrider<LLColor4U> emissivep;
|
||||
|
||||
|
|
@ -877,7 +873,9 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)
|
|||
buffer->getColorStrider(colorsp);
|
||||
buffer->getEmissiveStrider(emissivep);
|
||||
|
||||
|
||||
S32 geom_idx = 0;
|
||||
S32 indices_idx = 0;
|
||||
|
||||
LLSpatialGroup::drawmap_elem_t& draw_vec = group->mDrawMap[mRenderPass];
|
||||
|
||||
for (std::vector<LLFace*>::iterator i = mFaceList.begin(); i != mFaceList.end(); ++i)
|
||||
|
|
@ -885,56 +883,44 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)
|
|||
LLFace* facep = *i;
|
||||
LLAlphaObject* object = (LLAlphaObject*) facep->getViewerObject();
|
||||
|
||||
if (!facep->isState(LLFace::PARTICLE))
|
||||
{ //set the indices of this face
|
||||
S32 idx = LLVOPartGroup::findAvailableVBSlot();
|
||||
if (idx >= 0)
|
||||
{
|
||||
facep->setGeomIndex(idx*4);
|
||||
facep->setIndicesIndex(idx*6);
|
||||
facep->setVertexBuffer(LLVOPartGroup::sVB);
|
||||
facep->setPoolType(LLDrawPool::POOL_ALPHA);
|
||||
facep->setState(LLFace::PARTICLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
continue; //out of space in particle buffer
|
||||
}
|
||||
}
|
||||
facep->setGeomIndex(geom_idx);
|
||||
facep->setIndicesIndex(indices_idx);
|
||||
|
||||
S32 geom_idx = (S32) facep->getGeomIndex();
|
||||
|
||||
LLStrider<U16> cur_idx = indicesp + facep->getIndicesStart();
|
||||
LLStrider<LLVector4a> cur_vert = verticesp + geom_idx;
|
||||
LLStrider<LLVector3> cur_norm = normalsp + geom_idx;
|
||||
LLStrider<LLVector2> cur_tc = texcoordsp + geom_idx;
|
||||
LLStrider<LLColor4U> cur_col = colorsp + geom_idx;
|
||||
LLStrider<LLColor4U> cur_glow = emissivep + geom_idx;
|
||||
|
||||
// not actually used
|
||||
LLStrider<LLVector2> cur_tc;
|
||||
LLStrider<U16> cur_idx;
|
||||
|
||||
|
||||
geom_idx += 4;
|
||||
indices_idx += 6;
|
||||
|
||||
LLColor4U* start_glow = cur_glow.get();
|
||||
|
||||
object->getGeometry(facep->getTEOffset(), cur_vert, cur_norm, cur_tc, cur_col, cur_glow, cur_idx);
|
||||
|
||||
BOOL has_glow = FALSE;
|
||||
bool has_glow = FALSE;
|
||||
|
||||
if (cur_glow.get() != start_glow)
|
||||
{
|
||||
has_glow = TRUE;
|
||||
has_glow = true;
|
||||
}
|
||||
|
||||
llassert(facep->getGeomCount() == 4);
|
||||
llassert(facep->getIndicesCount() == 6);
|
||||
|
||||
|
||||
|
||||
S32 idx = draw_vec.size()-1;
|
||||
|
||||
BOOL fullbright = facep->isState(LLFace::FULLBRIGHT);
|
||||
F32 vsize = facep->getVirtualSize();
|
||||
bool fullbright = facep->isState(LLFace::FULLBRIGHT);
|
||||
|
||||
bool batched = false;
|
||||
|
||||
U32 bf_src = LLRender::BF_SOURCE_ALPHA;
|
||||
U32 bf_dst = LLRender::BF_ONE_MINUS_SOURCE_ALPHA;
|
||||
LLRender::eBlendFactor bf_src = LLRender::BF_SOURCE_ALPHA;
|
||||
LLRender::eBlendFactor bf_dst = LLRender::BF_ONE_MINUS_SOURCE_ALPHA;
|
||||
|
||||
object->getBlendFunc(facep->getTEOffset(), bf_src, bf_dst);
|
||||
|
||||
|
|
@ -954,7 +940,6 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)
|
|||
batched = true;
|
||||
info->mCount += facep->getIndicesCount();
|
||||
info->mEnd += facep->getGeomCount();
|
||||
info->mVSize = llmax(draw_vec[idx]->mVSize, vsize);
|
||||
}
|
||||
else if (draw_vec[idx]->mStart == facep->getGeomIndex()+facep->getGeomCount()+1)
|
||||
{
|
||||
|
|
@ -962,12 +947,10 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)
|
|||
info->mCount += facep->getIndicesCount();
|
||||
info->mStart -= facep->getGeomCount();
|
||||
info->mOffset = facep->getIndicesStart();
|
||||
info->mVSize = llmax(draw_vec[idx]->mVSize, vsize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!batched)
|
||||
{
|
||||
U32 start = facep->getGeomIndex();
|
||||
|
|
@ -975,19 +958,18 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)
|
|||
U32 offset = facep->getIndicesStart();
|
||||
U32 count = facep->getIndicesCount();
|
||||
LLDrawInfo* info = new LLDrawInfo(start,end,count,offset,facep->getTexture(),
|
||||
buffer, object->isSelected(), fullbright);
|
||||
buffer, fullbright);
|
||||
|
||||
info->mVSize = vsize;
|
||||
info->mBlendFuncDst = bf_dst;
|
||||
info->mBlendFuncSrc = bf_src;
|
||||
info->mHasGlow = has_glow;
|
||||
info->mParticle = TRUE;
|
||||
draw_vec.push_back(info);
|
||||
//for alpha sorting
|
||||
facep->setDrawInfo(info);
|
||||
}
|
||||
}
|
||||
|
||||
buffer->unmapBuffer();
|
||||
mFaceList.clear();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,16 +40,9 @@ class LLVOPartGroup : public LLAlphaObject
|
|||
{
|
||||
public:
|
||||
|
||||
//vertex buffer for holding all particles
|
||||
static LLPointer<LLVertexBuffer> sVB;
|
||||
static S32 sVBSlotFree[LL_MAX_PARTICLE_COUNT];
|
||||
static S32 *sVBSlotCursor;
|
||||
|
||||
static void initClass();
|
||||
static void restoreGL();
|
||||
static void destroyGL();
|
||||
static S32 findAvailableVBSlot();
|
||||
static void freeVBSlot(S32 idx);
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
@ -99,7 +92,7 @@ public:
|
|||
|
||||
void updateFaceSize(S32 idx) { }
|
||||
F32 getPartSize(S32 idx);
|
||||
void getBlendFunc(S32 idx, U32& src, U32& dst);
|
||||
void getBlendFunc(S32 idx, LLRender::eBlendFactor& src, LLRender::eBlendFactor& dst);
|
||||
LLUUID getPartOwner(S32 idx);
|
||||
LLUUID getPartSource(S32 idx);
|
||||
|
||||
|
|
|
|||
|
|
@ -1016,8 +1016,8 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable)
|
|||
face->setSize(4, 6);
|
||||
face->setGeomIndex(0);
|
||||
face->setIndicesIndex(0);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolSky::VERTEX_DATA_MASK, GL_STREAM_DRAW);
|
||||
buff->allocateBuffer(4, 6, TRUE);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolSky::VERTEX_DATA_MASK);
|
||||
buff->allocateBuffer(4, 6);
|
||||
face->setVertexBuffer(buff);
|
||||
|
||||
index_offset = face->getGeometry(verticesp,normalsp,texCoordsp, indicesp);
|
||||
|
|
@ -1052,7 +1052,7 @@ BOOL LLVOSky::updateGeometry(LLDrawable *drawable)
|
|||
*indicesp++ = index_offset + 3;
|
||||
*indicesp++ = index_offset + 2;
|
||||
|
||||
buff->flush();
|
||||
buff->unmapBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1148,8 +1148,8 @@ bool LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, F32 scale, const
|
|||
if (!facep->getVertexBuffer())
|
||||
{
|
||||
facep->setSize(4, 6);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolSky::VERTEX_DATA_MASK, GL_STREAM_DRAW);
|
||||
if (!buff->allocateBuffer(facep->getGeomCount(), facep->getIndicesCount(), TRUE))
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolSky::VERTEX_DATA_MASK);
|
||||
if (!buff->allocateBuffer(facep->getGeomCount(), facep->getIndicesCount()))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer for vosky to "
|
||||
<< facep->getGeomCount() << " vertices and "
|
||||
|
|
@ -1188,7 +1188,7 @@ bool LLVOSky::updateHeavenlyBodyGeometry(LLDrawable *drawable, F32 scale, const
|
|||
*indicesp++ = index_offset + 2;
|
||||
*indicesp++ = index_offset + 3;
|
||||
|
||||
facep->getVertexBuffer()->flush();
|
||||
facep->getVertexBuffer()->unmapBuffer();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -1388,8 +1388,8 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H,
|
|||
if (!face->getVertexBuffer() || quads*4 != face->getGeomCount())
|
||||
{
|
||||
face->setSize(quads * 4, quads * 6);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK, GL_STREAM_DRAW);
|
||||
if (!buff->allocateBuffer(face->getGeomCount(), face->getIndicesCount(), TRUE))
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK);
|
||||
if (!buff->allocateBuffer(face->getGeomCount(), face->getIndicesCount()))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer for vosky to "
|
||||
<< face->getGeomCount() << " vertices and "
|
||||
|
|
@ -1532,7 +1532,7 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H,
|
|||
}
|
||||
}
|
||||
|
||||
face->getVertexBuffer()->flush();
|
||||
face->getVertexBuffer()->unmapBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,26 +45,6 @@
|
|||
|
||||
F32 LLVOSurfacePatch::sLODFactor = 1.f;
|
||||
|
||||
//============================================================================
|
||||
|
||||
class LLVertexBufferTerrain : public LLVertexBuffer
|
||||
{
|
||||
public:
|
||||
LLVertexBufferTerrain() :
|
||||
LLVertexBuffer(MAP_VERTEX | MAP_NORMAL | MAP_TEXCOORD0 | MAP_TEXCOORD1 | MAP_COLOR, GL_DYNAMIC_DRAW)
|
||||
{
|
||||
//texture coordinates 2 and 3 exist, but use the same data as texture coordinate 1
|
||||
};
|
||||
|
||||
// virtual
|
||||
void setupVertexBuffer(U32 data_mask)
|
||||
{
|
||||
LLVertexBuffer::setupVertexBuffer(data_mask & ~(MAP_TEXCOORD2 | MAP_TEXCOORD3));
|
||||
}
|
||||
};
|
||||
|
||||
//============================================================================
|
||||
|
||||
LLVOSurfacePatch::LLVOSurfacePatch(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
|
||||
: LLStaticViewerObject(id, LL_VO_SURFACE_PATCH, regionp),
|
||||
mDirtiedPatch(FALSE),
|
||||
|
|
@ -1001,7 +981,7 @@ U32 LLVOSurfacePatch::getPartitionType() const
|
|||
}
|
||||
|
||||
LLTerrainPartition::LLTerrainPartition(LLViewerRegion* regionp)
|
||||
: LLSpatialPartition(LLDrawPoolTerrain::VERTEX_DATA_MASK, FALSE, GL_DYNAMIC_DRAW, regionp)
|
||||
: LLSpatialPartition(LLDrawPoolTerrain::VERTEX_DATA_MASK, FALSE, regionp)
|
||||
{
|
||||
mOcclusionEnabled = FALSE;
|
||||
mInfiniteFarClip = TRUE;
|
||||
|
|
@ -1009,11 +989,6 @@ LLTerrainPartition::LLTerrainPartition(LLViewerRegion* regionp)
|
|||
mPartitionType = LLViewerRegion::PARTITION_TERRAIN;
|
||||
}
|
||||
|
||||
LLVertexBuffer* LLTerrainPartition::createVertexBuffer(U32 type_mask, U32 usage)
|
||||
{
|
||||
return new LLVertexBufferTerrain();
|
||||
}
|
||||
|
||||
void LLTerrainPartition::getGeometry(LLSpatialGroup* group)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED;
|
||||
|
|
@ -1051,7 +1026,7 @@ void LLTerrainPartition::getGeometry(LLSpatialGroup* group)
|
|||
index_offset += facep->getGeomCount();
|
||||
}
|
||||
|
||||
buffer->flush();
|
||||
buffer->unmapBuffer();
|
||||
mFaceList.clear();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -549,8 +549,8 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
|
|||
max_vertices += sLODVertexCount[lod];
|
||||
}
|
||||
|
||||
mReferenceBuffer = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK, 0);
|
||||
if (!mReferenceBuffer->allocateBuffer(max_vertices, max_indices, TRUE))
|
||||
mReferenceBuffer = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK);
|
||||
if (!mReferenceBuffer->allocateBuffer(max_vertices, max_indices))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer on update to "
|
||||
<< max_vertices << " vertices and "
|
||||
|
|
@ -873,7 +873,7 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
|
|||
slices /= 2;
|
||||
}
|
||||
|
||||
mReferenceBuffer->flush();
|
||||
mReferenceBuffer->unmapBuffer();
|
||||
llassert(vertex_count == max_vertices);
|
||||
llassert(index_count == max_indices);
|
||||
}
|
||||
|
|
@ -932,19 +932,19 @@ void LLVOTree::updateMesh()
|
|||
|
||||
LLFace* facep = mDrawable->getFace(0);
|
||||
if (!facep) return;
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK, GL_STATIC_DRAW);
|
||||
if (!buff->allocateBuffer(vert_count, index_count, TRUE))
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK);
|
||||
if (!buff->allocateBuffer(vert_count, index_count))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer on mesh update to "
|
||||
<< vert_count << " vertices and "
|
||||
<< index_count << " indices" << LL_ENDL;
|
||||
buff->allocateBuffer(1, 3, true);
|
||||
buff->allocateBuffer(1, 3);
|
||||
memset((U8*)buff->getMappedData(), 0, buff->getSize());
|
||||
memset((U8*)buff->getMappedIndices(), 0, buff->getIndicesSize());
|
||||
facep->setSize(1, 3);
|
||||
facep->setVertexBuffer(buff);
|
||||
mReferenceBuffer->flush();
|
||||
buff->flush();
|
||||
mReferenceBuffer->unmapBuffer();
|
||||
buff->unmapBuffer();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -965,8 +965,8 @@ void LLVOTree::updateMesh()
|
|||
|
||||
genBranchPipeline(vertices, normals, tex_coords, colors, indices, idx_offset, scale_mat, mTrunkLOD, stop_depth, mDepth, mTrunkDepth, 1.0, mTwist, droop, mBranches, alpha);
|
||||
|
||||
mReferenceBuffer->flush();
|
||||
buff->flush();
|
||||
mReferenceBuffer->unmapBuffer();
|
||||
buff->unmapBuffer();
|
||||
}
|
||||
|
||||
void LLVOTree::appendMesh(LLStrider<LLVector3>& vertices,
|
||||
|
|
@ -1236,7 +1236,7 @@ U32 LLVOTree::getPartitionType() const
|
|||
}
|
||||
|
||||
LLTreePartition::LLTreePartition(LLViewerRegion* regionp)
|
||||
: LLSpatialPartition(0, FALSE, GL_DYNAMIC_DRAW, regionp)
|
||||
: LLSpatialPartition(0, FALSE, regionp)
|
||||
{
|
||||
mDrawableType = LLPipeline::RENDER_TYPE_TREE;
|
||||
mPartitionType = LLViewerRegion::PARTITION_TREE;
|
||||
|
|
|
|||
|
|
@ -101,7 +101,6 @@ const F32 FORCE_CULL_AREA = 8.f;
|
|||
U32 JOINT_COUNT_REQUIRED_FOR_FULLRIG = 1;
|
||||
|
||||
BOOL gAnimateTextures = TRUE;
|
||||
//extern BOOL gHideSelectedObjects;
|
||||
|
||||
F32 LLVOVolume::sLODFactor = 1.f;
|
||||
F32 LLVOVolume::sLODSlopDistanceFactor = 0.5f; //Changing this to zero, effectively disables the LOD transition slop
|
||||
|
|
@ -653,6 +652,10 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys,
|
|||
if (result & teDirtyBits)
|
||||
{
|
||||
updateTEData();
|
||||
if (mDrawable)
|
||||
{ //on the fly TE updates break batches, isolate in octree
|
||||
shrinkWrap();
|
||||
}
|
||||
}
|
||||
if (result & TEM_CHANGE_MEDIA)
|
||||
{
|
||||
|
|
@ -715,6 +718,7 @@ void LLVOVolume::animateTextures()
|
|||
{
|
||||
if (!mDead)
|
||||
{
|
||||
shrinkWrap();
|
||||
F32 off_s = 0.f, off_t = 0.f, scale_s = 1.f, scale_t = 1.f, rot = 0.f;
|
||||
S32 result = mTextureAnimp->animateTextures(off_s, off_t, scale_s, scale_t, rot);
|
||||
|
||||
|
|
@ -1132,6 +1136,11 @@ void LLVOVolume::setScale(const LLVector3 &scale, BOOL damped)
|
|||
//since drawable transforms do not include scale, changing volume scale
|
||||
//requires an immediate rebuild of volume verts.
|
||||
gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_POSITION, TRUE);
|
||||
|
||||
if (mDrawable)
|
||||
{
|
||||
shrinkWrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2399,7 +2408,12 @@ S32 LLVOVolume::setTETexture(const U8 te, const LLUUID &uuid)
|
|||
S32 res = LLViewerObject::setTETexture(te, uuid);
|
||||
if (res)
|
||||
{
|
||||
gPipeline.markTextured(mDrawable);
|
||||
if (mDrawable)
|
||||
{
|
||||
// dynamic texture changes break batches, isolate in octree
|
||||
shrinkWrap();
|
||||
gPipeline.markTextured(mDrawable);
|
||||
}
|
||||
mFaceMappingChanged = TRUE;
|
||||
}
|
||||
return res;
|
||||
|
|
@ -2434,6 +2448,7 @@ S32 LLVOVolume::setTEColor(const U8 te, const LLColor4& color)
|
|||
// These should only happen on updates which are not the initial update.
|
||||
mColorChanged = TRUE;
|
||||
mDrawable->setState(LLDrawable::REBUILD_COLOR);
|
||||
shrinkWrap();
|
||||
dirtyMesh();
|
||||
}
|
||||
}
|
||||
|
|
@ -2523,7 +2538,11 @@ S32 LLVOVolume::setTEGlow(const U8 te, const F32 glow)
|
|||
S32 res = LLViewerObject::setTEGlow(te, glow);
|
||||
if (res)
|
||||
{
|
||||
gPipeline.markTextured(mDrawable);
|
||||
if (mDrawable)
|
||||
{
|
||||
gPipeline.markTextured(mDrawable);
|
||||
shrinkWrap();
|
||||
}
|
||||
mFaceMappingChanged = TRUE;
|
||||
}
|
||||
return res;
|
||||
|
|
@ -4601,83 +4620,61 @@ void LLVOVolume::updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
|
|||
F32 LLVOVolume::getBinRadius()
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
|
||||
F32 radius;
|
||||
|
||||
F32 scale = 1.f;
|
||||
F32 radius;
|
||||
|
||||
static LLCachedControl<S32> octree_size_factor(gSavedSettings, "OctreeStaticObjectSizeFactor", 3);
|
||||
static LLCachedControl<S32> octree_attachment_size_factor(gSavedSettings, "OctreeAttachmentSizeFactor", 4);
|
||||
static LLCachedControl<LLVector3> octree_distance_factor(gSavedSettings, "OctreeDistanceFactor", LLVector3(0.01f, 0.f, 0.f));
|
||||
static LLCachedControl<LLVector3> octree_alpha_distance_factor(gSavedSettings, "OctreeAlphaDistanceFactor", LLVector3(0.1f, 0.f, 0.f));
|
||||
static LLCachedControl<S32> octree_size_factor(gSavedSettings, "OctreeStaticObjectSizeFactor", 3);
|
||||
static LLCachedControl<S32> octree_attachment_size_factor(gSavedSettings, "OctreeAttachmentSizeFactor", 4);
|
||||
static LLCachedControl<LLVector3> octree_distance_factor(gSavedSettings, "OctreeDistanceFactor", LLVector3(0.01f, 0.f, 0.f));
|
||||
static LLCachedControl<LLVector3> octree_alpha_distance_factor(gSavedSettings, "OctreeAlphaDistanceFactor", LLVector3(0.1f, 0.f, 0.f));
|
||||
|
||||
S32 size_factor = llmax((S32)octree_size_factor, 1);
|
||||
S32 attachment_size_factor = llmax((S32)octree_attachment_size_factor, 1);
|
||||
LLVector3 distance_factor = octree_distance_factor;
|
||||
LLVector3 alpha_distance_factor = octree_alpha_distance_factor;
|
||||
S32 size_factor = llmax((S32)octree_size_factor, 1);
|
||||
LLVector3 alpha_distance_factor = octree_alpha_distance_factor;
|
||||
|
||||
const LLVector4a* ext = mDrawable->getSpatialExtents();
|
||||
|
||||
BOOL shrink_wrap = mDrawable->isAnimating();
|
||||
BOOL alpha_wrap = FALSE;
|
||||
//const LLVector4a* ext = mDrawable->getSpatialExtents();
|
||||
|
||||
if (!isHUDAttachment())
|
||||
{
|
||||
for (S32 i = 0; i < mDrawable->getNumFaces(); i++)
|
||||
{
|
||||
LLFace* face = mDrawable->getFace(i);
|
||||
if (!face) continue;
|
||||
if (face->isInAlphaPool() &&
|
||||
!face->canRenderAsMask())
|
||||
{
|
||||
alpha_wrap = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
shrink_wrap = FALSE;
|
||||
}
|
||||
bool shrink_wrap = mShouldShrinkWrap || mDrawable->isAnimating();
|
||||
bool alpha_wrap = FALSE;
|
||||
|
||||
if (alpha_wrap)
|
||||
{
|
||||
LLVector3 bounds = getScale();
|
||||
radius = llmin(bounds.mV[1], bounds.mV[2]);
|
||||
radius = llmin(radius, bounds.mV[0]);
|
||||
radius *= 0.5f;
|
||||
radius *= 1.f+mDrawable->mDistanceWRTCamera*alpha_distance_factor[1];
|
||||
radius += mDrawable->mDistanceWRTCamera*alpha_distance_factor[0];
|
||||
}
|
||||
else if (shrink_wrap)
|
||||
{
|
||||
LLVector4a rad;
|
||||
rad.setSub(ext[1], ext[0]);
|
||||
|
||||
radius = rad.getLength3().getF32()*0.5f;
|
||||
}
|
||||
else if (mDrawable->isStatic())
|
||||
{
|
||||
F32 szf = size_factor;
|
||||
if (!isHUDAttachment() && mDrawable->mDistanceWRTCamera < alpha_distance_factor[2])
|
||||
{
|
||||
for (S32 i = 0; i < mDrawable->getNumFaces(); i++)
|
||||
{
|
||||
LLFace* face = mDrawable->getFace(i);
|
||||
if (!face) continue;
|
||||
if (face->isInAlphaPool() &&
|
||||
!face->canRenderAsMask())
|
||||
{
|
||||
alpha_wrap = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
shrink_wrap = FALSE;
|
||||
}
|
||||
|
||||
radius = llmax(mDrawable->getRadius(), szf);
|
||||
|
||||
radius = powf(radius, 1.f+szf/radius);
|
||||
if (alpha_wrap)
|
||||
{
|
||||
LLVector3 bounds = getScale();
|
||||
radius = llmin(bounds.mV[1], bounds.mV[2]);
|
||||
radius = llmin(radius, bounds.mV[0]);
|
||||
radius *= 0.5f;
|
||||
//radius *= 1.f+mDrawable->mDistanceWRTCamera*alpha_distance_factor[1];
|
||||
//radius += mDrawable->mDistanceWRTCamera*alpha_distance_factor[0];
|
||||
}
|
||||
else if (shrink_wrap)
|
||||
{
|
||||
radius = mDrawable->getRadius() * 0.25f;
|
||||
}
|
||||
else
|
||||
{
|
||||
F32 szf = size_factor;
|
||||
radius = llmax(mDrawable->getRadius(), szf);
|
||||
//radius = llmax(radius, mDrawable->mDistanceWRTCamera * distance_factor[0]);
|
||||
}
|
||||
|
||||
radius *= 1.f + mDrawable->mDistanceWRTCamera * distance_factor[1];
|
||||
radius += mDrawable->mDistanceWRTCamera * distance_factor[0];
|
||||
}
|
||||
else if (mDrawable->getVObj()->isAttachment())
|
||||
{
|
||||
radius = llmax((S32) mDrawable->getRadius(),1)*attachment_size_factor;
|
||||
}
|
||||
else
|
||||
{
|
||||
radius = mDrawable->getRadius();
|
||||
radius *= 1.f + mDrawable->mDistanceWRTCamera * distance_factor[1];
|
||||
radius += mDrawable->mDistanceWRTCamera * distance_factor[0];
|
||||
}
|
||||
|
||||
return llclamp(radius*scale, 0.5f, 256.f);
|
||||
return llclamp(radius, 0.5f, 256.f);
|
||||
}
|
||||
|
||||
const LLVector3 LLVOVolume::getPivotPositionAgent() const
|
||||
|
|
@ -4724,6 +4721,11 @@ void LLVOVolume::markForUpdate(BOOL priority)
|
|||
}
|
||||
}
|
||||
|
||||
if (mDrawable)
|
||||
{
|
||||
shrinkWrap();
|
||||
}
|
||||
|
||||
LLViewerObject::markForUpdate(priority);
|
||||
mVolumeChanged = TRUE;
|
||||
}
|
||||
|
|
@ -5250,7 +5252,7 @@ U32 LLVOVolume::getPartitionType() const
|
|||
}
|
||||
|
||||
LLVolumePartition::LLVolumePartition(LLViewerRegion* regionp)
|
||||
: LLSpatialPartition(LLVOVolume::VERTEX_DATA_MASK, TRUE, GL_DYNAMIC_DRAW, regionp),
|
||||
: LLSpatialPartition(LLVOVolume::VERTEX_DATA_MASK, TRUE, regionp),
|
||||
LLVolumeGeometryManager()
|
||||
{
|
||||
mLODPeriod = 32;
|
||||
|
|
@ -5258,7 +5260,6 @@ LLVolumeGeometryManager()
|
|||
mDrawableType = LLPipeline::RENDER_TYPE_VOLUME;
|
||||
mPartitionType = LLViewerRegion::PARTITION_VOLUME;
|
||||
mSlopRatio = 0.25f;
|
||||
mBufferUsage = GL_DYNAMIC_DRAW;
|
||||
}
|
||||
|
||||
LLVolumeBridge::LLVolumeBridge(LLDrawable* drawablep, LLViewerRegion* regionp)
|
||||
|
|
@ -5270,8 +5271,6 @@ LLVolumeGeometryManager()
|
|||
mDrawableType = LLPipeline::RENDER_TYPE_VOLUME;
|
||||
mPartitionType = LLViewerRegion::PARTITION_BRIDGE;
|
||||
|
||||
mBufferUsage = GL_DYNAMIC_DRAW;
|
||||
|
||||
mSlopRatio = 0.25f;
|
||||
}
|
||||
|
||||
|
|
@ -5423,7 +5422,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
|
|||
// if (selected && LLSelectMgr::getInstance()->mHideSelectedObjects)
|
||||
// [RLVa:KB] - Checked: 2010-11-29 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c
|
||||
const LLViewerObject* pObj = facep->getViewerObject();
|
||||
bool selected = pObj->isSelected();
|
||||
if ( (pObj->isSelected() && LLSelectMgr::getInstance()->mHideSelectedObjects) &&
|
||||
( (!RlvActions::isRlvEnabled()) ||
|
||||
( ((!pObj->isHUDAttachment()) || (!gRlvAttachmentLocks.isLockedAttachment(pObj->getRootEdit()))) &&
|
||||
|
|
@ -5450,7 +5448,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
|
|||
|
||||
S32 idx = draw_vec.size()-1;
|
||||
|
||||
BOOL fullbright = (type == LLRenderPass::PASS_FULLBRIGHT) ||
|
||||
bool fullbright = (type == LLRenderPass::PASS_FULLBRIGHT) ||
|
||||
(type == LLRenderPass::PASS_INVISIBLE) ||
|
||||
(type == LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK) ||
|
||||
(type == LLRenderPass::PASS_ALPHA && facep->isState(LLFace::FULLBRIGHT)) ||
|
||||
|
|
@ -5513,7 +5511,8 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
|
|||
mat = facep->getTextureEntry()->getMaterialParams().get();
|
||||
if (mat)
|
||||
{
|
||||
mat_id = facep->getTextureEntry()->getMaterialID().asUUID();
|
||||
//mat_id = facep->getTextureEntry()->getMaterialID().asUUID();
|
||||
mat_id = facep->getTextureEntry()->getMaterialParams()->getHash();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5538,8 +5537,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
|
|||
}
|
||||
}
|
||||
|
||||
F32 vsize = facep->getVirtualSize(); //TODO -- adjust by texture scale?
|
||||
|
||||
if (index < FACE_DO_NOT_BATCH_TEXTURES && idx >= 0)
|
||||
{
|
||||
if (mat || gltf_mat || draw_vec[idx]->mMaterial)
|
||||
|
|
@ -5552,12 +5549,10 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
|
|||
{
|
||||
batchable = true;
|
||||
draw_vec[idx]->mTextureList[index] = tex;
|
||||
draw_vec[idx]->mTextureListVSize[index] = vsize;
|
||||
}
|
||||
else if (draw_vec[idx]->mTextureList[index] == tex)
|
||||
{ //this face's texture index can be used with this batch
|
||||
batchable = true;
|
||||
draw_vec[idx]->mTextureListVSize[index] = llmax(vsize, draw_vec[idx]->mTextureListVSize[index]);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -5586,14 +5581,11 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
|
|||
{
|
||||
draw_vec[idx]->mCount += facep->getIndicesCount();
|
||||
draw_vec[idx]->mEnd += facep->getGeomCount();
|
||||
draw_vec[idx]->mVSize = llmax(draw_vec[idx]->mVSize, vsize);
|
||||
|
||||
if (index < FACE_DO_NOT_BATCH_TEXTURES && index >= draw_vec[idx]->mTextureList.size())
|
||||
{
|
||||
draw_vec[idx]->mTextureList.resize(index+1);
|
||||
draw_vec[idx]->mTextureList[index] = tex;
|
||||
draw_vec[idx]->mTextureListVSize.resize(index + 1);
|
||||
draw_vec[idx]->mTextureListVSize[index] = vsize;
|
||||
}
|
||||
draw_vec[idx]->validate();
|
||||
}
|
||||
|
|
@ -5603,10 +5595,8 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
|
|||
U32 end = start + facep->getGeomCount()-1;
|
||||
U32 offset = facep->getIndicesStart();
|
||||
U32 count = facep->getIndicesCount();
|
||||
LLPointer<LLDrawInfo> draw_info = new LLDrawInfo(start,end,count,offset, tex,
|
||||
facep->getVertexBuffer(), selected, fullbright, bump);
|
||||
draw_info->mGroup = group;
|
||||
draw_info->mVSize = vsize;
|
||||
LLPointer<LLDrawInfo> draw_info = new LLDrawInfo(start,end,count,offset, tex,
|
||||
facep->getVertexBuffer(), fullbright, bump);
|
||||
draw_vec.push_back(draw_info);
|
||||
draw_info->mTextureMatrix = tex_mat;
|
||||
draw_info->mModelMatrix = model_mat;
|
||||
|
|
@ -5679,8 +5669,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
|
|||
{ //initialize texture list for texture batching
|
||||
draw_info->mTextureList.resize(index+1);
|
||||
draw_info->mTextureList[index] = tex;
|
||||
draw_info->mTextureListVSize.resize(index + 1);
|
||||
draw_info->mTextureListVSize[index] = vsize;
|
||||
}
|
||||
draw_info->validate();
|
||||
}
|
||||
|
|
@ -5846,8 +5834,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
|||
U32 spec_count[2] = { 0 };
|
||||
U32 normspec_count[2] = { 0 };
|
||||
|
||||
U32 useage = group->getSpatialPartition()->mBufferUsage;
|
||||
|
||||
static LLCachedControl<S32> max_vbo_size(gSavedSettings, "RenderMaxVBOSize", 512);
|
||||
static LLCachedControl<S32> max_node_size(gSavedSettings, "RenderMaxNodeSize", 65536);
|
||||
U32 max_vertices = (max_vbo_size * 1024)/LLVertexBuffer::calcVertexSize(group->getSpatialPartition()->mVertexDataMask);
|
||||
|
|
@ -5880,11 +5866,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (drawablep->isAnimating())
|
||||
{ //fall back to stream draw for animating verts
|
||||
useage = GL_STREAM_DRAW;
|
||||
}
|
||||
|
||||
LLVOVolume* vobj = drawablep->getVOVolume();
|
||||
|
||||
if (!vobj)
|
||||
|
|
@ -6274,8 +6255,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
|||
}
|
||||
}
|
||||
|
||||
group->mBufferUsage = useage;
|
||||
|
||||
//PROCESS NON-ALPHA FACES
|
||||
U32 simple_mask = LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_COLOR;
|
||||
U32 alpha_mask = simple_mask | 0x80000000; //hack to give alpha verts their own VBO
|
||||
|
|
@ -6368,8 +6347,6 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
|
|||
|
||||
group->mBuilt = 1.f;
|
||||
|
||||
S32 num_mapped_vertex_buffer = LLVertexBuffer::sMappedCount ;
|
||||
|
||||
const U32 MAX_BUFFER_COUNT = 4096;
|
||||
LLVertexBuffer* locked_buffer[MAX_BUFFER_COUNT];
|
||||
|
||||
|
|
@ -6432,11 +6409,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
|
|||
gPipeline.markRebuild(group, TRUE);
|
||||
}
|
||||
|
||||
|
||||
if (buff->isLocked() && buffer_count < MAX_BUFFER_COUNT)
|
||||
{
|
||||
locked_buffer[buffer_count++] = buff;
|
||||
}
|
||||
buff->unmapBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6454,44 +6427,17 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group)
|
|||
LL_PROFILE_ZONE_NAMED_CATEGORY_VOLUME("rebuildMesh - flush");
|
||||
for (LLVertexBuffer** iter = locked_buffer, ** end_iter = locked_buffer+buffer_count; iter != end_iter; ++iter)
|
||||
{
|
||||
(*iter)->flush();
|
||||
(*iter)->unmapBuffer();
|
||||
}
|
||||
|
||||
// don't forget alpha
|
||||
if(group != NULL &&
|
||||
!group->mVertexBuffer.isNull() &&
|
||||
group->mVertexBuffer->isLocked())
|
||||
!group->mVertexBuffer.isNull())
|
||||
{
|
||||
group->mVertexBuffer->flush();
|
||||
group->mVertexBuffer->unmapBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
//if not all buffers are unmapped
|
||||
if(num_mapped_vertex_buffer != LLVertexBuffer::sMappedCount)
|
||||
{
|
||||
LL_WARNS() << "Not all mapped vertex buffers are unmapped!" << LL_ENDL ;
|
||||
for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)
|
||||
{
|
||||
LLDrawable* drawablep = (LLDrawable*)(*drawable_iter)->getDrawable();
|
||||
if(!drawablep)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (S32 i = 0; i < drawablep->getNumFaces(); ++i)
|
||||
{
|
||||
LLFace* face = drawablep->getFace(i);
|
||||
if (face)
|
||||
{
|
||||
LLVertexBuffer* buff = face->getVertexBuffer();
|
||||
if (buff && buff->isLocked())
|
||||
{
|
||||
buff->flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
group->clearState(LLSpatialGroup::MESH_DIRTY | LLSpatialGroup::NEW_DRAWINFO);
|
||||
}
|
||||
}
|
||||
|
|
@ -6558,18 +6504,6 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
|||
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
|
||||
|
||||
U32 geometryBytes = 0;
|
||||
U32 buffer_usage = group->mBufferUsage;
|
||||
|
||||
#if LL_DARWIN
|
||||
// HACK from Leslie:
|
||||
// Disable VBO usage for alpha on Mac OS X because it kills the framerate
|
||||
// due to implicit calls to glTexSubImage that are beyond our control.
|
||||
// (this works because the only calls here that sort by distance are alpha)
|
||||
if (distance_sort)
|
||||
{
|
||||
buffer_usage = 0x0;
|
||||
}
|
||||
#endif
|
||||
|
||||
//calculate maximum number of vertices to store in a single buffer
|
||||
static LLCachedControl<S32> max_vbo_size(gSavedSettings, "RenderMaxVBOSize", 512);
|
||||
|
|
@ -6790,19 +6724,13 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (flexi && buffer_usage && buffer_usage != GL_STREAM_DRAW)
|
||||
{
|
||||
buffer_usage = GL_STREAM_DRAW;
|
||||
}
|
||||
|
||||
//create vertex buffer
|
||||
LLPointer<LLVertexBuffer> buffer;
|
||||
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_VOLUME("genDrawInfo - allocate");
|
||||
buffer = createVertexBuffer(mask, buffer_usage);
|
||||
if(!buffer->allocateBuffer(geom_count, index_count, TRUE))
|
||||
buffer = new LLVertexBuffer(mask);
|
||||
if(!buffer->allocateBuffer(geom_count, index_count))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate group Vertex Buffer to "
|
||||
<< geom_count << " vertices and "
|
||||
|
|
@ -7201,7 +7129,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
|||
|
||||
if (buffer)
|
||||
{
|
||||
buffer->flush();
|
||||
buffer->unmapBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7216,9 +7144,6 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
|||
|
||||
void LLVolumeGeometryManager::addGeometryCount(LLSpatialGroup* group, U32& vertex_count, U32& index_count)
|
||||
{
|
||||
//initialize to default usage for this partition
|
||||
U32 usage = group->getSpatialPartition()->mBufferUsage;
|
||||
|
||||
//for each drawable
|
||||
for (LLSpatialGroup::element_iter drawable_iter = group->getDataBegin(); drawable_iter != group->getDataEnd(); ++drawable_iter)
|
||||
{
|
||||
|
|
@ -7228,23 +7153,13 @@ void LLVolumeGeometryManager::addGeometryCount(LLSpatialGroup* group, U32& verte
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (drawablep->isAnimating())
|
||||
{ //fall back to stream draw for animating verts
|
||||
usage = GL_STREAM_DRAW;
|
||||
}
|
||||
}
|
||||
|
||||
group->mBufferUsage = usage;
|
||||
}
|
||||
|
||||
void LLGeometryManager::addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32 &index_count)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
|
||||
|
||||
//initialize to default usage for this partition
|
||||
U32 usage = group->getSpatialPartition()->mBufferUsage;
|
||||
|
||||
//clear off any old faces
|
||||
mFaceList.clear();
|
||||
|
||||
|
|
@ -7258,11 +7173,6 @@ void LLGeometryManager::addGeometryCount(LLSpatialGroup* group, U32 &vertex_coun
|
|||
continue;
|
||||
}
|
||||
|
||||
if (drawablep->isAnimating())
|
||||
{ //fall back to stream draw for animating verts
|
||||
usage = GL_STREAM_DRAW;
|
||||
}
|
||||
|
||||
//for each face
|
||||
for (S32 i = 0; i < drawablep->getNumFaces(); i++)
|
||||
{
|
||||
|
|
@ -7287,8 +7197,6 @@ void LLGeometryManager::addGeometryCount(LLSpatialGroup* group, U32 &vertex_coun
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
group->mBufferUsage = usage;
|
||||
}
|
||||
|
||||
LLHUDPartition::LLHUDPartition(LLViewerRegion* regionp) : LLBridgePartition(regionp)
|
||||
|
|
|
|||
|
|
@ -153,10 +153,14 @@ BOOL LLVOWater::updateGeometry(LLDrawable *drawable)
|
|||
indices_per_quad * num_quads);
|
||||
|
||||
LLVertexBuffer* buff = face->getVertexBuffer();
|
||||
if (!buff || !buff->isWriteable())
|
||||
if (!buff ||
|
||||
buff->getNumIndices() != face->getIndicesCount() ||
|
||||
buff->getNumVerts() != face->getGeomCount() ||
|
||||
face->getIndicesStart() != 0 ||
|
||||
face->getGeomIndex() != 0)
|
||||
{
|
||||
buff = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK, GL_DYNAMIC_DRAW);
|
||||
if (!buff->allocateBuffer(face->getGeomCount(), face->getIndicesCount(), TRUE))
|
||||
buff = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK);
|
||||
if (!buff->allocateBuffer(face->getGeomCount(), face->getIndicesCount()))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer on water update to "
|
||||
<< face->getGeomCount() << " vertices and "
|
||||
|
|
@ -166,13 +170,6 @@ BOOL LLVOWater::updateGeometry(LLDrawable *drawable)
|
|||
face->setGeomIndex(0);
|
||||
face->setVertexBuffer(buff);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!buff->resizeBuffer(face->getGeomCount(), face->getIndicesCount()))
|
||||
{
|
||||
LL_WARNS() << "Failed to resize Vertex Buffer" << LL_ENDL;
|
||||
}
|
||||
}
|
||||
|
||||
index_offset = face->getGeometry(verticesp,normalsp,texCoordsp, indicesp);
|
||||
|
||||
|
|
@ -233,7 +230,7 @@ BOOL LLVOWater::updateGeometry(LLDrawable *drawable)
|
|||
}
|
||||
}
|
||||
|
||||
buff->flush();
|
||||
buff->unmapBuffer();
|
||||
|
||||
mDrawable->movePartition();
|
||||
LLPipeline::sCompiles++;
|
||||
|
|
@ -298,7 +295,7 @@ U32 LLVOVoidWater::getPartitionType() const
|
|||
}
|
||||
|
||||
LLWaterPartition::LLWaterPartition(LLViewerRegion* regionp)
|
||||
: LLSpatialPartition(0, FALSE, GL_DYNAMIC_DRAW, regionp)
|
||||
: LLSpatialPartition(0, FALSE, regionp)
|
||||
{
|
||||
mInfiniteFarClip = TRUE;
|
||||
mDrawableType = LLPipeline::RENDER_TYPE_WATER;
|
||||
|
|
|
|||
|
|
@ -151,9 +151,9 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
|
|||
|
||||
if (mFsSkyVerts.isNull())
|
||||
{
|
||||
mFsSkyVerts = new LLVertexBuffer(LLDrawPoolWLSky::ADV_ATMO_SKY_VERTEX_DATA_MASK, GL_STATIC_DRAW);
|
||||
mFsSkyVerts = new LLVertexBuffer(LLDrawPoolWLSky::ADV_ATMO_SKY_VERTEX_DATA_MASK);
|
||||
|
||||
if (!mFsSkyVerts->allocateBuffer(4, 6, TRUE))
|
||||
if (!mFsSkyVerts->allocateBuffer(4, 6))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer on full screen sky update" << LL_ENDL;
|
||||
}
|
||||
|
|
@ -184,7 +184,7 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
|
|||
*indices++ = 3;
|
||||
*indices++ = 2;
|
||||
|
||||
mFsSkyVerts->flush();
|
||||
mFsSkyVerts->unmapBuffer();
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -216,7 +216,7 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
|
|||
|
||||
for (U32 i = 0; i < strips_segments ;++i)
|
||||
{
|
||||
LLVertexBuffer * segment = new LLVertexBuffer(LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK, GL_STATIC_DRAW);
|
||||
LLVertexBuffer * segment = new LLVertexBuffer(LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK);
|
||||
mStripsVerts[i] = segment;
|
||||
|
||||
U32 num_stacks_this_seg = stacks_per_seg;
|
||||
|
|
@ -237,7 +237,7 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
|
|||
const U32 num_indices_this_seg = 1+num_stacks_this_seg*(2+2*verts_per_stack);
|
||||
llassert(num_indices_this_seg * sizeof(U16) <= max_buffer_bytes);
|
||||
|
||||
bool allocated = segment->allocateBuffer(num_verts_this_seg, num_indices_this_seg, TRUE);
|
||||
bool allocated = segment->allocateBuffer(num_verts_this_seg, num_indices_this_seg);
|
||||
#if RELEASE_SHOW_WARNS
|
||||
if( !allocated )
|
||||
{
|
||||
|
|
@ -267,7 +267,7 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
|
|||
buildStripsBuffer(begin_stack, end_stack, vertices, texCoords, indices, dome_radius, verts_per_stack, total_stacks);
|
||||
|
||||
// and unlock the buffer
|
||||
segment->flush();
|
||||
segment->unmapBuffer();
|
||||
}
|
||||
|
||||
#if RELEASE_SHOW_DEBUG
|
||||
|
|
@ -288,7 +288,7 @@ void LLVOWLSky::drawStars(void)
|
|||
// render the stars as a sphere centered at viewer camera
|
||||
if (mStarsVerts.notNull())
|
||||
{
|
||||
mStarsVerts->setBuffer(LLDrawPoolWLSky::STAR_VERTEX_DATA_MASK);
|
||||
mStarsVerts->setBuffer();
|
||||
mStarsVerts->drawArrays(LLRender::TRIANGLES, 0, getStarsNumVerts()*4);
|
||||
}
|
||||
}
|
||||
|
|
@ -302,7 +302,7 @@ void LLVOWLSky::drawFsSky(void)
|
|||
|
||||
LLGLDisable disable_blend(GL_BLEND);
|
||||
|
||||
mFsSkyVerts->setBuffer(LLDrawPoolWLSky::ADV_ATMO_SKY_VERTEX_DATA_MASK);
|
||||
mFsSkyVerts->setBuffer();
|
||||
mFsSkyVerts->drawRange(LLRender::TRIANGLES, 0, mFsSkyVerts->getNumVerts() - 1, mFsSkyVerts->getNumIndices(), 0);
|
||||
gPipeline.addTrianglesDrawn(mFsSkyVerts->getNumIndices());
|
||||
LLVertexBuffer::unbind();
|
||||
|
|
@ -317,15 +317,13 @@ void LLVOWLSky::drawDome(void)
|
|||
|
||||
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
|
||||
|
||||
const U32 data_mask = LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK;
|
||||
|
||||
std::vector< LLPointer<LLVertexBuffer> >::const_iterator strips_vbo_iter, end_strips;
|
||||
end_strips = mStripsVerts.end();
|
||||
for(strips_vbo_iter = mStripsVerts.begin(); strips_vbo_iter != end_strips; ++strips_vbo_iter)
|
||||
{
|
||||
LLVertexBuffer * strips_segment = strips_vbo_iter->get();
|
||||
|
||||
strips_segment->setBuffer(data_mask);
|
||||
strips_segment->setBuffer();
|
||||
|
||||
strips_segment->drawRange(
|
||||
LLRender::TRIANGLE_STRIP,
|
||||
|
|
@ -518,10 +516,10 @@ BOOL LLVOWLSky::updateStarGeometry(LLDrawable *drawable)
|
|||
LLStrider<LLColor4U> colorsp;
|
||||
LLStrider<LLVector2> texcoordsp;
|
||||
|
||||
if (mStarsVerts.isNull() || !mStarsVerts->isWriteable())
|
||||
if (mStarsVerts.isNull())
|
||||
{
|
||||
mStarsVerts = new LLVertexBuffer(LLDrawPoolWLSky::STAR_VERTEX_DATA_MASK, GL_DYNAMIC_DRAW);
|
||||
if (!mStarsVerts->allocateBuffer(getStarsNumVerts()*6, 0, TRUE))
|
||||
mStarsVerts = new LLVertexBuffer(LLDrawPoolWLSky::STAR_VERTEX_DATA_MASK);
|
||||
if (!mStarsVerts->allocateBuffer(getStarsNumVerts()*6, 0))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer for Sky to " << getStarsNumVerts() * 6 << " vertices" << LL_ENDL;
|
||||
}
|
||||
|
|
@ -591,6 +589,6 @@ BOOL LLVOWLSky::updateStarGeometry(LLDrawable *drawable)
|
|||
|
||||
}
|
||||
|
||||
mStarsVerts->flush();
|
||||
mStarsVerts->unmapBuffer();
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -266,21 +266,17 @@ public:
|
|||
void stateSort(LLDrawable* drawablep, LLCamera& camera);
|
||||
void postSort(LLCamera& camera);
|
||||
|
||||
//update stats for textures in given DrawInfo
|
||||
void touchTextures(LLDrawInfo* info);
|
||||
void touchTexture(LLViewerTexture* tex, F32 vsize);
|
||||
|
||||
void forAllVisibleDrawables(void (*func)(LLDrawable*));
|
||||
|
||||
void renderObjects(U32 type, U32 mask, bool texture = true, bool batch_texture = false, bool rigged = false);
|
||||
void renderObjects(U32 type, bool texture = true, bool batch_texture = false, bool rigged = false);
|
||||
void renderShadowSimple(U32 type);
|
||||
|
||||
void renderAlphaObjects(U32 mask, bool texture = true, bool batch_texture = false, bool rigged = false);
|
||||
void renderMaskedObjects(U32 type, U32 mask, bool texture = true, bool batch_texture = false, bool rigged = false);
|
||||
void renderFullbrightMaskedObjects(U32 type, U32 mask, bool texture = true, bool batch_texture = false, bool rigged = false);
|
||||
void renderAlphaObjects(bool texture = true, bool batch_texture = false, bool rigged = false);
|
||||
void renderMaskedObjects(U32 type, bool texture = true, bool batch_texture = false, bool rigged = false);
|
||||
void renderFullbrightMaskedObjects(U32 type, bool texture = true, bool batch_texture = false, bool rigged = false);
|
||||
|
||||
void renderGroups(LLRenderPass* pass, U32 type, U32 mask, bool texture);
|
||||
void renderRiggedGroups(LLRenderPass* pass, U32 type, U32 mask, bool texture);
|
||||
void renderGroups(LLRenderPass* pass, U32 type, bool texture);
|
||||
void renderRiggedGroups(LLRenderPass* pass, U32 type, bool texture);
|
||||
|
||||
void grabReferences(LLCullResult& result);
|
||||
void clearReferences();
|
||||
|
|
@ -290,9 +286,7 @@ public:
|
|||
void checkReferences(LLDrawable* drawable);
|
||||
void checkReferences(LLDrawInfo* draw_info);
|
||||
void checkReferences(LLSpatialGroup* group);
|
||||
|
||||
|
||||
void renderGeom(LLCamera& camera, bool forceVBOUpdate = false);
|
||||
|
||||
void renderGeomDeferred(LLCamera& camera, bool do_occlusion = false);
|
||||
void renderGeomPostDeferred(LLCamera& camera);
|
||||
void renderGeomShadow(LLCamera& camera);
|
||||
|
|
|
|||
|
|
@ -107,7 +107,6 @@
|
|||
<panel label="Hardware" name="Hardware Settings">
|
||||
<check_box label="Anisotropische Filterung (langsamer, wenn aktiviert)" name="ani" tool_tip="Aktiviert anisotropischen Filter, wodurch die Qualität von Texturen verbessert wird, wenn sie im relativ großen Winkel in Abhängigkeit der Kameraposition betrachtet werden. Üblicherweise erscheinen sie dadurch in größerer Entfernung weniger verwaschen."/>
|
||||
<check_box label="VSync aktivieren" name="vsync" tool_tip="Synchronisiert die Bilder pro Sekunde mit der Bildwiederholrate des Monitors, was in einer gleichmäßigeren Performance resultiert."/>
|
||||
<check_box label="Gestreamte VBOs aktivieren" name="vbo_stream" tool_tip="Deaktivieren kann die Performance verbessern, wenn VBOs aktiviert sind, insbesondere auf diversen AMD-GPUs."/>
|
||||
<text name="tc label">
|
||||
S3TC aktivieren:
|
||||
</text>
|
||||
|
|
|
|||
|
|
@ -793,17 +793,6 @@
|
|||
name="vsync"
|
||||
tool_tip="Synchronizes the frame rate to the refresh rate of the monitor, can result in increased stutter and input lag."
|
||||
width="315" />
|
||||
<check_box
|
||||
control_name="RenderUseStreamVBO"
|
||||
height="16"
|
||||
initial_value="false"
|
||||
label="Enable Streamed VBOs"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
top_pad="5"
|
||||
name="vbo_stream"
|
||||
tool_tip="Disabling this may improve performance when VBOs are enabled. Disabling produced observable improvement on various AMD and Intel GPUs."
|
||||
width="315" />
|
||||
<check_box
|
||||
control_name="RenderCompressTextures"
|
||||
height="16"
|
||||
|
|
|
|||
|
|
@ -69,7 +69,6 @@
|
|||
<panel label="Paramètres matériels" name="Hardware Settings">
|
||||
<check_box label="Filtrage Anisotrope (plus lent lorsqu'il est activé)" name="ani"/>
|
||||
<check_box label="Activer VSync" name="vsync" tool_tip="Synchronise la fréquence d'images avec la fréquence de rafraîchissement du moniteur, ce qui peut entraîner une augmentation du lag et des images saccadées."/>
|
||||
<check_box label="Activer les Streamed VBOs" name="vbo_stream" tool_tip="Désactiver cette option peut améliorer les performances lorsque les VBO sont activés. La désactivation de ce paramètre améliore grandement les performances sur certaines cartes graphiques Intel et AMD."/>
|
||||
<check_box label="Activer la compression de textures sans pertes (Redémarrage requis)" name="texture compression" tool_tip="Activer la compression des textures dans la mémoire graphique permet de charger des textures de résolution supérieure et une prise en charge d'un nombre de textures plus élevé pour le même cout mémoire."/>
|
||||
<check_box label="Active la prise en charge des écrans HiDPI (Mac OSX seulement; Redémarrage requis)" name="use HiDPI" tool_tip="Active OpenGL pour l'affichage haute résolution."/>
|
||||
<text name="Antialiasing:">Anticrénelage :</text>
|
||||
|
|
|
|||
|
|
@ -104,7 +104,6 @@
|
|||
<panel label="Impostazioni Hardware" name="Hardware Settings">
|
||||
<check_box label="Filtro Anisotropico (rallenta se attivo)" name="ani"/>
|
||||
<check_box label="Abilita OpenGL Vertex Buffer sugli oggetti" name="vbo" tool_tip="Abilitare questo su computer con schede video di ultima generazione per aumentare le prestazioni della scheda video. Tuttavia, gli hardware vecchi spesso hanno una scarsa implementazione dei VBOs e questo può provocare crash improvvisi quando questa opzione è abilitata."/>
|
||||
<check_box label="Abilita Streamed VBO" name="vbo_stream" tool_tip="La disattivazione di questa opzione può migliorare le prestazioni quando le VBO sono abilitate. Disattivato mostra importanti miglioramenti su molte GPU AMD (es: Schede video ATI)."/>
|
||||
<check_box label="Abilita compressione texture (richiede riavvio)" name="texture compression" tool_tip="Le texture vengono compresse nella memoria video, questo consente per le texture con una risoluzione alta di essere caricate più rapidamente perdendo qualità nel colore."/>
|
||||
<check_box label="Abilita supporto display HiDPI (solo Mac OSX; richiede riavvio)" name="use HiDPI" tool_tip="Abilita OpenGL per il disegno ad alta risoluzione." />
|
||||
<text name="Antialiasing:">
|
||||
|
|
|
|||
|
|
@ -136,7 +136,6 @@
|
|||
|
||||
<check_box label="異方性フィルタリング(有効にすると速度が低下します)" name="ani" tool_tip="ここにチェックを入れると、異方性フィルタリングが有効になります。これは、自分のカメラの位置に対して、正面ではない角度で見えているテクスチャの品質を向上させるものです。通常、より遠くにある部分がぼやけて見えるのを防ぎます。" />
|
||||
<check_box label="OpenGL Vertex Buffer Objectsを有効化" name="vbo" tool_tip="最新のハードウェアでこの設定を有効にすると、パフォーマンスが向上します。しかし、旧型のハードウェアではVBOの実装が貧弱な場合が多く、この設定を有効にすることでクラッシュにつながるおそれがあります。" />
|
||||
<check_box label="VBOのストリームを有効にする" name="vbo_stream" tool_tip="VBOを有効にしている時に、このオプションをオフにするとパフォーマンスが向上する可能性があります。多くのAMDのGPUにおいて、このオプションをオフにしたことで顕著なパフォーマンスの向上が見られました。" />
|
||||
<check_box label="テクスチャの不可逆圧縮(再起動が必要)" name="texture compression" tool_tip="ビデオメモリ内のテクスチャを圧縮することで、色の品質が低下する代わりに、より高解像度のテクスチャやより多くのテクスチャを読み込むことを可能にします。" />
|
||||
<check_box label="HiDPI 表示対応を有効にする(Mac OSX のみ。再起動が必要。)" name="use HiDPI" tool_tip="高解像度描画のための OpenGL を有効にします" />
|
||||
<text name="Antialiasing:" tool_tip="ハードウェアによってはこの設定の変更を適用するには再起動が必要な場合があります。" >
|
||||
|
|
|
|||
|
|
@ -104,7 +104,6 @@
|
|||
<panel label="Ustawienia sprzętowe" name="Hardware Settings">
|
||||
<check_box label="Filtrowanie anizotropowe (wolniej, gdy włączone)" name="ani" tool_tip="To pole wyboru włącza filtrowanie anizotropowe, które jest metodą polepszania jakości tekstur, gdy są one oglądane pod względnie dużymi kątami w stosunku do położenia kamery. Zazwyczaj sprawia, że wydają się mniej rozmyte przy większych odległościach." />
|
||||
<check_box label="Włącz VSync" name="vsync" tool_tip="Synchronizuje liczbę klatek na sekundę z częstotliwością odświeżania monitora, może skutkować zmniejszeniem widocznej płynności i opóźnieniami."/>
|
||||
<check_box label="Włącz strumieniowe VBO" name="vbo_stream" tool_tip="Wyłączenie tej opcji może zwiększyć wydajność, gdy VBO jest włączone. Odnotowano zauważalny wzrost wydajności na różnych GPU ze stajni AMD i Intela przy wyłączonej tej pozycji."/>
|
||||
<check_box label="Włącz stratną kompresję tekstur (wymaga restartu)" name="texture compression" tool_tip="Kompresuje tekstury w pamięci wideo. Umożliwi to ładowanie tekstur w wyższej rozdzielczości / większej ich ilości, ale kosztem jakości obrazu."/>
|
||||
<check_box label="Włącz wsparcie dla ekranów HiDPI (tylko Mac OSX; wymaga restartu)" name="use HiDPI" tool_tip="Włącz funkcje OpenGL dla rysowania w wysokich rozdzielczościach." />
|
||||
<text name="Antialiasing:" tool_tip="Zmiana tego ustawienia może wymagać ponownego uruchomienia na niektórych urządzeniach.">
|
||||
|
|
|
|||
|
|
@ -105,7 +105,6 @@
|
|||
<panel label="Аппаратные установки" name="Hardware Settings">
|
||||
<check_box label="Анизотропная фильтрация (медленнее, когда включено)" name="ani" tool_tip = "Этот флажок включает анизотропную фильтрацию, которая представляет собой метод повышения качества текстур, когда они просматриваются под относительно большими углами по отношению к положению вашей камеры. Обычно заставляет их выглядеть менее размытыми на больших расстояниях."/>
|
||||
<check_box label="Включить VSync" name="vsync" tool_tip="Синхронизирует частоту кадров с частотой обновления монитора, что обеспечивает плавную работу."/>
|
||||
<check_box label="Включить потоковое VBO" name="vbo_stream" tool_tip="Отключение этого может улучшить производительность при включеном VBO. Наблюдение показало, что отключение давало улучшения на различных графических картах AMD и Intel."/>
|
||||
<check_box label="Включить сжатие текстур с потерями (требуется перезапуск)" name="texture compression" tool_tip="Сжатие текстур в видеопамяти, позволяет текстурам с высоким разрешение загружаться за счет некоторого потери качества цвета."/>
|
||||
<check_box label="Включить поддержку дисплеев HiDPI (только Mac OSX; требуется перезапуск)" name="use HiDPI" tool_tip="Включить OpenGL для отображения в высоком разрешении."/>
|
||||
<text name="Antialiasing:" tool_tip = "Изменения этого параметра может потребовать перезапуск на некотором оборудовании." width="290">
|
||||
|
|
|
|||
Loading…
Reference in New Issue