Merge branch 'master' of git://github.com/Shyotl/SingularityViewer
Conflicts: indra/llaudio/llaudioengine_fmodex.cpp
This commit is contained in:
@@ -95,6 +95,28 @@ inline bool Check_FMOD_Error(FMOD_RESULT result, const char *string)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void* F_STDCALL decode_alloc(unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr)
|
||||||
|
{
|
||||||
|
if(type & FMOD_MEMORY_STREAM_DECODE)
|
||||||
|
{
|
||||||
|
llinfos << "Decode buffer size: " << size << llendl;
|
||||||
|
}
|
||||||
|
else if(type & FMOD_MEMORY_STREAM_FILE)
|
||||||
|
{
|
||||||
|
llinfos << "Strean buffer size: " << size << llendl;
|
||||||
|
}
|
||||||
|
return new char[size];
|
||||||
|
}
|
||||||
|
void* F_STDCALL decode_realloc(void *ptr, unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr)
|
||||||
|
{
|
||||||
|
memset(ptr,0,size);
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
void F_STDCALL decode_dealloc(void *ptr, FMOD_MEMORY_TYPE type, const char *sourcestr)
|
||||||
|
{
|
||||||
|
delete[] (char*)ptr;
|
||||||
|
}
|
||||||
|
|
||||||
bool LLAudioEngine_FMODEX::init(const S32 num_channels, void* userdata)
|
bool LLAudioEngine_FMODEX::init(const S32 num_channels, void* userdata)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -108,6 +130,10 @@ bool LLAudioEngine_FMODEX::init(const S32 num_channels, void* userdata)
|
|||||||
|
|
||||||
LL_DEBUGS("AppInit") << "LLAudioEngine_FMODEX::init() initializing FMOD" << LL_ENDL;
|
LL_DEBUGS("AppInit") << "LLAudioEngine_FMODEX::init() initializing FMOD" << LL_ENDL;
|
||||||
|
|
||||||
|
result = FMOD::Memory_Initialize(NULL, 0, &decode_alloc, &decode_realloc, &decode_dealloc, FMOD_MEMORY_STREAM_DECODE | FMOD_MEMORY_STREAM_FILE);
|
||||||
|
if(Check_FMOD_Error(result, "FMOD::Memory_Initialize"))
|
||||||
|
return false;
|
||||||
|
|
||||||
result = FMOD::System_Create(&mSystem);
|
result = FMOD::System_Create(&mSystem);
|
||||||
if(Check_FMOD_Error(result, "FMOD::System_Create"))
|
if(Check_FMOD_Error(result, "FMOD::System_Create"))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ class LLStreamingAudioInterface
|
|||||||
virtual const LLSD *getMetaData() = 0;
|
virtual const LLSD *getMetaData() = 0;
|
||||||
virtual bool supportsWaveData() = 0;
|
virtual bool supportsWaveData() = 0;
|
||||||
virtual bool getWaveData(float* arr, S32 count, S32 stride = 1) = 0;
|
virtual bool getWaveData(float* arr, S32 count, S32 stride = 1) = 0;
|
||||||
|
|
||||||
|
virtual bool supportsAdjustableBufferSizes(){return false;}
|
||||||
|
virtual void setBufferSizes(U32 streambuffertime, U32 decodebuffertime){};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LL_STREAMINGAUDIO_H
|
#endif // LL_STREAMINGAUDIO_H
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
|
|
||||||
const std::string& getURL() { return mInternetStreamURL; }
|
const std::string& getURL() { return mInternetStreamURL; }
|
||||||
|
|
||||||
FMOD_OPENSTATE getOpenState();
|
FMOD_OPENSTATE getOpenState(unsigned int* percentbuffered=NULL, bool* starving=NULL, bool* diskbusy=NULL);
|
||||||
protected:
|
protected:
|
||||||
FMOD::System* mSystem;
|
FMOD::System* mSystem;
|
||||||
FMOD::Channel* mStreamChannel;
|
FMOD::Channel* mStreamChannel;
|
||||||
@@ -70,11 +70,13 @@ LLStreamingAudio_FMODEX::LLStreamingAudio_FMODEX(FMOD::System *system) :
|
|||||||
mCurrentInternetStreamp(NULL),
|
mCurrentInternetStreamp(NULL),
|
||||||
mFMODInternetStreamChannelp(NULL),
|
mFMODInternetStreamChannelp(NULL),
|
||||||
mGain(1.0f),
|
mGain(1.0f),
|
||||||
mMetaData(NULL)
|
mMetaData(NULL),
|
||||||
|
mStarvedProgress(0),
|
||||||
|
mStarvedNoProgressFrames(0)
|
||||||
{
|
{
|
||||||
// Number of milliseconds of audio to buffer for the audio card.
|
// Number of milliseconds of audio to buffer for the audio card.
|
||||||
// Must be larger than the usual Second Life frame stutter time.
|
// Must be larger than the usual Second Life frame stutter time.
|
||||||
const U32 buffer_seconds = 5; //sec
|
const U32 buffer_seconds = 10; //sec
|
||||||
const U32 estimated_bitrate = 128; //kbit/sec
|
const U32 estimated_bitrate = 128; //kbit/sec
|
||||||
mSystem->setStreamBufferSize(estimated_bitrate * buffer_seconds * 128/*bytes/kbit*/, FMOD_TIMEUNIT_RAWBYTES);
|
mSystem->setStreamBufferSize(estimated_bitrate * buffer_seconds * 128/*bytes/kbit*/, FMOD_TIMEUNIT_RAWBYTES);
|
||||||
|
|
||||||
@@ -145,7 +147,10 @@ void LLStreamingAudio_FMODEX::update()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FMOD_OPENSTATE open_state = mCurrentInternetStreamp->getOpenState();
|
unsigned int progress;
|
||||||
|
bool starving;
|
||||||
|
bool diskbusy;
|
||||||
|
FMOD_OPENSTATE open_state = mCurrentInternetStreamp->getOpenState(&progress, &starving, &diskbusy);
|
||||||
|
|
||||||
if (open_state == FMOD_OPENSTATE_READY)
|
if (open_state == FMOD_OPENSTATE_READY)
|
||||||
{
|
{
|
||||||
@@ -158,6 +163,7 @@ void LLStreamingAudio_FMODEX::update()
|
|||||||
// Reset volume to previously set volume
|
// Reset volume to previously set volume
|
||||||
setGain(getGain());
|
setGain(getGain());
|
||||||
mFMODInternetStreamChannelp->setPaused(false);
|
mFMODInternetStreamChannelp->setPaused(false);
|
||||||
|
mLastStarved.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(open_state == FMOD_OPENSTATE_ERROR)
|
else if(open_state == FMOD_OPENSTATE_ERROR)
|
||||||
@@ -168,6 +174,7 @@ void LLStreamingAudio_FMODEX::update()
|
|||||||
|
|
||||||
if(mFMODInternetStreamChannelp)
|
if(mFMODInternetStreamChannelp)
|
||||||
{
|
{
|
||||||
|
llinfos << "progress = " << progress << llendl;
|
||||||
if(!mMetaData)
|
if(!mMetaData)
|
||||||
mMetaData = new LLSD;
|
mMetaData = new LLSD;
|
||||||
|
|
||||||
@@ -237,12 +244,46 @@ void LLStreamingAudio_FMODEX::update()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(starving)
|
||||||
|
{
|
||||||
|
if(!mLastStarved.getStarted())
|
||||||
|
{
|
||||||
|
llinfos << "Stream starvation detected! Muting stream audio until it clears." << llendl;
|
||||||
|
llinfos << " (diskbusy="<<diskbusy<<")" << llendl;
|
||||||
|
llinfos << " (progress="<<progress<<")" << llendl;
|
||||||
|
mFMODInternetStreamChannelp->setMute(true);
|
||||||
|
mStarvedProgress = progress;
|
||||||
|
mStarvedNoProgressFrames = 0;
|
||||||
|
}
|
||||||
|
else if(mStarvedProgress == progress)
|
||||||
|
{
|
||||||
|
if(++mStarvedNoProgressFrames >= 10)
|
||||||
|
{
|
||||||
|
//we got 10 consecutive updates of 0 progress made on the stream buffer. It probably stalled.
|
||||||
|
llinfos << "Stream unable to recover from starvation. Halting." << llendl;
|
||||||
|
stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mStarvedNoProgressFrames = 0;
|
||||||
|
mStarvedProgress = progress;
|
||||||
|
}
|
||||||
|
mLastStarved.start();
|
||||||
|
}
|
||||||
|
else if(mLastStarved.getStarted() && mLastStarved.getElapsedTimeF32() > 5.f)
|
||||||
|
{
|
||||||
|
mLastStarved.stop();
|
||||||
|
mFMODInternetStreamChannelp->setMute(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLStreamingAudio_FMODEX::stop()
|
void LLStreamingAudio_FMODEX::stop()
|
||||||
{
|
{
|
||||||
|
mLastStarved.stop();
|
||||||
if(mMetaData)
|
if(mMetaData)
|
||||||
{
|
{
|
||||||
delete mMetaData;
|
delete mMetaData;
|
||||||
@@ -341,6 +382,11 @@ void LLStreamingAudio_FMODEX::setGain(F32 vol)
|
|||||||
if(!mFMODInternetStreamChannelp || !mCurrentInternetStreamp)
|
if(!mFMODInternetStreamChannelp || !mCurrentInternetStreamp)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
bool muted=false;
|
||||||
|
mFMODInternetStreamChannelp->getMute(&muted);
|
||||||
|
if(muted)
|
||||||
|
return false;
|
||||||
|
|
||||||
static std::vector<float> local_array(count); //Have to have an extra buffer to mix channels. Bleh.
|
static std::vector<float> local_array(count); //Have to have an extra buffer to mix channels. Bleh.
|
||||||
if(count > (S32)local_array.size()) //Expand the array if needed. Try to minimize allocation calls, so don't ever shrink.
|
if(count > (S32)local_array.size()) //Expand the array if needed. Try to minimize allocation calls, so don't ever shrink.
|
||||||
local_array.resize(count);
|
local_array.resize(count);
|
||||||
@@ -442,9 +488,19 @@ bool LLAudioStreamManagerFMODEX::stopStream()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FMOD_OPENSTATE LLAudioStreamManagerFMODEX::getOpenState()
|
FMOD_OPENSTATE LLAudioStreamManagerFMODEX::getOpenState(unsigned int* percentbuffered, bool* starving, bool* diskbusy)
|
||||||
{
|
{
|
||||||
FMOD_OPENSTATE state;
|
FMOD_OPENSTATE state;
|
||||||
mInternetStream->getOpenState(&state,NULL,NULL,NULL);
|
mInternetStream->getOpenState(&state,percentbuffered,starving,diskbusy);
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLStreamingAudio_FMODEX::setBufferSizes(U32 streambuffertime, U32 decodebuffertime)
|
||||||
|
{
|
||||||
|
mSystem->setStreamBufferSize(streambuffertime/1000*128*128, FMOD_TIMEUNIT_RAWBYTES);
|
||||||
|
FMOD_ADVANCEDSETTINGS settings;
|
||||||
|
memset(&settings,0,sizeof(settings));
|
||||||
|
settings.cbsize=sizeof(settings);
|
||||||
|
settings.defaultDecodeBufferSize = decodebuffertime;//ms
|
||||||
|
mSystem->setAdvancedSettings(&settings);
|
||||||
|
}
|
||||||
@@ -37,6 +37,7 @@
|
|||||||
#include "stdtypes.h" // from llcommon
|
#include "stdtypes.h" // from llcommon
|
||||||
|
|
||||||
#include "llstreamingaudio.h"
|
#include "llstreamingaudio.h"
|
||||||
|
#include "lltimer.h"
|
||||||
|
|
||||||
//Stubs
|
//Stubs
|
||||||
class LLAudioStreamManagerFMODEX;
|
class LLAudioStreamManagerFMODEX;
|
||||||
@@ -66,6 +67,8 @@ class LLStreamingAudio_FMODEX : public LLStreamingAudioInterface
|
|||||||
/*virtual*/ const LLSD *getMetaData(){return mMetaData;} //return NULL if not playing.
|
/*virtual*/ const LLSD *getMetaData(){return mMetaData;} //return NULL if not playing.
|
||||||
/*virtual*/ bool supportsWaveData(){return true;}
|
/*virtual*/ bool supportsWaveData(){return true;}
|
||||||
/*virtual*/ bool getWaveData(float* arr, S32 count, S32 stride = 1);
|
/*virtual*/ bool getWaveData(float* arr, S32 count, S32 stride = 1);
|
||||||
|
/*virtual*/ bool supportsAdjustableBufferSizes(){return true;}
|
||||||
|
/*virtual*/ void setBufferSizes(U32 streambuffertime, U32 decodebuffertime);
|
||||||
private:
|
private:
|
||||||
FMOD::System *mSystem;
|
FMOD::System *mSystem;
|
||||||
|
|
||||||
@@ -76,6 +79,10 @@ private:
|
|||||||
std::string mURL;
|
std::string mURL;
|
||||||
F32 mGain;
|
F32 mGain;
|
||||||
|
|
||||||
|
LLTimer mLastStarved;
|
||||||
|
unsigned int mStarvedProgress;
|
||||||
|
unsigned int mStarvedNoProgressFrames;
|
||||||
|
|
||||||
LLSD *mMetaData;
|
LLSD *mMetaData;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -435,11 +435,7 @@ LLGLManager::LLGLManager() :
|
|||||||
mHasPointParameters(FALSE),
|
mHasPointParameters(FALSE),
|
||||||
mHasDrawBuffers(FALSE),
|
mHasDrawBuffers(FALSE),
|
||||||
mHasTextureRectangle(FALSE),
|
mHasTextureRectangle(FALSE),
|
||||||
mHasTextureMultisample(FALSE),
|
|
||||||
mHasTransformFeedback(FALSE),
|
mHasTransformFeedback(FALSE),
|
||||||
mMaxSampleMaskWords(0),
|
|
||||||
mMaxColorTextureSamples(0),
|
|
||||||
mMaxDepthTextureSamples(0),
|
|
||||||
mMaxIntegerSamples(0),
|
mMaxIntegerSamples(0),
|
||||||
|
|
||||||
mHasAnisotropic(FALSE),
|
mHasAnisotropic(FALSE),
|
||||||
@@ -732,12 +728,10 @@ bool LLGLManager::initGL()
|
|||||||
|
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
|
|
||||||
if (mHasTextureMultisample)
|
if (mHasFramebufferMultisample)
|
||||||
{
|
{
|
||||||
glGetIntegerv(GL_MAX_COLOR_TEXTURE_SAMPLES, &mMaxColorTextureSamples);
|
|
||||||
glGetIntegerv(GL_MAX_DEPTH_TEXTURE_SAMPLES, &mMaxDepthTextureSamples);
|
|
||||||
glGetIntegerv(GL_MAX_INTEGER_SAMPLES, &mMaxIntegerSamples);
|
glGetIntegerv(GL_MAX_INTEGER_SAMPLES, &mMaxIntegerSamples);
|
||||||
glGetIntegerv(GL_MAX_SAMPLE_MASK_WORDS, &mMaxSampleMaskWords);
|
glGetIntegerv(GL_MAX_SAMPLES, &mMaxSamples);
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
@@ -749,24 +743,12 @@ bool LLGLManager::initGL()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
mHasTextureMultisample = FALSE;
|
|
||||||
#if LL_WINDOWS
|
|
||||||
if (mIsATI)
|
|
||||||
{ //using multisample textures on ATI results in black screen for some reason
|
|
||||||
mHasTextureMultisample = FALSE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (mIsIntel && mGLVersion <= 3.f)
|
if (mIsIntel && mGLVersion <= 3.f)
|
||||||
{ //never try to use framebuffer objects on older intel drivers (crashy)
|
{ //never try to use framebuffer objects on older intel drivers (crashy)
|
||||||
mHasFramebufferObject = FALSE;
|
mHasFramebufferObject = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mHasFramebufferObject)
|
|
||||||
{
|
|
||||||
glGetIntegerv(GL_MAX_SAMPLES, &mMaxSamples);
|
|
||||||
}
|
|
||||||
|
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
|
|
||||||
setToDebugGPU();
|
setToDebugGPU();
|
||||||
@@ -847,14 +829,6 @@ std::string LLGLManager::getRawGLString()
|
|||||||
return gl_string;
|
return gl_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
U32 LLGLManager::getNumFBOFSAASamples(U32 samples)
|
|
||||||
{
|
|
||||||
samples = llmin(samples, (U32) mMaxColorTextureSamples);
|
|
||||||
samples = llmin(samples, (U32) mMaxDepthTextureSamples);
|
|
||||||
samples = llmin(samples, (U32) 4);
|
|
||||||
return samples;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLGLManager::shutdownGL()
|
void LLGLManager::shutdownGL()
|
||||||
{
|
{
|
||||||
if (mInited)
|
if (mInited)
|
||||||
@@ -960,7 +934,6 @@ void LLGLManager::initExtensions()
|
|||||||
mHasDrawBuffers = ExtensionExists("GL_ARB_draw_buffers", gGLHExts.mSysExts);
|
mHasDrawBuffers = ExtensionExists("GL_ARB_draw_buffers", gGLHExts.mSysExts);
|
||||||
mHasBlendFuncSeparate = ExtensionExists("GL_EXT_blend_func_separate", gGLHExts.mSysExts);
|
mHasBlendFuncSeparate = ExtensionExists("GL_EXT_blend_func_separate", gGLHExts.mSysExts);
|
||||||
mHasTextureRectangle = ExtensionExists("GL_ARB_texture_rectangle", gGLHExts.mSysExts);
|
mHasTextureRectangle = ExtensionExists("GL_ARB_texture_rectangle", gGLHExts.mSysExts);
|
||||||
mHasTextureMultisample = ExtensionExists("GL_ARB_texture_multisample", gGLHExts.mSysExts);
|
|
||||||
mHasDebugOutput = ExtensionExists("GL_ARB_debug_output", gGLHExts.mSysExts);
|
mHasDebugOutput = ExtensionExists("GL_ARB_debug_output", gGLHExts.mSysExts);
|
||||||
mHasTransformFeedback = mGLVersion >= 4.f ? TRUE : FALSE;
|
mHasTransformFeedback = mGLVersion >= 4.f ? TRUE : FALSE;
|
||||||
#if !LL_DARWIN
|
#if !LL_DARWIN
|
||||||
@@ -1198,13 +1171,6 @@ void LLGLManager::initExtensions()
|
|||||||
{
|
{
|
||||||
glBlendFuncSeparateEXT = (PFNGLBLENDFUNCSEPARATEEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glBlendFuncSeparateEXT");
|
glBlendFuncSeparateEXT = (PFNGLBLENDFUNCSEPARATEEXTPROC) GLH_EXT_GET_PROC_ADDRESS("glBlendFuncSeparateEXT");
|
||||||
}
|
}
|
||||||
if (mHasTextureMultisample)
|
|
||||||
{
|
|
||||||
glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC) GLH_EXT_GET_PROC_ADDRESS("glTexImage2DMultisample");
|
|
||||||
glTexImage3DMultisample = (PFNGLTEXIMAGE3DMULTISAMPLEPROC) GLH_EXT_GET_PROC_ADDRESS("glTexImage3DMultisample");
|
|
||||||
glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC) GLH_EXT_GET_PROC_ADDRESS("glGetMultisamplefv");
|
|
||||||
glSampleMaski = (PFNGLSAMPLEMASKIPROC) GLH_EXT_GET_PROC_ADDRESS("glSampleMaski");
|
|
||||||
}
|
|
||||||
if (mHasTransformFeedback)
|
if (mHasTransformFeedback)
|
||||||
{
|
{
|
||||||
glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC) GLH_EXT_GET_PROC_ADDRESS("glBeginTransformFeedback");
|
glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC) GLH_EXT_GET_PROC_ADDRESS("glBeginTransformFeedback");
|
||||||
|
|||||||
@@ -104,11 +104,7 @@ public:
|
|||||||
BOOL mHasDrawBuffers;
|
BOOL mHasDrawBuffers;
|
||||||
BOOL mHasDepthClamp;
|
BOOL mHasDepthClamp;
|
||||||
BOOL mHasTextureRectangle;
|
BOOL mHasTextureRectangle;
|
||||||
BOOL mHasTextureMultisample;
|
|
||||||
BOOL mHasTransformFeedback;
|
BOOL mHasTransformFeedback;
|
||||||
S32 mMaxSampleMaskWords;
|
|
||||||
S32 mMaxColorTextureSamples;
|
|
||||||
S32 mMaxDepthTextureSamples;
|
|
||||||
S32 mMaxIntegerSamples;
|
S32 mMaxIntegerSamples;
|
||||||
|
|
||||||
// Other extensions.
|
// Other extensions.
|
||||||
@@ -155,7 +151,6 @@ public:
|
|||||||
void printGLInfoString();
|
void printGLInfoString();
|
||||||
void getGLInfo(LLSD& info);
|
void getGLInfo(LLSD& info);
|
||||||
|
|
||||||
U32 getNumFBOFSAASamples(U32 desired_samples = 32);
|
|
||||||
// In ALL CAPS
|
// In ALL CAPS
|
||||||
std::string mGLVendor;
|
std::string mGLVendor;
|
||||||
std::string mGLVendorShort;
|
std::string mGLVendorShort;
|
||||||
|
|||||||
@@ -330,7 +330,6 @@ S32 LLImageGL::updateBoundTexMem(const S32 mem, const S32 ncomponents, S32 categ
|
|||||||
//static
|
//static
|
||||||
void LLImageGL::destroyGL(BOOL save_state)
|
void LLImageGL::destroyGL(BOOL save_state)
|
||||||
{
|
{
|
||||||
deleteDeadTextures(); //Dump unimportant textures.
|
|
||||||
for (S32 stage = 0; stage < gGLManager.mNumTextureUnits; stage++)
|
for (S32 stage = 0; stage < gGLManager.mNumTextureUnits; stage++)
|
||||||
{
|
{
|
||||||
gGL.getTexUnit(stage)->unbind(LLTexUnit::TT_TEXTURE);
|
gGL.getTexUnit(stage)->unbind(LLTexUnit::TT_TEXTURE);
|
||||||
@@ -364,7 +363,6 @@ void LLImageGL::destroyGL(BOOL save_state)
|
|||||||
}
|
}
|
||||||
llinfos << "Storing " << stored_count << " images..." << llendl;
|
llinfos << "Storing " << stored_count << " images..." << llendl;
|
||||||
sAllowReadBackRaw = false ;
|
sAllowReadBackRaw = false ;
|
||||||
deleteDeadTextures();//Now, actually call glDeleteTextures for everything.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
//static
|
||||||
@@ -1528,7 +1526,7 @@ void LLImageGL::deleteDeadTextures()
|
|||||||
{
|
{
|
||||||
bool reset = false;
|
bool reset = false;
|
||||||
|
|
||||||
for(U32 i=0;i<LLTexUnit::TT_NONE;++i)
|
/*for(U32 i=0;i<LLTexUnit::TT_NONE;++i)
|
||||||
{
|
{
|
||||||
for(dead_texturelist_t::iterator it=sDeadTextureList[i].begin();it!=sDeadTextureList[i].end();++it)
|
for(dead_texturelist_t::iterator it=sDeadTextureList[i].begin();it!=sDeadTextureList[i].end();++it)
|
||||||
{
|
{
|
||||||
@@ -1554,7 +1552,7 @@ void LLImageGL::deleteDeadTextures()
|
|||||||
stop_glerror();
|
stop_glerror();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if (reset)
|
if (reset)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -699,6 +699,28 @@ bool LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth
|
|||||||
release();
|
release();
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
|
|
||||||
|
if (!gGLManager.mHasFramebufferMultisample || !gGLManager.mHasFramebufferObject || !(sUseFBO || use_fbo))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(color_fmt != GL_RGBA)
|
||||||
|
{
|
||||||
|
llwarns << "Unsupported color format: " << color_fmt << llendl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Restrict to valid sample count
|
||||||
|
{
|
||||||
|
mSamples = samples;
|
||||||
|
mSamples = llmin(mSamples, (U32)4); //Cap to prevent memory bloat.
|
||||||
|
mSamples = llmin(mSamples, (U32) gGLManager.mMaxIntegerSamples);//GL_RGBA
|
||||||
|
|
||||||
|
if(depth && !stencil)
|
||||||
|
mSamples = llmin(mSamples, (U32) gGLManager.mMaxSamples); //GL_DEPTH_COMPONENT16_ARB
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mSamples <= 1)
|
||||||
|
return false;
|
||||||
|
|
||||||
mResX = resx;
|
mResX = resx;
|
||||||
mResY = resy;
|
mResY = resy;
|
||||||
|
|
||||||
@@ -706,30 +728,16 @@ bool LLMultisampleBuffer::allocate(U32 resx, U32 resy, U32 color_fmt, bool depth
|
|||||||
mUseDepth = depth;
|
mUseDepth = depth;
|
||||||
mStencil = stencil;
|
mStencil = stencil;
|
||||||
|
|
||||||
if (!gGLManager.mHasFramebufferMultisample)
|
|
||||||
{
|
|
||||||
llerrs << "Attempting to allocate unsupported render target type!" << llendl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
mSamples = gGLManager.getNumFBOFSAASamples(samples);
|
|
||||||
|
|
||||||
if (mSamples <= 1)
|
|
||||||
{
|
|
||||||
llerrs << "Cannot create a multisample buffer with less than 2 samples." << llendl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
stop_glerror();
|
|
||||||
|
|
||||||
if ((sUseFBO || use_fbo) && gGLManager.mHasFramebufferObject)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (depth)
|
if (depth)
|
||||||
{
|
{
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
if(!allocateDepth())
|
if(!allocateDepth())
|
||||||
|
{
|
||||||
|
release();
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
stop_glerror();
|
stop_glerror();
|
||||||
}
|
}
|
||||||
glGenFramebuffers(1, (GLuint *) &mFBO);
|
glGenFramebuffers(1, (GLuint *) &mFBO);
|
||||||
@@ -779,6 +787,7 @@ bool LLMultisampleBuffer::addColorAttachment(U32 color_fmt)
|
|||||||
if (glGetError() != GL_NO_ERROR)
|
if (glGetError() != GL_NO_ERROR)
|
||||||
{
|
{
|
||||||
llwarns << "Unable to allocate color buffer for multisample render target." << llendl;
|
llwarns << "Unable to allocate color buffer for multisample render target." << llendl;
|
||||||
|
release();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,28 @@
|
|||||||
<string>Boolean</string>
|
<string>Boolean</string>
|
||||||
<key>Value</key>
|
<key>Value</key>
|
||||||
<integer>0</integer>
|
<integer>0</integer>
|
||||||
|
</map>
|
||||||
|
<key>SHFMODExStreamBufferSize</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Sets the streaming buffer size (in milliseconds)</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>U32</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<integer>7000</integer>
|
||||||
|
</map>
|
||||||
|
<key>SHFMODExDecodeBufferSize</key>
|
||||||
|
<map>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Sets the streaming decode buffer size (in milliseconds)</string>
|
||||||
|
<key>Persist</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Type</key>
|
||||||
|
<string>U32</string>
|
||||||
|
<key>Value</key>
|
||||||
|
<integer>1000</integer>
|
||||||
</map>
|
</map>
|
||||||
<key>SHAllowScriptCommands</key>
|
<key>SHAllowScriptCommands</key>
|
||||||
<map>
|
<map>
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
#include "llaudioengine.h"
|
#include "llaudioengine.h"
|
||||||
#include "lloverlaybar.h"
|
#include "lloverlaybar.h"
|
||||||
#include "slfloatermediafilter.h"
|
#include "slfloatermediafilter.h"
|
||||||
|
#include "llstreamingaudio.h"
|
||||||
|
|
||||||
// Static Variables
|
// Static Variables
|
||||||
|
|
||||||
@@ -661,6 +662,9 @@ void LLViewerParcelMedia::playStreamingMusic(LLParcel* parcel, bool filter)
|
|||||||
else if (gAudiop)
|
else if (gAudiop)
|
||||||
{
|
{
|
||||||
LLStringUtil::trim(music_url);
|
LLStringUtil::trim(music_url);
|
||||||
|
LLStreamingAudioInterface *stream = gAudiop->getStreamingAudioImpl();
|
||||||
|
if(stream && stream->supportsAdjustableBufferSizes())
|
||||||
|
stream->setBufferSizes(gSavedSettings.getU32("SHFMODExStreamBufferSize"),gSavedSettings.getU32("SHFMODExDecodeBufferSize"));
|
||||||
gAudiop->startInternetStream(music_url);
|
gAudiop->startInternetStream(music_url);
|
||||||
if (music_url.empty())
|
if (music_url.empty())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ void LLViewerShaderMgr::setShaders()
|
|||||||
|
|
||||||
//setup preprocessor definitions
|
//setup preprocessor definitions
|
||||||
LLShaderMgr::instance()->mDefinitions.clear();
|
LLShaderMgr::instance()->mDefinitions.clear();
|
||||||
LLShaderMgr::instance()->mDefinitions["samples"] = llformat("%d", gSavedSettings.getU32("RenderFSAASamples")/*gGLManager.getNumFBOFSAASamples(gSavedSettings.getU32("RenderFSAASamples"))*/);
|
LLShaderMgr::instance()->mDefinitions["samples"] = llformat("%d", gSavedSettings.getU32("RenderFSAASamples"));
|
||||||
LLShaderMgr::instance()->mDefinitions["NUM_TEX_UNITS"] = llformat("%d", gGLManager.mNumTextureImageUnits);
|
LLShaderMgr::instance()->mDefinitions["NUM_TEX_UNITS"] = llformat("%d", gGLManager.mNumTextureImageUnits);
|
||||||
|
|
||||||
initAttribsAndUniforms();
|
initAttribsAndUniforms();
|
||||||
|
|||||||
@@ -632,12 +632,6 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY)
|
|||||||
static const LLCachedControl<U32> RenderFSAASamples("RenderFSAASamples",0);
|
static const LLCachedControl<U32> RenderFSAASamples("RenderFSAASamples",0);
|
||||||
U32 samples = RenderFSAASamples.get() - RenderFSAASamples.get() % 2; //Must be multipe of 2.
|
U32 samples = RenderFSAASamples.get() - RenderFSAASamples.get() % 2; //Must be multipe of 2.
|
||||||
|
|
||||||
//Don't multisample if not using FXAA, or if fbos are disabled, or if multisampled fbos are not supported.
|
|
||||||
if(!LLPipeline::sRenderDeferred && (!LLRenderTarget::sUseFBO || !gGLManager.mHasFramebufferMultisample))
|
|
||||||
{
|
|
||||||
samples = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//try to allocate screen buffers at requested resolution and samples
|
//try to allocate screen buffers at requested resolution and samples
|
||||||
// - on failure, shrink number of samples and try again
|
// - on failure, shrink number of samples and try again
|
||||||
// - if not multisampled, shrink resolution and try again (favor X resolution over Y)
|
// - if not multisampled, shrink resolution and try again (favor X resolution over Y)
|
||||||
@@ -693,6 +687,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mSampleBuffer.release();
|
mSampleBuffer.release();
|
||||||
|
mScreen.release();
|
||||||
|
|
||||||
if (LLPipeline::sRenderDeferred)
|
if (LLPipeline::sRenderDeferred)
|
||||||
{
|
{
|
||||||
@@ -790,7 +785,6 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
|
|||||||
if (!mScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;
|
if (!mScreen.allocate(resX, resY, GL_RGBA, TRUE, TRUE, LLTexUnit::TT_RECT_TEXTURE, FALSE)) return false;
|
||||||
if(samples > 1)
|
if(samples > 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(mSampleBuffer.allocate(resX,resY,GL_RGBA,TRUE,TRUE,LLTexUnit::TT_RECT_TEXTURE,FALSE,samples))
|
if(mSampleBuffer.allocate(resX,resY,GL_RGBA,TRUE,TRUE,LLTexUnit::TT_RECT_TEXTURE,FALSE,samples))
|
||||||
mScreen.setSampleBuffer(&mSampleBuffer);
|
mScreen.setSampleBuffer(&mSampleBuffer);
|
||||||
else
|
else
|
||||||
@@ -906,6 +900,8 @@ void LLPipeline::releaseScreenBuffers()
|
|||||||
{
|
{
|
||||||
mShadow[i].release();
|
mShadow[i].release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mSampleBuffer.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user