summaryrefslogtreecommitdiff
path: root/indra/llrender
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-10-21 16:40:22 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-10-21 18:19:27 +0300
commit24fb2f83362f3aaffed42360f750bc4c82037c39 (patch)
tree59fe52d1791350c66b9e9b1d5d5c2cea6e29558e /indra/llrender
parentfd751f4e99557f4d1ef9cbdc4ab7b7a765b563d1 (diff)
parente45b6159666b3aa271eaaa366fb4bcade2c2a28b (diff)
Merge branch 'master' (DRTVWR-548) into DRTVWR-559
# Conflicts: # indra/llrender/llgl.cpp # indra/llrender/llrendertarget.cpp # indra/newview/VIEWER_VERSION.txt # indra/newview/app_settings/shaders/class1/deferred/materialF.glsl # indra/newview/llfloaterpreference.cpp # indra/newview/llviewercontrol.cpp # indra/newview/llviewermenu.cpp # indra/newview/llviewertexturelist.cpp # indra/newview/llvovolume.cpp
Diffstat (limited to 'indra/llrender')
-rw-r--r--indra/llrender/llgl.cpp6
-rw-r--r--indra/llrender/llimagegl.cpp2
-rw-r--r--indra/llrender/llrender.cpp77
-rw-r--r--indra/llrender/llrender.h4
-rw-r--r--indra/llrender/llvertexbuffer.cpp2
-rw-r--r--indra/llrender/llvertexbuffer.h1
6 files changed, 57 insertions, 35 deletions
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 9ea6bfdb4e..e15157af05 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -1206,14 +1206,14 @@ bool LLGLManager::initGL()
stop_glerror();
glGetIntegerv(GL_MAX_SAMPLES, &mMaxSamples);
stop_glerror();
+
if (mGLVersion >= 4.59f)
{
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY, &mMaxAnisotropy);
+ stop_glerror();
}
- stop_glerror();
-
- initGLStates();
+ initGLStates();
stop_glerror();
return true;
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 01bd4aba26..d16757d0ed 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -2421,7 +2421,7 @@ void LLImageGLThread::run()
// We must perform setup on this thread before actually servicing our
// WorkQueue, likewise cleanup afterwards.
mWindow->makeContextCurrent(mContext);
- gGL.init();
+ gGL.init(false);
ThreadPool::run();
gGL.shutdown();
mWindow->destroySharedContext(mContext);
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 409b03f425..39e3a0243c 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -857,7 +857,7 @@ LLRender::~LLRender()
shutdown();
}
-void LLRender::init()
+void LLRender::init(bool needs_vertex_buffer)
{
#if LL_WINDOWS
if (gGLManager.mHasDebugOutput && gDebugGL)
@@ -886,15 +886,27 @@ void LLRender::init()
glBindVertexArray(ret);
}
+ if (needs_vertex_buffer)
+ {
+ initVertexBuffer();
+ }
+}
- llassert_always(mBuffer.isNull()) ;
- stop_glerror();
- mBuffer = new LLVertexBuffer(immediate_mask, 0);
- mBuffer->allocateBuffer(4096, 0, TRUE);
- mBuffer->getVertexStrider(mVerticesp);
- mBuffer->getTexCoord0Strider(mTexcoordsp);
- mBuffer->getColorStrider(mColorsp);
- stop_glerror();
+void LLRender::initVertexBuffer()
+{
+ llassert_always(mBuffer.isNull());
+ stop_glerror();
+ mBuffer = new LLVertexBuffer(immediate_mask, 0);
+ mBuffer->allocateBuffer(4096, 0, TRUE);
+ mBuffer->getVertexStrider(mVerticesp);
+ mBuffer->getTexCoord0Strider(mTexcoordsp);
+ mBuffer->getColorStrider(mColorsp);
+ stop_glerror();
+}
+
+void LLRender::resetVertexBuffer()
+{
+ mBuffer = NULL;
}
void LLRender::shutdown()
@@ -912,7 +924,7 @@ void LLRender::shutdown()
delete mLightState[i];
}
mLightState.clear();
- mBuffer = NULL ;
+ resetVertexBuffer();
}
void LLRender::refreshState(void)
@@ -1613,25 +1625,34 @@ void LLRender::flush()
mCount = 0;
- if (mBuffer->useVBOs() && !mBuffer->isLocked())
- { //hack to only flush the part of the buffer that was updated (relies on stream draw using buffersubdata)
- mBuffer->getVertexStrider(mVerticesp, 0, count);
- mBuffer->getTexCoord0Strider(mTexcoordsp, 0, count);
- mBuffer->getColorStrider(mColorsp, 0, count);
- }
-
- mBuffer->flush();
- mBuffer->setBuffer(immediate_mask);
+ if (mBuffer)
+ {
+ if (mBuffer->useVBOs() && !mBuffer->isLocked())
+ { //hack to only flush the part of the buffer that was updated (relies on stream draw using buffersubdata)
+ mBuffer->getVertexStrider(mVerticesp, 0, count);
+ mBuffer->getTexCoord0Strider(mTexcoordsp, 0, count);
+ mBuffer->getColorStrider(mColorsp, 0, count);
+ }
+
+ mBuffer->flush();
+ mBuffer->setBuffer(immediate_mask);
+
+ if (mMode == LLRender::QUADS && sGLCoreProfile)
+ {
+ mBuffer->drawArrays(LLRender::TRIANGLES, 0, count);
+ mQuadCycle = 1;
+ }
+ else
+ {
+ mBuffer->drawArrays(mMode, 0, count);
+ }
+ }
+ else
+ {
+ // mBuffer is present in main thread and not present in an image thread
+ LL_ERRS() << "A flush call from outside main rendering thread" << LL_ENDL;
+ }
- if (mMode == LLRender::QUADS && sGLCoreProfile)
- {
- mBuffer->drawArrays(LLRender::TRIANGLES, 0, count);
- mQuadCycle = 1;
- }
- else
- {
- mBuffer->drawArrays(mMode, 0, count);
- }
mVerticesp[0] = mVerticesp[count];
mTexcoordsp[0] = mTexcoordsp[count];
diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h
index 3e4a1fe933..6dd5f9601e 100644
--- a/indra/llrender/llrender.h
+++ b/indra/llrender/llrender.h
@@ -359,7 +359,9 @@ public:
LLRender();
~LLRender();
- void init() ;
+ void init(bool needs_vertex_buffer);
+ void initVertexBuffer();
+ void resetVertexBuffer();
void shutdown();
// Refreshes renderer state to the cached values
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 33dcd6c563..f51000b9a6 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -1050,7 +1050,7 @@ void LLVertexBuffer::releaseIndices()
bool LLVertexBuffer::createGLBuffer(U32 size)
{
- if (mGLBuffer)
+ if (mGLBuffer || mMappedData)
{
destroyGLBuffer();
}
diff --git a/indra/llrender/llvertexbuffer.h b/indra/llrender/llvertexbuffer.h
index d6f681e4ca..233d7785f8 100644
--- a/indra/llrender/llvertexbuffer.h
+++ b/indra/llrender/llvertexbuffer.h
@@ -265,7 +265,6 @@ public:
bool getTangentStrider(LLStrider<LLVector3>& strider, S32 index=0, S32 count = -1, bool map_range = false);
bool getTangentStrider(LLStrider<LLVector4a>& strider, S32 index=0, S32 count = -1, bool map_range = false);
bool getColorStrider(LLStrider<LLColor4U>& strider, S32 index=0, S32 count = -1, bool map_range = false);
- bool getTextureIndexStrider(LLStrider<LLColor4U>& strider, S32 index=0, S32 count = -1, bool map_range = false);
bool getEmissiveStrider(LLStrider<LLColor4U>& strider, S32 index=0, S32 count = -1, bool map_range = false);
bool getWeightStrider(LLStrider<F32>& strider, S32 index=0, S32 count = -1, bool map_range = false);
bool getWeight4Strider(LLStrider<LLVector4>& strider, S32 index=0, S32 count = -1, bool map_range = false);