Merge branch 'animesh' of git://github.com/Shyotl/SingularityViewer into animesh

This commit is contained in:
Lirusaito
2019-07-04 12:39:47 -04:00
12 changed files with 165 additions and 65 deletions

View File

@@ -100,10 +100,73 @@ void APIENTRY gl_debug_callback(GLenum source,
}
else
{
LL_WARNS() << "----- GL WARNING -------" << LL_ENDL;
if (severity == GL_DEBUG_SEVERITY_MEDIUM_ARB)
{
LL_WARNS() << "----- GL WARNING MEDIUM --------" << LL_ENDL;
}
else if (severity == GL_DEBUG_SEVERITY_LOW_ARB)
{
LL_WARNS() << "----- GL WARNING LOW --------" << LL_ENDL;
}
else if (severity == 0x826b && id == 0x20071 && type == GL_DEBUG_TYPE_OTHER_ARB && source == GL_DEBUG_SOURCE_API_ARB)
{
// Silence nvidia buffer detail info.
return;
}
}
LL_WARNS() << "Source: " << std::hex << source << std::dec << LL_ENDL;
LL_WARNS() << "Type: " << std::hex << type << std::dec << LL_ENDL;
std::string sourcestr = "Unknown";
switch (source)
{
case GL_DEBUG_SOURCE_API_ARB:
sourcestr = "OpenGL";
break;
case GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB:
sourcestr = "Window manager";
break;
case GL_DEBUG_SOURCE_SHADER_COMPILER_ARB:
sourcestr = "Shader compiler";
break;
case GL_DEBUG_SOURCE_THIRD_PARTY_ARB:
sourcestr = "3rd party";
break;
case GL_DEBUG_SOURCE_APPLICATION_ARB:
sourcestr = "Application";
break;
case GL_DEBUG_SOURCE_OTHER_ARB:
sourcestr = "Other";
break;
default:
break;
}
std::string typestr = "Unknown";
switch (type)
{
case GL_DEBUG_TYPE_ERROR_ARB:
typestr = "Error";
break;
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB:
typestr = "Deprecated behavior";
break;
case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB:
typestr = "Undefined behavior";
break;
case GL_DEBUG_TYPE_PORTABILITY_ARB:
typestr = "Portability";
break;
case GL_DEBUG_TYPE_PERFORMANCE_ARB:
typestr = "Performance";
break;
case GL_DEBUG_TYPE_OTHER_ARB:
typestr = "Other";
break;
default:
break;
}
LL_WARNS() << "Source: " << sourcestr << " (" << std::hex << source << std::dec << ")" << LL_ENDL;
LL_WARNS() << "Type: " << typestr << " (" << std::hex << type << std::dec << ")" << LL_ENDL;
LL_WARNS() << "ID: " << std::hex << id << std::dec<< LL_ENDL;
LL_WARNS() << "Severity: " << std::hex << severity << std::dec << LL_ENDL;
LL_WARNS() << "Message: " << message << LL_ENDL;

View File

@@ -443,7 +443,7 @@ LLDXDevice *LLDXHardware::findDevice(const std::string &vendor, const std::strin
}
*/
BOOL LLDXHardware::getInfo(BOOL vram_only)
BOOL LLDXHardware::getInfo(BOOL vram_only, S32Megabytes system_ram)
{
LLTimer hw_timer;
BOOL ok = FALSE;
@@ -543,6 +543,11 @@ BOOL LLDXHardware::getInfo(BOOL vram_only)
// Dump the string as an int into the structure
char *stopstring;
mVRAM = strtol(ram_str.c_str(), &stopstring, 10);
mVRAM -= ((S32)system_ram/2) + 1; // Ignore shared memory pool.
if (mVRAM <= 0)
{
mVRAM = (S32)system_ram / 2; // Integrated graphics perhaps? Use half system ram.
}
LL_INFOS("AppInit") << "VRAM Detected: " << mVRAM << " DX9 string: " << ram_str << LL_ENDL;
}

View File

@@ -92,7 +92,7 @@ public:
// Returns TRUE on success.
// vram_only TRUE does a "light" probe.
BOOL getInfo(BOOL vram_only);
BOOL getInfo(BOOL vram_only, S32Megabytes sytem_ram);
S32 getVRAM() const { return mVRAM; }

View File

@@ -1579,7 +1579,6 @@ if (WINDOWS)
add_custom_target(copy_w_viewer_manifest ALL DEPENDS ${CMAKE_CFG_INTDIR}/copy_touched.bat)
if(EXISTS ${VISUAL_STUDIO_REDISTRIBUTABLE_PATH})
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/redist
@@ -1598,10 +1597,12 @@ if (WINDOWS)
)
add_custom_target(copy_w_redist ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/redist/${VISUAL_STUDIO_REDISTRIBUTABLE_NAME})
add_dependencies(${VIEWER_BINARY_NAME} copy_w_redist)
endif()
add_dependencies(${VIEWER_BINARY_NAME} stage_third_party_libs llcommon copy_w_viewer_manifest copy_w_redist)
add_dependencies(${VIEWER_BINARY_NAME} stage_third_party_libs llcommon copy_w_viewer_manifest)
if (EXISTS ${CMAKE_SOURCE_DIR}/copy_win_scripts)
add_dependencies(${VIEWER_BINARY_NAME} copy_win_scripts)

View File

@@ -700,7 +700,7 @@ void main()
col.rgb += light.rgb;
glare = min(glare, 1.0) * diffcol.a;
glare = min(glare, 1.0)/* * diffcol.a*/;
float al = max(diffcol.a,glare)*vertex_color.a;
//convert to gamma space for display on screen

View File

@@ -3346,16 +3346,15 @@ bool LLAppViewer::initCache()
// Init the texture cache
// Allocate 80% of the cache size for textures
const U32 MB = 1024 * 1024;
const U64 MIN_CACHE_SIZE = 64 * MB;
const U64 MAX_CACHE_SIZE = 9984ll * MB;
const U64 MAX_VFS_SIZE = 1024 * MB; // 1 GB
const U64Bytes MIN_CACHE_SIZE = U32Megabytes(64);
const U64Bytes MAX_CACHE_SIZE = U32Megabytes(9984);
const U64Bytes MAX_VFS_SIZE = U32Gigabytes(1);
U64 cache_size = (U64)(gSavedSettings.getU32("CacheSize")) * MB;
U64Bytes cache_size = U32Megabytes(gSavedSettings.getU32("CacheSize"));
cache_size = llclamp(cache_size, MIN_CACHE_SIZE, MAX_CACHE_SIZE);
U64 texture_cache_size = ((cache_size * 8) / 10);
U64 vfs_size = cache_size - texture_cache_size;
U64Bytes texture_cache_size = ((cache_size * 8) / 10);
U64Bytes vfs_size = U64Bytes(cache_size) - U64Bytes(texture_cache_size);
if (vfs_size > MAX_VFS_SIZE)
{
@@ -3365,7 +3364,7 @@ bool LLAppViewer::initCache()
texture_cache_size = cache_size - MAX_VFS_SIZE;
}
U64 extra = LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, texture_cache_mismatch);
U64Bytes extra(LLAppViewer::getTextureCache()->initCache(LL_PATH_CACHE, texture_cache_size, texture_cache_mismatch));
texture_cache_size -= extra;
LLVOCache::getInstance()->initCache(LL_PATH_CACHE, gSavedSettings.getU32("CacheNumberOfRegionsForObjects"), getObjectCacheVersion()) ;
@@ -3374,15 +3373,14 @@ bool LLAppViewer::initCache()
// Init the VFS
vfs_size = llmin(vfs_size + extra, MAX_VFS_SIZE);
vfs_size = (vfs_size / MB) * MB; // make sure it is MB aligned
U32 vfs_size_u32 = (U32)vfs_size;
U32 old_vfs_size = gSavedSettings.getU32("VFSOldSize") * MB;
bool resize_vfs = (vfs_size_u32 != old_vfs_size);
vfs_size = U32Megabytes(vfs_size + U32Bytes(1048575)); // make sure it is MB aligned
U32Megabytes old_vfs_size(gSavedSettings.getU32("VFSOldSize"));
bool resize_vfs = (vfs_size != old_vfs_size);
if (resize_vfs)
{
gSavedSettings.setU32("VFSOldSize", vfs_size_u32 / MB);
gSavedSettings.setU32("VFSOldSize", U32Megabytes(vfs_size));
}
LL_INFOS("AppCache") << "VFS CACHE SIZE: " << vfs_size / (1024*1024) << " MB" << LL_ENDL;
LL_INFOS("AppCache") << "VFS CACHE SIZE: " << U32Megabytes(vfs_size) << LL_ENDL;
// This has to happen BEFORE starting the vfs
// time_t ltime;
@@ -3492,7 +3490,7 @@ bool LLAppViewer::initCache()
gSavedSettings.setU32("VFSSalt", new_salt);
// Don't remove VFS after viewer crashes. If user has corrupt data, they can reinstall. JC
gVFS = LLVFS::createLLVFS(new_vfs_index_file, new_vfs_data_file, false, vfs_size_u32, false);
gVFS = LLVFS::createLLVFS(new_vfs_index_file, new_vfs_data_file, false, U32Bytes(vfs_size), false);
if (!gVFS)
{
return false;

View File

@@ -527,7 +527,10 @@ bool LLAppViewerWin32::initHardwareTest()
LL_DEBUGS("AppInit") << "Attempting to poll DirectX for hardware info" << LL_ENDL;
gDXHardware.setWriteDebugFunc(write_debug_dx);
BOOL probe_ok = gDXHardware.getInfo(vram_only);
S32Megabytes system_ram = gSysMemory.getPhysicalMemoryKB();
BOOL probe_ok = gDXHardware.getInfo(vram_only, system_ram);
if (!probe_ok
&& gSavedSettings.getWarning("AboutDirectX9"))
@@ -572,6 +575,7 @@ bool LLAppViewerWin32::initHardwareTest()
if (gGLManager.mVRAM == 0)
{
gGLManager.mVRAM = gDXHardware.getVRAM();
LL_WARNS("AppInit") << "gGLManager.mVRAM: " << gGLManager.mVRAM << LL_ENDL;
}
LL_INFOS("AppInit") << "Detected VRAM: " << gGLManager.mVRAM << LL_ENDL;

View File

@@ -1619,7 +1619,7 @@ void LLModelPreview::rebuildUploadData()
{
LLQuaternion bind_rot = LLSkinningUtil::getUnscaledQuaternion(high_lod_model->mSkinInfo.mBindShapeMatrix);
LLQuaternion identity;
if (!bind_rot.isEqualEps(identity,0.01))
if (!bind_rot.isEqualEps(identity,0.01f))
{
LL_WARNS() << "non-identity bind shape rot. mat is " << high_lod_model->mSkinInfo.mBindShapeMatrix
<< " bind_rot " << bind_rot << LL_ENDL;

View File

@@ -5580,7 +5580,48 @@ void process_health_message(LLMessageSystem *mesgsys, void **user_data)
void process_sim_stats(LLMessageSystem *msg, void **user_data)
{
{
static LLHost sLastHost;
if (msg->getSender() != sLastHost)
{
sLastHost = msg->getSender();
LLViewerStats::getInstance()->mSimTimeDilation.reset();
LLViewerStats::getInstance()->mSimFPS.reset();
LLViewerStats::getInstance()->mSimPhysicsFPS.reset();
LLViewerStats::getInstance()->mSimAgentUPS.reset();
LLViewerStats::getInstance()->mSimFrameMsec.reset();
LLViewerStats::getInstance()->mSimNetMsec.reset();
LLViewerStats::getInstance()->mSimSimOtherMsec.reset();
LLViewerStats::getInstance()->mSimSimPhysicsMsec.reset();
LLViewerStats::getInstance()->mSimAgentMsec.reset();
LLViewerStats::getInstance()->mSimImagesMsec.reset();
LLViewerStats::getInstance()->mSimScriptMsec.reset();
LLViewerStats::getInstance()->mSimObjects.reset();
LLViewerStats::getInstance()->mSimActiveObjects.reset();
LLViewerStats::getInstance()->mSimMainAgents.reset();
LLViewerStats::getInstance()->mSimChildAgents.reset();
LLViewerStats::getInstance()->mSimActiveScripts.reset();
LLViewerStats::getInstance()->mSimScriptEPS.reset();
LLViewerStats::getInstance()->mSimInPPS.reset();
LLViewerStats::getInstance()->mSimOutPPS.reset();
LLViewerStats::getInstance()->mSimPendingDownloads.reset();
LLViewerStats::getInstance()->mSimPendingUploads.reset();
LLViewerStats::getInstance()->mSimPendingLocalUploads.reset();
LLViewerStats::getInstance()->mSimTotalUnackedBytes.reset();
LLViewerStats::getInstance()->mPhysicsPinnedTasks.reset();
LLViewerStats::getInstance()->mPhysicsLODTasks.reset();
LLViewerStats::getInstance()->mSimSimPhysicsStepMsec.reset();
LLViewerStats::getInstance()->mSimSimPhysicsShapeUpdateMsec.reset();
LLViewerStats::getInstance()->mSimSimPhysicsOtherMsec.reset();
LLViewerStats::getInstance()->mPhysicsMemoryAllocated.reset();
LLViewerStats::getInstance()->mSimSpareMsec.reset();
LLViewerStats::getInstance()->mSimSleepMsec.reset();
LLViewerStats::getInstance()->mSimPumpIOMsec.reset();
LLViewerStats::getInstance()->mSimPctScriptsRun.reset();
LLViewerStats::getInstance()->mSimSimAIStepMsec.reset();
LLViewerStats::getInstance()->mSimSimSkippedSilhouetteSteps.reset();
LLViewerStats::getInstance()->mSimSimPctSteppedCharacters.reset();
}
S32 count = msg->getNumberOfBlocks("Stat");
for (S32 i = 0; i < count; ++i)
{

View File

@@ -525,15 +525,15 @@ void LLViewerTexture::updateClass(const F32 velocity, const F32 angular_velocity
sBoundTextureMemory = LLImageGL::sBoundTextureMemory;
sTotalTextureMemory = LLImageGL::sGlobalTextureMemory;
sMaxBoundTextureMemory = S32Megabytes(gTextureList.getMaxResidentTexMem());
sMaxTotalTextureMem = S32Megabytes(gTextureList.getMaxTotalTextureMem());
sMaxBoundTextureMemory = gTextureList.getMaxResidentTexMem();
sMaxTotalTextureMem = gTextureList.getMaxTotalTextureMem();
sMaxDesiredTextureMem = sMaxTotalTextureMem; //in Bytes, by default and when total used texture memory is small.
if (sBoundTextureMemory >= sMaxBoundTextureMemory ||
sTotalTextureMemory >= sMaxTotalTextureMem)
{
//when texture memory overflows, lower down the threshold to release the textures more aggressively.
sMaxDesiredTextureMem = llmin(sMaxDesiredTextureMem * 0.75f, F32Bytes(gMaxVideoRam));
sMaxDesiredTextureMem = llmin(F64Bytes(sMaxDesiredTextureMem) * 0.75f, F64Bytes(gMaxVideoRam));
// If we are using more texture memory than we should,
// scale up the desired discard level

View File

@@ -1285,6 +1285,7 @@ LLPointer<LLImageJ2C> LLViewerTextureList::convertToUploadFile(LLPointer<LLImage
S32Megabytes LLViewerTextureList::getMinVideoRamSetting()
{
S32Megabytes system_ram = gSysMemory.getPhysicalMemoryKB();
LL_INFOS() << system_ram << LL_ENDL;
//min texture mem sets to 64M if total physical mem is more than 1.5GB
return (system_ram > S32Megabytes(1500)) ? S32Megabytes(64) : gMinVideoRam ;
}
@@ -1329,6 +1330,9 @@ S32Megabytes LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended, fl
}
S32Megabytes system_ram = gSysMemory.getPhysicalMemoryKB(); // In MB
LL_INFOS() << "get_recommended: " << get_recommended << LL_ENDL;
LL_INFOS() << "system_ram: " << system_ram << LL_ENDL;
LL_INFOS() << "max_texmem: " << max_texmem << LL_ENDL;
if (get_recommended)
max_texmem = llmin(max_texmem, system_ram/2);
else
@@ -1342,58 +1346,42 @@ S32Megabytes LLViewerTextureList::getMaxVideoRamSetting(bool get_recommended, fl
return max_texmem;
}
const S32Megabytes VIDEO_CARD_FRAMEBUFFER_MEM(12);
const S32Megabytes VIDEO_CARD_FRAMEBUFFER_MEM_MIN(12);
const S32Megabytes VIDEO_CARD_FRAMEBUFFER_MEM_MAX(512);
const S32Megabytes MIN_MEM_FOR_NON_TEXTURE(512);
void LLViewerTextureList::updateMaxResidentTexMem(S32Megabytes mem)
{
// Initialize the image pipeline VRAM settings
S32Megabytes cur_mem(gSavedSettings.getS32("TextureMemory"));
F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple");
S32Megabytes default_mem = getMaxVideoRamSetting(true, mem_multiplier); // recommended default
if (mem == (S32Bytes)0)
const S32Megabytes cur_mem(gSavedSettings.getS32("TextureMemory"));
const F32 mem_multiplier = gSavedSettings.getF32("RenderTextureMemoryMultiple");
const S32Megabytes default_mem = getMaxVideoRamSetting(true, mem_multiplier); // recommended default
const S32Megabytes max_mem = getMaxVideoRamSetting(false, mem_multiplier);
const S32Megabytes min_mem = getMinVideoRamSetting();
if (mem == 0)
{
mem = cur_mem > (S32Bytes)0 ? cur_mem : default_mem;
}
else if (mem < (S32Bytes)0)
else if (mem < 0)
{
mem = default_mem;
}
mem = llclamp(mem, getMinVideoRamSetting(), getMaxVideoRamSetting(false, mem_multiplier));
if (mem != cur_mem)
S32Megabytes reported_mem = llclamp(mem, min_mem, max_mem);
if (reported_mem != cur_mem)
{
gSavedSettings.setS32("TextureMemory", mem.value());
gSavedSettings.setS32("TextureMemory", reported_mem.value());
return; //listener will re-enter this function
}
// TODO: set available resident texture mem based on use by other subsystems
// currently max(12MB, VRAM/4) assumed...
S32Megabytes vb_mem = mem;
S32Megabytes fb_mem = llmax(VIDEO_CARD_FRAMEBUFFER_MEM, vb_mem/4);
mMaxResidentTexMemInMegaBytes = (vb_mem - fb_mem) ; //in MB
mMaxTotalTextureMemInMegaBytes = mMaxResidentTexMemInMegaBytes * 2;
if (mMaxResidentTexMemInMegaBytes > (S32Megabytes)640)
{
mMaxTotalTextureMemInMegaBytes -= (mMaxResidentTexMemInMegaBytes / 4);
}
S32Megabytes fb_mem = llmin(llmax(VIDEO_CARD_FRAMEBUFFER_MEM_MIN, mem / 4), VIDEO_CARD_FRAMEBUFFER_MEM_MAX); // 25% for framebuffers.
S32Megabytes misc_mem = llmax(MIN_MEM_FOR_NON_TEXTURE, mem / 5); // 20% for misc.
//system mem
S32Megabytes system_ram = gSysMemory.getPhysicalMemoryKB();
mMaxTotalTextureMemInMegaBytes = llmin(mem - misc_mem, max_mem);
mMaxResidentTexMemInMegaBytes = llmin(mem - misc_mem - fb_mem, max_mem);
//minimum memory reserved for non-texture use.
//if system_raw >= 1GB, reserve at least 512MB for non-texture use;
//otherwise reserve half of the system_ram for non-texture use.
S32Megabytes min_non_texture_mem = llmin(system_ram / 2, MIN_MEM_FOR_NON_TEXTURE) ;
if (mMaxTotalTextureMemInMegaBytes > system_ram - min_non_texture_mem)
{
mMaxTotalTextureMemInMegaBytes = system_ram - min_non_texture_mem ;
}
LL_INFOS() << "Total Video Memory set to: " << vb_mem << " MB" << LL_ENDL;
LL_INFOS() << "Available Texture Memory set to: " << (vb_mem - fb_mem) << " MB" << LL_ENDL;
LL_INFOS() << "Available Texture Memory set to: " << mMaxResidentTexMemInMegaBytes << LL_ENDL;
LL_INFOS() << "Total Texture Memory set to: " << mMaxTotalTextureMemInMegaBytes << LL_ENDL;
}
///////////////////////////////////////////////////////////////////////////////

View File

@@ -10,7 +10,7 @@
<check_box bottom_delta="-5" follows="top" left_delta="90" label="Textures" name="http_textures"/>
<check_box bottom_delta="0" follows="top" left_delta="90" label="Inventory" name="http_inventory"/>
<text bottom_delta="-20" follows="top" height="10" left="12" name="cache_size_label_l">Disk Cache Size:</text>
<slider bottom_delta="-4" left_delta="110" can_edit_text="true" decimal_digits="0" follows="top" height="15" increment="64" initial_val="1024" max_val="20480" min_val="64" name="cache_size" show_text="true" width="180"/>
<slider bottom_delta="-4" left_delta="110" can_edit_text="true" decimal_digits="0" follows="top" height="15" increment="64" initial_val="1024" max_val="9984" min_val="64" name="cache_size" show_text="true" width="180"/>
<text bottom_delta="4" follows="top" height="10" left_delta="186" name="text_box5">MB</text>
<button bottom_delta="-8" follows="top" height="22" label="Clear Cache" left_delta="30" name="clear_cache" scale_image="true" width="100"/>
<text bottom_delta="-17" follows="top" height="10" left="12" name="cache_location_label">Disk Cache Location:</text>