Merge branch 'DRTVWR-559' of ssh://bitbucket.org/lindenlab/viewer into DRTVWR-559
commit
c5af5d10ed
|
|
@ -241,7 +241,7 @@ LLGLTexture* LLAtmosphere::getTransmittance()
|
|||
m_transmittance->generateGLTexture();
|
||||
m_transmittance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP);
|
||||
m_transmittance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR);
|
||||
m_transmittance->setExplicitFormat(GL_RGB32F_ARB, GL_RGB, GL_FLOAT);
|
||||
m_transmittance->setExplicitFormat(GL_RGB32F, GL_RGB, GL_FLOAT);
|
||||
m_transmittance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE);
|
||||
}
|
||||
return m_transmittance;
|
||||
|
|
@ -255,7 +255,7 @@ LLGLTexture* LLAtmosphere::getScattering()
|
|||
m_scattering->generateGLTexture();
|
||||
m_scattering->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP);
|
||||
m_scattering->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR);
|
||||
m_scattering->setExplicitFormat(GL_RGB16F_ARB, GL_RGB, GL_FLOAT);
|
||||
m_scattering->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||
m_scattering->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D);
|
||||
}
|
||||
return m_scattering;
|
||||
|
|
@ -269,7 +269,7 @@ LLGLTexture* LLAtmosphere::getMieScattering()
|
|||
m_mie_scatter_texture->generateGLTexture();
|
||||
m_mie_scatter_texture->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP);
|
||||
m_mie_scatter_texture->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR);
|
||||
m_mie_scatter_texture->setExplicitFormat(GL_RGB16F_ARB, GL_RGB, GL_FLOAT);
|
||||
m_mie_scatter_texture->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT);
|
||||
m_mie_scatter_texture->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D);
|
||||
}
|
||||
return m_mie_scatter_texture;
|
||||
|
|
@ -283,7 +283,7 @@ LLGLTexture* LLAtmosphere::getIlluminance()
|
|||
m_illuminance->generateGLTexture();
|
||||
m_illuminance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP);
|
||||
m_illuminance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR);
|
||||
m_illuminance->setExplicitFormat(GL_RGB32F_ARB, GL_RGB, GL_FLOAT);
|
||||
m_illuminance->setExplicitFormat(GL_RGB32F, GL_RGB, GL_FLOAT);
|
||||
m_illuminance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE);
|
||||
}
|
||||
return m_illuminance;
|
||||
|
|
|
|||
|
|
@ -51,12 +51,12 @@ LLCubeMap::LLCubeMap(bool init_as_srgb)
|
|||
mMatrixStage(0),
|
||||
mIssRGB(init_as_srgb)
|
||||
{
|
||||
mTargets[0] = GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB;
|
||||
mTargets[1] = GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB;
|
||||
mTargets[2] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB;
|
||||
mTargets[3] = GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB;
|
||||
mTargets[4] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB;
|
||||
mTargets[5] = GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB;
|
||||
mTargets[0] = GL_TEXTURE_CUBE_MAP_NEGATIVE_X;
|
||||
mTargets[1] = GL_TEXTURE_CUBE_MAP_POSITIVE_X;
|
||||
mTargets[2] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y;
|
||||
mTargets[3] = GL_TEXTURE_CUBE_MAP_POSITIVE_Y;
|
||||
mTargets[4] = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z;
|
||||
mTargets[5] = GL_TEXTURE_CUBE_MAP_POSITIVE_Z;
|
||||
}
|
||||
|
||||
LLCubeMap::~LLCubeMap()
|
||||
|
|
|
|||
|
|
@ -45,12 +45,12 @@
|
|||
// MUST match order of OpenGL face-layers
|
||||
GLenum LLCubeMapArray::sTargets[6] =
|
||||
{
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB,
|
||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB,
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB,
|
||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB,
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB,
|
||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_X,
|
||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
|
||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
|
||||
GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
|
||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
|
||||
};
|
||||
|
||||
LLVector3 LLCubeMapArray::sLookVecs[6] =
|
||||
|
|
@ -122,14 +122,14 @@ void LLCubeMapArray::allocate(U32 resolution, U32 components, U32 count)
|
|||
|
||||
bind(0);
|
||||
|
||||
glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY_ARB, 0, GL_RGB, resolution, resolution, count*6, 0,
|
||||
glTexImage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 0, GL_RGB, resolution, resolution, count*6, 0,
|
||||
GL_RGB, GL_UNSIGNED_BYTE, nullptr);
|
||||
|
||||
mImage->setAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
|
||||
mImage->setFilteringOption(LLTexUnit::TFO_ANISOTROPIC);
|
||||
|
||||
glGenerateMipmap(GL_TEXTURE_CUBE_MAP_ARRAY_ARB);
|
||||
glGenerateMipmap(GL_TEXTURE_CUBE_MAP_ARRAY);
|
||||
|
||||
unbind();
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -37,7 +37,7 @@
|
|||
#include "OpenGL/OpenGL.h"
|
||||
#endif
|
||||
|
||||
// Print-print list of shader included source files that are linked together via glAttachObjectARB()
|
||||
// Print-print list of shader included source files that are linked together via glAttachShader()
|
||||
// i.e. On macOS / OSX the AMD GLSL linker will display an error if a varying is left in an undefined state.
|
||||
#define DEBUG_SHADER_INCLUDES 0
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ using std::pair;
|
|||
using std::make_pair;
|
||||
using std::string;
|
||||
|
||||
GLhandleARB LLGLSLShader::sCurBoundShader = 0;
|
||||
GLuint LLGLSLShader::sCurBoundShader = 0;
|
||||
LLGLSLShader* LLGLSLShader::sCurBoundShaderPtr = NULL;
|
||||
S32 LLGLSLShader::sIndexedTextureChannels = 0;
|
||||
bool LLGLSLShader::sProfileEnabled = false;
|
||||
|
|
@ -227,11 +227,11 @@ void LLGLSLShader::stopProfile(U32 count, U32 mode)
|
|||
|
||||
void LLGLSLShader::placeProfileQuery()
|
||||
{
|
||||
#if !LL_DARWIN
|
||||
#if 1 || !LL_DARWIN
|
||||
if (mTimerQuery == 0)
|
||||
{
|
||||
glGenQueriesARB(1, &mSamplesQuery);
|
||||
glGenQueriesARB(1, &mTimerQuery);
|
||||
glGenQueries(1, &mSamplesQuery);
|
||||
glGenQueries(1, &mTimerQuery);
|
||||
}
|
||||
|
||||
if (!mTextureStateFetched)
|
||||
|
|
@ -267,16 +267,16 @@ void LLGLSLShader::placeProfileQuery()
|
|||
}
|
||||
|
||||
|
||||
glBeginQueryARB(GL_SAMPLES_PASSED, mSamplesQuery);
|
||||
glBeginQueryARB(GL_TIME_ELAPSED, mTimerQuery);
|
||||
glBeginQuery(GL_SAMPLES_PASSED, mSamplesQuery);
|
||||
glBeginQuery(GL_TIME_ELAPSED, mTimerQuery);
|
||||
#endif
|
||||
}
|
||||
|
||||
void LLGLSLShader::readProfileQuery(U32 count, U32 mode)
|
||||
{
|
||||
#if !LL_DARWIN
|
||||
glEndQueryARB(GL_TIME_ELAPSED);
|
||||
glEndQueryARB(GL_SAMPLES_PASSED);
|
||||
glEndQuery(GL_TIME_ELAPSED);
|
||||
glEndQuery(GL_SAMPLES_PASSED);
|
||||
|
||||
U64 time_elapsed = 0;
|
||||
glGetQueryObjectui64v(mTimerQuery, GL_QUERY_RESULT, &time_elapsed);
|
||||
|
|
@ -347,30 +347,37 @@ void LLGLSLShader::unloadInternal()
|
|||
|
||||
if (mProgramObject)
|
||||
{
|
||||
GLhandleARB obj[1024];
|
||||
GLsizei count;
|
||||
glGetAttachedObjectsARB(mProgramObject, 1024, &count, obj);
|
||||
GLuint obj[1024];
|
||||
GLsizei count = 0;
|
||||
glGetAttachedShaders(mProgramObject, 1024, &count, obj);
|
||||
|
||||
for (GLsizei i = 0; i < count; i++)
|
||||
{
|
||||
glDetachObjectARB(mProgramObject, obj[i]);
|
||||
glDeleteObjectARB(obj[i]);
|
||||
glDetachShader(mProgramObject, obj[i]);
|
||||
}
|
||||
|
||||
glDeleteObjectARB(mProgramObject);
|
||||
for (GLsizei i = 0; i < count; i++)
|
||||
{
|
||||
if (glIsShader(obj[i]))
|
||||
{
|
||||
glDeleteShader(obj[i]);
|
||||
}
|
||||
}
|
||||
|
||||
glDeleteProgram(mProgramObject);
|
||||
|
||||
mProgramObject = 0;
|
||||
}
|
||||
|
||||
if (mTimerQuery)
|
||||
{
|
||||
glDeleteQueriesARB(1, &mTimerQuery);
|
||||
glDeleteQueries(1, &mTimerQuery);
|
||||
mTimerQuery = 0;
|
||||
}
|
||||
|
||||
if (mSamplesQuery)
|
||||
{
|
||||
glDeleteQueriesARB(1, &mSamplesQuery);
|
||||
glDeleteQueries(1, &mSamplesQuery);
|
||||
mSamplesQuery = 0;
|
||||
}
|
||||
|
||||
|
|
@ -401,7 +408,7 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes,
|
|||
llassert_always(!mShaderFiles.empty());
|
||||
|
||||
// Create program
|
||||
mProgramObject = glCreateProgramObjectARB();
|
||||
mProgramObject = glCreateProgram();
|
||||
if (mProgramObject == 0)
|
||||
{
|
||||
// Shouldn't happen if shader related extensions, like ARB_vertex_shader, exist.
|
||||
|
|
@ -425,7 +432,7 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes,
|
|||
vector< pair<string,GLenum> >::iterator fileIter = mShaderFiles.begin();
|
||||
for ( ; fileIter != mShaderFiles.end(); fileIter++ )
|
||||
{
|
||||
GLhandleARB shaderhandle = LLShaderMgr::instance()->loadShaderFile((*fileIter).first, mShaderLevel, (*fileIter).second, &mDefines, mFeatures.mIndexedTextureChannels);
|
||||
GLuint shaderhandle = LLShaderMgr::instance()->loadShaderFile((*fileIter).first, mShaderLevel, (*fileIter).second, &mDefines, mFeatures.mIndexedTextureChannels);
|
||||
LL_DEBUGS("ShaderLoading") << "SHADER FILE: " << (*fileIter).first << " mShaderLevel=" << mShaderLevel << LL_ENDL;
|
||||
if (shaderhandle)
|
||||
{
|
||||
|
|
@ -505,20 +512,20 @@ BOOL LLGLSLShader::createShader(std::vector<LLStaticHashedString> * attributes,
|
|||
}
|
||||
|
||||
#if DEBUG_SHADER_INCLUDES
|
||||
void dumpAttachObject( const char *func_name, GLhandleARB program_object, const std::string &object_path )
|
||||
void dumpAttachObject( const char *func_name, GLuint program_object, const std::string &object_path )
|
||||
{
|
||||
GLcharARB* info_log;
|
||||
GLchar* info_log;
|
||||
GLint info_len_expect = 0;
|
||||
GLint info_len_actual = 0;
|
||||
|
||||
glGetObjectParameterivARB(program_object, GL_OBJECT_INFO_LOG_LENGTH_ARB, &info_len_expect);
|
||||
glGetShaderiv(program_object, GL_INFO_LOG_LENGTH,, &info_len_expect);
|
||||
fprintf(stderr, " * %-20s(), log size: %d, %s\n", func_name, info_len_expect, object_path.c_str());
|
||||
|
||||
if (info_len_expect > 0)
|
||||
{
|
||||
fprintf(stderr, " ========== %s() ========== \n", func_name);
|
||||
info_log = new GLcharARB [ info_len_expect ];
|
||||
glGetInfoLogARB(program_object, info_len_expect, &info_len_actual, info_log);
|
||||
info_log = new GLchar [ info_len_expect ];
|
||||
glGetProgramInfoLog(program_object, info_len_expect, &info_len_actual, info_log);
|
||||
fprintf(stderr, "%s\n", info_log);
|
||||
delete [] info_log;
|
||||
}
|
||||
|
|
@ -530,7 +537,7 @@ BOOL LLGLSLShader::attachVertexObject(std::string object_path)
|
|||
if (LLShaderMgr::instance()->mVertexShaderObjects.count(object_path) > 0)
|
||||
{
|
||||
stop_glerror();
|
||||
glAttachObjectARB(mProgramObject, LLShaderMgr::instance()->mVertexShaderObjects[object_path]);
|
||||
glAttachShader(mProgramObject, LLShaderMgr::instance()->mVertexShaderObjects[object_path]);
|
||||
#if DEBUG_SHADER_INCLUDES
|
||||
dumpAttachObject("attachVertexObject", mProgramObject, object_path);
|
||||
#endif // DEBUG_SHADER_INCLUDES
|
||||
|
|
@ -549,7 +556,7 @@ BOOL LLGLSLShader::attachFragmentObject(std::string object_path)
|
|||
if (LLShaderMgr::instance()->mFragmentShaderObjects.count(object_path) > 0)
|
||||
{
|
||||
stop_glerror();
|
||||
glAttachObjectARB(mProgramObject, LLShaderMgr::instance()->mFragmentShaderObjects[object_path]);
|
||||
glAttachShader(mProgramObject, LLShaderMgr::instance()->mFragmentShaderObjects[object_path]);
|
||||
#if DEBUG_SHADER_INCLUDES
|
||||
dumpAttachObject("attachFragmentObject", mProgramObject, object_path);
|
||||
#endif // DEBUG_SHADER_INCLUDES
|
||||
|
|
@ -563,12 +570,12 @@ BOOL LLGLSLShader::attachFragmentObject(std::string object_path)
|
|||
}
|
||||
}
|
||||
|
||||
void LLGLSLShader::attachObject(GLhandleARB object)
|
||||
void LLGLSLShader::attachObject(GLuint object)
|
||||
{
|
||||
if (object != 0)
|
||||
{
|
||||
stop_glerror();
|
||||
glAttachObjectARB(mProgramObject, object);
|
||||
glAttachShader(mProgramObject, object);
|
||||
#if DEBUG_SHADER_INCLUDES
|
||||
std::string object_path("???");
|
||||
dumpAttachObject("attachObject", mProgramObject, object_path);
|
||||
|
|
@ -581,7 +588,7 @@ void LLGLSLShader::attachObject(GLhandleARB object)
|
|||
}
|
||||
}
|
||||
|
||||
void LLGLSLShader::attachObjects(GLhandleARB* objects, S32 count)
|
||||
void LLGLSLShader::attachObjects(GLuint* objects, S32 count)
|
||||
{
|
||||
for (S32 i = 0; i < count; i++)
|
||||
{
|
||||
|
|
@ -597,7 +604,7 @@ BOOL LLGLSLShader::mapAttributes(const std::vector<LLStaticHashedString> * attri
|
|||
for (U32 i = 0; i < LLShaderMgr::instance()->mReservedAttribs.size(); i++)
|
||||
{
|
||||
const char* name = LLShaderMgr::instance()->mReservedAttribs[i].c_str();
|
||||
glBindAttribLocationARB(mProgramObject, i, (const GLcharARB *) name);
|
||||
glBindAttribLocation(mProgramObject, i, (const GLchar *) name);
|
||||
}
|
||||
|
||||
//link the program
|
||||
|
|
@ -620,7 +627,7 @@ BOOL LLGLSLShader::mapAttributes(const std::vector<LLStaticHashedString> * attri
|
|||
for (U32 i = 0; i < LLShaderMgr::instance()->mReservedAttribs.size(); i++)
|
||||
{
|
||||
const char* name = LLShaderMgr::instance()->mReservedAttribs[i].c_str();
|
||||
S32 index = glGetAttribLocationARB(mProgramObject, (const GLcharARB *)name);
|
||||
S32 index = glGetAttribLocation(mProgramObject, (const GLchar *)name);
|
||||
if (index != -1)
|
||||
{
|
||||
#if LL_RELEASE_WITH_DEBUG_INFO
|
||||
|
|
@ -637,7 +644,7 @@ BOOL LLGLSLShader::mapAttributes(const std::vector<LLStaticHashedString> * attri
|
|||
for (U32 i = 0; i < numAttributes; i++)
|
||||
{
|
||||
const char* name = (*attributes)[i].String().c_str();
|
||||
S32 index = glGetAttribLocationARB(mProgramObject, name);
|
||||
S32 index = glGetAttribLocation(mProgramObject, name);
|
||||
if (index != -1)
|
||||
{
|
||||
mAttribute[LLShaderMgr::instance()->mReservedAttribs.size() + i] = index;
|
||||
|
|
@ -668,7 +675,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector<LLStaticHashedString> *
|
|||
name[0] = 0;
|
||||
|
||||
|
||||
glGetActiveUniformARB(mProgramObject, index, 1024, &length, &size, &type, (GLcharARB *)name);
|
||||
glGetActiveUniform(mProgramObject, index, 1024, &length, &size, &type, (GLchar *)name);
|
||||
#if !LL_DARWIN
|
||||
if (size > 0)
|
||||
{
|
||||
|
|
@ -713,7 +720,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector<LLStaticHashedString> *
|
|||
}
|
||||
#endif
|
||||
|
||||
S32 location = glGetUniformLocationARB(mProgramObject, name);
|
||||
S32 location = glGetUniformLocation(mProgramObject, name);
|
||||
if (location != -1)
|
||||
{
|
||||
//chop off "[0]" so we can always access the first element
|
||||
|
|
@ -779,14 +786,14 @@ GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type, GLint
|
|||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
|
||||
|
||||
if ((type >= GL_SAMPLER_1D_ARB && type <= GL_SAMPLER_2D_RECT_SHADOW_ARB) ||
|
||||
if ((type >= GL_SAMPLER_1D && type <= GL_SAMPLER_2D_RECT_SHADOW) ||
|
||||
type == GL_SAMPLER_2D_MULTISAMPLE ||
|
||||
type == GL_SAMPLER_CUBE_MAP_ARRAY_ARB)
|
||||
type == GL_SAMPLER_CUBE_MAP_ARRAY)
|
||||
{ //this here is a texture
|
||||
GLint ret = mActiveTextureChannels;
|
||||
if (size == 1)
|
||||
{
|
||||
glUniform1iARB(location, mActiveTextureChannels);
|
||||
glUniform1i(location, mActiveTextureChannels);
|
||||
LL_DEBUGS("ShaderUniform") << "Assigned to texture channel " << mActiveTextureChannels << LL_ENDL;
|
||||
mActiveTextureChannels++;
|
||||
}
|
||||
|
|
@ -800,7 +807,7 @@ GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type, GLint
|
|||
{
|
||||
channel[i] = mActiveTextureChannels++;
|
||||
}
|
||||
glUniform1ivARB(location, size, channel);
|
||||
glUniform1iv(location, size, channel);
|
||||
LL_DEBUGS("ShaderUniform") << "Assigned to texture channel " <<
|
||||
(mActiveTextureChannels-size) << " through " << (mActiveTextureChannels-1) << LL_ENDL;
|
||||
}
|
||||
|
|
@ -833,7 +840,7 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms)
|
|||
|
||||
//get the number of active uniforms
|
||||
GLint activeCount;
|
||||
glGetObjectParameterivARB(mProgramObject, GL_OBJECT_ACTIVE_UNIFORMS_ARB, &activeCount);
|
||||
glGetProgramiv(mProgramObject, GL_ACTIVE_UNIFORMS, &activeCount);
|
||||
|
||||
//........................................................................................................................................
|
||||
//........................................................................................
|
||||
|
|
@ -860,12 +867,12 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms)
|
|||
*/
|
||||
|
||||
|
||||
S32 diffuseMap = glGetUniformLocationARB(mProgramObject, "diffuseMap");
|
||||
S32 specularMap = glGetUniformLocationARB(mProgramObject, "specularMap");
|
||||
S32 bumpMap = glGetUniformLocationARB(mProgramObject, "bumpMap");
|
||||
S32 altDiffuseMap = glGetUniformLocationARB(mProgramObject, "altDiffuseMap");
|
||||
S32 environmentMap = glGetUniformLocationARB(mProgramObject, "environmentMap");
|
||||
S32 reflectionMap = glGetUniformLocationARB(mProgramObject, "reflectionMap");
|
||||
S32 diffuseMap = glGetUniformLocation(mProgramObject, "diffuseMap");
|
||||
S32 specularMap = glGetUniformLocation(mProgramObject, "specularMap");
|
||||
S32 bumpMap = glGetUniformLocation(mProgramObject, "bumpMap");
|
||||
S32 altDiffuseMap = glGetUniformLocation(mProgramObject, "altDiffuseMap");
|
||||
S32 environmentMap = glGetUniformLocation(mProgramObject, "environmentMap");
|
||||
S32 reflectionMap = glGetUniformLocation(mProgramObject, "reflectionMap");
|
||||
|
||||
std::set<S32> skip_index;
|
||||
|
||||
|
|
@ -882,7 +889,7 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms)
|
|||
{
|
||||
name[0] = '\0';
|
||||
|
||||
glGetActiveUniformARB(mProgramObject, i, 1024, &length, &size, &type, (GLcharARB *)name);
|
||||
glGetActiveUniform(mProgramObject, i, 1024, &length, &size, &type, (GLchar *)name);
|
||||
|
||||
if (-1 == diffuseMap && std::string(name) == "diffuseMap")
|
||||
{
|
||||
|
|
@ -965,6 +972,14 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms)
|
|||
}
|
||||
//........................................................................................................................................
|
||||
|
||||
if (mFeatures.hasReflectionProbes) // Set up block binding, in a way supported by Apple (rather than binding = 1 in .glsl).
|
||||
{ // See slide 35 and more of https://docs.huihoo.com/apple/wwdc/2011/session_420__advances_in_opengl_for_mac_os_x_lion.pdf
|
||||
static const GLuint BLOCKBINDING = 1; //picked by us
|
||||
//Get the index, similar to a uniform location
|
||||
GLuint UBOBlockIndex = glGetUniformBlockIndex(mProgramObject, "ReflectionProbes");
|
||||
//Set this index to a binding index
|
||||
glUniformBlockBinding(mProgramObject, UBOBlockIndex, BLOCKBINDING);
|
||||
}
|
||||
unbind();
|
||||
|
||||
LL_DEBUGS("ShaderUniform") << "Total Uniform Size: " << mTotalUniformSize << LL_ENDL;
|
||||
|
|
@ -995,7 +1010,7 @@ void LLGLSLShader::bind()
|
|||
if (sCurBoundShader != mProgramObject) // Don't re-bind current shader
|
||||
{
|
||||
LLVertexBuffer::unbind();
|
||||
glUseProgramObjectARB(mProgramObject);
|
||||
glUseProgram(mProgramObject);
|
||||
sCurBoundShader = mProgramObject;
|
||||
sCurBoundShaderPtr = this;
|
||||
}
|
||||
|
|
@ -1027,7 +1042,7 @@ void LLGLSLShader::unbind()
|
|||
gGL.flush();
|
||||
stop_glerror();
|
||||
LLVertexBuffer::unbind();
|
||||
glUseProgramObjectARB(0);
|
||||
glUseProgram(0);
|
||||
sCurBoundShader = 0;
|
||||
sCurBoundShaderPtr = NULL;
|
||||
stop_glerror();
|
||||
|
|
@ -1038,7 +1053,7 @@ void LLGLSLShader::bindNoShader(void)
|
|||
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
|
||||
|
||||
LLVertexBuffer::unbind();
|
||||
glUseProgramObjectARB(0);
|
||||
glUseProgram(0);
|
||||
sCurBoundShader = 0;
|
||||
sCurBoundShaderPtr = NULL;
|
||||
}
|
||||
|
|
@ -1168,7 +1183,7 @@ void LLGLSLShader::uniform1i(U32 index, GLint x)
|
|||
const auto& iter = mValue.find(mUniform[index]);
|
||||
if (iter == mValue.end() || iter->second.mV[0] != x)
|
||||
{
|
||||
glUniform1iARB(mUniform[index], x);
|
||||
glUniform1i(mUniform[index], x);
|
||||
mValue[mUniform[index]] = LLVector4(x,0.f,0.f,0.f);
|
||||
}
|
||||
}
|
||||
|
|
@ -1191,7 +1206,7 @@ void LLGLSLShader::uniform1f(U32 index, GLfloat x)
|
|||
const auto& iter = mValue.find(mUniform[index]);
|
||||
if (iter == mValue.end() || iter->second.mV[0] != x)
|
||||
{
|
||||
glUniform1fARB(mUniform[index], x);
|
||||
glUniform1f(mUniform[index], x);
|
||||
mValue[mUniform[index]] = LLVector4(x,0.f,0.f,0.f);
|
||||
}
|
||||
}
|
||||
|
|
@ -1214,7 +1229,7 @@ void LLGLSLShader::uniform2f(U32 index, GLfloat x, GLfloat y)
|
|||
LLVector4 vec(x,y,0.f,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec))
|
||||
{
|
||||
glUniform2fARB(mUniform[index], x, y);
|
||||
glUniform2f(mUniform[index], x, y);
|
||||
mValue[mUniform[index]] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1237,7 +1252,7 @@ void LLGLSLShader::uniform3f(U32 index, GLfloat x, GLfloat y, GLfloat z)
|
|||
LLVector4 vec(x,y,z,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec))
|
||||
{
|
||||
glUniform3fARB(mUniform[index], x, y, z);
|
||||
glUniform3f(mUniform[index], x, y, z);
|
||||
mValue[mUniform[index]] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1260,7 +1275,7 @@ void LLGLSLShader::uniform4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat
|
|||
LLVector4 vec(x,y,z,w);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec))
|
||||
{
|
||||
glUniform4fARB(mUniform[index], x, y, z, w);
|
||||
glUniform4f(mUniform[index], x, y, z, w);
|
||||
mValue[mUniform[index]] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1283,7 +1298,7 @@ void LLGLSLShader::uniform1iv(U32 index, U32 count, const GLint* v)
|
|||
LLVector4 vec(v[0],0.f,0.f,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
|
||||
{
|
||||
glUniform1ivARB(mUniform[index], count, v);
|
||||
glUniform1iv(mUniform[index], count, v);
|
||||
mValue[mUniform[index]] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1306,7 +1321,7 @@ void LLGLSLShader::uniform4iv(U32 index, U32 count, const GLint* v)
|
|||
LLVector4 vec(v[0], v[1], v[2], v[3]);
|
||||
if (iter == mValue.end() || shouldChange(iter->second, vec) || count != 1)
|
||||
{
|
||||
glUniform1ivARB(mUniform[index], count, v);
|
||||
glUniform1iv(mUniform[index], count, v);
|
||||
mValue[mUniform[index]] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1330,7 +1345,7 @@ void LLGLSLShader::uniform1fv(U32 index, U32 count, const GLfloat* v)
|
|||
LLVector4 vec(v[0],0.f,0.f,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
|
||||
{
|
||||
glUniform1fvARB(mUniform[index], count, v);
|
||||
glUniform1fv(mUniform[index], count, v);
|
||||
mValue[mUniform[index]] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1353,7 +1368,7 @@ void LLGLSLShader::uniform2fv(U32 index, U32 count, const GLfloat* v)
|
|||
LLVector4 vec(v[0],v[1],0.f,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
|
||||
{
|
||||
glUniform2fvARB(mUniform[index], count, v);
|
||||
glUniform2fv(mUniform[index], count, v);
|
||||
mValue[mUniform[index]] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1376,7 +1391,7 @@ void LLGLSLShader::uniform3fv(U32 index, U32 count, const GLfloat* v)
|
|||
LLVector4 vec(v[0],v[1],v[2],0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
|
||||
{
|
||||
glUniform3fvARB(mUniform[index], count, v);
|
||||
glUniform3fv(mUniform[index], count, v);
|
||||
mValue[mUniform[index]] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1400,7 +1415,7 @@ void LLGLSLShader::uniform4fv(U32 index, U32 count, const GLfloat* v)
|
|||
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
|
||||
glUniform4fvARB(mUniform[index], count, v);
|
||||
glUniform4fv(mUniform[index], count, v);
|
||||
mValue[mUniform[index]] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1419,7 +1434,7 @@ void LLGLSLShader::uniformMatrix2fv(U32 index, U32 count, GLboolean transpose, c
|
|||
|
||||
if (mUniform[index] >= 0)
|
||||
{
|
||||
glUniformMatrix2fvARB(mUniform[index], count, transpose, v);
|
||||
glUniformMatrix2fv(mUniform[index], count, transpose, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1436,7 +1451,7 @@ void LLGLSLShader::uniformMatrix3fv(U32 index, U32 count, GLboolean transpose, c
|
|||
|
||||
if (mUniform[index] >= 0)
|
||||
{
|
||||
glUniformMatrix3fvARB(mUniform[index], count, transpose, v);
|
||||
glUniformMatrix3fv(mUniform[index], count, transpose, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1472,7 +1487,7 @@ void LLGLSLShader::uniformMatrix4fv(U32 index, U32 count, GLboolean transpose, c
|
|||
|
||||
if (mUniform[index] >= 0)
|
||||
{
|
||||
glUniformMatrix4fvARB(mUniform[index], count, transpose, v);
|
||||
glUniformMatrix4fv(mUniform[index], count, transpose, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1490,7 +1505,7 @@ GLint LLGLSLShader::getUniformLocation(const LLStaticHashedString& uniform)
|
|||
if (gDebugGL)
|
||||
{
|
||||
stop_glerror();
|
||||
if (iter->second != glGetUniformLocationARB(mProgramObject, uniform.String().c_str()))
|
||||
if (iter->second != glGetUniformLocation(mProgramObject, uniform.String().c_str()))
|
||||
{
|
||||
LL_ERRS() << "Uniform does not match." << LL_ENDL;
|
||||
}
|
||||
|
|
@ -1545,7 +1560,7 @@ void LLGLSLShader::uniform1i(const LLStaticHashedString& uniform, GLint v)
|
|||
LLVector4 vec(v,0.f,0.f,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec))
|
||||
{
|
||||
glUniform1iARB(location, v);
|
||||
glUniform1i(location, v);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1562,7 +1577,7 @@ void LLGLSLShader::uniform1iv(const LLStaticHashedString& uniform, U32 count, co
|
|||
if (iter == mValue.end() || shouldChange(iter->second, vec) || count != 1)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
|
||||
glUniform1ivARB(location, count, v);
|
||||
glUniform1iv(location, count, v);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1579,7 +1594,7 @@ void LLGLSLShader::uniform4iv(const LLStaticHashedString& uniform, U32 count, co
|
|||
if (iter == mValue.end() || shouldChange(iter->second, vec) || count != 1)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
|
||||
glUniform4ivARB(location, count, v);
|
||||
glUniform4iv(location, count, v);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1595,7 +1610,7 @@ void LLGLSLShader::uniform2i(const LLStaticHashedString& uniform, GLint i, GLint
|
|||
LLVector4 vec(i,j,0.f,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec))
|
||||
{
|
||||
glUniform2iARB(location, i, j);
|
||||
glUniform2i(location, i, j);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1612,7 +1627,7 @@ void LLGLSLShader::uniform1f(const LLStaticHashedString& uniform, GLfloat v)
|
|||
LLVector4 vec(v,0.f,0.f,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec))
|
||||
{
|
||||
glUniform1fARB(location, v);
|
||||
glUniform1f(location, v);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1628,7 +1643,7 @@ void LLGLSLShader::uniform2f(const LLStaticHashedString& uniform, GLfloat x, GLf
|
|||
LLVector4 vec(x,y,0.f,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec))
|
||||
{
|
||||
glUniform2fARB(location, x,y);
|
||||
glUniform2f(location, x,y);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1645,7 +1660,7 @@ void LLGLSLShader::uniform3f(const LLStaticHashedString& uniform, GLfloat x, GLf
|
|||
LLVector4 vec(x,y,z,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec))
|
||||
{
|
||||
glUniform3fARB(location, x,y,z);
|
||||
glUniform3f(location, x,y,z);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1661,7 +1676,7 @@ void LLGLSLShader::uniform1fv(const LLStaticHashedString& uniform, U32 count, co
|
|||
LLVector4 vec(v[0],0.f,0.f,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
|
||||
{
|
||||
glUniform1fvARB(location, count, v);
|
||||
glUniform1fv(location, count, v);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1677,7 +1692,7 @@ void LLGLSLShader::uniform2fv(const LLStaticHashedString& uniform, U32 count, co
|
|||
LLVector4 vec(v[0],v[1],0.f,0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
|
||||
{
|
||||
glUniform2fvARB(location, count, v);
|
||||
glUniform2fv(location, count, v);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1693,7 +1708,7 @@ void LLGLSLShader::uniform3fv(const LLStaticHashedString& uniform, U32 count, co
|
|||
LLVector4 vec(v[0],v[1],v[2],0.f);
|
||||
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
|
||||
{
|
||||
glUniform3fvARB(location, count, v);
|
||||
glUniform3fv(location, count, v);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1710,7 +1725,7 @@ void LLGLSLShader::uniform4fv(const LLStaticHashedString& uniform, U32 count, co
|
|||
if (iter == mValue.end() || shouldChange(iter->second,vec) || count != 1)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
|
||||
glUniform4fvARB(location, count, v);
|
||||
glUniform4fv(location, count, v);
|
||||
mValue[location] = vec;
|
||||
}
|
||||
}
|
||||
|
|
@ -1723,7 +1738,7 @@ void LLGLSLShader::uniformMatrix4fv(const LLStaticHashedString& uniform, U32 cou
|
|||
if (location >= 0)
|
||||
{
|
||||
stop_glerror();
|
||||
glUniformMatrix4fvARB(location, count, transpose, v);
|
||||
glUniformMatrix4fv(location, count, transpose, v);
|
||||
stop_glerror();
|
||||
}
|
||||
}
|
||||
|
|
@ -1733,7 +1748,7 @@ void LLGLSLShader::vertexAttrib4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GL
|
|||
{
|
||||
if (mAttribute[index] > 0)
|
||||
{
|
||||
glVertexAttrib4fARB(mAttribute[index], x, y, z, w);
|
||||
glVertexAttrib4f(mAttribute[index], x, y, z, w);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1741,7 +1756,7 @@ void LLGLSLShader::vertexAttrib4fv(U32 index, GLfloat* v)
|
|||
{
|
||||
if (mAttribute[index] > 0)
|
||||
{
|
||||
glVertexAttrib4fvARB(mAttribute[index], v);
|
||||
glVertexAttrib4fv(mAttribute[index], v);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ public:
|
|||
LLGLSLShader();
|
||||
~LLGLSLShader();
|
||||
|
||||
static GLhandleARB sCurBoundShader;
|
||||
static GLuint sCurBoundShader;
|
||||
static LLGLSLShader* sCurBoundShaderPtr;
|
||||
static S32 sIndexedTextureChannels;
|
||||
|
||||
|
|
@ -168,8 +168,8 @@ public:
|
|||
const char** varyings = NULL);
|
||||
BOOL attachFragmentObject(std::string object);
|
||||
BOOL attachVertexObject(std::string object);
|
||||
void attachObject(GLhandleARB object);
|
||||
void attachObjects(GLhandleARB* objects = NULL, S32 count = 0);
|
||||
void attachObject(GLuint object);
|
||||
void attachObjects(GLuint* objects = NULL, S32 count = 0);
|
||||
BOOL mapAttributes(const std::vector<LLStaticHashedString> * attributes);
|
||||
BOOL mapUniforms(const std::vector<LLStaticHashedString> *);
|
||||
void mapUniform(GLint index, const std::vector<LLStaticHashedString> *);
|
||||
|
|
@ -243,7 +243,7 @@ public:
|
|||
U32 mMatHash[LLRender::NUM_MATRIX_MODES];
|
||||
U32 mLightHash;
|
||||
|
||||
GLhandleARB mProgramObject;
|
||||
GLuint mProgramObject;
|
||||
#if LL_RELEASE_WITH_DEBUG_INFO
|
||||
struct attr_name
|
||||
{
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public:
|
|||
mLineStipple(GL_LINE_STIPPLE),
|
||||
mNormalize(GL_NORMALIZE),
|
||||
mPolygonSmooth(GL_POLYGON_SMOOTH),
|
||||
mGLMultisample(GL_MULTISAMPLE_ARB)
|
||||
mGLMultisample(GL_MULTISAMPLE)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -794,7 +794,7 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32
|
|||
if (is_compressed)
|
||||
{
|
||||
S32 tex_size = dataFormatBytes(mFormatPrimary, w, h);
|
||||
glCompressedTexImage2DARB(mTarget, gl_level, mFormatPrimary, w, h, 0, tex_size, (GLvoid *)data_in);
|
||||
glCompressedTexImage2D(mTarget, gl_level, mFormatPrimary, w, h, 0, tex_size, (GLvoid *)data_in);
|
||||
stop_glerror();
|
||||
}
|
||||
else
|
||||
|
|
@ -990,7 +990,7 @@ BOOL LLImageGL::setImage(const U8* data_in, BOOL data_hasmips /* = FALSE */, S32
|
|||
if (is_compressed)
|
||||
{
|
||||
S32 tex_size = dataFormatBytes(mFormatPrimary, w, h);
|
||||
glCompressedTexImage2DARB(mTarget, 0, mFormatPrimary, w, h, 0, tex_size, (GLvoid *)data_in);
|
||||
glCompressedTexImage2D(mTarget, 0, mFormatPrimary, w, h, 0, tex_size, (GLvoid *)data_in);
|
||||
stop_glerror();
|
||||
}
|
||||
else
|
||||
|
|
@ -1838,7 +1838,7 @@ BOOL LLImageGL::readBackRaw(S32 discard_level, LLImageRaw* imageraw, bool compre
|
|||
return FALSE ;
|
||||
}
|
||||
|
||||
glGetCompressedTexImageARB(mTarget, gl_discard, (GLvoid*)(imageraw->getData()));
|
||||
glGetCompressedTexImage(mTarget, gl_discard, (GLvoid*)(imageraw->getData()));
|
||||
//stop_glerror();
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -239,17 +239,17 @@ void LLPostProcess::applyColorFilterShader(void)
|
|||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, sceneRenderTexture);
|
||||
|
||||
getShaderUniforms(colorFilterUniforms, gPostColorFilterProgram.mProgramObject);
|
||||
glUniform1iARB(colorFilterUniforms["RenderTexture"], 0);
|
||||
glUniform1fARB(colorFilterUniforms["brightness"], tweaks.getBrightness());
|
||||
glUniform1fARB(colorFilterUniforms["contrast"], tweaks.getContrast());
|
||||
glUniform1i(colorFilterUniforms["RenderTexture"], 0);
|
||||
glUniform1f(colorFilterUniforms["brightness"], tweaks.getBrightness());
|
||||
glUniform1f(colorFilterUniforms["contrast"], tweaks.getContrast());
|
||||
float baseI = (tweaks.getContrastBaseR() + tweaks.getContrastBaseG() + tweaks.getContrastBaseB()) / 3.0f;
|
||||
baseI = tweaks.getContrastBaseIntensity() / ((baseI < 0.001f) ? 0.001f : baseI);
|
||||
float baseR = tweaks.getContrastBaseR() * baseI;
|
||||
float baseG = tweaks.getContrastBaseG() * baseI;
|
||||
float baseB = tweaks.getContrastBaseB() * baseI;
|
||||
glUniform3fARB(colorFilterUniforms["contrastBase"], baseR, baseG, baseB);
|
||||
glUniform1fARB(colorFilterUniforms["saturation"], tweaks.getSaturation());
|
||||
glUniform3fARB(colorFilterUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B);
|
||||
glUniform3f(colorFilterUniforms["contrastBase"], baseR, baseG, baseB);
|
||||
glUniform1f(colorFilterUniforms["saturation"], tweaks.getSaturation());
|
||||
glUniform3f(colorFilterUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B);
|
||||
|
||||
LLGLEnable blend(GL_BLEND);
|
||||
gGL.setSceneBlendType(LLRender::BT_REPLACE);
|
||||
|
|
@ -282,22 +282,22 @@ void LLPostProcess::applyNightVisionShader(void)
|
|||
|
||||
getShaderUniforms(nightVisionUniforms, gPostNightVisionProgram.mProgramObject);
|
||||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, sceneRenderTexture);
|
||||
glUniform1iARB(nightVisionUniforms["RenderTexture"], 0);
|
||||
glUniform1i(nightVisionUniforms["RenderTexture"], 0);
|
||||
|
||||
gGL.getTexUnit(1)->activate();
|
||||
gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
|
||||
|
||||
gGL.getTexUnit(1)->bindManual(LLTexUnit::TT_TEXTURE, noiseTexture);
|
||||
glUniform1iARB(nightVisionUniforms["NoiseTexture"], 1);
|
||||
glUniform1i(nightVisionUniforms["NoiseTexture"], 1);
|
||||
|
||||
|
||||
glUniform1fARB(nightVisionUniforms["brightMult"], tweaks.getBrightMult());
|
||||
glUniform1fARB(nightVisionUniforms["noiseStrength"], tweaks.getNoiseStrength());
|
||||
glUniform1f(nightVisionUniforms["brightMult"], tweaks.getBrightMult());
|
||||
glUniform1f(nightVisionUniforms["noiseStrength"], tweaks.getNoiseStrength());
|
||||
noiseTextureScale = 0.01f + ((101.f - tweaks.getNoiseSize()) / 100.f);
|
||||
noiseTextureScale *= (screenH / NOISE_SIZE);
|
||||
|
||||
|
||||
glUniform3fARB(nightVisionUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B);
|
||||
glUniform3f(nightVisionUniforms["lumWeights"], LUMINANCE_R, LUMINANCE_G, LUMINANCE_B);
|
||||
|
||||
LLGLEnable blend(GL_BLEND);
|
||||
gGL.setSceneBlendType(LLRender::BT_REPLACE);
|
||||
|
|
@ -345,12 +345,12 @@ void LLPostProcess::createBloomShader(void)
|
|||
bloomBlurUniforms[sBlurWidth] = 0;
|
||||
}
|
||||
|
||||
void LLPostProcess::getShaderUniforms(glslUniforms & uniforms, GLhandleARB & prog)
|
||||
void LLPostProcess::getShaderUniforms(glslUniforms & uniforms, GLuint & prog)
|
||||
{
|
||||
/// Find uniform locations and insert into map
|
||||
glslUniforms::iterator i;
|
||||
for (i = uniforms.begin(); i != uniforms.end(); ++i){
|
||||
i->second = glGetUniformLocationARB(prog, i->first.String().c_str());
|
||||
i->second = glGetUniformLocation(prog, i->first.String().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -391,7 +391,7 @@ void LLPostProcess::doEffects(void)
|
|||
void LLPostProcess::copyFrameBuffer(U32 & texture, unsigned int width, unsigned int height)
|
||||
{
|
||||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, texture);
|
||||
glCopyTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, 0, 0, width, height, 0);
|
||||
glCopyTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA, 0, 0, width, height, 0);
|
||||
}
|
||||
|
||||
void LLPostProcess::drawOrthoQuad(unsigned int width, unsigned int height, QuadType type)
|
||||
|
|
@ -410,60 +410,60 @@ void LLPostProcess::drawOrthoQuad(unsigned int width, unsigned int height, QuadT
|
|||
|
||||
glBegin(GL_QUADS);
|
||||
if (type != QUAD_BLOOM_EXTRACT){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, (GLfloat) height);
|
||||
glMultiTexCoord2f(GL_TEXTURE0, 0.f, (GLfloat) height);
|
||||
} else {
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, (GLfloat) height * 2.0f);
|
||||
glMultiTexCoord2f(GL_TEXTURE0, 0.f, (GLfloat) height * 2.0f);
|
||||
}
|
||||
if (type == QUAD_NOISE){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB,
|
||||
glMultiTexCoord2f(GL_TEXTURE1,
|
||||
noiseX,
|
||||
noiseTextureScale + noiseY);
|
||||
} else if (type == QUAD_BLOOM_COMBINE){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.f, (GLfloat) height * 0.5f);
|
||||
glMultiTexCoord2f(GL_TEXTURE1, 0.f, (GLfloat) height * 0.5f);
|
||||
}
|
||||
glVertex2f(0.f, (GLfloat) screenH - height);
|
||||
|
||||
if (type != QUAD_BLOOM_EXTRACT){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, 0.f);
|
||||
glMultiTexCoord2f(GL_TEXTURE0, 0.f, 0.f);
|
||||
} else {
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, 0.f, 0.f);
|
||||
glMultiTexCoord2f(GL_TEXTURE0, 0.f, 0.f);
|
||||
}
|
||||
if (type == QUAD_NOISE){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB,
|
||||
glMultiTexCoord2f(GL_TEXTURE1,
|
||||
noiseX,
|
||||
noiseY);
|
||||
} else if (type == QUAD_BLOOM_COMBINE){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, 0.f, 0.f);
|
||||
glMultiTexCoord2f(GL_TEXTURE1, 0.f, 0.f);
|
||||
}
|
||||
glVertex2f(0.f, (GLfloat) height + (screenH - height));
|
||||
|
||||
|
||||
if (type != QUAD_BLOOM_EXTRACT){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width, 0.f);
|
||||
glMultiTexCoord2f(GL_TEXTURE0, (GLfloat) width, 0.f);
|
||||
} else {
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width * 2.0f, 0.f);
|
||||
glMultiTexCoord2f(GL_TEXTURE0, (GLfloat) width * 2.0f, 0.f);
|
||||
}
|
||||
if (type == QUAD_NOISE){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB,
|
||||
glMultiTexCoord2f(GL_TEXTURE1,
|
||||
screenRatio * noiseTextureScale + noiseX,
|
||||
noiseY);
|
||||
} else if (type == QUAD_BLOOM_COMBINE){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, (GLfloat) width * 0.5f, 0.f);
|
||||
glMultiTexCoord2f(GL_TEXTURE1, (GLfloat) width * 0.5f, 0.f);
|
||||
}
|
||||
glVertex2f((GLfloat) width, (GLfloat) height + (screenH - height));
|
||||
|
||||
|
||||
if (type != QUAD_BLOOM_EXTRACT){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width, (GLfloat) height);
|
||||
glMultiTexCoord2f(GL_TEXTURE0, (GLfloat) width, (GLfloat) height);
|
||||
} else {
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB, (GLfloat) width * 2.0f, (GLfloat) height * 2.0f);
|
||||
glMultiTexCoord2f(GL_TEXTURE0, (GLfloat) width * 2.0f, (GLfloat) height * 2.0f);
|
||||
}
|
||||
if (type == QUAD_NOISE){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB,
|
||||
glMultiTexCoord2f(GL_TEXTURE1,
|
||||
screenRatio * noiseTextureScale + noiseX,
|
||||
noiseTextureScale + noiseY);
|
||||
} else if (type == QUAD_BLOOM_COMBINE){
|
||||
glMultiTexCoord2fARB(GL_TEXTURE1_ARB, (GLfloat) width * 0.5f, (GLfloat) height * 0.5f);
|
||||
glMultiTexCoord2f(GL_TEXTURE1, (GLfloat) width * 0.5f, (GLfloat) height * 0.5f);
|
||||
}
|
||||
glVertex2f((GLfloat) width, (GLfloat) screenH - height);
|
||||
glEnd();
|
||||
|
|
@ -503,7 +503,7 @@ void LLPostProcess::createTexture(LLPointer<LLImageGL>& texture, unsigned int wi
|
|||
if(texture->createGLTexture())
|
||||
{
|
||||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_RECT_TEXTURE, texture->getTexName());
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 4, width, height, 0,
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE, 0, 4, width, height, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, &data[0]);
|
||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
|
||||
gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
|
|
@ -557,7 +557,7 @@ bool LLPostProcess::checkError(void)
|
|||
return retCode;
|
||||
}
|
||||
|
||||
void LLPostProcess::checkShaderError(GLhandleARB shader)
|
||||
void LLPostProcess::checkShaderError(GLuint shader)
|
||||
{
|
||||
GLint infologLength = 0;
|
||||
GLint charsWritten = 0;
|
||||
|
|
@ -565,7 +565,7 @@ void LLPostProcess::checkShaderError(GLhandleARB shader)
|
|||
|
||||
checkError(); // Check for OpenGL errors
|
||||
|
||||
glGetObjectParameterivARB(shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &infologLength);
|
||||
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infologLength);
|
||||
|
||||
checkError(); // Check for OpenGL errors
|
||||
|
||||
|
|
@ -577,7 +577,7 @@ void LLPostProcess::checkShaderError(GLhandleARB shader)
|
|||
/// Could not allocate infolog buffer
|
||||
return;
|
||||
}
|
||||
glGetInfoLogARB(shader, infologLength, &charsWritten, infoLog);
|
||||
glGetProgramInfoLog(shader, infologLength, &charsWritten, infoLog);
|
||||
// shaderErrorLog << (char *) infoLog << std::endl;
|
||||
mShaderErrorString = (char *) infoLog;
|
||||
free(infoLog);
|
||||
|
|
|
|||
|
|
@ -249,12 +249,12 @@ private:
|
|||
void applyColorFilterShader(void);
|
||||
|
||||
/// OpenGL Helper Functions
|
||||
void getShaderUniforms(glslUniforms & uniforms, GLhandleARB & prog);
|
||||
void getShaderUniforms(glslUniforms & uniforms, GLuint & prog);
|
||||
void createTexture(LLPointer<LLImageGL>& texture, unsigned int width, unsigned int height);
|
||||
void copyFrameBuffer(U32 & texture, unsigned int width, unsigned int height);
|
||||
void createNoiseTexture(LLPointer<LLImageGL>& texture);
|
||||
bool checkError(void);
|
||||
void checkShaderError(GLhandleARB shader);
|
||||
void checkShaderError(GLuint shader);
|
||||
void drawOrthoQuad(unsigned int width, unsigned int height, QuadType type);
|
||||
void viewOrthogonal(unsigned int width, unsigned int height);
|
||||
void changeOrthogonal(unsigned int width, unsigned int height);
|
||||
|
|
|
|||
|
|
@ -69,9 +69,9 @@ static const U32 LL_NUM_LIGHT_UNITS = 8;
|
|||
static const GLenum sGLTextureType[] =
|
||||
{
|
||||
GL_TEXTURE_2D,
|
||||
GL_TEXTURE_RECTANGLE_ARB,
|
||||
GL_TEXTURE_CUBE_MAP_ARB,
|
||||
GL_TEXTURE_CUBE_MAP_ARRAY_ARB,
|
||||
GL_TEXTURE_RECTANGLE,
|
||||
GL_TEXTURE_CUBE_MAP,
|
||||
GL_TEXTURE_CUBE_MAP_ARRAY,
|
||||
GL_TEXTURE_2D_MULTISAMPLE,
|
||||
GL_TEXTURE_3D
|
||||
};
|
||||
|
|
@ -123,7 +123,7 @@ void LLTexUnit::refreshState(void)
|
|||
|
||||
gGL.flush();
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + mIndex);
|
||||
glActiveTexture(GL_TEXTURE0 + mIndex);
|
||||
|
||||
if (mCurrTexType != TT_NONE)
|
||||
{
|
||||
|
|
@ -144,7 +144,7 @@ void LLTexUnit::activate(void)
|
|||
if ((S32)gGL.mCurrTextureUnitIndex != mIndex || gGL.mDirty)
|
||||
{
|
||||
gGL.flush();
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + mIndex);
|
||||
glActiveTexture(GL_TEXTURE0 + mIndex);
|
||||
gGL.mCurrTextureUnitIndex = mIndex;
|
||||
}
|
||||
}
|
||||
|
|
@ -188,7 +188,7 @@ void LLTexUnit::bindFast(LLTexture* texture)
|
|||
{
|
||||
LLImageGL* gl_tex = texture->getGLTexture();
|
||||
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + mIndex);
|
||||
glActiveTexture(GL_TEXTURE0 + mIndex);
|
||||
gGL.mCurrTextureUnitIndex = mIndex;
|
||||
mCurrTexture = gl_tex->getTexName();
|
||||
if (!mCurrTexture)
|
||||
|
|
@ -340,7 +340,7 @@ bool LLTexUnit::bind(LLCubeMap* cubeMap)
|
|||
activate();
|
||||
enable(LLTexUnit::TT_CUBE_MAP);
|
||||
mCurrTexture = cubeMap->mImages[0]->getTexName();
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, mCurrTexture);
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, mCurrTexture);
|
||||
mHasMipMaps = cubeMap->mImages[0]->mHasMipMaps;
|
||||
cubeMap->mImages[0]->updateBindStats();
|
||||
if (cubeMap->mImages[0]->mTexOptionsDirty)
|
||||
|
|
@ -470,7 +470,7 @@ void LLTexUnit::setTextureAddressMode(eTextureAddressMode mode)
|
|||
glTexParameteri (sGLTextureType[mCurrTexType], GL_TEXTURE_WRAP_T, sGLAddressMode[mode]);
|
||||
if (mCurrTexType == TT_CUBE_MAP)
|
||||
{
|
||||
glTexParameteri (GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_R, sGLAddressMode[mode]);
|
||||
glTexParameteri (GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, sGLAddressMode[mode]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -545,7 +545,7 @@ GLint LLTexUnit::getTextureSource(eTextureBlendSrc src)
|
|||
case TBS_PREV_ALPHA:
|
||||
case TBS_ONE_MINUS_PREV_COLOR:
|
||||
case TBS_ONE_MINUS_PREV_ALPHA:
|
||||
return GL_PREVIOUS_ARB;
|
||||
return GL_PREVIOUS;
|
||||
|
||||
// All four cases should return the same value.
|
||||
case TBS_TEX_COLOR:
|
||||
|
|
@ -559,18 +559,18 @@ GLint LLTexUnit::getTextureSource(eTextureBlendSrc src)
|
|||
case TBS_VERT_ALPHA:
|
||||
case TBS_ONE_MINUS_VERT_COLOR:
|
||||
case TBS_ONE_MINUS_VERT_ALPHA:
|
||||
return GL_PRIMARY_COLOR_ARB;
|
||||
return GL_PRIMARY_COLOR;
|
||||
|
||||
// All four cases should return the same value.
|
||||
case TBS_CONST_COLOR:
|
||||
case TBS_CONST_ALPHA:
|
||||
case TBS_ONE_MINUS_CONST_COLOR:
|
||||
case TBS_ONE_MINUS_CONST_ALPHA:
|
||||
return GL_CONSTANT_ARB;
|
||||
return GL_CONSTANT;
|
||||
|
||||
default:
|
||||
LL_WARNS() << "Unknown eTextureBlendSrc: " << src << ". Using Vertex Color instead." << LL_ENDL;
|
||||
return GL_PRIMARY_COLOR_ARB;
|
||||
return GL_PRIMARY_COLOR;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -639,10 +639,10 @@ void LLTexUnit::debugTextureUnit(void)
|
|||
if (mIndex < 0) return;
|
||||
|
||||
GLint activeTexture;
|
||||
glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &activeTexture);
|
||||
if ((GL_TEXTURE0_ARB + mIndex) != activeTexture)
|
||||
glGetIntegerv(GL_ACTIVE_TEXTURE, &activeTexture);
|
||||
if ((GL_TEXTURE0 + mIndex) != activeTexture)
|
||||
{
|
||||
U32 set_unit = (activeTexture - GL_TEXTURE0_ARB);
|
||||
U32 set_unit = (activeTexture - GL_TEXTURE0);
|
||||
LL_WARNS() << "Incorrect Texture Unit! Expected: " << set_unit << " Actual: " << mIndex << LL_ENDL;
|
||||
}
|
||||
}
|
||||
|
|
@ -875,9 +875,9 @@ void LLRender::init()
|
|||
#if LL_WINDOWS
|
||||
if (gGLManager.mHasDebugOutput && gDebugGL)
|
||||
{ //setup debug output callback
|
||||
//glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW_ARB, 0, NULL, GL_TRUE);
|
||||
glDebugMessageCallbackARB((GLDEBUGPROCARB) gl_debug_callback, NULL);
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB);
|
||||
//glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW_ARB, 0, NULL, GL_TRUE);
|
||||
glDebugMessageCallback((GLDEBUGPROC) gl_debug_callback, NULL);
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -1471,7 +1471,7 @@ void LLRender::blendFunc(eBlendFactor color_sfactor, eBlendFactor color_dfactor,
|
|||
llassert(color_dfactor < BF_UNDEF);
|
||||
llassert(alpha_sfactor < BF_UNDEF);
|
||||
llassert(alpha_dfactor < BF_UNDEF);
|
||||
if (!gGLManager.mHasBlendFuncSeparate)
|
||||
if (!LLRender::sGLCoreProfile && !gGLManager.mHasBlendFuncSeparate)
|
||||
{
|
||||
LL_WARNS_ONCE("render") << "no glBlendFuncSeparateEXT(), using color-only blend func" << LL_ENDL;
|
||||
blendFunc(color_sfactor, color_dfactor);
|
||||
|
|
@ -1485,8 +1485,9 @@ void LLRender::blendFunc(eBlendFactor color_sfactor, eBlendFactor color_dfactor,
|
|||
mCurrBlendColorDFactor = color_dfactor;
|
||||
mCurrBlendAlphaDFactor = alpha_dfactor;
|
||||
flush();
|
||||
glBlendFuncSeparateEXT(sGLBlendFactor[color_sfactor], sGLBlendFactor[color_dfactor],
|
||||
sGLBlendFactor[alpha_sfactor], sGLBlendFactor[alpha_dfactor]);
|
||||
|
||||
glBlendFuncSeparate(sGLBlendFactor[color_sfactor], sGLBlendFactor[color_dfactor],
|
||||
sGLBlendFactor[alpha_sfactor], sGLBlendFactor[alpha_dfactor]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -490,7 +490,7 @@ void LLRenderTarget::bindTarget()
|
|||
GL_COLOR_ATTACHMENT1,
|
||||
GL_COLOR_ATTACHMENT2,
|
||||
GL_COLOR_ATTACHMENT3};
|
||||
glDrawBuffersARB(mTex.size(), drawbuffers);
|
||||
glDrawBuffers(mTex.size(), drawbuffers);
|
||||
}
|
||||
|
||||
if (mTex.empty())
|
||||
|
|
|
|||
|
|
@ -558,26 +558,59 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader)
|
|||
//============================================================================
|
||||
// Load Shader
|
||||
|
||||
static std::string get_object_log(GLhandleARB ret)
|
||||
static std::string get_shader_log(GLuint ret)
|
||||
{
|
||||
std::string res;
|
||||
|
||||
//get log length
|
||||
GLint length;
|
||||
glGetObjectParameterivARB(ret, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length);
|
||||
glGetShaderiv(ret, GL_INFO_LOG_LENGTH, &length);
|
||||
if (length > 0)
|
||||
{
|
||||
//the log could be any size, so allocate appropriately
|
||||
GLcharARB* log = new GLcharARB[length];
|
||||
glGetInfoLogARB(ret, length, &length, log);
|
||||
GLchar* log = new GLchar[length];
|
||||
glGetShaderInfoLog(ret, length, &length, log);
|
||||
res = std::string((char *)log);
|
||||
delete[] log;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static std::string get_program_log(GLuint ret)
|
||||
{
|
||||
std::string res;
|
||||
|
||||
//get log length
|
||||
GLint length;
|
||||
glGetProgramiv(ret, GL_INFO_LOG_LENGTH, &length);
|
||||
if (length > 0)
|
||||
{
|
||||
//the log could be any size, so allocate appropriately
|
||||
GLchar* log = new GLchar[length];
|
||||
glGetProgramInfoLog(ret, length, &length, log);
|
||||
res = std::string((char*)log);
|
||||
delete[] log;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
// get the info log for the given object, be it a shader or program object
|
||||
// NOTE: ret MUST be a shader OR a program object
|
||||
static std::string get_object_log(GLuint ret)
|
||||
{
|
||||
if (glIsProgram(ret))
|
||||
{
|
||||
return get_program_log(ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
llassert(glIsShader(ret));
|
||||
return get_shader_log(ret);
|
||||
}
|
||||
}
|
||||
|
||||
//dump shader source for debugging
|
||||
void LLShaderMgr::dumpShaderSource(U32 shader_code_count, GLcharARB** shader_code_text)
|
||||
void LLShaderMgr::dumpShaderSource(U32 shader_code_count, GLchar** shader_code_text)
|
||||
{
|
||||
char num_str[16]; // U32 = max 10 digits
|
||||
|
||||
|
|
@ -592,9 +625,10 @@ void LLShaderMgr::dumpShaderSource(U32 shader_code_count, GLcharARB** shader_cod
|
|||
LL_CONT << LL_ENDL;
|
||||
}
|
||||
|
||||
void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns, const std::string& filename)
|
||||
void LLShaderMgr::dumpObjectLog(GLuint ret, BOOL warns, const std::string& filename)
|
||||
{
|
||||
std::string log = get_object_log(ret);
|
||||
std::string log;
|
||||
log = get_object_log(ret);
|
||||
std::string fname = filename;
|
||||
if (filename.empty())
|
||||
{
|
||||
|
|
@ -608,7 +642,7 @@ void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns, const std::string&
|
|||
}
|
||||
}
|
||||
|
||||
GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_map<std::string, std::string>* defines, S32 texture_index_channels)
|
||||
GLuint LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_map<std::string, std::string>* defines, S32 texture_index_channels)
|
||||
{
|
||||
|
||||
// endsure work-around for missing GLSL funcs gets propogated to feature shader files (e.g. srgbF.glsl)
|
||||
|
|
@ -679,9 +713,9 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||
|
||||
//we can't have any lines longer than 1024 characters
|
||||
//or any shaders longer than 4096 lines... deal - DaveP
|
||||
GLcharARB buff[1024];
|
||||
GLcharARB *extra_code_text[1024];
|
||||
GLcharARB *shader_code_text[4096 + LL_ARRAY_SIZE(extra_code_text)] = { NULL };
|
||||
GLchar buff[1024];
|
||||
GLchar *extra_code_text[1024];
|
||||
GLchar *shader_code_text[4096 + LL_ARRAY_SIZE(extra_code_text)] = { NULL };
|
||||
GLuint extra_code_count = 0, shader_code_count = 0;
|
||||
BOOST_STATIC_ASSERT(LL_ARRAY_SIZE(extra_code_text) < LL_ARRAY_SIZE(shader_code_text));
|
||||
|
||||
|
|
@ -763,7 +797,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||
|
||||
extra_code_text[extra_code_count++] = strdup("#define ATTRIBUTE in\n");
|
||||
|
||||
if (type == GL_VERTEX_SHADER_ARB)
|
||||
if (type == GL_VERTEX_SHADER)
|
||||
{ //"varying" state is "out" in a vertex program, "in" in a fragment program
|
||||
// ("varying" is deprecated after version 1.20)
|
||||
extra_code_text[extra_code_count++] = strdup("#define VARYING out\n");
|
||||
|
|
@ -800,7 +834,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||
for (std::unordered_map<std::string,std::string>::iterator iter = defines->begin(); iter != defines->end(); ++iter)
|
||||
{
|
||||
std::string define = "#define " + iter->first + " " + iter->second + "\n";
|
||||
extra_code_text[extra_code_count++] = (GLcharARB *) strdup(define.c_str());
|
||||
extra_code_text[extra_code_count++] = (GLchar *) strdup(define.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -809,7 +843,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||
extra_code_text[extra_code_count++] = strdup( "#define IS_AMD_CARD 1\n" );
|
||||
}
|
||||
|
||||
if (texture_index_channels > 0 && type == GL_FRAGMENT_SHADER_ARB)
|
||||
if (texture_index_channels > 0 && type == GL_FRAGMENT_SHADER)
|
||||
{
|
||||
//use specified number of texture channels for indexed texture rendering
|
||||
|
||||
|
|
@ -949,7 +983,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||
}
|
||||
else
|
||||
{
|
||||
shader_code_text[shader_code_count] = (GLcharARB *)strdup((char *)buff);
|
||||
shader_code_text[shader_code_count] = (GLchar *)strdup((char *)buff);
|
||||
|
||||
if(flag_write_to_out_of_extra_block_area & flags)
|
||||
{
|
||||
|
|
@ -986,40 +1020,40 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||
fclose(file);
|
||||
|
||||
//create shader object
|
||||
GLhandleARB ret = glCreateShaderObjectARB(type);
|
||||
GLuint ret = glCreateShader(type);
|
||||
|
||||
error = glGetError();
|
||||
if (error != GL_NO_ERROR)
|
||||
{
|
||||
LL_WARNS("ShaderLoading") << "GL ERROR in glCreateShaderObjectARB: " << error << " for file: " << open_file_name << LL_ENDL;
|
||||
LL_WARNS("ShaderLoading") << "GL ERROR in glCreateShader: " << error << " for file: " << open_file_name << LL_ENDL;
|
||||
}
|
||||
|
||||
//load source
|
||||
glShaderSourceARB(ret, shader_code_count, (const GLcharARB**) shader_code_text, NULL);
|
||||
glShaderSource(ret, shader_code_count, (const GLchar**) shader_code_text, NULL);
|
||||
|
||||
error = glGetError();
|
||||
if (error != GL_NO_ERROR)
|
||||
{
|
||||
LL_WARNS("ShaderLoading") << "GL ERROR in glShaderSourceARB: " << error << " for file: " << open_file_name << LL_ENDL;
|
||||
LL_WARNS("ShaderLoading") << "GL ERROR in glShaderSource: " << error << " for file: " << open_file_name << LL_ENDL;
|
||||
}
|
||||
|
||||
//compile source
|
||||
glCompileShaderARB(ret);
|
||||
glCompileShader(ret);
|
||||
|
||||
error = glGetError();
|
||||
if (error != GL_NO_ERROR)
|
||||
{
|
||||
LL_WARNS("ShaderLoading") << "GL ERROR in glCompileShaderARB: " << error << " for file: " << open_file_name << LL_ENDL;
|
||||
LL_WARNS("ShaderLoading") << "GL ERROR in glCompileShader: " << error << " for file: " << open_file_name << LL_ENDL;
|
||||
}
|
||||
|
||||
if (error == GL_NO_ERROR)
|
||||
{
|
||||
//check for errors
|
||||
GLint success = GL_TRUE;
|
||||
glGetObjectParameterivARB(ret, GL_OBJECT_COMPILE_STATUS_ARB, &success);
|
||||
glGetShaderiv(ret, GL_COMPILE_STATUS, &success);
|
||||
|
||||
error = glGetError();
|
||||
if (error != GL_NO_ERROR || success == GL_FALSE)
|
||||
if (error != GL_NO_ERROR || success == GL_FALSE)
|
||||
{
|
||||
//an error occured, print log
|
||||
LL_WARNS("ShaderLoading") << "GLSL Compilation Error:" << LL_ENDL;
|
||||
|
|
@ -1044,10 +1078,10 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||
if (ret)
|
||||
{
|
||||
// Add shader file to map
|
||||
if (type == GL_VERTEX_SHADER_ARB) {
|
||||
if (type == GL_VERTEX_SHADER) {
|
||||
mVertexShaderObjects[filename] = ret;
|
||||
}
|
||||
else if (type == GL_FRAGMENT_SHADER_ARB) {
|
||||
else if (type == GL_FRAGMENT_SHADER) {
|
||||
mFragmentShaderObjects[filename] = ret;
|
||||
}
|
||||
shader_level = try_gpu_class;
|
||||
|
|
@ -1064,19 +1098,21 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
|
|||
return ret;
|
||||
}
|
||||
|
||||
BOOL LLShaderMgr::linkProgramObject(GLhandleARB obj, BOOL suppress_errors)
|
||||
BOOL LLShaderMgr::linkProgramObject(GLuint obj, BOOL suppress_errors)
|
||||
{
|
||||
//check for errors
|
||||
glLinkProgramARB(obj);
|
||||
glLinkProgram(obj);
|
||||
GLint success = GL_TRUE;
|
||||
glGetObjectParameterivARB(obj, GL_OBJECT_LINK_STATUS_ARB, &success);
|
||||
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_object_log(obj);
|
||||
std::string log = get_program_log(obj);
|
||||
LLStringUtil::toLower(log);
|
||||
if (log.find("software") != std::string::npos)
|
||||
{
|
||||
|
|
@ -1087,12 +1123,12 @@ BOOL LLShaderMgr::linkProgramObject(GLhandleARB obj, BOOL suppress_errors)
|
|||
return success;
|
||||
}
|
||||
|
||||
BOOL LLShaderMgr::validateProgramObject(GLhandleARB obj)
|
||||
BOOL LLShaderMgr::validateProgramObject(GLuint obj)
|
||||
{
|
||||
//check program validity against current GL
|
||||
glValidateProgramARB(obj);
|
||||
glValidateProgram(obj);
|
||||
GLint success = GL_TRUE;
|
||||
glGetObjectParameterivARB(obj, GL_OBJECT_VALIDATE_STATUS_ARB, &success);
|
||||
glGetProgramiv(obj, GL_LINK_STATUS, &success);
|
||||
if (success == GL_FALSE)
|
||||
{
|
||||
LL_SHADER_LOADING_WARNS() << "GLSL program not valid: " << LL_ENDL;
|
||||
|
|
@ -1173,7 +1209,7 @@ void LLShaderMgr::initAttribsAndUniforms()
|
|||
mReservedUniforms.push_back("emissiveColor");
|
||||
mReservedUniforms.push_back("metallicFactor");
|
||||
mReservedUniforms.push_back("roughnessFactor");
|
||||
|
||||
|
||||
mReservedUniforms.push_back("diffuseMap");
|
||||
mReservedUniforms.push_back("altDiffuseMap");
|
||||
mReservedUniforms.push_back("specularMap");
|
||||
|
|
|
|||
|
|
@ -269,11 +269,11 @@ public:
|
|||
virtual void initAttribsAndUniforms(void);
|
||||
|
||||
BOOL attachShaderFeatures(LLGLSLShader * shader);
|
||||
void dumpObjectLog(GLhandleARB ret, BOOL warns = TRUE, const std::string& filename = "");
|
||||
void dumpShaderSource(U32 shader_code_count, GLcharARB** shader_code_text);
|
||||
BOOL linkProgramObject(GLhandleARB obj, BOOL suppress_errors = FALSE);
|
||||
BOOL validateProgramObject(GLhandleARB obj);
|
||||
GLhandleARB loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_map<std::string, std::string>* defines = NULL, S32 texture_index_channels = -1);
|
||||
void dumpObjectLog(GLuint ret, BOOL warns = TRUE, const std::string& filename = "");
|
||||
void dumpShaderSource(U32 shader_code_count, GLchar** shader_code_text);
|
||||
BOOL linkProgramObject(GLuint obj, BOOL suppress_errors = FALSE);
|
||||
BOOL validateProgramObject(GLuint obj);
|
||||
GLuint loadShaderFile(const std::string& filename, S32 & shader_level, GLenum type, std::unordered_map<std::string, std::string>* defines = NULL, S32 texture_index_channels = -1);
|
||||
|
||||
// Implemented in the application to actually point to the shader directory.
|
||||
virtual std::string getShaderDirPrefix(void) = 0; // Pure Virtual
|
||||
|
|
@ -283,8 +283,8 @@ public:
|
|||
|
||||
public:
|
||||
// Map of shader names to compiled
|
||||
std::map<std::string, GLhandleARB> mVertexShaderObjects;
|
||||
std::map<std::string, GLhandleARB> mFragmentShaderObjects;
|
||||
std::map<std::string, GLuint> mVertexShaderObjects;
|
||||
std::map<std::string, GLuint> mFragmentShaderObjects;
|
||||
|
||||
//global (reserved slot) shader parameters
|
||||
std::vector<std::string> mReservedAttribs;
|
||||
|
|
|
|||
|
|
@ -83,11 +83,11 @@ const U32 LL_VBO_POOL_SEED_COUNT = vbo_block_index(LL_VBO_POOL_MAX_SEED_SIZE);
|
|||
//============================================================================
|
||||
|
||||
//static
|
||||
LLVBOPool LLVertexBuffer::sStreamVBOPool(GL_STREAM_DRAW_ARB, GL_ARRAY_BUFFER_ARB);
|
||||
LLVBOPool LLVertexBuffer::sDynamicVBOPool(GL_DYNAMIC_DRAW_ARB, GL_ARRAY_BUFFER_ARB);
|
||||
LLVBOPool LLVertexBuffer::sDynamicCopyVBOPool(GL_DYNAMIC_COPY_ARB, GL_ARRAY_BUFFER_ARB);
|
||||
LLVBOPool LLVertexBuffer::sStreamIBOPool(GL_STREAM_DRAW_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB);
|
||||
LLVBOPool LLVertexBuffer::sDynamicIBOPool(GL_DYNAMIC_DRAW_ARB, GL_ELEMENT_ARRAY_BUFFER_ARB);
|
||||
LLVBOPool LLVertexBuffer::sStreamVBOPool(GL_STREAM_DRAW, GL_ARRAY_BUFFER);
|
||||
LLVBOPool LLVertexBuffer::sDynamicVBOPool(GL_DYNAMIC_DRAW, GL_ARRAY_BUFFER);
|
||||
LLVBOPool LLVertexBuffer::sDynamicCopyVBOPool(GL_DYNAMIC_COPY, GL_ARRAY_BUFFER);
|
||||
LLVBOPool LLVertexBuffer::sStreamIBOPool(GL_STREAM_DRAW, GL_ELEMENT_ARRAY_BUFFER);
|
||||
LLVBOPool LLVertexBuffer::sDynamicIBOPool(GL_DYNAMIC_DRAW, GL_ELEMENT_ARRAY_BUFFER);
|
||||
|
||||
U32 LLVBOPool::sBytesPooled = 0;
|
||||
U32 LLVBOPool::sIndexBytesPooled = 0;
|
||||
|
|
@ -127,7 +127,7 @@ U32 LLVBOPool::genBuffer()
|
|||
|
||||
if (sNameIdx == 0)
|
||||
{
|
||||
glGenBuffersARB(1024, sNamePool);
|
||||
glGenBuffers(1024, sNamePool);
|
||||
sNameIdx = 1024;
|
||||
}
|
||||
|
||||
|
|
@ -141,11 +141,11 @@ void LLVBOPool::deleteBuffer(U32 name)
|
|||
{
|
||||
LLVertexBuffer::unbind();
|
||||
|
||||
glBindBufferARB(mType, name);
|
||||
glBufferDataARB(mType, 0, NULL, mUsage);
|
||||
glBindBufferARB(mType, 0);
|
||||
glBindBuffer(mType, name);
|
||||
glBufferData(mType, 0, NULL, mUsage);
|
||||
glBindBuffer(mType, 0);
|
||||
|
||||
glDeleteBuffersARB(1, &name);
|
||||
glDeleteBuffers(1, &name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -176,14 +176,14 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed)
|
|||
//make a new buffer
|
||||
name = genBuffer();
|
||||
|
||||
glBindBufferARB(mType, name);
|
||||
glBindBuffer(mType, name);
|
||||
|
||||
if (!for_seed && i < LL_VBO_POOL_SEED_COUNT)
|
||||
{ //record this miss
|
||||
mMissCount[i]++;
|
||||
}
|
||||
|
||||
if (mType == GL_ARRAY_BUFFER_ARB)
|
||||
if (mType == GL_ARRAY_BUFFER)
|
||||
{
|
||||
LLVertexBuffer::sAllocatedBytes += size;
|
||||
}
|
||||
|
|
@ -192,10 +192,10 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed)
|
|||
LLVertexBuffer::sAllocatedIndexBytes += size;
|
||||
}
|
||||
|
||||
if (LLVertexBuffer::sDisableVBOMapping || mUsage != GL_DYNAMIC_DRAW_ARB)
|
||||
if (LLVertexBuffer::sDisableVBOMapping || mUsage != GL_DYNAMIC_DRAW)
|
||||
{
|
||||
glBufferDataARB(mType, size, 0, mUsage);
|
||||
if (mUsage != GL_DYNAMIC_COPY_ARB)
|
||||
glBufferData(mType, size, 0, mUsage);
|
||||
if (mUsage != GL_DYNAMIC_COPY)
|
||||
{ //data will be provided by application
|
||||
ret = (U8*) ll_aligned_malloc<64>(size);
|
||||
if (!ret)
|
||||
|
|
@ -212,10 +212,10 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed)
|
|||
}
|
||||
else
|
||||
{ //always use a true hint of static draw when allocating non-client-backed buffers
|
||||
glBufferDataARB(mType, size, 0, GL_STATIC_DRAW_ARB);
|
||||
glBufferData(mType, size, 0, GL_STATIC_DRAW);
|
||||
}
|
||||
|
||||
glBindBufferARB(mType, 0);
|
||||
glBindBuffer(mType, 0);
|
||||
|
||||
if (for_seed)
|
||||
{ //put into pool for future use
|
||||
|
|
@ -225,7 +225,7 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed)
|
|||
rec.mGLName = name;
|
||||
rec.mClientData = ret;
|
||||
|
||||
if (mType == GL_ARRAY_BUFFER_ARB)
|
||||
if (mType == GL_ARRAY_BUFFER)
|
||||
{
|
||||
sBytesPooled += size;
|
||||
}
|
||||
|
|
@ -241,7 +241,7 @@ U8* LLVBOPool::allocate(U32& name, U32 size, bool for_seed)
|
|||
name = mFreeList[i].front().mGLName;
|
||||
ret = mFreeList[i].front().mClientData;
|
||||
|
||||
if (mType == GL_ARRAY_BUFFER_ARB)
|
||||
if (mType == GL_ARRAY_BUFFER)
|
||||
{
|
||||
sBytesPooled -= size;
|
||||
}
|
||||
|
|
@ -263,7 +263,7 @@ void LLVBOPool::release(U32 name, U8* buffer, U32 size)
|
|||
deleteBuffer(name);
|
||||
ll_aligned_free_fallback((U8*) buffer);
|
||||
|
||||
if (mType == GL_ARRAY_BUFFER_ARB)
|
||||
if (mType == GL_ARRAY_BUFFER)
|
||||
{
|
||||
LLVertexBuffer::sAllocatedBytes -= size;
|
||||
}
|
||||
|
|
@ -322,7 +322,7 @@ void LLVBOPool::cleanup()
|
|||
|
||||
l.pop_front();
|
||||
|
||||
if (mType == GL_ARRAY_BUFFER_ARB)
|
||||
if (mType == GL_ARRAY_BUFFER)
|
||||
{
|
||||
sBytesPooled -= size;
|
||||
LLVertexBuffer::sAllocatedBytes -= size;
|
||||
|
|
@ -451,14 +451,14 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask)
|
|||
{ //was enabled
|
||||
if (!(data_mask & mask))
|
||||
{ //needs to be disabled
|
||||
glDisableVertexAttribArrayARB(loc);
|
||||
glDisableVertexAttribArray(loc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ //was disabled
|
||||
if (data_mask & mask)
|
||||
{ //needs to be enabled
|
||||
glEnableVertexAttribArrayARB(loc);
|
||||
glEnableVertexAttribArray(loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -763,12 +763,12 @@ void LLVertexBuffer::unbind()
|
|||
|
||||
if (sVBOActive)
|
||||
{
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
sVBOActive = false;
|
||||
}
|
||||
if (sIBOActive)
|
||||
{
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
sIBOActive = false;
|
||||
}
|
||||
|
||||
|
|
@ -801,32 +801,32 @@ S32 LLVertexBuffer::determineUsage(S32 usage)
|
|||
ret_usage = 0;
|
||||
}
|
||||
|
||||
if (ret_usage == GL_STREAM_DRAW_ARB && !sUseStreamDraw)
|
||||
if (ret_usage == GL_STREAM_DRAW && !sUseStreamDraw)
|
||||
{
|
||||
ret_usage = 0;
|
||||
}
|
||||
|
||||
if (ret_usage == GL_DYNAMIC_DRAW_ARB && sPreferStreamDraw)
|
||||
if (ret_usage == GL_DYNAMIC_DRAW && sPreferStreamDraw)
|
||||
{
|
||||
ret_usage = GL_STREAM_DRAW_ARB;
|
||||
ret_usage = GL_STREAM_DRAW;
|
||||
}
|
||||
|
||||
if (ret_usage == 0 && LLRender::sGLCoreProfile)
|
||||
{ //MUST use VBOs for all rendering
|
||||
ret_usage = GL_STREAM_DRAW_ARB;
|
||||
ret_usage = GL_STREAM_DRAW;
|
||||
}
|
||||
|
||||
if (ret_usage && ret_usage != GL_STREAM_DRAW_ARB)
|
||||
if (ret_usage && ret_usage != GL_STREAM_DRAW)
|
||||
{ //only stream_draw and dynamic_draw are supported when using VBOs, dynamic draw is the default
|
||||
if (ret_usage != GL_DYNAMIC_COPY_ARB)
|
||||
if (ret_usage != GL_DYNAMIC_COPY)
|
||||
{
|
||||
if (sDisableVBOMapping)
|
||||
{ //always use stream draw if VBO mapping is disabled
|
||||
ret_usage = GL_STREAM_DRAW_ARB;
|
||||
ret_usage = GL_STREAM_DRAW;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret_usage = GL_DYNAMIC_DRAW_ARB;
|
||||
ret_usage = GL_DYNAMIC_DRAW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -859,7 +859,7 @@ LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage)
|
|||
mMappable(false),
|
||||
mFence(NULL)
|
||||
{
|
||||
mMappable = (mUsage == GL_DYNAMIC_DRAW_ARB && !sDisableVBOMapping);
|
||||
mMappable = (mUsage == GL_DYNAMIC_DRAW && !sDisableVBOMapping);
|
||||
|
||||
//zero out offsets
|
||||
for (U32 i = 0; i < TYPE_MAX; i++)
|
||||
|
|
@ -982,11 +982,11 @@ void LLVertexBuffer::genBuffer(U32 size)
|
|||
{
|
||||
mSize = vbo_block_size(size);
|
||||
|
||||
if (mUsage == GL_STREAM_DRAW_ARB)
|
||||
if (mUsage == GL_STREAM_DRAW)
|
||||
{
|
||||
mMappedData = sStreamVBOPool.allocate(mGLBuffer, mSize);
|
||||
}
|
||||
else if (mUsage == GL_DYNAMIC_DRAW_ARB)
|
||||
else if (mUsage == GL_DYNAMIC_DRAW)
|
||||
{
|
||||
mMappedData = sDynamicVBOPool.allocate(mGLBuffer, mSize);
|
||||
}
|
||||
|
|
@ -1003,7 +1003,7 @@ void LLVertexBuffer::genIndices(U32 size)
|
|||
{
|
||||
mIndicesSize = vbo_block_size(size);
|
||||
|
||||
if (mUsage == GL_STREAM_DRAW_ARB)
|
||||
if (mUsage == GL_STREAM_DRAW)
|
||||
{
|
||||
mMappedIndexData = sStreamIBOPool.allocate(mGLIndices, mIndicesSize);
|
||||
}
|
||||
|
|
@ -1017,7 +1017,7 @@ void LLVertexBuffer::genIndices(U32 size)
|
|||
|
||||
void LLVertexBuffer::releaseBuffer()
|
||||
{
|
||||
if (mUsage == GL_STREAM_DRAW_ARB)
|
||||
if (mUsage == GL_STREAM_DRAW)
|
||||
{
|
||||
sStreamVBOPool.release(mGLBuffer, mMappedData, mSize);
|
||||
}
|
||||
|
|
@ -1034,7 +1034,7 @@ void LLVertexBuffer::releaseBuffer()
|
|||
|
||||
void LLVertexBuffer::releaseIndices()
|
||||
{
|
||||
if (mUsage == GL_STREAM_DRAW_ARB)
|
||||
if (mUsage == GL_STREAM_DRAW)
|
||||
{
|
||||
sStreamIBOPool.release(mGLIndices, mMappedIndexData, mIndicesSize);
|
||||
}
|
||||
|
|
@ -1334,7 +1334,7 @@ void LLVertexBuffer::setupVertexArray()
|
|||
{
|
||||
if (mTypeMask & (1 << i))
|
||||
{
|
||||
glEnableVertexAttribArrayARB(i);
|
||||
glEnableVertexAttribArray(i);
|
||||
|
||||
if (attrib_integer[i])
|
||||
{
|
||||
|
|
@ -1360,14 +1360,14 @@ void LLVertexBuffer::setupVertexArray()
|
|||
// pointer value. Ruslan asserts that in this case the last
|
||||
// param is interpreted as an array data offset within the VBO
|
||||
// rather than as an actual pointer, so it's okay.
|
||||
glVertexAttribPointerARB(i, attrib_size[i], attrib_type[i],
|
||||
glVertexAttribPointer(i, attrib_size[i], attrib_type[i],
|
||||
attrib_normalized[i], sTypeSize[i],
|
||||
reinterpret_cast<GLvoid*>(intptr_t(mOffsets[i])));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
glDisableVertexAttribArrayARB(i);
|
||||
glDisableVertexAttribArray(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1499,7 +1499,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran
|
|||
#ifdef GL_ARB_map_buffer_range
|
||||
S32 offset = mOffsets[type] + sTypeSize[type]*index;
|
||||
S32 length = (sTypeSize[type]*count+0xF) & ~0xF;
|
||||
src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER_ARB, offset, length,
|
||||
src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER, offset, length,
|
||||
GL_MAP_WRITE_BIT |
|
||||
GL_MAP_FLUSH_EXPLICIT_BIT |
|
||||
GL_MAP_INVALIDATE_RANGE_BIT);
|
||||
|
|
@ -1512,7 +1512,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran
|
|||
if (gDebugGL)
|
||||
{
|
||||
GLint size = 0;
|
||||
glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size);
|
||||
glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &size);
|
||||
|
||||
if (size < mSize)
|
||||
{
|
||||
|
|
@ -1520,7 +1520,7 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran
|
|||
}
|
||||
}
|
||||
|
||||
src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER_ARB, 0, mSize,
|
||||
src = (U8*) glMapBufferRange(GL_ARRAY_BUFFER, 0, mSize,
|
||||
GL_MAP_WRITE_BIT |
|
||||
GL_MAP_FLUSH_EXPLICIT_BIT);
|
||||
#endif
|
||||
|
|
@ -1530,21 +1530,17 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran
|
|||
{
|
||||
if (map_range)
|
||||
{
|
||||
#ifndef LL_MESA_HEADLESS
|
||||
glBufferParameteriAPPLE(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE);
|
||||
glBufferParameteriAPPLE(GL_ARRAY_BUFFER_ARB, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE);
|
||||
#endif
|
||||
src = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
src = (U8*) glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
|
||||
}
|
||||
else
|
||||
{
|
||||
src = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
src = (U8*) glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
map_range = false;
|
||||
src = (U8*) glMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
src = (U8*) glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
|
||||
}
|
||||
|
||||
llassert(src != NULL);
|
||||
|
|
@ -1568,8 +1564,8 @@ U8* LLVertexBuffer::mapVertexBuffer(S32 type, S32 index, S32 count, bool map_ran
|
|||
//print out more debug info before crash
|
||||
LL_INFOS() << "vertex buffer size: (num verts : num indices) = " << getNumVerts() << " : " << getNumIndices() << LL_ENDL;
|
||||
GLint size;
|
||||
glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size);
|
||||
LL_INFOS() << "GL_ARRAY_BUFFER_ARB size is " << size << LL_ENDL;
|
||||
glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &size);
|
||||
LL_INFOS() << "GL_ARRAY_BUFFER size is " << size << LL_ENDL;
|
||||
//--------------------
|
||||
|
||||
GLint buff;
|
||||
|
|
@ -1684,7 +1680,7 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
|
|||
#ifdef GL_ARB_map_buffer_range
|
||||
S32 offset = sizeof(U16)*index;
|
||||
S32 length = sizeof(U16)*count;
|
||||
src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length,
|
||||
src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER, offset, length,
|
||||
GL_MAP_WRITE_BIT |
|
||||
GL_MAP_FLUSH_EXPLICIT_BIT |
|
||||
GL_MAP_INVALIDATE_RANGE_BIT);
|
||||
|
|
@ -1693,7 +1689,7 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
|
|||
else
|
||||
{
|
||||
#ifdef GL_ARB_map_buffer_range
|
||||
src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, sizeof(U16)*mNumIndices,
|
||||
src = (U8*) glMapBufferRange(GL_ELEMENT_ARRAY_BUFFER, 0, sizeof(U16)*mNumIndices,
|
||||
GL_MAP_WRITE_BIT |
|
||||
GL_MAP_FLUSH_EXPLICIT_BIT);
|
||||
#endif
|
||||
|
|
@ -1703,21 +1699,17 @@ U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range)
|
|||
{
|
||||
if (map_range)
|
||||
{
|
||||
#ifndef LL_MESA_HEADLESS
|
||||
glBufferParameteriAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_SERIALIZED_MODIFY_APPLE, GL_FALSE);
|
||||
glBufferParameteriAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_FLUSHING_UNMAP_APPLE, GL_FALSE);
|
||||
#endif
|
||||
src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
src = (U8*) glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY);
|
||||
}
|
||||
else
|
||||
{
|
||||
src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
src = (U8*) glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
map_range = false;
|
||||
src = (U8*) glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
src = (U8*) glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY);
|
||||
}
|
||||
|
||||
llassert(src != NULL);
|
||||
|
|
@ -1793,12 +1785,12 @@ void LLVertexBuffer::unmapBuffer()
|
|||
S32 length = sTypeSize[region.mType]*region.mCount;
|
||||
if (mSize >= length + offset)
|
||||
{
|
||||
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, offset, length, (U8*)mMappedData + offset);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, offset, length, (U8*)mMappedData + offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLint size = 0;
|
||||
glGetBufferParameterivARB(GL_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size);
|
||||
glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &size);
|
||||
LL_WARNS() << "Attempted to map regions to a buffer that is too small, "
|
||||
<< "mapped size: " << mSize
|
||||
<< ", gl buffer size: " << size
|
||||
|
|
@ -1814,7 +1806,7 @@ void LLVertexBuffer::unmapBuffer()
|
|||
else
|
||||
{
|
||||
stop_glerror();
|
||||
glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, getSize(), (U8*) mMappedData);
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, getSize(), (U8*) mMappedData);
|
||||
stop_glerror();
|
||||
}
|
||||
}
|
||||
|
|
@ -1832,15 +1824,7 @@ void LLVertexBuffer::unmapBuffer()
|
|||
S32 length = sTypeSize[region.mType]*region.mCount;
|
||||
if (gGLManager.mHasMapBufferRange)
|
||||
{
|
||||
#ifdef GL_ARB_map_buffer_range
|
||||
glFlushMappedBufferRange(GL_ARRAY_BUFFER_ARB, offset, length);
|
||||
#endif
|
||||
}
|
||||
else if (gGLManager.mHasFlushBufferRange)
|
||||
{
|
||||
#ifndef LL_MESA_HEADLESS
|
||||
glFlushMappedBufferRangeAPPLE(GL_ARRAY_BUFFER_ARB, offset, length);
|
||||
#endif
|
||||
glFlushMappedBufferRange(GL_ARRAY_BUFFER, offset, length);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1848,7 +1832,7 @@ void LLVertexBuffer::unmapBuffer()
|
|||
}
|
||||
}
|
||||
stop_glerror();
|
||||
glUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
stop_glerror();
|
||||
|
||||
mMappedData = NULL;
|
||||
|
|
@ -1873,12 +1857,12 @@ void LLVertexBuffer::unmapBuffer()
|
|||
S32 length = sizeof(U16)*region.mCount;
|
||||
if (mIndicesSize >= length + offset)
|
||||
{
|
||||
glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length, (U8*) mMappedIndexData+offset);
|
||||
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, offset, length, (U8*) mMappedIndexData+offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLint size = 0;
|
||||
glGetBufferParameterivARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_BUFFER_SIZE_ARB, &size);
|
||||
glGetBufferParameteriv(GL_ELEMENT_ARRAY_BUFFER, GL_BUFFER_SIZE, &size);
|
||||
LL_WARNS() << "Attempted to map regions to a buffer that is too small, "
|
||||
<< "mapped size: " << mIndicesSize
|
||||
<< ", gl buffer size: " << size
|
||||
|
|
@ -1894,7 +1878,7 @@ void LLVertexBuffer::unmapBuffer()
|
|||
else
|
||||
{
|
||||
stop_glerror();
|
||||
glBufferSubDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0, getIndicesSize(), (U8*) mMappedIndexData);
|
||||
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, getIndicesSize(), (U8*) mMappedIndexData);
|
||||
stop_glerror();
|
||||
}
|
||||
}
|
||||
|
|
@ -1912,17 +1896,7 @@ void LLVertexBuffer::unmapBuffer()
|
|||
S32 length = sizeof(U16)*region.mCount;
|
||||
if (gGLManager.mHasMapBufferRange)
|
||||
{
|
||||
#ifdef GL_ARB_map_buffer_range
|
||||
glFlushMappedBufferRange(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length);
|
||||
#endif
|
||||
}
|
||||
else if (gGLManager.mHasFlushBufferRange)
|
||||
{
|
||||
#ifdef GL_APPLE_flush_buffer_range
|
||||
#ifndef LL_MESA_HEADLESS
|
||||
glFlushMappedBufferRangeAPPLE(GL_ELEMENT_ARRAY_BUFFER_ARB, offset, length);
|
||||
#endif
|
||||
#endif
|
||||
glFlushMappedBufferRange(GL_ELEMENT_ARRAY_BUFFER, offset, length);
|
||||
}
|
||||
stop_glerror();
|
||||
}
|
||||
|
|
@ -1931,7 +1905,7 @@ void LLVertexBuffer::unmapBuffer()
|
|||
}
|
||||
}
|
||||
|
||||
glUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB);
|
||||
glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER);
|
||||
|
||||
mMappedIndexData = NULL;
|
||||
}
|
||||
|
|
@ -2085,7 +2059,7 @@ bool LLVertexBuffer::bindGLBuffer(bool force_bind)
|
|||
if (useVBOs() && (force_bind || (mGLBuffer && (mGLBuffer != sGLRenderBuffer || !sVBOActive))))
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX;
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, mGLBuffer);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, mGLBuffer);
|
||||
sGLRenderBuffer = mGLBuffer;
|
||||
sBindCount++;
|
||||
sVBOActive = true;
|
||||
|
|
@ -2102,7 +2076,7 @@ bool LLVertexBuffer::bindGLBufferFast()
|
|||
{
|
||||
if (mGLBuffer != sGLRenderBuffer || !sVBOActive)
|
||||
{
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, mGLBuffer);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, mGLBuffer);
|
||||
sGLRenderBuffer = mGLBuffer;
|
||||
sBindCount++;
|
||||
sVBOActive = true;
|
||||
|
|
@ -2125,7 +2099,7 @@ bool LLVertexBuffer::bindGLIndices(bool force_bind)
|
|||
{
|
||||
LL_ERRS() << "VBO bound while another VBO mapped!" << LL_ENDL;
|
||||
}*/
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mGLIndices);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mGLIndices);
|
||||
sGLRenderIndices = mGLIndices;
|
||||
stop_glerror();
|
||||
sBindCount++;
|
||||
|
|
@ -2140,7 +2114,7 @@ bool LLVertexBuffer::bindGLIndicesFast()
|
|||
{
|
||||
if (mGLIndices != sGLRenderIndices || !sIBOActive)
|
||||
{
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, mGLIndices);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mGLIndices);
|
||||
sGLRenderIndices = mGLIndices;
|
||||
sBindCount++;
|
||||
sIBOActive = true;
|
||||
|
|
@ -2302,7 +2276,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
|
|||
{
|
||||
if (sVBOActive)
|
||||
{
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
sBindCount++;
|
||||
sVBOActive = false;
|
||||
setup = true; // ... or a VBO is deactivated
|
||||
|
|
@ -2317,7 +2291,7 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
|
|||
{
|
||||
if (sIBOActive)
|
||||
{
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
sBindCount++;
|
||||
sIBOActive = false;
|
||||
}
|
||||
|
|
@ -2392,74 +2366,74 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask)
|
|||
{
|
||||
S32 loc = TYPE_NORMAL;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_NORMAL]);
|
||||
glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], ptr);
|
||||
glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TEXCOORD3)
|
||||
{
|
||||
S32 loc = TYPE_TEXCOORD3;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD3]);
|
||||
glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], ptr);
|
||||
glVertexAttribPointer(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TEXCOORD2)
|
||||
{
|
||||
S32 loc = TYPE_TEXCOORD2;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD2]);
|
||||
glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], ptr);
|
||||
glVertexAttribPointer(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TEXCOORD1)
|
||||
{
|
||||
S32 loc = TYPE_TEXCOORD1;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD1]);
|
||||
glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], ptr);
|
||||
glVertexAttribPointer(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TANGENT)
|
||||
{
|
||||
S32 loc = TYPE_TANGENT;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_TANGENT]);
|
||||
glVertexAttribPointerARB(loc, 4,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TANGENT], ptr);
|
||||
glVertexAttribPointer(loc, 4,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TANGENT], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TEXCOORD0)
|
||||
{
|
||||
S32 loc = TYPE_TEXCOORD0;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD0]);
|
||||
glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], ptr);
|
||||
glVertexAttribPointer(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], ptr);
|
||||
}
|
||||
if (data_mask & MAP_COLOR)
|
||||
{
|
||||
S32 loc = TYPE_COLOR;
|
||||
//bind emissive instead of color pointer if emissive is present
|
||||
void* ptr = (data_mask & MAP_EMISSIVE) ? (void*)(base + mOffsets[TYPE_EMISSIVE]) : (void*)(base + mOffsets[TYPE_COLOR]);
|
||||
glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], ptr);
|
||||
}
|
||||
if (data_mask & MAP_EMISSIVE)
|
||||
{
|
||||
S32 loc = TYPE_EMISSIVE;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_EMISSIVE]);
|
||||
glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr);
|
||||
|
||||
if (!(data_mask & MAP_COLOR))
|
||||
{ //map emissive to color channel when color is not also being bound to avoid unnecessary shader swaps
|
||||
loc = TYPE_COLOR;
|
||||
glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr);
|
||||
}
|
||||
}
|
||||
if (data_mask & MAP_WEIGHT)
|
||||
{
|
||||
S32 loc = TYPE_WEIGHT;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_WEIGHT]);
|
||||
glVertexAttribPointerARB(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr);
|
||||
glVertexAttribPointer(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr);
|
||||
}
|
||||
if (data_mask & MAP_WEIGHT4)
|
||||
{
|
||||
S32 loc = TYPE_WEIGHT4;
|
||||
void* ptr = (void*)(base+mOffsets[TYPE_WEIGHT4]);
|
||||
glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr);
|
||||
}
|
||||
if (data_mask & MAP_CLOTHWEIGHT)
|
||||
{
|
||||
S32 loc = TYPE_CLOTHWEIGHT;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]);
|
||||
glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_FLOAT, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TEXTURE_INDEX &&
|
||||
(gGLManager.mGLSLVersionMajor >= 2 || gGLManager.mGLSLVersionMinor >= 30)) //indexed texture rendering requires GLSL 1.30 or later
|
||||
|
|
@ -2474,7 +2448,7 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask)
|
|||
{
|
||||
S32 loc = TYPE_VERTEX;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_VERTEX]);
|
||||
glVertexAttribPointerARB(loc, 3,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr);
|
||||
glVertexAttribPointer(loc, 3,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr);
|
||||
}
|
||||
|
||||
llglassertok();
|
||||
|
|
@ -2488,74 +2462,74 @@ void LLVertexBuffer::setupVertexBufferFast(U32 data_mask)
|
|||
{
|
||||
S32 loc = TYPE_NORMAL;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_NORMAL]);
|
||||
glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], ptr);
|
||||
glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TEXCOORD3)
|
||||
{
|
||||
S32 loc = TYPE_TEXCOORD3;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD3]);
|
||||
glVertexAttribPointerARB(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], ptr);
|
||||
glVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TEXCOORD2)
|
||||
{
|
||||
S32 loc = TYPE_TEXCOORD2;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD2]);
|
||||
glVertexAttribPointerARB(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], ptr);
|
||||
glVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TEXCOORD1)
|
||||
{
|
||||
S32 loc = TYPE_TEXCOORD1;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD1]);
|
||||
glVertexAttribPointerARB(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], ptr);
|
||||
glVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TANGENT)
|
||||
{
|
||||
S32 loc = TYPE_TANGENT;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_TANGENT]);
|
||||
glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TANGENT], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TANGENT], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TEXCOORD0)
|
||||
{
|
||||
S32 loc = TYPE_TEXCOORD0;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD0]);
|
||||
glVertexAttribPointerARB(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], ptr);
|
||||
glVertexAttribPointer(loc, 2, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], ptr);
|
||||
}
|
||||
if (data_mask & MAP_COLOR)
|
||||
{
|
||||
S32 loc = TYPE_COLOR;
|
||||
//bind emissive instead of color pointer if emissive is present
|
||||
void* ptr = (data_mask & MAP_EMISSIVE) ? (void*)(base + mOffsets[TYPE_EMISSIVE]) : (void*)(base + mOffsets[TYPE_COLOR]);
|
||||
glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], ptr);
|
||||
}
|
||||
if (data_mask & MAP_EMISSIVE)
|
||||
{
|
||||
S32 loc = TYPE_EMISSIVE;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_EMISSIVE]);
|
||||
glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr);
|
||||
|
||||
if (!(data_mask & MAP_COLOR))
|
||||
{ //map emissive to color channel when color is not also being bound to avoid unnecessary shader swaps
|
||||
loc = TYPE_COLOR;
|
||||
glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr);
|
||||
}
|
||||
}
|
||||
if (data_mask & MAP_WEIGHT)
|
||||
{
|
||||
S32 loc = TYPE_WEIGHT;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_WEIGHT]);
|
||||
glVertexAttribPointerARB(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr);
|
||||
glVertexAttribPointer(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr);
|
||||
}
|
||||
if (data_mask & MAP_WEIGHT4)
|
||||
{
|
||||
S32 loc = TYPE_WEIGHT4;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_WEIGHT4]);
|
||||
glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr);
|
||||
}
|
||||
if (data_mask & MAP_CLOTHWEIGHT)
|
||||
{
|
||||
S32 loc = TYPE_CLOTHWEIGHT;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]);
|
||||
glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr);
|
||||
glVertexAttribPointer(loc, 4, GL_FLOAT, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr);
|
||||
}
|
||||
if (data_mask & MAP_TEXTURE_INDEX)
|
||||
{
|
||||
|
|
@ -2569,7 +2543,7 @@ void LLVertexBuffer::setupVertexBufferFast(U32 data_mask)
|
|||
{
|
||||
S32 loc = TYPE_VERTEX;
|
||||
void* ptr = (void*)(base + mOffsets[TYPE_VERTEX]);
|
||||
glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr);
|
||||
glVertexAttribPointer(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ public:
|
|||
U8* getMappedIndices() const { return mMappedIndexData; }
|
||||
S32 getOffset(S32 type) const { return mOffsets[type]; }
|
||||
S32 getUsage() const { return mUsage; }
|
||||
bool isWriteable() const { return (mMappable || mUsage == GL_STREAM_DRAW_ARB) ? true : false; }
|
||||
bool isWriteable() const { return (mMappable || mUsage == GL_STREAM_DRAW) ? true : false; }
|
||||
|
||||
void draw(U32 mode, U32 count, U32 indices_offset) const;
|
||||
void drawArrays(U32 mode, U32 offset, U32 count) const;
|
||||
|
|
|
|||
|
|
@ -261,6 +261,7 @@ attributedStringInfo getSegments(NSAttributedString *str)
|
|||
NSOpenGLPFADepthSize, 24,
|
||||
NSOpenGLPFAAlphaSize, 8,
|
||||
NSOpenGLPFAColorSize, 24,
|
||||
NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion4_1Core,
|
||||
0
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -161,7 +161,11 @@ float getDepth(vec2 pos_screen)
|
|||
|
||||
vec4 getTexture2DLodAmbient(vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
#ifndef FXAA_GLSL_120
|
||||
vec4 ret = textureLod(projectionMap, tc, lod);
|
||||
#else
|
||||
vec4 ret = texture2D(projectionMap, tc);
|
||||
#endif
|
||||
ret.rgb = srgb_to_linear(ret.rgb);
|
||||
|
||||
vec2 dist = tc-vec2(0.5);
|
||||
|
|
@ -173,7 +177,11 @@ vec4 getTexture2DLodAmbient(vec2 tc, float lod)
|
|||
|
||||
vec4 getTexture2DLodDiffuse(vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
#ifndef FXAA_GLSL_120
|
||||
vec4 ret = textureLod(projectionMap, tc, lod);
|
||||
#else
|
||||
vec4 ret = texture2D(projectionMap, tc);
|
||||
#endif
|
||||
ret.rgb = srgb_to_linear(ret.rgb);
|
||||
|
||||
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
||||
|
|
@ -216,7 +224,11 @@ vec3 getProjectedLightDiffuseColor(float light_distance, vec2 projected_uv)
|
|||
|
||||
vec4 texture2DLodSpecular(vec2 tc, float lod)
|
||||
{
|
||||
vec4 ret = texture2DLod(projectionMap, tc, lod);
|
||||
#ifndef FXAA_GLSL_120
|
||||
vec4 ret = textureLod(projectionMap, tc, lod);
|
||||
#else
|
||||
vec4 ret = texture2D(projectionMap, tc);
|
||||
#endif
|
||||
ret.rgb = srgb_to_linear(ret.rgb);
|
||||
|
||||
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
|
||||
|
|
|
|||
|
|
@ -76,10 +76,15 @@ uniform vec3 moon_dir;
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SHADOW
|
||||
VARYING vec3 vary_fragcoord;
|
||||
uniform vec2 screen_res;
|
||||
#endif
|
||||
|
||||
VARYING vec3 vary_position;
|
||||
VARYING vec4 vertex_color;
|
||||
VARYING vec2 vary_texcoord0;
|
||||
|
||||
#ifdef HAS_NORMAL_MAP
|
||||
VARYING vec3 vary_normal;
|
||||
VARYING vec3 vary_mat0;
|
||||
|
|
@ -100,7 +105,7 @@ uniform float minimum_alpha; // PBR alphaMode: MASK, See: mAlphaCutoff, setAlpha
|
|||
// See: LLRender::syncLightState()
|
||||
uniform vec4 light_position[8];
|
||||
uniform vec3 light_direction[8]; // spot direction
|
||||
uniform vec4 light_attenuation[8]; // linear, quadratic, ?, ?
|
||||
uniform vec4 light_attenuation[8]; // linear, quadratic, is omni, unused, See: LLPipeline::setupHWLights() and syncLightState()
|
||||
uniform vec3 light_diffuse[8];
|
||||
|
||||
vec2 encode_normal(vec3 n);
|
||||
|
|
@ -116,14 +121,16 @@ float calcLegacyDistanceAttenuation(float distance, float falloff);
|
|||
vec2 getGGX( vec2 brdfPoint );
|
||||
void initMaterial( vec3 diffuse, vec3 packedORM,
|
||||
out float alphaRough, out vec3 c_diff, out vec3 reflect0, out vec3 reflect90, out float specWeight );
|
||||
float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);
|
||||
void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyEnv,
|
||||
vec3 pos, vec3 norm, float glossiness, float envIntensity);
|
||||
|
||||
vec3 hue_to_rgb(float hue);
|
||||
|
||||
// lp = light position
|
||||
// la = light radius
|
||||
// la = linear attenuation, light radius
|
||||
// fa = falloff
|
||||
// See: LLRender::syncLightState()
|
||||
vec3 calcPointLightOrSpotLight(vec3 reflect0, vec3 c_diff,
|
||||
vec3 lightColor, vec3 diffuse, vec3 v, vec3 n, vec4 lp, vec3 ln,
|
||||
float la, float fa, float is_pointlight, float ambiance)
|
||||
|
|
@ -164,15 +171,8 @@ void main()
|
|||
vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
|
||||
vec3 pos = vary_position;
|
||||
|
||||
#if defined(HAS_SUN_SHADOW) || defined(HAS_SSAO)
|
||||
vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;
|
||||
scol_ambocc = pow(scol_ambocc, vec2(light_gamma));
|
||||
float scol = max(scol_ambocc.r, diffuse.a);
|
||||
float ambocc = scol_ambocc.g;
|
||||
#else
|
||||
float scol = 1.0;
|
||||
float ambocc = 1.0;
|
||||
#endif
|
||||
|
||||
vec3 sunlit;
|
||||
vec3 amblit;
|
||||
|
|
@ -211,6 +211,12 @@ void main()
|
|||
tnorm = normalize(tnorm.xyz);
|
||||
norm.xyz = tnorm.xyz;
|
||||
|
||||
#if HAS_SHADOW
|
||||
vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
|
||||
frag *= screen_res;
|
||||
scol = sampleDirectionalShadow(pos.xyz, norm.xyz, frag);
|
||||
#endif
|
||||
|
||||
// RGB = Occlusion, Roughness, Metal
|
||||
// default values, see LLViewerFetchedTexture::sWhiteImagep since roughnessFactor and metallicFactor are multiplied in
|
||||
// occlusion 1.0
|
||||
|
|
@ -304,11 +310,10 @@ irradiance = vec3(amblit);
|
|||
#endif
|
||||
}
|
||||
vec3 col = colorDiffuse + colorEmissive + colorSpec;
|
||||
|
||||
vec3 light = vec3(0);
|
||||
|
||||
// Punctual lights
|
||||
#define LIGHT_LOOP(i) light += calcPointLightOrSpotLight( reflect0, c_diff, srgb_to_linear(light_diffuse[i].rgb), albedo.rgb, pos.xyz, n, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w );
|
||||
#define LIGHT_LOOP(i) light += srgb_to_linear(vec3(scol)) * calcPointLightOrSpotLight( reflect0, c_diff, srgb_to_linear(2.2*light_diffuse[i].rgb), albedo.rgb, pos.xyz, n, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w );
|
||||
|
||||
LIGHT_LOOP(1)
|
||||
LIGHT_LOOP(2)
|
||||
|
|
|
|||
|
|
@ -46,6 +46,11 @@ uniform mat4 modelview_projection_matrix;
|
|||
|
||||
uniform mat4 texture_matrix0;
|
||||
|
||||
#ifdef HAS_SHADOW
|
||||
VARYING vec3 vary_fragcoord;
|
||||
uniform float near_clip;
|
||||
#endif
|
||||
|
||||
ATTRIBUTE vec3 position;
|
||||
ATTRIBUTE vec4 diffuse_color;
|
||||
ATTRIBUTE vec3 normal;
|
||||
|
|
@ -82,12 +87,17 @@ void main()
|
|||
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
|
||||
vary_position = pos;
|
||||
#endif
|
||||
gl_Position = projection_matrix*vec4(pos,1.0);
|
||||
vec4 vert = projection_matrix * vec4(pos,1.0);
|
||||
#else
|
||||
//transform vertex
|
||||
gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
vec4 vert = modelview_projection_matrix * vec4(position.xyz, 1.0);
|
||||
#endif
|
||||
|
||||
gl_Position = vert;
|
||||
|
||||
#if HAS_SHADOW
|
||||
vary_fragcoord.xyz = vert.xyz + vec3(0,0,near_clip);
|
||||
#endif
|
||||
|
||||
vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
|
||||
|
||||
#ifdef HAS_NORMAL_MAP
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
uniform samplerCubeArray reflectionProbes;
|
||||
|
||||
layout (std140, binding = 1) uniform ReflectionProbes
|
||||
layout (std140) uniform ReflectionProbes
|
||||
{
|
||||
// list of OBBs for user override probes
|
||||
// box is a set of 3 planes outward facing planes and the depth of the box along that plane
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
uniform samplerCubeArray reflectionProbes;
|
||||
uniform samplerCubeArray irradianceProbes;
|
||||
|
||||
layout (std140, binding = 1) uniform ReflectionProbes
|
||||
layout (std140) uniform ReflectionProbes
|
||||
{
|
||||
// list of OBBs for user override probes
|
||||
// box is a set of 3 planes outward facing planes and the depth of the box along that plane
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@
|
|||
#define PBR_USE_IRRADIANCE_HACK 1
|
||||
|
||||
#define DEBUG_PBR_LIGHT_TYPE 0 // Output no global light to make it easier to see pointLight and spotLight
|
||||
#define DEBUG_PBR_PACKORM0 0 // Rough=0, Metal=0
|
||||
#define DEBUG_PBR_PACKORM1 0 // Rough=1, Metal=1
|
||||
#define DEBUG_PBR_PACK_ORM0 0 // Rough=0, Metal=0
|
||||
#define DEBUG_PBR_PACK_ORM1 0 // Rough=1, Metal=1
|
||||
#define DEBUG_PBR_TANGENT1 1 // Tangent = 1,0,0
|
||||
#define DEBUG_PBR_VERT2CAM1 0 // vertex2camera = 0,0,1
|
||||
#define DEBUG_PBR_SPECLIGHT051 0 // Force specLigh to be 0,0.5,1
|
||||
|
|
@ -76,6 +76,7 @@
|
|||
#define DEBUG_PBR_IRRADIANCE 0 // Output: Diffuse Irradiance, NOTE: SSAO is factored in
|
||||
#define DEBUG_PBR_FSS_ESS_LAMBERT 0 // Output: FssEssLambert
|
||||
#define DEBUG_PBR_EMS 0 // Output: Ems = (1 - BRDF Scale + BRDF Bias)
|
||||
#define DEBUG_PBR_EMS_AVG 0 // Output: Avg Ems
|
||||
#define DEBUG_PBR_AVG 0 // Output: Avg
|
||||
#define DEBUG_PBR_FMS_EMS 0 // Output: FmsEms
|
||||
#define DEBUG_PBR_DIFFUSE_K 0 // Output: diffuse FssEssLambert + FmsEms
|
||||
|
|
@ -114,6 +115,7 @@
|
|||
#define DEBUG_PBR_SUN_SPEC_FV 0 // F() * V()
|
||||
#define DEBUG_PBR_SUN_SPEC_DFV 0 // D() * F() * V()
|
||||
#define DEBUG_PBR_SUN_SPEC_NL_DFV 0 // nl * D() * F() * V()
|
||||
#define DEBUG_PBR_SUN_FINAL 0 // LAMBERT_NL + BRDF()
|
||||
|
||||
#define DEBUG_PBR_IOR 0 // Output: grayscale IOR
|
||||
#define DEBUG_PBR_REFLECT0_BASE 0 // Output: black reflect0 default from ior
|
||||
|
|
@ -338,9 +340,6 @@ void main()
|
|||
#if DEBUG_PBR_SPECLIGHT051
|
||||
specLight = vec3(0,0.5,1.0);
|
||||
irradiance = specLight;
|
||||
#endif
|
||||
#if HAS_IBL
|
||||
kSpec = mix( kSpec, iridescenceFresnel, iridescenceFactor);
|
||||
#endif
|
||||
vec3 FssEssGGX = kSpec*vScaleBias.x + vScaleBias.y;
|
||||
#if DEBUG_PBR_SPEC_IBL
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ void main()
|
|||
}
|
||||
}
|
||||
|
||||
#if DEBUG_SPOT_DIFFUSE
|
||||
#if DEBUG_PBR_SPOT_DIFFUSE
|
||||
final_color = vec3(nl * dist_atten);
|
||||
#endif
|
||||
#if DEBUG_SPOT_NL
|
||||
|
|
|
|||
|
|
@ -531,7 +531,7 @@ static void settings_to_globals()
|
|||
|
||||
LLSurface::setTextureSize(gSavedSettings.getU32("RegionTextureSize"));
|
||||
|
||||
LLRender::sGLCoreProfile = gSavedSettings.getBOOL("RenderGLContextCoreProfile");
|
||||
LLRender::sGLCoreProfile = TRUE; // Now required, ignoring gSavedSettings.getBOOL("RenderGLContextCoreProfile");
|
||||
LLRender::sNsightDebugSupport = gSavedSettings.getBOOL("RenderNsightDebugSupport");
|
||||
LLVertexBuffer::sUseVAO = gSavedSettings.getBOOL("RenderUseVAO");
|
||||
LLImageGL::sGlobalUseAnisotropic = gSavedSettings.getBOOL("RenderAnisotropic");
|
||||
|
|
|
|||
|
|
@ -1252,7 +1252,7 @@ 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_ARB, regionp)
|
||||
LLSpatialPartition(data_mask, render_by_group, GL_STREAM_DRAW, regionp)
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWABLE
|
||||
|
||||
|
|
|
|||
|
|
@ -83,6 +83,11 @@ void LLDrawPoolAlpha::prerender()
|
|||
// TODO: is this even necessay? These are probably set to never discard
|
||||
LLViewerFetchedTexture::sFlatNormalImagep->addTextureStats(1024.f*1024.f);
|
||||
LLViewerFetchedTexture::sWhiteImagep->addTextureStats(1024.f * 1024.f);
|
||||
|
||||
if (LLPipeline::sRenderPBR)
|
||||
{
|
||||
gPipeline.setupHWLights(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
S32 LLDrawPoolAlpha::getNumPostDeferredPasses()
|
||||
|
|
@ -657,6 +662,9 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged)
|
|||
target_shader->uniform1f(LLShaderMgr::ROUGHNESS_FACTOR, params.mGLTFMaterial->mRoughnessFactor);
|
||||
target_shader->uniform1f(LLShaderMgr::METALLIC_FACTOR, params.mGLTFMaterial->mMetallicFactor);
|
||||
target_shader->uniform3fv(LLShaderMgr::EMISSIVE_COLOR, 1, params.mGLTFMaterial->mEmissiveColor.mV);
|
||||
|
||||
target_shader->mLightHash = 0;
|
||||
gGL.syncLightState(); // Set light uniforms
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
#include "llviewertexturelist.h"
|
||||
|
||||
static U32 sDataMask = LLDrawPoolAvatar::VERTEX_DATA_MASK;
|
||||
static U32 sBufferUsage = GL_STREAM_DRAW_ARB;
|
||||
static U32 sBufferUsage = GL_STREAM_DRAW;
|
||||
static U32 sShaderLevel = 0;
|
||||
|
||||
LLGLSLShader* LLDrawPoolAvatar::sVertexProgram = NULL;
|
||||
|
|
@ -146,11 +146,11 @@ void LLDrawPoolAvatar::prerender()
|
|||
|
||||
if (sShaderLevel > 0)
|
||||
{
|
||||
sBufferUsage = GL_DYNAMIC_DRAW_ARB;
|
||||
sBufferUsage = GL_DYNAMIC_DRAW;
|
||||
}
|
||||
else
|
||||
{
|
||||
sBufferUsage = GL_STREAM_DRAW_ARB;
|
||||
sBufferUsage = GL_STREAM_DRAW;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -934,7 +934,7 @@ LLColor3 LLDrawPoolAvatar::getDebugColor() const
|
|||
|
||||
LLVertexBufferAvatar::LLVertexBufferAvatar()
|
||||
: LLVertexBuffer(sDataMask,
|
||||
GL_STREAM_DRAW_ARB) //avatars are always stream draw due to morph targets
|
||||
GL_STREAM_DRAW) //avatars are always stream draw due to morph targets
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1224,7 +1224,7 @@ void LLFace::cacheFaceInVRAM(const LLVolumeFace& vf)
|
|||
mask |= LLVertexBuffer::MAP_WEIGHT4;
|
||||
}
|
||||
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(mask, GL_STATIC_DRAW_ARB);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(mask, GL_STATIC_DRAW);
|
||||
vf.mVertexBuffer = buff;
|
||||
|
||||
buff->allocateBuffer(vf.mNumVertices, 0, true);
|
||||
|
|
@ -1539,7 +1539,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
|
||||
#ifdef GL_TRANSFORM_FEEDBACK_BUFFER
|
||||
if (use_transform_feedback &&
|
||||
mVertexBuffer->getUsage() == GL_DYNAMIC_COPY_ARB &&
|
||||
mVertexBuffer->getUsage() == GL_DYNAMIC_COPY &&
|
||||
gTransformPositionProgram.mProgramObject && //transform shaders are loaded
|
||||
mVertexBuffer->useVBOs() && //target buffer is in VRAM
|
||||
!rebuild_weights && //TODO: add support for weights
|
||||
|
|
@ -1674,7 +1674,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|
|||
}
|
||||
}
|
||||
|
||||
glBindBufferARB(GL_TRANSFORM_FEEDBACK_BUFFER, 0);
|
||||
glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, 0);
|
||||
gGL.popMatrix();
|
||||
|
||||
if (cur_shader)
|
||||
|
|
|
|||
|
|
@ -607,7 +607,7 @@ void LLFeatureManager::applyFeatures(bool skipFeatures)
|
|||
void LLFeatureManager::setGraphicsLevel(U32 level, bool skipFeatures)
|
||||
{
|
||||
LLViewerShaderMgr::sSkipReload = true;
|
||||
|
||||
flush_glerror(); // Whatever may have already happened (e.g., to cause us to change), don't let confuse it with new initializations.
|
||||
applyBaseMasks();
|
||||
|
||||
// if we're passed an invalid level, default to "Low"
|
||||
|
|
|
|||
|
|
@ -1000,8 +1000,8 @@ F32 gpu_benchmark()
|
|||
gBenchmarkProgram.mName = "Benchmark Shader";
|
||||
gBenchmarkProgram.mFeatures.attachNothing = true;
|
||||
gBenchmarkProgram.mShaderFiles.clear();
|
||||
gBenchmarkProgram.mShaderFiles.push_back(std::make_pair("interface/benchmarkV.glsl", GL_VERTEX_SHADER_ARB));
|
||||
gBenchmarkProgram.mShaderFiles.push_back(std::make_pair("interface/benchmarkF.glsl", GL_FRAGMENT_SHADER_ARB));
|
||||
gBenchmarkProgram.mShaderFiles.push_back(std::make_pair("interface/benchmarkV.glsl", GL_VERTEX_SHADER));
|
||||
gBenchmarkProgram.mShaderFiles.push_back(std::make_pair("interface/benchmarkF.glsl", GL_FRAGMENT_SHADER));
|
||||
gBenchmarkProgram.mShaderLevel = 1;
|
||||
if (!gBenchmarkProgram.createShader(NULL, NULL))
|
||||
{
|
||||
|
|
@ -1084,7 +1084,7 @@ F32 gpu_benchmark()
|
|||
delete [] pixels;
|
||||
|
||||
//make a dummy triangle to draw with
|
||||
LLPointer<LLVertexBuffer> buff = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX, GL_STREAM_DRAW_ARB);
|
||||
LLPointer<LLVertexBuffer> buff = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX, GL_STREAM_DRAW);
|
||||
|
||||
if (!buff->allocateBuffer(3, 0, true))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -56,9 +56,16 @@ LLGLTFMaterial* LLGLTFMaterialList::getMaterial(const LLUUID& id)
|
|||
}
|
||||
|
||||
LLFileSystem file(id, asset_type, LLFileSystem::READ);
|
||||
auto size = file.getSize();
|
||||
if (!size)
|
||||
{
|
||||
LL_DEBUGS() << "Zero size material." << LL_ENDL;
|
||||
mat->unref();
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<char> buffer;
|
||||
buffer.resize(file.getSize());
|
||||
buffer.resize(size);
|
||||
file.read((U8*)&buffer[0], buffer.size());
|
||||
|
||||
LLSD asset;
|
||||
|
|
|
|||
|
|
@ -725,14 +725,14 @@ void LLReflectionMapManager::updateUniforms()
|
|||
//copy rpd into uniform buffer object
|
||||
if (mUBO == 0)
|
||||
{
|
||||
glGenBuffersARB(1, &mUBO);
|
||||
glGenBuffers(1, &mUBO);
|
||||
}
|
||||
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("rmmsu - update buffer");
|
||||
glBindBufferARB(GL_UNIFORM_BUFFER, mUBO);
|
||||
glBufferDataARB(GL_UNIFORM_BUFFER, sizeof(ReflectionProbeData), &rpd, GL_STREAM_DRAW);
|
||||
glBindBufferARB(GL_UNIFORM_BUFFER, 0);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, mUBO);
|
||||
glBufferData(GL_UNIFORM_BUFFER, sizeof(ReflectionProbeData), &rpd, GL_STREAM_DRAW);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -445,14 +445,14 @@ void LLSceneMonitor::calcDiffAggregate()
|
|||
|
||||
if(mDiffState == EXECUTE_DIFF)
|
||||
{
|
||||
glBeginQueryARB(GL_SAMPLES_PASSED_ARB, mQueryObject);
|
||||
glBeginQuery(GL_SAMPLES_PASSED_ARB, mQueryObject);
|
||||
}
|
||||
|
||||
gl_draw_scaled_target(0, 0, S32(mDiff->getWidth() * mDiffPixelRatio), S32(mDiff->getHeight() * mDiffPixelRatio), mDiff);
|
||||
|
||||
if(mDiffState == EXECUTE_DIFF)
|
||||
{
|
||||
glEndQueryARB(GL_SAMPLES_PASSED_ARB);
|
||||
glEndQuery(GL_SAMPLES_PASSED_ARB);
|
||||
mDiffState = WAIT_ON_RESULT;
|
||||
}
|
||||
|
||||
|
|
@ -483,11 +483,11 @@ void LLSceneMonitor::fetchQueryResult()
|
|||
mDiffState = WAITING_FOR_NEXT_DIFF;
|
||||
|
||||
GLuint available = 0;
|
||||
glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_AVAILABLE_ARB, &available);
|
||||
glGetQueryObjectuiv(mQueryObject, GL_QUERY_RESULT_AVAILABLE_ARB, &available);
|
||||
if(available)
|
||||
{
|
||||
GLuint count = 0;
|
||||
glGetQueryObjectuivARB(mQueryObject, GL_QUERY_RESULT_ARB, &count);
|
||||
glGetQueryObjectuiv(mQueryObject, GL_QUERY_RESULT_ARB, &count);
|
||||
|
||||
mDiffResult = sqrtf(count * 0.5f / (mDiff->getWidth() * mDiff->getHeight() * mDiffPixelRatio * mDiffPixelRatio)); //0.5 -> (front face + back face)
|
||||
|
||||
|
|
|
|||
|
|
@ -6112,7 +6112,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
|
|||
auto renderMeshSelection_f = [fogCfx, wireframe_selection](LLSelectNode* node, LLViewerObject* objectp, LLColor4 hlColor)
|
||||
{
|
||||
//Need to because crash on ATI 3800 (and similar cards) MAINT-5018
|
||||
LLGLDisable multisample(LLPipeline::RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
|
||||
LLGLDisable multisample(LLPipeline::RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0);
|
||||
|
||||
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
|
||||
|
||||
|
|
|
|||
|
|
@ -1581,7 +1581,7 @@ void renderOctree(LLSpatialGroup* group)
|
|||
if (group->mBuilt > 0.f)
|
||||
{
|
||||
group->mBuilt -= 2.f * gFrameIntervalSeconds.value();
|
||||
if (group->mBufferUsage == GL_STATIC_DRAW_ARB)
|
||||
if (group->mBufferUsage == GL_STATIC_DRAW)
|
||||
{
|
||||
col.setVec(1.0f, 0, 0, group->mBuilt*0.5f);
|
||||
}
|
||||
|
|
@ -1591,7 +1591,7 @@ void renderOctree(LLSpatialGroup* group)
|
|||
//col.setVec(1.0f, 1.0f, 0, sinf(group->mBuilt*3.14159f)*0.5f);
|
||||
}
|
||||
|
||||
if (group->mBufferUsage != GL_STATIC_DRAW_ARB)
|
||||
if (group->mBufferUsage != GL_STATIC_DRAW)
|
||||
{
|
||||
LLGLDepthTest gl_depth(FALSE, FALSE);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
|
|
@ -1686,7 +1686,7 @@ void renderOctree(LLSpatialGroup* group)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (group->mBufferUsage == GL_STATIC_DRAW_ARB && !group->isEmpty()
|
||||
if (group->mBufferUsage == GL_STATIC_DRAW && !group->isEmpty()
|
||||
&& group->getSpatialPartition()->mRenderByGroup)
|
||||
{
|
||||
col.setVec(0.8f, 0.4f, 0.1f, 0.1f);
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ void LLSprite::updateFace(LLFace &face)
|
|||
{
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX |
|
||||
LLVertexBuffer::MAP_TEXCOORD0,
|
||||
GL_STREAM_DRAW_ARB);
|
||||
GL_STREAM_DRAW);
|
||||
buff->allocateBuffer(4, 12, TRUE);
|
||||
face.setGeomIndex(0);
|
||||
face.setIndicesIndex(0);
|
||||
|
|
|
|||
|
|
@ -800,7 +800,7 @@ U32 LLOcclusionCullingGroup::getNewOcclusionQueryObjectName()
|
|||
{
|
||||
//seed 1024 query names into the free query pool
|
||||
GLuint queries[1024];
|
||||
glGenQueriesARB(1024, queries);
|
||||
glGenQueries(1024, queries);
|
||||
for (int i = 0; i < 1024; ++i)
|
||||
{
|
||||
sFreeQueries.push(queries[i]);
|
||||
|
|
@ -1129,7 +1129,7 @@ void LLOcclusionCullingGroup::checkOcclusion()
|
|||
GLuint available;
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_OCTREE("co - query available");
|
||||
glGetQueryObjectuivARB(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_AVAILABLE_ARB, &available);
|
||||
glGetQueryObjectuiv(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_AVAILABLE_ARB, &available);
|
||||
}
|
||||
|
||||
if (available)
|
||||
|
|
@ -1137,7 +1137,7 @@ void LLOcclusionCullingGroup::checkOcclusion()
|
|||
GLuint query_result; // Will be # samples drawn, or a boolean depending on mHasOcclusionQuery2 (both are type GLuint)
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED_CATEGORY_OCTREE("co - query result");
|
||||
glGetQueryObjectuivARB(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_ARB, &query_result);
|
||||
glGetQueryObjectuiv(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT_ARB, &query_result);
|
||||
}
|
||||
#if LL_TRACK_PENDING_OCCLUSION_QUERIES
|
||||
sPendingQueries.erase(mOcclusionQuery[LLViewerCamera::sCurCameraID]);
|
||||
|
|
@ -1250,7 +1250,7 @@ void LLOcclusionCullingGroup::doOcclusion(LLCamera* camera, const LLVector4a* sh
|
|||
//get an occlusion query that hasn't been used in awhile
|
||||
releaseOcclusionQueryObjectName(mOcclusionQuery[LLViewerCamera::sCurCameraID]);
|
||||
mOcclusionQuery[LLViewerCamera::sCurCameraID] = getNewOcclusionQueryObjectName();
|
||||
glBeginQueryARB(mode, mOcclusionQuery[LLViewerCamera::sCurCameraID]);
|
||||
glBeginQuery(mode, mOcclusionQuery[LLViewerCamera::sCurCameraID]);
|
||||
}
|
||||
|
||||
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
|
||||
|
|
@ -1292,7 +1292,7 @@ void LLOcclusionCullingGroup::doOcclusion(LLCamera* camera, const LLVector4a* sh
|
|||
|
||||
{
|
||||
LL_PROFILE_ZONE_NAMED("glEndQuery");
|
||||
glEndQueryARB(mode);
|
||||
glEndQuery(mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -594,7 +594,7 @@ U32 LLVOGrass::getPartitionType() const
|
|||
}
|
||||
|
||||
LLGrassPartition::LLGrassPartition(LLViewerRegion* regionp)
|
||||
: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, GL_STREAM_DRAW_ARB, regionp)
|
||||
: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, GL_STREAM_DRAW, regionp)
|
||||
{
|
||||
mDrawableType = LLPipeline::RENDER_TYPE_GRASS;
|
||||
mPartitionType = LLViewerRegion::PARTITION_GRASS;
|
||||
|
|
@ -602,7 +602,7 @@ LLGrassPartition::LLGrassPartition(LLViewerRegion* regionp)
|
|||
mDepthMask = TRUE;
|
||||
mSlopRatio = 0.1f;
|
||||
mRenderPass = LLRenderPass::PASS_GRASS;
|
||||
mBufferUsage = GL_DYNAMIC_DRAW_ARB;
|
||||
mBufferUsage = GL_DYNAMIC_DRAW;
|
||||
}
|
||||
|
||||
void LLGrassPartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_count, U32& index_count)
|
||||
|
|
@ -626,7 +626,7 @@ void LLGrassPartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_count
|
|||
|
||||
if (drawablep->isAnimating())
|
||||
{
|
||||
group->mBufferUsage = GL_STREAM_DRAW_ARB;
|
||||
group->mBufferUsage = GL_STREAM_DRAW;
|
||||
}
|
||||
|
||||
U32 count = 0;
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ BOOL LLVOGround::updateGeometry(LLDrawable *drawable)
|
|||
if (!face->getVertexBuffer())
|
||||
{
|
||||
face->setSize(5, 12);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolGround::VERTEX_DATA_MASK, GL_STREAM_DRAW_ARB);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolGround::VERTEX_DATA_MASK, GL_STREAM_DRAW);
|
||||
if (!buff->allocateBuffer(face->getGeomCount(), face->getIndicesCount(), TRUE))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer for VOGround to "
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ 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_ARB);
|
||||
sVB = new LLVertexBuffer(VERTEX_DATA_MASK | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2, GL_STREAM_DRAW);
|
||||
U32 count = LL_MAX_PARTICLE_COUNT;
|
||||
if (!sVB->allocateBuffer(count*4, count*6, true))
|
||||
{
|
||||
|
|
@ -738,7 +738,7 @@ U32 LLVOPartGroup::getPartitionType() const
|
|||
}
|
||||
|
||||
LLParticlePartition::LLParticlePartition(LLViewerRegion* regionp)
|
||||
: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, GL_STREAM_DRAW_ARB, regionp)
|
||||
: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, GL_STREAM_DRAW, regionp)
|
||||
{
|
||||
mRenderPass = LLRenderPass::PASS_ALPHA;
|
||||
mDrawableType = LLPipeline::RENDER_TYPE_PARTICLES;
|
||||
|
|
|
|||
|
|
@ -1010,7 +1010,7 @@ 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_ARB);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolSky::VERTEX_DATA_MASK, GL_STREAM_DRAW);
|
||||
buff->allocateBuffer(4, 6, TRUE);
|
||||
face->setVertexBuffer(buff);
|
||||
|
||||
|
|
@ -1139,7 +1139,7 @@ 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_ARB);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolSky::VERTEX_DATA_MASK, GL_STREAM_DRAW);
|
||||
if (!buff->allocateBuffer(facep->getGeomCount(), facep->getIndicesCount(), TRUE))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer for vosky to "
|
||||
|
|
@ -1379,7 +1379,7 @@ 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_ARB);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK, GL_STREAM_DRAW);
|
||||
if (!buff->allocateBuffer(face->getGeomCount(), face->getIndicesCount(), TRUE))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer for vosky to "
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class LLVertexBufferTerrain : public LLVertexBuffer
|
|||
{
|
||||
public:
|
||||
LLVertexBufferTerrain() :
|
||||
LLVertexBuffer(MAP_VERTEX | MAP_NORMAL | MAP_TEXCOORD0 | MAP_TEXCOORD1 | MAP_COLOR, GL_DYNAMIC_DRAW_ARB)
|
||||
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
|
||||
};
|
||||
|
|
@ -1001,7 +1001,7 @@ U32 LLVOSurfacePatch::getPartitionType() const
|
|||
}
|
||||
|
||||
LLTerrainPartition::LLTerrainPartition(LLViewerRegion* regionp)
|
||||
: LLSpatialPartition(LLDrawPoolTerrain::VERTEX_DATA_MASK, FALSE, GL_DYNAMIC_DRAW_ARB, regionp)
|
||||
: LLSpatialPartition(LLDrawPoolTerrain::VERTEX_DATA_MASK, FALSE, GL_DYNAMIC_DRAW, regionp)
|
||||
{
|
||||
mOcclusionEnabled = FALSE;
|
||||
mInfiniteFarClip = TRUE;
|
||||
|
|
|
|||
|
|
@ -921,7 +921,7 @@ void LLVOTree::updateMesh()
|
|||
|
||||
LLFace* facep = mDrawable->getFace(0);
|
||||
if (!facep) return;
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK, GL_STATIC_DRAW_ARB);
|
||||
LLVertexBuffer* buff = new LLVertexBuffer(LLDrawPoolTree::VERTEX_DATA_MASK, GL_STATIC_DRAW);
|
||||
if (!buff->allocateBuffer(vert_count, index_count, TRUE))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer on mesh update to "
|
||||
|
|
@ -1226,7 +1226,7 @@ U32 LLVOTree::getPartitionType() const
|
|||
}
|
||||
|
||||
LLTreePartition::LLTreePartition(LLViewerRegion* regionp)
|
||||
: LLSpatialPartition(0, FALSE, GL_DYNAMIC_DRAW_ARB, regionp)
|
||||
: LLSpatialPartition(0, FALSE, GL_DYNAMIC_DRAW, regionp)
|
||||
{
|
||||
mDrawableType = LLPipeline::RENDER_TYPE_TREE;
|
||||
mPartitionType = LLViewerRegion::PARTITION_TREE;
|
||||
|
|
|
|||
|
|
@ -5182,7 +5182,7 @@ U32 LLVOVolume::getPartitionType() const
|
|||
}
|
||||
|
||||
LLVolumePartition::LLVolumePartition(LLViewerRegion* regionp)
|
||||
: LLSpatialPartition(LLVOVolume::VERTEX_DATA_MASK, TRUE, GL_DYNAMIC_DRAW_ARB, regionp),
|
||||
: LLSpatialPartition(LLVOVolume::VERTEX_DATA_MASK, TRUE, GL_DYNAMIC_DRAW, regionp),
|
||||
LLVolumeGeometryManager()
|
||||
{
|
||||
mLODPeriod = 32;
|
||||
|
|
@ -5190,7 +5190,7 @@ LLVolumeGeometryManager()
|
|||
mDrawableType = LLPipeline::RENDER_TYPE_VOLUME;
|
||||
mPartitionType = LLViewerRegion::PARTITION_VOLUME;
|
||||
mSlopRatio = 0.25f;
|
||||
mBufferUsage = GL_DYNAMIC_DRAW_ARB;
|
||||
mBufferUsage = GL_DYNAMIC_DRAW;
|
||||
}
|
||||
|
||||
LLVolumeBridge::LLVolumeBridge(LLDrawable* drawablep, LLViewerRegion* regionp)
|
||||
|
|
@ -5202,7 +5202,7 @@ LLVolumeGeometryManager()
|
|||
mDrawableType = LLPipeline::RENDER_TYPE_VOLUME;
|
||||
mPartitionType = LLViewerRegion::PARTITION_BRIDGE;
|
||||
|
||||
mBufferUsage = GL_DYNAMIC_DRAW_ARB;
|
||||
mBufferUsage = GL_DYNAMIC_DRAW;
|
||||
|
||||
mSlopRatio = 0.25f;
|
||||
}
|
||||
|
|
@ -5788,7 +5788,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
|||
|
||||
if (drawablep->isAnimating())
|
||||
{ //fall back to stream draw for animating verts
|
||||
useage = GL_STREAM_DRAW_ARB;
|
||||
useage = GL_STREAM_DRAW;
|
||||
}
|
||||
|
||||
LLVOVolume* vobj = drawablep->getVOVolume();
|
||||
|
|
@ -5961,7 +5961,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
|
|||
|
||||
BOOL force_simple = (facep->getPixelArea() < FORCE_SIMPLE_RENDER_AREA);
|
||||
U32 type = gPipeline.getPoolTypeFromTE(te, tex);
|
||||
if (is_pbr && gltf_mat && gltf_mat->mAlphaMode != LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)
|
||||
if (is_pbr && gltf_mat && gltf_mat->mAlphaMode != LLGLTFMaterial::ALPHA_MODE_BLEND)
|
||||
{
|
||||
type = LLDrawPool::POOL_PBR_OPAQUE;
|
||||
}
|
||||
|
|
@ -6408,10 +6408,10 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
|||
|
||||
if (use_transform_feedback &&
|
||||
gTransformPositionProgram.mProgramObject && //transform shaders are loaded
|
||||
buffer_usage == GL_DYNAMIC_DRAW_ARB && //target buffer is in VRAM
|
||||
buffer_usage == GL_DYNAMIC_DRAW && //target buffer is in VRAM
|
||||
!(mask & LLVertexBuffer::MAP_WEIGHT4)) //TODO: add support for weights
|
||||
{
|
||||
buffer_usage = GL_DYNAMIC_COPY_ARB;
|
||||
buffer_usage = GL_DYNAMIC_COPY;
|
||||
}
|
||||
|
||||
#if LL_DARWIN
|
||||
|
|
@ -6645,9 +6645,9 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
|||
}
|
||||
|
||||
|
||||
if (flexi && buffer_usage && buffer_usage != GL_STREAM_DRAW_ARB)
|
||||
if (flexi && buffer_usage && buffer_usage != GL_STREAM_DRAW)
|
||||
{
|
||||
buffer_usage = GL_STREAM_DRAW_ARB;
|
||||
buffer_usage = GL_STREAM_DRAW;
|
||||
}
|
||||
|
||||
//create vertex buffer
|
||||
|
|
@ -6781,7 +6781,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
|
|||
|
||||
if (gltf_mat)
|
||||
{ // all other parameters ignored if gltf material is present
|
||||
if (gltf_mat->mAlphaMode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND)
|
||||
if (gltf_mat->mAlphaMode == LLGLTFMaterial::ALPHA_MODE_BLEND)
|
||||
registerFace(group, facep, LLRenderPass::PASS_ALPHA);
|
||||
else
|
||||
registerFace(group, facep, LLRenderPass::PASS_PBR_OPAQUE);
|
||||
|
|
@ -7068,7 +7068,7 @@ void LLVolumeGeometryManager::addGeometryCount(LLSpatialGroup* group, U32& verte
|
|||
|
||||
if (drawablep->isAnimating())
|
||||
{ //fall back to stream draw for animating verts
|
||||
usage = GL_STREAM_DRAW_ARB;
|
||||
usage = GL_STREAM_DRAW;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -7097,7 +7097,7 @@ void LLGeometryManager::addGeometryCount(LLSpatialGroup* group, U32 &vertex_coun
|
|||
|
||||
if (drawablep->isAnimating())
|
||||
{ //fall back to stream draw for animating verts
|
||||
usage = GL_STREAM_DRAW_ARB;
|
||||
usage = GL_STREAM_DRAW;
|
||||
}
|
||||
|
||||
//for each face
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ BOOL LLVOWater::updateGeometry(LLDrawable *drawable)
|
|||
LLVertexBuffer* buff = face->getVertexBuffer();
|
||||
if (!buff || !buff->isWriteable())
|
||||
{
|
||||
buff = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK, GL_DYNAMIC_DRAW_ARB);
|
||||
buff = new LLVertexBuffer(LLDrawPoolWater::VERTEX_DATA_MASK, GL_DYNAMIC_DRAW);
|
||||
if (!buff->allocateBuffer(face->getGeomCount(), face->getIndicesCount(), TRUE))
|
||||
{
|
||||
LL_WARNS() << "Failed to allocate Vertex Buffer on water update to "
|
||||
|
|
@ -295,7 +295,7 @@ U32 LLVOVoidWater::getPartitionType() const
|
|||
}
|
||||
|
||||
LLWaterPartition::LLWaterPartition(LLViewerRegion* regionp)
|
||||
: LLSpatialPartition(0, FALSE, GL_DYNAMIC_DRAW_ARB, regionp)
|
||||
: LLSpatialPartition(0, FALSE, GL_DYNAMIC_DRAW, regionp)
|
||||
{
|
||||
mInfiniteFarClip = TRUE;
|
||||
mDrawableType = LLPipeline::RENDER_TYPE_WATER;
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ BOOL LLVOWLSky::updateGeometry(LLDrawable * drawable)
|
|||
|
||||
if (mFsSkyVerts.isNull())
|
||||
{
|
||||
mFsSkyVerts = new LLVertexBuffer(LLDrawPoolWLSky::ADV_ATMO_SKY_VERTEX_DATA_MASK, GL_STATIC_DRAW_ARB);
|
||||
mFsSkyVerts = new LLVertexBuffer(LLDrawPoolWLSky::ADV_ATMO_SKY_VERTEX_DATA_MASK, GL_STATIC_DRAW);
|
||||
|
||||
if (!mFsSkyVerts->allocateBuffer(4, 6, TRUE))
|
||||
{
|
||||
|
|
@ -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_ARB);
|
||||
LLVertexBuffer * segment = new LLVertexBuffer(LLDrawPoolWLSky::SKY_VERTEX_DATA_MASK, GL_STATIC_DRAW);
|
||||
mStripsVerts[i] = segment;
|
||||
|
||||
U32 num_stacks_this_seg = stacks_per_seg;
|
||||
|
|
|
|||
|
|
@ -536,7 +536,7 @@ void LLPipeline::init()
|
|||
|
||||
if (mCubeVB.isNull())
|
||||
{
|
||||
mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX, GL_STATIC_DRAW_ARB);
|
||||
mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX, GL_STATIC_DRAW);
|
||||
}
|
||||
|
||||
mDeferredVB = new LLVertexBuffer(DEFERRED_VB_MASK, 0);
|
||||
|
|
@ -731,7 +731,7 @@ void LLPipeline::destroyGL()
|
|||
|
||||
if (mMeshDirtyQueryObject)
|
||||
{
|
||||
glDeleteQueriesARB(1, &mMeshDirtyQueryObject);
|
||||
glDeleteQueries(1, &mMeshDirtyQueryObject);
|
||||
mMeshDirtyQueryObject = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1293,7 +1293,7 @@ void LLPipeline::createGLBuffers()
|
|||
LLImageGL::generateTextures(1, &mNoiseMap);
|
||||
|
||||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mNoiseMap);
|
||||
LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB16F_ARB, noiseRes, noiseRes, GL_RGB, GL_FLOAT, noise, false);
|
||||
LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB16F, noiseRes, noiseRes, GL_RGB, GL_FLOAT, noise, false);
|
||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
|
||||
}
|
||||
|
||||
|
|
@ -1308,7 +1308,7 @@ void LLPipeline::createGLBuffers()
|
|||
|
||||
LLImageGL::generateTextures(1, &mTrueNoiseMap);
|
||||
gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, mTrueNoiseMap);
|
||||
LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB16F_ARB, noiseRes, noiseRes, GL_RGB,GL_FLOAT, noise, false);
|
||||
LLImageGL::setManualImage(LLTexUnit::getInternalType(LLTexUnit::TT_TEXTURE), 0, GL_RGB16F, noiseRes, noiseRes, GL_RGB,GL_FLOAT, noise, false);
|
||||
gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
|
||||
}
|
||||
|
||||
|
|
@ -1684,7 +1684,7 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima
|
|||
}
|
||||
}
|
||||
|
||||
if (alpha || (gltf_mat && gltf_mat->mAlphaMode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND))
|
||||
if (alpha || (gltf_mat && gltf_mat->mAlphaMode == LLGLTFMaterial::ALPHA_MODE_BLEND))
|
||||
{
|
||||
return LLDrawPool::POOL_ALPHA;
|
||||
}
|
||||
|
|
@ -2418,7 +2418,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, LLPlane* pla
|
|||
{
|
||||
if (mCubeVB.isNull())
|
||||
{ //cube VB will be used for issuing occlusion queries
|
||||
mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX, GL_STATIC_DRAW_ARB);
|
||||
mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX, GL_STATIC_DRAW);
|
||||
}
|
||||
mCubeVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
||||
}
|
||||
|
|
@ -2677,7 +2677,7 @@ void LLPipeline::doOcclusion(LLCamera& camera)
|
|||
|
||||
if (mCubeVB.isNull())
|
||||
{ //cube VB will be used for issuing occlusion queries
|
||||
mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX, GL_STATIC_DRAW_ARB);
|
||||
mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX, GL_STATIC_DRAW);
|
||||
}
|
||||
mCubeVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
||||
|
||||
|
|
@ -3918,11 +3918,11 @@ void LLPipeline::postSort(LLCamera& camera)
|
|||
|
||||
if (!mMeshDirtyQueryObject)
|
||||
{
|
||||
glGenQueriesARB(1, &mMeshDirtyQueryObject);
|
||||
glGenQueries(1, &mMeshDirtyQueryObject);
|
||||
}
|
||||
|
||||
|
||||
glBeginQueryARB(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, mMeshDirtyQueryObject);
|
||||
glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, mMeshDirtyQueryObject);
|
||||
}*/
|
||||
|
||||
//pack vertex buffers for groups that chose to delay their updates
|
||||
|
|
@ -3933,7 +3933,7 @@ void LLPipeline::postSort(LLCamera& camera)
|
|||
|
||||
/*if (use_transform_feedback)
|
||||
{
|
||||
glEndQueryARB(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
|
||||
glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
|
||||
}*/
|
||||
|
||||
mMeshDirtyGroup.clear();
|
||||
|
|
@ -4063,7 +4063,7 @@ void render_hud_elements()
|
|||
|
||||
if (!LLPipeline::sReflectionRender && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
|
||||
{
|
||||
LLGLEnable multisample(LLPipeline::RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
|
||||
LLGLEnable multisample(LLPipeline::RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0);
|
||||
gViewerWindow->renderSelections(FALSE, FALSE, FALSE); // For HUD version in render_ui_3d()
|
||||
|
||||
// Draw the tracking overlays
|
||||
|
|
@ -4371,7 +4371,7 @@ void LLPipeline::renderGeom(LLCamera& camera, bool forceVBOUpdate)
|
|||
gGL.matrixMode(LLRender::MM_MODELVIEW);
|
||||
|
||||
LLGLSPipeline gls_pipeline;
|
||||
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
|
||||
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0);
|
||||
|
||||
LLGLState gls_color_material(GL_COLOR_MATERIAL, mLightingDetail < 2);
|
||||
|
||||
|
|
@ -4592,7 +4592,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)
|
|||
}
|
||||
}
|
||||
|
||||
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
|
||||
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0);
|
||||
|
||||
LLVertexBuffer::unbind();
|
||||
|
||||
|
|
@ -4682,7 +4682,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera, bool do_occlusion)
|
|||
|
||||
LLGLEnable cull(GL_CULL_FACE);
|
||||
|
||||
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
|
||||
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0);
|
||||
|
||||
calcNearbyLights(camera);
|
||||
setupHWLights(NULL);
|
||||
|
|
@ -8078,7 +8078,7 @@ void LLPipeline::renderFinalize()
|
|||
gGL.getTexUnit(0)->bind(&mGlow[1]);
|
||||
gGL.getTexUnit(1)->bind(&mRT->screen);
|
||||
|
||||
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
|
||||
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0);
|
||||
|
||||
buff->setBuffer(mask);
|
||||
buff->drawArrays(LLRender::TRIANGLE_STRIP, 0, 3);
|
||||
|
|
@ -8246,8 +8246,8 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
|
|||
gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
stop_glerror();
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
|
||||
stop_glerror();
|
||||
}
|
||||
}
|
||||
|
|
@ -8268,8 +8268,8 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
|
|||
gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
|
||||
stop_glerror();
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
|
||||
stop_glerror();
|
||||
}
|
||||
}
|
||||
|
|
@ -8448,7 +8448,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget *screen_target)
|
|||
GL_NEAREST);
|
||||
}
|
||||
|
||||
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0);
|
||||
LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0);
|
||||
|
||||
if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD))
|
||||
{
|
||||
|
|
@ -8722,7 +8722,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget *screen_target)
|
|||
|
||||
if (mCubeVB.isNull())
|
||||
{
|
||||
mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX, GL_STATIC_DRAW_ARB);
|
||||
mCubeVB = ll_create_cube_vb(LLVertexBuffer::MAP_VERTEX, GL_STATIC_DRAW);
|
||||
}
|
||||
|
||||
mCubeVB->setBuffer(LLVertexBuffer::MAP_VERTEX);
|
||||
|
|
@ -9229,7 +9229,7 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader)
|
|||
{
|
||||
if (shader.disableTexture(LLShaderMgr::DEFERRED_SHADOW0+i) > -1)
|
||||
{
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -9237,7 +9237,7 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader)
|
|||
{
|
||||
if (shader.disableTexture(LLShaderMgr::DEFERRED_SHADOW0+i) > -1)
|
||||
{
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -11338,7 +11338,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar)
|
|||
if (LLPipeline::sRenderDeferred)
|
||||
{
|
||||
GLuint buff = GL_COLOR_ATTACHMENT0;
|
||||
glDrawBuffersARB(1, &buff);
|
||||
glDrawBuffers(1, &buff);
|
||||
}
|
||||
|
||||
LLGLDisable blend(GL_BLEND);
|
||||
|
|
|
|||
Loading…
Reference in New Issue