Collection of theoretical improvements for ATI cards, as well as a couple memory leaks. Thanks to Shyotl for bringing them up and offering solutions.

Signed-off-by: Beeks <HgDelirium@gmail.com>
This commit is contained in:
Beeks
2010-09-16 16:00:47 -04:00
parent d529819e12
commit 59d7c33954
12 changed files with 77 additions and 16 deletions

View File

@@ -873,6 +873,7 @@ void LLStringUtilBase<T>::addCRLF(std::basic_string<T>& string)
}
string.assign(t, size);
delete[] t;
}
}

View File

@@ -36,7 +36,7 @@
const S32 LL_VERSION_MAJOR = 1;
const S32 LL_VERSION_MINOR = 4;
const S32 LL_VERSION_PATCH = 2;
const S32 LL_VERSION_BUILD = 5;
const S32 LL_VERSION_BUILD = 6;
const char * const LL_CHANNEL = "Ascent Viewer Release";

View File

@@ -135,6 +135,7 @@ BOOL LLImagePNG::encode(const LLImageRaw* raw_image, F32 encode_time)
if (! pngWrapper.writePng(raw_image, mTmpWriteBuffer))
{
setLastError(pngWrapper.getErrorMessage());
delete[] mTmpWriteBuffer;
return FALSE;
}

View File

@@ -161,10 +161,9 @@ namespace
fstream.seekg(0, std::ios::end);
U32 fileSize = fstream.tellg();
fstream.seekg(0, std::ios::beg);
char* fileBuffer;
fileBuffer = new char [fileSize];
fstream.read(fileBuffer, fileSize);
ostream.write(fileBuffer, fileSize);
std::vector<char> fileBuffer(fileSize); //Mem leak fix'd
fstream.read(&fileBuffer[0], fileSize);
ostream.write(&fileBuffer[0], fileSize);
fstream.close();
eos = true;
return STATUS_DONE;
@@ -191,10 +190,9 @@ namespace
LLVFile vfile(gVFS, mUUID, mAssetType, LLVFile::READ);
S32 fileSize = vfile.getSize();
U8* fileBuffer;
fileBuffer = new U8 [fileSize];
vfile.read(fileBuffer, fileSize);
ostream.write((char*)fileBuffer, fileSize);
std::vector<U8> fileBuffer(fileSize);
vfile.read(&fileBuffer[0], fileSize);
ostream.write((char*)&fileBuffer[0], fileSize);
eos = true;
return STATUS_DONE;
}
@@ -341,6 +339,20 @@ void LLHTTPClient::get(const std::string& url, const LLSD& query, ResponderPtr r
get(uri.asString(), responder, headers, timeout);
}
class LLHTTPFileBuffer
{
public:
llofstream * stream;
LLHTTPFileBuffer(llofstream * fstream):stream(fstream){}
static size_t curl_write( void *ptr, size_t size, size_t nmemb, void *user_data)
{
LLHTTPFileBuffer* self = (LLHTTPFileBuffer*)user_data;
size_t bytes = (size * nmemb);
self->stream->write((char*)ptr,bytes);
return nmemb;
}
};
// A simple class for managing data returned from a curl http request.
class LLHTTPBuffer
{

View File

@@ -255,7 +255,7 @@ PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB = NULL;
PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB = NULL;
#if LL_WINDOWS
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL;
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = NULL;
#endif
#if LL_LINUX_NV_GL_HEADERS
@@ -748,11 +748,13 @@ void LLGLManager::initExtensions()
LL_INFOS("RenderInit") << "Disabling mip-map generation for Intel GPUs" << LL_ENDL;
mHasMipMapGeneration = FALSE;
}
//Don't do this! This has since been fixed. I've benchmarked it. Hardware generation considerably faster. -Shyotl
/*
if (mIsATI && mHasMipMapGeneration)
{
LL_INFOS("RenderInit") << "Disabling mip-map generation for ATI GPUs (performance opt)" << LL_ENDL;
mHasMipMapGeneration = FALSE;
}
}*/
// Misc
glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, (GLint*) &mGLMaxVertexRange);

View File

@@ -62,6 +62,7 @@ BOOL LLVertexBuffer::sVBOActive = FALSE;
BOOL LLVertexBuffer::sIBOActive = FALSE;
U32 LLVertexBuffer::sAllocatedBytes = 0;
BOOL LLVertexBuffer::sMapped = FALSE;
BOOL LLVertexBuffer::sUseStreamDraw = TRUE;
std::vector<U32> LLVertexBuffer::sDeleteList;
@@ -348,6 +349,11 @@ LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) :
mUsage = 0 ;
}
if (mUsage == GL_STREAM_DRAW_ARB && !sUseStreamDraw)
{
mUsage = 0;
}
S32 stride = calcStride(typemask, mOffsets);
mTypeMask = typemask;
@@ -771,7 +777,7 @@ BOOL LLVertexBuffer::useVBOs() const
return FALSE;
}
#endif
return sEnableVBOs;
return TRUE;
}
//----------------------------------------------------------------------------
@@ -1078,7 +1084,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
{
if (mGLBuffer)
{
if (sEnableVBOs && sVBOActive)
if (sVBOActive)
{
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
sBindCount++;
@@ -1090,7 +1096,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
setup = TRUE; // ... or a client memory pointer changed
}
}
if (sEnableVBOs && mGLIndices && sIBOActive)
if (mGLIndices && sIBOActive)
{
/*if (sMapped)
{

View File

@@ -85,6 +85,8 @@ public:
static LLVBOPool sStreamIBOPool;
static LLVBOPool sDynamicIBOPool;
static BOOL sUseStreamDraw;
static void initClass(bool use_vbo);
static void cleanupClass();
static void setupClientArrays(U32 data_mask);

View File

@@ -2,10 +2,21 @@
<llsd>
<map>
<!--Expanded settings from Vanilla SL -->
<key>ShyotlRenderUseStreamVBO</key>
<map>
<key>Comment</key>
<string>Use VBO's for stream buffers</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>AscentShowLookAt</key>
<map>
<key>Comment</key>
<string>Avatar position modifier (X)</string>
<string>Show Others' Lookat points</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>

View File

@@ -99,7 +99,17 @@ void LLFloaterHardwareSettings::refreshEnabledState()
!gGLManager.mHasVertexBufferObject)
{
childSetEnabled("vbo", FALSE);
//Streaming VBOs -Shyotl
childSetEnabled("vbo_stream", FALSE);
}
else
#if LL_DARWIN
childSetEnabled("vbo_stream", FALSE); //Hardcoded disable on mac
childSetValue("vbo_stream", (LLSD::Boolean) FALSE); //Hardcoded disable on mac
#else
childSetEnabled("vbo_stream", LLVertexBuffer::sEnableVBOs);
#endif
// if no windlight shaders, turn off nighttime brightness, gamma, and fog distance
childSetEnabled("gamma", !gPipeline.canUseWindLightShaders());

View File

@@ -526,6 +526,8 @@ void settings_setup_listeners()
gSavedSettings.getControl("RenderFastAlpha")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1));
gSavedSettings.getControl("RenderObjectBump")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1));
gSavedSettings.getControl("RenderMaxVBOSize")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1));
//See LL jira VWR-3258 comment section. Implemented by LL in 2.1 -Shyotl
gSavedSettings.getControl("ShyotlRenderUseStreamVBO")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _1));
gSavedSettings.getControl("RenderUseFBO")->getSignal()->connect(boost::bind(&handleRenderUseFBOChanged, _1));
gSavedSettings.getControl("RenderDeferredNoise")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _1));
gSavedSettings.getControl("RenderUseImpostors")->getSignal()->connect(boost::bind(&handleRenderUseImpostorsChanged, _1));

View File

@@ -102,6 +102,10 @@
#include "llspatialpartition.h"
#include "llmutelist.h"
#if !LL_DARWIN
#include "llfloaterhardwaresettings.h"
#endif
#ifdef _DEBUG
// Debug indices is disabled for now for debug performance - djs 4/24/02
//#define DEBUG_INDICES
@@ -321,6 +325,7 @@ void LLPipeline::init()
sDynamicLOD = gSavedSettings.getBOOL("RenderDynamicLOD");
sRenderBump = gSavedSettings.getBOOL("RenderObjectBump");
LLVertexBuffer::sUseStreamDraw = gSavedSettings.getBOOL("ShyotlRenderUseStreamVBO");
sRenderAttachedLights = gSavedSettings.getBOOL("RenderAttachedLights");
sRenderAttachedParticles = gSavedSettings.getBOOL("RenderAttachedParticles");
@@ -4911,6 +4916,10 @@ void LLPipeline::setUseVBO(BOOL use_vbo)
resetVertexBuffers();
LLVertexBuffer::initClass(use_vbo);
#if !LL_DARWIN
if(LLFloaterHardwareSettings::isOpen())
LLFloaterHardwareSettings::instance()->refreshEnabledState();
#endif
}
}

View File

@@ -63,7 +63,12 @@
mouse_opaque="true" name="vbo" radio_style="false"
tool_tip="Enabling this on modern hardware gives a performance gain. However, older hardware often has poor implementations of VBOs and you may get crashes when this is enabled."
width="315" />
<check_box bottom_delta="-18" control_name="ShyotlRenderUseStreamVBO" enabled="true" follows="left|top"
font="SansSerifSmall" height="16" initial_value="false"
label="Enable Streamed VBOs" left="157"
mouse_opaque="true" name="vbo_stream" radio_style="false"
tool_tip="Disabling this may improve performance when VBOs are enabled. Disabling produced observable improvement on various AMD GPUs."
width="315" />
<slider bottom_delta="-21" can_edit_text="false" control_name="TextureMemory"
decimal_digits="0" enabled="true"
follows="left|top" height="16" increment="16"