Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:Shyotl/SingularityViewer.git
Browse files Browse the repository at this point in the history
  • Loading branch information
Shyotl committed Feb 8, 2018
2 parents 1271eeb + 24a05a2 commit ce1b58d
Show file tree
Hide file tree
Showing 79 changed files with 1,071 additions and 1,364 deletions.
10 changes: 5 additions & 5 deletions indra/llimage/llimage.cpp
Expand Up @@ -281,7 +281,7 @@ U8* LLImageBase::allocateDataSize(S32 width, S32 height, S32 ncomponents, S32 si
// LLImageRaw
//---------------------------------------------------------------------------

AIThreadSafeSimpleDC<S32> LLImageRaw::sGlobalRawMemory;
AIThreadSafeSimpleDC<S64> LLImageRaw::sGlobalRawMemory;
S32 LLImageRaw::sRawImageCount = 0;
S32 LLImageRaw::sRawImageCachedCount = 0;

Expand Down Expand Up @@ -358,7 +358,7 @@ LLImageRaw::~LLImageRaw()
U8* LLImageRaw::allocateData(S32 size)
{
U8* res = LLImageBase::allocateData(size);
*AIAccess<S32>(sGlobalRawMemory) += getDataSize();
*AIAccess<S64>(sGlobalRawMemory) += getDataSize();
return res;
}

Expand All @@ -367,15 +367,15 @@ U8* LLImageRaw::reallocateData(S32 size)
{
S32 old_data_size = getDataSize();
U8* res = LLImageBase::reallocateData(size);
*AIAccess<S32>(sGlobalRawMemory) += getDataSize() - old_data_size;
*AIAccess<S64>(sGlobalRawMemory) += getDataSize() - old_data_size;
return res;
}

// virtual
void LLImageRaw::deleteData()
{
{
*AIAccess<S32>(sGlobalRawMemory) -= getDataSize();
*AIAccess<S64>(sGlobalRawMemory) -= getDataSize();
}
LLImageBase::deleteData();
}
Expand All @@ -392,7 +392,7 @@ void LLImageRaw::setDataAndSize(U8 *data, S32 width, S32 height, S8 components)
LLImageBase::setSize(width, height, components) ;
LLImageBase::setDataAndSize(data, width * height * components) ;

*AIAccess<S32>(sGlobalRawMemory) += getDataSize();
*AIAccess<S64>(sGlobalRawMemory) += getDataSize();
}

BOOL LLImageRaw::resize(U16 width, U16 height, S8 components)
Expand Down
2 changes: 1 addition & 1 deletion indra/llimage/llimage.h
Expand Up @@ -257,7 +257,7 @@ class LLImageRaw : public LLImageBase
void setDataAndSize(U8 *data, S32 width, S32 height, S8 components) ;

public:
static AIThreadSafeSimpleDC<S32> sGlobalRawMemory;
static AIThreadSafeSimpleDC<S64> sGlobalRawMemory;
static S32 sRawImageCount;

static S32 sRawImageCachedCount;
Expand Down
1 change: 1 addition & 0 deletions indra/llmessage/aihttptimeoutpolicy.cpp
Expand Up @@ -962,3 +962,4 @@ P(wholeModelFeeResponder);
P(wholeModelUploadResponder);
P2(XMLRPCResponder, connect_40s);
P2(crashLoggerResponder, transfer_300s);
P(getUpdateInfoResponder);
2 changes: 1 addition & 1 deletion indra/llrender/llglslshader.cpp
Expand Up @@ -414,7 +414,7 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes,
}

// Attach existing objects
if (!LLShaderMgr::instance()->attachShaderFeatures(this))
if (!LLShaderMgr::instance()->attachClassSharedShaders(*this, mShaderClass) || !LLShaderMgr::instance()->attachShaderFeatures(this))
{
if(mProgramObject)
glDeleteObjectARB(mProgramObject);
Expand Down
16 changes: 8 additions & 8 deletions indra/llrender/llimagegl.cpp
Expand Up @@ -50,9 +50,9 @@ U32 wpo2(U32 i);

U32 LLImageGL::sUniqueCount = 0;
U32 LLImageGL::sBindCount = 0;
S32Bytes LLImageGL::sGlobalTextureMemory(0);
S32Bytes LLImageGL::sBoundTextureMemory(0);
S32Bytes LLImageGL::sCurBoundTextureMemory(0);
S64Bytes LLImageGL::sGlobalTextureMemory(0);
S64Bytes LLImageGL::sBoundTextureMemory(0);
S64Bytes LLImageGL::sCurBoundTextureMemory(0);
S32 LLImageGL::sCount = 0;

BOOL LLImageGL::sGlobalUseAnisotropic = FALSE;
Expand All @@ -78,9 +78,9 @@ S32 LLImageGL::sCurTexPickSize = -1 ;
LLPointer<LLImageGL> LLImageGL::sHighlightTexturep = NULL;
S32 LLImageGL::sMaxCategories = 1 ;

std::vector<S32Bytes> LLImageGL::sTextureMemByCategory;
std::vector<S32Bytes> LLImageGL::sTextureMemByCategoryBound ;
std::vector<S32Bytes> LLImageGL::sTextureCurMemByCategoryBound ;
std::vector<S64Bytes> LLImageGL::sTextureMemByCategory;
std::vector<S64Bytes> LLImageGL::sTextureMemByCategoryBound ;
std::vector<S64Bytes> LLImageGL::sTextureCurMemByCategoryBound ;
//------------------------
// ****************************************************************************************************
//End for texture auditing use only
Expand Down Expand Up @@ -293,7 +293,7 @@ void LLImageGL::updateStats(F32 current_time)
LL_RECORD_BLOCK_TIME(FTM_IMAGE_UPDATE_STATS);
sLastFrameTime = current_time;
sBoundTextureMemory = sCurBoundTextureMemory;
sCurBoundTextureMemory = S32Bytes(0);
sCurBoundTextureMemory = S64Bytes(0);

if(gAuditTexture)
{
Expand All @@ -305,7 +305,7 @@ void LLImageGL::updateStats(F32 current_time)
for(U32 i = 0 ; i < sTextureCurMemByCategoryBound.size() ; i++)
{
sTextureMemByCategoryBound[i] = sTextureCurMemByCategoryBound[i] ;
sTextureCurMemByCategoryBound[i] = (S32Bytes)0 ;
sTextureCurMemByCategoryBound[i] = (S64Bytes)0 ;
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions indra/llrender/llimagegl.h
Expand Up @@ -233,9 +233,9 @@ class LLImageGL : public LLRefCount
static F32 sLastFrameTime;

// Global memory statistics
static S32Bytes sGlobalTextureMemory; // Tracks main memory texmem
static S32Bytes sBoundTextureMemory; // Tracks bound texmem for last completed frame
static S32Bytes sCurBoundTextureMemory; // Tracks bound texmem for current frame
static S64Bytes sGlobalTextureMemory; // Tracks main memory texmem
static S64Bytes sBoundTextureMemory; // Tracks bound texmem for last completed frame
static S64Bytes sCurBoundTextureMemory; // Tracks bound texmem for current frame
static U32 sBindCount; // Tracks number of texture binds for current frame
static U32 sUniqueCount; // Tracks number of unique texture binds for current frame
static BOOL sGlobalUseAnisotropic;
Expand Down Expand Up @@ -288,9 +288,9 @@ class LLImageGL : public LLRefCount
//for debug use: show texture category distribution
//----------------------------------------

static std::vector<S32Bytes> sTextureMemByCategory;
static std::vector<S32Bytes> sTextureMemByCategoryBound ;
static std::vector<S32Bytes> sTextureCurMemByCategoryBound ;
static std::vector<S64Bytes> sTextureMemByCategory;
static std::vector<S64Bytes> sTextureMemByCategoryBound ;
static std::vector<S64Bytes> sTextureCurMemByCategoryBound ;
//----------------------------------------
// ****************************************************************************************************
//End of definitions for texture auditing use only
Expand Down
94 changes: 45 additions & 49 deletions indra/llrender/llshadermgr.cpp
Expand Up @@ -611,95 +611,90 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
if (minor_version <= 19)
{
text[count++] = strdup("#version 110\n");
text[count++] = strdup("#define ATTRIBUTE attribute\n");
text[count++] = strdup("#define VARYING varying\n");
text[count++] = strdup("#define VARYING_FLAT varying\n");
// Need to enable extensions here instead of in the shader files,
// before any non-preprocessor directives (per spec)
text[count++] = strdup("#extension GL_ARB_texture_rectangle : enable\n");
text[count++] = strdup("#extension GL_ARB_shader_texture_lod : enable\n");
}
else if (minor_version <= 29)
{
//set version to 1.20
text[count++] = strdup("#version 120\n");
text[count++] = strdup("#define FXAA_GLSL_120 1\n");
text[count++] = strdup("#define FXAA_FAST_PIXEL_OFFSET 0\n");
text[count++] = strdup("#define ATTRIBUTE attribute\n");
text[count++] = strdup("#define VARYING varying\n");
text[count++] = strdup("#define VARYING_FLAT varying\n");
// Need to enable extensions here instead of in the shader files,
// before any non-preprocessor directives (per spec)
text[count++] = strdup("#extension GL_ARB_texture_rectangle : enable\n");
text[count++] = strdup("#extension GL_ARB_shader_texture_lod : enable\n");
if (type == GL_FRAGMENT_SHADER_ARB)
{
// Need to enable extensions here instead of in the shader files,
// before any non-preprocessor directives (per spec)
text[count++] = strdup("#extension GL_ARB_shader_texture_lod : enable\n");
text[count++] = strdup("#define FXAA_GLSL_120 1\n");
text[count++] = strdup("#define FXAA_FAST_PIXEL_OFFSET 0\n");
}
}

text[count++] = strdup("#define ATTRIBUTE attribute\n");
text[count++] = strdup("#define VARYING varying\n");
text[count++] = strdup("#define VARYING_FLAT varying\n");
}
else
{
if (major_version < 4)
{
//set version to 1.30
text[count++] = strdup("#version 130\n");
// Need to enable extensions here instead of in the shader files,
// before any non-preprocessor directives (per spec)
text[count++] = strdup("#extension GL_ARB_texture_rectangle : enable\n");
text[count++] = strdup("#extension GL_ARB_shader_texture_lod : enable\n");
if (major_version > 1 || minor_version >= 40)
{
//set version to 1.40
text[count++] = strdup("#version 140\n");
}
else
{
//set version to 1.30
text[count++] = strdup("#version 130\n");
}
if (minor_version == 50 && gGLManager.mHasGpuShader5)
{
// Need to enable extensions here instead of in the shader files,
// before any non-preprocessor directives (per spec)
text[count++] = strdup("#extension GL_ARB_gpu_shader5 : enable\n");
}
//some implementations of GLSL 1.30 require integer precision be explicitly declared
text[count++] = strdup("precision mediump int;\n");
text[count++] = strdup("precision highp float;\n");
text[count++] = strdup("#define FXAA_GLSL_130 1\n");
if (type == GL_FRAGMENT_SHADER_ARB)
{
text[count++] = strdup("#define FXAA_GLSL_130 1\n");
}
}
else
{ //set version to 400
text[count++] = strdup("#version 400\n");
// Need to enable extensions here instead of in the shader files,
// before any non-preprocessor directives (per spec)
text[count++] = strdup("#extension GL_ARB_texture_rectangle : enable\n");
text[count++] = strdup("#extension GL_ARB_shader_texture_lod : enable\n");
text[count++] = strdup("#define FXAA_GLSL_400 1\n");
if (type == GL_FRAGMENT_SHADER_ARB)
{
text[count++] = strdup("#define FXAA_GLSL_400 1\n");
}
}


text[count++] = strdup("#define DEFINE_GL_FRAGCOLOR 1\n");

text[count++] = strdup("#define ATTRIBUTE in\n");

if (type == GL_VERTEX_SHADER_ARB)
{ //"varying" state is "out" in a vertex program, "in" in a fragment program
// ("varying" is deprecated after version 1.20)
text[count++] = strdup("#define ATTRIBUTE in\n");
text[count++] = strdup("#define VARYING out\n");
text[count++] = strdup("#define VARYING_FLAT flat out\n");
}
else
{
text[count++] = strdup("#define DEFINE_GL_FRAGCOLOR 1\n");
text[count++] = strdup("#define VARYING in\n");
text[count++] = strdup("#define VARYING_FLAT flat in\n");
}

//backwards compatibility with legacy texture lookup syntax
text[count++] = strdup("#define texture2D texture\n");
text[count++] = strdup("#define textureCube texture\n");
text[count++] = strdup("#define texture2DLod textureLod\n");
text[count++] = strdup("#define shadow2D(a,b) vec2(texture(a,b))\n");

if (major_version > 1 || minor_version >= 40)
{ //GLSL 1.40 replaces texture2DRect et al with texture
text[count++] = strdup("#define texture2DRect texture\n");
text[count++] = strdup("#define shadow2DRect(a,b) vec2(texture(a,b))\n");
//backwards compatibility with legacy texture lookup syntax
text[count++] = strdup("#define texture2D texture\n");
text[count++] = strdup("#define textureCube texture\n");
text[count++] = strdup("#define texture2DLod textureLod\n");
text[count++] = strdup("#define shadow2D(a,b) vec2(texture(a,b))\n");
}
}

if(defines)
{
for (std::map<std::string,std::string>::iterator iter = defines->begin(); iter != defines->end(); ++iter)
{
std::string define = "#define " + iter->first + " " + iter->second + "\n";
text[count++] = (GLcharARB *) strdup(define.c_str());
}
{
std::string define = "#define " + iter->first + " " + iter->second + "\n";
text[count++] = (GLcharARB *) strdup(define.c_str());
}
}

if (texture_index_channels > 0 && type == GL_FRAGMENT_SHADER_ARB)
Expand Down Expand Up @@ -796,7 +791,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
LL_ERRS() << "Indexed texture rendering requires GLSL 1.30 or later." << LL_ENDL;
}
}
else
else if( type == GL_FRAGMENT_SHADER_ARB )
{
text[count++] = strdup("#define HAS_DIFFUSE_LOOKUP 0\n");
}
Expand Down Expand Up @@ -1214,6 +1209,7 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("ssao_factor");
mReservedUniforms.push_back("ssao_factor_inv");
mReservedUniforms.push_back("ssao_effect");
mReservedUniforms.push_back("ssao_scale");
mReservedUniforms.push_back("kern_scale");
mReservedUniforms.push_back("noise_scale");
mReservedUniforms.push_back("near_clip");
Expand Down
2 changes: 2 additions & 0 deletions indra/llrender/llshadermgr.h
Expand Up @@ -123,6 +123,7 @@ class LLShaderMgr
DEFERRED_SSAO_FACTOR,
DEFERRED_SSAO_FACTOR_INV,
DEFERRED_SSAO_EFFECT,
DEFERRED_SSAO_SCALE,
DEFERRED_KERN_SCALE,
DEFERRED_NOISE_SCALE,
DEFERRED_NEAR_CLIP,
Expand Down Expand Up @@ -239,6 +240,7 @@ DISPLAY_GAMMA,

// Implemented in the application to actually update out of date uniforms for a particular shader
virtual void updateShaderUniforms(LLGLSLShader * shader) = 0; // Pure Virtual
virtual bool attachClassSharedShaders(LLGLSLShader& shader, S32 shader_class) = 0; // Pure Virtual

public:
struct CachedObjectInfo
Expand Down

0 comments on commit ce1b58d

Please sign in to comment.