diff options
author | Dave Parks <davep@lindenlab.com> | 2022-11-17 13:35:39 -0600 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2022-11-17 13:35:39 -0600 |
commit | e2d1af5c4f7bdc04becb4a4fd56b7e9057bdfedc (patch) | |
tree | e8cb28fb6ee56322b5db81ef8a2b07c89c5697cb /indra/llrender/llglslshader.cpp | |
parent | d5395502525ad3ebcfa2b75be23544d022b18dbc (diff) |
SL-18154 Profile guided optimizations -- remove some unneeded operations and make LLDrawPoolMaterials less branchy.
Diffstat (limited to 'indra/llrender/llglslshader.cpp')
-rw-r--r-- | indra/llrender/llglslshader.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 661ea6c4fa..55b6f5e2a6 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -1215,8 +1215,18 @@ void LLGLSLShader::uniform1f(U32 index, GLfloat x) } } +void LLGLSLShader::fastUniform1f(U32 index, GLfloat x) +{ + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; + llassert(mProgramObject); + llassert(mUniform.size() <= index); + llassert(mUniform[index] >= 0); + glUniform1f(mUniform[index], x); +} + void LLGLSLShader::uniform2f(U32 index, GLfloat x, GLfloat y) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; if (mProgramObject) { if (mUniform.size() <= index) @@ -1240,6 +1250,7 @@ void LLGLSLShader::uniform2f(U32 index, GLfloat x, GLfloat y) void LLGLSLShader::uniform3f(U32 index, GLfloat x, GLfloat y, GLfloat z) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; if (mProgramObject) { if (mUniform.size() <= index) @@ -1263,6 +1274,7 @@ void LLGLSLShader::uniform3f(U32 index, GLfloat x, GLfloat y, GLfloat z) void LLGLSLShader::uniform4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; if (mProgramObject) { if (mUniform.size() <= index) @@ -1286,6 +1298,7 @@ void LLGLSLShader::uniform4f(U32 index, GLfloat x, GLfloat y, GLfloat z, GLfloat void LLGLSLShader::uniform1iv(U32 index, U32 count, const GLint* v) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; if (mProgramObject) { if (mUniform.size() <= index) @@ -1309,6 +1322,7 @@ void LLGLSLShader::uniform1iv(U32 index, U32 count, const GLint* v) void LLGLSLShader::uniform4iv(U32 index, U32 count, const GLint* v) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; if (mProgramObject) { if (mUniform.size() <= index) @@ -1333,6 +1347,7 @@ void LLGLSLShader::uniform4iv(U32 index, U32 count, const GLint* v) void LLGLSLShader::uniform1fv(U32 index, U32 count, const GLfloat* v) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; if (mProgramObject) { if (mUniform.size() <= index) @@ -1356,6 +1371,7 @@ void LLGLSLShader::uniform1fv(U32 index, U32 count, const GLfloat* v) void LLGLSLShader::uniform2fv(U32 index, U32 count, const GLfloat* v) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; if (mProgramObject) { if (mUniform.size() <= index) @@ -1379,6 +1395,7 @@ void LLGLSLShader::uniform2fv(U32 index, U32 count, const GLfloat* v) void LLGLSLShader::uniform3fv(U32 index, U32 count, const GLfloat* v) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; if (mProgramObject) { if (mUniform.size() <= index) @@ -1402,6 +1419,7 @@ void LLGLSLShader::uniform3fv(U32 index, U32 count, const GLfloat* v) void LLGLSLShader::uniform4fv(U32 index, U32 count, const GLfloat* v) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; if (mProgramObject) { if (mUniform.size() <= index) @@ -1426,6 +1444,7 @@ void LLGLSLShader::uniform4fv(U32 index, U32 count, const GLfloat* v) void LLGLSLShader::uniformMatrix2fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; if (mProgramObject) { if (mUniform.size() <= index) @@ -1443,6 +1462,7 @@ void LLGLSLShader::uniformMatrix2fv(U32 index, U32 count, GLboolean transpose, c void LLGLSLShader::uniformMatrix3fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; if (mProgramObject) { if (mUniform.size() <= index) @@ -1479,6 +1499,7 @@ void LLGLSLShader::uniformMatrix3x4fv(U32 index, U32 count, GLboolean transpose, void LLGLSLShader::uniformMatrix4fv(U32 index, U32 count, GLboolean transpose, const GLfloat *v) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; if (mProgramObject) { if (mUniform.size() <= index) @@ -1554,6 +1575,7 @@ GLint LLGLSLShader::getAttribLocation(U32 attrib) void LLGLSLShader::uniform1i(const LLStaticHashedString& uniform, GLint v) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; GLint location = getUniformLocation(uniform); if (location >= 0) @@ -1570,6 +1592,7 @@ void LLGLSLShader::uniform1i(const LLStaticHashedString& uniform, GLint v) void LLGLSLShader::uniform1iv(const LLStaticHashedString& uniform, U32 count, const GLint* v) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; GLint location = getUniformLocation(uniform); if (location >= 0) @@ -1587,6 +1610,7 @@ void LLGLSLShader::uniform1iv(const LLStaticHashedString& uniform, U32 count, co void LLGLSLShader::uniform4iv(const LLStaticHashedString& uniform, U32 count, const GLint* v) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; GLint location = getUniformLocation(uniform); if (location >= 0) @@ -1604,6 +1628,7 @@ void LLGLSLShader::uniform4iv(const LLStaticHashedString& uniform, U32 count, co void LLGLSLShader::uniform2i(const LLStaticHashedString& uniform, GLint i, GLint j) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; GLint location = getUniformLocation(uniform); if (location >= 0) @@ -1621,6 +1646,7 @@ void LLGLSLShader::uniform2i(const LLStaticHashedString& uniform, GLint i, GLint void LLGLSLShader::uniform1f(const LLStaticHashedString& uniform, GLfloat v) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; GLint location = getUniformLocation(uniform); if (location >= 0) @@ -1637,6 +1663,7 @@ void LLGLSLShader::uniform1f(const LLStaticHashedString& uniform, GLfloat v) void LLGLSLShader::uniform2f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; GLint location = getUniformLocation(uniform); if (location >= 0) @@ -1654,6 +1681,7 @@ void LLGLSLShader::uniform2f(const LLStaticHashedString& uniform, GLfloat x, GLf void LLGLSLShader::uniform3f(const LLStaticHashedString& uniform, GLfloat x, GLfloat y, GLfloat z) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; GLint location = getUniformLocation(uniform); if (location >= 0) @@ -1670,6 +1698,7 @@ void LLGLSLShader::uniform3f(const LLStaticHashedString& uniform, GLfloat x, GLf void LLGLSLShader::uniform1fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; GLint location = getUniformLocation(uniform); if (location >= 0) @@ -1686,6 +1715,7 @@ void LLGLSLShader::uniform1fv(const LLStaticHashedString& uniform, U32 count, co void LLGLSLShader::uniform2fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; GLint location = getUniformLocation(uniform); if (location >= 0) @@ -1702,6 +1732,7 @@ void LLGLSLShader::uniform2fv(const LLStaticHashedString& uniform, U32 count, co void LLGLSLShader::uniform3fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; GLint location = getUniformLocation(uniform); if (location >= 0) @@ -1718,6 +1749,7 @@ void LLGLSLShader::uniform3fv(const LLStaticHashedString& uniform, U32 count, co void LLGLSLShader::uniform4fv(const LLStaticHashedString& uniform, U32 count, const GLfloat* v) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; GLint location = getUniformLocation(uniform); if (location >= 0) @@ -1735,6 +1767,7 @@ void LLGLSLShader::uniform4fv(const LLStaticHashedString& uniform, U32 count, co void LLGLSLShader::uniformMatrix4fv(const LLStaticHashedString& uniform, U32 count, GLboolean transpose, const GLfloat* v) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; GLint location = getUniformLocation(uniform); if (location >= 0) @@ -1764,6 +1797,7 @@ void LLGLSLShader::vertexAttrib4fv(U32 index, GLfloat* v) void LLGLSLShader::setMinimumAlpha(F32 minimum) { + LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; gGL.flush(); uniform1f(LLShaderMgr::MINIMUM_ALPHA, minimum); } |