diff options
| author | mobserveur <mobserveur@gmail.com> | 2026-08-25 12:34:13 +0200 |
|---|---|---|
| committer | mobserveur <mobserveur@gmail.com> | 2026-08-25 12:34:13 +0200 |
| commit | fb2376983a87711b0c01a8ac9ad29b8cf8079249 (patch) | |
| tree | 60f091e5138acb4bbd5cb399f2cbf281e94a4b98 /indra/llrender/llglslshader.cpp | |
| parent | ba4911d87bb833572b46dd1d6f38264f4c561662 (diff) | |
optimisations related to llvertexbuffer
this commit includes some optimisations related to the llvertextbuffer and is closer to LL code in that regard. It also removes the alternative vertexbuffer mode.
Diffstat (limited to 'indra/llrender/llglslshader.cpp')
| -rw-r--r-- | indra/llrender/llglslshader.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 39bd9cbfed..7ec23f5da0 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -1098,7 +1098,14 @@ void LLGLSLShader::bind() { sCurBoundShaderPtr->readProfileQuery(); } - LLVertexBuffer::unbind(); + // Apple's OpenGL-on-Metal layer pays a high price for rebinding buffer + // objects on every shader transition. LLVertexBuffer tracks the + // attribute formats needed by the new shader, so the current buffer + // can remain bound until a draw actually selects a different one. + if (!gGLManager.mIsApple) + { + LLVertexBuffer::unbind(); + } glUseProgram(mProgramObject); sCurBoundShader = mProgramObject; sCurBoundShaderPtr = this; @@ -1194,22 +1201,22 @@ S32 LLGLSLShader::bindTexture(S32 uniform, LLRenderTarget* texture, bool depth, return -1; } - S32 channel = getTextureChannel(uniform); + uniform = getTextureChannel(uniform); - if (channel > -1) + if (uniform > -1) { if (depth) { - gGL.getTexUnit(channel)->bind(texture, true); + gGL.getTexUnit(uniform)->bind(texture, true); } else { bool has_mips = mode == LLTexUnit::TFO_TRILINEAR || mode == LLTexUnit::TFO_ANISOTROPIC; - gGL.getTexUnit(channel)->bindManual(texture->getUsage(), texture->getTexture(index), has_mips); + gGL.getTexUnit(uniform)->bindManual(texture->getUsage(), texture->getTexture(index), has_mips); } - gGL.getTexUnit(channel)->setTextureFilteringOption(mode); + gGL.getTexUnit(uniform)->setTextureFilteringOption(mode); } - return channel; + return uniform; } S32 LLGLSLShader::bindTexture(const std::string& uniform, LLRenderTarget* texture, bool depth, LLTexUnit::eTextureFilterOptions mode) |
